@wise/dynamic-flow-client 3.18.1 → 3.19.1-experimental-6810eca

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.
@@ -5,11 +5,13 @@ import { type PerformRefresh } from '../features/refresh/getPerformRefresh';
5
5
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
6
6
  export type IntegerInputComponent = InputComponent<number | null> & {
7
7
  type: 'integer';
8
+ maximum?: number;
9
+ minimum?: number;
8
10
  persistedState: PersistedState;
9
11
  validationState: ValidationState;
10
12
  onChange: (value: number | null) => void;
11
13
  };
12
- export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
14
+ export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "maximum" | "minimum" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
13
15
  checks: IsInvalidCheck<number | null>[];
14
16
  performPersistAsync: PerformPersistAsync | undefined;
15
17
  performRefresh: PerformRefresh | undefined;
@@ -6,6 +6,8 @@ import type { SelectInputOption } from './SelectInputComponent';
6
6
  export type MultiSelectComponent = InputComponent<LocalValueArray | null> & {
7
7
  type: 'multi-select';
8
8
  children: DomainComponent[];
9
+ maxItems?: number;
10
+ minItems?: number;
9
11
  options: SelectInputOption[];
10
12
  validationState: ValidationState;
11
13
  selectedIndices: number[];
@@ -13,7 +15,7 @@ export type MultiSelectComponent = InputComponent<LocalValueArray | null> & {
13
15
  getSelectedChildren: () => DomainComponent[] | null;
14
16
  onSelect: (indices: number[]) => void;
15
17
  };
16
- export declare const createMultiSelectComponent: (multiSelectProps: Pick<MultiSelectComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "hidden" | "required" | "title" | "validationState"> & {
18
+ export declare const createMultiSelectComponent: (multiSelectProps: Pick<MultiSelectComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "hidden" | "maxItems" | "minItems" | "required" | "title" | "validationState"> & {
17
19
  checks: IsInvalidCheck<LocalValueArray | null>[];
18
20
  initialValue: LocalValue;
19
21
  options: (SelectInputOption & {
@@ -5,11 +5,13 @@ import type { PerformValidationAsync } from '../features/validationAsync/getPerf
5
5
  import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationState } from '../types';
6
6
  export type NumberInputComponent = InputComponent<number | null> & {
7
7
  type: 'number';
8
+ maximum?: number;
9
+ minimum?: number;
8
10
  persistedState: PersistedState;
9
11
  validationState: ValidationState;
10
12
  onChange: (value: number | null) => void;
11
13
  };
12
- export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
14
+ export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "maximum" | "minimum" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
13
15
  checks: IsInvalidCheck<number | null>[];
14
16
  performPersistAsync: PerformPersistAsync | undefined;
15
17
  performRefresh: PerformRefresh | undefined;
@@ -6,11 +6,13 @@ import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary,
6
6
  export type TextInputComponent = InputComponent<string | null> & {
7
7
  type: 'text';
8
8
  displayFormat?: string;
9
+ maxLength?: number;
10
+ minLength?: number;
9
11
  persistedState: PersistedState;
10
12
  validationState: ValidationState;
11
13
  onChange: (value: string | null) => void;
12
14
  };
13
- export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
15
+ export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "maxLength" | "minLength" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
14
16
  checks: IsInvalidCheck<string | null>[];
15
17
  performPersistAsync: PerformPersistAsync | undefined;
16
18
  performValidationAsync: PerformValidationAsync | undefined;
@@ -10,6 +10,8 @@ export type RepeatableComponent = ComponentWithTitle & {
10
10
  editableIndex: number | null;
11
11
  editItemTitle: string;
12
12
  errors: string[];
13
+ maxItems?: number;
14
+ minItems?: number;
13
15
  summaryDefaults: RepeatableSummary;
14
16
  getChildren: () => DomainComponent[];
15
17
  getLocalValue: () => LocalValueArray;
@@ -18,7 +20,7 @@ export type RepeatableComponent = ComponentWithTitle & {
18
20
  onRemove: () => void;
19
21
  onSave: () => boolean;
20
22
  };
21
- export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "uid" | "id" | "addItemTitle" | "components" | "control" | "description" | "editItemTitle" | "errors" | "hidden" | "title"> & {
23
+ export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "uid" | "id" | "addItemTitle" | "components" | "control" | "description" | "editItemTitle" | "errors" | "hidden" | "maxItems" | "minItems" | "title"> & {
22
24
  analyticsId?: string;
23
25
  checks: IsInvalidCheck<LocalValueArray | null>[];
24
26
  summary?: SummarySummariser;
@@ -1,12 +1,11 @@
1
1
  import type { Polling } from '@wise/dynamic-flow-types/build/next';
2
- import type { HttpClient } from '../../../types';
3
- import type { OnAction } from '../../types';
2
+ import type { OnAction, OnPoll } from '../../types';
4
3
  export type StepPollingProps = {
5
- httpClient: HttpClient;
6
4
  pollingConfig: Polling;
7
5
  onAction: OnAction;
6
+ onPoll: OnPoll;
8
7
  };
9
8
  export type StepPolling = {
10
9
  stop: () => void;
11
10
  };
12
- export declare const getStepPolling: ({ httpClient, pollingConfig, onAction, }: StepPollingProps) => StepPolling;
11
+ export declare const getStepPolling: ({ pollingConfig, onAction, onPoll, }: StepPollingProps) => StepPolling;
@@ -1,9 +1,10 @@
1
1
  import type { AnalyticsEventDispatcher } from '../features/events';
2
- import type { LoadingState } from '../types';
2
+ import type { LoadingState, OnPoll } from '../types';
3
3
  import type { MapperProps } from './schema/types';
4
4
  export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
5
5
  displayStepTitle: boolean;
6
6
  loadingState: LoadingState;
7
7
  trackEvent: AnalyticsEventDispatcher<string>;
8
+ onPoll: OnPoll;
8
9
  };
9
- export declare const mapStepToComponent: ({ loadingState, displayStepTitle, trackEvent, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
10
+ export declare const mapStepToComponent: ({ loadingState, displayStepTitle, trackEvent, onPoll, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
@@ -76,6 +76,7 @@ export type InputComponent<V extends LocalValue> = ComponentWithTitle & {
76
76
  };
77
77
  export type UpdateComponent = (id: string, update: (component: DomainComponent) => void) => void;
78
78
  export type OnAction = (action: Action) => Promise<void>;
79
+ export type OnPoll = (url: string, errorAction: Action, signal: AbortSignal) => Promise<boolean>;
79
80
  export type OnRefresh = (schemaId: string | undefined, url?: string) => Promise<void> | void;
80
81
  export type OnValueChange = () => void;
81
82
  export type Align = 'start' | 'center' | 'end';
@@ -0,0 +1,21 @@
1
+ import { Action, Model, Step } from '@wise/dynamic-flow-types/build/next';
2
+ type Command = {
3
+ type: 'complete';
4
+ result: Model;
5
+ } | {
6
+ type: 'replace-step';
7
+ step: Step;
8
+ etag: string | null;
9
+ } | {
10
+ type: 'continue';
11
+ } | {
12
+ type: 'action';
13
+ action: Action;
14
+ };
15
+ export declare const executePoll: (props: {
16
+ httpClient: typeof fetch;
17
+ url: string;
18
+ errorAction: Action;
19
+ signal: AbortSignal;
20
+ }) => Promise<Command>;
21
+ export {};
@@ -7,4 +7,5 @@ export type ResponseType = (typeof responseTypes)[number];
7
7
  * Ideally it should just be a matter of checking the "X-Df-Response-Type" response header.
8
8
  */
9
9
  export declare const getResponseType: (response: Response) => Promise<ResponseType>;
10
+ export declare const getResponseTypeFromHeader: (response: Response) => ResponseType | undefined;
10
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "3.18.1",
3
+ "version": "3.19.1-experimental-6810eca",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -86,8 +86,8 @@
86
86
  "tsx": "4.19.0",
87
87
  "typescript": "5.5.4",
88
88
  "webpack": "5.94.0",
89
- "@wise/dynamic-flow-fixtures": "0.0.1",
90
- "@wise/dynamic-flow-renderers": "0.0.0"
89
+ "@wise/dynamic-flow-renderers": "0.0.0",
90
+ "@wise/dynamic-flow-fixtures": "0.0.1"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@transferwise/components": "^46.31",
@@ -104,7 +104,7 @@
104
104
  "nanoid": "5.0.7",
105
105
  "react-webcam": "^7.2.0",
106
106
  "screenfull": "^5.2.0",
107
- "@wise/dynamic-flow-types": "2.21.0"
107
+ "@wise/dynamic-flow-types": "2.22.1-experimental-6810eca"
108
108
  },
109
109
  "scripts": {
110
110
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",