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
@@ -66,7 +66,13 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
66
66
  return <div className="daf-default-cell" />
67
67
  }
68
68
 
69
- const activity = findOptions(v, data?.options?.activityAtSiteOptions || data?.options?.activityAtSite);
69
+ const activityAtSiteOptions = [
70
+ ...(data?.options?.activityAtSiteOptions || []),
71
+ ...(options?.activityAtSiteOptions || []),
72
+ ...(options?.activityAtSite || [])
73
+ ]
74
+
75
+ const activity = findOptions(v, activityAtSiteOptions);
70
76
 
71
77
  return activity ? <Tooltip title={activity}>{activity}</Tooltip> : '-';
72
78
  },
@@ -101,20 +107,24 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
101
107
  ellipsis: true,
102
108
  },
103
109
  {
104
- title: t("Sources"),
105
- dataIndex: "sources",
106
- key: "sources",
107
- show: activeTab !== "own",
108
- render: (val, all) => {
109
- if (all.empty) {
110
- return <div className="daf-default-cell" />;
111
- }
110
+ title: t("Sources"),
111
+ dataIndex: "sources",
112
+ key: "sources",
113
+ show: activeTab !== "own",
114
+ render: (val, all) => {
115
+ if (all.empty) {
116
+ return <div className="daf-default-cell" />;
117
+ }
112
118
 
113
- const sources = sourceAvatarConfig(val, user, applications);
119
+ if (!val || val?.length === 0) {
120
+ return "-";
121
+ }
114
122
 
115
- return <AvatarGroup items={sources}></AvatarGroup>;
116
- },
117
- },
123
+ const sources = sourceAvatarConfig(val, user, applications);
124
+
125
+ return <AvatarGroup items={sources} />;
126
+ },
127
+ },
118
128
  {
119
129
  title: t("Status"),
120
130
  dataIndex: "status",
@@ -43,7 +43,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
43
43
  return <div className="daf-default-cell" />
44
44
  }
45
45
 
46
- const category = findOptions(v, options?.categoriesOptions);
46
+ const categoriesOptions = [...(options?.categoriesOptions || []), ...(options?.category || [])]
47
+
48
+ const category = findOptions(v, categoriesOptions);
47
49
 
48
50
  return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
49
51
  },
@@ -58,7 +60,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
58
60
  return <div className="daf-default-cell" />
59
61
  }
60
62
 
61
- const subCategory = findOptions(v, options?.subCategoriesOptions);
63
+ const subCategoriesOptions = [...(options?.subCategoriesOptions || []), ...(options?.subCategory || [])];
64
+
65
+ const subCategory = findOptions(v, subCategoriesOptions);
62
66
 
63
67
  return subCategory ? <Tooltip title={subCategory}>{subCategory}</Tooltip> : '-';
64
68
  },
@@ -89,12 +93,12 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
89
93
  return <div className="daf-default-cell" />;
90
94
  }
91
95
  if (!val || val?.length === 0) {
92
- return "--";
96
+ return "-";
93
97
  }
94
98
 
95
99
  const sources = sourceAvatarConfig(val, user, applications);
96
100
 
97
- return <AvatarGroup items={sources}></AvatarGroup>;
101
+ return <AvatarGroup items={sources} />;
98
102
  },
99
103
  },
