@wise/dynamic-flow-client 5.4.0 → 5.4.1-experimental-controller-59f0d39

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 (39) hide show
  1. package/build/main.js +5089 -5061
  2. package/build/main.mjs +4195 -4167
  3. package/build/types/controller/FlowController.d.ts +18 -0
  4. package/build/types/controller/getRequestAbortController.d.ts +4 -0
  5. package/build/types/controller/getStepCounter.d.ts +9 -0
  6. package/build/types/domain/components/BooleanInputComponent.d.ts +2 -2
  7. package/build/types/domain/components/DateInputComponent.d.ts +2 -2
  8. package/build/types/domain/components/FormattedValueComponent.d.ts +2 -2
  9. package/build/types/domain/components/IntegerInputComponent.d.ts +2 -2
  10. package/build/types/domain/components/ModalComponent.d.ts +2 -2
  11. package/build/types/domain/components/MoneyInputComponent.d.ts +2 -2
  12. package/build/types/domain/components/MultiSelectInputComponent.d.ts +2 -2
  13. package/build/types/domain/components/MultiUploadInputComponent.d.ts +2 -2
  14. package/build/types/domain/components/NumberInputComponent.d.ts +2 -2
  15. package/build/types/domain/components/PersistAsyncComponent.d.ts +2 -2
  16. package/build/types/domain/components/RepeatableComponent.d.ts +2 -2
  17. package/build/types/domain/components/RootDomainComponent.d.ts +7 -9
  18. package/build/types/domain/components/SelectInputComponent.d.ts +2 -2
  19. package/build/types/domain/components/SubflowDomainComponent.d.ts +2 -2
  20. package/build/types/domain/components/TextInputComponent.d.ts +2 -2
  21. package/build/types/domain/components/UploadInputComponent.d.ts +2 -2
  22. package/build/types/domain/components/searchComponent/SearchComponent.d.ts +2 -2
  23. package/build/types/domain/components/step/ExternalConfirmationComponent.d.ts +2 -2
  24. package/build/types/domain/components/step/StepDomainComponent.d.ts +2 -2
  25. package/build/types/domain/components/utils/component-utils.d.ts +4 -4
  26. package/build/types/domain/mappers/schema/types.d.ts +2 -2
  27. package/build/types/domain/types.d.ts +1 -1
  28. package/package.json +2 -2
  29. package/build/types/useDynamicFlowController.d.ts +0 -15
  30. /package/build/types/{flow → controller}/executePoll.d.ts +0 -0
  31. /package/build/types/{flow → controller}/executeRefresh.d.ts +0 -0
  32. /package/build/types/{flow → controller}/executeRequest.d.ts +0 -0
  33. /package/build/types/{flow → controller}/executeSubmission.d.ts +0 -0
  34. /package/build/types/{flow → controller}/getErrorMessage.d.ts +0 -0
  35. /package/build/types/{flow → controller}/getResponseType.d.ts +0 -0
  36. /package/build/types/{flow → controller}/getSafeHttpClient.d.ts +0 -0
  37. /package/build/types/{flow → controller}/handleErrorResponse.d.ts +0 -0
  38. /package/build/types/{flow → controller}/makeSafeHttpClient.d.ts +0 -0
  39. /package/build/types/{flow → controller}/response-utils.d.ts +0 -0
