@wise/dynamic-flow-client 2.7.1 → 2.8.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.
Files changed (58) hide show
  1. package/README.md +42 -13
  2. package/build/i18n/en.json +4 -0
  3. package/build/i18n/pt.json +2 -2
  4. package/build/i18n/zh_CN.json +20 -20
  5. package/build/main.css +0 -20
  6. package/build/main.js +332 -295
  7. package/build/main.min.js +1 -1
  8. package/build/types/dynamic-flow-types.d.ts +1 -1
  9. package/build/types/legacy/common/constants/FeatureName.d.ts +1 -1
  10. package/build/types/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +1 -1
  11. package/build/types/legacy/common/utils/debounce.d.ts +2 -2
  12. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +5 -5
  13. package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +40 -0
  14. package/build/types/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +1 -1
  15. package/build/types/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +2 -1
  16. package/build/types/legacy/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +1 -1
  17. package/build/types/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +3 -0
  18. package/build/types/legacy/step/cameraStep/cameraCapture/screens/index.d.ts +1 -2
  19. package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +4 -3
  20. package/build/types/legacy/step/cameraStep/cameraCapture/types/index.d.ts +11 -0
  21. package/build/types/revamp/domain/components/BoxComponent.d.ts +2 -2
  22. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +20 -0
  23. package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -2
  24. package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -2
  25. package/build/types/revamp/domain/components/ParagraphComponent.d.ts +2 -2
  26. package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -3
  27. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +2 -2
  28. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +4 -0
  29. package/build/types/revamp/domain/mappers/mapStepToComponents.d.ts +2 -9
  30. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +8 -1
  31. package/build/types/revamp/domain/mappers/schema/types.d.ts +3 -0
  32. package/build/types/revamp/domain/mappers/types.d.ts +10 -0
  33. package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +4 -1
  34. package/build/types/revamp/domain/mappers/utils/type-validators.d.ts +9 -0
  35. package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +10 -0
  36. package/build/types/revamp/domain/types.d.ts +9 -9
  37. package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +1 -1
  38. package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +1 -1
  39. package/build/types/revamp/renderers/mappers/columnsComponentToProps.d.ts +4 -0
  40. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +5 -1
  41. package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +1 -1
  42. package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +1 -1
  43. package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +1 -1
  44. package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +1 -1
  45. package/build/types/revamp/renderers/types.d.ts +18 -9
  46. package/build/types/revamp/step/utils/getRenderFunction.d.ts +3 -0
  47. package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +4 -0
  48. package/build/types/revamp/utils/type-utils.d.ts +2 -0
  49. package/build/types/revamp/utils/validateComponents.d.ts +2 -0
  50. package/build/types/revamp/wise/renderers/ColumnsRenderer.d.ts +3 -0
  51. package/package.json +4 -3
  52. package/build/types/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -2
  53. package/build/types/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -13
  54. package/build/types/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -5
  55. package/build/types/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -18
  56. package/build/types/revamp/renderers/utils/mapping-utils.d.ts +0 -3
  57. package/build/types/revamp/step/utils/render-utils.d.ts +0 -5
  58. /package/build/types/{legacy/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts → common/validationMessages/validation.messages.d.ts} +0 -0
@@ -10,7 +10,7 @@ export type DynamicFlowPropsWithInitialStep = DynamicFlowPropsBasic & {
10
10
  };
11
11
  export type HttpClient = typeof fetch;
12
12
  export type EventHandler = (eventName: EventName, properties: Record<string, unknown>) => void;
