@wise/dynamic-flow-client 2.8.0 → 2.8.1

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 (32) hide show
  1. package/build/main.js +1 -1
  2. package/build/main.min.js +1 -1
  3. package/build/types/revamp/DynamicFlowRevamp.d.ts +5 -1
  4. package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -3
  5. package/build/types/revamp/domain/components/BoxComponent.d.ts +2 -3
  6. package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -4
  7. package/build/types/revamp/domain/components/ColumnsComponent.d.ts +2 -3
  8. package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -2
  9. package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -3
  10. package/build/types/revamp/domain/components/ParagraphComponent.d.ts +1 -2
  11. package/build/types/revamp/domain/components/TextInputComponent.d.ts +4 -5
  12. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  13. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
  14. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  15. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
  16. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  17. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  18. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  19. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +2 -2
  20. package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +1 -1
  21. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +1 -1
  22. package/build/types/revamp/domain/mappers/schema/types.d.ts +1 -1
  23. package/build/types/revamp/domain/mappers/types.d.ts +2 -1
  24. package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +3 -3
  25. package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +1 -1
  26. package/build/types/revamp/domain/types.d.ts +7 -4
  27. package/build/types/revamp/renderers/types.d.ts +2 -2
  28. package/build/types/revamp/step/Step.d.ts +1 -1
  29. package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +2 -3
  30. package/build/types/revamp/utils/getSubmittableData.d.ts +1 -1
  31. package/build/types/revamp/utils/type-utils.d.ts +5 -1
  32. package/package.json +1 -1
@@ -1,3 +1,7 @@
1
+ import type { Step as DFStep } from '@wise/dynamic-flow-types/build/next';
1
2
  import type { DynamicFlowProps } from '../dynamic-flow-types';
2
- declare function DynamicFlowRevamp({ initialStep, onError }: DynamicFlowProps): JSX.Element;
3
+ type Props = Omit<DynamicFlowProps, 'initialStep'> & {
4
+ initialStep?: DFStep;
5
+ };
6
+ declare function DynamicFlowRevamp({ initialStep, onError }: Props): JSX.Element;
3
7
  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;
@@ -1,12 +1,11 @@
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 = BaseComponent<Record<string, Model>> & {
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;
10
9
  };