@@ -0,0 +1,18 @@
1
+ import { BackConfig } from '../domain/components/RootDomainComponent';
2
+ import { GetErrorMessageFunctions } from '../domain/mappers/types';
3
+ import { FeatureFlags } from '../domain/mappers/utils/FeatureFlags';
4
+ import { OnValueChange, ScrollToTop } from '../domain/types';
5
+ import { DynamicFlowCoreProps } from '../types';
6
+ export type FlowControllerProps = Omit<DynamicFlowCoreProps, 'renderers' | 'features'> & {
7
+ backConfig: BackConfig;
8
+ features: FeatureFlags;
9
+ getErrorMessageFunctions: GetErrorMessageFunctions;
10
+ onChange: () => void;
11
+ onValueChange: OnValueChange;
12
+ scrollToTop: ScrollToTop;
13
+ onLink: (url: string) => boolean;
14
+ };
15
+ export declare const createFlowController: (props: FlowControllerProps) => {
16
+ rootComponent: import("../domain/components/RootDomainComponent").RootDomainComponent;
17
+ cancel: () => void;
18
+ };
@@ -0,0 +1,4 @@
1
+ export declare const getRequestAbortController: () => {
2
+ abortAndGetNewSignal(): AbortSignal;
3
+ abort(): void;
4
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * To ensure there are no uid collisions between consecutive steps, we use a
3
+ * counter that is appended to the step id. This means that even steps with the
4
+ * same structure and ids will not have the same component uids.
5
+ */
6
+ export declare const getStepCounter: () => {
7
+ increment(): void;
8
+ readonly current: number;
9
+ };
@@ -1,6 +1,6 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
3
- import type { BaseInputComponent, InlineAlert, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState, SupportingValues } from '../types';
3
+ import type { BaseInputComponent, InlineAlert, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, SupportingValues, ValidationAsyncState } from '../types';
4
4
  export type BooleanInputComponent = BaseInputComponent<boolean> & {
5
5
  type: 'boolean';
6
6
  kind: 'input';
@@ -16,4 +16,4 @@ export declare const createBooleanInputComponent: (booleanInputProps: Pick<Boole
16
16
  summariser: (value: boolean) => RepeatableSummary;
17
17
  onValueChange: OnValueChange;
18
18
  onPersistAsync: OnPersistAsync | undefined;
19
- }, updateComponent: UpdateComponent) => BooleanInputComponent;
19
+ }, onComponentUpdate: OnComponentUpdate) => BooleanInputComponent;
@@ -1,7 +1,7 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
4
+ import type { BaseInputComponent, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, Suggestions, ValidationAsyncState } from '../types';
5
5
  export type DateInputComponent = BaseInputComponent<string | null> & {
6
6
  type: 'date';
7
7
  kind: 'input';
@@ -18,4 +18,4 @@ export declare const createDateInputComponent: (textInputProps: Pick<DateInputCo
18
18
  onValueChange: OnValueChange;
19
19
  onPersistAsync: OnPersistAsync | undefined;
20
20
  summariser: (value: string | null) => RepeatableSummary;
21
- }, updateComponent: UpdateComponent) => DateInputComponent;
21
+ }, onComponentUpdate: OnComponentUpdate) => DateInputComponent;
@@ -1,6 +1,6 @@
1
1
  import { JsonElement } from '@wise/dynamic-flow-types/spec';
