@wise/dynamic-flow-client 2.8.8 → 2.8.10

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.
Files changed (52) hide show
  1. package/build/main.js +145 -144
  2. package/build/main.min.js +1 -1
  3. package/build/types/{legacy/layout → common}/icon/FlagIcon.d.ts +1 -1
  4. package/build/types/{legacy/layout → common}/icon/NamedIcon.d.ts +1 -1
  5. package/build/types/legacy/layout/button/DynamicButton.d.ts +3 -3
  6. package/build/types/legacy/layout/icon/DynamicIcon.d.ts +1 -1
  7. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +8 -0
  8. package/build/types/revamp/domain/components/DateInputComponent.d.ts +2 -2
  9. package/build/types/revamp/domain/components/HiddenComponent.d.ts +2 -1
  10. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +2 -2
  11. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +2 -2
  12. package/build/types/revamp/domain/components/ObjectComponent.d.ts +3 -2
  13. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +29 -0
  14. package/build/types/revamp/domain/components/TextInputComponent.d.ts +2 -2
  15. package/build/types/revamp/domain/components/UploadInputComponent.d.ts +2 -2
  16. package/build/types/revamp/domain/components/search/SearchComponent.d.ts +25 -0
  17. package/build/types/revamp/domain/components/utils/debounce.d.ts +6 -0
  18. package/build/types/revamp/domain/components/utils/isModelPartialOf.d.ts +2 -0
  19. package/build/types/revamp/domain/{events → features/events}/getAnalyticsEventDispatcher.d.ts +1 -1
  20. package/build/types/revamp/domain/features/search/getPerformSearchFunction.d.ts +3 -0
  21. package/build/types/revamp/domain/{validation → features/validation}/validateComponents.d.ts +1 -1
  22. package/build/types/revamp/domain/{validation → features/validation}/value-checks.d.ts +1 -1
  23. package/build/types/revamp/domain/mappers/layout/searchLayoutToComponent.d.ts +3 -0
  24. package/build/types/revamp/domain/mappers/schema/booleanSchemaToComponent.d.ts +5 -0
  25. package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +5 -0
  26. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +4 -2
  27. package/build/types/revamp/domain/mappers/schema/types.d.ts +3 -1
  28. package/build/types/revamp/domain/types.d.ts +10 -6
  29. package/build/types/revamp/dynamic-flow-types.d.ts +1 -1
  30. package/build/types/revamp/renderers/mappers/booleanInputComponentToProps.d.ts +3 -0
  31. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +3 -3
  32. package/build/types/revamp/renderers/mappers/searchComponentToProps.d.ts +3 -0
  33. package/build/types/revamp/renderers/mappers/selectInputComponentToProps.d.ts +4 -0
  34. package/build/types/revamp/renderers/types.d.ts +84 -29
  35. package/build/types/revamp/step/Step.d.ts +4 -2
  36. package/build/types/revamp/stories/utils/mockSearchHandler.d.ts +1 -0
  37. package/build/types/revamp/utils/type-utils.d.ts +7 -5
  38. package/build/types/revamp/wise/renderers/BooleanInputRenderer.d.ts +3 -0
  39. package/build/types/revamp/wise/renderers/SearchRenderer.d.ts +14 -0
  40. package/build/types/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.d.ts +2 -0
  41. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.d.ts +3 -0
  42. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.d.ts +2 -0
  43. package/build/types/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.d.ts +2 -0
  44. package/build/types/revamp/wise/renderers/components/icon/DynamicIcon.d.ts +6 -0
  45. package/build/types/revamp/wise/renderers/components/icon/FlagIcon.d.ts +6 -0
  46. package/build/types/revamp/wise/renderers/components/icon/NamedIcon.d.ts +6 -0
  47. package/build/types/test-utils/fetch-utils.d.ts +19 -0
  48. package/package.json +26 -26
  49. /package/build/types/revamp/domain/{events → features/events}/getLogggingEventDispatcher.d.ts +0 -0
  50. /package/build/types/revamp/domain/{events → features/events}/index.d.ts +0 -0
  51. /package/build/types/revamp/domain/{validation → features/validation}/getModelValidationErrors.d.ts +0 -0
  52. /package/build/types/revamp/domain/{validation → features/validation}/spec-utils.d.ts +0 -0