11
10
  export declare const createObjectComponent: (objectProps: {
12
11
  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,6 +1,6 @@
1
- import type { StringSchema } from '@wise/dynamic-flow-types';
1
+ import type { StringSchemaFormat } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { InputComponent, UpdateComponent } from '../types';
3
- export type TextInputComponent = InputComponent & {
3
+ export type TextInputComponent = InputComponent<string | null> & {
4
4
  type: 'text';
5
5
  title?: string;
6
6
  description?: string;
@@ -10,7 +10,6 @@ export type TextInputComponent = InputComponent & {
10
10
  value: string | null;
11
11
  errors: string[];
12
12
  onChange: (value: string | null) => void;
13
- getValue: () => string | null;
14
13
  };
15
14
  export declare const createTextInputComponent: (textInputProps: {
16
15
  uid: string;
@@ -18,8 +17,8 @@ export declare const createTextInputComponent: (textInputProps: {
18
17
  title?: string | undefined;
19
18
  description?: string | undefined;
20
19
  placeholder?: string | undefined;
21
- control?: StringSchema['control'];
22
- format: StringSchema['format'];
20
+ control?: string | undefined;
21
+ format?: StringSchemaFormat | undefined;
23
22
  value: string | null;
24
23
  validate: (value: string | null) => string[];
25
24
  }, updateComponent: UpdateComponent) => TextInputComponent;
@@ -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,4 +1,4 @@
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
3
  export declare const objectSchemaToComponent: (uid: string, { schema, model }: SchemaMapperProps & {
4
4
  schema: ObjectSchema;
@@ -1,4 +1,4 @@
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
3
  import type { GetErrorMessageFunctions } from '../types';
4
4
  export declare const stringSchemaToComponent: (uid: string, { schema, model, required }: SchemaMapperProps & {
@@ -1,4 +1,4 @@
1
- import type { Step as DFStep, Model, Schema } from '@wise/dynamic-flow-types';
1
+ import type { Step as DFStep, Model, Schema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { OnAction, UpdateComponent } from '../../types';
3
3
  import type { GetErrorMessageFunctions } from '../types';
4
4
  export type MapperProps = {
@@ -1,4 +1,5 @@
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
4
  minimumDate: (minDate: string) => string;
4
5
  maximumDate: (maxDate: string) => 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 { StringSchema } from '@wise/dynamic-flow-types';
1
+ import type { StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  type IsInvalidCheck = (schema: StringSchema, model: string | null) => boolean;
3
3
  export declare const isAboveMaximum: IsInvalidCheck;
4
4
  export declare const isAboveMaxLength: IsInvalidCheck;
@@ -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';
@@ -9,18 +9,21 @@ import type { TextInputComponent } from './components/TextInputComponent';
9
9
  import type { ColumnsComponent } from './components/ColumnsComponent';
10
10
  export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | HeadingComponent | ObjectComponent | ParagraphComponent | TextInputComponent;
11
11
  export type ContainerComponent = ObjectComponent | BoxComponent | ColumnsComponent;
12
- export type BaseComponent = {
12
+ export type BaseComponent<M extends Model> = {
13
13
  type: string;
14
14
  uid: string;
15
15
  validate: () => boolean;
16
+ getValue: () => M;
16
17
  };
17
- export type LayoutComponent = BaseComponent & {
18
+ export type LayoutComponent = BaseComponent<Model> & {
18
19
  margin: Margin;
20
+ getValue: () => null;
19
21
  };
20
- export type InputComponent = BaseComponent & {
22
+ export type InputComponent<M extends Model> = BaseComponent<M> & {
21
23
  id: string;
22
24
  };
23
25
  export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
24
26
  export type OnAction = (action: Action) => void;
25
27
  export type Align = 'start' | 'center' | 'end';
26
28
  export type Bias = 'none' | 'start' | 'end';
29
+ export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
@@ -1,4 +1,4 @@
1
- import type { Context as DFContext, Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types';
1
+ import type { Margin as DFMargin, Size as DFSize } 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;
@@ -6,7 +6,7 @@ export type Renderer<P extends RendererProps> = {
6
6
  };
7
7
  export type Align = 'start' | 'center' | 'end';
8
8
  export type Bias = 'none' | 'start' | 'end';
9
- export type Context = DFContext;
9
+ export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
10
10
  export type Margin = DFMargin;
11
11
  export type Size = DFSize;
12
12
  export interface RendererProps {
@@ -1,4 +1,4 @@
1
- import type { Step as DFStep } from '@wise/dynamic-flow-types';
1
+ import type { Step as DFStep } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Renderer, RendererProps } from '../renderers/types';
3
3
  type StepProps = {
4
4
  step: DFStep;
@@ -1,4 +1,3 @@
1
- import type { Schema } from '@wise/dynamic-flow-types';
2
1
  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;
2
+ import type { GetErrorMessageFunctions } from '../../domain/mappers/types';
3
+ export declare function getSchemaErrorMessageFunction(formatMessage: IntlFormatters['formatMessage'], locale: string): GetErrorMessageFunctions;
@@ -1,3 +1,3 @@
1
- import type { Model } from '@wise/dynamic-flow-types';
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { StepComponent } from '../domain/types';
3
3
  export declare const getSubmittableData: (components: StepComponent[]) => Model;
@@ -1,6 +1,10 @@
1
- import type { Model } from '@wise/dynamic-flow-types';
1
+ import type { AllOfSchema, Model, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ContainerComponent, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
4
  export declare const isContainerComponent: (component: StepComponent) => component is ContainerComponent;
5
5
  export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
6
6
  export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
7
+ export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
8
+ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
9
+ export declare const isObjectSchema: (schema: Schema) => schema is ObjectSchema;
10
+ export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",