amp-workflow-ui 0.1.20 → 0.1.21

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
@@ -314,6 +314,7 @@ function WorkflowRequestCard({
314
314
  return statusList2 == null ? void 0 : statusList2.filter((item) => item.status !== 3);
315
315
  };
316
316
  const redirectionUrl = buildRedirectionUrl(requestDetails);
317
+ console.log("\u{1F680} ~ WorkflowRequestCard ~ redirectionUrl:", redirectionUrl);
317
318
  const currentStatus = ((_f = (_e = (_d = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _d.find(
318
319
  (lvl) => lvl.id === (requestDetails == null ? void 0 : requestDetails.current_level)
319
320
  )) == null ? void 0 : _e.selected_status) == null ? void 0 : _f.status_id) === 1 ? "approved" : ((_i = (_h = (_g = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _g.find(
@@ -1902,6 +1903,20 @@ function ApprovalWorkflow({
1902
1903
  setIsFilterOpen(false);
1903
1904
  fetchData(selectedOption, 1, tabs[selectedOption].search, filters);
1904
1905
  };
1906
+ const formatDataUrlConfig = (data) => {
1907
+ return data == null ? void 0 : data.reduce((acc, { module_name, ...details }) => {
1908
+ acc[module_name] = details;
1909
+ return acc;
1910
+ }, {});
1911
+ };
1912
+ useEffect(() => {
1913
+ api.get({
1914
+ url: `/workflow/url-config`,
1915
+ serviceURL: "api"
1916
+ }).then((res) => {
1917
+ setUrlConfig(formatDataUrlConfig(res == null ? void 0 : res.data));
1918
+ });
1919
+ }, []);
1905
1920
  const fetchData = useCallback(
1906
1921
  (tab, page, search, filtersOverride) => {
1907
1922
  var _a2, _b2;
@@ -2084,10 +2099,17 @@ function ApprovalWorkflow({
2084
2099
  }, [urlConfig, userInfo]);
2085
2100
  const buildRedirectionUrl = (info) => {
2086
2101
  const { module_name, module_id, reference_id, redirection_link } = info;
2102
+ console.log("\u{1F680} ~ buildRedirectionUrl ~ info:", {
2103
+ module_name,
2104
+ module_id,
2105
+ reference_id,
2106
+ redirection_link,
2107
+ urlConfig
2108
+ });
2087
2109
  if (redirection_link) return redirection_link;
2088
2110
  if (module_name === "route_approval") {
2089
2111
  return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.TRANSPORT_URL}route-listing/view/${reference_id}`;
2090
- } else if (module_name === "update_bus_details_approval") {
2112
+ } else if (module_name === "update_bus_details_approval" || module_name === "create_bus_details_approval") {
2091
2113
  return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.TRANSPORT_URL}bus-listing/view/${reference_id}`;
2092
2114
  } else if (module_name === "kit_handover_approve") {
2093
2115
  return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.FINANCE_URL}fee-collection/?reference_id=${reference_id}&module_name=${module_name}&module_id=${module_id}`;
@@ -2117,6 +2139,7 @@ function ApprovalWorkflow({
2117
2139
  }
2118
2140
  const callAllApi = () => {
2119
2141
  var _a2, _b2, _c2, _d2, _e2, _f2;
2142
+ setExpandedId(null);
2120
2143
  fetchData(
2121
2144
  "Assign To Me",
2122
2145
  1,