@wise/dynamic-flow-client 2.8.4 → 2.8.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.
package/build/main.js CHANGED
@@ -3520,9 +3520,9 @@ var import_react17 = require("react");
3520
3520
  var import_components11 = require("@transferwise/components");
3521
3521
  var import_react_intl13 = require("react-intl");
3522
3522
 
3523
- // src/legacy/jsonSchemaForm/help/Help.messages.js
3523
+ // src/common/helpMessages/help.messages.ts
3524
3524
  var import_react_intl12 = require("react-intl");
3525
- var Help_messages_default = (0, import_react_intl12.defineMessages)({
3525
+ var help_messages_default = (0, import_react_intl12.defineMessages)({
3526
3526
  helpAria: {
3527
3527
  id: "dynamicFlows.Help.ariaLabel",
3528
3528
  defaultMessage: "Click here for more info.",
@@ -3541,7 +3541,7 @@ var Help = (props) => {
3541
3541
  content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components11.Markdown, { children: props.help.markdown }),
3542
3542
  presentation: "POPOVER",
3543
3543
  size: "sm",
3544
- "aria-label": intl.formatMessage(Help_messages_default.helpAria)
3544
+ "aria-label": intl.formatMessage(help_messages_default.helpAria)
3545
3545
  }
3546
3546
  );
3547
3547
  };
@@ -7304,9 +7304,16 @@ var DynamicFlowComponent = ({
7304
7304
  dispatchEvent("Dynamic Flow - Step Submitted", { actionId: action.id || action.$id });
7305
7305
  try {
7306
7306
  const response = await dfHttpClient({ action, data });
7307
+ if (action.exit && response.ok) {
7308
+ await handleExitResponse(response, action.result);
7309
+ return;
7310
+ }
7307
7311
  await handleResponse(response, "submission");
7308
7312
  } catch (error) {
7309
- completeWithError(error, "Error fetching next step");
7313
+ completeWithError(
7314
+ error,
7315
+ action.exit ? "Error fetching exit result" : "Error fetching next step"
7316
+ );
7310
7317
  }
7311
7318
  };
7312
7319
  const performRefresh = async (url, data, etag2) => {
@@ -7319,15 +7326,6 @@ var DynamicFlowComponent = ({
7319
7326
  completeWithError(error, "Error fetching refresh step");
7320
7327
  }
7321
7328
  };
7322
- const performExitAction = async (action, data) => {
7323
- setLoadingState("submission");
7324
- try {
7325
- const response = await dfHttpClient({ action, data });
7326
- await handleExitResponse(response, action.result);
7327
- } catch (error) {
7328
- completeWithError(error, "Error fetching exit result");
7329
- }
7330
- };
7331
7329
  const handleExitResponse = async (response, actionResult) => {
7332
7330
  const exitResult = await getJsonObjectOrNull(response);
7333
7331
  dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
@@ -7443,7 +7441,6 @@ var DynamicFlowComponent = ({
7443
7441
  dispatchEventAndComplete(action.result);
7444
7442
  return;
7445
7443
  }
7446
- const actionHandler = action.exit ? performExitAction : performAction;
7447
7444
  const { data, method, skipValidation } = action;
7448
7445
  const submissionData = __spreadValues(__spreadValues({}, combineModels2(models)), data);
7449
7446
  if (isSubmissionMethod(method)) {
@@ -7452,10 +7449,10 @@ var DynamicFlowComponent = ({
7452
7449
  setSubmitted(true);
7453
7450
  }
7454
7451
  if (modelIsValid || skipValidation) {
7455
- await actionHandler(action, submissionData);
7452
+ await performAction(action, submissionData);
7456
7453
  }
7457
7454
  } else {
7458
- await actionHandler(action);
7455
+ await performAction(action);
7459
7456
  }
7460
7457
  };
7461
7458
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(