@@ -2,5 +2,5 @@ type Props = {
2
2
  name: string;
3
3
  };
4
4
  export declare const isFlagIcon: (name: string) => boolean;
5
- export declare const FlagIcon: ({ name }: Props) => JSX.Element | null;
5
+ export declare function FlagIcon({ name }: Props): JSX.Element | null;
6
6
  export {};
@@ -2,5 +2,5 @@ type Props = {
2
2
  name: string;
3
3
  };
4
4
  export declare const isNamedIcon: (name: string) => boolean;
5
- export declare const NamedIcon: ({ name }: Props) => JSX.Element | null;
5
+ export declare function NamedIcon({ name }: Props): JSX.Element | null;
6
6
  export {};
@@ -1,7 +1,7 @@
1
- import { ButtonLayout } from '@wise/dynamic-flow-types';
2
- import { CommonLayoutProps } from '../DynamicLayout';
1
+ import type { ButtonLayout } from '@wise/dynamic-flow-types';
2
+ import type { CommonLayoutProps } from '../DynamicLayout';
3
3
  type Props = Omit<CommonLayoutProps, 'submitted' | 'onModelChange' | 'onPersistAsync'> & {
4
4
  component: ButtonLayout;
5
5
  };
6
- declare const DynamicButton: (props: Props) => JSX.Element;
6
+ declare function DynamicButton(props: Props): JSX.Element;
7
7
  export default DynamicButton;
@@ -1,6 +1,6 @@
1
1
  export type Props = {
2
2
  type: string;
3
3
  };
4
- declare const DynamicIcon: ({ type }: Props) => JSX.Element | null;
4
+ declare function DynamicIcon({ type }: Props): JSX.Element | null;
5
5
  export declare function isValidIconName(name: string): boolean;
6
6
  export default DynamicIcon;
@@ -0,0 +1,8 @@
1
+ import type { InputComponent, UpdateComponent } from '../types';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
+ export type BooleanInputComponent = InputComponent<boolean> & {
4
+ type: 'boolean';
5
+ };
6
+ export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "control" | "id" | "errors" | "required" | "value" | "uid"> & {
7
+ checks: IsInvalidCheck<boolean | null>[];
8
+ }, updateComponent: UpdateComponent) => BooleanInputComponent;
@@ -1,10 +1,10 @@
1
1
  import type { InputComponent, UpdateComponent } from '../types';
2
- import type { IsInvalidCheck } from '../validation/value-checks';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  export type DateInputComponent = InputComponent<string> & {
4
4
  type: 'date';
5
5
  minimumDate?: string;
6
6
  maximumDate?: string;
7
7
  };
8
- export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "minimumDate" | "maximumDate" | "uid"> & {
8
+ export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "analyticsId" | "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "minimumDate" | "maximumDate" | "uid"> & {
9
9
  checks: IsInvalidCheck<string | null>[];
10
10
  }, updateComponent: UpdateComponent) => DateInputComponent;
@@ -5,7 +5,8 @@ export type HiddenComponent = BaseComponent<Model> & {
5
5
  };
6
6
  type HiddenProps = {
7
7
  uid: string;
8
+ analyticsId?: string;
8
9
  value: Model;
9
10
  };
10
- export declare const createHiddenComponent: ({ uid, value }: HiddenProps) => HiddenComponent;
11
+ export declare const createHiddenComponent: ({ uid, analyticsId, value, }: HiddenProps) => HiddenComponent;
11
12
  export {};
@@ -1,8 +1,8 @@
1
1
  import type { InputComponent, UpdateComponent } from '../types';
2
- import type { IsInvalidCheck } from '../validation/value-checks';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  export type IntegerInputComponent = InputComponent<number> & {
4
4
  type: 'integer';
5
5
  };
6
- export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
6
+ export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
7
7
  checks: IsInvalidCheck<number | null>[];
