@oatfi/ui 0.7.0 → 0.8.0

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/dist/index.cjs.js CHANGED
@@ -2045,16 +2045,24 @@ const DECLINED = /* @__PURE__ */ new Set([
2045
2045
  "DECLINED",
2046
2046
  "DENIED",
2047
2047
  "ERROR",
2048
+ "MANUAL_REVIEW_DECLINED",
2048
2049
  "N/A",
2049
2050
  "REJECTED"
2050
2051
  ]);
2052
+ function classifyUnderwritingStatus(status) {
2053
+ if (status === "PROCESSING") return "processing";
2054
+ if (status === "APPROVED") return "approved";
2055
+ if (status && DECLINED.has(status)) return "declined";
2056
+ return "review";
2057
+ }
2051
2058
  function UnderwritingStatus({
2052
2059
  status,
2053
2060
  creditLimit,
2054
2061
  children,
2055
2062
  testId
2056
2063
  }) {
2057
- if (status === "PROCESSING") {
2064
+ const outcome = classifyUnderwritingStatus(status);
2065
+ if (outcome === "processing") {
2058
2066
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": testId, children: [
2059
2067
  /* @__PURE__ */ jsxRuntime.jsx(H3, { children: "Your application is being reviewed" }),
2060
2068
  /* @__PURE__ */ jsxRuntime.jsxs(Stack, { width: "100%", alignItems: "center", gap: "16px", children: [
@@ -2063,7 +2071,7 @@ function UnderwritingStatus({
2063
2071
  ] })
2064
2072
  ] });
2065
2073
  }
2066
- if (status === "APPROVED") {
2074
+ if (outcome === "approved") {
2067
2075
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": testId, children: [
2068
2076
  /* @__PURE__ */ jsxRuntime.jsx(H3, { children: "Congrats!" }),
2069
2077
  /* @__PURE__ */ jsxRuntime.jsxs(Body200, { children: [
@@ -2077,7 +2085,7 @@ function UnderwritingStatus({
2077
2085
  children
2078
2086
  ] });
2079
2087
  }
2080
- if (status && DECLINED.has(status)) {
2088
+ if (outcome === "declined") {
2081
2089
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": testId, children: [
2082
2090
  /* @__PURE__ */ jsxRuntime.jsx(H3, { children: "Sorry, we cannot approve your application" }),
2083
2091
  /* @__PURE__ */ jsxRuntime.jsx(Body200, { children: "We are sorry to inform you that we cannot approve your application. Please try again later." })
@@ -2674,6 +2682,7 @@ exports.ThemeProvider = ThemeProvider;
2674
2682
  exports.UnderwritingStatus = UnderwritingStatus;
2675
2683
  exports.UploadZone = UploadZone;
2676
2684
  exports.buildMuiTheme = buildMuiTheme;
2685
+ exports.classifyUnderwritingStatus = classifyUnderwritingStatus;
2677
2686
  exports.defaultTheme = defaultTheme;
2678
2687
  exports.describeComponentEnv = describeComponentEnv;
2679
2688
  exports.describeComponentEnvTitle = describeComponentEnvTitle;