13
- export type EventName = 'Dynamic Flow - Flow Started' | 'Dynamic Flow - Flow Finished' | 'Dynamic Flow - Step Started' | 'Dynamic Flow - Step Submitted' | 'Dynamic Flow - Step Refreshed' | 'Dynamic Flow - OneOf Selected' | 'Dynamic Flow - PersistAsync' | 'Dynamic Flow - ValidationAsync' | 'Dynamic Flow - Camera Permission Denied' | 'Dynamic Flow - Camera Feed Started' | 'Dynamic Flow - Camera Not Supported' | 'Dynamic Flow - Search Started' | 'Dynamic Flow - Search Result Selected' | 'Dynamic Flow - invalid submission response' | 'Dynamic Flow - onAction supressed' | 'Dynamic Flow - OneOf Searched';
13
+ export type EventName = 'Dynamic Flow - Flow Started' | 'Dynamic Flow - Flow Finished' | 'Dynamic Flow - Step Started' | 'Dynamic Flow - Step Submitted' | 'Dynamic Flow - Step Refreshed' | 'Dynamic Flow - OneOf Selected' | 'Dynamic Flow - PersistAsync' | 'Dynamic Flow - ValidationAsync' | 'Dynamic Flow - Camera Permission Denied' | 'Dynamic Flow - Camera Feed Started' | 'Dynamic Flow - Camera Not Supported' | 'Dynamic Flow - Camera Not Accessible' | 'Dynamic Flow - Camera Orientation Locked' | 'Dynamic Flow - Camera Orientation Lock Overlay Shown' | 'Dynamic Flow - Search Started' | 'Dynamic Flow - Search Result Selected' | 'Dynamic Flow - invalid submission response' | 'Dynamic Flow - onAction supressed' | 'Dynamic Flow - OneOf Searched';
14
14
  export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
15
15
  export type LogEventHandler = (level: LogLevel, message: string, extra: Record<string, unknown>) => void;
16
16
  export type Feature = {
@@ -1,3 +1,3 @@
1
1
  export declare enum FeatureName {
2
- CAMERA_ORIENTATION_LOCK = "camera-orientation-lock"
2
+ SAMPLE_FEATURE = "sample-feature"
3
3
  }
@@ -1,2 +1,2 @@
1
1
  import { type DebouncedFunc } from '../../utils';
2
- export declare function useDebouncedFunction<T extends (...args: any[]) => any>(callback: T, waitMs: number): DebouncedFunc<T>;
2
+ export declare function useDebouncedFunction<T extends (...args: Parameters<T>) => ReturnType<T>>(callback: T, waitMs: number): DebouncedFunc<T>;
@@ -1,6 +1,6 @@
1
- export interface DebouncedFunc<T extends (...args: any[]) => any> {
1
+ export interface DebouncedFunc<T extends (...args: Parameters<T>) => ReturnType<T>> {
2
2
  (...args: Parameters<T>): void;
3
3
  cancel: () => void;
4
4
  flush: () => void;
5
5
  }
6
- export declare const debounce: <T extends (...args: any[]) => any>(callback: T, waitMs: number) => DebouncedFunc<T>;
6
+ export declare const debounce: <T extends (...args: Parameters<T>) => ReturnType<T>>(callback: T, waitMs: number) => DebouncedFunc<T>;
@@ -1,13 +1,13 @@
1
- import { Schema } from '@wise/dynamic-flow-types';
2
- declare const ControlFeedback: {
3
- (props: ControlFeedbackProps): JSX.Element;
4
- defaultProps: {
1
+ import type { Schema } from '@wise/dynamic-flow-types';
2
+ declare function ControlFeedback(props: ControlFeedbackProps): JSX.Element;
3
+ declare namespace ControlFeedback {
4
+ var defaultProps: {
5
5
  errors: string;
6
6
  validations: never[];
7
7
  validationMessages: {};
8
8
  validationAsyncSuccessMessage: null;
9
9
  };
10
- };
10
+ }
11
11
  type ValidationMessages = {
12
12
  minimum?: string;
13
13
  maximum?: string;
@@ -14,5 +14,45 @@ declare const _default: {
14
14
  defaultMessage: string;
15
15
  description: string;
16
16
  };
17
+ cameraNotSupportedTitle: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
22
+ cameraNotSupportedParagraph: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ noCameraAccessTitle: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
32
+ noCameraAccessParagraph: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
37
+ noCameraAccessAction: {
38
+ id: string;
39
+ defaultMessage: string;
40
+ description: string;
41
+ };
42
+ cameraConnectionIssueTitle: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ cameraConnectionIssueParagraph: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
52
+ cameraConnectionIssueAction: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ description: string;
56
+ };
17
57
  };
18
58
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const OrientationLockOverlay: () => JSX.Element;
1
+ declare function OrientationLockOverlay(): JSX.Element;
2
2
  export default OrientationLockOverlay;
@@ -1,4 +1,5 @@
1
- export declare const useFullScreenOrientationLock: (shouldLockOrientation: boolean) => {
1
+ import type { EventHandler } from '../../../../../dynamic-flow-types';
2
+ export declare const useFullScreenOrientationLock: (shouldLockOrientation: boolean, onEvent: EventHandler | undefined) => {
2
3
  enterFullScreen: () => void;
3
4
  exitFullScreen: () => void;
4
5
  };
@@ -6,5 +6,5 @@ type Props = {
6
6
  instructions?: string;
7
7
  reviewInstructions?: string;
8
8
  };
9
- declare function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions, }: Props): JSX.Element;
9
+ declare function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }: Props): JSX.Element;
10
10
  export default Overlay;