100
104
  {
@@ -83,8 +83,8 @@ const BiodiversityHabitat = ({
83
83
  t={t}
84
84
  />
85
85
 
86
- <div style={{ display: "flex", gap: "24px" }}>
87
- <section style={{ flex: 1 }}>
86
+ <div style={{ display: "flex", gap: "24px", flexWrap: "wrap" }}>
87
+ <section style={{ flex: 1, minWidth: "300px" }}>
88
88
  <ObservedFauna
89
89
  observedFaunaChart={observedFauna}
90
90
  t={t}
@@ -92,11 +92,13 @@ const BiodiversityHabitat = ({
92
92
  />
93
93
  </section>
94
94
 
95
+ <section style={{ flex: 1, minWidth: "300px" }}>
95
96
  <InvasiveSpecies
96
97
  invasiveSpeciesChart={invasiveSpecies}
97
98
  t={t}
98
99
  options={options}
99
100
  />
101
+ </section>
100
102
 
101
103
  </div>
102
104
  </Widget>
@@ -16,7 +16,7 @@ export const getSelectFiltersConfig = ({ subject }) => {
16
16
 
17
17
  export const getFiltersConfig = ({ t, subject }) => {
18
18
  const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
19
- return registry?.config({ t });
19
+ return registry?.config({ t , screen: subject});
20
20
  };
21
21
 
22
22
  export const getFilterOptions = ({ t, subject, options }) => {
@@ -22,6 +22,14 @@ import {
22
22
  } from '../Stakeholders/Workers/config.js';
23
23
  import { getColumns as getColumnsWorkers } from "../Stakeholders/Workers/columns.js";
24
24
 
25
+ import {
26
+ getFiltersConfig as getFiltersConfigArmedGroups,
27
+ getFilterOptions as getFilterOptionsArmedGroups,
28
+ formConfig as formConfigArmedGroups,
29
+ viewConfig as viewConfigArmedGroups
30
+ } from '../Stakeholders/ArmedGroups/config.js';
31
+ import { getColumns as getColumnsArmedGroups } from "../Stakeholders/ArmedGroups/columns.js";
32
+
25
33
  import {
26
34
  getFiltersConfig as getFiltersConfigEvents,
27
35
  getFilterOptions as getFilterOptionsEvents,
@@ -45,6 +53,14 @@ import {
45
53
  viewConfig as viewConfigIncidents
46
54
  } from '../Events/Incidents/config.js';
47
55
  import { getColumns as getColumnsIncidents } from "../Events/Incidents/columns.js";
56
+
57
+ import {
58
+ getFiltersConfig as getFiltersConfigTestimonials,
59
+ getFilterOptions as getFilterOptionsTestimonials,
60
+ formConfig as formConfigTestimonials,
61
+ viewConfig as viewConfigTestimonials
62
+ } from '../Events/Testimonials/config.js';
63
+ import { getColumns as getColumnsTestimonials } from "../Events/Testimonials/columns.js";
48
64
 
49
65
  import {
50
66
  getFiltersConfig as getFiltersConfigLocations,
@@ -63,6 +79,14 @@ import {
63
79
  sclViewConfig as sclViewConfigProductionSites
64
80
  } from '../Locations/MineSite/config.js';
65
81
  import { getColumns as getColumnsProductionSites } from "../Locations/MineSite/columns.js";
82
+
83
+ import {
84
+ getFiltersConfig as getFiltersConfigConflictAreas,
85
+ getFilterOptions as getFilterOptionsConflictAreas,
86
+ formConfig as formConfigConflictAreas,
87
+ viewConfig as viewConfigConflictAreas
88
+ } from '../Locations/ConflictAreas/config.js';
89
+ import { getColumns as getColumnsConflictAreas } from "../Locations/ConflictAreas/columns.js";
66
90
 
67
91
  import {
68
92
  getFiltersConfig as getFilterConfigDocuments,
@@ -95,6 +119,13 @@ export const FILTER_REGISTRY = {
95
119
  viewConfig: viewConfigOperators,
96
120
  columns: getColumnsOperators,
97
121
  },
122
+ "armed-groups": {
123
+ config: getFiltersConfigArmedGroups,
124
+ options: getFilterOptionsArmedGroups,
125
+ formConfig: formConfigArmedGroups,
126
+ viewConfig: viewConfigArmedGroups,
127
+ columns: getColumnsArmedGroups,
128
+ },
98
129
  events: {
99
130
  config: getFiltersConfigEvents,
100
131
  options: getFilterOptionsEvents,
@@ -123,6 +154,13 @@ export const FILTER_REGISTRY = {
123
154
  viewConfig: viewConfigIncidents,
124
155
  columns: getColumnsIncidents,
125
156
  },
157
+ testimonials: {
158
+ config: getFiltersConfigTestimonials,
159
+ options: getFilterOptionsTestimonials,
160
+ formConfig: formConfigTestimonials,
161
+ viewConfig: viewConfigTestimonials,
162
+ columns: getColumnsTestimonials,
163
+ },
126
164
  locations: {
127
165
  config: getFiltersConfigLocations,
128
166
  options: getFilterOptionsLocations,
@@ -137,6 +175,13 @@ export const FILTER_REGISTRY = {
137
175
  viewConfig: viewConfigProductionSites,
138
176
  columns: getColumnsProductionSites,
139
177
  },
178
+ "conflict-areas": {
179
+ config: getFiltersConfigConflictAreas,
180
+ options: getFilterOptionsConflictAreas,
181
+ formConfig: formConfigConflictAreas,
182
+ viewConfig: viewConfigConflictAreas,
183
+ columns: getColumnsConflictAreas,
184
+ },
140
185
  scl: {
141
186
  config: getFiltersConfigProductionSites,
142
187
  options: getFilterOptionsProductionSites,
@@ -0,0 +1,115 @@
1
+ import { BaseService } from "./BaseService.js";
2
+ import { createLazyService } from "./helpers/LazyService.js";
3
+ import { filterCreateData } from "../../helpers/Forms.js";
4
+
5
+ class EventsService extends BaseService {
6
+ getForm({ scope }, language = "en") {
7
+ return this.apiGet({
8
+ isApp: true,
9
+ url: `/forms/event`,
10
+ params: { scope, language },
11
+ });
12
+ }
13
+
14
+ getWithModule({ query, signal, module }) {
15
+ return this.apiGet({
16
+ isApp: true,
17
+ url: `/${module}/event`,
18
+ params: query,
19
+ signal,
20
+ });
21
+ }
22
+
23
+ getOne({ id, module, signal }) {
24
+ return this.apiGet({
25
+ url: `/${module}/event/${id}`,
26
+ isApp: true,
27
+ signal,
28
+ });
29
+ }
30
+
31
+ get(query, signal) {
32
+ return this.apiGet({
33
+ isApp: true,
34
+ url: "/event",
35
+ params: query,
36
+ signal,
37
+ });
38
+ }
39
+
40
+ getData(id, sourceId, source, version) {
41
+ return this.apiGet({
42
+ isApp: true,
43
+ url: `/event/${id}`,
44
+ params: { authorId: sourceId, source, version },
45
+ });
46
+ }
47
+
48
+ getLinking(query) {
49
+ return this.apiGet({
50
+ isApp: true,
51
+ url: "/event/linking",
52
+ params: query,
53
+ });
54
+ }
55
+
56
+ submit(payload) {
57
+ if (payload.id) {
58
+ return this.apiPut({
59
+ isApp: true,
60
+ url: `/event/${payload.id}`,
61
+ data: filterCreateData(payload),
62
+ });
63
+ }
64
+
65
+ if (payload?.form) {
66
+ delete payload.form;
67
+ return this.apiPut({
68
+ isApp: true,
69
+ url: "/event",
70
+ data: filterCreateData(payload),
71
+ });
72
+ }
73
+ return this.apiPost({
74
+ isApp: true,
75
+ url: "/event",
76
+ data: filterCreateData(payload),
77
+ });
78
+ }
79
+
80
+ submitStep(data, id) {
81
+ return this.apiPut({
82
+ isApp: true,
83
+ url: `/event/submit/${id}`,
84
+ data: filterCreateData(data),
85
+ });
86
+ }
87
+ remove(id, data) {
88
+ return this.apiDelete({
89
+ isApp: true,
90
+ url: `/event/${id}/remove`,
91
+ data: data,
92
+ });
93
+ }
94
+
95
+ submitForm(id) {
96
+ const app = window.globalServicesConfig.application;
97
+
98
+ return this.apiPost({
99
+ isApp: true,
100
+ url: `/${app}/versioning/submit/Event/${id}`,
101
+ });
102
+ }
103
+
104
+ getOptions() {
105
+ return this.apiGet({
106
+ isApp: true,
107
+ url: `/forms/options`,
108
+ params: {
109
+ id: "categoryOptions,eventsType,testimonialsType,eventCategory,countries,eventCategoryOptions",
110
+ },
111
+ });
112
+ }
113
+ }
114
+
115
+ export default createLazyService(EventsService);
@@ -27,6 +27,7 @@ export const getNamespace = (namespace) => {
27
27
 
28
28
  class LinkedSubjectsService extends BaseService {
29
29
  getForm({ namespace }, language = "en", scope) {
30
+ console.log({namespace, language, scope})
30
31
  return this.apiGet({
31
32
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
32
33
  isApp: true,
@@ -0,0 +1,80 @@
1
+ import { BaseService } from "./BaseService.js";
2
+ import { createLazyService } from "./helpers/LazyService.js";
3
+ import { filterCreateData } from "../../helpers/Forms.js";
4
+
5
+ class WorkersService extends BaseService {
6
+ get(params) {
7
+ return this.apiGet({
8
+ isApp: true,
9
+ url: "/stakeholder",
10
+ params,
11
+ });
12
+ }
13
+
14
+ getForm(scope = "modalNashirikiWorker", language = "en") {
15
+ return this.apiGet({
16
+ isApp: true,
17
+ url: `/forms/stakeholder`,
18
+ params: { scope, language },
19
+ });
20
+ }
21
+ getData(id, sourceId, version, source) {
22
+ return this.apiGet({
23
+ isApp: true,
24
+ url: `/stakeholder/${id}`,
25
+ params: { authorId: sourceId, version, source },
26
+ });
27
+ }
28
+
29
+ submit(payload) {
30
+ if (payload.id) {
31
+ // const { id, ...data } = payload;
32
+ return this.apiPut({
33
+ isApp: true,
34
+ url: `/stakeholder/${payload.id}`,
35
+ data: filterCreateData(payload),
36
+ });
37
+ }
38
+ if (payload?.form) {
39
+ delete payload.form;
40
+ return this.apiPost({
41
+ isApp: true,
42
+ url: "/stakeholder",
43
+ data: filterCreateData(payload),
44
+ });
45
+ }
46
+ return this.apiPost({
47
+ isApp: true,
48
+ url: "/stakeholder",
49
+ data: filterCreateData(payload),
50
+ });
51
+ }
52
+
53
+ submitStep(data, id) {
54
+ return this.apiPut({
55
+ isApp: true,
56
+ url: `/stakeholder/submit/${id}`,
57
+ data: filterCreateData(data),
58
+ });
59
+ }
60
+
61
+ remove(id, data) {
62
+ return this.apiDelete({
63
+ isApp: true,
64
+ url: `/stakeholder/${id}/remove`,
65
+ data: data,
66
+ });
67
+ }
68
+
69
+ getOptions() {
70
+ return this.apiGet({
71
+ isApp: true,
72
+ url: `/forms/options`,
73
+ params: {
74
+ id: "activityAtSiteOptions,category,countries,optionPositionSupplyChain,subCategory",
75
+ },
76
+ });
77
+ }
78
+ }
79
+
80
+ export default createLazyService(WorkersService);
@@ -1,67 +1,135 @@
1
1
  import { message } from 'antd';
2
2
 
3
+ /**
4
+ * Check if a successful response contains embedded error data
5
+ */
6
+ export const isErrorResponse = (data) => {
7
+ if (!data) return false;
8
+
9
+ return (
10
+ // Check for Exception names
11
+ (data.name && data.name.includes('Exception')) ||
12
+ // Check for nested response with error status
13
+ (data.response?.statusCode && data.response.statusCode >= 400) ||
14
+ // Check for top-level error status
15
+ (data.statusCode && data.statusCode >= 400) ||
16
+ // Check for explicit error flag
17
+ data.error === true ||
18
+ // Check for nested error property
19
+ (data.response?.error && data.response.error !== null)
20
+ );
21
+ };
22
+
23
+ /**
24
+ * Extract error message from various error response formats
25
+ */
26
+ export const getErrorMessage = (data) => {
27
+ return (
28
+ data?.message ||
29
+ data?.response?.message ||
30
+ data?.response?.error ||
31
+ 'An error occurred'
32
+ );
33
+ };
34
+
3
35
  /**
4
36
  * Generic error handler factory for axios requests
5
37
  * Highly configurable to adapt to different project needs
6
38
  */
7
39
  export const createErrorHandler = (config = {}) => {
8
- const {
9
- onUnauthorized,
10
- handleError,
11
- getStorageManager,
12
- checkTokenValidity = true,
13
- unauthorizedRedirect = '/',
14
- tokenStorageKey = 'token',
15
- handleNetworkError = true,
16
- } = config;
17
-
18
- return (error, customOnUnauthorized) => {
19
- // Handle cases where error.response doesn't exist (network errors)
20
- if (!error.response) {
21
- if (handleNetworkError && handleError) {
22
- handleError({
23
- status: 0,
24
- statusText: "Network Error",
25
- data: ["Please check your internet connection."],
26
- });
27
- }
28
- return Promise.reject(error);
40
+ const {
41
+ onUnauthorized,
42
+ handleError,
43
+ getStorageManager,
44
+ checkTokenValidity = true,
45
+ unauthorizedRedirect = '/',
46
+ tokenStorageKey = 'token',
47
+ handleNetworkError = true,
48
+ } = config;
49
+
50
+ return (error, customOnUnauthorized) => {
51
+ // Handle cases where error.response doesn't exist (network errors)
52
+ if (!error.response) {
53
+ if (handleNetworkError && handleError) {
54
+ handleError({
55
+ status: 0,
56
+ statusText: "Network Error",
57
+ data: ["Please check your internet connection."],
58
+ });
29
59
  }
30
-
31
- const { status, statusText, data: { errors, message } = {} } = error.response || { data: {} };
32
-
33
- // Handle 401 Unauthorized
34
- if (status === 401) {
35
- if (checkTokenValidity && getStorageManager) {
36
- const token = getStorageManager().get(tokenStorageKey);
37
- if (token) {
38
- if (typeof customOnUnauthorized === 'function') {
39
- customOnUnauthorized();
40
- } else if (typeof onUnauthorized === 'function') {
41
- onUnauthorized();
42
- } else {
43
- getStorageManager().clearOne(tokenStorageKey);
44
- if (typeof window !== 'undefined') {
45
- window.location.href = unauthorizedRedirect;
46
- }
60
+ return Promise.reject(error);
61
+ }
62
+
63
+ const { status, statusText, data: { errors, message } = {} } = error.response || { data: {} };
64
+
65
+ // Handle 401 Unauthorized
66
+ if (status === 401) {
67
+ if (checkTokenValidity && getStorageManager) {
68
+ const token = getStorageManager().get(tokenStorageKey);
69
+ if (token) {
70
+ if (typeof customOnUnauthorized === 'function') {
71
+ customOnUnauthorized();
72
+ } else if (typeof onUnauthorized === 'function') {
73
+ onUnauthorized();
74
+ } else {
75
+ getStorageManager().clearOne(tokenStorageKey);
76
+ if (typeof window !== 'undefined') {
77
+ window.location.href = unauthorizedRedirect;
47
78
  }
48
79
  }
49
80
  }
50
81
  }
51
-
52
- // Handle 4xx and 5xx errors
53
- if (status >= 400 && status <= 500) {
54
- if (handleError) {
55
- handleError({
56
- status,
57
- statusText: message || statusText,
58
- data: errors || []
59
- });
82
+ }
83
+
84
+ // Handle 4xx and 5xx errors
85
+ if (status >= 400 && status <= 500) {
86
+ if (handleError) {
87
+ handleError({
88
+ status,
89
+ statusText: message || statusText,
90
+ data: errors || []
91
+ });
92
+ }
93
+ }
94
+
95
+ return Promise.reject(error);
96
+ };
97
+ };
98
+
99
+ /**
100
+ * Create axios response interceptor to catch embedded errors in successful responses
101
+ */
102
+ export const createResponseInterceptor = (config = {}) => {
103
+ const { showNotification = true } = config;
104
+
105
+ return {
106
+ onSuccess: (response) => {
107
+ // Check if the response data contains an error
108
+ if (isErrorResponse(response.data)) {
109
+ const errorMessage = getErrorMessage(response.data);
110
+
111
+ if (showNotification) {
112
+ message.error(errorMessage);
60
113
  }
114
+
115
+ // Convert to a rejected promise so catch blocks handle it
116
+ const error = new Error(errorMessage);
117
+ error.response = {
118
+ data: response.data,
119
+ status: response.data.statusCode || response.data.response?.statusCode || 200,
120
+ statusText: errorMessage,
121
+ };
122
+ error.isEmbeddedError = true; // Flag to identify these special errors
123
+
124
+ return Promise.reject(error);
61
125
  }
62
126
 
127
+ return response;
128
+ },
129
+ onError: (error) => {
63
130
  return Promise.reject(error);
64
- };
131
+ }
132
+ };
65
133
  };
66
134
 
67
135
  /**
@@ -69,29 +137,29 @@ export const createErrorHandler = (config = {}) => {
69
137
  * Useful for quick error notifications
70
138
  */
71
139
  export const handleError = (err) => {
72
- const errorMessage = err?.response?.data?.message ||
73
- err?.message ||
74
- 'An error occurred';
75
- message.error(errorMessage);
76
- };
77
-
78
- /**
79
- * Success message handler
80
- */
81
- export const handleSuccess = (msg) => {
82
- message.success(msg || 'Operation successful');
83
- };
84
-
85
- /**
86
- * Warning message handler
87
- */
88
- export const handleWarning = (msg) => {
89
- message.warning(msg || 'Warning');
90
- };
91
-
92
- /**
93
- * Info message handler
94
- */
95
- export const handleInfo = (msg) => {
96
- message.info(msg);
97
- };
140
+ const errorMessage = err?.response?.data?.message ||
141
+ err?.message ||
142
+ 'An error occurred';
143
+ message.error(errorMessage);
144
+ };
145
+
146
+ /**
147
+ * Success message handler
148
+ */
149
+ export const handleSuccess = (msg) => {
150
+ message.success(msg || 'Operation successful');
151
+ };
152
+
153
+ /**
154
+ * Warning message handler
155
+ */
156
+ export const handleWarning = (msg) => {
157
+ message.warning(msg || 'Warning');
158
+ };
159
+
160
+ /**
161
+ * Info message handler
162
+ */
163
+ export const handleInfo = (msg) => {
164
+ message.info(msg);
165
+ };
package/src/services.js CHANGED
@@ -18,4 +18,6 @@ export { default as SourceService } from './@daf/services/SourceService.js';
18
18
  export { default as DashboardService } from './@daf/services/DashboardService.js';
19
19
  export { default as LinkedSubjectsService } from './@daf/services/LinkedSubjects.js';
20
20
  export { default as OperatorService } from './@daf/services/OperatorService.js';
21
- export { default as PartnerService } from './@daf/services/PartnerService.js';
21
+ export { default as PartnerService } from './@daf/services/PartnerService.js';
22
+ export { default as EventsService } from './@daf/services/EventsService.js';
23
+ export { default as WorkersService } from './@daf/services/WorkersService.js';
package/src/utils.js CHANGED
@@ -46,7 +46,7 @@ export { StorageManager } from './helpers/StorageManager.js';
46
46
 
47
47
  export { assignParamsToUrl, buildQueryString } from './helpers/urlHelpers.js';
48
48
 
49
- export { createErrorHandler, handleError, handleSuccess, handleWarning, handleInfo } from './helpers/errorHandling.js';
49
+ export { createErrorHandler, handleError, handleSuccess, handleWarning, handleInfo, isErrorResponse, getErrorMessage } from './helpers/errorHandling.js';
50
50
 
51
51
  export { createTheme, createAdminTheme } from './helpers/theme.js';
52
52