2
2
  import { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
3
- import type { BaseSchemaComponent, InlineAlert, LocalValue, RepeatableSummary, UpdateComponent } from '../types';
3
+ import type { BaseSchemaComponent, InlineAlert, LocalValue, OnComponentUpdate, RepeatableSummary } from '../types';
4
4
  export type FormattedValueComponent = BaseSchemaComponent<JsonElement> & {
5
5
  type: 'formatted-value';
6
6
  kind: 'input';
@@ -13,4 +13,4 @@ export type FormattedValueComponent = BaseSchemaComponent<JsonElement> & {
13
13
  export declare const createFormattedValueComponent: (props: Pick<FormattedValueComponent, "uid" | "schemaId" | "analyticsId" | "alert" | "control" | "description" | "errors" | "format" | "help" | "hidden" | "media" | "title" | "tags" | "value"> & {
14
14
  summariser: (value: LocalValue | null) => RepeatableSummary;
15
15
  schemaOnChange: SchemaOnChange | undefined;
16
- }, updateComponent: UpdateComponent) => FormattedValueComponent;
16
+ }, onComponentUpdate: OnComponentUpdate) => FormattedValueComponent;
@@ -1,7 +1,7 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
4
+ import type { BaseInputComponent, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, ValidationAsyncState } from '../types';
5
5
  export type IntegerInputComponent = BaseInputComponent<number | null> & {
6
6
  type: 'integer';
7
7
  kind: 'input';
@@ -17,4 +17,4 @@ export declare const createIntegerInputComponent: (integerInputProps: Pick<Integ
17
17
  onValueChange: OnValueChange;
18
18
  onPersistAsync: OnPersistAsync | undefined;
19
19
  summariser: (value: number | null) => RepeatableSummary;
20
- }, updateComponent: UpdateComponent) => IntegerInputComponent;
20
+ }, onComponentUpdate: OnComponentUpdate) => IntegerInputComponent;
@@ -1,4 +1,4 @@
1
- import type { BaseComponent, DomainComponent, UpdateComponent } from '../types';
1
+ import type { BaseComponent, DomainComponent, OnComponentUpdate } from '../types';
2
2
  export type ModalComponent = BaseComponent & {
3
3
  type: 'modal';
4
4
  kind: 'layout';
@@ -9,4 +9,4 @@ export type ModalComponent = BaseComponent & {
9
9
  getChildren: () => DomainComponent[];
10
10
  close: () => void;
11
11
  };
12
- export declare const createModalContentComponent: (modalProps: Pick<ModalComponent, "uid" | "analyticsId" | "components" | "tags" | "title">, updateComponent: UpdateComponent) => ModalComponent;
12
+ export declare const createModalContentComponent: (modalProps: Pick<ModalComponent, "uid" | "analyticsId" | "components" | "tags" | "title">, onComponentUpdate: OnComponentUpdate) => ModalComponent;
@@ -1,6 +1,6 @@
1
1
  import { JsonObject } from '@wise/dynamic-flow-types/spec';
2
2
  import { IsInvalidCheck } from '../features/validation/value-checks';
3
- import { BaseInputComponent, LocalValue, LocalValueObject, RepeatableSummary, UpdateComponent } from '../types';
3
+ import { BaseInputComponent, LocalValue, LocalValueObject, OnComponentUpdate, RepeatableSummary } from '../types';
4
4
  import { SelectInputComponent } from './SelectInputComponent';
5
5
  import { TextInputComponent } from './TextInputComponent';
6
6
  export type MoneyInputComponent = BaseInputComponent<LocalValueObject> & {
@@ -19,4 +19,4 @@ export declare const createMoneyInputComponent: (moneyInputProps: Pick<MoneyInpu
19
19
  extraValues: JsonObject;
20
20
  checks: IsInvalidCheck<string | null>[];
21
21
  summariser: (value: LocalValue | null) => RepeatableSummary;
22
- }, updateComponent: UpdateComponent) => MoneyInputComponent;
22
+ }, onComponentUpdate: OnComponentUpdate) => MoneyInputComponent;
@@ -1,7 +1,7 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
- import type { BaseInputComponent, LocalValue, LocalValueArray, OnValueChange, SchemaComponent, UpdateComponent, ValidationAsyncState } from '../types';
4
+ import type { BaseInputComponent, LocalValue, LocalValueArray, OnValueChange, SchemaComponent, OnComponentUpdate, ValidationAsyncState } from '../types';
5
5
  import type { SelectInputOption } from './SelectInputComponent';
6
6
  export type MultiSelectComponent = BaseInputComponent<LocalValueArray | null> & {
7
7
  type: 'multi-select';
@@ -25,4 +25,4 @@ export declare const createMultiSelectComponent: (multiSelectProps: Pick<MultiSe
25
25
  performValidationAsync: PerformValidationAsync | undefined;
26
26
  schemaOnChange: SchemaOnChange | undefined;
27
27
  onValueChange: OnValueChange;
28
- }, updateComponent: UpdateComponent) => MultiSelectComponent;
28
+ }, onComponentUpdate: OnComponentUpdate) => MultiSelectComponent;
@@ -1,7 +1,7 @@
1
1
  import { JsonElement } from '@wise/dynamic-flow-types/spec';
2
2
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
3
3
  import type { IsInvalidCheck } from '../features/validation/value-checks';
4
- import type { BaseInputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, UploadSource } from '../types';
4
+ import type { BaseInputComponent, OnComponentUpdate, OnValueChange, PersistedState, RepeatableSummary, UploadSource } from '../types';
5
5
  export type MultiUploadInputComponent = BaseInputComponent<File[]> & {
6
6
  type: 'multi-upload';
7
7
  kind: 'input';
@@ -30,4 +30,4 @@ export declare const createMultiUploadInputComponent: (uploadInputProps: Pick<Mu
30
30
  performPersistAsync: PerformPersistAsync | undefined;
31
31
  onValueChange: OnValueChange;
32
32
  summariser: (value: string[]) => RepeatableSummary;
33
- }, updateComponent: UpdateComponent) => MultiUploadInputComponent;
33
+ }, onComponentUpdate: OnComponentUpdate) => MultiUploadInputComponent;
@@ -1,7 +1,7 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
4
+ import type { BaseInputComponent, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, ValidationAsyncState } from '../types';
5
5
  export type NumberInputComponent = BaseInputComponent<number | null> & {
6
6
  type: 'number';
7
7
  kind: 'input';
@@ -17,4 +17,4 @@ export declare const createNumberInputComponent: (numberInputProps: Pick<NumberI
17
17
  onValueChange: OnValueChange;
18
18
  onPersistAsync: OnPersistAsync | undefined;
19
19
  summariser: (value: number | null) => RepeatableSummary;
20
- }, updateComponent: UpdateComponent) => NumberInputComponent;
20
+ }, onComponentUpdate: OnComponentUpdate) => NumberInputComponent;
@@ -1,7 +1,7 @@
1
1
  import { JsonElement } from '@wise/dynamic-flow-types/spec';
