@wise/dynamic-flow-client 2.8.0 → 2.8.2

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 (72) hide show
  1. package/build/main.js +12 -9
  2. package/build/main.min.js +1 -1
  3. package/build/types/index.d.ts +1 -1
  4. package/build/types/legacy/common/contexts/eventsContext/EventsContext.d.ts +1 -1
  5. package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +1 -1
  6. package/build/types/legacy/common/contexts/httpClientContext/HttpClientContext.d.ts +1 -1
  7. package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
  8. package/build/types/legacy/dynamicFlow/DynamicFlow.d.ts +1 -1
  9. package/build/types/legacy/dynamicFlow/stories/fixtureHttpClient.d.ts +1 -1
  10. package/build/types/legacy/dynamicFlow/utils/responseParsers/response-parsers.d.ts +1 -1
  11. package/build/types/legacy/dynamicFlow/utils/useLoader.d.ts +1 -1
  12. package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -1
  13. package/build/types/legacy/jsonSchemaForm/oneOfSchema/utils.d.ts +1 -1
  14. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +1 -1
  15. package/build/types/legacy/layout/search/useSearch.d.ts +1 -1
  16. package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.d.ts +1 -1
  17. package/build/types/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +1 -1
  18. package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +1 -1
  19. package/build/types/legacy/test-utils/DynamicFlowProviders.d.ts +1 -1
  20. package/build/types/legacy/test-utils/legacy-utils.d.ts +1 -1
  21. package/build/types/revamp/DynamicFlowRevamp.d.ts +2 -2
  22. package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -3
  23. package/build/types/revamp/domain/components/BoxComponent.d.ts +2 -3
  24. package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -4
  25. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +2 -3
  26. package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -2
  27. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +8 -0
  28. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +8 -0
  29. package/build/types/revamp/domain/components/ObjectComponent.d.ts +3 -3
  30. package/build/types/revamp/domain/components/ParagraphComponent.d.ts +1 -2
  31. package/build/types/revamp/domain/components/TextInputComponent.d.ts +4 -21
  32. package/build/types/revamp/domain/components/utils/component-utils.d.ts +12 -0
  33. package/build/types/revamp/domain/events/getAnalyticsEventDispatcher.d.ts +9 -0
  34. package/build/types/revamp/domain/events/getLogggingEventDispatcher.d.ts +4 -0
  35. package/build/types/revamp/domain/events/index.d.ts +2 -0
  36. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  37. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
  38. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  39. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
  40. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  41. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  42. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  43. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +2 -2
  44. package/build/types/revamp/domain/mappers/mapSchemaToComponent.d.ts +1 -1
  45. package/build/types/revamp/domain/mappers/schema/integerSchemaToComponent.d.ts +5 -0
  46. package/build/types/revamp/domain/mappers/schema/numberSchemaToComponent.d.ts +5 -0
  47. package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +2 -2
  48. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +2 -9
  49. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +21 -0
  50. package/build/types/revamp/domain/mappers/schema/types.d.ts +5 -1
  51. package/build/types/revamp/domain/mappers/types.d.ts +6 -4
  52. package/build/types/revamp/domain/mappers/utils/getAutocompleteString.d.ts +2 -0
  53. package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +3 -3
  54. package/build/types/revamp/domain/types.d.ts +22 -5
  55. package/build/types/revamp/domain/validation/getModelValidationErrors.d.ts +6 -0
  56. package/build/types/revamp/domain/validation/spec-utils.d.ts +11 -0
  57. package/build/types/revamp/{utils → domain/validation}/validateComponents.d.ts +1 -1
  58. package/build/types/revamp/domain/validation/value-checks.d.ts +13 -0
  59. package/build/types/revamp/dynamic-flow-types.d.ts +38 -0
  60. package/build/types/revamp/renderers/mappers/integerInputComponentToProps.d.ts +3 -0
  61. package/build/types/revamp/renderers/mappers/numberInputComponentToProps.d.ts +3 -0
  62. package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +1 -1
  63. package/build/types/revamp/renderers/types.d.ts +20 -6
  64. package/build/types/revamp/step/Step.d.ts +5 -2
  65. package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +2 -3
  66. package/build/types/revamp/utils/getSubmittableData.d.ts +1 -1
  67. package/build/types/revamp/utils/type-utils.d.ts +7 -1
  68. package/build/types/revamp/wise/renderers/IntegerInputRenderer.d.ts +3 -0
  69. package/build/types/revamp/wise/renderers/NumberInputRenderer.d.ts +3 -0
  70. package/package.json +1 -1
  71. package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +0 -10
  72. /package/build/types/{dynamic-flow-types.d.ts → legacy/dynamic-flow-types.d.ts} +0 -0
