amp-workflow-ui 0.1.8 → 0.1.10

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.js CHANGED
@@ -1135,7 +1135,7 @@ function ApprovalWorkflow({
1135
1135
  selectedWorkflowsList = [],
1136
1136
  userInfo
1137
1137
  }) {
1138
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1138
+ var _a, _b, _c, _d, _e, _f, _g;
1139
1139
  const theme = material.useTheme();
1140
1140
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
1141
1141
  const [selectedApprovalOtions, setSelectedApprovalOtions] = React7.useState(
@@ -1382,43 +1382,39 @@ function ApprovalWorkflow({
1382
1382
  return urlBuilder(module_name, module_id, urlConfig, reference_id);
1383
1383
  }
1384
1384
  const ref = urlConfig == null ? void 0 : urlConfig[module_name];
1385
- if ((ref == null ? void 0 : ref.base_url) && (ref == null ? void 0 : ref.sub_url)) {
1385
+ if ((ref == null ? void 0 : ref.base_variable) && (ref == null ? void 0 : ref.sub_url)) {
1386
+ const BASE_ENV_VARIABLE = ENV_VARIABLES[(ref == null ? void 0 : ref.base_variable.split("_")[3]) + "_" + (ref == null ? void 0 : ref.base_variable.split("_")[4])];
1386
1387
  const qs = new URLSearchParams();
1387
1388
  if (reference_id) qs.set("reference_id", String(reference_id));
1388
1389
  if (module_name) qs.set("module_name", String(module_name));
1389
1390
  if (module_id) qs.set("module_id", String(module_id));
1390
- return `${ref.base_url}${ref.sub_url}?${qs.toString()}`;
1391
+ return `${BASE_ENV_VARIABLE}${ref.sub_url}?${qs.toString()}`;
1391
1392
  }
1392
1393
  return "#";
1393
1394
  };
1394
1395
  const StatusObj = {
1395
1396
  approved: {
1396
1397
  title: "Approved",
1397
- color: theme.palette.success.light,
1398
- labelColor: theme.palette.success.main
1398
+ color: "#e6f7e9",
1399
+ labelColor: "#389e49"
1399
1400
  },
1400
1401
  rejected: {
1401
1402
  title: "Rejected",
1402
- color: ((_a = theme.palette.customColors) == null ? void 0 : _a.chipWarningContainer) || theme.palette.error.light,
1403
- labelColor: theme.palette.error.main
1403
+ color: "#fff1f0",
1404
+ labelColor: "#f5222d"
1404
1405
  },
1405
1406
  onhold: {
1406
1407
  title: "On Hold",
1407
- color: ((_c = (_b = theme.palette) == null ? void 0 : _b.customColors) == null ? void 0 : _c.chipPendingContainer) || theme.palette.warning.light,
1408
- labelColor: ((_e = (_d = theme.palette) == null ? void 0 : _d.customColors) == null ? void 0 : _e.chipPendingText) || theme.palette.warning.dark
1408
+ color: "#fff7e6",
1409
+ labelColor: "#faad14"
1409
1410
  },
1410
1411
  sendback: {
1411
1412
  title: "Send Back",
1412
- color: ((_g = (_f = theme.palette) == null ? void 0 : _f.customColors) == null ? void 0 : _g.approvalPrimaryChipBG) || theme.palette.info.light,
1413
- labelColor: ((_i = (_h = theme.palette) == null ? void 0 : _h.customColors) == null ? void 0 : _i.approvalPrimaryChipText) || theme.palette.info.dark
1414
- },
1415
- pending: {
1416
- color: ((_j = theme.palette.customColors) == null ? void 0 : _j.approvalPrimaryChipBG) || theme.palette.grey[300],
1417
- labelColor: ((_l = (_k = theme.palette) == null ? void 0 : _k.customColors) == null ? void 0 : _l.approvalPrimaryChipText) || theme.palette.text.primary
1418
- }
1419
- };
1413
+ color: "#e6f7ff",
1414
+ labelColor: "#1890ff"
1415
+ }};
1420
1416
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
1421
- console.log("TEST LIB");
1417
+ console.info("LIBRARY RUNNING...");
1422
1418
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1423
1419
  /* @__PURE__ */ jsxRuntime.jsx(
1424
1420
  system.Box,
@@ -1489,7 +1485,7 @@ function ApprovalWorkflow({
1489
1485
  pb: 3
1490
1486
  },
1491
1487
  children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
1492
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1488
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
1493
1489
  const currentLevel = info == null ? void 0 : info.levels.find(
1494
1490
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1495
1491
  );
@@ -1598,7 +1594,7 @@ function ApprovalWorkflow({
1598
1594
  mt: 0.8,
1599
1595
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1600
1596
  },
1601
- children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1597
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1602
1598
  }
1603
1599
  )
1604
1600
  ] }),
