@wise/dynamic-flow-client 4.0.0-experimental-af37aae → 4.0.0-experimental-9cbdd3f

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.
@@ -12,5 +12,5 @@ export { default as JsonSchemaForm } from './legacy/jsonSchemaForm';
12
12
  export { DynamicLayout as Layout } from './legacy/layout';
13
13
  export { isValidSchema } from './legacy/common/validators';
14
14
  export * from './legacy/dynamicFlow/DynamicFlow';
15
- export { find, findType } from './revamp/renderers/utils';
15
+ export { findRendererPropsByType } from './revamp/renderers/utils';
16
16
  export type { Renderers, Renderer, AlertRendererProps, CheckboxInputRendererProps, BoxRendererProps, ButtonRendererProps, ColumnsRendererProps, DateInputRendererProps, DecisionRendererProps, DividerRendererProps, FormRendererProps, SectionRendererProps, HeadingRendererProps, HiddenRendererProps, ImageRendererProps, InstructionsRendererProps, IntegerInputRendererProps, LoadingIndicatorRendererProps, MarkdownRendererProps, ModalRendererProps, MultiSelectInputRendererProps, MultiUploadInputRendererProps, NumberInputRendererProps, ParagraphRendererProps, RepeatableRendererProps, ReviewRendererProps, SearchRendererProps, SelectInputRendererProps, StatusListRendererProps, StepRendererProps, TextInputRendererProps, UploadInputRendererProps, } from '@wise/dynamic-flow-types/build/renderers';