@@ -6,5 +6,5 @@ export { DynamicLayout as Layout } from './legacy/layout';
6
6
  export { isValidSchema } from './legacy/common/validators';
7
7
  export { default as translations } from './i18n';
8
8
  export * from './legacy/dynamicFlow/DynamicFlow';
9
- export type { DynamicFlowProps, InitialAction } from './dynamic-flow-types';
9
+ export type { DynamicFlowProps, InitialAction } from './legacy/dynamic-flow-types';
10
10
  export type { Step } from '@wise/dynamic-flow-types';
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { EventHandler } from '../../../../dynamic-flow-types';
2
+ import type { EventHandler } from '../../../dynamic-flow-types';
3
3
  type Props = {
4
4
  metadata?: Record<string, unknown> & {
5
5
  flowId?: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { Feature } from '../../../../dynamic-flow-types';
2
+ import type { Feature } from '../../../dynamic-flow-types';
3
3
  import type { FeatureName } from '../../constants/FeatureName';
4
4
  type FeatureContextProviderProps = {
5
5
  features: Feature[] | undefined;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { HttpClient } from '../../../../dynamic-flow-types';
2
+ import type { HttpClient } from '../../../dynamic-flow-types';
3
3
  type ProviderProps = {
4
4
  httpClient: HttpClient;
5
5
  children: React.ReactNode;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { LogLevel, LogEventHandler } from '../../../../dynamic-flow-types';
2
+ import type { LogLevel, LogEventHandler } from '../../../dynamic-flow-types';
3
3
  export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation warning' | 'Deprecated schema' | 'Error fetching';
4
4
  type LogFunction = (title: LogTitle, description: string, extra?: Record<string, unknown>) => void;
5
5
  export declare const getLogger: (level: LogLevel, onLog: LogEventHandler, flowId?: string | undefined, stepId?: string | undefined) => LogFunction;
@@ -1,3 +1,3 @@
1
- import type { DynamicFlowProps } from '../../dynamic-flow-types';
1
+ import type { DynamicFlowProps } from '../dynamic-flow-types';
2
2
  declare function DynamicFlow(props: DynamicFlowProps): JSX.Element;
3
3
  export default DynamicFlow;
@@ -1,3 +1,3 @@
1
- import type { HttpClient } from '../../../dynamic-flow-types';
1
+ import type { HttpClient } from '../../dynamic-flow-types';
2
2
  export declare const getObjectKeys: <T>(object: T) => (keyof T)[];
3
3
  export declare const fixtureHttpClient: HttpClient;
@@ -1,5 +1,5 @@
1
1
  import type { ActionResponseBody, ErrorResponseBody, Step } from '@wise/dynamic-flow-types';
2
- import type { DynamicFlowProps } from '../../../../dynamic-flow-types';
2
+ import type { DynamicFlowProps } from '../../../dynamic-flow-types';
3
3
  type ParsedBody = {
4
4
  type: 'exit';
5
5
  result: Parameters<DynamicFlowProps['onCompletion']>[0];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { DynamicFlowProps } from '../../../dynamic-flow-types';
2
+ import type { DynamicFlowProps } from '../../dynamic-flow-types';
3
3
  type LoadingState = 'idle' | 'initial' | 'refresh' | 'submission';
4
4
  export declare function useLoader(loaderConfig: DynamicFlowProps['loaderConfig'], initialState: LoadingState): {
5
5
  isLoading: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { FormErrors, Model, Schema } from '@wise/dynamic-flow-types';
2
- import type { EventHandler, LogEventHandler } from '../../dynamic-flow-types';
2
+ import type { EventHandler, LogEventHandler } from '../dynamic-flow-types';
3
3
  import type { OnPersistAsync } from '../dynamicFlow/DynamicFlowTypes';
4
4
  declare function JsonSchemaForm(props: JsonSchemaFormProps): JSX.Element;
5
5
  export type OnChange = (parameters: OnChangeProps) => void;
@@ -1,4 +1,4 @@
1
- import { Model, ObjectModel, OneOfSchema, OneOfObjectSchema } from '@wise/dynamic-flow-types';
1
+ import type { Model, ObjectModel, OneOfSchema, OneOfObjectSchema } from '@wise/dynamic-flow-types';
2
2
  export declare const getActiveSchemaIndex: (schema: OneOfSchema, model: Model) => number | null;
3
3
  export declare const getValidIndexFromValue: (schema: OneOfSchema, value: Model | undefined) => number;
4
4
  export declare function getBestMatchingSchemaIndexForValue(schema: OneOfObjectSchema, value: ObjectModel): number | null;
@@ -1,6 +1,6 @@
1
1
  import type { UploadProps } from '@transferwise/components/build/types/upload/Upload';
2
2
  import type { PersistAsync } from '@wise/dynamic-flow-types';
3
- import type { HttpClient } from '../../../../dynamic-flow-types';
3
+ import type { HttpClient } from '../../../dynamic-flow-types';
4
4
  type Props = UploadProps & {
5
5
  id: string;
6
6
  httpClient: HttpClient;
@@ -1,6 +1,6 @@
1
1
  import type { SearchConfig, SearchResult } from '@wise/dynamic-flow-types';
2
2
  export declare const useSearch: (defaultSearchConfig: SearchConfig) => {
3
- status: "error" | "success" | "loading" | "idle";
3
+ status: "success" | "loading" | "error" | "idle";
4
4
  results: SearchResult[];
5
5
  search: (query: string, { url, method, param }?: SearchConfig) => Promise<void>;
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import type { CameraDirection } from '@wise/dynamic-flow-types';
2
- import type { EventHandler } from '../../../../dynamic-flow-types';
2
+ import type { EventHandler } from '../../../dynamic-flow-types';
3
3
  type Props = {
4
4
  direction?: CameraDirection;
5
5
  overlay?: string;
@@ -1,4 +1,4 @@
1
- import type { EventHandler } from '../../../../../dynamic-flow-types';
1
+ import type { EventHandler } from '../../../../dynamic-flow-types';
2
2
  export declare const useFullScreenOrientationLock: (shouldLockOrientation: boolean, onEvent: EventHandler | undefined) => {
3
3
  enterFullScreen: () => void;
4
4
  exitFullScreen: () => void;
@@ -1,5 +1,5 @@
1
1
  import type { CameraDirection } from '@wise/dynamic-flow-types';
2
- import type { EventHandler, EventName } from '../../../../../dynamic-flow-types';
2
+ import type { EventHandler, EventName } from '../../../../dynamic-flow-types';
3
3
  export declare const trackCameraError: (message: EventName, onEvent: EventHandler | undefined, error: string | DOMException) => void | undefined;
4
4
  export declare const trackCameraFeedStarted: (onEvent: EventHandler | undefined, props: {
5
5
  direction?: CameraDirection;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { EventHandler, LogEventHandler } from '../../dynamic-flow-types';
2
+ import type { EventHandler, LogEventHandler } from '../dynamic-flow-types';
3
3
  type DynamicFlowProvidersProps = {
4
4
  children: React.ReactNode;
5
5
  onLog?: LogEventHandler;
@@ -1,6 +1,6 @@
1
1
  import { type ReactWrapper } from 'enzyme';
2
2
  import type { ReactNode } from 'react';
3
- import type { EventHandler, LogEventHandler } from '../../dynamic-flow-types';
3
+ import type { EventHandler, LogEventHandler } from '../dynamic-flow-types';
4
4
  declare const getMockFetchPromise: (status: number, jsonFn: () => void, delay: number, signal?: AbortSignal | null) => Promise<Response>;
5
5
  declare const wait: (t: number) => Promise<unknown>;
6
6
  declare function mountWithProviders(component: ReactNode, locale?: string, messages?: Record<string, unknown>, baseUrl?: string, onEvent?: EventHandler, onLog?: LogEventHandler): ReactWrapper;
@@ -1,3 +1,3 @@
1
- import type { DynamicFlowProps } from '../dynamic-flow-types';
2
- declare function DynamicFlowRevamp({ initialStep, onError }: DynamicFlowProps): JSX.Element;
1
+ import type { DynamicFlowProps } from './dynamic-flow-types';
2
+ declare function DynamicFlowRevamp(props: DynamicFlowProps): JSX.Element;
3
3
  export default DynamicFlowRevamp;
@@ -1,10 +1,9 @@
1
- import type { Context, Margin } from '@wise/dynamic-flow-types';
2
- import type { LayoutComponent } from '../types';
1
+ import type { Margin } from '@wise/dynamic-flow-types/build/next';
2
+ import type { Context, LayoutComponent } from '../types';
3
3
  export type AlertComponent = LayoutComponent & {
4
4
  type: 'alert';
5
5
  markdown: string;
6
6
  context: Context;
7
- getValue: () => null;
8
7
  };
9
8
  export declare const createAlertComponent: (alertProps: {
10
9
  uid: string;
@@ -1,13 +1,12 @@
1
- import type { Margin, Model, Size } from '@wise/dynamic-flow-types';
1
+ import type { Margin, Model, Size } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { BaseComponent, StepComponent } from '../types';
3
- export type BoxComponent = BaseComponent & {
3
+ export type BoxComponent = BaseComponent<Model> & {
4
4
  type: 'box';
5
5
  border: boolean;
6
6
  width: Size;
7
7
  margin: Margin;
8
8
  components: StepComponent[];
9
9
  getChildren: () => StepComponent[];
10
- getValue: () => Model;
11
10
  };
12
11
  export declare const createBoxComponent: (boxProps: {
13
12
  uid: string;
@@ -1,15 +1,13 @@
1
- import type { Context, Margin } from '@wise/dynamic-flow-types';
2
- import type { LayoutComponent } from '../types';
1
+ import type { Margin } from '@wise/dynamic-flow-types/build/next';
2
+ import type { LayoutComponent, Context } from '../types';
3
3
  export type ButtonComponent = LayoutComponent & {
4
4
  type: 'button';
5
5
  title: string;
6
6
  context: Context;
7
7
  control?: string;
8
8
  disabled: boolean;
9
- margin: Margin;
10
9
  pinOrder?: number;
11
10
  onClick: () => void;
12
- getValue: () => null;
13
11
  };
14
12
  export declare const createButtonComponent: (buttonProps: {
15
13
  uid: string;
@@ -1,6 +1,6 @@
1
- import type { Margin, Model } from '@wise/dynamic-flow-types';
1
+ import type { Margin, Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { BaseComponent, Bias, StepComponent } from '../types';
3
- export type ColumnsComponent = BaseComponent & {
3
+ export type ColumnsComponent = BaseComponent<Model> & {
4
4
  type: 'columns';
5
5
  bias: Bias;
6
6
  control?: string;
@@ -8,7 +8,6 @@ export type ColumnsComponent = BaseComponent & {
8
8
  startComponents: StepComponent[];
9
9
  endComponents: StepComponent[];
10
10
  getChildren: () => StepComponent[];
11
- getValue: () => Model;
12
11
  };
13
12
  export declare const createColumnsComponent: (columnsProps: {
14
13
  uid: string;
@@ -1,11 +1,10 @@
1
- import type { Margin, Size } from '@wise/dynamic-flow-types';
1
+ import type { Margin, Size } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Align, LayoutComponent } from '../types';
3
3
  export type HeadingComponent = LayoutComponent & {
4
4
  type: 'heading';
5
5
  text: string;
6
6
  align: Align;
7
7
  size: Size;
8
- getValue: () => null;
9
8
  };
10
9
  export declare const createHeadingComponent: (headingProps: {
11
10
  uid: string;
@@ -0,0 +1,8 @@
1
+ import type { InputComponent, UpdateComponent } from '../types';
2
+ import type { IsInvalidCheck } from '../validation/value-checks';
3
+ export type IntegerInputComponent = InputComponent<number> & {
4
+ type: 'integer';
5
+ };
6
+ export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "value" | "autoComplete" | "uid"> & {
7
+ checks: IsInvalidCheck<number | null>[];
8
+ }, updateComponent: UpdateComponent) => IntegerInputComponent;
@@ -0,0 +1,8 @@
1
+ import type { InputComponent, UpdateComponent } from '../types';
2
+ import type { IsInvalidCheck } from '../validation/value-checks';
3
+ export type NumberInputComponent = InputComponent<number> & {
4
+ type: 'number';
5
+ };
6
+ export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "value" | "autoComplete" | "uid"> & {
7
+ checks: IsInvalidCheck<number | null>[];
8
+ }, updateComponent: UpdateComponent) => NumberInputComponent;
@@ -1,12 +1,12 @@
1
- import type { ObjectModel } from '@wise/dynamic-flow-types';
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { BaseComponent, StepComponent } from '../types';
3
- export type ObjectComponent = BaseComponent & {
3
+ export type ObjectComponent = Omit<BaseComponent<Record<string, Model>>, 'getValue'> & {
4
4
  type: 'object';
5
5
  title?: string;
6
6
  description?: string;
7
7
  componentMap: Record<string, StepComponent>;
8
8
  getChildren: () => StepComponent[];
9
- getValue: () => ObjectModel;
9
+ getValue: () => Record<string, Model>;
10
10
  };
11
11
  export declare const createObjectComponent: (objectProps: {
12
12
  uid: string;
@@ -1,11 +1,10 @@
1
- import type { Margin } from '@wise/dynamic-flow-types';
1
+ import type { Margin } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Align, LayoutComponent } from '../types';
3
3
  export type ParagraphComponent = LayoutComponent & {
4
4
  type: 'paragraph';
5
5
  text: string;
6
6
  control?: string;
7
7
  align: Align;
8
- getValue: () => null;
9
8
  };
10
9
  export declare const createParagraphComponent: (paragraphProps: {
11
10
  uid: string;
@@ -1,25 +1,8 @@
1
- import type { StringSchema } from '@wise/dynamic-flow-types';
2
1
  import type { InputComponent, UpdateComponent } from '../types';
3
- export type TextInputComponent = InputComponent & {
2
+ import type { IsInvalidCheck } from '../validation/value-checks';
3
+ export type TextInputComponent = InputComponent<string> & {
4
4
  type: 'text';
5
- title?: string;
6
- description?: string;
7
- placeholder?: string;
8
- control?: string;
9
- format?: 'date';
10
- value: string | null;
11
- errors: string[];
12
- onChange: (value: string | null) => void;
13
- getValue: () => string | null;
14
5
  };
15
- export declare const createTextInputComponent: (textInputProps: {
16
- uid: string;
17
- id: string;
18
- title?: string | undefined;
19
- description?: string | undefined;
20
- placeholder?: string | undefined;
21
- control?: StringSchema['control'];
22
- format: StringSchema['format'];
23
- value: string | null;
24
- validate: (value: string | null) => string[];
6
+ export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "value" | "autoComplete" | "uid"> & {
7
+ checks: IsInvalidCheck<string | null>[];
25
8
  }, updateComponent: UpdateComponent) => TextInputComponent;
@@ -0,0 +1,12 @@
1
+ import type { StepComponent, UpdateComponent } from '../../types';
2
+ /**
3
+ * Helper function to update a component.
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
+ * @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
11
+ */
12
+ export declare const getInputUpdateFunction: <C extends StepComponent>(uid: string, updateComponent: UpdateComponent) => (updateFn: (component: C) => void) => void;
@@ -0,0 +1,9 @@
1
+ import type { Step } from '@wise/dynamic-flow-types/build/next';
2
+ export type AnalyticsEventHandler = (eventName: string, properties?: Record<string, unknown>) => void;
3
+ export type AnalyticsEventDispatcher = (eventName: EventName, properties?: Record<string, unknown>) => void;
4
+ export declare const getAnalyticsEventDispatcher: ({ flowId, step, onEvent, }: {
5
+ flowId: string;
6
+ step?: Step | null | undefined;
7
+ onEvent?: AnalyticsEventHandler | undefined;
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';
@@ -0,0 +1,4 @@
1
+ export type LogLevel = 'info' | 'warning' | 'error';
2
+ export type LoggingEventHandler = (level: LogLevel, message: string, extra: Record<string, unknown>) => void;
3
+ export type LoggingEventDispatcher = (level: LogLevel, message: string, extra?: Record<string, unknown>) => void;
4
+ export declare const getLoggingEventDispatcher: (onLog?: LoggingEventHandler) => LoggingEventDispatcher;
@@ -0,0 +1,2 @@
1
+ export * from './getAnalyticsEventDispatcher';
2
+ export * from './getLogggingEventDispatcher';
@@ -1,3 +1,3 @@
1
- import type { AlertLayout } from '@wise/dynamic-flow-types';
1
+ import type { AlertLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
3
  export declare const alertLayoutToComponent: (uid: string, { markdown, margin, context }: AlertLayout, mapperProps: MapperProps) => import("../../components/AlertComponent").AlertComponent;
@@ -1,4 +1,4 @@
1
- import type { BoxLayout } from '@wise/dynamic-flow-types';
1
+ import type { BoxLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import { type BoxComponent } from '../../components/BoxComponent';
3
3
  import type { MapperProps } from '../schema/types';
4
4
  export declare const boxLayoutToComponent: (uid: string, { components, width, margin, border }: BoxLayout, mapperProps: MapperProps) => BoxComponent;
@@ -1,3 +1,3 @@
1
- import type { ButtonLayout } from '@wise/dynamic-flow-types';
1
+ import type { ButtonLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
3
  export declare const buttonLayoutToComponent: (uid: string, { title, action, context, disabled, control, margin }: ButtonLayout, { onAction }: MapperProps) => import("../../components/ButtonComponent").ButtonComponent;
@@ -1,4 +1,4 @@
1
- import type { ColumnsLayout } from '@wise/dynamic-flow-types';
1
+ import type { ColumnsLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
3
  import { type ColumnsComponent } from '../../components/ColumnsComponent';
4
4
  export declare const columnsLayoutToComponent: (uid: string, { left, right, bias, margin }: ColumnsLayout, mapperProps: MapperProps) => ColumnsComponent;
@@ -1,4 +1,4 @@
1
- import type { FormLayout } from '@wise/dynamic-flow-types';
1
+ import type { FormLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { StepComponent } from '../../types';
3
3
  import type { MapperProps } from '../schema/types';
4
4
  export declare const formLayoutToComponent: (uid: string, { schemaId }: FormLayout, mapperProps: MapperProps) => StepComponent;
@@ -1,3 +1,3 @@
1
- import type { HeadingLayout } from '@wise/dynamic-flow-types';
1
+ import type { HeadingLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
3
  export declare const headingLayoutToComponent: (uid: string, { text, size, margin, align }: HeadingLayout, mapperProps: MapperProps) => import("../../components/HeadingComponent").HeadingComponent;
@@ -1,3 +1,3 @@
1
- import type { ParagraphLayout } from '@wise/dynamic-flow-types';
1
+ import type { ParagraphLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
3
  export declare const paragraphLayoutToComponent: (uid: string, { text, control, align, margin }: ParagraphLayout, mapperProps: MapperProps) => import("../../components/ParagraphComponent").ParagraphComponent;
@@ -1,4 +1,4 @@
1
- import type { LayoutComponent } from '@wise/dynamic-flow-types';
1
+ import type { Layout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { StepComponent } from '../types';
3
3
  import type { MapperProps } from './schema/types';
4
- export declare const mapLayoutToComponent: (uid: string, layout: LayoutComponent, mapperProps: MapperProps) => StepComponent;
4
+ export declare const mapLayoutToComponent: (uid: string, layout: Layout, mapperProps: MapperProps) => StepComponent;
@@ -1,3 +1,3 @@
1
1
  import type { StepComponent } from '../types';
2
2
  import type { MapperProps, SchemaMapperProps } from './schema/types';
3
- export declare const mapSchemaToComponent: (uid: string, { schema, model }: SchemaMapperProps, mapperProps: MapperProps) => StepComponent;
3
+ export declare const mapSchemaToComponent: (uid: string, schemaMapperProps: SchemaMapperProps, mapperProps: MapperProps) => StepComponent;
@@ -0,0 +1,5 @@
1
+ import type { MapperProps, SchemaMapperProps } from './types';
2
+ import type { IntegerSchema } from '@wise/dynamic-flow-types/build/next';
3
+ export declare const integerSchemaToComponent: (uid: string, schemaMapperProps: SchemaMapperProps & {
4
+ schema: IntegerSchema;
5
+ }, mapperProps: MapperProps) => import("../../components/IntegerInputComponent").IntegerInputComponent;
@@ -0,0 +1,5 @@
1
+ import type { MapperProps, SchemaMapperProps } from './types';
2
+ import type { NumberSchema } from '@wise/dynamic-flow-types/build/next';
3
+ export declare const numberSchemaToComponent: (uid: string, schemaMapperProps: SchemaMapperProps & {
4
+ schema: NumberSchema;
5
+ }, mapperProps: MapperProps) => import("../../components/NumberInputComponent").NumberInputComponent;
@@ -1,5 +1,5 @@
1
- import type { ObjectSchema } from '@wise/dynamic-flow-types';
1
+ import type { ObjectSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps, SchemaMapperProps } from './types';
3
- export declare const objectSchemaToComponent: (uid: string, { schema, model }: SchemaMapperProps & {
3
+ export declare const objectSchemaToComponent: (uid: string, { schema, model, validationErrors }: SchemaMapperProps & {
4
4
  schema: ObjectSchema;
5
5
  }, mapperProps: MapperProps) => import("../../components/ObjectComponent").ObjectComponent;
@@ -1,12 +1,5 @@
1
- import type { StringSchema } from '@wise/dynamic-flow-types';
1
+ import type { StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps, SchemaMapperProps } from './types';
3
- import type { GetErrorMessageFunctions } from '../types';
4
- export declare const stringSchemaToComponent: (uid: string, { schema, model, required }: SchemaMapperProps & {
3
+ export declare const stringSchemaToComponent: (uid: string, schemaMapperProps: SchemaMapperProps & {
5
4
  schema: StringSchema;
6
5
  }, mapperProps: MapperProps) => import("../../components/TextInputComponent").TextInputComponent;
7
- export declare const getStringValidationErrors: ({ schema, model, required, getErrorMessageFunctions, }: {
8
- schema: StringSchema;
9
- model: string | null;
10
- required: boolean;
11
- getErrorMessageFunctions: GetErrorMessageFunctions;
12
- }) => string[];
@@ -0,0 +1,21 @@
1
+ /// <reference types="jest" />
2
+ import type { Schema, Step } from '@wise/dynamic-flow-types/build/next';
3
+ import type { MapperProps, SchemaMapperProps } from '../types';
4
+ import type { StepComponent } from '../../../types';
5
+ export declare const getMockMapperProps: (mapperProps?: Partial<MapperProps>) => {
6
+ step: Step;
7
+ getErrorMessageFunctions: jest.Mock<any, any, any> | import("../../types").GetErrorMessageFunctions;
8
+ onAction: jest.Mock<any, any, any> | import("../../../types").OnAction;
9
+ 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;
12
+ };
13
+ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperProps: Partial<SchemaMapperProps> & {
14
+ schema: S;
15
+ }) => {
16
+ schema: (Schema | undefined) & S;
17
+ model: import("@wise/dynamic-flow-types/build/next").Model;
18
+ required: boolean;
19
+ validationErrors: import("@wise/dynamic-flow-types/build/next").ValidationError;
20
+ };
21
+ export declare const mockUpdateFunction: <C extends StepComponent>(draftComponent: C) => jest.Mock<any, any, any>;
@@ -1,14 +1,18 @@
1
- import type { Step as DFStep, Model, Schema } from '@wise/dynamic-flow-types';
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
5
  export type MapperProps = {
5
6
  step: DFStep;
6
7
  getErrorMessageFunctions: GetErrorMessageFunctions;
7
8
  onAction: OnAction;
8
9
  updateComponent: UpdateComponent;
10
+ trackEvent: AnalyticsEventDispatcher;
11
+ logEvent: LoggingEventDispatcher;
9
12
  };
10
13
  export type SchemaMapperProps = {
11
14
  schema: Schema;
12
15
  model: Model;
13
16
  required?: boolean;
17
+ validationErrors?: ValidationError;
14
18
  };
@@ -1,10 +1,12 @@
1
- export type GetErrorMessageFunctions = (validationMessages?: Record<string, string>) => ErrorMessageFunctions;
1
+ export type GetErrorMessageFunctions = (validationMessages?: ValidationMessages) => ErrorMessageFunctions;
2
+ export type ValidationMessages = Record<string, string | undefined>;
2
3
  export type ErrorMessageFunctions = {
3
- minimumDate: (minDate: string) => string;
4
+ maximum: (maximum: number) => string;
5
+ minimum: (minimum: number) => string;
4
6
  maximumDate: (maxDate: string) => string;
5
- minLength: (minLength: number) => string;
7
+ minimumDate: (minDate: string) => string;
6
8
  maxLength: (maxLength: number) => string;
9
+ minLength: (minLength: number) => string;
7
10
  pattern: () => string;
8
11
  required: () => string;
9
- type: () => string;
10
12
  };
@@ -0,0 +1,2 @@
1
+ import type { AutocompleteToken } from '@wise/dynamic-flow-types';
2
+ export declare const getAutocompleteString: (hints: AutocompleteToken[] | undefined) => string;
@@ -1,5 +1,5 @@
1
- import type { Context, LegacyContext, Align as DFAlign } from '@wise/dynamic-flow-types';
2
- import type { Align, Bias } from '../../types';
3
- export declare const mapLegacyContext: (context: Context | LegacyContext) => "warning" | "positive" | "negative" | "neutral";
1
+ import type { Context as DFContext, Align as DFAlign } from '@wise/dynamic-flow-types/build/next';
2
+ import type { Align, Bias, Context } from '../../types';
3
+ export declare const mapLegacyContext: (context: DFContext) => Context;
4
4
  export declare const mapLegacyBias: (bias: 'left' | 'right' | 'none') => Bias;
5
5
  export declare const mapLegacyAlign: (align: DFAlign) => Align;
@@ -1,4 +1,4 @@
1
- import type { Action, Margin } from '@wise/dynamic-flow-types';
1
+ import type { Action, Margin, Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { AlertComponent } from './components/AlertComponent';
3
3
  import type { BoxComponent } from './components/BoxComponent';
4
4
  import type { ButtonComponent } from './components/ButtonComponent';
@@ -7,20 +7,37 @@ import type { ObjectComponent } from './components/ObjectComponent';
7
7
  import type { ParagraphComponent } from './components/ParagraphComponent';
8
8
  import type { TextInputComponent } from './components/TextInputComponent';
9
9
  import type { ColumnsComponent } from './components/ColumnsComponent';
10
- export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | HeadingComponent | ObjectComponent | ParagraphComponent | TextInputComponent;
10
+ import type { NumberInputComponent } from './components/NumberInputComponent';
11
+ import type { IntegerInputComponent } from './components/IntegerInputComponent';
12
+ export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | HeadingComponent | ObjectComponent | ParagraphComponent | TextInputComponent | NumberInputComponent | IntegerInputComponent;
11
13
  export type ContainerComponent = ObjectComponent | BoxComponent | ColumnsComponent;
12
- export type BaseComponent = {
14
+ export type BaseComponent<M extends Model> = {
13
15
  type: string;
14
16
  uid: string;
15
17
  validate: () => boolean;
18
+ getValue: () => M | null;
16
19
  };
17
- export type LayoutComponent = BaseComponent & {
20
+ export type LayoutComponent = BaseComponent<Model> & {
18
21
  margin: Margin;
22
+ getValue: () => null;
19
23
  };
20
- export type InputComponent = BaseComponent & {
24
+ export type InputComponent<M extends Model> = BaseComponent<M> & {
21
25
  id: string;
26
+ autoComplete: string;
27
+ control?: string;
28
+ description?: string;
29
+ disabled: boolean;
30
+ errors: string[];
31
+ placeholder?: string;
32
+ title?: string;
33
+ value: M | null;
34
+ onChange: (value: M | null) => void;
35
+ onBlur: () => void;
36
+ onFocus: () => void;
37
+ getValue: () => M | null;
22
38
  };
23
39
  export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
24
40
  export type OnAction = (action: Action) => void;
25
41
  export type Align = 'start' | 'center' | 'end';
26
42
  export type Bias = 'none' | 'start' | 'end';
43
+ export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
@@ -0,0 +1,6 @@
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { IsInvalidCheck } from './value-checks';
3
+ export declare const getModelValidationErrors: <M extends Model>({ checks, model, }: {
4
+ checks: IsInvalidCheck<M>[];
5
+ model: M;
6
+ }) => string[];
@@ -0,0 +1,11 @@
1
+ /// <reference types="jest" />
2
+ export declare const mockErrorMessageFunctions: {
3
+ minimum: jest.Mock<any, any, any>;
4
+ maximum: jest.Mock<any, any, any>;
5
+ minimumDate: jest.Mock<any, any, any>;
6
+ maximumDate: jest.Mock<any, any, any>;
7
+ minLength: jest.Mock<any, any, any>;
8
+ maxLength: jest.Mock<any, any, any>;
9
+ pattern: jest.Mock<any, any, any>;
10
+ required: jest.Mock<any, any, any>;
11
+ };