2
2
  import { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
3
3
  import { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
4
- import type { BaseSchemaComponent, LocalValue, SchemaComponent, UpdateComponent } from '../types';
4
+ import type { BaseSchemaComponent, LocalValue, OnComponentUpdate, SchemaComponent } from '../types';
5
5
  export type PersistAsyncComponent = BaseSchemaComponent<LocalValue> & {
6
6
  type: 'persist-async';
7
7
  kind: 'input';
@@ -16,4 +16,4 @@ export type PersistAsyncComponent = BaseSchemaComponent<LocalValue> & {
16
16
  export declare const createPersistAsyncComponent: (props: Pick<PersistAsyncComponent, "uid" | "analyticsId" | "schemaId" | "component" | "hidden" | "tags"> & {
17
17
  model?: JsonElement | null;
18
18
  localValue?: LocalValue | null;
19
- }, performPersistAsync: PerformPersistAsync, schemaOnChange: SchemaOnChange | undefined, updateComponent: UpdateComponent) => PersistAsyncComponent;
19
+ }, performPersistAsync: PerformPersistAsync, schemaOnChange: SchemaOnChange | undefined, onComponentUpdate: OnComponentUpdate) => PersistAsyncComponent;
@@ -1,5 +1,5 @@
1
1
  import type { IsInvalidCheck } from '../features/validation/value-checks';
2
- import type { BaseSchemaComponent, InlineAlert, LocalValue, LocalValueArray, Media, OnValueChange, RepeatableSummary, SchemaComponent, UpdateComponent } from '../types';
2
+ import type { BaseSchemaComponent, InlineAlert, LocalValue, LocalValueArray, Media, OnComponentUpdate, OnValueChange, RepeatableSummary, SchemaComponent } from '../types';
3
3
  export type RepeatableComponent = BaseSchemaComponent<LocalValueArray> & {
4
4
  type: 'repeatable';
5
5
  kind: 'input';
@@ -34,5 +34,5 @@ export declare const createRepeatableComponent: (repeatableProps: Pick<Repeatabl
34
34
  summariser: (value: LocalValueArray | null) => RepeatableSummary;
35
35
  onValueChange: OnValueChange;
36
36
  createEditableComponent: (value: LocalValue) => SchemaComponent;
37
- }, updateComponent: UpdateComponent) => RepeatableComponent;
37
+ }, onComponentUpdate: OnComponentUpdate) => RepeatableComponent;
38
38
  export {};
@@ -1,20 +1,21 @@
1
1
  import { Model } from '@wise/dynamic-flow-types/spec';
2
2
  import { AnalyticsEventDispatcher } from '../features/events';
3
- import { BaseComponent, DomainComponent, LoadingState, LocalValue, SchemaComponent, ScrollToTop, UpdateComponent } from '../types';
3
+ import { BaseComponent, DomainComponent, LoadingState, LocalValue, SchemaComponent, ScrollToTop, OnComponentUpdate } from '../types';
4
4
  import { ModalComponent } from './ModalComponent';
5
5
  import { StepDomainComponent } from './step/StepDomainComponent';
6
6
  import { SubflowDomainComponent } from './SubflowDomainComponent';
7
7
  import { RequestCache } from '../prefetching/request-cache';
