datastake-daf 0.6.765 → 0.6.767

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 (64) hide show
  1. package/dist/components/index.js +482 -245
  2. package/dist/layouts/index.js +0 -3
  3. package/dist/pages/index.js +299 -241
  4. package/dist/services/index.js +18 -0
  5. package/dist/utils/index.js +328 -5
  6. package/package.json +4 -2
  7. package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +1 -1
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -9
  10. package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +31 -1
  12. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
  13. package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
  14. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +10 -7
  15. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
  16. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
  17. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
  21. package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  26. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
  27. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/create.jsx +106 -0
  28. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +115 -0
  29. package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
  30. package/src/@daf/hooks/useMapHelper.js +5 -0
  31. package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
  32. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
  33. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +11 -5
  34. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
  35. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
  36. package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
  37. package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
  38. package/src/@daf/pages/Data/Channels/columns.js +175 -0
  39. package/src/@daf/pages/Data/Channels/config.js +0 -0
  40. package/src/@daf/pages/Data/Channels/create.jsx +0 -0
  41. package/src/@daf/pages/Data/Channels/index.jsx +0 -0
  42. package/src/@daf/pages/Events/Activities/columns.js +1 -4
  43. package/src/@daf/pages/Events/helper.js +2 -2
  44. package/src/@daf/pages/Events/index.jsx +1 -1
  45. package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
  46. package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
  47. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +1 -0
  48. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
  49. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
  50. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
  51. package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
  52. package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
  53. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
  54. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
  55. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
  56. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +10 -3
  57. package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
  58. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
  59. package/src/@daf/services/AdminService.js +14 -0
  60. package/src/constants/locales/en/translation.js +109 -2
  61. package/src/constants/locales/fr/translation.js +109 -1
  62. package/src/constants/locales/sp/translation.js +104 -1
  63. package/src/index.js +2 -0
  64. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -7934,7 +7934,12 @@ const defaultMapConfig = {
7934
7934
  maxZoom: 18,
7935
7935
  preferCanvas: true,
7936
7936
  zoomControl: false,
7937
- maxBounds: maxBounds
7937
+ maxBounds: maxBounds,
7938
+ zoomSnap: 0.5,
7939
+ zoomDelta: 0.5,
7940
+ wheelPxPerZoomLevel: 150,
7941
+ zoomAnimation: true,
7942
+ zoomAnimationThreshold: 10
7938
7943
  };
7939
7944
  const filterValidGPS = data => {
7940
7945
  const latCheck = lat => lat > -90 || lat < 90;
@@ -8809,7 +8814,7 @@ function StakeholderIcon$1({
8809
8814
  onClickLink(data);
8810
8815
  }
8811
8816
  }),