@@ -0,0 +1,3 @@
1
+ import type { CameraError } from '../../types';
2
+ declare function CameraErrorScreen({ title, description, actionButton, onAction }: CameraError): JSX.Element;
3
+ export default CameraErrorScreen;
@@ -1,2 +1 @@
1
- export { default as NoCameraAccess } from './NoCameraAccess/NoCameraAccess';
2
- export { default as CameraNotSupported } from './CameraNotSupported/CameraNotSupported';
1
+ export { default as CameraErrorScreen } from "./cameraErrorScreen/CameraErrorScreen";
@@ -1,7 +1,8 @@
1
1
  import type { CameraDirection } from '@wise/dynamic-flow-types';
2
- import type { EventHandler } from '../../../../../dynamic-flow-types';
3
- export declare const trackCameraPermissionDenied: (onEvent: EventHandler | undefined) => void | undefined;
2
+ import type { EventHandler, EventName } from '../../../../../dynamic-flow-types';
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;
6
6
  }, stream: MediaStream) => Promise<void | undefined>;
7
- export declare const trackCameraNotSupported: (onEvent: EventHandler | undefined, error: string | DOMException) => void | undefined;
7
+ export declare const trackCameraOrientationLandscape: (onEvent: EventHandler | undefined) => void;
8
+ export declare const trackCameraOrientationLocked: (onEvent: EventHandler | undefined) => void;
@@ -0,0 +1,11 @@
1
+ export declare enum CameraMode {
2
+ CAPTURE = "CAPTURE",
3
+ REVIEW = "REVIEW",
4
+ ERROR = "ERROR"
5
+ }
6
+ export type CameraError = {
7
+ title: string;
8
+ description: string;
9
+ actionButton?: string;
10
+ onAction?: () => void;
11
+ };
@@ -1,6 +1,6 @@
1
1
  import type { Margin, Model, Size } from '@wise/dynamic-flow-types';