8
8
  }, updateComponent: UpdateComponent) => IntegerInputComponent;
@@ -1,8 +1,8 @@
1
1
  import type { InputComponent, UpdateComponent } from '../types';
2
- import type { IsInvalidCheck } from '../validation/value-checks';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  export type NumberInputComponent = InputComponent<number> & {
4
4
  type: 'number';
5
5
  };
6
- export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
6
+ export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
7
7
  checks: IsInvalidCheck<number | null>[];
8
8
  }, updateComponent: UpdateComponent) => NumberInputComponent;
@@ -11,9 +11,10 @@ export type ObjectComponent = Omit<BaseComponent<Record<string, Model>>, 'getVal
11
11
  };
12
12
  export declare const createObjectComponent: (objectProps: {
13
13
  uid: string;
14
- title?: string | undefined;
14
+ analyticsId?: string | undefined;
15
+ components: Record<string, StepComponent>;
15
16
  description?: string | undefined;
16
17
  displayOrder: string[];
17
- components: Record<string, StepComponent>;
18
18
  help?: string | undefined;
19
+ title?: string | undefined;
19
20
  }) => ObjectComponent;
@@ -0,0 +1,29 @@
1
+ import type { Icon, ImageLayout, Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { InputComponent, StepComponent, UpdateComponent } from '../types';
3
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
4
+ import type { AnalyticsEventDispatcher } from '../features/events';
5
+ export type SelectInputComponent = Omit<InputComponent<Model>, 'onChange' | 'value'> & {
6
+ type: 'select';
7
+ selectedIndex: number | null;
8
+ options: SelectInputOption[];
9
+ children: StepComponent[];
10
+ onSelect: (index: number | null) => void;
11
+ getChildren: () => StepComponent[];
12
+ getSelectedChild: () => StepComponent | null;
13
+ };
14
+ export type SelectInputOption = {
15
+ title: string;
16
+ description?: string;
17
+ icon?: Icon;
18
+ image?: ImageLayout;
19
+ keywords?: string[];
20
+ disabled: boolean;
21
+ };
22
+ export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, 'uid' | 'id' | 'analyticsId' | 'autoComplete' | 'control' | 'errors' | 'description' | 'disabled' | 'help' | 'placeholder' | 'required' | 'title'> & {
23
+ initialValue: Model;
24
+ options: (SelectInputOption & {
25
+ component: StepComponent;
26
+ })[];
27
+ checks: IsInvalidCheck<Model>[];
28
+ trackEvent: AnalyticsEventDispatcher;
29
+ }, updateComponent: UpdateComponent) => SelectInputComponent;
@@ -1,9 +1,9 @@
1
1
  import type { InputComponent, UpdateComponent } from '../types';
2
- import type { IsInvalidCheck } from '../validation/value-checks';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  export type TextInputComponent = InputComponent<string> & {
4
4
  type: 'text';
5
5
  displayFormat?: string;
6
6
  };
7
- export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "displayFormat" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
7
+ export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "displayFormat" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
8
8
  checks: IsInvalidCheck<string | null>[];
9
9
  }, updateComponent: UpdateComponent) => TextInputComponent;
@@ -1,9 +1,9 @@
1
1
  import type { InputComponent, UpdateComponent } from '../types';
2
- import type { IsInvalidCheck } from '../validation/value-checks';
2
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  export type UploadInputComponent = InputComponent<string> & {
4
4
  type: 'upload';
5
5
  accepts?: string[];
6
6
  };
7
- export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "accepts" | "autoComplete" | "uid"> & {
7
+ export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "analyticsId" | "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "accepts" | "autoComplete" | "uid"> & {
8
8
  checks: IsInvalidCheck<string | null>[];
9
9
  }, updateComponent: UpdateComponent) => UploadInputComponent;
