@wise/dynamic-flow-client 2.9.4 → 2.9.5

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 (35) hide show
  1. package/build/types/revamp/domain/components/AllOfComponent.d.ts +3 -2
  2. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +3 -1
  3. package/build/types/revamp/domain/components/ContainerComponent.d.ts +2 -2
  4. package/build/types/revamp/domain/components/DateInputComponent.d.ts +3 -1
  5. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +3 -1
  6. package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
  7. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +3 -1
  8. package/build/types/revamp/domain/components/ObjectComponent.d.ts +5 -2
  9. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +5 -3
  10. package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -1
  11. package/build/types/revamp/domain/components/UploadInputComponent.d.ts +3 -1
  12. package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +5 -2
  13. package/build/types/revamp/domain/components/utils/isPartialLocalValueMatch.d.ts +2 -0
  14. package/build/types/revamp/domain/features/events/getAnalyticsEventDispatcher.d.ts +1 -1
  15. package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +3 -2
  16. package/build/types/revamp/domain/features/refresh/getPerformRefresh.d.ts +5 -0
  17. package/build/types/revamp/domain/mappers/schema/blobSchemaToComponent.d.ts +1 -1
  18. package/build/types/revamp/domain/mappers/schema/booleanSchemaToComponent.d.ts +1 -1
  19. package/build/types/revamp/domain/mappers/schema/integerSchemaToComponent.d.ts +1 -1
  20. package/build/types/revamp/domain/mappers/schema/numberSchemaToComponent.d.ts +1 -1
  21. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +3 -0
  22. package/build/types/revamp/domain/mappers/schema/types.d.ts +4 -1
  23. package/build/types/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.d.ts +5 -0
  24. package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +2 -3
  25. package/build/types/revamp/domain/types.d.ts +3 -13
  26. package/build/types/revamp/flow/executeRefresh.d.ts +19 -0
  27. package/build/types/revamp/flow/{performAction.d.ts → executeSubmission.d.ts} +1 -6
  28. package/build/types/revamp/renderers/types.d.ts +1 -0
  29. package/build/types/revamp/step/Step.d.ts +10 -3
  30. package/build/types/revamp/utils/component-utils.d.ts +3 -2
  31. package/build/types/revamp/utils/type-utils.d.ts +2 -1
  32. package/build/types/revamp/utils/type-validators.d.ts +1 -0
  33. package/package.json +2 -3
  34. package/build/types/revamp/domain/components/utils/isModelMatchWithValue.d.ts +0 -3
  35. package/build/types/revamp/domain/components/utils/isModelMatchWithValue.spec..d.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { ListComponent, RepeatableSummary, StepComponent } from '../types';