2
- import type { RenderableComponent, StepComponent } from '../types';
3
- export type BoxComponent = RenderableComponent & {
2
+ import type { BaseComponent, StepComponent } from '../types';
3
+ export type BoxComponent = BaseComponent & {
4
4
  type: 'box';
5
5
  border: boolean;
6
6
  width: Size;
@@ -0,0 +1,20 @@
1
+ import type { Margin, Model } from '@wise/dynamic-flow-types';
2
+ import type { BaseComponent, Bias, StepComponent } from '../types';
3
+ export type ColumnsComponent = BaseComponent & {
4
+ type: 'columns';
5
+ bias: Bias;
6
+ control?: string;
7
+ margin: Margin;
8
+ startComponents: StepComponent[];
9
+ endComponents: StepComponent[];
10
+ getChildren: () => StepComponent[];
11
+ getValue: () => Model;
12
+ };
13
+ export declare const createColumnsComponent: (columnsProps: {
14
+ uid: string;
15
+ bias: Bias;
16
+ control?: string;
17
+ margin: Margin;
18
+ startComponents: StepComponent[];
19
+ endComponents: StepComponent[];
20
+ }) => ColumnsComponent;
@@ -1,5 +1,5 @@
1
- import type { Align, Margin, Size } from '@wise/dynamic-flow-types';
2
- import type { LayoutComponent } from '../types';
1
+ import type { Margin, Size } from '@wise/dynamic-flow-types';
2
+ import type { Align, LayoutComponent } from '../types';
3
3
  export type HeadingComponent = LayoutComponent & {
4
4
  type: 'heading';
5
5
  text: string;
@@ -1,6 +1,6 @@
1
1
  import type { ObjectModel } from '@wise/dynamic-flow-types';
2
- import type { RenderableComponent, StepComponent } from '../types';
3
- export type ObjectComponent = RenderableComponent & {
2
+ import type { BaseComponent, StepComponent } from '../types';
3
+ export type ObjectComponent = BaseComponent & {
4
4
  type: 'object';
5
5
  title?: string;
6
6
  description?: string;
@@ -1,5 +1,5 @@
1
- import type { Align, Margin } from '@wise/dynamic-flow-types';
2
- import type { LayoutComponent } from '../types';
1
+ import type { Margin } from '@wise/dynamic-flow-types';
2
+ import type { Align, LayoutComponent } from '../types';
3
3
  export type ParagraphComponent = LayoutComponent & {
4
4
  type: 'paragraph';
5
5
  text: string;
@@ -1,14 +1,14 @@
1
1
  import type { StringSchema } from '@wise/dynamic-flow-types';
2
2
  import type { InputComponent, UpdateComponent } from '../types';
3
- type TextInputFormat = 'text' | 'date';
4
3
  export type TextInputComponent = InputComponent & {
5
4
  type: 'text';
6
5
  title?: string;
7
6
  description?: string;
8
7
  placeholder?: string;
9
8
  control?: string;
10
- format: TextInputFormat;
9
+ format?: 'date';
11
10
  value: string | null;
11
+ errors: string[];
12
12
  onChange: (value: string | null) => void;
13
13
  getValue: () => string | null;
14
14
  };
@@ -21,5 +21,5 @@ export declare const createTextInputComponent: (textInputProps: {
21
21
  control?: StringSchema['control'];
22
22
  format: StringSchema['format'];
23
23
  value: string | null;
24
+ validate: (value: string | null) => string[];
24
25
  }, updateComponent: UpdateComponent) => TextInputComponent;
25
- export {};
@@ -1,4 +1,4 @@
1
1
  import type { BoxLayout } from '@wise/dynamic-flow-types';
2
- import type { StepComponent } from '../../types';
2
+ import { type BoxComponent } from '../../components/BoxComponent';
3
3
  import type { MapperProps } from '../schema/types';
4
- export declare const boxLayoutToComponent: (uid: string, { components, width, margin, border }: BoxLayout, mapperProps: MapperProps) => StepComponent;
4
+ export declare const boxLayoutToComponent: (uid: string, { components, width, margin, border }: BoxLayout, mapperProps: MapperProps) => BoxComponent;
@@ -0,0 +1,4 @@
1
+ import type { ColumnsLayout } from '@wise/dynamic-flow-types';
2
+ import type { MapperProps } from '../schema/types';
3
+ import { type ColumnsComponent } from '../../components/ColumnsComponent';
4
+ export declare const columnsLayoutToComponent: (uid: string, { left, right, bias, margin }: ColumnsLayout, mapperProps: MapperProps) => ColumnsComponent;
@@ -1,9 +1,2 @@
1
- import type { Step as DFStep } from '@wise/dynamic-flow-types';
2
- import type { OnAction, UpdateComponent } from '../types';
3
- type MapStepToComponentsProps = {
4
- step: DFStep;
5
- updateComponent: UpdateComponent;
6
- onAction: OnAction;
7
- };
8
- export declare const mapStepToComponents: (mapperProps: MapStepToComponentsProps) => import("../types").StepComponent[];
9
- export {};
1
+ import type { MapperProps } from './schema/types';
2
+ export declare const mapStepToComponents: (mapperProps: MapperProps) => import("../types").StepComponent[];
@@ -1,5 +1,12 @@
1
1
  import type { StringSchema } from '@wise/dynamic-flow-types';
2
2
  import type { MapperProps, SchemaMapperProps } from './types';
3
- export declare const stringSchemaToComponent: (uid: string, { schema, model }: SchemaMapperProps & {
3
+ import type { GetErrorMessageFunctions } from '../types';
4
+ export declare const stringSchemaToComponent: (uid: string, { schema, model, required }: SchemaMapperProps & {
4
5
  schema: StringSchema;
5
6
  }, 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[];
@@ -1,11 +1,14 @@
1
1
  import type { Step as DFStep, Model, Schema } from '@wise/dynamic-flow-types';
2
2
  import type { OnAction, UpdateComponent } from '../../types';
3
+ import type { GetErrorMessageFunctions } from '../types';
3
4
  export type MapperProps = {
4
5
  step: DFStep;
6
+ getErrorMessageFunctions: GetErrorMessageFunctions;
5
7
  onAction: OnAction;
6
8
  updateComponent: UpdateComponent;
7
9
  };
8
10
  export type SchemaMapperProps = {
9
11
  schema: Schema;
10
12
  model: Model;
13
+ required?: boolean;
11
14
  };
@@ -0,0 +1,10 @@
1
+ export type GetErrorMessageFunctions = (validationMessages?: Record<string, string>) => ErrorMessageFunctions;
2
+ export type ErrorMessageFunctions = {
3
+ minimumDate: (minDate: string) => string;
4
+ maximumDate: (maxDate: string) => string;
5
+ minLength: (minLength: number) => string;
6
+ maxLength: (maxLength: number) => string;
7
+ pattern: () => string;
8
+ required: () => string;
9
+ type: () => string;
10
+ };
@@ -1,2 +1,5 @@
1
- import type { Context, LegacyContext } from '@wise/dynamic-flow-types';
1
+ import type { Context, LegacyContext, Align as DFAlign } from '@wise/dynamic-flow-types';
2
+ import type { Align, Bias } from '../../types';
2
3
  export declare const mapLegacyContext: (context: Context | LegacyContext) => "warning" | "positive" | "negative" | "neutral";
4
+ export declare const mapLegacyBias: (bias: 'left' | 'right' | 'none') => Bias;
5
+ export declare const mapLegacyAlign: (align: DFAlign) => Align;
@@ -0,0 +1,9 @@
1
+ export declare const isString: (value: unknown) => value is string;
2
+ export declare const isNumber: (value: unknown) => value is number;
3
+ export declare const isInteger: (value: unknown) => value is number;
4
+ export declare const isBoolean: (value: unknown) => value is boolean;
5
+ export declare const isObject: (value: unknown) => value is Record<string, unknown>;
6
+ export declare const isArray: (value: unknown) => value is unknown[];
7
+ export declare const isNull: (value: unknown) => value is null;
8
+ export declare const isUndefined: (value: unknown) => value is undefined;
9
+ export declare const isNullish: (v: unknown) => v is null | undefined;
@@ -0,0 +1,10 @@
1
+ import type { StringSchema } from '@wise/dynamic-flow-types';
2
+ type IsInvalidCheck = (schema: StringSchema, model: string | null) => boolean;
3
+ export declare const isAboveMaximum: IsInvalidCheck;
4
+ export declare const isAboveMaxLength: IsInvalidCheck;
5
+ export declare const isBelowMinimum: IsInvalidCheck;
6
+ export declare const isBelowMinLength: IsInvalidCheck;
7
+ export declare const isNotAdheringToPattern: IsInvalidCheck;
8
+ export declare const isNotCorrectType: IsInvalidCheck;
9
+ export declare const isNotProvided: IsInvalidCheck;
10
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Action, Margin, Model } from '@wise/dynamic-flow-types';
1
+ import type { Action, Margin } from '@wise/dynamic-flow-types';
2
2
  import type { AlertComponent } from './components/AlertComponent';
3
3
  import type { BoxComponent } from './components/BoxComponent';
4
4
  import type { ButtonComponent } from './components/ButtonComponent';
@@ -6,21 +6,21 @@ import type { HeadingComponent } from './components/HeadingComponent';
6
6
  import type { ObjectComponent } from './components/ObjectComponent';
7
7
  import type { ParagraphComponent } from './components/ParagraphComponent';
8
8
  import type { TextInputComponent } from './components/TextInputComponent';
9
- export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | HeadingComponent | ObjectComponent | ParagraphComponent | TextInputComponent;
10
- export type ContainerComponent = ObjectComponent | BoxComponent;
9
+ import type { ColumnsComponent } from './components/ColumnsComponent';
10
+ export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | HeadingComponent | ObjectComponent | ParagraphComponent | TextInputComponent;
11
+ export type ContainerComponent = ObjectComponent | BoxComponent | ColumnsComponent;
11
12
  export type BaseComponent = {
12
13
  type: string;
13
14
  uid: string;
14
- getValue: () => Model;
15
+ validate: () => boolean;
15
16
  };
16
- export type RenderableComponent = BaseComponent & {
17
- keyProp: string;
18
- };
19
- export type LayoutComponent = RenderableComponent & {
17
+ export type LayoutComponent = BaseComponent & {
20
18
  margin: Margin;
21
19
  };
22
- export type InputComponent = RenderableComponent & {
20
+ export type InputComponent = BaseComponent & {
23
21
  id: string;
24
22
  };
25
23
  export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
26
24
  export type OnAction = (action: Action) => void;
25
+ export type Align = 'start' | 'center' | 'end';
26
+ export type Bias = 'none' | 'start' | 'end';
@@ -1,3 +1,3 @@
1
1
  import type { AlertComponent } from '../../domain/components/AlertComponent';
2
2
  import type { AlertRendererProps } from '../types';
3
- export declare const alertComponentToProps: ({ keyProp, markdown, margin, context, }: AlertComponent) => AlertRendererProps;
3
+ export declare const alertComponentToProps: ({ markdown, margin, context, }: AlertComponent) => AlertRendererProps;
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { BoxComponent } from '../../domain/components/BoxComponent';
3
3
  import type { BoxRendererProps } from '../types';
4
- export declare const boxComponentToProps: ({ keyProp, border, width, margin }: BoxComponent, children: ReactNode) => BoxRendererProps;
4
+ export declare const boxComponentToProps: ({ border, width, margin }: BoxComponent, children: ReactNode) => BoxRendererProps;
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ColumnsRendererProps } from '../types';
3
+ import type { ColumnsComponent } from '../../domain/components/ColumnsComponent';
4
+ export declare const columnsComponentToProps: ({ bias, control, margin }: ColumnsComponent, startChildren: ReactNode, endChildren: ReactNode) => ColumnsRendererProps;
@@ -1,4 +1,8 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { StepComponent } from '../../domain/types';
3
3
  import type { RendererProps } from '../types';
4
- export declare const componentToRendererProps: (component: StepComponent, children?: ReactNode) => RendererProps;
4
+ export declare const componentToRendererProps: (component: StepComponent, nestedContent: {
5
+ children?: ReactNode;
6
+ startChildren?: ReactNode;
7
+ endChildren?: ReactNode;
8
+ }) => RendererProps;
@@ -1,3 +1,3 @@
1
1
  import type { HeadingComponent } from '../../domain/components/HeadingComponent';
2
2
  import type { HeadingRendererProps } from '../types';
3
- export declare const headingComponentToProps: ({ keyProp, text, align, margin, size, }: HeadingComponent) => HeadingRendererProps;
3
+ export declare const headingComponentToProps: ({ text, align, margin, size, }: HeadingComponent) => HeadingRendererProps;
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ObjectComponent } from '../../domain/components/ObjectComponent';
3
3
  import type { ObjectRendererProps } from '../types';
4
- export declare const objectComponentToProps: ({ keyProp, title, description }: ObjectComponent, children: ReactNode) => ObjectRendererProps;
4
+ export declare const objectComponentToProps: ({ title, description }: ObjectComponent, children: ReactNode) => ObjectRendererProps;
@@ -1,3 +1,3 @@
1
1
  import type { ParagraphComponent } from '../../domain/components/ParagraphComponent';
2
2
  import type { ParagraphRendererProps } from '../types';
3
- export declare const paragraphComponentToProps: ({ keyProp, text, control, align, margin, }: ParagraphComponent) => ParagraphRendererProps;
3
+ export declare const paragraphComponentToProps: ({ text, control, align, margin, }: ParagraphComponent) => ParagraphRendererProps;
@@ -1,3 +1,3 @@
1
1
  import type { TextInputComponent } from '../../domain/components/TextInputComponent';
2
2
  import type { TextInputRendererProps } from '../types';
3
- export declare const textComponentToProps: ({ keyProp, format, id, title, description, placeholder, value, onChange, }: TextInputComponent) => TextInputRendererProps;
3
+ export declare const textComponentToProps: ({ format, errors, id, title, description, placeholder, value, onChange, }: TextInputComponent) => TextInputRendererProps;
@@ -2,15 +2,15 @@ import type { Context as DFContext, Margin as DFMargin, Size as DFSize } from '@
2
2
  import type { ReactNode } from 'react';
3
3
  export type Renderer<P extends RendererProps> = {
4
4
  canRender: (props: RendererProps) => boolean;
5
- render: (props: P) => ReactNode;
5
+ render: (props: P) => JSX.Element;
6
6
  };
7
7
  export type Align = 'start' | 'center' | 'end';
8
- export type Margin = DFMargin;
8
+ export type Bias = 'none' | 'start' | 'end';
9
9
  export type Context = DFContext;
10
+ export type Margin = DFMargin;
10
11
  export type Size = DFSize;
11
12
  export interface RendererProps {
12
13
  type: string;
13
- keyProp: string;
14
14
  }
15
15
  export interface AlertRendererProps extends RendererProps {
16
16
  type: 'alert';
@@ -25,6 +25,14 @@ export interface BoxRendererProps extends RendererProps {
25
25
  margin: Margin;
26
26
  children: ReactNode;
27
27
  }
28
+ export interface ColumnsRendererProps extends RendererProps {
29
+ type: 'columns';
30
+ control?: string;
31
+ bias: Bias;
32
+ margin: Margin;
33
+ startChildren: ReactNode;
34
+ endChildren: ReactNode;
35
+ }
28
36
  export interface HeadingRendererProps extends RendererProps {
29
37
  type: 'heading';
30
38
  text: string;
@@ -36,7 +44,7 @@ export interface HeadingRendererProps extends RendererProps {
36
44
  export interface ParagraphRendererProps extends RendererProps {
37
45
  type: 'paragraph';
38
46
  text: string;
39
- control?: 'copyable' | string;
47
+ control?: string;
40
48
  margin: Margin;
41
49
  align: Align;
42
50
  }
@@ -48,12 +56,13 @@ export interface ObjectRendererProps extends RendererProps {
48
56
  }
49
57
  export interface TextInputRendererProps extends RendererProps {
50
58
  type: 'input-text';
51
- control?: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
52
- format: 'text' | 'date';
53
59
  id: string;
54
- name: string;
55
- label?: string;
60
+ control?: string;
56
61
  description?: string;
62
+ error?: string;
63
+ format?: 'date';
64
+ label?: string;
65
+ name: string;
57
66
  placeholder?: string;
58
67
  value: string | null;
59
68
  onChange: (value: string | null) => void;
@@ -61,7 +70,7 @@ export interface TextInputRendererProps extends RendererProps {
61
70
  export interface ButtonRendererProps extends RendererProps {
62
71
  type: 'button';
63
72
  title: string;
64
- control?: 'primary' | 'secondary' | 'tertiary' | string;
73
+ control?: string;
65
74
  context: Context;
66
75
  disabled: boolean;
67
76
  margin: Margin;
@@ -0,0 +1,3 @@
1
+ import type { StepComponent } from '../../domain/types';
2
+ import type { Renderer, RendererProps } from '../../renderers/types';
3
+ export declare const getRenderFunction: (renderers: Renderer<RendererProps>[]) => (component: StepComponent) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { Schema } from '@wise/dynamic-flow-types';
2
+ import type { IntlFormatters } from 'react-intl';
3
+ import type { ErrorMessageFunctions } from '../../domain/mappers/types';
4
+ export declare function getSchemaErrorMessageFunction(formatMessage: IntlFormatters['formatMessage'], locale: string): (validationMessages: Schema['validationMessages']) => ErrorMessageFunctions;
@@ -1,4 +1,6 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types';
2
2
  import type { ContainerComponent, StepComponent } from '../domain/types';
3
+ import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
3
4
  export declare const isContainerComponent: (component: StepComponent) => component is ContainerComponent;
5
+ export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
4
6
  export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
@@ -0,0 +1,2 @@
1
+ import type { StepComponent } from '../domain/types';
2
+ export declare const validateComponents: (components: StepComponent[]) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { ColumnsRendererProps, Renderer } from '../../renderers/types';
2
+ declare const ColumnsRenderer: Renderer<ColumnsRendererProps>;
3
+ export default ColumnsRenderer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -48,6 +48,7 @@
48
48
  "@types/jest": "29.5.10",
49
49
  "@types/react": "18",
50
50
  "@types/react-dom": "18",
51
+ "@types/react-intl": "3.0.0",
51
52
  "@types/testing-library__jest-dom": "5.14.9",
52
53
  "@wise/art": "2.8.4",
53
54
  "@wise/components-theming": "^0.8.4",
@@ -90,7 +91,7 @@
90
91
  "classnames": "2.3.2",
91
92
  "react-webcam": "^7.2.0",
92
93
  "screenfull": "^5.2.0",
93
- "@wise/dynamic-flow-types": "2.3.1"
94
+ "@wise/dynamic-flow-types": "2.4.0"
94
95
  },
95
96
  "scripts": {
96
97
  "dev": "storybook dev -p 3003",
@@ -98,7 +99,7 @@
98
99
  "build:types": "tsc --project ./tsconfig.types.json",
99
100
  "build:js": "node ./scripts/build.mjs",
100
101
  "build:css": "postcss src/main.css -o build/main.css",
101
- "build:messages-source": "formatjs extract 'src/**/*.messages.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
102
+ "build:messages-source": "formatjs extract 'src/**/{*.messages,messages}.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
102
103
  "build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
103
104
  "test": "npm-run-all test:once test:tz",
104
105
  "test:once": "jest --config jest.config.js --env=jsdom -w 2",
@@ -1,2 +0,0 @@
1
- declare const CameraNotSupported: () => JSX.Element;
2
- export default CameraNotSupported;
@@ -1,13 +0,0 @@
1
- declare const _default: {
2
- title: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- paragraph: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- };
13
- export default _default;
@@ -1,5 +0,0 @@
1
- type Props = {
2
- onAction: () => void;
3
- };
4
- declare function NoCameraAccess({ onAction }: Props): JSX.Element;
5
- export default NoCameraAccess;
@@ -1,18 +0,0 @@
1
- declare const _default: {
2
- title: {
3
- id: string;
4
- defaultMessage: string;
5
- description: string;
6
- };
7
- paragraph: {
8
- id: string;
9
- defaultMessage: string;
10
- description: string;
11
- };
12
- action: {
13
- id: string;
14
- defaultMessage: string;
15
- description: string;
16
- };
17
- };
18
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { Align as DFAlign } from '@wise/dynamic-flow-types';
2
- import type { Align } from '../types';
3
- export declare const mapAlign: (align: DFAlign) => Align;