@@ -0,0 +1,25 @@
1
+ import type { SearchResult } from '@wise/dynamic-flow-types/build/next';
2
+ import type { LayoutComponent, OnAction, UpdateComponent } from '../../types';
3
+ export type SearchConfig = {
4
+ method: string;
5
+ param: string;
6
+ url: string;
7
+ };
8
+ export type SearchProps = {
9
+ config?: SearchConfig;
10
+ query: string;
11
+ signal: AbortSignal;
12
+ };
13
+ export type PerformSearch = (props: SearchProps) => Promise<SearchResult[]>;
14
+ export type SearchComponent = LayoutComponent & {
15
+ type: 'search';
16
+ emptyMessage: string;
17
+ isLoading: boolean;
18
+ query: string;
19
+ title: string;
20
+ results: SearchResult[];
21
+ error?: string;
22
+ onChange: (query: string) => void;
23
+ onSelect: (result: SearchResult) => void;
24
+ };
25
+ export declare const createSearchComponent: (searchProps: Pick<SearchComponent, 'uid' | 'control' | 'emptyMessage' | 'margin' | 'title'>, performSearch: PerformSearch, onAction: OnAction, updateComponent: UpdateComponent) => SearchComponent;
@@ -0,0 +1,6 @@
1
+ export interface DebouncedFunc<T extends (...args: Parameters<T>) => ReturnType<T>> {
2
+ (...args: Parameters<T>): void;
3
+ cancel: () => void;
4
+ flush: () => void;
5
+ }
6
+ export declare const debounce: <T extends (...args: Parameters<T>) => ReturnType<T>>(callback: T, waitMs: number) => DebouncedFunc<T>;
@@ -0,0 +1,2 @@
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
+ export declare const isModelPartialOf: (partialModel: Model, model: Model) => boolean;
@@ -6,4 +6,4 @@ export declare const getAnalyticsEventDispatcher: ({ flowId, step, onEvent, }: {
6
6
  step?: Step | null | undefined;
7
7
  onEvent?: AnalyticsEventHandler | undefined;
8
8
  }) => AnalyticsEventDispatcher;
9
- export type EventName = 'Flow Started' | 'Flow Completed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Failed' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
9
+ export type EventName = 'Flow Started' | 'Flow Completed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
@@ -0,0 +1,3 @@
1
+ import type { SearchConfig, PerformSearch } from '../../components/search/SearchComponent';
2
+ import type { HttpClient } from '../../../dynamic-flow-types';
3
+ export declare const getPerformSearchFunction: (httpClient: HttpClient, defaultConfig: SearchConfig) => PerformSearch;
@@ -1,2 +1,2 @@
1
- import type { StepComponent } from '../types';
1
+ import type { StepComponent } from '../../types';
2
2
  export declare const validateComponents: (components: StepComponent[]) => boolean;