@@ -1627,9 +1623,9 @@ function ApprovalWorkflow({
1627
1623
  },
1628
1624
  children: [
1629
1625
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1630
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j2 = (_i2 = info == null ? void 0 : info.levels) == null ? void 0 : _i2.findIndex(
1626
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1631
1627
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1632
- )) != null ? _j2 : -1) + 1 || "") })
1628
+ )) != null ? _j : -1) + 1 || "") })
1633
1629
  ]
1634
1630
  }
1635
1631
  ),
@@ -1645,14 +1641,14 @@ function ApprovalWorkflow({
1645
1641
  gap: 1.5
1646
1642
  },
1647
1643
  children: [
1648
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1644
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1649
1645
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1650
- )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1646
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1651
1647
  (lvl) => {
1652
1648
  var _a3;
1653
1649
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1654
1650
  }
1655
- )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1651
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1656
1652
  Statusselector_default,
1657
1653
  {
1658
1654
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1781,7 +1777,7 @@ function ApprovalWorkflow({
1781
1777
  pb: 3
1782
1778
  },
1783
1779
  children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1784
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1780
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
1785
1781
  const currentLevel = info == null ? void 0 : info.levels.find(
1786
1782
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1787
1783
  );
@@ -1897,7 +1893,7 @@ function ApprovalWorkflow({
1897
1893
  mt: 0.8,
1898
1894
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1899
1895
  },
1900
- children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1896
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1901
1897
  }
1902
1898
  )
1903
1899
  ] }),
@@ -1926,9 +1922,9 @@ function ApprovalWorkflow({
1926
1922
  },
1927
1923
  children: [
1928
1924
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1929
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j2 = (_i2 = info == null ? void 0 : info.levels) == null ? void 0 : _i2.findIndex(
1925
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1930
1926
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1931
- )) != null ? _j2 : -1) + 1 || "") })
1927
+ )) != null ? _j : -1) + 1 || "") })
1932
1928
  ]
1933
1929
  }
1934
1930
  ),
@@ -1944,14 +1940,14 @@ function ApprovalWorkflow({
1944
1940
  gap: 1.5
1945
1941
  },
1946
1942
  children: [
1947
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1943
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1948
1944
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1949
- )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1945
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1950
1946
  (lvl) => {
1951
1947
  var _a3;
1952
1948
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1953
1949
  }
1954
- )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1950
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1955
1951
  Statusselector_default,
1956
1952
  {
1957
1953
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -2080,7 +2076,7 @@ function ApprovalWorkflow({
2080
2076
  pb: 3
2081
2077
  },
2082
2078
  children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
2083
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
2079
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
2084
2080
  const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
2085
2081
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
2086
2082
  );
@@ -2171,9 +2167,9 @@ function ApprovalWorkflow({
2171
2167
  noWrap: true,
2172
2168
  sx: {
2173
2169
  mt: 0.8,
2174
- color: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? "primary.dark" : "text.disabled"
2170
+ color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
2175
2171
  },
2176
- children: ((_i2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2172
+ children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2177
2173
  }
2178
2174
  )
2179
2175
  ] }),
@@ -2202,9 +2198,9 @@ function ApprovalWorkflow({
2202
2198
  },
2203
2199
  children: [
2204
2200
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
2205
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k2 = (_j2 = info == null ? void 0 : info.levels) == null ? void 0 : _j2.findIndex(
2201
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.findIndex(
2206
2202
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2207
- )) != null ? _k2 : -1) + 1 || "") })
2203
+ )) != null ? _k : -1) + 1 || "") })
2208
2204
  ]
2209
2205
  }
2210
2206
  ),
@@ -2354,8 +2350,8 @@ function ApprovalWorkflow({
2354
2350
  openModal: !!approveTarget,
2355
2351
  closeModal: () => setApproveTarget(null),
2356
2352
  header: "Approve",
2357
- workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2358
- statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
2353
+ workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
2354
+ statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
2359
2355
  }
2360
2356
  ),
2361
2357
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2364,9 +2360,9 @@ function ApprovalWorkflow({
2364
2360
  openModal: !!rejectTarget,
2365
2361
  closeModal: () => setRejectTarget(null),
2366
2362
  header: "Reject",
2367
- workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2368
- statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2369
- rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
2363
+ workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
2364
+ statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
2365
+ rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
2370
2366
  }
2371
2367
  ),
2372
2368
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2375,8 +2371,8 @@ function ApprovalWorkflow({
2375
2371
  openModal: !!onHoldTarget,
2376
2372
  closeModal: () => setOnHoldTarget(null),
2377
2373
  header: "On Hold",
2378
- workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2379
- statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
2374
+ workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
2375
+ statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
2380
2376
  }
2381
2377
  )
2382
2378
  ] });