8812
- getPopupContainer: () => document.getElementById(data.datastakeId),
8817
+ getPopupContainer: () => document.getElementById("map"),
8813
8818
  children: /*#__PURE__*/jsxRuntime.jsx(StakeholderMarker, {
8814
8819
  className: `${data.type} ${isSelected ? "selected" : selectedMarkersId.length > 0 ? "unselected" : ""}
8815
8820
  ${isSmall ? "small" : isMedium ? "medium" : "large"}
@@ -8916,12 +8921,6 @@ function LocationIcon({
8916
8921
  }).addTo(mapRef);
8917
8922
  const div = document.getElementById(markerId);
8918
8923
  root.current = client.createRoot(div);
8919
- console.log({
8920
- locationID: data.datastakeId,
8921
- stakeholder,
8922
- index,
8923
- parentId: data.datastakeId
8924
- });
8925
8924
  root.current.render( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
8926
8925
  data: stakeholder,
8927
8926
  zoom: zoom,
@@ -9018,8 +9017,7 @@ function LocationIcon({
9018
9017
  // isHovering
9019
9018
  // }
9020
9019
  ,
9021
-
9022
- getPopupContainer: () => document.getElementById(i),
9020
+ getPopupContainer: () => document.getElementById("map"),
9023
9021
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
9024
9022
  style: {
9025
9023
  position: "relative",
@@ -9120,6 +9118,7 @@ function StakeholderIcon({
9120
9118
  link,
9121
9119
  onClickLink: () => onClickLink(marker)
9122
9120
  }),
9121
+ getPopupContainer: () => document.getElementById("map"),
9123
9122
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
9124
9123
  style: {
9125
9124
  position: "absolute",
@@ -9161,6 +9160,7 @@ function StakeholderIcon({
9161
9160
  link,
9162
9161
  onClickLink: () => onClickLink(marker)
9163
9162
  }),
9163
+ getPopupContainer: () => document.getElementById("map"),
9164
9164
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
9165
9165
  style: {
9166
9166
  position: "absolute",
@@ -9196,6 +9196,7 @@ function StakeholderIcon({
9196
9196
  link,
9197
9197
  onClickLink: () => onClickLink(marker)
9198
9198
  }),
9199
+ getPopupContainer: () => document.getElementById("map"),
9199
9200
  children: /*#__PURE__*/jsxRuntime.jsx(Style$c
9200
9201
  // onClick={toggleOpen}
9201
9202
  , {
@@ -9919,7 +9920,13 @@ const useMap = ({
9919
9920
  if (mapRef) {
9920
9921
  L__namespace.control.scale().addTo(mapRef);
9921
9922
  L__namespace.tileLayer(TILE_LAYER_URL, {
9922
- access_token: MAP_TOKEN
9923
+ access_token: MAP_TOKEN,
9924
+ keepBuffer: 4,
9925
+ updateWhenZooming: false,
9926
+ updateInterval: 200,
9927
+ maxNativeZoom: 18,
9928
+ tileSize: 256,
9929
+ fadeAnimation: true
9923
9930
  }).addTo(mapRef);
9924
9931
  }
9925
9932
  }, [mapRef]);
@@ -9983,6 +9990,23 @@ const useMap = ({
9983
9990
  mapRef.setView([marker.coordinates[0], marker.coordinates[1]], getZoom(mapRef));
9984
9991
  }
9985
9992
  }, [activeMarker, mapRef]);
9993
+ React.useEffect(() => {
9994
+ if (mapRef && type === "chain") {
9995
+ const handleMapClick = e => {
9996
+ const clickedElement = e.originalEvent.target;
9997
+ const isMarkerClick = clickedElement.closest('.marker-chain') || clickedElement.closest('.leaflet-marker-icon');
9998
+ if (!isMarkerClick && selectedMarkersId.length > 0) {
9999
+ setSelectedMarkersId([]);
10000
+ openPopupIdRef.current = null;
10001
+ setMarkerWithPopup(null);
10002
+ }
10003
+ };
10004
+ mapRef.on('click', handleMapClick);
10005
+ return () => {
10006
+ mapRef.off('click', handleMapClick);
10007
+ };
10008
+ }
10009
+ }, [mapRef, type, selectedMarkersId]);
9986
10010
  return {
9987
10011
  container,
9988
10012
  activeMarker,
@@ -10475,6 +10499,7 @@ function SupplyChainMap({
10475
10499
  } = useWidgetFetch({
10476
10500
  config: defaultConfig
10477
10501
  });
10502
+ console.log('data', data);
10478
10503
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
10479
10504
  title: t("Supply Chain Map"),
10480
10505
  loading: loading,
@@ -10484,22 +10509,25 @@ function SupplyChainMap({
10484
10509
  data: Array.isArray(data) && data.length > 0 ? data : [],
10485
10510
  renderTooltip: data => {
10486
10511
  const productsText = data?.products?.[0];
10487
- const minerals = options?.minerals || [];
10512
+ const minerals = options?.mineralOptions || [];
10513
+ const participants = data?.stakeholders?.map(stakeholder => stakeholder.name);
10488
10514
  return [{
10489
10515
  label: t("Products"),
10490
- value: minerals.find(mineral => mineral.value === productsText)?.label || productsText || "-",
10516
+ value: findOptions(productsText, minerals) || productsText || "-",
10491
10517
  ...(productsText && {
10492
10518
  tag: getTagColor(productsText)
10493
10519
  })
10494
10520
  }, {
10495
10521
  label: t("Participants"),
10496
- value: data?.participants || "-"
10522
+ value: participants?.length > 0 ? participants.join(', ') : "-"
10497
10523
  }];
10498
10524
  },
10499
10525
  link: true,
10500
10526
  onClickLink: data => {
10501
- const locationTypes = ['mineSite', 'village'];
10502
- if (locationTypes.includes(data.type)) {
10527
+ const locationTypes = ['village', 'town', 'area', 'territory'];
10528
+ if (data?.type === 'mineSite') {
10529
+ goTo(getRedirectLink(`/app/mine-summary/${data.datastakeId}`));
10530
+ } else if (locationTypes.includes(data.type)) {
10503
10531
  goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
10504
10532
  } else {
10505
10533
  goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
@@ -11626,7 +11654,6 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
11626
11654
  withDuration = true,
11627
11655
  onFilterChange,
11628
11656
  isPdf,
11629
- zoomOutTransition = false,
11630
11657
  ...props
11631
11658
  }, ref) {
11632
11659
  const {
@@ -11643,17 +11670,23 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
11643
11670
  }
11644
11671
  return result;
11645
11672
  }, [nodes.length, mandatoryNodesToFit?.length, mandatoryNodesToFit]);
11673
+
11674
+ // In BaseGraph.jsx, replace the useEffect with:
11646
11675
  React.useEffect(() => {
11647
11676
  if (nodesToFit.length === 0) return;
11648
- requestAnimationFrame(() => {
11677
+
11678
+ // Use setTimeout instead of requestAnimationFrame to ensure nodes are rendered
11679
+ const timer = setTimeout(() => {
11649
11680
  fitView({
11650
11681
  padding: 0.4,
11651
11682
  nodes: [...nodesToFit],
11652
- duration: withDuration ? 300 : undefined,
11653
- maxZoom: 0.8
11683
+ // duration: withDuration ? 300 : undefined,
11684
+ maxZoom: 0.9
11654
11685
  });
11655
- });
11656
- }, [JSON.stringify(nodesToFit), withDuration]);
11686
+ }, 100); // Small delay to ensure nodes are rendered
11687
+
11688
+ return () => clearTimeout(timer);
11689
+ }, [nodesToFit.length, nodesToFit.map(n => `${n.id}-${n.width}-${n.height}`).join(','), withDuration]);
11657
11690
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
11658
11691
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
11659
11692
  style: {
@@ -11684,9 +11717,7 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
11684
11717
  fitViewOptions: {
11685
11718
  padding: 0.2,
11686
11719
  //zoom out on default
11687
- ...(zoomOutTransition ? {
11688
- duration: withDuration ? 300 : undefined
11689
- } : {})
11720
+ duration: withDuration ? 300 : undefined
11690
11721
  },
11691
11722
  ...props,
11692
11723
  children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
@@ -12300,11 +12331,13 @@ function useIdentification({
12300
12331
  const values = graphData.filter(d => d.date === title);
12301
12332
  return {
12302
12333
  title: "Products",
12303
- items: values.map(val => ({
12304
- label: options?.minerals?.find(mineral => mineral.value === val.typeOfProduct)?.label || val.typeOfProduct,
12305
- color: colors[allSeenProducts.indexOf(val.typeOfProduct) % colors.length],
12306
- value: val.value.toLocaleString()
12307
- }))
12334
+ items: values.map(val => {
12335
+ return {
12336
+ label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
12337
+ color: colors[allSeenProducts.indexOf(val.typeOfProduct) % colors.length],
12338
+ value: val.value.toLocaleString()
12339
+ };
12340
+ })
12308
12341
  };
12309
12342
  }
12310
12343
  return {
@@ -13594,7 +13627,7 @@ function MineSites({
13594
13627
  if (activeTab === "stakeholder") {
13595
13628
  return [{
13596
13629
  label: t("Category"),
13597
- value: findOptions(data?.category, locationCategories ?? []) || "--"
13630
+ value: findOptions(data?.category, options?.categoriesOptions ?? []) || "--"
13598
13631
  }];
13599
13632
  }
13600
13633
  if (activeTab === "event") {
@@ -14079,6 +14112,7 @@ function BarChart({
14079
14112
  isPdf = false,
14080
14113
  legendConfig = {},
14081
14114
  width,
14115
+ xAxisConfig = {},
14082
14116
  ...rest
14083
14117
  }) {
14084
14118
  const containerRef = React__default["default"].useRef(null);
@@ -14111,8 +14145,10 @@ function BarChart({
14111
14145
  return Array.from(new Array(11), (v, i) => i * 10);
14112
14146
  }
14113
14147
  } : {}),
14148
+ ...xAxisConfig,
14114
14149
  label: {
14115
- formatter: isPercentage ? v => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, s => `${s},`) + " %" : formattedXAxis
14150
+ formatter: isPercentage ? v => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, s => `${s},`) + " %" : formattedXAxis,
14151
+ ...xAxisConfig?.label
14116
14152
  }
14117
14153
  },
14118
14154
  yAxis: {
@@ -14138,7 +14174,7 @@ function BarChart({
14138
14174
  } else {
14139
14175
  chartRef.current.update(config);
14140
14176
  }
14141
- }, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7]);
14177
+ }, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7, xAxisConfig]);
14142
14178
  React__default["default"].useEffect(() => {
14143
14179
  return () => {
14144
14180
  if (chartRef.current) {
@@ -14172,55 +14208,7 @@ const mapData = ({
14172
14208
  tabSelected
14173
14209
  }) => {
14174
14210
  if (!data.length) {
14175
- return [{
14176
- category: "",
14177
- type: t("Stakeholders"),
14178
- value: 0.5
14179
- }, {
14180
- category: "",
14181
- type: t("Locations"),
14182
- value: 0.5
14183
- }, {
14184
- category: "",
14185
- type: t("Events"),
14186
- value: 0.5
14187
- }, {
14188
- category: " ",
14189
- type: "Stakeholders",
14190
- value: 0.5
14191
- }, {
14192
- category: " ",
14193
- type: "Locations",
14194
- value: 0.5
14195
- }, {
14196
- category: " ",
14197
- type: t("Events"),
14198
- value: 0.5
14199
- }, {
14200
- category: " ",
14201
- type: t("Stakeholders"),
14202
- value: 0.5
14203
- }, {
14204
- category: " ",
14205
- type: t("Locations"),
14206
- value: 0.5
14207
- }, {
14208
- category: " ",
14209
- type: t("Events"),
14210
- value: 0.5
14211
- }, {
14212
- category: " ",
14213
- type: t("Stakeholders"),
14214
- value: 0.5
14215
- }, {
14216
- category: " ",
14217
- type: t("Locations"),
14218
- value: 0.5
14219
- }, {
14220
- category: " ",
14221
- type: t("Events"),
14222
- value: 0.5
14223
- }];
14211
+ return [];
14224
14212
  }
14225
14213
  const metricTypes = {
14226
14214
  stakeholders: tabSelected === "dataPoints" ? t("Stakeholders Data") : t("Stakeholders"),
@@ -14286,15 +14274,22 @@ const useContributionsGraph = ({
14286
14274
  tabSelected
14287
14275
  });
14288
14276
  }, [data, t]);
14277
+ const isEmpty = React.useMemo(() => _data?.length === 0, [_data]);
14289
14278
  const chartConfig = React.useMemo(() => {
14290
14279
  return {
14291
14280
  data: _data,
14292
- xField: "value",
14293
- yField: "category",
14281
+ xFieldKey: "value",
14282
+ yFieldKey: "category",
14294
14283
  seriesField: "type",
14295
14284
  isGroup: true,
14285
+ ...(isEmpty && {
14286
+ xAxisConfig: {
14287
+ min: 0,
14288
+ max: 10,
14289
+ tickCount: 5
14290
+ }
14291
+ }),
14296
14292
  renderTooltipContent: (title, items) => {
14297
- const isEmpty = !data.length;
14298
14293
  const tooltipItems = items.map(item => ({
14299
14294
  label: item.name,
14300
14295
  color: item.color,
@@ -14308,7 +14303,7 @@ const useContributionsGraph = ({
14308
14303
  },
14309
14304
  color: [theme.colorPrimary7, theme.colorPrimary4, theme.colorPrimary9]
14310
14305
  };
14311
- }, [_data, t, theme]);
14306
+ }, [_data, t, theme, isEmpty]);
14312
14307
  return chartConfig;
14313
14308
  };
14314
14309
 
@@ -14422,7 +14417,7 @@ const useTriangulation = ({
14422
14417
  const _config = config.find(c => c.key === item.key);
14423
14418
  if (_config) {
14424
14419
  return renderTooltipJsx({
14425
- title: t(section === "data-compilation" ? "nashiriki::Information Sharing" : "Triangulation"),
14420
+ title: t(section === "data-compilation" ? "Information Sharing" : "Triangulation"),
14426
14421
  items: [{
14427
14422
  // color: _config.color,
14428
14423
  label: t(_config.label[section]),
@@ -16133,6 +16128,42 @@ MoreMenu.propTypes = {
16133
16128
  trigger: PropTypes__default["default"].oneOf(["click", "hover", "contextMenu"])
16134
16129
  };
16135
16130
 
16131
+ const renderStatusTag = ({
16132
+ value,
16133
+ t = s => s
16134
+ }) => {
16135
+ const width = 87;
16136
+ switch (value) {
16137
+ case "edited":
16138
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
16139
+ color: "yellow",
16140
+ style: {
16141
+ width
16142
+ },
16143
+ className: "text-center",
16144
+ children: t("Edited")
16145
+ });
16146
+ case "submitted":
16147
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
16148
+ color: "green",
16149
+ style: {
16150
+ width
16151
+ },
16152
+ className: "text-center",
16153
+ children: t("Submitted")
16154
+ });
16155
+ default:
16156
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
16157
+ color: "blue",
16158
+ style: {
16159
+ width
16160
+ },
16161
+ className: "text-center",
16162
+ children: t("Private")
16163
+ });
16164
+ }
16165
+ };
16166
+
16136
16167
  const getColumns$a = ({
16137
16168
  t,
16138
16169
  goTo,
@@ -16289,11 +16320,11 @@ const getColumns$a = ({
16289
16320
  className: "daf-default-cell"
16290
16321
  });
16291
16322
  }
16292
- const status = findOptions(v, data?.options?.statusOptions);
16293
- return status ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16294
- title: status,
16295
- children: status
16296
- }) : '-';
16323
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
16324
+ return renderStatusTag({
16325
+ value: _val,
16326
+ t
16327
+ });
16297
16328
  }
16298
16329
  }, {
16299
16330
  id: 'actions',
@@ -31157,7 +31188,10 @@ function MoreTags({
31157
31188
  values = [],
31158
31189
  maxWidthCont = 120,
31159
31190
  maxTextCont = 100,
31160
- diff = 30
31191
+ diff = 30,
31192
+ style = {},
31193
+ tagColor,
31194
+ limit
31161
31195
  }) {
31162
31196
  const ref = React.useRef();
31163
31197
  const [width, setWidth] = React.useState(0);
@@ -31172,6 +31206,11 @@ function MoreTags({
31172
31206
  return () => resizeObserver.disconnect();
31173
31207
  }, []);
31174
31208
  const _calculate = () => {
31209
+ // If limit prop is provided and valid, use it instead of calculating
31210
+ if (typeof limit === 'number' && limit > 0) {
31211
+ setIndexToReturn(Math.min(limit - 1, values.length - 1));
31212
+ return;
31213
+ }
31175
31214
  const tabs = ref.current.querySelectorAll(".check-tabs");
31176
31215
  let filled = 0;
31177
31216
  let indexToReturn;
@@ -31198,7 +31237,7 @@ function MoreTags({
31198
31237
  const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
31199
31238
  React.useEffect(() => {
31200
31239
  _calculate();
31201
- }, [width, values]);
31240
+ }, [width, values, limit]);
31202
31241
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
31203
31242
  className: "daf-more-tags",
31204
31243
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -31208,9 +31247,10 @@ function MoreTags({
31208
31247
  maxWidth: _maxWidthCont,
31209
31248
  overflow: "hidden",
31210
31249
  textOverflow: "ellipsis",
31211
- whiteSpace: "nowrap"
31250
+ whiteSpace: "nowrap",
31251
+ ...style
31212
31252
  },
31213
- color: ac.color,
31253
+ color: tagColor || ac.color,
31214
31254
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31215
31255
  title: typeof ac === "object" ? ac.label : ac,
31216
31256
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -31218,7 +31258,8 @@ function MoreTags({
31218
31258
  maxWidth: _maxWidthTxt,
31219
31259
  overflow: "hidden",
31220
31260
  textOverflow: "ellipsis",
31221
- whiteSpace: "nowrap"
31261
+ whiteSpace: "nowrap",
31262
+ ...style
31222
31263
  },
31223
31264
  children: typeof ac === "object" ? ac.label : ac
31224
31265
  })
@@ -31226,6 +31267,8 @@ function MoreTags({
31226
31267
  }, `${typeof ac === "object" ? ac.value : ac}-${i}`)), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31227
31268
  title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
31228
31269
  children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
31270
+ color: tagColor || 'default',
31271
+ style: style,
31229
31272
  children: ["+", other.length]
31230
31273
  })
31231
31274
  }) : null]
@@ -31233,10 +31276,11 @@ function MoreTags({
31233
31276
  className: "list hidden",
31234
31277
  ref: ref,
31235
31278
  children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31236
- color: ac.color,
31279
+ color: tagColor || ac.color,
31237
31280
  className: "check-tabs",
31238
31281
  style: {
31239
- maxWidth: _maxWidthCont
31282
+ maxWidth: _maxWidthCont,
31283
+ ...style
31240
31284
  },
31241
31285
  children: /*#__PURE__*/jsxRuntime.jsx(Text, {
31242
31286
  ellipsis: {
@@ -31255,43 +31299,8 @@ MoreTags.propTypes = {
31255
31299
  values: PropTypes__default["default"].array,
31256
31300
  maxWidthCont: PropTypes__default["default"].number,
31257
31301
  maxTextCont: PropTypes__default["default"].number,
31258
- diff: PropTypes__default["default"].number
31259
- };
31260
-
31261
- const renderStatusTag = ({
31262
- value,
31263
- t = s => s
31264
- }) => {
31265
- const width = 87;
31266
- switch (value) {
31267
- case "edited":
31268
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31269
- color: "yellow",
31270
- style: {
31271
- width
31272
- },
31273
- className: "text-center",
31274
- children: t("Edited")
31275
- });
31276
- case "submitted":
31277
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31278
- color: "green",
31279
- style: {
31280
- width
31281
- },
31282
- className: "text-center",
31283
- children: t("Submitted")
31284
- });
31285
- default:
31286
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31287
- color: "blue",
31288
- style: {
31289
- width
31290
- },
31291
- className: "text-center",
31292
- children: t("Private")
31293
- });
31294
- }
31302
+ diff: PropTypes__default["default"].number,
31303
+ limit: PropTypes__default["default"].number
31295
31304
  };
31296
31305
 
31297
31306
  const getColumns$7 = ({
@@ -31910,7 +31919,7 @@ const EventsTable = ({
31910
31919
  }, []);
31911
31920
  return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
31912
31921
  t: t,
31913
- title: t("events"),
31922
+ title: t("Events"),
31914
31923
  breadCrumbs: breadcrumbs,
31915
31924
  location: location,
31916
31925
  loading: loading,
@@ -32940,11 +32949,11 @@ const WorkersTable = ({
32940
32949
  });
32941
32950
  };
32942
32951
 
32943
- const getEventCategoryBySubject = (eventCategoryObject, subject) => {
32952
+ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = false) => {
32944
32953
  if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
32945
32954
  return null;
32946
32955
  }
32947
- const subjectSingular = subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
32956
+ const subjectSingular = isSingular ? subject : subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
32948
32957
  const key = `typeOfEvent is ${subjectSingular}`;
32949
32958
  return eventCategoryObject[key] || null;
32950
32959
  };
@@ -33074,16 +33083,7 @@ const getColumns$4 = ({
33074
33083
  });
33075
33084
  }
33076
33085
  const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
33077
- const categoryValue = getEventCategoryBySubject(eventCategory, subject);
33078
- console.log({
33079
- categoryValue
33080
- });
33081
- console.log({
33082
- eventCategory
33083
- });
33084
- console.log({
33085
- subject
33086
- });
33086
+ const categoryValue = getEventCategoryBySubject(eventCategory, "correctiveActions", true);
33087
33087
  return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33088
33088
  title: categoryValue,
33089
33089
  children: categoryValue
@@ -34397,10 +34397,10 @@ const getColumns$2 = ({
34397
34397
  className: "daf-default-cell"
34398
34398
  });
34399
34399
  }
34400
- const operators = all?.operatorOfLocation?.map(operator => operator?.clientLocation?.name);
34400
+ const operators = all?.operator?.map(operator => operator?.locationClient?.name)?.filter(Boolean);
34401
34401
  return operators && operators.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(MoreOptions, {
34402
34402
  data: operators || [],
34403
- tooltipPlacement: "topLeft"
34403
+ toolTipPlacement: operators?.length < 2 ? "topLeft" : "top"
34404
34404
  }) : '-';
34405
34405
  }
34406
34406
  }, {
@@ -34432,11 +34432,11 @@ const getColumns$2 = ({
34432
34432
  className: "daf-default-cell"
34433
34433
  });
34434
34434
  }
34435
- const status = findOptions(v, data?.options?.statusOptions);
34436
- return status ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
34437
- title: status,
34438
- children: status
34439
- }) : '-';
34435
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
34436
+ return renderStatusTag({
34437
+ value: _val,
34438
+ t
34439
+ });
34440
34440
  }
34441
34441
  }, {
34442
34442
  title: t("Sources"),
@@ -36844,6 +36844,9 @@ const useSummary = ({
36844
36844
  hasTooltip: PropTypes__default["default"].bool
36845
36845
  });
36846
36846
 
36847
+ const getAllProducts = arr => {
36848
+ return arr.flatMap(item => (item.products || []).map(product => product.typeOfProduct));
36849
+ };
36847
36850
  const getKeyIndicatorConfig = ({
36848
36851
  t,
36849
36852
  data = {},
@@ -36872,7 +36875,7 @@ const getKeyIndicatorConfig = ({
36872
36875
  }, {
36873
36876
  label: t("Supply Chain Position"),
36874
36877
  render: () => {
36875
- const position = findOptions(data?.positionSupplyChain, options?.positionSupplyChainOptions);
36878
+ const position = findOptions(data?.positionSupplyChain, options?.positionSupplyChainOptions || options?.optionPositionSupplyChain);
36876
36879
  return /*#__PURE__*/jsxRuntime.jsx("div", {
36877
36880
  children: position || "-"
36878
36881
  });
@@ -36880,7 +36883,7 @@ const getKeyIndicatorConfig = ({
36880
36883
  }, {
36881
36884
  label: t("Legal Form"),
36882
36885
  render: () => {
36883
- const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions);
36886
+ const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions || options?.subCategory);
36884
36887
  if (subCategory?.length > 22) {
36885
36888
  const _subCategory = truncateString(subCategory, 22);
36886
36889
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
@@ -36901,45 +36904,49 @@ const getKeyIndicatorConfig = ({
36901
36904
  }, {
36902
36905
  label: t("Products"),
36903
36906
  render: () => {
36904
- if ((data?.products || []).length === 0) {
36905
- return "-";
36906
- }
36907
- return /*#__PURE__*/jsxRuntime.jsx("div", {
36908
- style: {
36909
- display: "flex",
36910
- flexWrap: "wrap"
36911
- },
36912
- children: data?.products?.map(product => {
36913
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
36914
- color: "processing",
36907
+ const clientProducts = getAllProducts(data?.clients || []);
36908
+ const supplierProducts = getAllProducts(data?.suppliers || []);
36909
+ const locationProducts = getAllProducts(data?.locationSuppliers || []);
36910
+ const allProducts = [...clientProducts, ...supplierProducts, ...locationProducts];
36911
+ const uniqueProducts = [...new Set(allProducts)];
36912
+ const products = findOptions(uniqueProducts, options?.mineralOptions || options?.minerals);
36913
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
36914
+ children: products.length > 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
36915
+ style: {
36916
+ display: "flex",
36917
+ flexWrap: "wrap"
36918
+ },
36919
+ children: /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
36920
+ values: products,
36921
+ limit: 3,
36922
+ tagColor: "processing",
36915
36923
  style: {
36916
- color: "#1677FF",
36917
- marginBottom: 8
36918
- },
36919
- children: t(product)
36920
- }, product);
36921
- })
36924
+ fontWeight: "normal",
36925
+ fontSize: 14
36926
+ }
36927
+ })
36928
+ }) : "-"
36922
36929
  });
36923
36930
  }
36924
36931
  }, {
36925
36932
  label: t("Associated Mine Sites"),
36926
36933
  render: () => {
36927
36934
  return /*#__PURE__*/jsxRuntime.jsx("div", {
36928
- children: data?.associatedMineSites || 0
36935
+ children: data?.locationSuppliers?.length || 0
36929
36936
  });
36930
36937
  }
36931
36938
  }, {
36932
36939
  label: t("Identified Suppliers"),
36933
36940
  render: () => {
36934
36941
  return /*#__PURE__*/jsxRuntime.jsx("div", {
36935
- children: data?.identifiedSuppliers || 0
36942
+ children: data?.suppliers?.length || 0
36936
36943
  });
36937
36944
  }
36938
36945
  }, {
36939
36946
  label: t("Identified Customers"),
36940
36947
  render: () => {
36941
36948
  return /*#__PURE__*/jsxRuntime.jsx("div", {
36942
- children: data?.identifiedCustomers || 0
36949
+ children: data?.clients?.length || 0
36943
36950
  });
36944
36951
  }
36945
36952
  }];
@@ -37240,7 +37247,8 @@ const InformationAvailability = ({
37240
37247
  t = () => {},
37241
37248
  id,
37242
37249
  subject,
37243
- partners
37250
+ partners,
37251
+ APP
37244
37252
  }) => {
37245
37253
  const defaultFetchConfig = React.useMemo(() => ({
37246
37254
  basepath: subject === "stakeholder" ? "stakeholder" : "location",
@@ -37249,10 +37257,10 @@ const InformationAvailability = ({
37249
37257
  stop: !id || selectedPartners?.loading,
37250
37258
  filters: {
37251
37259
  // datastakeId: id,
37252
- scope: subject === "stakeholder" ? "operatorInfo" : "locationInfo",
37260
+ scope: subject === "stakeholder" ? APP === "nashiriki" ? "operator" : "operatorInfo" : APP === "nashiriki" ? "nashiriki" : "locationInfo",
37253
37261
  sources: selectedPartners?.partners || []
37254
37262
  }
37255
- }), [id, selectedPartners]);
37263
+ }), [id, selectedPartners, APP]);
37256
37264
  const {
37257
37265
  data,
37258
37266
  loading
@@ -37383,12 +37391,13 @@ const getFilterConfig = ({
37383
37391
  operatorData = {},
37384
37392
  options = {},
37385
37393
  filters = {},
37386
- t = () => {}
37394
+ t = () => {},
37395
+ APP
37387
37396
  }) => {
37388
37397
  const productSet = new Set();
37389
37398
  const allTradeMineralOptions = [...(operatorData?.suppliers || []), ...(operatorData?.clients || []), ...(operatorData?.locationSuppliers || [])].flatMap(trade => (trade?.products || []).filter(product => !!product?.typeOfProduct && !productSet.has(product.typeOfProduct)).map(product => {
37390
37399
  productSet.add(product.typeOfProduct);
37391
- const label = options?.minerals?.find(mineral => mineral.value === product.typeOfProduct)?.label;
37400
+ const label = options?.[APP !== 'nashiriki' ? 'mineralOptions' : 'minerals']?.find(mineral => mineral.value === product.typeOfProduct)?.label;
37392
37401
  return {
37393
37402
  value: product.typeOfProduct,
37394
37403
  label: label ?? product.typeOfProduct
@@ -37419,30 +37428,31 @@ const getLeft = (data = {}, mapChildren = () => {}, supplierLocations = []) => {
37419
37428
  return mapChildren([location], location.connect, "left");
37420
37429
  }).flat().filter(d => !!d);
37421
37430
  };
37422
- const mapItem = (data, options, goTo, getRedirectLink) => {
37431
+ const mapItem = (data, options, goTo, getRedirectLink, operatorData = {}, APP) => {
37423
37432
  const {
37424
37433
  positionSupplyChainOptions,
37425
- locationCategories
37434
+ locationCategories,
37435
+ optionPositionSupplyChain
37426
37436
  } = options || {};
37427
37437
  return {
37428
- id: data.datastakeId || "-",
37429
- datastakeId: data.datastakeId || "-",
37438
+ id: data.datastakeId || operatorData?.id || "-",
37439
+ datastakeId: data.datastakeId || operatorData?.datastakeId || "-",
37430
37440
  leftIcon: leftIcons[data.type === "mineSite" ? "location" : "stakeholder"],
37431
- name: data.name || "-",
37432
- subTitle: findOptions(data.type, [...(positionSupplyChainOptions || []), ...(locationCategories || [])]),
37441
+ name: data.name || operatorData?.name || "-",
37442
+ subTitle: findOptions(data.type || operatorData?.positionSupplyChain, [...(positionSupplyChainOptions || optionPositionSupplyChain || []), ...(locationCategories || [])]),
37433
37443
  leftBackground: data.type === "mineSite" ? leftBackgroundColorLocation : leftBackgroundColorStakeholder,
37434
37444
  topIcon: topIcons[data.type],
37435
37445
  country: {
37436
- label: findOptions(data.country, options?.countries || []),
37437
- value: data.country
37446
+ label: findOptions(data.country || operatorData?.country, options?.countries || []),
37447
+ value: data.country || operatorData?.country
37438
37448
  },
37439
37449
  totalSources: data.sources ?? 0,
37440
37450
  volume: data?.volume || "",
37441
37451
  onClick: function () {
37442
37452
  if (data.type === "mineSite") {
37443
- return goTo(getRedirectLink(`/app/summary/scl/${data.datastakeId}`));
37453
+ return goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'summary/scl' : 'mine-summary'}/${data.datastakeId}`));
37444
37454
  }