3
- export type AllOfComponent = ListComponent & {
2
+ import type { BaseComponent, LocalValue, RepeatableSummary, StepComponent } from '../types';
3
+ export type AllOfComponent = BaseComponent & {
4
4
  type: 'all-of';
5
5
  components: StepComponent[];
6
6
  control?: string;
@@ -9,6 +9,7 @@ export type AllOfComponent = ListComponent & {
9
9
  hidden: boolean;
10
10
  title?: string;
11
11
  getChildren: () => StepComponent[];
12
+ getLocalValue: () => LocalValue;
12
13
  };
13
14
  export declare const createAllOfComponent: (allOfProps: Pick<AllOfComponent, "description" | "help" | "hidden" | "title" | "control" | "components"> & {
14
15
  uid: string;
@@ -1,13 +1,15 @@
1
1
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type BooleanInputComponent = InputComponent<boolean> & {
5
6
  type: 'boolean';
6
7
  persistedState: PersistedState;
7
8
  onChange: (value: boolean) => void;
8
9
  };
9
- export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "control" | "id" | "errors" | "required" | "value" | "uid"> & {
10
+ export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "control" | "id" | "errors" | "required" | "value" | "uid" | "persistedState"> & {
10
11
  checks: IsInvalidCheck<boolean>[];
11
12
  performPersistAsync: PerformPersistAsync | undefined;
13
+ performRefresh?: PerformRefresh | undefined;
12
14
  summariser: (value: boolean) => RepeatableSummary;
13
15
  }, updateComponent: UpdateComponent) => BooleanInputComponent;
@@ -1,9 +1,9 @@
1
- import type { BaseComponent, LocalValueArray, StepComponent } from '../types';
1
+ import type { BaseComponent, LocalValue, StepComponent } from '../types';
2
2
  export type ContainerComponent = BaseComponent & {
3
3
  type: 'container';
4
4
  components: StepComponent[];
5
5
  getChildren: () => StepComponent[];
6
- getLocalValue: () => LocalValueArray;
6
+ getLocalValue: () => LocalValue;
7
7
  };
8
8
  export declare const createContainerComponent: (containerProps: {
9
9
  uid: string;
@@ -1,6 +1,7 @@
1
1
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type DateInputComponent = InputComponent<string | null> & {
5
6
  type: 'date';
6
7
  minimumDate?: string;
@@ -8,8 +9,9 @@ export type DateInputComponent = InputComponent<string | null> & {
8
9
  persistedState: PersistedState;
9
10
  onChange: (value: string | null) => void;
10
11
  };
11
- export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "minimumDate" | "maximumDate" | "uid"> & {
12
+ export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "minimumDate" | "maximumDate" | "uid" | "persistedState"> & {
12
13
  checks: IsInvalidCheck<string | null>[];
13
14
  performPersistAsync: PerformPersistAsync | undefined;
15
+ performRefresh?: PerformRefresh | undefined;
14
16
  summariser: (value: string | null) => RepeatableSummary;
15
17
  }, updateComponent: UpdateComponent) => DateInputComponent;
@@ -1,13 +1,15 @@
1
1
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type IntegerInputComponent = InputComponent<number | null> & {
5
6
  type: 'integer';
6
7
  persistedState: PersistedState;
7
8
  onChange: (value: number | null) => void;
8
9
  };
9
- export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
10
+ export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid" | "persistedState"> & {
10
11
  checks: IsInvalidCheck<number | null>[];
11
12
  performPersistAsync: PerformPersistAsync | undefined;
13
+ performRefresh?: PerformRefresh | undefined;
12
14
  summariser: (value: number | null) => RepeatableSummary;
13
15
  }, updateComponent: UpdateComponent) => IntegerInputComponent;
@@ -14,7 +14,7 @@ export type MultiUploadInputComponent = InputComponent<File[]> & {
14
14
  onDelete: (fileId: string) => Promise<void>;
15
15
  onUpload: (file: File, fileId: string) => Promise<void>;
16
16
  };
17
- export declare const createMultiUploadInputComponent: (uploadInputProps: Pick<MultiUploadInputComponent, "analyticsId" | "description" | "disabled" | "format" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "maxItems" | "minItems" | "accepts" | "maxSize" | "autoComplete" | "uid" | "uploadLabel"> & {
17
+ export declare const createMultiUploadInputComponent: (uploadInputProps: Pick<MultiUploadInputComponent, "analyticsId" | "description" | "disabled" | "format" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "maxItems" | "minItems" | "value" | "accepts" | "maxSize" | "autoComplete" | "uid" | "persistedState" | "uploadLabel"> & {
18
18
  checks: IsInvalidCheck<File[]>[];
19
19
  performPersistAsync: PerformPersistAsync | undefined;
20
20
  summariser: (value: string[]) => RepeatableSummary;
@@ -1,13 +1,15 @@
1
1
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
3
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type NumberInputComponent = InputComponent<number | null> & {
5
6
  type: 'number';
6
7
  persistedState: PersistedState;
7
8
  onChange: (value: number | null) => void;
8
9
  };
9
- export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
10
+ export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid" | "persistedState"> & {
10
11
  checks: IsInvalidCheck<number | null>[];
11
12
  performPersistAsync: PerformPersistAsync | undefined;
13
+ performRefresh?: PerformRefresh | undefined;
12
14
  summariser: (value: number | null) => RepeatableSummary;
13
15
  }, updateComponent: UpdateComponent) => NumberInputComponent;
@@ -1,6 +1,9 @@
1
- import type { LocalValue, MapComponent, RepeatableSummary } from '../types';
2
- export type ObjectComponent = MapComponent & {
1
+ import type { ComponentWithTitle, LocalValue, LocalValueObject, RepeatableSummary, StepComponent } from '../types';
2
+ export type ObjectComponent = ComponentWithTitle & {
3
3
  type: 'object';
4
+ componentMap: Record<string, StepComponent>;
5
+ getChildren: () => StepComponent[];
6
+ getLocalValue: () => LocalValueObject;
4
7
  };
5
8
  export declare const createObjectComponent: (objectProps: Pick<ObjectComponent, "description" | "help" | "hidden" | "title" | "control" | "componentMap"> & {
6
9
  uid: string;
@@ -1,8 +1,9 @@
1
- import type { Icon, Image, Model } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Icon, Image } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { InputComponent, LocalValue, PersistedState, RepeatableSummary, StepComponent, UpdateComponent } from '../types';
3
3
  import type { IsInvalidCheck } from '../features/validation/value-checks';
4
4
  import type { AnalyticsEventDispatcher } from '../features/events';
5
5
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
6
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
6
7
  export type SelectInputComponent = InputComponent<LocalValue | null> & {
7
8
  type: 'select';
8
9
  selectedIndex: number | null;
@@ -21,13 +22,14 @@ export type SelectInputOption = {
21
22
  keywords?: string[];
22
23
  disabled: boolean;
23
24
  };
24
- export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "autoComplete" | "uid"> & {
25
- initialValue: Model;
25
+ export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "autoComplete" | "uid" | "persistedState"> & {
26
+ initialValue: LocalValue;
26
27
  options: (SelectInputOption & {
27
28
  component: StepComponent;
28
29
  })[];
29
30
  checks: IsInvalidCheck<LocalValue>[];
30
31
  performPersistAsync: PerformPersistAsync | undefined;
32
+ performRefresh?: PerformRefresh | undefined;
31
33
  summariser: (value: LocalValue | null) => RepeatableSummary;
32
34
  trackEvent: AnalyticsEventDispatcher;
33
35
  }, updateComponent: UpdateComponent) => SelectInputComponent;
@@ -1,14 +1,16 @@
1
1
  import type { IsInvalidCheck } from '../features/validation/value-checks';
2
2
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
3
3
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type TextInputComponent = InputComponent<string | null> & {
5
6
  type: 'text';
6
7
  displayFormat?: string;
7
8
  persistedState: PersistedState;
8
9
  onChange: (value: string | null) => void;
9
10
  };
10
- export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "displayFormat" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
11
+ export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "analyticsId" | "description" | "disabled" | "help" | "hidden" | "title" | "placeholder" | "control" | "displayFormat" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid" | "persistedState"> & {
11
12
  checks: IsInvalidCheck<string | null>[];
12
13
  performPersistAsync: PerformPersistAsync | undefined;
14
+ performRefresh?: PerformRefresh | undefined;
13
15
  summariser: (value: string | null) => RepeatableSummary;
14
16
  }, updateComponent: UpdateComponent) => TextInputComponent;
@@ -1,6 +1,7 @@
1
1
  import type { IsInvalidCheck } from '../features/validation/value-checks';
2
2
  import type { InputComponent, PersistedState, RepeatableSummary, UpdateComponent } from '../types';
3
3
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
4
+ import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
4
5
  export type UploadInputComponent = InputComponent<File | null> & {
5
6
  type: 'upload';
6
7
  format: 'blob' | 'base64';
@@ -9,8 +10,9 @@ export type UploadInputComponent = InputComponent<File | null> & {
9
10
  persistedState: PersistedState;
10
11
  onUpload: (value: File | null) => Promise<void>;
11
12
  };
12
- export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "analyticsId" | "description" | "disabled" | "format" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "accepts" | "maxSize" | "autoComplete" | "uid"> & {
13
+ export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "analyticsId" | "description" | "disabled" | "format" | "help" | "hidden" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "accepts" | "maxSize" | "autoComplete" | "uid" | "persistedState"> & {
13
14
  checks: IsInvalidCheck<File | null>[];
14
15
  performPersistAsync: PerformPersistAsync | undefined;
16
+ performRefresh?: PerformRefresh | undefined;
15
17
  summariser: (value: string | null) => RepeatableSummary;
16
18
  }, updateComponent: UpdateComponent) => UploadInputComponent;
@@ -1,15 +1,18 @@
1
1
  import type { SummarySummariser } from '@wise/dynamic-flow-types/build/next/feature/SummarySummariser';
2
- import type { ListComponent, LocalValue, LocalValueArray, RepeatableSummary, StepComponent, UpdateComponent } from '../../types';
2
+ import type { ComponentWithTitle, LocalValue, LocalValueArray, RepeatableSummary, StepComponent, UpdateComponent } from '../../types';
3
3
  import type { IsInvalidCheck } from '../../features/validation/value-checks';
4
- export type RepeatableComponent = ListComponent & {
4
+ export type RepeatableComponent = ComponentWithTitle & {
5
5
  type: 'repeatable';
6
6
  id?: string;
7
+ components: StepComponent[];
7
8
  addItemTitle: string;
8
9
  editableComponent: StepComponent | null;
9
10
  editableIndex: number | null;
10
11
  editItemTitle: string;
11
12
  errors: string[];
12
13
  summaryDefaults: RepeatableSummary;
14
+ getChildren: () => StepComponent[];
15
+ getLocalValue: () => LocalValueArray;
13
16
  onAdd: () => void;
14
17
  onEdit: (itemIndex: number) => void;
15
18
  onRemove: () => void;
@@ -0,0 +1,2 @@
1
+ import type { LocalValue } from '../../types';
2
+ export declare const isPartialLocalValueMatch: (partialValue: LocalValue, value: LocalValue) => boolean;
@@ -6,4 +6,4 @@ export declare const getAnalyticsEventDispatcher: ({ flowId, step, onEvent, }: {
6
6
  step?: Step | null | undefined;
7
7
  onEvent?: AnalyticsEventHandler | undefined;
8
8
  }) => AnalyticsEventDispatcher;
9
- export type EventName = 'Flow Started' | 'Flow Completed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
9
+ export type EventName = 'Flow Started' | 'Flow Succeeded' | 'Flow Failed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Aborted' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Aborted' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Search Started' | 'Search Result Selected';
@@ -1,2 +1,3 @@
1
- import type { PersistedState } from '../../types';
2
- export declare const getInitialPersistedState: () => PersistedState;
1
+ import type { JsonElement } from '@wise/dynamic-flow-types/build/next';
2
+ import type { LocalValue, PersistedState } from '../../types';
3
+ export declare const getInitialPersistedState: (lastSubmitted?: LocalValue, model?: JsonElement) => PersistedState;
@@ -0,0 +1,5 @@
1
+ import type { Schema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { OnRefresh } from '../../types';
3
+ export type PerformRefresh = () => void;
4
+ export declare const getPerformRefresh: (schema: Schema, onRefresh: OnRefresh) => (() => Promise<void>) | undefined;
5
+ export declare const getDebouncedPerformRefresh: (schema: Schema, onRefresh: OnRefresh) => (() => Promise<void>) | undefined;
@@ -1,5 +1,5 @@
1
- import type { MapperProps, SchemaMapperProps } from './types';
2
1
  import type { BlobSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { MapperProps, SchemaMapperProps } from './types';
3
3
  export declare const blobSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
4
4
  schema: BlobSchema;
5
5
  }, mapperProps: MapperProps) => import("../../components/UploadInputComponent").UploadInputComponent;
@@ -1,5 +1,5 @@
1
- import type { MapperProps, SchemaMapperProps } from './types';
2
1
  import type { BooleanSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { MapperProps, SchemaMapperProps } from './types';
3
3
  export declare const booleanSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
4
4
  schema: BooleanSchema;
5
5
  }, mapperProps: MapperProps) => import("../../components/BooleanInputComponent").BooleanInputComponent;
@@ -1,5 +1,5 @@
1
- import type { MapperProps, SchemaMapperProps } from './types';
2
1
  import type { IntegerSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { MapperProps, SchemaMapperProps } from './types';
3
3
  export declare const integerSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
4
4
  schema: IntegerSchema;
5
5
  }, mapperProps: MapperProps) => import("../../components/IntegerInputComponent").IntegerInputComponent;
@@ -1,5 +1,5 @@
1
- import type { MapperProps, SchemaMapperProps } from './types';
2
1
  import type { NumberSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { MapperProps, SchemaMapperProps } from './types';
3
3
  export declare const numberSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
4
4
  schema: NumberSchema;
5
5
  }, mapperProps: MapperProps) => import("../../components/NumberInputComponent").NumberInputComponent;
@@ -3,10 +3,12 @@ import type { Schema, Step } from '@wise/dynamic-flow-types/build/next';
3
3
  import type { MapperProps, SchemaMapperProps } from '../types';
4
4
  import type { StepComponent } from '../../../types';
5
5
  export declare const getMockMapperProps: (mapperProps?: Partial<MapperProps>) => {
6
+ stepLocalValue: import("../../../types").LocalValue;
6
7
  step: Step;
7
8
  getErrorMessageFunctions: jest.Mock<any, any, any> | import("../../types").GetErrorMessageFunctions;
8
9
  httpClient: typeof fetch | jest.Mock<any, any, any>;
9
10
  onAction: jest.Mock<any, any, any> | import("../../../types").OnAction;
11
+ onRefresh: jest.Mock<any, any, any> | import("../../../types").OnRefresh;
10
12
  updateComponent: jest.Mock<any, any, any> | import("../../../types").UpdateComponent;
11
13
  trackEvent: jest.Mock<any, any, any> | import("../../../features/events").AnalyticsEventDispatcher;
12
14
  logEvent: jest.Mock<any, any, any> | import("../../../features/events").LoggingEventDispatcher;
@@ -17,6 +19,7 @@ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperPr
17
19
  uid: string;
18
20
  schema: (Schema | undefined) & S;
19
21
  model: import("@wise/dynamic-flow-types/build/next").JsonElement;
22
+ localValue: import("../../../types").LocalValue;
20
23
  required: boolean;
21
24
  validationErrors: import("@wise/dynamic-flow-types/build/next").JsonElement;
22
25
  persistAsyncConfig?: import("../../types").PersistAsyncConfig | undefined;
@@ -1,13 +1,15 @@
1
1
  import type { Step as DFStep, Model, Schema, ValidationError } from '@wise/dynamic-flow-types/build/next';
2
- import type { OnAction, UpdateComponent } from '../../types';
2
+ import type { LocalValue, OnAction, OnRefresh, UpdateComponent } from '../../types';
3
3
  import type { GetErrorMessageFunctions, PersistAsyncConfig } from '../types';
4
4
  import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
5
5
  import type { HttpClient } from '../../../types';
6
6
  export type MapperProps = {
7
+ stepLocalValue: LocalValue;
7
8
  step: DFStep;
8
9
  getErrorMessageFunctions: GetErrorMessageFunctions;
9
10
  httpClient: HttpClient;
10
11
  onAction: OnAction;
12
+ onRefresh: OnRefresh;
11
13
  updateComponent: UpdateComponent;
12
14
  trackEvent: AnalyticsEventDispatcher;
13
15
  logEvent: LoggingEventDispatcher;
@@ -16,6 +18,7 @@ export type SchemaMapperProps = {
16
18
  uid: string;
17
19
  schema: Schema;
18
20
  model: Model;
21
+ localValue: LocalValue;
19
22
  required?: boolean;
20
23
  validationErrors?: ValidationError;
21
24
  persistAsyncConfig?: PersistAsyncConfig;
@@ -0,0 +1,5 @@
1
+ import type { MapperProps, SchemaMapperProps } from '../types';
2
+ export declare const getPersistAsyncInitialState: (schemaMapperProps: SchemaMapperProps, mapperProps: MapperProps) => {
3
+ performPersistAsync: import("../../../features/persistAsync/getPerformPersistAsync").PerformPersistAsync | undefined;
4
+ persistedState: import("../../../types").PersistedState;
5
+ };
@@ -1,5 +1,5 @@
1
- import type { MapperProps, SchemaMapperProps } from '../types';
2
- export declare const mapCommonSchemaProps: (schemaMapperProps: SchemaMapperProps, mapperProps: MapperProps) => {
1
+ import type { SchemaMapperProps } from '../types';
2
+ export declare const mapCommonSchemaProps: (schemaMapperProps: SchemaMapperProps) => {
3
3
  placeholder?: string | undefined;
4
4
  help?: string | undefined;
5
5
  uid: string;
@@ -13,7 +13,6 @@ export declare const mapCommonSchemaProps: (schemaMapperProps: SchemaMapperProps
13
13
  keywords: string[] | undefined;
14
14
  required: boolean;
15
15
  title: string | undefined;
16
- performPersistAsync: import("../../../features/persistAsync/getPerformPersistAsync").PerformPersistAsync | undefined;
17
16
  summariser: (value: import("../../../types").LocalValue) => {
18
17
  title?: undefined;
19
18
  description?: undefined;
@@ -47,25 +47,15 @@ export type BaseComponent = {
47
47
  export type LayoutComponent = BaseComponent & {
48
48
  control?: string;
49
49
  margin: Margin;
50
- getLocalValue: () => LocalValueArray | null;
50
+ getLocalValue: () => LocalValue;
51
51
  };
52
- type ComponentWithTitle = BaseComponent & {
52
+ export type ComponentWithTitle = BaseComponent & {
53
53
  control?: string;
54
54
  description?: string;
55
55
  help?: string;
56
56
  hidden: boolean;
57
57
  title?: string;
58
58
  };
59
- export type ListComponent = ComponentWithTitle & {
60
- components: StepComponent[];
61
- getChildren: () => StepComponent[];
62
- getLocalValue: () => LocalValueArray;
63
- };
64
- export type MapComponent = ComponentWithTitle & {
65
- componentMap: Record<string, StepComponent>;
66
- getChildren: () => StepComponent[];
67
- getLocalValue: () => LocalValueObject;
68
- };
69
59
  export type InputComponent<V extends LocalValue> = ComponentWithTitle & {
70
60
  id: string;
71
61
  autoComplete: string;
@@ -80,6 +70,7 @@ export type InputComponent<V extends LocalValue> = ComponentWithTitle & {
80
70
  };
81
71
  export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
82
72
  export type OnAction = (action: Action) => Promise<void>;
73
+ export type OnRefresh = (schemaId: string | undefined, url?: string) => Promise<void> | void;
83
74
  export type Align = 'start' | 'center' | 'end';
84
75
  export type Bias = 'none' | 'start' | 'end';
85
76
  export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
@@ -95,4 +86,3 @@ export type PersistedState = {
95
86
  lastSubmitted: LocalValue;
96
87
  submission: Promise<JsonElement | null>;
97
88
  };
98
- export {};
@@ -0,0 +1,19 @@
1
+ import type { Model, Step } from '@wise/dynamic-flow-types/build/next';
2
+ import type { AnalyticsEventDispatcher } from '../domain/features/events';
3
+ type Command = {
4
+ type: 'refresh-step';
5
+ step: Step;
6
+ etag: string | null;
7
+ } | {
8
+ type: 'noop';
9
+ };
10
+ export declare const executeRefresh: (props: {
11
+ abortSignal: AbortSignal;
12
+ url: string;
13
+ model: Model;
14
+ schemaId: string | undefined;
15
+ etag: string | null;
16
+ httpClient: typeof fetch;
17
+ trackEvent: AnalyticsEventDispatcher;
18
+ }) => Promise<Command>;
19
+ export {};
@@ -7,16 +7,11 @@ type Command = {
7
7
  type: 'replace-step';
8
8
  step: Step;
9
9
  etag: string | null;
10
- } | {
11
- type: 'refresh-step';
12
- step: Step;
13
- etag: string | null;
14
10
  } | {
15
11
  type: 'errors';
16
12
  errors: ErrorResponseBody;
17
13
  };
18
- export declare const performAction: (props: {
19
- type: 'submit' | 'refresh';
14
+ export declare const executeSubmission: (props: {
20
15
  action: Action;
21
16
  model: Model;
22
17
  httpClient: typeof fetch;
@@ -259,6 +259,7 @@ export type RepeatableRendererProps = {
259
259
  onRemove: () => void;
260
260
  };
261
261
  export type RepeatableItemRendererProps = {
262
+ id: string;
262
263
  description?: string;
263
264
  icon?: Icon;
264
265
  image?: Image;
@@ -1,14 +1,21 @@
1
1
  import type { Action, Step as DFStep, Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { StepComponent } from '../domain/types';
2
+ import type { LocalValue, StepComponent } from '../domain/types';
3
3
  import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
4
4
  import type { HttpClient } from '../types';
5
5
  type StepProps = {
6
+ localValue: LocalValue;
6
7
  step: DFStep;
7
8
  render: (component: StepComponent) => JSX.Element;
8
9
  httpClient: HttpClient;
9
10
  trackEvent: AnalyticsEventDispatcher;
10
11
  logEvent: LoggingEventDispatcher;
11
- triggerAction: (type: 'submit' | 'refresh', action: Action, model: Model) => Promise<void>;
12
+ triggerSubmission: (action: Action, model: Model) => Promise<void>;
13
+ triggerRefresh: (props: {
14
+ refreshUrl: string;
15
+ model: Model;
16
+ localValue: LocalValue;
17
+ schemaId: string | undefined;
18
+ }) => Promise<void>;
12
19
  };
13
- declare function Step({ step, render, httpClient, trackEvent, logEvent, triggerAction }: StepProps): JSX.Element;
20
+ declare function Step({ localValue, step, render, httpClient, trackEvent, logEvent, triggerSubmission, triggerRefresh, }: StepProps): JSX.Element;
14
21
  export default Step;
@@ -1,5 +1,6 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { LocalValueArray, StepComponent } from '../domain/types';
2
+ import type { LocalValue, StepComponent } from '../domain/types';
3
3
  export declare const getSubmittableData: (components: StepComponent[]) => Promise<Model>;
4
- export declare const getLocalValues: (components: StepComponent[]) => LocalValueArray;
4
+ export declare const getLocalValues: (components: StepComponent[]) => LocalValue;
5
+ export declare const mergeLocalValues: (valueA: LocalValue, valueB: LocalValue) => LocalValue;
5
6
  export declare const mergeModels: (valueA: Model, valueB: Model) => Model;
@@ -1,5 +1,5 @@
1
1
  import type { AllOfSchema, ArraySchema, ArraySchemaList, ArraySchemaTuple, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema, BlobSchema } from '@wise/dynamic-flow-types/build/next';
2
- import type { StepComponent } from '../domain/types';
2
+ import type { LocalValue, LocalValueObject, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
4
  import type { RepeatableComponent } from '../domain/components/repeatableComponent/RepeatableComponent';
5
5
  import type { PersistAsync } from '@wise/dynamic-flow-types/build/next/feature/PersistAsync';
@@ -22,6 +22,7 @@ export declare const isHiddenComponent: (component: StepComponent) => component
22
22
  hidden: true;
23
23
  };
24
24
  export declare const isRepeatableComponent: (component: StepComponent) => component is RepeatableComponent;
25
+ export declare const isObjectLocalValue: (value: LocalValue) => value is LocalValueObject;
25
26
  export declare const isObjectModel: (model: Model) => model is Record<string, import("@wise/dynamic-flow-types/build/next").JsonElement>;
26
27
  export declare const isArrayModel: (model: Model) => model is import("@wise/dynamic-flow-types/build/next").JsonElement[];
27
28
  export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
@@ -7,3 +7,4 @@ export declare const isArray: (value: unknown) => value is unknown[];
7
7
  export declare const isNull: (value: unknown) => value is null;
8
8
  export declare const isUndefined: (value: unknown) => value is undefined;
9
9
  export declare const isNullish: (v: unknown) => v is null | undefined;
10
+ export declare const isFile: (value: unknown) => value is File;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -57,7 +57,6 @@
57
57
  "currency-flags": "4.0.7",
58
58
  "enzyme": "^3.11.0",
59
59
  "esbuild": "0.20.1",
60
- "immer": "10.0.3",
61
60
  "jest": "29.7.0",
62
61
  "jest-environment-jsdom": "29.7.0",
63
62
  "jest-fetch-mock": "^3.0.3",
@@ -92,7 +91,7 @@
92
91
  "classnames": "2.5.1",
93
92
  "react-webcam": "^7.2.0",
94
93
  "screenfull": "^5.2.0",
95
- "@wise/dynamic-flow-types": "2.6.6"
94
+ "@wise/dynamic-flow-types": "2.6.7"
96
95
  },
97
96
  "scripts": {
98
97
  "dev": "storybook dev -p 3003",
@@ -1,3 +0,0 @@
1
- import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { LocalValue } from '../../types';
3
- export declare const isModelMatchWithValue: (partialModel: Model, value: LocalValue) => boolean;