@@ -1,5 +1,5 @@
1
1
  import type { IntegerSchema, Model, NumberSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
- import type { ErrorMessageFunctions } from '../mappers/types';
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
5
  export declare const getAboveMaxLengthCheck: GetIsInvalidCheck<StringSchema, string | null>;
@@ -0,0 +1,3 @@
1
+ import type { SearchLayout } from '@wise/dynamic-flow-types/build/next/layout/SearchLayout';
2
+ import type { MapperProps } from '../schema/types';
3
+ export declare const searchLayoutToComponent: (uid: string, { control, emptyMessage, method, param, title, url, margin }: SearchLayout, mapperProps: MapperProps) => import("../../components/search/SearchComponent").SearchComponent;
@@ -0,0 +1,5 @@
1
+ import type { MapperProps, SchemaMapperProps } from './types';
2
+ import type { BooleanSchema } from '@wise/dynamic-flow-types/build/next';
3
+ export declare const booleanSchemaToComponent: (uid: string, schemaMapperProps: SchemaMapperProps & {
4
+ schema: BooleanSchema;
5
+ }, mapperProps: MapperProps) => import("../../components/BooleanInputComponent").BooleanInputComponent;
@@ -0,0 +1,5 @@
1
+ import type { OneOfSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { MapperProps, SchemaMapperProps } from '../types';
3
+ export declare const oneOfSchemaToComponent: (uid: string, { schema, model, validationErrors: initialError, required, }: SchemaMapperProps & {
4
+ schema: OneOfSchema;
5
+ }, mapperProps: MapperProps) => import("../../../components/SelectInputComponent").SelectInputComponent;
@@ -5,10 +5,11 @@ import type { StepComponent } from '../../../types';
5
5
  export declare const getMockMapperProps: (mapperProps?: Partial<MapperProps>) => {
6
6
  step: Step;
7
7
  getErrorMessageFunctions: jest.Mock<any, any, any> | import("../../types").GetErrorMessageFunctions;
8
+ httpClient: typeof fetch | jest.Mock<any, any, any>;
8
9
  onAction: jest.Mock<any, any, any> | import("../../../types").OnAction;
9
10
  updateComponent: jest.Mock<any, any, any> | import("../../../types").UpdateComponent;
10
- trackEvent: jest.Mock<any, any, any> | import("../../../events").AnalyticsEventDispatcher;
11
- logEvent: jest.Mock<any, any, any> | import("../../../events").LoggingEventDispatcher;
11
+ trackEvent: jest.Mock<any, any, any> | import("../../../features/events").AnalyticsEventDispatcher;
12
+ logEvent: jest.Mock<any, any, any> | import("../../../features/events").LoggingEventDispatcher;
12
13
  };
13
14
  export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperProps: Partial<SchemaMapperProps> & {
14
15
  schema: S;
@@ -19,3 +20,4 @@ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperPr
19
20
  validationErrors: import("@wise/dynamic-flow-types/build/next").ValidationError;
20
21
  };
21
22
  export declare const mockUpdateFunction: <C extends StepComponent>(draftComponent: C) => jest.Mock<any, any, any>;
23
+ export declare const getUpdateFunctionMock: <C extends StepComponent>(getComponent: () => C) => jest.Mock<void, [uid: string, update: (component: StepComponent) => void], any>;
@@ -1,10 +1,12 @@
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
3
  import type { GetErrorMessageFunctions } from '../types';
4
- import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../events';
4
+ import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
5
+ import type { HttpClient } from '../../../dynamic-flow-types';
5
6
  export type MapperProps = {
6
7
  step: DFStep;
7
8
  getErrorMessageFunctions: GetErrorMessageFunctions;
9
+ httpClient: HttpClient;
8
10
  onAction: OnAction;
9
11
  updateComponent: UpdateComponent;
10
12
  trackEvent: AnalyticsEventDispatcher;
@@ -1,24 +1,28 @@
1
1
  import type { Action, 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 { BooleanInputComponent } from './components/BooleanInputComponent';
4
5
  import type { BoxComponent } from './components/BoxComponent';
5
6
  import type { ButtonComponent } from './components/ButtonComponent';
7
+ import type { ColumnsComponent } from './components/ColumnsComponent';
8
+ import type { ContainerComponent } from './components/ContainerComponent';
6
9
  import type { HeadingComponent } from './components/HeadingComponent';
10
+ import type { IntegerInputComponent } from './components/IntegerInputComponent';
11
+ import type { NumberInputComponent } from './components/NumberInputComponent';
7
12
  import type { ObjectComponent } from './components/ObjectComponent';
8
13
  import type { ParagraphComponent } from './components/ParagraphComponent';
14
+ import type { SelectInputComponent } from './components/SelectInputComponent';
9
15
  import type { TextInputComponent } from './components/TextInputComponent';
10
- import type { ColumnsComponent } from './components/ColumnsComponent';
11
- import type { NumberInputComponent } from './components/NumberInputComponent';
12
- import type { IntegerInputComponent } from './components/IntegerInputComponent';
13
16
  import type { DateInputComponent } from './components/DateInputComponent';
14
17
  import type { UploadInputComponent } from './components/UploadInputComponent';
15
- import type { ContainerComponent } from './components/ContainerComponent';
16
18
  import type { FormComponent } from './components/FormComponent';
17
- export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | TextInputComponent | UploadInputComponent;
18
- export type HasChildren = BoxComponent | ColumnsComponent | ContainerComponent | FormComponent | ObjectComponent;
19
+ import type { SearchComponent } from './components/search/SearchComponent';
20
+ export type StepComponent = AlertComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | SearchComponent | SelectInputComponent | TextInputComponent | UploadInputComponent;
21
+ export type HasChildren = BoxComponent | ColumnsComponent | ContainerComponent | FormComponent | SelectInputComponent | ObjectComponent;
19
22
  export type BaseComponent<M extends Model> = {
20
23
  type: string;
21
24
  uid: string;
25
+ analyticsId?: string;
22
26
  validate: () => boolean;
23
27
  getValue: () => M | null;
24
28
  };
@@ -1,5 +1,5 @@
1
1
  import type { Step, Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/events';
2
+ import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/features/events';
3
3
  export type DynamicFlowProps = DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep;
4
4
  export type DynamicFlowPropsWithInitialAction = DynamicFlowPropsBasic & {
5
5
  initialAction: InitialAction;
@@ -0,0 +1,3 @@
1
+ import type { BooleanInputComponent } from '../../domain/components/BooleanInputComponent';
2
+ import type { BooleanInputRendererProps } from '../types';
3
+ export declare const booleanInputComponentToProps: (component: BooleanInputComponent) => BooleanInputRendererProps;
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { StepComponent } from '../../domain/types';
3
3
  import type { RendererProps } from '../types';
4
4
  export declare const componentToRendererProps: (component: StepComponent, nestedContent: {
5
- children?: ReactNode;
6
- startChildren?: ReactNode;
7
- endChildren?: ReactNode;
5
+ children?: ReactNode[] | undefined;
6
+ startChildren?: ReactNode[] | undefined;
7
+ endChildren?: ReactNode[] | undefined;
8
8
  }) => RendererProps;
@@ -0,0 +1,3 @@
1
+ import type { SearchComponent } from '../../domain/components/search/SearchComponent';
2
+ import type { SearchRendererProps } from '../types';
3
+ export declare const searchComponentToProps: (component: SearchComponent) => SearchRendererProps;
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { SelectInputComponent } from '../../domain/components/SelectInputComponent';
3
+ import type { SelectInputRendererProps } from '../types';
4
+ export declare const selectInputComponentToProps: ({ autoComplete, control, description, errors, id, title, placeholder, options, required, help, selectedIndex, disabled, onBlur, onFocus, onSelect, }: SelectInputComponent, children: ReactNode[]) => SelectInputRendererProps;
@@ -1,4 +1,4 @@
1
- import type { Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Margin as DFMargin, Size as DFSize, SearchResult as SearchResultSpec, Icon, ImageLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ReactNode } from 'react';
3
3
  export type Renderer<P extends RendererProps> = {
4
4
  canRender: (props: RendererProps) => boolean;
@@ -11,11 +11,11 @@ export type Margin = DFMargin;
11
11
  export type Size = DFSize;
12
12
  export interface RendererProps {
13
13
  type: string;
14
+ control?: string;
14
15
  }
15
16
  export interface AlertRendererProps extends RendererProps {
16
17
  type: 'alert';
17
18
  context: Context;
18
- control?: string;
19
19
  margin: Margin;
20
20
  markdown: string;
21
21
  }
@@ -23,13 +23,11 @@ export interface BoxRendererProps extends RendererProps {
23
23
  type: 'box';
24
24
  border: boolean;
25
25
  children: ReactNode;
26
- control?: string;
27
26
  margin: Margin;
28
27
  width: Size;
29
28
  }
30
29
  export interface ColumnsRendererProps extends RendererProps {
31
30
  type: 'columns';
32
- control?: string;
33
31
  bias: Bias;
34
32
  margin: Margin;
35
33
  startChildren: ReactNode;
@@ -38,24 +36,57 @@ export interface ColumnsRendererProps extends RendererProps {
38
36
  export interface FormRendererProps extends RendererProps {
39
37
  type: 'form';
40
38
  children: ReactNode;
41
- control?: string;
42
39
  margin: Margin;
43
40
  }
41
+ /**
42
+ * Known values for "control" are: 'display'.
43
+ */
44
44
  export interface HeadingRendererProps extends RendererProps {
45
45
  type: 'heading';
46
46
  text: string;
47
- control?: string;
48
47
  align: Align;
49
48
  margin: Margin;
50
49
  size: Size;
51
50
  }
51
+ /**
52
+ * Known values for "control" are: 'copyable'.
53
+ */
52
54
  export interface ParagraphRendererProps extends RendererProps {
53
55
  type: 'paragraph';
54
56
  align: Align;
55
- control?: string;
56
57
  margin: Margin;
57
58
  text: string;
58
59
  }
60
+ export interface SearchRendererProps extends RendererProps {
61
+ type: 'search';
62
+ control?: string;
63
+ emptyMessage?: string;
64
+ isLoading: boolean;
65
+ margin: Margin;
66
+ query: string;
67
+ onChange: (query: string) => void;
68
+ state: SearchState;
69
+ title: string;
70
+ }
71
+ export type SearchState = PendingSearchState | NoResultsSearchState | ResultsSearchState | ErrorSearchState;
72
+ export type PendingSearchState = {
73
+ type: 'pending';
74
+ };
75
+ export type NoResultsSearchState = {
76
+ type: 'noResults';
77
+ message: string;
78
+ };
79
+ export type ErrorSearchState = {
80
+ type: 'error';
81
+ onRetry: () => void;
82
+ };
83
+ export type ResultsSearchState = {
84
+ type: 'results';
85
+ results: SearchResult[];
86
+ };
87
+ export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'image' | 'title'> & {
88
+ onClick: () => void;
89
+ };
59
90
  export interface ObjectRendererProps extends RendererProps {
60
91
  type: 'object';
61
92
  title?: string;
@@ -63,10 +94,9 @@ export interface ObjectRendererProps extends RendererProps {
63
94
  help?: string;
64
95
  children: ReactNode;
65
96
  }
66
- interface BaseInputRendererProps<M extends string | number> extends RendererProps {
97
+ interface BaseInputRendererProps<M extends string | number | boolean> extends RendererProps {
67
98
  id: string;
68
99
  autoComplete: string;
69
- control?: string;
70
100
  description?: string;
71
101
  disabled: boolean;
72
102
  error?: string;
@@ -81,39 +111,64 @@ interface BaseInputRendererProps<M extends string | number> extends RendererProp
81
111
  onBlur: () => void;
82
112
  onFocus: () => void;
83
113
  }
84
- export interface TextInputRendererProps extends BaseInputRendererProps<string> {
85
- type: 'input-text';
86
- control?: string;
87
- displayFormat?: string;
114
+ export interface BooleanInputRendererProps extends BaseInputRendererProps<boolean> {
115
+ type: 'input-boolean';
116
+ value: boolean;
117
+ }
118
+ /**
119
+ * Known values for "control" are: 'primary' | 'secondary' | 'tertiary'.
120
+ */
121
+ export interface ButtonRendererProps extends RendererProps {
122
+ type: 'button';
123
+ context: Context;
124
+ disabled: boolean;
125
+ margin: Margin;
126
+ pinOrder?: number;
127
+ size?: Size;
128
+ title: string;
129
+ onClick: () => void;
88
130
  }
131
+ /**
132
+ * Known values for "control" are: 'date-lookup'.
133
+ */
89
134
  export interface DateInputRendererProps extends BaseInputRendererProps<string> {
90
135
  type: 'input-date';
91
- control?: string;
92
136
  minimumDate?: string;
93
137
  maximumDate?: string;
94
138
  }
95
- export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
96
- type: 'input-number';
139
+ export interface HiddenRendererProps extends RendererProps {
140
+ type: 'hidden';
97
141
  }
98
142
  export interface IntegerInputRendererProps extends BaseInputRendererProps<number> {
99
143
  type: 'input-integer';
100
144
  }
101
- export interface UploadInputRendererProps extends BaseInputRendererProps<string> {
102
- type: 'input-upload';
103
- accepts?: string[];
145
+ export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
146
+ type: 'input-number';
104
147
  }
105
- export interface ButtonRendererProps extends RendererProps {
106
- type: 'button';
107
- context: Context;
108
- control?: string;
148
+ export interface SelectInputRendererProps extends Omit<BaseInputRendererProps<number>, 'onChange' | 'value'> {
149
+ type: 'input-select';
150
+ children: ReactNode;
151
+ options: SelectInputRendererOption[];
152
+ selectedIndex: number | null;
153
+ onSelect: (index: number | null) => void;
154
+ }
155
+ export type SelectInputRendererOption = {
156
+ description?: string;
109
157
  disabled: boolean;
110
- margin: Margin;
111
- pinOrder?: number;
112
- size?: Size;
158
+ icon?: Icon;
159
+ image?: ImageLayout;
160
+ keywords?: string[];
113
161
  title: string;
114
- onClick: () => void;
162
+ };
163
+ /**
164
+ * Known values for "control" are: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number'.
165
+ */
166
+ export interface TextInputRendererProps extends BaseInputRendererProps<string> {
167
+ type: 'input-text';
168
+ displayFormat?: string;
115
169
  }
116
- export interface HiddenRendererProps extends RendererProps {
117
- type: 'hidden';
170
+ export interface UploadInputRendererProps extends BaseInputRendererProps<string> {
171
+ type: 'input-upload';
172
+ accepts?: string[];
118
173
  }
119
174
  export {};
@@ -1,11 +1,13 @@
1
1
  import type { Step as DFStep } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Renderer, RendererProps } from '../renderers/types';
3
- import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/events';
3
+ import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
4
+ import type { HttpClient } from '../dynamic-flow-types';
4
5
  type StepProps = {
5
6
  step: DFStep;
6
7
  renderers: Renderer<RendererProps>[];
8
+ httpClient: HttpClient;
7
9
  trackEvent: AnalyticsEventDispatcher;
8
10
  logEvent: LoggingEventDispatcher;
9
11
  };
10
- declare function Step({ step, renderers, trackEvent, logEvent }: StepProps): JSX.Element;
12
+ declare function Step({ step, renderers, httpClient, trackEvent, logEvent }: StepProps): JSX.Element;
11
13
  export default Step;
@@ -0,0 +1 @@
1
+ export declare const mockSearchHandler: typeof fetch;
@@ -1,13 +1,15 @@
1
- import type { AllOfSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
1
+ import type { AllOfSchema, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { HasChildren, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
4
  export declare const hasChildren: (component: StepComponent) => component is HasChildren;
5
5
  export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
6
+ export declare const isArrayModel: (model: Model) => model is Model[];
6
7
  export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
7
8
  export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
8
- export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
9
+ export declare const isBooleanSchema: (schema: Schema) => schema is BooleanSchema;
10
+ export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
11
+ export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
12
+ export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
9
13
  export declare const isObjectSchema: (schema: Schema) => schema is ObjectSchema;
14
+ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
10
15
  export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
11
- export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
12
- export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
13
- export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, BooleanInputRendererProps } from '../../renderers/types';
2
+ declare const BooleanInputRenderer: Renderer<BooleanInputRendererProps>;
3
+ export default BooleanInputRenderer;
@@ -0,0 +1,14 @@
1
+ import type { ErrorSearchState, Renderer, ResultsSearchState, SearchRendererProps } from '../../renderers/types';
2
+ declare const SearchRenderer: Renderer<SearchRendererProps>;
3
+ export declare function SearchInput({ query, onChange, }: {
4
+ query: string;
5
+ onChange: (query: string) => void;
6
+ }): JSX.Element;
7
+ export declare function ErrorResult({ state }: {
8
+ state: ErrorSearchState;
9
+ }): JSX.Element;
10
+ export declare function SearchResults({ state, }: {
11
+ state: ResultsSearchState;
12
+ onChange: (query: string) => void;
13
+ }): JSX.Element;
14
+ export default SearchRenderer;
@@ -0,0 +1,2 @@
1
+ import type { SelectInputRendererProps } from '../../../renderers/types';
2
+ export declare function RadioInputRendererComponent(props: SelectInputRendererProps): JSX.Element;