37445
- return goTo(getRedirectLink(`/app/summary/operators/${data.datastakeId}`));
37455
+ return goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'summary/operators' : 'operator-summary'}/${data.datastakeId}`));
37446
37456
  }
37447
37457
  };
37448
37458
  };
@@ -37453,26 +37463,30 @@ const useTradeRelationship = ({
37453
37463
  options,
37454
37464
  goTo,
37455
37465
  getRedirectLink,
37456
- filters
37466
+ filters,
37467
+ operatorData,
37468
+ APP
37457
37469
  }) => {
37458
37470
  const [graphData, setGraphData] = React.useState({});
37459
37471
  const [loading, setLoading] = React.useState(false);
37460
37472
  const [fetchedProducts, setFetchedProducts] = React.useState(false);
37461
37473
  const config = React.useMemo(() => ({
37462
37474
  basepath: "analytics",
37463
- url: "/widgets/trade-connection-map",
37475
+ url: `/widgets/trade-relationship-map`,
37464
37476
  filters: {
37477
+ datastakeId: id,
37465
37478
  product: filters?.products,
37466
37479
  sources: selectedPartners?.partners || []
37467
- }
37468
- }), [id, filters?.products, selectedPartners?.partners]);
37480
+ },
37481
+ stop: !selectedPartners?.partners?.length || selectedPartners?.loading
37482
+ }), [id, filters?.products, selectedPartners?.partners, selectedPartners?.loading]);
37469
37483
  const {
37470
37484
  data
37471
37485
  } = useWidgetFetch({
37472
37486
  config: config
37473
37487
  });
37474
37488
  const mapItem$1 = data => {
37475
- return mapItem(data, options, goTo, getRedirectLink);
37489
+ return mapItem(data, options, goTo, getRedirectLink, operatorData, APP);
37476
37490
  };
37477
37491
  React.useEffect(() => {
37478
37492
  if (id && selectedPartners?.partners?.length > 0 && fetchedProducts) {
@@ -37545,9 +37559,6 @@ const useTradeRelationship = ({
37545
37559
  right: mapChildren(data.clients, data.datastakeId, "right")?.filter(d => !!d),
37546
37560
  left: getLeft(data, mapChildren, supplierLocations)
37547
37561
  };
37548
- console.log({
37549
- graphData
37550
- });
37551
37562
  setGraphData(graphData);
37552
37563
  } catch (err) {
37553
37564
  setGraphData({});
@@ -37557,7 +37568,7 @@ const useTradeRelationship = ({
37557
37568
  };
37558
37569
  _fetch();
37559
37570
  }
37560
- }, [filters?.products, id, selectedPartners, fetchedProducts]);
37571
+ }, [filters?.products, id, selectedPartners, fetchedProducts, operatorData, options, goTo, getRedirectLink, data]);
37561
37572
  return {
37562
37573
  graphData,
37563
37574
  loading,
@@ -37580,7 +37591,8 @@ function TradeRelationship({
37580
37591
  filtersConfig,
37581
37592
  onFilterChange = () => {},
37582
37593
  renderTooltipItems = () => [],
37583
- getTotal = () => 0
37594
+ getTotal = () => 0,
37595
+ onRenderComplete = () => {}
37584
37596
  }) {
37585
37597
  const reactFlowWrapper = React.useRef(null);
37586
37598
  const [nodes, setNodes] = react.useNodesState([]);
@@ -37593,6 +37605,23 @@ function TradeRelationship({
37593
37605
  const [activeNode, setActiveNode] = React.useState(null);
37594
37606
  // const [initCenter, setInitCenter] = useState(true);
37595
37607
  const [associatedNodes, setAssociatedNodes] = React.useState(null);
37608
+ const isFullyRenderedRef = React.useRef(false);
37609
+ const [isFullyRendered, setIsFullyRendered] = React.useState(false);
37610
+ React.useEffect(() => {
37611
+ isFullyRenderedRef.current = false;
37612
+ setIsFullyRendered(false);
37613
+ setActiveNode(null);
37614
+ }, [data]);
37615
+ React.useEffect(() => {
37616
+ if (nodes.length > 0 && edges.length > 0 && !isFullyRenderedRef.current) {
37617
+ const timeoutId = setTimeout(() => {
37618
+ isFullyRenderedRef.current = true;
37619
+ setIsFullyRendered(true);
37620
+ onRenderComplete(true);
37621
+ }, 200);
37622
+ return () => clearTimeout(timeoutId);
37623
+ }
37624
+ }, [nodes.length, edges.length, associatedNodes]);
37596
37625
  React.useEffect(() => {
37597
37626
  setActiveNode(null);
37598
37627
  }, [data]);
@@ -37632,7 +37661,7 @@ function TradeRelationship({
37632
37661
  return;
37633
37662
  }
37634
37663
  const _nodes = [{
37635
- id: data.id,
37664
+ id: data.id?.toString(),
37636
37665
  type: "expandedNode",
37637
37666
  position: {
37638
37667
  x: xInit,
@@ -37644,10 +37673,10 @@ function TradeRelationship({
37644
37673
  if (isBilateral) {
37645
37674
  (data.sources || []).forEach(source => {
37646
37675
  const hasPrev = false;
37647
- _edges.push({
37676
+ const edge = {
37648
37677
  id: `e-${data.id}-${source}`,
37649
- source: source,
37650
- type: "default",
37678
+ source: source?.toString(),
37679
+ type: "defaultEdge",
37651
37680
  target: data?.id?.toString(),
37652
37681
  sourceHandle: "left",
37653
37682
  targetHandle: "right",
@@ -37661,7 +37690,8 @@ function TradeRelationship({
37661
37690
  tooltipTitle,
37662
37691
  moreLeft: false
37663
37692
  }
37664
- });
37693
+ };
37694
+ _edges.push(edge);
37665
37695
  });
37666
37696
  }
37667
37697
  const mapChildren = ({
@@ -37702,7 +37732,7 @@ function TradeRelationship({
37702
37732
  (ch.sources || []).forEach(source => {
37703
37733
  const hasPrev = _prevNodes.find(p => p.id === source);
37704
37734
  const isCustom = !hasPrev ? true : prevChildren.includes(source) ? false : true;
37705
- _edges.push({
37735
+ const edge = {
37706
37736
  id: `e-${ch.id}-${source}`,
37707
37737
  source: hasPrev ? source : ch?.id?.toString(),
37708
37738
  type: isCustom ? "verticalPath" : "defaultEdge",
@@ -37720,7 +37750,8 @@ function TradeRelationship({
37720
37750
  tooltipTitle,
37721
37751
  moreLeft: prevChildren.length > children.length
37722
37752
  }
37723
- });
37753
+ };
37754
+ _edges.push(edge);
37724
37755
  if (isCustom) {
37725
37756
  customIndex += 1;
37726
37757
  }
@@ -37759,11 +37790,24 @@ function TradeRelationship({
37759
37790
  prevChildren: !isBilateral ? [data.id] : [],
37760
37791
  maxHeight: 0
37761
37792
  });
37793
+
37794
+ // Check for potential ID mismatches
37795
+ const nodeIds = _nodes.map(n => n.id);
37796
+ _edges.filter(e => {
37797
+ const sourceExists = nodeIds.includes(e.source);
37798
+ const targetExists = nodeIds.includes(e.target);
37799
+ return !sourceExists || !targetExists;
37800
+ });
37801
+
37802
+ // Set nodes first
37762
37803
  setNodes(_nodes);
37763
- setEdges(_edges);
37764
- }, [data, activeNode]);
37804
+ const timeoutId = setTimeout(() => {
37805
+ setEdges(_edges);
37806
+ }, 100); // 100ms is imperceptible to users but ensures React Flow is ready
37765
37807
 
37766
- // Used to find associated nodes, when a node is selected
37808
+ // Cleanup to prevent memory leaks if component unmounts quickly
37809
+ return () => clearTimeout(timeoutId);
37810
+ }, [data, activeNode]);
37767
37811
  React.useEffect(() => {
37768
37812
  if (activeNode) {
37769
37813
  let _associatedNodesRight = [activeNode];
@@ -37829,7 +37873,7 @@ function TradeRelationship({
37829
37873
  });
37830
37874
  },
37831
37875
  ref: reactFlowWrapper
37832
- });
37876
+ }, JSON.stringify(nodes) + JSON.stringify(edges));
37833
37877
  }
37834
37878
  var TradeRelationship$1 = withProvider(TradeRelationship);
37835
37879
 
@@ -37840,9 +37884,11 @@ const TradeRelationships = ({
37840
37884
  selectedPartners = {},
37841
37885
  id,
37842
37886
  options = {},
37843
- getRedirectLink = () => {}
37887
+ getRedirectLink = () => {},
37888
+ APP
37844
37889
  }) => {
37845
37890
  const [filters, setFilters] = React.useState({});
37891
+ const [isFullyRendered, setIsFullyRendered] = React.useState(true);
37846
37892
  const onFilterChange = filters => {
37847
37893
  setFilters(p => ({
37848
37894
  ...p,
@@ -37854,9 +37900,10 @@ const TradeRelationships = ({
37854
37900
  operatorData,
37855
37901
  options,
37856
37902
  filters,
37857
- t
37903
+ t,
37904
+ APP
37858
37905
  });
37859
- }, [filters.products, t, options?.minerals, operatorData]);
37906
+ }, [filters.products, t, options?.mineralOptions, operatorData, options?.mineral, APP]);
37860
37907
  const {
37861
37908
  graphData,
37862
37909
  loading,
@@ -37868,7 +37915,9 @@ const TradeRelationships = ({
37868
37915
  options,
37869
37916
  goTo,
37870
37917
  getRedirectLink,
37871
- filters
37918
+ filters,
37919
+ operatorData,
37920
+ APP
37872
37921
  });
37873
37922
  React.useEffect(() => {
37874
37923
  const defaultProduct = filterConfig?.[0]?.options?.[0]?.value;
@@ -37888,7 +37937,7 @@ const TradeRelationships = ({
37888
37937
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
37889
37938
  title: t("Trade Relationships"),
37890
37939
  className: "flex flex-1 with-border-header no-p-body",
37891
- loading: loading,
37940
+ loading: loading || isFullyRendered,
37892
37941
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
37893
37942
  className: "flex flex-1 flex-column justify-content-center",
37894
37943
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -37911,7 +37960,10 @@ const TradeRelationships = ({
37911
37960
  minZoom: 0.4,
37912
37961
  tooltipTitle: "Trade",
37913
37962
  filtersConfig: filterConfig,
37914
- onFilterChange: onFilterChange
37963
+ onFilterChange: onFilterChange,
37964
+ onRenderComplete: data => {
37965
+ setIsFullyRendered(!data);
37966
+ }
37915
37967
  })
37916
37968
  })
37917
37969
  })
@@ -38142,8 +38194,7 @@ function StakeholderMappings({
38142
38194
  iconOffsetY = 250,
38143
38195
  t = s => s,
38144
38196
  emptyString = undefined,
38145
- isPdf = false,
38146
- zoomOutTransition = false
38197
+ isPdf = false
38147
38198
  }) {
38148
38199
  const reactFlowWrapper = React.useRef(null);
38149
38200
  const [nodes, setNodes] = react.useNodesState([]);
@@ -38404,7 +38455,6 @@ function StakeholderMappings({
38404
38455
  });
38405
38456
  }, [reactFlowWrapper.current, JSON.stringify(data), JSON.stringify(selectedIconNodes), isAllOpenDefault, isSelectable, isChanged, emptyString]);
38406
38457
  return /*#__PURE__*/jsxRuntime.jsx(BaseGraph, {
38407
- zoomOutTransition: zoomOutTransition,
38408
38458
  nodes: nodes,
38409
38459
  mandatoryNodesToFit: mandatoryNodesToFit,
38410
38460
  edges: edges,
@@ -38511,7 +38561,8 @@ const OperatorSummary = ({
38511
38561
  getRedirectLink = () => {},
38512
38562
  goBack = () => {},
38513
38563
  onIdChange = () => {},
38514
- breadcrumbs = []
38564
+ breadcrumbs = [],
38565
+ APP
38515
38566
  }) => {
38516
38567
  const {
38517
38568
  selectedItem,
@@ -38617,7 +38668,8 @@ const OperatorSummary = ({
38617
38668
  t: t,
38618
38669
  id: params?.id || selectedItem,
38619
38670
  subject: "stakeholder",
38620
- partners: partners
38671
+ partners: partners,
38672
+ APP: APP
38621
38673
  })
38622
38674
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
38623
38675
  children: /*#__PURE__*/jsxRuntime.jsx(TradeRelationships, {
@@ -38627,7 +38679,8 @@ const OperatorSummary = ({
38627
38679
  options: options,
38628
38680
  goTo: goTo,
38629
38681
  getRedirectLink: getRedirectLink,
38630
- operatorData: singleItemData
38682
+ operatorData: singleItemData,
38683
+ APP: APP
38631
38684
  })
38632
38685
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
38633
38686
  children: /*#__PURE__*/jsxRuntime.jsx(Governance, {
@@ -43112,10 +43165,10 @@ const IconNodesConfig = {
43112
43165
  emptyName: "no-traders"
43113
43166
  },
43114
43167
  government: {
43115
- name: "Government",
43168
+ name: "Governance",
43116
43169
  icon: "KYC",
43117
43170
  order: 3,
43118
- emptyName: "no-government"
43171
+ emptyName: "no-governance"
43119
43172
  },
43120
43173
  other: {
43121
43174
  name: "Other",
@@ -43133,18 +43186,19 @@ const getStakeholderMappingData = ({
43133
43186
  t,
43134
43187
  goTo,
43135
43188
  selectedPartners,
43136
- mainSubject
43189
+ mainSubject,
43190
+ APP
43137
43191
  }) => {
43138
43192
  const _data = data;
43139
43193
  const mainSubjectData = _data?.[mainSubject];
43140
43194
  return {
43141
- id: mainSubjectData?.datastakeId || "",
43142
- name: mainSubjectData?.name || "",
43195
+ id: mainSubjectData?.datastakeId || locationData?.datastakeId || "",
43196
+ name: mainSubjectData?.name || locationData?.name || "",
43143
43197
  country: {
43144
- label: findOptions(mainSubjectData?.country, options?.countries) || "",
43145
- value: (mainSubjectData?.country || "").toLowerCase() || ""
43198
+ label: findOptions(mainSubjectData?.country || locationData?.country, options?.countries) || "",
43199
+ value: (mainSubjectData?.country || locationData?.country || "").toLowerCase() || ""
43146
43200
  },
43147
- onClick: () => goTo(`/app/view/production-sites/${mainSubjectData?.datastakeId}`),
43201
+ onClick: () => goTo(`/app/view/${APP === 'nashiriki' ? 'scl' : 'production-sites'}/${mainSubjectData?.datastakeId || locationData?.datastakeId}`),
43148
43202
  totalSources: selectedPartners?.partners?.length || 0,
43149
43203
  backgroundColor: "#FFD6E7",
43150
43204
  iconColor: "#C41D7F",
@@ -43171,7 +43225,7 @@ const getStakeholderMappingData = ({
43171
43225
  icon: "DashboardStakeholder",
43172
43226
  onClick: () => {
43173
43227
  if (child?.type === "operator") {
43174
- goTo(`/app/summary/operators/${child.datastakeId}`);
43228
+ goTo(`/app/${APP === 'nashiriki' ? 'summary/operators' : 'operator-summary'}/${child.datastakeId}`);
43175
43229
  return;
43176
43230
  }
43177
43231
  goTo(`/app/view/stakeholders/${child.datastakeId}`);
@@ -43193,7 +43247,8 @@ const StakeholderMapping = ({
43193
43247
  options = {},
43194
43248
  goTo = () => {},
43195
43249
  selectedPartners = {},
43196
- locationData = {}
43250
+ locationData = {},
43251
+ APP
43197
43252
  }) => {
43198
43253
  const defaultFilter = React.useMemo(() => {
43199
43254
  return {
@@ -43207,7 +43262,7 @@ const StakeholderMapping = ({
43207
43262
  coreSubject: "location",
43208
43263
  filterBySources: false,
43209
43264
  metrics: {
43210
- operator: ['operator', 'operator.clientLocation'],
43265
+ operator: ['operator.locationClient'],
43211
43266
  government: ['custom.stakeholderId', 'governance'],
43212
43267
  trader: ['trade'],
43213
43268
  other: ['civilSociety', 'international']
@@ -43230,7 +43285,8 @@ const StakeholderMapping = ({
43230
43285
  t,
43231
43286
  goTo,
43232
43287
  selectedPartners,
43233
- mainSubject: "mine"
43288
+ mainSubject: "mine",
43289
+ APP
43234
43290
  });
43235
43291
  }, [data, locationData, id, options, t, goTo, selectedPartners]);
43236
43292
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
@@ -43448,7 +43504,8 @@ const MineSummary = ({
43448
43504
  getRedirectLink = () => {},
43449
43505
  goBack = () => {},
43450
43506
  onIdChange = () => {},
43451
- breadcrumbs = []
43507
+ breadcrumbs = [],
43508
+ APP
43452
43509
  }) => {
43453
43510
  const {
43454
43511
  selectedItem,
@@ -43493,7 +43550,7 @@ const MineSummary = ({
43493
43550
  tooltip: t("Details"),
43494
43551
  icon: "FileEdit",
43495
43552
  onClick: () => {
43496
- goTo(getRedirectLink(`/app/view/production-sites/${params?.id ? params?.id : selectedItem}`));
43553
+ goTo(getRedirectLink(`/app/view/${APP === 'nashiriki' ? 'scl' : 'production-sites'}/${params?.id ? params?.id : selectedItem}`));
43497
43554
  }
43498
43555
  }, {
43499
43556
  tooltip: t("Find Data"),
@@ -43554,7 +43611,8 @@ const MineSummary = ({
43554
43611
  selectedPartners: selectedPartners,
43555
43612
  t: t,
43556
43613
  id: params?.id || selectedItem,
43557
- partners: partners
43614
+ partners: partners,
43615
+ APP: APP
43558
43616
  })
43559
43617
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
43560
43618
  children: /*#__PURE__*/jsxRuntime.jsx(StakeholderMapping, {