datastake-daf 0.6.816 → 0.6.818

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.
Files changed (37) hide show
  1. package/dist/components/index.js +1236 -1281
  2. package/dist/pages/index.js +1326 -426
  3. package/dist/services/index.js +202 -0
  4. package/dist/utils/index.js +28 -0
  5. package/package.json +1 -1
  6. package/public/Vegetation/damage-from-insects-default.svg +1 -0
  7. package/public/Vegetation/dry-or-dead-default.svg +1 -0
  8. package/public/Vegetation/healthy-default.svg +1 -0
  9. package/public/Vegetation/yellowing.svg +1 -0
  10. package/src/@daf/core/components/Charts/RadarChart/index.jsx +51 -9
  11. package/src/@daf/core/components/Charts/style.js +0 -1
  12. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +123 -104
  13. package/src/@daf/core/components/Table/index.jsx +11 -6
  14. package/src/@daf/pages/Events/Activities/columns.js +15 -11
  15. package/src/@daf/pages/Events/Incidents/columns.js +15 -11
  16. package/src/@daf/pages/Events/Testimonials/columns.js +173 -0
  17. package/src/@daf/pages/Events/Testimonials/config.js +175 -0
  18. package/src/@daf/pages/Events/columns.js +7 -3
  19. package/src/@daf/pages/Locations/ConflictAreas/columns.js +140 -0
  20. package/src/@daf/pages/Locations/ConflictAreas/config.js +41 -0
  21. package/src/@daf/pages/Locations/MineSite/columns.js +21 -12
  22. package/src/@daf/pages/Locations/MineSite/config.js +2 -1
  23. package/src/@daf/pages/Locations/columns.js +7 -3
  24. package/src/@daf/pages/Stakeholders/ArmedGroups/columns.js +110 -0
  25. package/src/@daf/pages/Stakeholders/ArmedGroups/config.js +41 -0
  26. package/src/@daf/pages/Stakeholders/Operators/columns.js +30 -14
  27. package/src/@daf/pages/Stakeholders/Workers/columns.js +23 -13
  28. package/src/@daf/pages/Stakeholders/columns.js +8 -4
  29. package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/index.jsx +4 -2
  30. package/src/@daf/pages/TablePage/config.js +1 -1
  31. package/src/@daf/pages/TablePage/helper.js +45 -0
  32. package/src/@daf/services/EventsService.js +115 -0
  33. package/src/@daf/services/LinkedSubjects.js +1 -0
  34. package/src/@daf/services/WorkersService.js +80 -0
  35. package/src/helpers/errorHandling.js +142 -74
  36. package/src/services.js +3 -1
  37. package/src/utils.js +1 -1
