@wise/dynamic-flow-client 4.3.13 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +439 -311
- package/build/main.mjs +439 -311
- package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -14
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ListComponent.d.ts +3 -16
- package/build/types/revamp/domain/components/ModalContentComponent.d.ts +11 -0
- package/build/types/revamp/domain/components/MultiSelectInputComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/RepeatableComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/RootDomainComponent.d.ts +7 -2
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/StepDomainComponent.d.ts +6 -0
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +3 -3
- package/build/types/revamp/domain/components/utils/WithUpdate.d.ts +4 -0
- package/build/types/revamp/domain/components/utils/component-utils.d.ts +2 -6
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +7 -6
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +2 -2
- package/build/types/revamp/domain/features/validationAsync/getComponentValidationAsync.d.ts +5 -5
- package/build/types/revamp/domain/mappers/layout/modalToContent.d.ts +4 -0
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -1
- package/build/types/revamp/domain/mappers/utils/call-to-action-utils.d.ts +1 -13
- package/build/types/revamp/domain/types.d.ts +17 -6
- package/build/types/revamp/flow/executeSubmission.d.ts +4 -0
- package/build/types/revamp/flow/getResponseType.d.ts +1 -1
- package/build/types/revamp/flow/response-utils.d.ts +2 -1
- package/build/types/revamp/renderers/mappers/modalContentComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/package.json +10 -10
- package/build/types/revamp/utils/findComponent.d.ts +0 -3
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import type { Context, LayoutComponent } from '../types';
|
|
1
|
+
import type { CallToAction, Context, LayoutComponent } from '../types';
|
|
2
2
|
export type AlertComponent = LayoutComponent & {
|
|
3
3
|
type: 'alert';
|
|
4
4
|
markdown: string;
|
|
5
5
|
context: Context;
|
|
6
|
-
callToAction?:
|
|
7
|
-
};
|
|
8
|
-
export type AlertCallToActionLink = {
|
|
9
|
-
type: 'link';
|
|
10
|
-
accessibilityDescription?: string;
|
|
11
|
-
href: string;
|
|
12
|
-
title: string;
|
|
13
|
-
};
|
|
14
|
-
export type AlertCallToAction = {
|
|
15
|
-
type: 'action';
|
|
16
|
-
accessibilityDescription?: string;
|
|
17
|
-
title: string;
|
|
18
|
-
onClick: () => void;
|
|
6
|
+
callToAction?: CallToAction;
|
|
19
7
|
};
|
|
20
8
|
export declare const createAlertComponent: (alertProps: Pick<AlertComponent, "uid" | "callToAction" | "context" | "control" | "margin" | "markdown">) => AlertComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
2
|
-
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
-
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
|
|
4
2
|
import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
3
|
+
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
5
4
|
import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
|
|
5
|
+
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
|
|
6
6
|
export type DateInputComponent = InputComponent<string | null> & {
|
|
7
7
|
type: 'date';
|
|
8
8
|
minimumDate?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
|
|
2
|
-
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
1
|
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
4
2
|
import { type PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
3
|
+
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
5
4
|
import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
|
|
5
|
+
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
|
|
6
6
|
export type IntegerInputComponent = InputComponent<number | null> & {
|
|
7
7
|
type: 'integer';
|
|
8
8
|
maximum?: number;
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import { Icon } from
|
|
2
|
-
import { Image, LayoutComponent } from
|
|
1
|
+
import { Icon } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import { CallToAction, Image, LayoutComponent } from '../types';
|
|
3
3
|
export type ListComponent = LayoutComponent & {
|
|
4
4
|
type: 'list';
|
|
5
5
|
items: ListItem[];
|
|
6
6
|
title?: string;
|
|
7
|
-
callToAction?:
|
|
8
|
-
};
|
|
9
|
-
export type ListCallToActionLink = {
|
|
10
|
-
type: 'link';
|
|
11
|
-
accessibilityDescription?: string;
|
|
12
|
-
href: string;
|
|
13
|
-
title: string;
|
|
14
|
-
onClick: () => void;
|
|
15
|
-
};
|
|
16
|
-
export type ListCallToActionAction = {
|
|
17
|
-
type: 'action';
|
|
18
|
-
accessibilityDescription?: string;
|
|
19
|
-
title: string;
|
|
20
|
-
onClick: () => void;
|
|
7
|
+
callToAction?: CallToAction;
|
|
21
8
|
};
|
|
22
9
|
export type ListItem = {
|
|
23
10
|
icon?: Icon;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DomainComponent, BaseComponent, LocalValue, UpdateComponent } from '../types';
|
|
2
|
+
export type ModalContentComponent = BaseComponent & {
|
|
3
|
+
type: 'modal-content';
|
|
4
|
+
components: DomainComponent[];
|
|
5
|
+
open: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
getChildren: () => DomainComponent[];
|
|
8
|
+
getLocalValue: () => LocalValue;
|
|
9
|
+
close: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const createModalContentComponent: (modalProps: Pick<ModalContentComponent, "uid" | "components" | "title">, updateComponent: UpdateComponent) => ModalContentComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
2
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
3
|
import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
|
|
4
|
-
import type { InputComponent, LocalValue,
|
|
4
|
+
import type { DomainComponent, InputComponent, LocalValue, LocalValueArray, OnValueChange, UpdateComponent, ValidationAsyncState } from '../types';
|
|
5
5
|
import type { SelectInputOption } from './SelectInputComponent';
|
|
6
6
|
export type MultiSelectComponent = InputComponent<LocalValueArray | null> & {
|
|
7
7
|
type: 'multi-select';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { JsonElement } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
1
3
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
2
4
|
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, UploadSource } from '../types';
|
|
3
|
-
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
4
|
-
import { JsonElement } from '@wise/dynamic-flow-types/build/next';
|
|
5
5
|
export type MultiUploadInputComponent = InputComponent<File[]> & {
|
|
6
6
|
type: 'multi-upload';
|
|
7
7
|
accepts?: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ComponentWithTitle, LocalValue, LocalValueArray, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange, Image } from '../types';
|
|
2
|
-
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
1
|
import { Icon } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
+
import type { ComponentWithTitle, DomainComponent, Image, LocalValue, LocalValueArray, OnValueChange, RepeatableSummary, UpdateComponent } from '../types';
|
|
4
4
|
export type RepeatableComponent = ComponentWithTitle & {
|
|
5
5
|
type: 'repeatable';
|
|
6
6
|
id?: string;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { AnalyticsEventDispatcher } from '../features/events';
|
|
2
|
-
import { BaseComponent, DomainComponent, LoadingState, LocalValue } from '../types';
|
|
2
|
+
import { BaseComponent, DomainComponent, LoadingState, LocalValue, UpdateComponent } from '../types';
|
|
3
3
|
import { StepDomainComponent } from './StepDomainComponent';
|
|
4
|
+
import { ModalContentComponent } from './ModalContentComponent';
|
|
4
5
|
export type RootDomainComponent = BaseComponent & {
|
|
5
6
|
type: 'root';
|
|
6
7
|
stepComponent: StepDomainComponent | null;
|
|
8
|
+
dismissAllModals: () => void;
|
|
9
|
+
dismissModal: () => void;
|
|
10
|
+
showModal: (modal: ModalContentComponent) => void;
|
|
7
11
|
getChildren: () => DomainComponent[];
|
|
8
12
|
getLocalValue: () => LocalValue;
|
|
9
13
|
getLoadingState: () => LoadingState;
|
|
@@ -11,5 +15,6 @@ export type RootDomainComponent = BaseComponent & {
|
|
|
11
15
|
setLoadingState: (loadingState: LoadingState) => void;
|
|
12
16
|
hasStep: () => boolean;
|
|
13
17
|
stop: () => void;
|
|
18
|
+
setStep: (stepComponent: StepDomainComponent) => void;
|
|
14
19
|
};
|
|
15
|
-
export declare const createRootDomainComponent: () => RootDomainComponent;
|
|
20
|
+
export declare const createRootDomainComponent: (updateComponent: UpdateComponent) => RootDomainComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Icon, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import type { InputComponent, LocalValue, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange, Image } from '../types';
|
|
3
|
-
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
4
2
|
import type { AnalyticsEventDispatcher } from '../features/events';
|
|
5
3
|
import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
4
|
+
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
5
|
+
import type { DomainComponent, Image, InputComponent, LocalValue, OnValueChange, RepeatableSummary, UpdateComponent } from '../types';
|
|
6
6
|
export type SelectInputComponent = InputComponent<LocalValue | null> & {
|
|
7
7
|
type: 'select';
|
|
8
8
|
selectedIndex: number | null;
|
|
@@ -3,6 +3,7 @@ import type { Step } from '@wise/dynamic-flow-types/build/next';
|
|
|
3
3
|
import type { AnalyticsEventDispatcher } from '../features/events';
|
|
4
4
|
import type { StepPolling } from '../features/polling/getStepPolling';
|
|
5
5
|
import { StepRefreshAfter } from '../features/refreshAfter/getStepRefreshAfter';
|
|
6
|
+
import { ModalContentComponent } from './ModalContentComponent';
|
|
6
7
|
export type StepDomainComponent = BaseComponent & {
|
|
7
8
|
type: 'step';
|
|
8
9
|
back?: BackNavigation;
|
|
@@ -14,7 +15,12 @@ export type StepDomainComponent = BaseComponent & {
|
|
|
14
15
|
loadingState: LoadingState;
|
|
15
16
|
step: Step;
|
|
16
17
|
title?: string;
|
|
18
|
+
modals: ModalContentComponent[];
|
|
19
|
+
dismissModal: () => void;
|
|
20
|
+
dismissAllModals: () => void;
|
|
21
|
+
showModal: (modal: ModalContentComponent) => void;
|
|
17
22
|
getChildren: () => DomainComponent[];
|
|
23
|
+
getModals: () => ModalContentComponent[];
|
|
18
24
|
getLocalValue: () => LocalValue;
|
|
19
25
|
setLoadingState: (loadingState: LoadingState) => void;
|
|
20
26
|
onBehavior: OnBehavior;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, UploadSource } from '../types';
|
|
1
|
+
import { JsonElement } from '@wise/dynamic-flow-types/build/next';
|
|
3
2
|
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
4
3
|
import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
5
|
-
import {
|
|
4
|
+
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
5
|
+
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, UploadSource } from '../types';
|
|
6
6
|
export type UploadInputComponent = InputComponent<File | null> & {
|
|
7
7
|
type: 'upload';
|
|
8
8
|
format: 'blob' | 'base64';
|
|
@@ -2,11 +2,7 @@ import type { DomainComponent, UpdateComponent } from '../../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to update a component.
|
|
4
4
|
*
|
|
5
|
-
* `updateComponent` is generic, meaning we have to specify the type of the draft whenever we use it. This function takes
|
|
6
|
-
* the component uid and type, and returns a typed function that will update the component without the need to type assert.
|
|
7
|
-
*
|
|
8
|
-
* @param uid uid of the component
|
|
9
5
|
* @param updateComponent the updateComponent function that will update the component with the given uid
|
|
10
|
-
* @returns a function that accepts a function that will update the component
|
|
6
|
+
* @returns a function that accepts a component and returns a function that takes a function that will update the component and call `updateComponent` to notify that there has been a change.
|
|
11
7
|
*/
|
|
12
|
-
export declare const getInputUpdateFunction: <C extends DomainComponent>(
|
|
8
|
+
export declare const getInputUpdateFunction: <C extends DomainComponent>(updateComponent: UpdateComponent) => (component: C, updateFn: (component: C) => void) => void;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import type { getInputUpdateFunction } from '../../components/utils/component-utils';
|
|
2
|
-
import type { PerformPersistAsync } from './getPerformPersistAsync';
|
|
3
1
|
import type { BooleanInputComponent } from '../../components/BooleanInputComponent';
|
|
4
2
|
import type { DateInputComponent } from '../../components/DateInputComponent';
|
|
5
3
|
import type { IntegerInputComponent } from '../../components/IntegerInputComponent';
|
|
4
|
+
import type { MultiUploadInputComponent } from '../../components/MultiUploadInputComponent';
|
|
6
5
|
import type { NumberInputComponent } from '../../components/NumberInputComponent';
|
|
7
6
|
import type { TextInputComponent } from '../../components/TextInputComponent';
|
|
8
7
|
import type { UploadInputComponent } from '../../components/UploadInputComponent';
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
8
|
+
import type { LocalValue } from '../../types';
|
|
9
|
+
import type { PerformPersistAsync } from './getPerformPersistAsync';
|
|
11
10
|
type Persistable = BooleanInputComponent | DateInputComponent | IntegerInputComponent | NumberInputComponent | TextInputComponent | UploadInputComponent;
|
|
11
|
+
type Update<C extends Persistable> = (component: C, updateFn: (component: C) => void) => void;
|
|
12
12
|
/**
|
|
13
13
|
* Creates an onPersistAsync handler for a component.
|
|
14
14
|
*/
|
|
15
|
-
export declare const getComponentPersistAsync: (update:
|
|
15
|
+
export declare const getComponentPersistAsync: <C extends Persistable>(update: Update<C>, performPersistAsync: PerformPersistAsync) => (component: C, currentValue: LocalValue) => Promise<import("@wise/dynamic-flow-types/build/next").JsonElement>;
|
|
16
|
+
type UpdateMultiUploadInputComponent = (component: MultiUploadInputComponent, updateFn: (component: MultiUploadInputComponent) => void) => void;
|
|
16
17
|
/**
|
|
17
18
|
* Creates an onPersistAsync handler for a component.
|
|
18
19
|
*/
|
|
19
|
-
export declare const getComponentMultiPersistAsync: (update:
|
|
20
|
+
export declare const getComponentMultiPersistAsync: (update: UpdateMultiUploadInputComponent, performPersistAsync: PerformPersistAsync) => (component: MultiUploadInputComponent, index: number, value: LocalValue) => Promise<string | number | boolean | import("@wise/dynamic-flow-types/build/next").JsonObject | import("@wise/dynamic-flow-types/build/next").JsonArray | null>;
|
|
20
21
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { JsonElement } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import type { PersistAsyncConfig } from '../../mappers/types';
|
|
3
2
|
import type { HttpClient } from '../../../types';
|
|
4
|
-
import type {
|
|
3
|
+
import type { PersistAsyncConfig } from '../../mappers/types';
|
|
5
4
|
import type { LocalValue } from '../../types';
|
|
5
|
+
import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../events';
|
|
6
6
|
export type PerformPersistAsync = (props: PersistAsyncProps) => Promise<JsonElement>;
|
|
7
7
|
type PersistAsyncProps = {
|
|
8
8
|
value: LocalValue;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { getInputUpdateFunction } from '../../components/utils/component-utils';
|
|
2
|
-
import type { PerformValidationAsync } from './getPerformValidationAsync';
|
|
3
1
|
import type { BooleanInputComponent } from '../../components/BooleanInputComponent';
|
|
4
2
|
import type { DateInputComponent } from '../../components/DateInputComponent';
|
|
5
3
|
import type { IntegerInputComponent } from '../../components/IntegerInputComponent';
|
|
6
4
|
import type { MultiSelectComponent } from '../../components/MultiSelectInputComponent';
|
|
7
5
|
import type { NumberInputComponent } from '../../components/NumberInputComponent';
|
|
8
6
|
import type { TextInputComponent } from '../../components/TextInputComponent';
|
|
9
|
-
import type { LocalValue
|
|
7
|
+
import type { LocalValue } from '../../types';
|
|
8
|
+
import type { PerformValidationAsync } from './getPerformValidationAsync';
|
|
10
9
|
type Validatable = BooleanInputComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | NumberInputComponent | TextInputComponent;
|
|
10
|
+
type Update<C extends Validatable> = (component: C, updateFn: (component: C) => void) => void;
|
|
11
11
|
/**
|
|
12
12
|
* Creates an onValidateAsync handler for a component.
|
|
13
13
|
*/
|
|
14
|
-
export declare const getComponentValidationAsync: (update:
|
|
15
|
-
export declare const getDebouncedComponentValidationAsync: (update:
|
|
14
|
+
export declare const getComponentValidationAsync: <C extends Validatable>(update: Update<C>, performValidationAsync: PerformValidationAsync) => (component: C, currentValue: LocalValue) => Promise<string | null | undefined>;
|
|
15
|
+
export declare const getDebouncedComponentValidationAsync: <C extends Validatable>(update: Update<C>, performValidationAsync: PerformValidationAsync) => import("../../components/utils/debounce").DebouncedFunc<(component: C, currentValue: LocalValue) => Promise<string | null | undefined>>;
|
|
16
16
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ModalBehavior } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import { MapperProps } from '../schema/types';
|
|
3
|
+
import { ModalContentComponent } from '../../components/ModalContentComponent';
|
|
4
|
+
export declare const modalToContent: (uid: string, { content, title }: ModalBehavior, mapperProps: MapperProps) => ModalContentComponent;
|
|
@@ -31,4 +31,4 @@ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperPr
|
|
|
31
31
|
};
|
|
32
32
|
export declare const getMockRendererMapperProps: () => RendererMapperProps;
|
|
33
33
|
export declare const mockUpdateFunction: <C extends DomainComponent>(draftComponent: C) => jest.Mock<any, any, any>;
|
|
34
|
-
export declare const getUpdateFunctionMock: <C extends DomainComponent>(getComponent: () => C) => jest.Mock<void, [
|
|
34
|
+
export declare const getUpdateFunctionMock: <C extends DomainComponent>(getComponent: () => C) => jest.Mock<void, [], any>;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import { OnBehavior } from '../../types';
|
|
3
|
-
type CallToAction = {
|
|
4
|
-
type: 'action';
|
|
5
|
-
title: string;
|
|
6
|
-
accessibilityDescription?: string;
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
} | {
|
|
9
|
-
type: 'link';
|
|
10
|
-
title: string;
|
|
11
|
-
accessibilityDescription?: string;
|
|
12
|
-
href: string;
|
|
13
|
-
onClick: () => void;
|
|
14
|
-
};
|
|
2
|
+
import { CallToAction, OnBehavior } from '../../types';
|
|
15
3
|
type SpecCallToAction = {
|
|
16
4
|
title?: string;
|
|
17
5
|
accessibilityDescription?: string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Action, Icon, JsonElement, Margin, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
-
import type { ActionBehavior } from '@wise/dynamic-flow-types/build/next/feature/ActionBehavior';
|
|
3
|
-
import type { LinkBehavior } from '@wise/dynamic-flow-types/build/next/feature/LinkBehavior';
|
|
1
|
+
import type { Action, Icon, JsonElement, Margin, Model, ActionBehavior, LinkBehavior, DismissBehavior, ModalBehavior } from '@wise/dynamic-flow-types/build/next';
|
|
4
2
|
import type { AlertComponent } from './components/AlertComponent';
|
|
5
3
|
import type { AllOfComponent } from './components/AllOfComponent';
|
|
6
4
|
import type { BooleanInputComponent } from './components/BooleanInputComponent';
|
|
@@ -36,14 +34,27 @@ import type { StepDomainComponent } from './components/StepDomainComponent';
|
|
|
36
34
|
import type { TextInputComponent } from './components/TextInputComponent';
|
|
37
35
|
import type { TupleComponent } from './components/TupleComponent';
|
|
38
36
|
import type { UploadInputComponent } from './components/UploadInputComponent';
|
|
39
|
-
|
|
37
|
+
import { ModalContentComponent } from './components/ModalContentComponent';
|
|
38
|
+
export type DomainComponent = RootDomainComponent | StepDomainComponent | AlertComponent | AllOfComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ConstComponent | ContainerComponent | DateInputComponent | DecisionComponent | DividerComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | IntegerInputComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalComponent | ModalContentComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | ReviewComponent | SearchComponent | SelectInputComponent | StatusListComponent | TextInputComponent | TupleComponent | UploadInputComponent;
|
|
40
39
|
export type LocalValue = LocalValuePrimitive | LocalValueObject | LocalValueArray;
|
|
41
40
|
export type LocalValuePrimitive = string | number | boolean | File | null;
|
|
42
41
|
export interface LocalValueObject extends Record<string, LocalValuePrimitive | LocalValueObject | LocalValueArray> {
|
|
43
42
|
}
|
|
44
43
|
export interface LocalValueArray extends Array<LocalValuePrimitive | LocalValueObject | LocalValueArray> {
|
|
45
44
|
}
|
|
46
|
-
export type
|
|
45
|
+
export type CallToAction = {
|
|
46
|
+
type: 'action' | 'modal' | 'dismiss';
|
|
47
|
+
title: string;
|
|
48
|
+
accessibilityDescription?: string;
|
|
49
|
+
onClick: () => void;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'link';
|
|
52
|
+
title: string;
|
|
53
|
+
accessibilityDescription?: string;
|
|
54
|
+
href: string;
|
|
55
|
+
onClick: () => void;
|
|
56
|
+
};
|
|
57
|
+
export type Behavior = ActionBehavior | LinkBehavior | ModalBehavior | DismissBehavior | {
|
|
47
58
|
type: 'none';
|
|
48
59
|
};
|
|
49
60
|
export type BaseComponent = {
|
|
@@ -88,7 +99,7 @@ export type InputComponent<V extends LocalValue> = ComponentWithTitle & {
|
|
|
88
99
|
onFocus: () => void;
|
|
89
100
|
getLocalValue: () => V;
|
|
90
101
|
};
|
|
91
|
-
export type UpdateComponent = (
|
|
102
|
+
export type UpdateComponent = () => void;
|
|
92
103
|
export type OnBehavior = (behavior: Behavior) => Promise<void>;
|
|
93
104
|
export type OnAction = (action: Action) => Promise<void>;
|
|
94
105
|
export type OnRefresh = (schemaId: string | undefined, url?: string) => Promise<void> | void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Action, ErrorResponseBody, Model, Step } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
|
|
3
|
+
import type { Behavior } from '../domain/types';
|
|
3
4
|
type Command = {
|
|
4
5
|
type: 'complete';
|
|
5
6
|
result: Model;
|
|
@@ -20,6 +21,9 @@ type Command = {
|
|
|
20
21
|
refreshUrl: string;
|
|
21
22
|
errors?: Step['errors'];
|
|
22
23
|
};
|
|
24
|
+
} | {
|
|
25
|
+
type: 'behavior';
|
|
26
|
+
behavior: Behavior;
|
|
23
27
|
};
|
|
24
28
|
export declare const executeSubmission: (props: {
|
|
25
29
|
action: Action;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const responseTypes: readonly ["step", "action", "exit"];
|
|
1
|
+
declare const responseTypes: readonly ["step", "action", "exit", "modal"];
|
|
2
2
|
export type ResponseType = (typeof responseTypes)[number];
|
|
3
3
|
/**
|
|
4
4
|
* Returns either 'step', 'action', or 'exit' based on the response headers and body.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ActionResponseBody, ErrorResponseBody, JsonElement, Step } from '@wise/dynamic-flow-types/build/next';
|
|
1
|
+
import type { ActionResponseBody, ErrorResponseBody, JsonElement, ModalBehavior, Step } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
export declare const assertResponseIsValid: (response: unknown) => void;
|
|
3
3
|
export declare const parseResponseBodyAsJsonElement: (response: Response) => Promise<JsonElement>;
|
|
4
4
|
export declare function isActionResponseBody(body: unknown): body is ActionResponseBody;
|
|
5
5
|
export declare function assertActionResponseBody(body: unknown): asserts body is ActionResponseBody;
|
|
6
|
+
export declare function assertModalResponseBody(body: unknown): asserts body is Omit<ModalBehavior, 'type'>;
|
|
6
7
|
export declare function isErrorResponseBody(body: unknown): body is ErrorResponseBody;
|
|
7
8
|
export declare function assertErrorResponseBody(body: unknown): asserts body is ErrorResponseBody;
|
|
8
9
|
export declare function assertStepResponseBody(body: unknown): asserts body is Step;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ModalContentRendererProps } from '@wise/dynamic-flow-types/build/renderers';
|
|
2
|
+
import { ModalContentComponent } from '../../domain/components/ModalContentComponent';
|
|
3
|
+
import { RendererMapperProps } from './componentToRendererProps';
|
|
4
|
+
export declare const modalContentComponentToProps: (component: ModalContentComponent, rendererMapperProps: RendererMapperProps) => ModalContentRendererProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { StepRendererProps } from '@wise/dynamic-flow-types/build/renderers';
|
|
2
2
|
import type { StepDomainComponent } from '../domain/components/StepDomainComponent';
|
|
3
3
|
import { type RendererMapperProps } from './mappers/componentToRendererProps';
|
|
4
|
-
export declare const stepComponentToProps: (
|
|
4
|
+
export declare const stepComponentToProps: (component: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@babel/preset-react": "7.26.3",
|
|
38
38
|
"@babel/preset-typescript": "7.27.0",
|
|
39
39
|
"@chromatic-com/storybook": "3.2.6",
|
|
40
|
-
"@formatjs/cli": "^6.6.
|
|
40
|
+
"@formatjs/cli": "^6.6.4",
|
|
41
41
|
"@storybook/addon-a11y": "^8.6.12",
|
|
42
42
|
"@storybook/addon-actions": "^8.6.12",
|
|
43
43
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"@testing-library/jest-dom": "6.6.3",
|
|
54
54
|
"@testing-library/react": "16.3.0",
|
|
55
55
|
"@testing-library/user-event": "14.6.1",
|
|
56
|
-
"@transferwise/components": "46.
|
|
56
|
+
"@transferwise/components": "46.96.0",
|
|
57
57
|
"@transferwise/formatting": "^2.13.1",
|
|
58
|
-
"@transferwise/icons": "3.
|
|
59
|
-
"@transferwise/neptune-css": "14.24.
|
|
60
|
-
"@types/node": "22.
|
|
58
|
+
"@transferwise/icons": "3.20.0",
|
|
59
|
+
"@transferwise/neptune-css": "14.24.2",
|
|
60
|
+
"@types/node": "22.15.3",
|
|
61
61
|
"@types/jest": "29.5.14",
|
|
62
62
|
"@types/react": "18.3.20",
|
|
63
63
|
"@types/react-dom": "18.3.6",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@wise/art": "2.20.0",
|
|
66
66
|
"@wise/components-theming": "^1.6.2",
|
|
67
67
|
"babel-jest": "29.7.0",
|
|
68
|
-
"esbuild": "0.25.
|
|
68
|
+
"esbuild": "0.25.3",
|
|
69
69
|
"jest": "29.7.0",
|
|
70
70
|
"jest-environment-jsdom": "29.7.0",
|
|
71
71
|
"jest-fetch-mock": "^3.0.3",
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
"react-dom": "18.3.1",
|
|
79
79
|
"react-intl": "6.8.9",
|
|
80
80
|
"storybook": "^8.6.12",
|
|
81
|
-
"stylelint": "16.
|
|
81
|
+
"stylelint": "16.19.1",
|
|
82
82
|
"stylelint-config-standard": "36.0.1",
|
|
83
83
|
"stylelint-no-unsupported-browser-features": "8.0.4",
|
|
84
84
|
"stylelint-value-no-unknown-custom-properties": "6.0.1",
|
|
85
85
|
"tsx": "4.19.3",
|
|
86
86
|
"typescript": "5.8.3",
|
|
87
|
-
"webpack": "5.99.
|
|
87
|
+
"webpack": "5.99.7",
|
|
88
88
|
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
89
89
|
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
90
90
|
},
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"classnames": "2.5.1",
|
|
103
103
|
"react-webcam": "^7.2.0",
|
|
104
104
|
"screenfull": "^5.2.0",
|
|
105
|
-
"@wise/dynamic-flow-types": "3.
|
|
105
|
+
"@wise/dynamic-flow-types": "3.2.0"
|
|
106
106
|
},
|
|
107
107
|
"scripts": {
|
|
108
108
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|