8
+ export type BackConfig = {
9
+ isNativeBackEnabled: boolean;
10
+ isFlowCancellable: boolean;
11
+ };
8
12
  export type RootDomainComponent = BaseComponent & {
9
13
  type: 'root';
10
14
  kind: 'step';
11
15
  stepComponent: StepDomainComponent | null;
12
16
  stepStack: StepDomainComponent[];
13
17
  subflow: SubflowDomainComponent | null;
14
- backConfig: {
15
- isNativeBackEnabled: boolean;
16
- isFlowCancellable: boolean;
17
- };
18
+ backConfig: BackConfig;
18
19
  requestCache: RequestCache;
19
20
  canPerformBack: () => boolean;
20
21
  dismissAllModals: () => void;
@@ -42,7 +43,4 @@ export type RootDomainComponent = BaseComponent & {
42
43
  addSubflow: (subflow: SubflowDomainComponent) => void;
43
44
  closeSubflow: () => void;
44
45
  };
45
- export declare const createRootDomainComponent: (updateComponent: UpdateComponent, scrollToTop: ScrollToTop, backConfig: {
46
- isNativeBackEnabled: boolean;
47
- isFlowCancellable: boolean;
48
- }, requestCache: RequestCache) => RootDomainComponent;
46
+ export declare const createRootDomainComponent: (onComponentUpdate: OnComponentUpdate, scrollToTop: ScrollToTop, backConfig: BackConfig, requestCache: RequestCache) => RootDomainComponent;
@@ -1,8 +1,8 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/spec';
2
2
  import type { AnalyticsEventDispatcher } from '../features/events';
3
3
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
4
- import type { InlineAlert, SupportingValues, BaseInputComponent, LocalValue, Media, OnValueChange, RepeatableSummary, SchemaComponent, UpdateComponent } from '../types';
5
4
  import type { IsInvalidCheck } from '../features/validation/value-checks';
5
+ import type { BaseInputComponent, InlineAlert, LocalValue, Media, OnComponentUpdate, OnValueChange, RepeatableSummary, SchemaComponent, SupportingValues } from '../types';
6
6
  export type SelectInputComponent = BaseInputComponent<LocalValue | null> & {
7
7
  type: 'select';
8
8
  kind: 'input';
@@ -36,4 +36,4 @@ export declare const createSelectInputComponent: (selectProps: Pick<SelectInputC
36
36
  summariser: (value: LocalValue | null) => RepeatableSummary;
37
37
  onValueChange: OnValueChange;
38
38
  trackEvent: AnalyticsEventDispatcher;
39
- }, updateComponent: UpdateComponent) => SelectInputComponent;
39
+ }, onComponentUpdate: OnComponentUpdate) => SelectInputComponent;
@@ -1,7 +1,7 @@
1
1
  import { JsonElement, Request } from '@wise/dynamic-flow-types/spec';
2
- import { BaseComponent, UpdateComponent, Presentation } from '../types';
3
2
  import { AnalyticsEventDispatcher } from '../features/events';
4
3
  import { RequestCache } from '../prefetching/request-cache';
4
+ import { BaseComponent, OnComponentUpdate, Presentation } from '../types';
5
5
  export type SubflowDomainComponent = BaseComponent & {
6
6
  kind: 'layout';
7
7
  type: 'subflow';
@@ -13,4 +13,4 @@ export type SubflowDomainComponent = BaseComponent & {
13
13
  onEvent: AnalyticsEventDispatcher<string>;
14
14
  onError: (error: unknown, status?: number) => void;
15
15
  };
16
- export declare const createSubflowDomainComponent: (subflowProps: Pick<SubflowDomainComponent, "initialRequest" | "presentation" | "requestCache" | "onCompletion" | "onCancellation" | "onError" | "onEvent">, updateComponent: UpdateComponent) => SubflowDomainComponent;
16
+ export declare const createSubflowDomainComponent: (subflowProps: Pick<SubflowDomainComponent, "initialRequest" | "presentation" | "requestCache" | "onCompletion" | "onCancellation" | "onError" | "onEvent">, onComponentUpdate: OnComponentUpdate) => SubflowDomainComponent;
@@ -1,7 +1,7 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
4
- import type { Autocapitalization, BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
4
+ import type { Autocapitalization, BaseInputComponent, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, Suggestions, ValidationAsyncState } from '../types';
5
5
  export type TextInputComponent = BaseInputComponent<string | null> & {
6
6
  type: 'text';
7
7
  kind: 'input';
@@ -20,4 +20,4 @@ export declare const createTextInputComponent: (textInputProps: Pick<TextInputCo
20
20
  onValueChange: OnValueChange;
21
21
  onPersistAsync: OnPersistAsync | undefined;
22
22
  summariser: (value: string | null) => RepeatableSummary;
23
- }, updateComponent: UpdateComponent) => TextInputComponent;
23
+ }, onComponentUpdate: OnComponentUpdate) => TextInputComponent;
@@ -1,7 +1,7 @@
1
1
  import type { JsonElement } from '@wise/dynamic-flow-types/spec';
