@wise/dynamic-flow-client 4.2.0 → 4.2.2
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 +20 -12
- package/build/main.mjs +20 -12
- package/build/types/revamp/utils/findComponent.d.ts +2 -1
- package/package.json +3 -3
package/build/main.js
CHANGED
|
@@ -10991,7 +10991,7 @@ var formatDateOptions = {
|
|
|
10991
10991
|
};
|
|
10992
10992
|
|
|
10993
10993
|
// src/revamp/utils/findComponent.ts
|
|
10994
|
-
var findComponent = (components, id) => {
|
|
10994
|
+
var findComponent = (components, id, logEvent) => {
|
|
10995
10995
|
const flattened = flattenComponents(components);
|
|
10996
10996
|
const matching = flattened.filter((component) => component.uid === id);
|
|
10997
10997
|
if (matching.length === 1) {
|
|
@@ -11000,6 +11000,10 @@ var findComponent = (components, id) => {
|
|
|
11000
11000
|
if (matching.length > 1) {
|
|
11001
11001
|
throw new Error(`Multiple components with the same uid: ${id}`);
|
|
11002
11002
|
}
|
|
11003
|
+
logEvent("error", "Failed to find domain layer component", {
|
|
11004
|
+
componentUid: id,
|
|
11005
|
+
componentsTree: flattened.map((component) => component.uid)
|
|
11006
|
+
});
|
|
11003
11007
|
throw new Error(`Failed to find any components with uid: ${id}`);
|
|
11004
11008
|
};
|
|
11005
11009
|
var flattenComponents = (components) => components.reduce((acc, component) => {
|
|
@@ -11036,6 +11040,21 @@ function useDynamicFlowCore(props) {
|
|
|
11036
11040
|
);
|
|
11037
11041
|
const [stepComponent, setStepComponent] = (0, import_react3.useState)(null);
|
|
11038
11042
|
const stepComponentRef = (0, import_react3.useRef)(null);
|
|
11043
|
+
const updateComponent = (0, import_react3.useCallback)(
|
|
11044
|
+
(id, update) => {
|
|
11045
|
+
const currentStepComponent = stepComponentRef.current;
|
|
11046
|
+
if (currentStepComponent) {
|
|
11047
|
+
update(findComponent([currentStepComponent], id, logEvent));
|
|
11048
|
+
setStepComponent(() => {
|
|
11049
|
+
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11050
|
+
stepComponentRef.current = newStepDomainComponent;
|
|
11051
|
+
return newStepDomainComponent;
|
|
11052
|
+
});
|
|
11053
|
+
}
|
|
11054
|
+
},
|
|
11055
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11056
|
+
[]
|
|
11057
|
+
);
|
|
11039
11058
|
const stepCount = (0, import_react3.useRef)(0);
|
|
11040
11059
|
const stepRef = (0, import_react3.useRef)(initialStep != null ? initialStep : null);
|
|
11041
11060
|
const etagRef = (0, import_react3.useRef)(null);
|
|
@@ -11077,17 +11096,6 @@ function useDynamicFlowCore(props) {
|
|
|
11077
11096
|
errors: validationResult.errors
|
|
11078
11097
|
});
|
|
11079
11098
|
}
|
|
11080
|
-
const updateComponent = (id, update) => {
|
|
11081
|
-
const currentStepComponent = stepComponentRef.current;
|
|
11082
|
-
if (currentStepComponent) {
|
|
11083
|
-
update(findComponent([currentStepComponent], id));
|
|
11084
|
-
setStepComponent(() => {
|
|
11085
|
-
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11086
|
-
stepComponentRef.current = newStepDomainComponent;
|
|
11087
|
-
return newStepDomainComponent;
|
|
11088
|
-
});
|
|
11089
|
-
}
|
|
11090
|
-
};
|
|
11091
11099
|
try {
|
|
11092
11100
|
const newStepComponent = mapStepToComponent({
|
|
11093
11101
|
count: stepCount.current,
|
package/build/main.mjs
CHANGED
|
@@ -10968,7 +10968,7 @@ var formatDateOptions = {
|
|
|
10968
10968
|
};
|
|
10969
10969
|
|
|
10970
10970
|
// src/revamp/utils/findComponent.ts
|
|
10971
|
-
var findComponent = (components, id) => {
|
|
10971
|
+
var findComponent = (components, id, logEvent) => {
|
|
10972
10972
|
const flattened = flattenComponents(components);
|
|
10973
10973
|
const matching = flattened.filter((component) => component.uid === id);
|
|
10974
10974
|
if (matching.length === 1) {
|
|
@@ -10977,6 +10977,10 @@ var findComponent = (components, id) => {
|
|
|
10977
10977
|
if (matching.length > 1) {
|
|
10978
10978
|
throw new Error(`Multiple components with the same uid: ${id}`);
|
|
10979
10979
|
}
|
|
10980
|
+
logEvent("error", "Failed to find domain layer component", {
|
|
10981
|
+
componentUid: id,
|
|
10982
|
+
componentsTree: flattened.map((component) => component.uid)
|
|
10983
|
+
});
|
|
10980
10984
|
throw new Error(`Failed to find any components with uid: ${id}`);
|
|
10981
10985
|
};
|
|
10982
10986
|
var flattenComponents = (components) => components.reduce((acc, component) => {
|
|
@@ -11013,6 +11017,21 @@ function useDynamicFlowCore(props) {
|
|
|
11013
11017
|
);
|
|
11014
11018
|
const [stepComponent, setStepComponent] = useState(null);
|
|
11015
11019
|
const stepComponentRef = useRef2(null);
|
|
11020
|
+
const updateComponent = useCallback2(
|
|
11021
|
+
(id, update) => {
|
|
11022
|
+
const currentStepComponent = stepComponentRef.current;
|
|
11023
|
+
if (currentStepComponent) {
|
|
11024
|
+
update(findComponent([currentStepComponent], id, logEvent));
|
|
11025
|
+
setStepComponent(() => {
|
|
11026
|
+
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11027
|
+
stepComponentRef.current = newStepDomainComponent;
|
|
11028
|
+
return newStepDomainComponent;
|
|
11029
|
+
});
|
|
11030
|
+
}
|
|
11031
|
+
},
|
|
11032
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11033
|
+
[]
|
|
11034
|
+
);
|
|
11016
11035
|
const stepCount = useRef2(0);
|
|
11017
11036
|
const stepRef = useRef2(initialStep != null ? initialStep : null);
|
|
11018
11037
|
const etagRef = useRef2(null);
|
|
@@ -11054,17 +11073,6 @@ function useDynamicFlowCore(props) {
|
|
|
11054
11073
|
errors: validationResult.errors
|
|
11055
11074
|
});
|
|
11056
11075
|
}
|
|
11057
|
-
const updateComponent = (id, update) => {
|
|
11058
|
-
const currentStepComponent = stepComponentRef.current;
|
|
11059
|
-
if (currentStepComponent) {
|
|
11060
|
-
update(findComponent([currentStepComponent], id));
|
|
11061
|
-
setStepComponent(() => {
|
|
11062
|
-
const newStepDomainComponent = __spreadValues({}, currentStepComponent);
|
|
11063
|
-
stepComponentRef.current = newStepDomainComponent;
|
|
11064
|
-
return newStepDomainComponent;
|
|
11065
|
-
});
|
|
11066
|
-
}
|
|
11067
|
-
};
|
|
11068
11076
|
try {
|
|
11069
11077
|
const newStepComponent = mapStepToComponent({
|
|
11070
11078
|
count: stepCount.current,
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
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.3",
|
|
86
86
|
"typescript": "5.8.2",
|
|
87
87
|
"webpack": "5.98.0",
|
|
88
|
-
"@wise/dynamic-flow-
|
|
89
|
-
"@wise/dynamic-flow-
|
|
88
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
89
|
+
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@transferwise/components": "^46.92.0",
|