@@ -1,16 +1,8 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { BaseComponent, LocalValue, RepeatableSummary, DomainComponent } from '../types';
3
- import { Icon, Image } from '@wise/dynamic-flow-types/build/next';
4
- export type AllOfComponent = BaseComponent & {
2
+ import type { LocalValue, RepeatableSummary, DomainComponent, ComponentWithTitle } from '../types';
3
+ export type AllOfComponent = ComponentWithTitle & {
5
4
  type: 'all-of';
6
5
  components: DomainComponent[];
7
- control?: string;
8
- description?: string;
9
- help?: string;
10
- hidden: boolean;
11
- icon?: Icon;
12
- image?: Image;
13
- title?: string;
14
6
  getChildren: () => DomainComponent[];
15
7
  getLocalValue: () => LocalValue;
16
8
  };
@@ -7,9 +7,7 @@ export type ImageComponent = LayoutComponent & {
7
7
  };
8
8
  type ImageContent = {
9
9
  accessibilityDescription?: string;
10
- text?: string;
11
- url?: string;
12
- uri?: string;
10
+ uri: string;
13
11
  };
14
12
  export declare const createImageComponent: (imageProps: Pick<ImageComponent, "uid" | "content" | "control" | "margin" | "size">) => ImageComponent;
15
13
  export {};
@@ -1,6 +1,6 @@
1
- import type { SummarySummariser } from '@wise/dynamic-flow-types/build/next/feature/SummarySummariser';
2
- import type { ComponentWithTitle, LocalValue, LocalValueArray, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange } from '../types';
1
+ import type { ComponentWithTitle, LocalValue, LocalValueArray, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange, Image } from '../types';
3
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
+ import { Icon } from '@wise/dynamic-flow-types/build/next';
4
4
  export type RepeatableComponent = ComponentWithTitle & {
5
5
  type: 'repeatable';
6
6
  id?: string;
@@ -20,11 +20,22 @@ export type RepeatableComponent = ComponentWithTitle & {
20
20
  onRemove: () => void;
21
21
  onSave: () => boolean;
22
22
  };
23
+ type Summary = {
24
+ defaultTitle?: string;
25
+ defaultDescription?: string;
26
+ defaultIcon?: Icon;
27
+ defaultImage?: Image;
28
+ providesTitle?: boolean;
29
+ providesDescription?: boolean;
30
+ providesIcon?: boolean;
31
+ providesImage?: boolean;
32
+ };
23
33
  export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "uid" | "id" | "addItemTitle" | "components" | "control" | "description" | "editItemTitle" | "errors" | "hidden" | "icon" | "image" | "maxItems" | "minItems" | "title"> & {
24
34
  analyticsId?: string;
25
35
  checks: IsInvalidCheck<LocalValueArray | null>[];
26
- summary?: SummarySummariser;
36
+ summary?: Summary;
27
37
  summariser: (value: LocalValueArray | null) => RepeatableSummary;
28
38
  onValueChange: OnValueChange;
29
39
  createEditableComponent: (value: LocalValue) => DomainComponent;
30
40
  }, updateComponent: UpdateComponent) => RepeatableComponent;
41
+ export {};
@@ -1,5 +1,5 @@
1
- import type { Icon, Image, Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { InputComponent, LocalValue, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange } from '../types';
1
+ import type { Icon, Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { InputComponent, LocalValue, RepeatableSummary, DomainComponent, UpdateComponent, OnValueChange, Image } from '../types';
3
3
  import type { IsInvalidCheck } from '../features/validation/value-checks';
4
4
  import type { AnalyticsEventDispatcher } from '../features/events';
5
5
  import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
@@ -1,28 +1,8 @@
1
- import type { Icon, Image, Model, Schema } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Icon, Model, Schema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { LocalValue, RepeatableSummary, DomainComponent } from '../../types';
3
3
  /** A summariser that accepts a schema and returns a function that can form a summary based on a value. */
4
- export declare const getSummariser: <S extends Schema>(schema: S) => (value: LocalValue | null) => {
5
- title?: undefined;
6
- description?: undefined;
7
- icon?: undefined;
8
- image?: undefined;
9
- } | {
10
- title: string | undefined;
11
- description: string | undefined;
12
- icon: Icon | undefined;
13
- image: Image | undefined;
14
- };
15
- export declare const getConstSummary: (schema: Schema, model: Model | null) => {
16
- title?: undefined;
17
- description?: undefined;
18
- icon?: undefined;
19
- image?: undefined;
20
- } | {
21
- title: string | undefined;
22
- description: string | undefined;
23
- icon: Icon | undefined;
24
- image: Image | undefined;
25
- };
4
+ export declare const getSummariser: <S extends Schema>(schema: S) => (value: LocalValue | null) => RepeatableSummary;
5
+ export declare const getConstSummary: (schema: Schema, model: Model | null) => RepeatableSummary;
26
6
  export declare const summariseFromChildren: (components: DomainComponent[]) => RepeatableSummary;
27
7
  export declare const mergeSummaries: (summaryA: RepeatableSummary, summaryB: RepeatableSummary) => {
28
8
  title: string | undefined;
@@ -1,6 +1,3 @@
1
1
  import type { ButtonLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
- import { SpecNextBehavior } from '../../types';
4
- export declare const buttonLayoutToComponent: (uid: string, button: ButtonLayout & {
5
- behavior?: SpecNextBehavior;
6
- }, mapperProps: MapperProps) => import("../../components/ButtonComponent").ButtonComponent;
3
+ export declare const buttonLayoutToComponent: (uid: string, button: ButtonLayout, mapperProps: MapperProps) => import("../../components/ButtonComponent").ButtonComponent;
@@ -1,8 +1,5 @@
1
1
  import type { DecisionLayout, DecisionLayoutOption } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
- import { SpecNextBehavior } from '../../types';
4
3
  export declare const decisionLayoutToComponent: (uid: string, { control, margin, options, title, }: Omit<DecisionLayout, "options"> & {
5
- options: (DecisionLayoutOption & {
6
- behavior?: SpecNextBehavior;
7
- })[];
4
+ options: DecisionLayoutOption[];
8
5
  }, mapperProps: MapperProps) => import("../../components/DecisionComponent").DecisionComponent;
@@ -1,11 +1,2 @@
1
1
  import type { ImageLayout } from '@wise/dynamic-flow-types/build/next';
2
- type ImageContent = {
3
- accessibilityDescription?: string;
4
- text?: string;
5
- url?: string;
6
- uri?: string;
7
- };
8
- export declare const imageLayoutToComponent: (uid: string, { accessibilityDescription, content, control, margin, size, text, url }: ImageLayout & {
9
- content?: ImageContent;
10
- }) => import("../../components/ImageComponent").ImageComponent;
11
- export {};
2
+ export declare const imageLayoutToComponent: (uid: string, { accessibilityDescription, content, control, margin, size, text, url, }: ImageLayout) => import("../../components/ImageComponent").ImageComponent;
@@ -2,10 +2,10 @@ import type { AnalyticsEventDispatcher } from '../features/events';
2
2
  import type { LoadingState, OnPoll } from '../types';
3
3
  import type { MapperProps } from './schema/types';
4
4
  export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
5
- bit: 'flip' | 'flop';
5
+ count: number;
6
6
  displayStepTitle: boolean;
7
7
  loadingState: LoadingState;
8
8
  trackEvent: AnalyticsEventDispatcher<string>;
9
9
  onPoll: OnPoll;
10
10
  };
11
- export declare const mapStepToComponent: ({ bit, loadingState, displayStepTitle, trackEvent, onPoll, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
11
+ export declare const mapStepToComponent: ({ count, loadingState, displayStepTitle, trackEvent, onPoll, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
@@ -11,19 +11,9 @@ export declare const mapCommonSchemaProps: (schemaMapperProps: SchemaMapperProps
11
11
  errors: string[] | undefined;
12
12
  hidden: boolean;
13
13
  icon: import("@wise/dynamic-flow-types/build/next").Icon | undefined;
14
- image: import("@wise/dynamic-flow-types/build/next").Image | undefined;
14
+ image: import("../../../types").Image | undefined;
15
15
  keywords: string[] | undefined;
16
16
  required: boolean;
17
17
  title: string | undefined;
18
- summariser: (value: import("../../../types").LocalValue | null) => {
19
- title?: undefined;
20
- description?: undefined;
21
- icon?: undefined;
22
- image?: undefined;
23
- } | {
24
- title: string | undefined;
25
- description: string | undefined;
26
- icon: import("@wise/dynamic-flow-types/build/next").Icon | undefined;
27
- image: import("@wise/dynamic-flow-types/build/next").Image | undefined;
28
- };
18
+ summariser: (value: import("../../../types").LocalValue | null) => import("../../../types").RepeatableSummary;
29
19
  };
@@ -0,0 +1,3 @@
1
+ import { Image as SpecImage } from '@wise/dynamic-flow-types/build/next';
2
+ import { Image } from '../../types';
3
+ export declare const mapSpecImage: (image: SpecImage | undefined) => Image | undefined;
@@ -57,10 +57,8 @@ export type LayoutComponent = BaseComponent & {
57
57
  getLocalValue: () => LocalValue;
58
58
  };
59
59
  export type Image = {
60
- url?: string;
61
- uri?: string;
60
+ uri: string;
62
61
  accessibilityDescription?: string;
63
- text?: string;
64
62
  };
65
63
  export type ComponentWithTitle = BaseComponent & {
66
64
  control?: string;
@@ -117,15 +115,3 @@ export type ValidationAsyncState = {
117
115
  };
118
116
  };
119
117
  export type LoadingState = 'idle' | 'submitting' | 'refreshing';
120
- export type SpecNextBehavior = {
121
- type: 'action';
122
- action: Action;
123
- } | {
124
- type: 'link';
125
- url: string;
126
- } | {
127
- action?: Action;
128
- link?: {
129
- url: string;
130
- };
131
- };
@@ -1,4 +1,4 @@
1
1
  import type { AllOfComponent } from '../../domain/components/AllOfComponent';
2
2
  import type { SectionRendererProps } from '@wise/dynamic-flow-types/build/renderers';
3
- import { RendererMapperProps } from './componentToRendererProps';
3
+ import { type RendererMapperProps } from './componentToRendererProps';
4
4
  export declare const allOfComponentToProps: (component: AllOfComponent, rendererMapperProps: RendererMapperProps) => SectionRendererProps;
@@ -10,11 +10,7 @@ export declare const inputComponentToProps: <T extends string, V extends LocalVa
10
10
  help: string | undefined;
11
11
  icon: import("@wise/dynamic-flow-types/build/renderers").Icon | undefined;
12
12
  id: string;
13
- image: {
14
- accessibilityDescription: string | undefined;
15
- uri: string | undefined;
16
- url: string;
17
- } | undefined;
13
+ image: import("../../../domain/types").Image | undefined;
18
14
  placeholder: string | undefined;
19
15
  required: boolean;
20
16
  title: string | undefined;
@@ -2,8 +2,4 @@ import { RendererProps } from '@wise/dynamic-flow-types/build/renderers';
2
2
  /**
3
3
  * @experimental
4
4
  */
5
- export declare function find(root: RendererProps | RendererProps[], predicate: (props: RendererProps) => boolean): RendererProps[];
6
- /**
7
- * @experimental
8
- */
9
- export declare function findType<T extends RendererProps>(root: RendererProps | RendererProps[], type: T['type'], predicate?: (props: T) => boolean): T[];
5
+ export declare function findRendererPropsByType<T extends RendererProps>(root: RendererProps | RendererProps[], type: T['type'], predicate?: (props: T) => boolean): readonly T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.0.0-experimental-af37aae",
3
+ "version": "4.0.0-experimental-9cbdd3f",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -85,8 +85,8 @@
85
85
  "tsx": "4.19.2",
86
86
  "typescript": "5.7.3",
87
87
  "webpack": "5.97.1",
88
- "@wise/dynamic-flow-fixtures": "0.0.1",
89
- "@wise/dynamic-flow-renderers": "0.0.0"
88
+ "@wise/dynamic-flow-renderers": "0.0.0",
89
+ "@wise/dynamic-flow-fixtures": "0.0.1"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@transferwise/components": "^46.92.0",
@@ -102,7 +102,7 @@
102
102
  "classnames": "2.5.1",
103
103
  "react-webcam": "^7.2.0",
104
104
  "screenfull": "^5.2.0",
105
- "@wise/dynamic-flow-types": "3.0.0-experimental-af37aae"
105
+ "@wise/dynamic-flow-types": "3.0.0-experimental-9cbdd3f"
106
106
  },
107
107
  "scripts": {
108
108
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",