@@ -1458,6 +1458,11 @@ class LinkedSubjectsService extends BaseService {
1458
1458
  getForm({
1459
1459
  namespace
1460
1460
  }, language = "en", scope) {
1461
+ console.log({
1462
+ namespace,
1463
+ language,
1464
+ scope
1465
+ });
1461
1466
  return this.apiGet({
1462
1467
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
1463
1468
  isApp: true,
@@ -1727,6 +1732,201 @@ class PartnerService extends BaseService {
1727
1732
  }
1728
1733
  var PartnerService$1 = createLazyService(PartnerService);
1729
1734
 
1735
+ class EventsService extends BaseService {
1736
+ getForm({
1737
+ scope
1738
+ }, language = "en") {
1739
+ return this.apiGet({
1740
+ isApp: true,
1741
+ url: `/forms/event`,
1742
+ params: {
1743
+ scope,
1744
+ language
1745
+ }
1746
+ });
1747
+ }
1748
+ getWithModule({
1749
+ query,
1750
+ signal,
1751
+ module
1752
+ }) {
1753
+ return this.apiGet({
1754
+ isApp: true,
1755
+ url: `/${module}/event`,
1756
+ params: query,
1757
+ signal
1758
+ });
1759
+ }
1760
+ getOne({
1761
+ id,
1762
+ module,
1763
+ signal
1764
+ }) {
1765
+ return this.apiGet({
1766
+ url: `/${module}/event/${id}`,
1767
+ isApp: true,
1768
+ signal
1769
+ });
1770
+ }
1771
+ get(query, signal) {
1772
+ return this.apiGet({
1773
+ isApp: true,
1774
+ url: "/event",
1775
+ params: query,
1776
+ signal
1777
+ });
1778
+ }
1779
+ getData(id, sourceId, source, version) {
1780
+ return this.apiGet({
1781
+ isApp: true,
1782
+ url: `/event/${id}`,
1783
+ params: {
1784
+ authorId: sourceId,
1785
+ source,
1786
+ version
1787
+ }
1788
+ });
1789
+ }
1790
+ getLinking(query) {
1791
+ return this.apiGet({
1792
+ isApp: true,
1793
+ url: "/event/linking",
1794
+ params: query
1795
+ });
1796
+ }
1797
+ submit(payload) {
1798
+ if (payload.id) {
1799
+ return this.apiPut({
1800
+ isApp: true,
1801
+ url: `/event/${payload.id}`,
1802
+ data: filterCreateData(payload)
1803
+ });
1804
+ }
1805
+ if (payload?.form) {
1806
+ delete payload.form;
1807
+ return this.apiPut({
1808
+ isApp: true,
1809
+ url: "/event",
1810
+ data: filterCreateData(payload)
1811
+ });
1812
+ }
1813
+ return this.apiPost({
1814
+ isApp: true,
1815
+ url: "/event",
1816
+ data: filterCreateData(payload)
1817
+ });
1818
+ }
1819
+ submitStep(data, id) {
1820
+ return this.apiPut({
1821
+ isApp: true,
1822
+ url: `/event/submit/${id}`,
1823
+ data: filterCreateData(data)
1824
+ });
1825
+ }
1826
+ remove(id, data) {
1827
+ return this.apiDelete({
1828
+ isApp: true,
1829
+ url: `/event/${id}/remove`,
1830
+ data: data
1831
+ });
1832
+ }
1833
+ submitForm(id) {
1834
+ const app = window.globalServicesConfig.application;
1835
+ return this.apiPost({
1836
+ isApp: true,
1837
+ url: `/${app}/versioning/submit/Event/${id}`
1838
+ });
1839
+ }
1840
+ getOptions() {
1841
+ return this.apiGet({
1842
+ isApp: true,
1843
+ url: `/forms/options`,
1844
+ params: {
1845
+ id: "categoryOptions,eventsType,testimonialsType,eventCategory,countries,eventCategoryOptions"
1846
+ }
1847
+ });
1848
+ }
1849
+ }
1850
+ var EventsService$1 = createLazyService(EventsService);
1851
+
1852
+ class WorkersService extends BaseService {
1853
+ get(params) {
1854
+ return this.apiGet({
1855
+ isApp: true,
1856
+ url: "/stakeholder",
1857
+ params
1858
+ });
1859
+ }
1860
+ getForm(scope = "modalNashirikiWorker", language = "en") {
1861
+ return this.apiGet({
1862
+ isApp: true,
1863
+ url: `/forms/stakeholder`,
1864
+ params: {
1865
+ scope,
1866
+ language
1867
+ }
1868
+ });
1869
+ }
1870
+ getData(id, sourceId, version, source) {
1871
+ return this.apiGet({
1872
+ isApp: true,
1873
+ url: `/stakeholder/${id}`,
1874
+ params: {
1875
+ authorId: sourceId,
1876
+ version,
1877
+ source
1878
+ }
1879
+ });
1880
+ }
1881
+ submit(payload) {
1882
+ if (payload.id) {
1883
+ // const { id, ...data } = payload;
1884
+ return this.apiPut({
1885
+ isApp: true,
1886
+ url: `/stakeholder/${payload.id}`,
1887
+ data: filterCreateData(payload)
1888
+ });
1889
+ }
1890
+ if (payload?.form) {
1891
+ delete payload.form;
1892
+ return this.apiPost({
1893
+ isApp: true,
1894
+ url: "/stakeholder",
1895
+ data: filterCreateData(payload)
1896
+ });
1897
+ }
1898
+ return this.apiPost({
1899
+ isApp: true,
1900
+ url: "/stakeholder",
1901
+ data: filterCreateData(payload)
1902
+ });
1903
+ }
1904
+ submitStep(data, id) {
1905
+ return this.apiPut({
1906
+ isApp: true,
1907
+ url: `/stakeholder/submit/${id}`,
1908
+ data: filterCreateData(data)
1909
+ });
1910
+ }
1911
+ remove(id, data) {
1912
+ return this.apiDelete({
1913
+ isApp: true,
1914
+ url: `/stakeholder/${id}/remove`,
1915
+ data: data
1916
+ });
1917
+ }
1918
+ getOptions() {
1919
+ return this.apiGet({
1920
+ isApp: true,
1921
+ url: `/forms/options`,
1922
+ params: {
1923
+ id: "activityAtSiteOptions,category,countries,optionPositionSupplyChain,subCategory"
1924
+ }
1925
+ });
1926
+ }
1927
+ }
1928
+ var WorkersService$1 = createLazyService(WorkersService);
1929
+
1730
1930
  exports.AdminService = AdminService$1;
1731
1931
  exports.AuthenticationService = AuthenticationService$1;
1732
1932
  exports.BaseHTTPService = BaseHTTPService;
@@ -1736,6 +1936,7 @@ exports.DashboardService = DashboardService$1;
1736
1936
  exports.DataStoreService = DataStoreService$1;
1737
1937
  exports.ErrorHandler = ErrorHandler;
1738
1938
  exports.ErrorService = ErrorService;
1939
+ exports.EventsService = EventsService$1;
1739
1940
  exports.LinkedSubjectsService = LinkedSubjects;
1740
1941
  exports.NotificationService = NotificationService$1;
1741
1942
  exports.OperatorService = OperatorService$1;
@@ -1743,6 +1944,7 @@ exports.PartnerService = PartnerService$1;
1743
1944
  exports.QueryService = QueryService$1;
1744
1945
  exports.SourceService = SourceService$1;
1745
1946
  exports.UserService = UserService$1;
1947
+ exports.WorkersService = WorkersService$1;
1746
1948
  exports.configureServices = configureServices;
1747
1949
  exports.createLazyService = createLazyService;
1748
1950
  exports.getServicesConfig = getServicesConfig;
@@ -14105,6 +14105,32 @@ const buildQueryString = params => {
14105
14105
  return query ? `?${query}` : '';
14106
14106
  };
14107
14107
 
14108
+ /**
14109
+ * Check if a successful response contains embedded error data
14110
+ */
14111
+ const isErrorResponse = data => {
14112
+ if (!data) return false;
14113
+ return (
14114
+ // Check for Exception names
14115
+ data.name && data.name.includes('Exception') ||
14116
+ // Check for nested response with error status
14117
+ data.response?.statusCode && data.response.statusCode >= 400 ||
14118
+ // Check for top-level error status
14119
+ data.statusCode && data.statusCode >= 400 ||
14120
+ // Check for explicit error flag
14121
+ data.error === true ||
14122
+ // Check for nested error property
14123
+ data.response?.error && data.response.error !== null
14124
+ );
14125
+ };
14126
+
14127
+ /**
14128
+ * Extract error message from various error response formats
14129
+ */
14130
+ const getErrorMessage = data => {
14131
+ return data?.message || data?.response?.message || data?.response?.error || 'An error occurred';
14132
+ };
14133
+
14108
14134
  /**
14109
14135
  * Generic error handler factory for axios requests
14110
14136
  * Highly configurable to adapt to different project needs
@@ -15091,6 +15117,7 @@ exports.formatToKebabCase = formatToKebabCase$1;
15091
15117
  exports.getAdminLevelName = getAdminLevelName;
15092
15118
  exports.getDefaultActiveFilters = getDefaultActiveFilters;
15093
15119
  exports.getDivergenceOrEqual = getDivergenceOrEqual;
15120
+ exports.getErrorMessage = getErrorMessage;
15094
15121
  exports.getImageUploadViewValue = getImageUploadViewValue;
15095
15122
  exports.getInterface = getInterface;
15096
15123
  exports.getNkey = getNkey;
@@ -15114,6 +15141,7 @@ exports.hasKeyInObject = hasKeyInObject;
15114
15141
  exports.hasNotChanged = hasNotChanged;
15115
15142
  exports.isArrayOfObjects = isArrayOfObjects;
15116
15143
  exports.isEmptyOrSpaces = isEmptyOrSpaces;
15144
+ exports.isErrorResponse = isErrorResponse;
15117
15145
  exports.isModuleApproved = isModuleApproved;
15118
15146
  exports.isProxy = isProxy;
15119
15147
  exports.isSuperAdmin = isSuperAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.816",
3
+ "version": "0.6.818",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -8,3 +8,4 @@
8
8
 
9
9
 
10
10
 
11
+
@@ -1,4 +1,4 @@
1
- import React, { useRef, useEffect } from "react";
1
+ import React, { useRef, useEffect, useCallback } from "react";
2
2
  import { Radar } from "@antv/g2plot";
3
3
  import { theme } from "antd";
4
4
  import { renderTooltip } from "../../../../utils/tooltip";
@@ -39,6 +39,46 @@ const RadarChart = ({
39
39
  legendStyle
40
40
  } = useLegendConfig({legendConfig, isPdf});
41
41
 
42
+ // Helper function to wrap long text labels to multiple lines
43
+ // Ensures text is never hidden - wraps to multiple lines if needed
44
+ const wrapLabel = useCallback((text, maxLength = 10) => {
45
+ if (!text) {
46
+ return '';
47
+ }
48
+
49
+ const formattedText = formattedXAxis(text);
50
+
51
+ // If text is short enough, return as is
52
+ if (formattedText.length <= maxLength) {
53
+ return formattedText;
54
+ }
55
+
56
+ // Split by spaces to find word boundaries
57
+ const words = formattedText.split(' ');
58
+ const lines = [];
59
+ let currentLine = '';
60
+
61
+ words.forEach((word, index) => {
62
+ // If adding this word would exceed maxLength, start a new line
63
+ if (currentLine && (currentLine + ' ' + word).length > maxLength) {
64
+ if (currentLine) {
65
+ lines.push(currentLine);
66
+ }
67
+ currentLine = word;
68
+ } else {
69
+ currentLine = currentLine ? currentLine + ' ' + word : word;
70
+ }
71
+
72
+ // If it's the last word, add it to lines
73
+ if (index === words.length - 1 && currentLine) {
74
+ lines.push(currentLine);
75
+ }
76
+ });
77
+
78
+ // Ensure we always return something - never empty
79
+ return lines.length > 0 ? lines.join('\n') : formattedText;
80
+ }, [formattedXAxis]);
81
+
42
82
  useEffect(() => {
43
83
  if (!containerRef.current) {
44
84
  return;
@@ -59,17 +99,18 @@ const RadarChart = ({
59
99
  }
60
100
  : { showCrosshairs: false, showMarkers: true, ...tooltipConfig },
61
101
  color: color || token.colorPrimary7,
62
-
63
- paddingX: 60,
64
- paddingY: 60,
102
+ // Increased padding to ensure labels are never clipped
103
+ padding: [50, 50, 50, 50],
65
104
  xAxis: {
66
105
  label: {
67
- formatter: formattedXAxis,
106
+ formatter: (text) => wrapLabel(text, 10),
68
107
  offset: 15,
108
+ autoRotate: false,
109
+ autoHide: false, // Never hide labels
110
+ autoEllipsis: false, // Never truncate with ellipsis
69
111
  style: {
70
112
  fontSize: 12,
71
113
  fill: '#666',
72
- textAlign: 'center',
73
114
  },
74
115
  },
75
116
  line: null,
@@ -138,6 +179,7 @@ const RadarChart = ({
138
179
  formattedXAxis,
139
180
  score,
140
181
  token.colorPrimary7,
182
+ wrapLabel,
141
183
  rest,
142
184
  ]);
143
185
 
@@ -151,9 +193,9 @@ const RadarChart = ({
151
193
  }, []);
152
194
 
153
195
  return (
154
- <div className="flex flex-1 flex-column justify-content-center" style={{ overflow: 'visible' }}>
155
- <div className="flex justify-content-center" style={{ paddingX: '30px', overflow: 'visible', width: '100%' }}>
156
- <Container ref={containerRef} height={height} isPdf={isPdf} style={{ paddingX: '30px' }}></Container>
196
+ <div className="flex flex-1 flex-column justify-content-center">
197
+ <div className="flex justify-content-center">
198
+ <Container ref={containerRef} height={height} isPdf={isPdf}></Container>
157
199
  </div>
158
200
  {legendEnabled && legendPosition === 'bottom' && (
159
201
  <CustomLegend
@@ -3,7 +3,6 @@ import styled from "styled-components";
3
3
  const Container = styled.div`
4
4
  height: ${props => props.height || '300px'};
5
5
  width: ${props => props.isPdf ? (props.width ? props.width : '1000px') : 'calc(100% - 48px)'};
6
- overflow: ${props => props.style?.overflow || 'visible'};
7
6
  `;
8
7
 
9
8
  export default Container;