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.mjs CHANGED
@@ -1122,7 +1122,7 @@ function ApprovalWorkflow({
1122
1122
  selectedWorkflowsList = [],
1123
1123
  userInfo
1124
1124
  }) {
1125
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1125
+ var _a, _b, _c, _d, _e, _f, _g;
1126
1126
  const theme = useTheme$1();
1127
1127
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
1128
1128
  const [selectedApprovalOtions, setSelectedApprovalOtions] = useState(
@@ -1369,43 +1369,39 @@ function ApprovalWorkflow({
1369
1369
  return urlBuilder(module_name, module_id, urlConfig, reference_id);
1370
1370
  }
1371
1371
  const ref = urlConfig == null ? void 0 : urlConfig[module_name];
1372
- if ((ref == null ? void 0 : ref.base_url) && (ref == null ? void 0 : ref.sub_url)) {
1372
+ if ((ref == null ? void 0 : ref.base_variable) && (ref == null ? void 0 : ref.sub_url)) {
1373
+ const BASE_ENV_VARIABLE = ENV_VARIABLES[(ref == null ? void 0 : ref.base_variable.split("_")[3]) + "_" + (ref == null ? void 0 : ref.base_variable.split("_")[4])];
1373
1374
  const qs = new URLSearchParams();
1374
1375
  if (reference_id) qs.set("reference_id", String(reference_id));
1375
1376
  if (module_name) qs.set("module_name", String(module_name));
1376
1377
  if (module_id) qs.set("module_id", String(module_id));
1377
- return `${ref.base_url}${ref.sub_url}?${qs.toString()}`;
1378
+ return `${BASE_ENV_VARIABLE}${ref.sub_url}?${qs.toString()}`;
1378
1379
  }
1379
1380
  return "#";
1380
1381
  };
1381
1382
  const StatusObj = {
1382
1383
  approved: {
1383
1384
  title: "Approved",
1384
- color: theme.palette.success.light,
1385
- labelColor: theme.palette.success.main
1385
+ color: "#e6f7e9",
1386
+ labelColor: "#389e49"
1386
1387
  },
1387
1388
  rejected: {
1388
1389
  title: "Rejected",
1389
- color: ((_a = theme.palette.customColors) == null ? void 0 : _a.chipWarningContainer) || theme.palette.error.light,
1390
- labelColor: theme.palette.error.main
1390
+ color: "#fff1f0",
1391
+ labelColor: "#f5222d"
1391
1392
  },
1392
1393
  onhold: {
1393
1394
  title: "On Hold",
1394
- color: ((_c = (_b = theme.palette) == null ? void 0 : _b.customColors) == null ? void 0 : _c.chipPendingContainer) || theme.palette.warning.light,
1395
- labelColor: ((_e = (_d = theme.palette) == null ? void 0 : _d.customColors) == null ? void 0 : _e.chipPendingText) || theme.palette.warning.dark
1395
+ color: "#fff7e6",
1396
+ labelColor: "#faad14"
1396
1397
  },
1397
1398
  sendback: {
1398
1399
  title: "Send Back",
1399
- color: ((_g = (_f = theme.palette) == null ? void 0 : _f.customColors) == null ? void 0 : _g.approvalPrimaryChipBG) || theme.palette.info.light,
1400
- labelColor: ((_i = (_h = theme.palette) == null ? void 0 : _h.customColors) == null ? void 0 : _i.approvalPrimaryChipText) || theme.palette.info.dark
1401
- },
1402
- pending: {
1403
- color: ((_j = theme.palette.customColors) == null ? void 0 : _j.approvalPrimaryChipBG) || theme.palette.grey[300],
1404
- labelColor: ((_l = (_k = theme.palette) == null ? void 0 : _k.customColors) == null ? void 0 : _l.approvalPrimaryChipText) || theme.palette.text.primary
1405
- }
1406
- };
1400
+ color: "#e6f7ff",
1401
+ labelColor: "#1890ff"
1402
+ }};
1407
1403
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
1408
- console.log("TEST LIB");
1404
+ console.info("LIBRARY RUNNING...");
1409
1405
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1410
1406
  /* @__PURE__ */ jsx(
1411
1407
  Box,
@@ -1476,7 +1472,7 @@ function ApprovalWorkflow({
1476
1472
  pb: 3
1477
1473
  },
1478
1474
  children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
1479
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1475
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
1480
1476
  const currentLevel = info == null ? void 0 : info.levels.find(
1481
1477
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1482
1478
  );
@@ -1585,7 +1581,7 @@ function ApprovalWorkflow({
1585
1581
  mt: 0.8,
1586
1582
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1587
1583
  },
1588
- children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1584
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1589
1585
  }
1590
1586
  )
1591
1587
  ] }),