2
2
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
3
3
  import type { IsInvalidCheck } from '../features/validation/value-checks';
4
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, UploadSource } from '../types';
4
+ import type { BaseInputComponent, OnComponentUpdate, OnPersistAsync, OnValueChange, RepeatableSummary, UploadSource } from '../types';
5
5
  export type UploadInputComponent = BaseInputComponent<File | null> & {
6
6
  type: 'upload';
7
7
  kind: 'input';
@@ -20,4 +20,4 @@ export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadI
20
20
  onValueChange: OnValueChange;
21
21
  onPersistAsync: OnPersistAsync | undefined;
22
22
  summariser: (value: string | null) => RepeatableSummary;
23
- }, updateComponent: UpdateComponent) => UploadInputComponent;
23
+ }, onComponentUpdate: OnComponentUpdate) => UploadInputComponent;
@@ -1,5 +1,5 @@
1
1
  import type { SearchResult } from '@wise/dynamic-flow-types/spec';
2
- import type { BaseLayoutComponent, OnBehavior, UpdateComponent } from '../../types';
2
+ import type { BaseLayoutComponent, OnBehavior, OnComponentUpdate } from '../../types';
3
3
  export type SearchConfig = {
4
4
  method: string;
5
5
  param: string;
@@ -23,4 +23,4 @@ export type SearchComponent = BaseLayoutComponent & {
23
23
  onChange: (query: string) => void;
24
24
  onSelect: (result: SearchResult) => void;
25
25
  };
26
- export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "analyticsId" | "control" | "emptyMessage" | "margin" | "tags" | "title">, performSearch: PerformSearch, onBehavior: OnBehavior, updateComponent: UpdateComponent) => SearchComponent;
26
+ export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "analyticsId" | "control" | "emptyMessage" | "margin" | "tags" | "title">, performSearch: PerformSearch, onBehavior: OnBehavior, onComponentUpdate: OnComponentUpdate) => SearchComponent;
@@ -1,4 +1,4 @@
1
- import { BaseComponent, UpdateComponent } from '../../types';
1
+ import { BaseComponent, OnComponentUpdate } from '../../types';
2
2
  export type ExternalConfirmationComponent = BaseComponent & {
3
3
  type: 'external-confirmation';
4
4
  kind: 'layout';
@@ -9,4 +9,4 @@ export type ExternalConfirmationComponent = BaseComponent & {
9
9
  onFailure: () => void;
10
10
  onCancel: () => void;
11
11
  };
12
- export declare const createExternalConfirmation: (uid: string, url: string, updateComponent: UpdateComponent) => ExternalConfirmationComponent;
12
+ export declare const createExternalConfirmation: (uid: string, url: string, onComponentUpdate: OnComponentUpdate) => ExternalConfirmationComponent;
@@ -1,4 +1,4 @@
1
- import type { BaseComponent, DomainComponent, LayoutComponent, LoadingState, LocalValue, OnBehavior, SchemaComponent, UpdateComponent } from '../../types';
1
+ import type { BaseComponent, DomainComponent, LayoutComponent, LoadingState, LocalValue, OnBehavior, SchemaComponent, OnComponentUpdate } from '../../types';
2
2
  import type { NavigationStackBehavior, Step } from '@wise/dynamic-flow-types/spec';
3
3
  import { Model } from '@wise/dynamic-flow-types/spec';
4
4
  import { RequestCache } from '../../prefetching/request-cache';
@@ -50,5 +50,5 @@ export type BackNavigation = {
50
50
  export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "toolbar" | "layoutComponents" | "schemaComponents" | "footerComponents" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "stackBehavior" | "etag" | "step" | "title" | "tags" | "requestCache" | "trackEvent" | "onBehavior"> & {
51
51
  stepPolling?: StepPolling;
52
52
  stepRefreshAfter?: StepRefreshAfter;
53
- updateComponent: UpdateComponent;
53
+ onComponentUpdate: OnComponentUpdate;
54
54
  }) => StepDomainComponent;
@@ -1,8 +1,8 @@
1
- import type { DomainComponent, UpdateComponent } from '../../types';
1
+ import type { DomainComponent, OnComponentUpdate } from '../../types';
2
2
  /**
3
3
  * Helper function to update a component.
4
4
  *
5
- * @param updateComponent the updateComponent function that will update the component with the given uid
6
- * @returns a function that accepts a component and returns a function that takes a function that will update the component and call `updateComponent` to notify that there has been a change.
5
+ * @param onComponentUpdate the function that will notify the view layer that something has changed in the domain layer
6
+ * @returns a function that can be used to update components without the linter shouting at us.
7
7
  */
8
- export declare const getInputUpdateFunction: <C extends DomainComponent>(updateComponent: UpdateComponent) => (component: C, updateFn: (component: C) => void) => void;
8
+ export declare const getInputUpdateFunction: <C extends DomainComponent>(onComponentUpdate: OnComponentUpdate) => (component: C, updateFn: (component: C) => void) => void;
@@ -1,7 +1,7 @@
1
1
  import type { Step as DFStep, Model, Schema, ValidationError } from '@wise/dynamic-flow-types/spec';
2
2
  import type { HttpClient } from '../../../types';
3
3
  import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
4
- import type { Behavior, LocalValue, OnBehavior, OnPersistAsync, OnValueChange, UpdateComponent } from '../../types';
4
+ import type { Behavior, LocalValue, OnBehavior, OnPersistAsync, OnValueChange, OnComponentUpdate } from '../../types';
5
5
  import type { GetErrorMessageFunctions, PersistAsyncConfig } from '../types';
6
6
  export type MapperProps = {
7
7
  stepLocalValue: LocalValue;
@@ -10,7 +10,7 @@ export type MapperProps = {
10
10
  httpClient: HttpClient;
11
11
  onBehavior: OnBehavior;
12
12
  onValueChange: OnValueChange;
13
- updateComponent: UpdateComponent;
13
+ onComponentUpdate: OnComponentUpdate;
14
14
  trackEvent: AnalyticsEventDispatcher;
15
15
  logEvent: LoggingEventDispatcher;
16
16
  registerSubmissionBehavior: (behavior: Behavior) => void;
@@ -174,7 +174,7 @@ export type BaseInputComponent<LV extends LocalValue> = BaseSchemaComponent<LV>
174
174
  onBlur: () => void;
175
175
  onFocus: () => void;
176
176
  };
177
- export type UpdateComponent = () => void;
177
+ export type OnComponentUpdate = () => void;
178
178
  export type ScrollToTop = (behavior: ScrollBehavior) => void;
179
179
  export type OnBehavior = (behavior: Behavior) => Promise<BehaviorController>;
180
180
  export type BehaviorController = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "5.4.0",
3
+ "version": "5.4.1-experimental-controller-59f0d39",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -41,7 +41,7 @@
41
41
  "@testing-library/jest-dom": "6.9.1",
42
42
  "@testing-library/react": "16.3.2",
43
43
  "@testing-library/user-event": "14.6.1",
44
- "@transferwise/components": "^46.121.1",
44
+ "@transferwise/components": "^46.122.1",
45
45
  "@transferwise/formatting": "^2.13.4",
46
46
  "@transferwise/icons": "4.0.2",
47
47
  "@transferwise/navigation-ui": "4.41.0",
@@ -1,15 +0,0 @@
1
- import { RootDomainComponent } from './domain/components/RootDomainComponent';
2
- import { FeatureFlags } from './domain/mappers/utils/FeatureFlags';
3
- import type { OnValueChange, ScrollToTop } from './domain/types';
4
- import type { DynamicFlowCoreProps } from './types';
5
- type UseDynamicFlowCoreProps = Omit<DynamicFlowCoreProps, 'renderers' | 'features'> & {
6
- features: FeatureFlags;
7
- onValueChange?: OnValueChange;
8
- scrollToTop: ScrollToTop;
9
- onLink: (url: string) => boolean;
10
- };
11
- export declare function useDynamicFlowController(props: UseDynamicFlowCoreProps): {
12
- rootComponent: RootDomainComponent;
13
- cancel: () => void;
14
- };
15
- export {};