@wise/dynamic-flow-client 4.12.0-experimental-5de9758 → 4.12.0-experimental-d108035

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 CHANGED
@@ -2504,9 +2504,9 @@ var mapAdditionalInfo = (info, onBehavior) => {
2504
2504
  return {
2505
2505
  text: info.text,
2506
2506
  accessibilityDescription: info.accessibilityDescription,
2507
- onClick: behavior.type !== "none" ? () => {
2507
+ onClick: () => {
2508
2508
  void onBehavior(behavior);
2509
- } : void 0
2509
+ }
2510
2510
  };
2511
2511
  }
2512
2512
  return void 0;
@@ -2555,7 +2555,11 @@ var createStatusListComponent = (statusListProps) => __spreadValues({
2555
2555
 
2556
2556
  // src/revamp/domain/mappers/layout/deprecatedListLayoutToComponent.ts
2557
2557
  var isDeprecatedListLayout = (layout) => {
2558
- return layout.items.some((item) => item.status);
2558
+ const usesCallToAction = layout.callToAction != null;
2559
+ const usesNewProperties = layout.items.some(
2560
+ (item) => item.additionalInfo != null || item.inlineAlert != null || item.supportingValues != null || item.subtitle != null || item.value != null || item.subvalue != null
2561
+ );
2562
+ return !usesCallToAction && !usesNewProperties;
2559
2563
  };
2560
2564
  var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", title }) => createStatusListComponent({
2561
2565
  uid,
@@ -6800,6 +6804,7 @@ function useDynamicFlowCore(props) {
6800
6804
  const onBehavior = (0, import_react3.useCallback)(async (behavior) => {
6801
6805
  switch (behavior.type) {
6802
6806
  case "action": {
6807
+ rootComponentRef.current.setLoadingState("submitting");
6803
6808
  rootComponentRef.current.dismissAllModals();
6804
6809
  try {
6805
6810
  const { action } = behavior;
@@ -6808,8 +6813,11 @@ function useDynamicFlowCore(props) {
6808
6813
  const canSubmit = skipValidation || rootComponentRef.current.validate();
6809
6814
  if (canSubmit) {
6810
6815
  void onAction(action, model);
6816
+ } else {
6817
+ rootComponentRef.current.setLoadingState("idle");
6811
6818
  }
6812
6819
  } catch (e) {
6820
+ rootComponentRef.current.setLoadingState("idle");
6813
6821
  }
6814
6822
  break;
6815
6823
  }
@@ -6869,6 +6877,7 @@ function useDynamicFlowCore(props) {
6869
6877
  });
6870
6878
  switch (command.type) {
6871
6879
  case "complete": {
6880
+ rootComponentRef.current.setLoadingState("idle");
6872
6881
  onCompletion(command.result);
6873
6882
  rootComponentRef.current.stop();
6874
6883
  trackCoreEvent("Succeeded");
@@ -6881,6 +6890,7 @@ function useDynamicFlowCore(props) {
6881
6890
  break;
6882
6891
  }
6883
6892
  case "error": {
6893
+ rootComponentRef.current.setLoadingState("idle");
6884
6894
  const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
6885
6895
  const errors = (_b = (_a2 = command.body) == null ? void 0 : _a2.errors) != null ? _b : { error: genericErrorMessage };
6886
6896
  if (stepRef.current) {
package/build/main.mjs CHANGED
@@ -2461,9 +2461,9 @@ var mapAdditionalInfo = (info, onBehavior) => {
2461
2461
  return {
2462
2462
  text: info.text,
2463
2463
  accessibilityDescription: info.accessibilityDescription,
2464
- onClick: behavior.type !== "none" ? () => {
2464
+ onClick: () => {
2465
2465
  void onBehavior(behavior);
2466
- } : void 0
2466
+ }
2467
2467
  };
2468
2468
  }
2469
2469
  return void 0;
@@ -2512,7 +2512,11 @@ var createStatusListComponent = (statusListProps) => __spreadValues({
2512
2512
 
2513
2513
  // src/revamp/domain/mappers/layout/deprecatedListLayoutToComponent.ts
2514
2514
  var isDeprecatedListLayout = (layout) => {
2515
- return layout.items.some((item) => item.status);
2515
+ const usesCallToAction = layout.callToAction != null;
2516
+ const usesNewProperties = layout.items.some(
2517
+ (item) => item.additionalInfo != null || item.inlineAlert != null || item.supportingValues != null || item.subtitle != null || item.value != null || item.subvalue != null
2518
+ );
2519
+ return !usesCallToAction && !usesNewProperties;
2516
2520
  };
2517
2521
  var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", title }) => createStatusListComponent({
2518
2522
  uid,
@@ -6757,6 +6761,7 @@ function useDynamicFlowCore(props) {
6757
6761
  const onBehavior = useCallback2(async (behavior) => {
6758
6762
  switch (behavior.type) {
6759
6763
  case "action": {
6764
+ rootComponentRef.current.setLoadingState("submitting");
6760
6765
  rootComponentRef.current.dismissAllModals();
6761
6766
  try {
6762
6767
  const { action } = behavior;
@@ -6765,8 +6770,11 @@ function useDynamicFlowCore(props) {
6765
6770
  const canSubmit = skipValidation || rootComponentRef.current.validate();
6766
6771
  if (canSubmit) {
6767
6772
  void onAction(action, model);
6773
+ } else {
6774
+ rootComponentRef.current.setLoadingState("idle");
6768
6775
  }
6769
6776
  } catch (e) {
6777
+ rootComponentRef.current.setLoadingState("idle");
6770
6778
  }
6771
6779
  break;
6772
6780
  }
@@ -6826,6 +6834,7 @@ function useDynamicFlowCore(props) {
6826
6834
  });
6827
6835
  switch (command.type) {
6828
6836
  case "complete": {
6837
+ rootComponentRef.current.setLoadingState("idle");
6829
6838
  onCompletion(command.result);
6830
6839
  rootComponentRef.current.stop();
6831
6840
  trackCoreEvent("Succeeded");
@@ -6838,6 +6847,7 @@ function useDynamicFlowCore(props) {
6838
6847
  break;
6839
6848
  }
6840
6849
  case "error": {
6850
+ rootComponentRef.current.setLoadingState("idle");
6841
6851
  const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
6842
6852
  const errors = (_b = (_a2 = command.body) == null ? void 0 : _a2.errors) != null ? _b : { error: genericErrorMessage };
6843
6853
  if (stepRef.current) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.12.0-experimental-5de9758",
3
+ "version": "4.12.0-experimental-d108035",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -46,7 +46,7 @@
46
46
  "@testing-library/jest-dom": "6.6.4",
47
47
  "@testing-library/react": "16.3.0",
48
48
  "@testing-library/user-event": "14.6.1",
49
- "@transferwise/components": "0.0.0-experimental-4ee52fa",
49
+ "@transferwise/components": "46.101.0",
50
50
  "@transferwise/formatting": "^2.13.4",
51
51
  "@transferwise/icons": "3.22.3",
52
52
  "@transferwise/neptune-css": "14.24.5",
@@ -95,7 +95,7 @@
95
95
  "classnames": "2.5.1",
96
96
  "react-webcam": "^7.2.0",
97
97
  "screenfull": "^5.2.0",
98
- "@wise/dynamic-flow-types": "3.10.0-experimental-5de9758"
98
+ "@wise/dynamic-flow-types": "3.10.0-experimental-d108035"
99
99
  },
100
100
  "scripts": {
101
101
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",