@@ -1614,9 +1610,9 @@ function ApprovalWorkflow({
1614
1610
  },
1615
1611
  children: [
1616
1612
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1617
- /* @__PURE__ */ jsx(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(
1613
+ /* @__PURE__ */ jsx(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(
1618
1614
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1619
- )) != null ? _j2 : -1) + 1 || "") })
1615
+ )) != null ? _j : -1) + 1 || "") })
1620
1616
  ]
1621
1617
  }
1622
1618
  ),
@@ -1632,14 +1628,14 @@ function ApprovalWorkflow({
1632
1628
  gap: 1.5
1633
1629
  },
1634
1630
  children: [
1635
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1631
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1636
1632
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1637
- )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1633
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1638
1634
  (lvl) => {
1639
1635
  var _a3;
1640
1636
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1641
1637
  }
1642
- )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsx(
1638
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1643
1639
  Statusselector_default,
1644
1640
  {
1645
1641
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1768,7 +1764,7 @@ function ApprovalWorkflow({
1768
1764
  pb: 3
1769
1765
  },
1770
1766
  children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1771
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1767
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
1772
1768
  const currentLevel = info == null ? void 0 : info.levels.find(
1773
1769
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1774
1770
  );
@@ -1884,7 +1880,7 @@ function ApprovalWorkflow({
1884
1880
  mt: 0.8,
1885
1881
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1886
1882
  },
1887
- children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1883
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1888
1884
  }
1889
1885
  )
1890
1886
  ] }),
@@ -1913,9 +1909,9 @@ function ApprovalWorkflow({
1913
1909
  },
1914
1910
  children: [
1915
1911
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1916
- /* @__PURE__ */ jsx(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(
1912
+ /* @__PURE__ */ jsx(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(
1917
1913
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1918
- )) != null ? _j2 : -1) + 1 || "") })
1914
+ )) != null ? _j : -1) + 1 || "") })
1919
1915
  ]
1920
1916
  }
1921
1917
  ),
@@ -1931,14 +1927,14 @@ function ApprovalWorkflow({
1931
1927
  gap: 1.5
1932
1928
  },
1933
1929
  children: [
1934
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1930
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1935
1931
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1936
- )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1932
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1937
1933
  (lvl) => {
1938
1934
  var _a3;
1939
1935
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1940
1936
  }
1941
- )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsx(
1937
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1942
1938
  Statusselector_default,
1943
1939
  {
1944
1940
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -2067,7 +2063,7 @@ function ApprovalWorkflow({
2067
2063
  pb: 3
2068
2064
  },
2069
2065
  children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
2070
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
2066
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
2071
2067
  const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
2072
2068
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
2073
2069
  );
@@ -2158,9 +2154,9 @@ function ApprovalWorkflow({
2158
2154
  noWrap: true,
2159
2155
  sx: {
2160
2156
  mt: 0.8,
2161
- color: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? "primary.dark" : "text.disabled"
2157
+ color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
2162
2158
  },
2163
- children: ((_i2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2159
+ children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2164
2160
  }
2165
2161
  )
2166
2162
  ] }),
@@ -2189,9 +2185,9 @@ function ApprovalWorkflow({
2189
2185
  },
2190
2186
  children: [
2191
2187
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
2192
- /* @__PURE__ */ jsx(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(
2188
+ /* @__PURE__ */ jsx(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(
2193
2189
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2194
- )) != null ? _k2 : -1) + 1 || "") })
2190
+ )) != null ? _k : -1) + 1 || "") })
2195
2191
  ]
2196
2192
  }
2197
2193
  ),
@@ -2341,8 +2337,8 @@ function ApprovalWorkflow({
2341
2337
  openModal: !!approveTarget,
2342
2338
  closeModal: () => setApproveTarget(null),
2343
2339
  header: "Approve",
2344
- workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2345
- statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
2340
+ workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
2341
+ statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
2346
2342
  }
2347
2343
  ),
2348
2344
  /* @__PURE__ */ jsx(
@@ -2351,9 +2347,9 @@ function ApprovalWorkflow({
2351
2347
  openModal: !!rejectTarget,
2352
2348
  closeModal: () => setRejectTarget(null),
2353
2349
  header: "Reject",
2354
- workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2355
- statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2356
- rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
2350
+ workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
2351
+ statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
2352
+ rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
2357
2353
  }
2358
2354
  ),
2359
2355
  /* @__PURE__ */ jsx(
@@ -2362,8 +2358,8 @@ function ApprovalWorkflow({
2362
2358
  openModal: !!onHoldTarget,
2363
2359
  closeModal: () => setOnHoldTarget(null),
2364
2360
  header: "On Hold",
2365
- workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2366
- statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
2361
+ workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
2362
+ statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
2367
2363
  }
2368
2364
  )
2369
2365
  ] });