@wise/dynamic-flow-client 3.34.2 → 3.34.4

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.mjs CHANGED
@@ -11434,13 +11434,20 @@ function useDynamicFlowCore(props) {
11434
11434
  void onAction(__spreadValues({ method: "GET" }, initialAction));
11435
11435
  }
11436
11436
  if (initialStep && !initialAction) {
11437
- initialiseWithStep(initialStep, null);
11437
+ createStep(initialStep, null);
11438
11438
  trackCoreEvent("Step Shown", { isFirstStep: true });
11439
11439
  }
11440
11440
  }, []);
11441
+ const createStep = useCallback2((newStep, etag) => {
11442
+ initialiseWithStep(newStep, etag, null);
11443
+ }, []);
11444
+ const updateStep = useCallback2((newStep, etag) => {
11445
+ var _a2, _b;
11446
+ initialiseWithStep(newStep, etag, (_b = (_a2 = stepComponentRef.current) == null ? void 0 : _a2.getLocalValue()) != null ? _b : null);
11447
+ }, []);
11441
11448
  const initialiseWithStep = useCallback2(
11442
- (newStep, etag) => {
11443
- var _a2, _b, _c;
11449
+ (newStep, etag, localValue) => {
11450
+ var _a2;
11444
11451
  (_a2 = stepComponentRef.current) == null ? void 0 : _a2.stop();
11445
11452
  stepRef.current = newStep;
11446
11453
  etagRef.current = etag;
@@ -11463,7 +11470,7 @@ function useDynamicFlowCore(props) {
11463
11470
  };
11464
11471
  try {
11465
11472
  const newStepComponent = mapStepToComponent({
11466
- stepLocalValue: (_c = (_b = stepComponentRef.current) == null ? void 0 : _b.getLocalValue()) != null ? _c : null,
11473
+ stepLocalValue: localValue,
11467
11474
  step: newStep,
11468
11475
  displayStepTitle,
11469
11476
  loadingState: "idle",
@@ -11548,7 +11555,7 @@ function useDynamicFlowCore(props) {
11548
11555
  }
11549
11556
  case "replace-step": {
11550
11557
  const isFirstStep = stepRef.current === null;
11551
- initialiseWithStep(command.step, command.etag);
11558
+ createStep(command.step, command.etag);
11552
11559
  trackCoreEvent("Step Shown", { isFirstStep });
11553
11560
  break;
11554
11561
  }
@@ -11556,7 +11563,7 @@ function useDynamicFlowCore(props) {
11556
11563
  const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
11557
11564
  const { errors = { error: genericErrorMessage } } = command.body;
11558
11565
  if (stepRef.current) {
11559
- initialiseWithStep(
11566
+ updateStep(
11560
11567
  __spreadProps(__spreadValues({}, stepRef.current), {
11561
11568
  // the existing step
11562
11569
  errors,
@@ -11604,7 +11611,7 @@ function useDynamicFlowCore(props) {
11604
11611
  case "refresh-step":
11605
11612
  {
11606
11613
  const errors = errorsOverride != null ? errorsOverride : command.step.errors;
11607
- initialiseWithStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
11614
+ updateStep(__spreadProps(__spreadValues({}, command.step), { errors }), command.etag);
11608
11615
  }
11609
11616
  break;
11610
11617
  case "error": {
@@ -11637,7 +11644,7 @@ function useDynamicFlowCore(props) {
11637
11644
  });
11638
11645
  switch (command.type) {
11639
11646
  case "replace-step":
11640
- initialiseWithStep(command.step, command.etag);
11647
+ createStep(command.step, command.etag);
11641
11648
  return true;
11642
11649
  case "action":
11643
11650
  void onAction(command.action);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "3.34.2",
3
+ "version": "3.34.4",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -38,17 +38,17 @@
38
38
  "@babel/preset-typescript": "7.26.0",
39
39
  "@chromatic-com/storybook": "3.2.4",
40
40
  "@formatjs/cli": "^6.5.1",
41
- "@storybook/addon-a11y": "^8.5.1",
42
- "@storybook/addon-actions": "^8.5.1",
43
- "@storybook/addon-essentials": "^8.5.1",
44
- "@storybook/addon-interactions": "^8.5.1",
45
- "@storybook/addon-links": "^8.5.1",
41
+ "@storybook/addon-a11y": "^8.5.4",
42
+ "@storybook/addon-actions": "^8.5.4",
43
+ "@storybook/addon-essentials": "^8.5.4",
44
+ "@storybook/addon-interactions": "^8.5.4",
45
+ "@storybook/addon-links": "^8.5.4",
46
46
  "@storybook/addon-webpack5-compiler-babel": "^3.0.5",
47
- "@storybook/manager-api": "^8.5.1",
48
- "@storybook/react": "^8.5.1",
49
- "@storybook/react-webpack5": "^8.5.1",
50
- "@storybook/test": "^8.5.1",
51
- "@storybook/types": "^8.5.1",
47
+ "@storybook/manager-api": "^8.5.4",
48
+ "@storybook/react": "^8.5.4",
49
+ "@storybook/react-webpack5": "^8.5.4",
50
+ "@storybook/test": "^8.5.4",
51
+ "@storybook/types": "^8.5.4",
52
52
  "@testing-library/dom": "10.4.0",
53
53
  "@testing-library/jest-dom": "6.6.3",
54
54
  "@testing-library/react": "16.2.0",
@@ -65,7 +65,7 @@
65
65
  "@wise/art": "2.19.0",
66
66
  "@wise/components-theming": "^1.6.1",
67
67
  "babel-jest": "29.7.0",
68
- "esbuild": "0.24.2",
68
+ "esbuild": "0.25.0",
69
69
  "jest": "29.7.0",
70
70
  "jest-environment-jsdom": "29.7.0",
71
71
  "jest-fetch-mock": "^3.0.3",
@@ -77,7 +77,7 @@
77
77
  "react": "18.3.1",
78
78
  "react-dom": "18.3.1",
79
79
  "react-intl": "6.8.9",
80
- "storybook": "^8.5.1",
80
+ "storybook": "^8.5.4",
81
81
  "stylelint": "16.14.0",
82
82
  "stylelint-config-standard": "36.0.1",
83
83
  "stylelint-no-unsupported-browser-features": "8.0.2",
@@ -85,8 +85,8 @@
85
85
  "tsx": "4.19.2",
86
86
  "typescript": "5.7.3",
87
87
  "webpack": "5.97.1",
88
- "@wise/dynamic-flow-fixtures": "0.0.1",
89
- "@wise/dynamic-flow-renderers": "0.0.0"
88
+ "@wise/dynamic-flow-renderers": "0.0.0",
89
+ "@wise/dynamic-flow-fixtures": "0.0.1"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@transferwise/components": "^46.31",
@@ -102,7 +102,7 @@
102
102
  "classnames": "2.5.1",
103
103
  "react-webcam": "^7.2.0",
104
104
  "screenfull": "^5.2.0",
105
- "@wise/dynamic-flow-types": "2.32.0"
105
+ "@wise/dynamic-flow-types": "2.32.1"
106
106
  },
107
107
  "scripts": {
108
108
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",