@wise/dynamic-flow-client 4.1.0 → 4.2.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.
- package/build/main.js +21 -3
- package/build/main.mjs +21 -3
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +3 -2
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -2
- package/build/types/revamp/domain/types.d.ts +10 -0
- package/build/types/revamp/utils/findComponent.d.ts +2 -1
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -8444,7 +8444,8 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8444
8444
|
autocompleteHint,
|
|
8445
8445
|
default: defaultValue,
|
|
8446
8446
|
minimum: minimumDate,
|
|
8447
|
-
maximum: maximumDate
|
|
8447
|
+
maximum: maximumDate,
|
|
8448
|
+
suggestions
|
|
8448
8449
|
} = schema;
|
|
8449
8450
|
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
|
|
8450
8451
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
@@ -8469,6 +8470,11 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8469
8470
|
],
|
|
8470
8471
|
minimumDate,
|
|
8471
8472
|
maximumDate,
|
|
8473
|
+
suggestions: suggestions ? {
|
|
8474
|
+
values: suggestions.values.map((suggestion) => __spreadProps(__spreadValues({}, suggestion), {
|
|
8475
|
+
image: mapSpecImage(suggestion.image)
|
|
8476
|
+
}))
|
|
8477
|
+
} : void 0,
|
|
8472
8478
|
value,
|
|
8473
8479
|
persistedState,
|
|
8474
8480
|
validationAsyncState,
|
|
@@ -8764,6 +8770,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8764
8770
|
format,
|
|
8765
8771
|
maxLength,
|
|
8766
8772
|
minLength,
|
|
8773
|
+
suggestions,
|
|
8767
8774
|
validationMessages
|
|
8768
8775
|
} = schema;
|
|
8769
8776
|
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange, logEvent } = mapperProps;
|
|
@@ -8794,6 +8801,11 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8794
8801
|
displayFormat,
|
|
8795
8802
|
maxLength,
|
|
8796
8803
|
minLength,
|
|
8804
|
+
suggestions: suggestions ? {
|
|
8805
|
+
values: suggestions.values.map((suggestion) => __spreadProps(__spreadValues({}, suggestion), {
|
|
8806
|
+
image: mapSpecImage(suggestion.image)
|
|
8807
|
+
}))
|
|
8808
|
+
} : void 0,
|
|
8797
8809
|
value,
|
|
8798
8810
|
persistedState,
|
|
8799
8811
|
validationAsyncState,
|
|
@@ -10979,7 +10991,7 @@ var formatDateOptions = {
|
|
|
10979
10991
|
};
|
|
10980
10992
|
|
|
10981
10993
|
// src/revamp/utils/findComponent.ts
|
|
10982
|
-
var findComponent = (components, id) => {
|
|
10994
|
+
var findComponent = (components, id, logEvent) => {
|
|
10983
10995
|
const flattened = flattenComponents(components);
|
|
10984
10996
|
const matching = flattened.filter((component) => component.uid === id);
|
|
10985
10997
|
if (matching.length === 1) {
|
|
@@ -10988,6 +11000,10 @@ var findComponent = (components, id) => {
|
|
|
10988
11000
|
if (matching.length > 1) {
|
|
10989
11001
|
throw new Error(`Multiple components with the same uid: ${id}`);
|
|
10990
11002
|
}
|
|
11003
|
+
logEvent("error", "Failed to find domain layer component", {
|
|
11004
|
+
componentUid: id,
|
|
11005
|
+
componentsTree: flattened.map((component) => component.uid)
|
|
11006
|
+
});
|
|
10991
11007
|
throw new Error(`Failed to find any components with uid: ${id}`);
|
|
10992
11008
|
};
|
|
10993
11009
|
var flattenComponents = (components) => components.reduce((acc, component) => {
|
|
@@ -11068,7 +11084,7 @@ function useDynamicFlowCore(props) {
|
|
|
11068
11084
|
const updateComponent = (id, update) => {
|
|
11069
11085
|
const currentStepComponent = stepComponentRef.current;
|
|
11070
11086
|
if (currentStepComponent) {
|
|
11071
|
-
update(findComponent([currentStepComponent], id));
|
|
11087
|
+
update(findComponent([currentStepComponent], id, logEvent));
|
|
11072
11088
|
setStepComponent(() => {
|
|
11073
11089
|
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11074
11090
|
stepComponentRef.current = newStepDomainComponent;
|
|
@@ -11447,6 +11463,7 @@ var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProp
|
|
|
11447
11463
|
autoComplete: component.autoComplete,
|
|
11448
11464
|
minimumDate: component.minimumDate,
|
|
11449
11465
|
maximumDate: component.maximumDate,
|
|
11466
|
+
suggestions: component.suggestions,
|
|
11450
11467
|
onChange: component.onChange.bind(component)
|
|
11451
11468
|
});
|
|
11452
11469
|
|
|
@@ -11713,6 +11730,7 @@ var textInputComponentToProps = (component, rendererMapperProps) => __spreadProp
|
|
|
11713
11730
|
displayFormat: component.displayFormat,
|
|
11714
11731
|
maxLength: component.maxLength,
|
|
11715
11732
|
minLength: component.minLength,
|
|
11733
|
+
suggestions: component.suggestions,
|
|
11716
11734
|
onChange: component.onChange.bind(component)
|
|
11717
11735
|
});
|
|
11718
11736
|
|
package/build/main.mjs
CHANGED
|
@@ -8421,7 +8421,8 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8421
8421
|
autocompleteHint,
|
|
8422
8422
|
default: defaultValue,
|
|
8423
8423
|
minimum: minimumDate,
|
|
8424
|
-
maximum: maximumDate
|
|
8424
|
+
maximum: maximumDate,
|
|
8425
|
+
suggestions
|
|
8425
8426
|
} = schema;
|
|
8426
8427
|
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
|
|
8427
8428
|
const errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
@@ -8446,6 +8447,11 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8446
8447
|
],
|
|
8447
8448
|
minimumDate,
|
|
8448
8449
|
maximumDate,
|
|
8450
|
+
suggestions: suggestions ? {
|
|
8451
|
+
values: suggestions.values.map((suggestion) => __spreadProps(__spreadValues({}, suggestion), {
|
|
8452
|
+
image: mapSpecImage(suggestion.image)
|
|
8453
|
+
}))
|
|
8454
|
+
} : void 0,
|
|
8449
8455
|
value,
|
|
8450
8456
|
persistedState,
|
|
8451
8457
|
validationAsyncState,
|
|
@@ -8741,6 +8747,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8741
8747
|
format,
|
|
8742
8748
|
maxLength,
|
|
8743
8749
|
minLength,
|
|
8750
|
+
suggestions,
|
|
8744
8751
|
validationMessages
|
|
8745
8752
|
} = schema;
|
|
8746
8753
|
const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange, logEvent } = mapperProps;
|
|
@@ -8771,6 +8778,11 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
8771
8778
|
displayFormat,
|
|
8772
8779
|
maxLength,
|
|
8773
8780
|
minLength,
|
|
8781
|
+
suggestions: suggestions ? {
|
|
8782
|
+
values: suggestions.values.map((suggestion) => __spreadProps(__spreadValues({}, suggestion), {
|
|
8783
|
+
image: mapSpecImage(suggestion.image)
|
|
8784
|
+
}))
|
|
8785
|
+
} : void 0,
|
|
8774
8786
|
value,
|
|
8775
8787
|
persistedState,
|
|
8776
8788
|
validationAsyncState,
|
|
@@ -10956,7 +10968,7 @@ var formatDateOptions = {
|
|
|
10956
10968
|
};
|
|
10957
10969
|
|
|
10958
10970
|
// src/revamp/utils/findComponent.ts
|
|
10959
|
-
var findComponent = (components, id) => {
|
|
10971
|
+
var findComponent = (components, id, logEvent) => {
|
|
10960
10972
|
const flattened = flattenComponents(components);
|
|
10961
10973
|
const matching = flattened.filter((component) => component.uid === id);
|
|
10962
10974
|
if (matching.length === 1) {
|
|
@@ -10965,6 +10977,10 @@ var findComponent = (components, id) => {
|
|
|
10965
10977
|
if (matching.length > 1) {
|
|
10966
10978
|
throw new Error(`Multiple components with the same uid: ${id}`);
|
|
10967
10979
|
}
|
|
10980
|
+
logEvent("error", "Failed to find domain layer component", {
|
|
10981
|
+
componentUid: id,
|
|
10982
|
+
componentsTree: flattened.map((component) => component.uid)
|
|
10983
|
+
});
|
|
10968
10984
|
throw new Error(`Failed to find any components with uid: ${id}`);
|
|
10969
10985
|
};
|
|
10970
10986
|
var flattenComponents = (components) => components.reduce((acc, component) => {
|
|
@@ -11045,7 +11061,7 @@ function useDynamicFlowCore(props) {
|
|
|
11045
11061
|
const updateComponent = (id, update) => {
|
|
11046
11062
|
const currentStepComponent = stepComponentRef.current;
|
|
11047
11063
|
if (currentStepComponent) {
|
|
11048
|
-
update(findComponent([currentStepComponent], id));
|
|
11064
|
+
update(findComponent([currentStepComponent], id, logEvent));
|
|
11049
11065
|
setStepComponent(() => {
|
|
11050
11066
|
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11051
11067
|
stepComponentRef.current = newStepDomainComponent;
|
|
@@ -11424,6 +11440,7 @@ var dateInputComponentToProps = (component, rendererMapperProps) => __spreadProp
|
|
|
11424
11440
|
autoComplete: component.autoComplete,
|
|
11425
11441
|
minimumDate: component.minimumDate,
|
|
11426
11442
|
maximumDate: component.maximumDate,
|
|
11443
|
+
suggestions: component.suggestions,
|
|
11427
11444
|
onChange: component.onChange.bind(component)
|
|
11428
11445
|
});
|
|
11429
11446
|
|
|
@@ -11690,6 +11707,7 @@ var textInputComponentToProps = (component, rendererMapperProps) => __spreadProp
|
|
|
11690
11707
|
displayFormat: component.displayFormat,
|
|
11691
11708
|
maxLength: component.maxLength,
|
|
11692
11709
|
minLength: component.minLength,
|
|
11710
|
+
suggestions: component.suggestions,
|
|
11693
11711
|
onChange: component.onChange.bind(component)
|
|
11694
11712
|
});
|
|
11695
11713
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
2
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
-
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
|
|
3
|
+
import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
|
|
4
4
|
import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
5
5
|
import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
|
|
6
6
|
export type DateInputComponent = InputComponent<string | null> & {
|
|
@@ -8,10 +8,11 @@ export type DateInputComponent = InputComponent<string | null> & {
|
|
|
8
8
|
minimumDate?: string;
|
|
9
9
|
maximumDate?: string;
|
|
10
10
|
persistedState: PersistedState;
|
|
11
|
+
suggestions?: Suggestions;
|
|
11
12
|
validationAsyncState: ValidationAsyncState;
|
|
12
13
|
onChange: (value: string | null) => void;
|
|
13
14
|
};
|
|
14
|
-
export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "icon" | "image" | "minimumDate" | "maximumDate" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationAsyncState"> & {
|
|
15
|
+
export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "icon" | "image" | "minimumDate" | "maximumDate" | "persistedState" | "placeholder" | "required" | "suggestions" | "title" | "value" | "validationAsyncState"> & {
|
|
15
16
|
checks: IsInvalidCheck<string | null>[];
|
|
16
17
|
performPersistAsync: PerformPersistAsync | undefined;
|
|
17
18
|
performRefresh: PerformRefresh | undefined;
|
|
@@ -2,7 +2,7 @@ import type { PerformPersistAsync } from '../features/persistAsync/getPerformPer
|
|
|
2
2
|
import { type PerformRefresh } from '../features/refresh/getPerformRefresh';
|
|
3
3
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
4
4
|
import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
|
|
5
|
-
import type { Autocapitalization, InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
|
|
5
|
+
import type { Autocapitalization, InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
|
|
6
6
|
export type TextInputComponent = InputComponent<string | null> & {
|
|
7
7
|
type: 'text';
|
|
8
8
|
autocapitalization?: Autocapitalization;
|
|
@@ -10,10 +10,11 @@ export type TextInputComponent = InputComponent<string | null> & {
|
|
|
10
10
|
maxLength?: number;
|
|
11
11
|
minLength?: number;
|
|
12
12
|
persistedState: PersistedState;
|
|
13
|
+
suggestions?: Suggestions;
|
|
13
14
|
validationAsyncState: ValidationAsyncState;
|
|
14
15
|
onChange: (value: string | null) => void;
|
|
15
16
|
};
|
|
16
|
-
export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autocapitalization" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "icon" | "image" | "maxLength" | "minLength" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationAsyncState"> & {
|
|
17
|
+
export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autocapitalization" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "icon" | "image" | "maxLength" | "minLength" | "persistedState" | "placeholder" | "required" | "suggestions" | "title" | "value" | "validationAsyncState"> & {
|
|
17
18
|
checks: IsInvalidCheck<string | null>[];
|
|
18
19
|
performPersistAsync: PerformPersistAsync | undefined;
|
|
19
20
|
performValidationAsync: PerformValidationAsync | undefined;
|
|
@@ -93,6 +93,16 @@ export type Autocapitalization = 'none' | 'sentences' | 'words' | 'characters';
|
|
|
93
93
|
export type Bias = 'none' | 'start' | 'end';
|
|
94
94
|
export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
|
|
95
95
|
export type UploadSource = 'file' | 'camera';
|
|
96
|
+
export type Suggestions = {
|
|
97
|
+
values: SuggestionsValue[];
|
|
98
|
+
};
|
|
99
|
+
export type SuggestionsValue = {
|
|
100
|
+
label: string;
|
|
101
|
+
value?: JsonElement;
|
|
102
|
+
icon?: Icon;
|
|
103
|
+
image?: Image;
|
|
104
|
+
tag?: string;
|
|
105
|
+
};
|
|
96
106
|
export type RepeatableSummary = {
|
|
97
107
|
title?: string;
|
|
98
108
|
description?: string;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { LoggingEventDispatcher } from '../domain/features/events';
|
|
1
2
|
import type { DomainComponent } from '../domain/types';
|
|
2
|
-
export declare const findComponent: (components: DomainComponent[], id: string) => DomainComponent;
|
|
3
|
+
export declare const findComponent: (components: DomainComponent[], id: string, logEvent: LoggingEventDispatcher) => DomainComponent;
|