datastake-daf 0.6.831 → 0.6.832

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 (30) hide show
  1. package/dist/components/index.js +2251 -2197
  2. package/dist/hooks/index.js +8 -0
  3. package/dist/pages/index.js +2027 -358
  4. package/dist/services/index.js +8 -0
  5. package/dist/utils/index.js +1 -0
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/Screens/ConflictManagement/components/KeyIndicators/config.js +106 -0
  8. package/src/@daf/core/components/Screens/ConflictManagement/components/KeyIndicators/index.js +47 -0
  9. package/src/@daf/core/components/Screens/ConflictManagement/components/MineSite/helper.js +3 -0
  10. package/src/@daf/core/components/Screens/ConflictManagement/components/MineSite/index.js +218 -0
  11. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +32 -0
  12. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +73 -0
  13. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +86 -0
  14. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +102 -0
  15. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/config.js +34 -0
  16. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +107 -0
  17. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/config.js +5 -0
  18. package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/index.js +77 -0
  19. package/src/@daf/core/components/Screens/ConflictManagement/index.js +136 -0
  20. package/src/@daf/pages/Events/Testimonials/columns.js +1 -1
  21. package/src/@daf/pages/Events/columns.js +2 -3
  22. package/src/@daf/pages/Locations/columns.js +1 -1
  23. package/src/@daf/services/DashboardService.js +9 -0
  24. package/src/constants/locales/en/translation.js +1 -0
  25. package/src/pages.js +4 -1
  26. package/build/favicon.ico +0 -0
  27. package/build/logo192.png +0 -0
  28. package/build/logo512.png +0 -0
  29. package/build/manifest.json +0 -25
  30. package/build/robots.txt +0 -3
@@ -5445,7 +5445,7 @@ const getMetaPlaceholer = (inputMeta, t) => inputMeta.notApplicable ? t("Not app
5445
5445
  * @param {string} [filterCond=null] - Filter condition.
5446
5446
  * @returns {Object[]} - Filtered options.
5447
5447
  */
5448
- function filterOptions$1(options, filters, formsValue = {}, repeatValues = {}, filterCond = null) {
5448
+ function filterOptions$2(options, filters, formsValue = {}, repeatValues = {}, filterCond = null) {
5449
5449
  const isOrCond = filterCond !== "and";
5450
5450
  const objFilter = {};
5451
5451
  filters.forEach(f => {
@@ -6490,7 +6490,7 @@ const useHeader = ({
6490
6490
  };
6491
6491
 
6492
6492
  const {
6493
- useToken: useToken$b
6493
+ useToken: useToken$c
6494
6494
  } = antd.theme;
6495
6495
  function BreadCrumbs({
6496
6496
  breadcrumbs = [],
@@ -6499,7 +6499,7 @@ function BreadCrumbs({
6499
6499
  const [splitIndex, setSplitIndex] = React.useState(0);
6500
6500
  const {
6501
6501
  token
6502
- } = useToken$b();
6502
+ } = useToken$c();
6503
6503
  const _renderBreadcrumb = (b, i, isLast, noOnClickLast = false) => {
6504
6504
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
6505
6505
  className: "flex breadcrumb-item",
@@ -6664,7 +6664,7 @@ const MultiSelectStyled = styled__default["default"](antd.Select)`
6664
6664
  `;
6665
6665
 
6666
6666
  const {
6667
- useToken: useToken$a
6667
+ useToken: useToken$b
6668
6668
  } = antd.theme;
6669
6669
 
6670
6670
  /**
@@ -6757,7 +6757,7 @@ function Multiselect({
6757
6757
  }) {
6758
6758
  const {
6759
6759
  token
6760
- } = useToken$a();
6760
+ } = useToken$b();
6761
6761
  const [selectValue, setSelectValue] = React.useState(Array.isArray(defaultSelected) ? defaultSelected.length > 0 ? defaultSelected : [] : [defaultSelected]);
6762
6762
  function onSelectChange(value) {
6763
6763
  if (!canUnselectLast && value.length === 0) {
@@ -7476,6 +7476,14 @@ class DashboardService extends BaseService {
7476
7476
  isUserManager: true
7477
7477
  });
7478
7478
  }
7479
+
7480
+ // getWidgetConflictManagement({ url, params = {}, filters = {} }) {
7481
+ // return this.apiGet({
7482
+ // url: `/dashboard/conflict-management${url}`,
7483
+ // params: { ...params, ...filters },
7484
+ // isApp: true,
7485
+ // });
7486
+ // }
7479
7487
  }
7480
7488
  var DashboardService$1 = createLazyService(DashboardService);
7481
7489
 
@@ -7487,7 +7495,7 @@ var DashboardService$1 = createLazyService(DashboardService);
7487
7495
  // basePath: string,
7488
7496
  // }
7489
7497
 
7490
- const useWidgetFetch = ({
7498
+ const useWidgetFetch$1 = ({
7491
7499
  config,
7492
7500
  getData = DashboardService$1.getWidget,
7493
7501
  onFetch = () => {}
@@ -7555,7 +7563,7 @@ function KeyIndicatorNavigateLabel({
7555
7563
  });
7556
7564
  }
7557
7565
 
7558
- const getRowConfig$1 = ({
7566
+ const getRowConfig$2 = ({
7559
7567
  t,
7560
7568
  data = {},
7561
7569
  goTo,
@@ -7624,7 +7632,7 @@ const getRowConfig$1 = ({
7624
7632
  const MOBILE_W = 850;
7625
7633
  const MOBILE_WIDTH = `max-width: ${MOBILE_W}px`;
7626
7634
 
7627
- const Style$l = styled__default["default"].div`
7635
+ const Style$m = styled__default["default"].div`
7628
7636
  overflow-x: auto;
7629
7637
 
7630
7638
  @media (${MOBILE_WIDTH}) {
@@ -8099,7 +8107,7 @@ function KeyIndicatorsWidget({
8099
8107
  className: formatClassname(["flex-1 h-w-btn-header with-border-header", widgetClassName]),
8100
8108
  title: noTitle ? undefined : t(title),
8101
8109
  noTitle: noTitle,
8102
- children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$l, {
8110
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$m, {
8103
8111
  className: formatClassname(["flex", className]),
8104
8112
  children: config.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
8105
8113
  className: `row-item ${c.icon ? 'row-item-with-icon' : ''}`,
@@ -8162,7 +8170,7 @@ function Label$1({
8162
8170
  }
8163
8171
  KeyIndicatorsWidget.displayName = 'KeyIndicatorsWidget';
8164
8172
 
8165
- const defaultFetchConfig$6 = {
8173
+ const defaultFetchConfig$7 = {
8166
8174
  basepath: "analytics",
8167
8175
  url: '/widgets/key-informations',
8168
8176
  filters: {
@@ -8170,7 +8178,7 @@ const defaultFetchConfig$6 = {
8170
8178
  metrics: ['connections', 'documents', 'mineSites', 'operators', 'sources']
8171
8179
  }
8172
8180
  };
8173
- function KeyIndicators$1({
8181
+ function KeyIndicators$2({
8174
8182
  selectedSources = {},
8175
8183
  theme = {},
8176
8184
  getRedirectLink = () => {},
@@ -8179,9 +8187,9 @@ function KeyIndicators$1({
8179
8187
  APP
8180
8188
  }) {
8181
8189
  const fetchConfig = React.useMemo(() => ({
8182
- ...defaultFetchConfig$6,
8190
+ ...defaultFetchConfig$7,
8183
8191
  filters: {
8184
- ...defaultFetchConfig$6.filters,
8192
+ ...defaultFetchConfig$7.filters,
8185
8193
  sources: selectedSources?.partners || []
8186
8194
  },
8187
8195
  stop: selectedSources?.loading
@@ -8189,11 +8197,11 @@ function KeyIndicators$1({
8189
8197
  const {
8190
8198
  data,
8191
8199
  loading
8192
- } = useWidgetFetch({
8200
+ } = useWidgetFetch$1({
8193
8201
  config: fetchConfig
8194
8202
  });
8195
8203
  const config = React.useMemo(() => {
8196
- return getRowConfig$1({
8204
+ return getRowConfig$2({
8197
8205
  t,
8198
8206
  data: {
8199
8207
  ...data
@@ -8212,7 +8220,7 @@ function KeyIndicators$1({
8212
8220
  className: "small-content"
8213
8221
  });
8214
8222
  }
8215
- KeyIndicators$1.propTypes = {
8223
+ KeyIndicators$2.propTypes = {
8216
8224
  selectedSources: PropTypes__default["default"].object,
8217
8225
  theme: PropTypes__default["default"].object,
8218
8226
  getRedirectLink: PropTypes__default["default"].func,
@@ -8220,7 +8228,7 @@ KeyIndicators$1.propTypes = {
8220
8228
  goTo: PropTypes__default["default"].func
8221
8229
  };
8222
8230
 
8223
- const Style$k = styled__default["default"].div`
8231
+ const Style$l = styled__default["default"].div`
8224
8232
  display: flex;
8225
8233
  flex-direction: row;
8226
8234
  position: relative;
@@ -9792,7 +9800,7 @@ function LocationIcon({
9792
9800
  });
9793
9801
  }
9794
9802
 
9795
- const Style$j = styled__default["default"].div`
9803
+ const Style$k = styled__default["default"].div`
9796
9804
  .main {
9797
9805
  width: 24px;
9798
9806
  height: 24px;
@@ -9937,7 +9945,7 @@ function StakeholderIcon({
9937
9945
  onClickLink: () => onClickLink(marker)
9938
9946
  }),
9939
9947
  getPopupContainer: () => document.getElementById("map"),
9940
- children: /*#__PURE__*/jsxRuntime.jsx(Style$j
9948
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$k
9941
9949
  // onClick={toggleOpen}
9942
9950
  , {
9943
9951
  className: `map-marker marker closed`,
@@ -9950,7 +9958,7 @@ function StakeholderIcon({
9950
9958
  })
9951
9959
  });
9952
9960
  }
9953
- return /*#__PURE__*/jsxRuntime.jsxs(Style$j, {
9961
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$k, {
9954
9962
  onClick: toggleOpen,
9955
9963
  className: `map-marker marker ${isActive ? "opened" : "closed"}`,
9956
9964
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10818,7 +10826,7 @@ const useMap = ({
10818
10826
  };
10819
10827
  };
10820
10828
 
10821
- const Style$i = styled__default["default"].div`
10829
+ const Style$j = styled__default["default"].div`
10822
10830
  position: relative;
10823
10831
  width: 100%;
10824
10832
  height: 100%;
@@ -10891,7 +10899,7 @@ function ComponentWithFocus({
10891
10899
  setClosed(false);
10892
10900
  }
10893
10901
  }, [closed]);
10894
- return /*#__PURE__*/jsxRuntime.jsxs(Style$i, {
10902
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$j, {
10895
10903
  className: className,
10896
10904
  ref: ref,
10897
10905
  style: style,
@@ -10903,7 +10911,7 @@ function ComponentWithFocus({
10903
10911
  });
10904
10912
  }
10905
10913
 
10906
- const Style$h = styled__default["default"].div`
10914
+ const Style$i = styled__default["default"].div`
10907
10915
  position: absolute;
10908
10916
  top: 24px;
10909
10917
  left: 24px;
@@ -11078,7 +11086,7 @@ function Filters({
11078
11086
  return null;
11079
11087
  }
11080
11088
  };
11081
- return /*#__PURE__*/jsxRuntime.jsxs(Style$h, {
11089
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$i, {
11082
11090
  children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
11083
11091
  onClick: () => setOpened(p => !p),
11084
11092
  children: [t("Filter"), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -11159,7 +11167,7 @@ function Map$1({
11159
11167
  isSatellite
11160
11168
  });
11161
11169
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
11162
- children: /*#__PURE__*/jsxRuntime.jsxs(Style$k, {
11170
+ children: /*#__PURE__*/jsxRuntime.jsxs(Style$l, {
11163
11171
  className: formatClassname([showSider && activeMarker && "with-sider"]),
11164
11172
  children: [filtersConfig ? /*#__PURE__*/jsxRuntime.jsx(Filters, {
11165
11173
  t: t,
@@ -11296,7 +11304,7 @@ function SupplyChainMap({
11296
11304
  const {
11297
11305
  loading,
11298
11306
  data
11299
- } = useWidgetFetch({
11307
+ } = useWidgetFetch$1({
11300
11308
  config: defaultConfig
11301
11309
  });
11302
11310
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
@@ -11368,7 +11376,7 @@ function PrimaryNode({
11368
11376
  style: {
11369
11377
  opacity: 0
11370
11378
  }
11371
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$g, {
11379
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$h, {
11372
11380
  $isPdf: isPdf,
11373
11381
  className: "flex",
11374
11382
  children: [" ", /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -11479,7 +11487,7 @@ function PrimaryNode({
11479
11487
  })]
11480
11488
  });
11481
11489
  }
11482
- const Style$g = styled__default["default"].div`
11490
+ const Style$h = styled__default["default"].div`
11483
11491
  width: ${MAIN_NODE_WIDTH}px;
11484
11492
  height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
11485
11493
  display: flex;
@@ -11615,7 +11623,7 @@ function IconNode({
11615
11623
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
11616
11624
  title: data?.name,
11617
11625
  defaultOpen: data?.ONLY_IN_STORYBOOK,
11618
- children: /*#__PURE__*/jsxRuntime.jsx(Style$f, {
11626
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$g, {
11619
11627
  hoverColor: data?.iconHoverColor,
11620
11628
  children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
11621
11629
  theme: {
@@ -11658,7 +11666,7 @@ function IconNode({
11658
11666
  })]
11659
11667
  });
11660
11668
  }
11661
- const Style$f = styled__default["default"].div`
11669
+ const Style$g = styled__default["default"].div`
11662
11670
  height: 40px;
11663
11671
  width: 40px;
11664
11672
 
@@ -11709,14 +11717,14 @@ const Style$f = styled__default["default"].div`
11709
11717
  // components/Nodes/NameNode.jsx
11710
11718
  const NAME_CARD_WIDTH = 315;
11711
11719
  const {
11712
- useToken: useToken$9
11720
+ useToken: useToken$a
11713
11721
  } = antd.theme;
11714
11722
  function NameNode({
11715
11723
  data
11716
11724
  }) {
11717
11725
  const {
11718
11726
  token
11719
- } = useToken$9();
11727
+ } = useToken$a();
11720
11728
  const translateFN = typeof data?.t === "function" ? data.t : key => key;
11721
11729
  const isPdf = data?.isPdf;
11722
11730
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -11736,7 +11744,7 @@ function NameNode({
11736
11744
  style: {
11737
11745
  opacity: 0
11738
11746
  }
11739
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
11747
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
11740
11748
  $isPdf: isPdf,
11741
11749
  style: {
11742
11750
  opacity: data.isEmpty ? 0.5 : 1
@@ -11824,7 +11832,7 @@ function NameNode({
11824
11832
  })]
11825
11833
  });
11826
11834
  }
11827
- const Style$e = styled__default["default"].div`
11835
+ const Style$f = styled__default["default"].div`
11828
11836
  width: ${NAME_CARD_WIDTH}px;
11829
11837
  height: 55px;
11830
11838
  display: flex;
@@ -11855,7 +11863,7 @@ const Style$e = styled__default["default"].div`
11855
11863
  }
11856
11864
  `;
11857
11865
 
11858
- const Style$d = styled__default["default"].div`
11866
+ const Style$e = styled__default["default"].div`
11859
11867
  width: 405px;
11860
11868
  display: flex;
11861
11869
  height: 140px;
@@ -11966,7 +11974,7 @@ function ExpandedNode({
11966
11974
  style: {
11967
11975
  opacity: 0
11968
11976
  }
11969
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
11977
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
11970
11978
  style: {
11971
11979
  opacity
11972
11980
  },
@@ -12905,7 +12913,7 @@ const CustomLegend = ({
12905
12913
  };
12906
12914
 
12907
12915
  const {
12908
- useToken: useToken$8
12916
+ useToken: useToken$9
12909
12917
  } = antd.theme;
12910
12918
 
12911
12919
  /**
@@ -12996,7 +13004,7 @@ function LineChart({
12996
13004
  const chartRef = React__default["default"].useRef(null);
12997
13005
  const {
12998
13006
  token
12999
- } = useToken$8();
13007
+ } = useToken$9();
13000
13008
  const {
13001
13009
  legendEnabled,
13002
13010
  legendItems,
@@ -13218,7 +13226,7 @@ Identification.propTypes = {
13218
13226
  theme: PropTypes__default["default"].object
13219
13227
  };
13220
13228
 
13221
- const Style$c = styled__default["default"].div`
13229
+ const Style$d = styled__default["default"].div`
13222
13230
  position: absolute;
13223
13231
  display: flex;
13224
13232
  gap: 12px;
@@ -13233,7 +13241,7 @@ function Tooltip({
13233
13241
  mouseY = 0,
13234
13242
  children = null
13235
13243
  }) {
13236
- return /*#__PURE__*/jsxRuntime.jsx(Style$c, {
13244
+ return /*#__PURE__*/jsxRuntime.jsx(Style$d, {
13237
13245
  style: {
13238
13246
  top: mouseY,
13239
13247
  left: mouseX
@@ -13651,7 +13659,7 @@ Chart.propTypes = {
13651
13659
  mouseYOffset: PropTypes__default["default"].any
13652
13660
  };
13653
13661
 
13654
- const getColors = theme => {
13662
+ const getColors$1 = theme => {
13655
13663
  return [theme.colorPrimary8, theme.colorPrimary7, theme.colorPrimary5, theme.colorPrimary6, theme.colorPrimary4];
13656
13664
  };
13657
13665
 
@@ -13666,7 +13674,7 @@ function Locations({
13666
13674
  const {
13667
13675
  countries = []
13668
13676
  } = options;
13669
- const colors = getColors(theme);
13677
+ const colors = getColors$1(theme);
13670
13678
  const pieData = React.useMemo(() => {
13671
13679
  // eslint-disable-next-line no-shadow-restricted-names
13672
13680
  const {
@@ -13889,7 +13897,7 @@ function ChartsContainer({
13889
13897
  const {
13890
13898
  loading,
13891
13899
  data
13892
- } = useWidgetFetch({
13900
+ } = useWidgetFetch$1({
13893
13901
  config: defaultConfig,
13894
13902
  onFetch: () => setPreviousRange(selectedRange)
13895
13903
  });
@@ -13996,7 +14004,7 @@ function SupplyChain({
13996
14004
  breadcrumbs: breadcrumbs
13997
14005
  }),
13998
14006
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
13999
- children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators$1, {
14007
+ children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators$2, {
14000
14008
  selectedSources: selectedPartners,
14001
14009
  theme: theme,
14002
14010
  t: t,
@@ -14099,7 +14107,7 @@ ActionWidget.propTypes = {
14099
14107
  onClick: PropTypes__default["default"].func
14100
14108
  };
14101
14109
 
14102
- const getRowConfig = ({
14110
+ const getRowConfig$1 = ({
14103
14111
  t,
14104
14112
  data = {},
14105
14113
  goTo,
@@ -14167,14 +14175,14 @@ const getRowConfig = ({
14167
14175
  })
14168
14176
  }];
14169
14177
 
14170
- const defaultFetchConfig$5 = {
14178
+ const defaultFetchConfig$6 = {
14171
14179
  basepath: "analytics",
14172
14180
  url: "/widgets/key-informations",
14173
14181
  filters: {
14174
14182
  metrics: ['locations', 'stakeholders', 'events', 'sources']
14175
14183
  }
14176
14184
  };
14177
- function KeyIndicators({
14185
+ function KeyIndicators$1({
14178
14186
  t = () => {},
14179
14187
  goTo = () => {},
14180
14188
  getRedirectLink = () => {},
@@ -14183,15 +14191,15 @@ function KeyIndicators({
14183
14191
  APP
14184
14192
  }) {
14185
14193
  const fetchConfig = React.useMemo(() => ({
14186
- ...defaultFetchConfig$5
14194
+ ...defaultFetchConfig$6
14187
14195
  }), []);
14188
14196
  const {
14189
14197
  data,
14190
14198
  loading
14191
- } = useWidgetFetch({
14199
+ } = useWidgetFetch$1({
14192
14200
  config: fetchConfig
14193
14201
  });
14194
- const config = React.useMemo(() => getRowConfig({
14202
+ const config = React.useMemo(() => getRowConfig$1({
14195
14203
  t,
14196
14204
  data: {
14197
14205
  ...data,
@@ -14390,11 +14398,11 @@ const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
14390
14398
  }
14391
14399
  };
14392
14400
 
14393
- const defaultFetchConfig$4 = {
14401
+ const defaultFetchConfig$5 = {
14394
14402
  basepath: "forms",
14395
14403
  url: "/location"
14396
14404
  };
14397
- function MineSites({
14405
+ function MineSites$1({
14398
14406
  t = () => {},
14399
14407
  goTo = () => {},
14400
14408
  getRedirectLink = () => {},
@@ -14416,7 +14424,7 @@ function MineSites({
14416
14424
  const [filters, setFilters] = React.useState({});
14417
14425
  const [activeTab, setActiveTab] = React.useState("location");
14418
14426
  const _formFetchConfig = React.useMemo(() => ({
14419
- ...defaultFetchConfig$4,
14427
+ ...defaultFetchConfig$5,
14420
14428
  params: {
14421
14429
  scope: "create",
14422
14430
  language: user?.language || "en"
@@ -14425,7 +14433,7 @@ function MineSites({
14425
14433
  const {
14426
14434
  data: _formData,
14427
14435
  loading: formLoading
14428
- } = useWidgetFetch({
14436
+ } = useWidgetFetch$1({
14429
14437
  config: _formFetchConfig
14430
14438
  });
14431
14439
  React.useEffect(() => {
@@ -14454,7 +14462,7 @@ function MineSites({
14454
14462
  data,
14455
14463
  loading,
14456
14464
  setData
14457
- } = useWidgetFetch({
14465
+ } = useWidgetFetch$1({
14458
14466
  config: dataFetchConfig
14459
14467
  });
14460
14468
  const tabs = React.useMemo(() => getTabs(t), [t]);
@@ -14807,7 +14815,7 @@ const useKnowledgeAccumulation = ({
14807
14815
  return chartConfig;
14808
14816
  };
14809
14817
 
14810
- const defaultFetchConfig$3 = {
14818
+ const defaultFetchConfig$4 = {
14811
14819
  basepath: "analytics",
14812
14820
  url: "/widgets/knowledge-accumulation",
14813
14821
  filters: {},
@@ -14822,7 +14830,7 @@ function AccumulationGraph({
14822
14830
  }) {
14823
14831
  const [timeFilter, setTimeFilter] = React.useState("monthly");
14824
14832
  const fetchConfig = React.useMemo(() => ({
14825
- ...defaultFetchConfig$3,
14833
+ ...defaultFetchConfig$4,
14826
14834
  filters: {
14827
14835
  section: section,
14828
14836
  tabSelected: tabSelected
@@ -14832,7 +14840,7 @@ function AccumulationGraph({
14832
14840
  const {
14833
14841
  data,
14834
14842
  loading
14835
- } = useWidgetFetch({
14843
+ } = useWidgetFetch$1({
14836
14844
  config: fetchConfig
14837
14845
  });
14838
14846
  const selectOptions = React.useMemo(() => [{
@@ -14878,7 +14886,7 @@ function AccumulationGraph({
14878
14886
  }
14879
14887
 
14880
14888
  const {
14881
- useToken: useToken$7
14889
+ useToken: useToken$8
14882
14890
  } = antd.theme;
14883
14891
 
14884
14892
  /**
@@ -14970,7 +14978,7 @@ function BarChart({
14970
14978
  const chartRef = React__default["default"].useRef(null);
14971
14979
  const {
14972
14980
  token
14973
- } = useToken$7();
14981
+ } = useToken$8();
14974
14982
  const {
14975
14983
  legendEnabled,
14976
14984
  legendItems,
@@ -15156,7 +15164,7 @@ const useContributionsGraph = ({
15156
15164
  return chartConfig;
15157
15165
  };
15158
15166
 
15159
- const defaultFetchConfig$2 = {
15167
+ const defaultFetchConfig$3 = {
15160
15168
  basepath: "analytics",
15161
15169
  url: "/widgets/contributions",
15162
15170
  filters: {},
@@ -15170,7 +15178,7 @@ function ContributionsGraph({
15170
15178
  theme = {}
15171
15179
  }) {
15172
15180
  const fetchConfig = React.useMemo(() => ({
15173
- ...defaultFetchConfig$2,
15181
+ ...defaultFetchConfig$3,
15174
15182
  filters: {
15175
15183
  section: section,
15176
15184
  tabSelected: tabSelected
@@ -15180,7 +15188,7 @@ function ContributionsGraph({
15180
15188
  const {
15181
15189
  data,
15182
15190
  loading
15183
- } = useWidgetFetch({
15191
+ } = useWidgetFetch$1({
15184
15192
  config: fetchConfig
15185
15193
  });
15186
15194
  const chartConfig = useContributionsGraph({
@@ -15286,7 +15294,7 @@ const useTriangulation = ({
15286
15294
  };
15287
15295
  };
15288
15296
 
15289
- const defaultFetchConfig$1 = {
15297
+ const defaultFetchConfig$2 = {
15290
15298
  basepath: "analytics",
15291
15299
  url: "/widgets/triangulation",
15292
15300
  defaultData: [],
@@ -15300,7 +15308,7 @@ function Triangulation({
15300
15308
  theme = {}
15301
15309
  }) {
15302
15310
  const fetchConfig = React.useMemo(() => ({
15303
- ...defaultFetchConfig$1,
15311
+ ...defaultFetchConfig$2,
15304
15312
  filters: {
15305
15313
  section: section,
15306
15314
  tabSelected: tabSelected
@@ -15310,7 +15318,7 @@ function Triangulation({
15310
15318
  const {
15311
15319
  data: widgetData,
15312
15320
  loading
15313
- } = useWidgetFetch({
15321
+ } = useWidgetFetch$1({
15314
15322
  config: fetchConfig
15315
15323
  });
15316
15324
  const {
@@ -15453,7 +15461,7 @@ function DataConsilidation({
15453
15461
  });
15454
15462
  }
15455
15463
 
15456
- const defaultFetchConfig = {
15464
+ const defaultFetchConfig$1 = {
15457
15465
  basepath: "analytics",
15458
15466
  url: "/widgets/datachain-of-custody",
15459
15467
  filters: {},
@@ -15466,12 +15474,12 @@ function DataChainOfCustody({
15466
15474
  hardcodedData = []
15467
15475
  }) {
15468
15476
  const fetchConfig = React.useMemo(() => ({
15469
- ...defaultFetchConfig
15477
+ ...defaultFetchConfig$1
15470
15478
  }), []);
15471
15479
  const {
15472
15480
  data,
15473
15481
  loading
15474
- } = useWidgetFetch({
15482
+ } = useWidgetFetch$1({
15475
15483
  config: fetchConfig
15476
15484
  });
15477
15485
  const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
@@ -15529,7 +15537,7 @@ function UserDashboard({
15529
15537
  disabled: conf.disabled
15530
15538
  }, conf.title))
15531
15539
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
15532
- children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators, {
15540
+ children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators$1, {
15533
15541
  theme: theme,
15534
15542
  partners: informationSourcesCount,
15535
15543
  t: t,
@@ -15538,7 +15546,7 @@ function UserDashboard({
15538
15546
  APP: APP
15539
15547
  })
15540
15548
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
15541
- children: /*#__PURE__*/jsxRuntime.jsx(MineSites, {
15549
+ children: /*#__PURE__*/jsxRuntime.jsx(MineSites$1, {
15542
15550
  t: t,
15543
15551
  goTo: goTo,
15544
15552
  getRedirectLink: getRedirectLink,
@@ -15748,7 +15756,7 @@ DAFTable.propTypes = {
15748
15756
  scrollX: PropTypes__default["default"].any
15749
15757
  };
15750
15758
 
15751
- const Style$b = styled__default["default"].div`
15759
+ const Style$c = styled__default["default"].div`
15752
15760
  width: 99px;
15753
15761
  height: 10px;
15754
15762
  border-radius: 8px;
@@ -15769,7 +15777,7 @@ function ProgressBar({
15769
15777
  }) {
15770
15778
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15771
15779
  title: tooltipTitle || `${parseInt(percentage)}%`,
15772
- children: /*#__PURE__*/jsxRuntime.jsx(Style$b, {
15780
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$c, {
15773
15781
  onClick: onClick,
15774
15782
  style: style,
15775
15783
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -15789,7 +15797,7 @@ ProgressBar.propTypes = {
15789
15797
  style: PropTypes__default["default"].any
15790
15798
  };
15791
15799
 
15792
- const Style$a = styled__default["default"].div`
15800
+ const Style$b = styled__default["default"].div`
15793
15801
  .icon-background {
15794
15802
  width: ${({
15795
15803
  size
@@ -15808,7 +15816,7 @@ const SideIcon = ({
15808
15816
  size = 20,
15809
15817
  iconSize = 12
15810
15818
  }) => {
15811
- return /*#__PURE__*/jsxRuntime.jsx(Style$a, {
15819
+ return /*#__PURE__*/jsxRuntime.jsx(Style$b, {
15812
15820
  size: size,
15813
15821
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
15814
15822
  className: "icon-background",
@@ -16334,7 +16342,7 @@ function StickyTable({
16334
16342
  return data.length > 5 ? ComponentWithFocus : "div";
16335
16343
  }, [data.length]);
16336
16344
  return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
16337
- children: /*#__PURE__*/jsxRuntime.jsx(Style$9, {
16345
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$a, {
16338
16346
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
16339
16347
  className: "daf-table-wrapper",
16340
16348
  style: {
@@ -16360,7 +16368,7 @@ function StickyTable({
16360
16368
  })
16361
16369
  });
16362
16370
  }
16363
- const Style$9 = styled__default["default"].div`
16371
+ const Style$a = styled__default["default"].div`
16364
16372
  max-width: calc(100% - 48px);
16365
16373
  margin-left: var(--size-lg);
16366
16374
  overflow: hidden;
@@ -16392,223 +16400,223 @@ StickyTable.propTypes = {
16392
16400
  pagination: PropTypes__default["default"].any
16393
16401
  };
16394
16402
 
16403
+ const Style$9 = styled__default["default"].div`
16404
+ overflow: hidden;
16405
+
16406
+ .daf-table {
16407
+ padding: 0px;
16408
+ margin-top: 0px;
16409
+
16410
+ .ant-tag {
16411
+ text-align: center;
16412
+ }
16413
+ }
16414
+
16415
+ .daf-select-filters .filters {
16416
+ padding-top: 16px;
16417
+ padding-left: 0;
16418
+ padding-right: 0;
16419
+ }
16420
+
16421
+ .daf-table {
16422
+ padding-top: 16px;
16423
+ }
16424
+ `;
16425
+
16426
+ const getColumns$i = ({
16427
+ t = () => {},
16428
+ options = {},
16429
+ user = {},
16430
+ goTo = () => {},
16431
+ getRedirectLink = () => {}
16432
+ }) => [{
16433
+ title: t("ID"),
16434
+ dataIndex: "datastakeId",
16435
+ key: "datastakeId",
16436
+ render: (v, all) => {
16437
+ if (all.empty) {
16438
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16439
+ className: "daf-default-cell"
16440
+ });
16441
+ }
16442
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16443
+ title: v,
16444
+ children: v
16445
+ });
16446
+ }
16447
+ }, {
16448
+ title: t("Name"),
16449
+ dataIndex: "name",
16450
+ key: "name",
16451
+ render: (v, all) => {
16452
+ if (all.empty) {
16453
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16454
+ className: "daf-default-cell"
16455
+ });
16456
+ }
16457
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16458
+ title: v,
16459
+ children: v
16460
+ });
16461
+ }
16462
+ }, {
16463
+ dataIndex: 'category',
16464
+ title: t('type'),
16465
+ ellipsis: true,
16466
+ show: true,
16467
+ render: (v, all) => {
16468
+ if (all.empty) {
16469
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16470
+ className: "daf-default-cell"
16471
+ });
16472
+ }
16473
+ const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
16474
+ const category = findOptions(v, locationCategories);
16475
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16476
+ title: category,
16477
+ children: category
16478
+ });
16479
+ }
16480
+ }, {
16481
+ dataIndex: 'region',
16482
+ title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
16483
+ ellipsis: true,
16484
+ show: true,
16485
+ render: (v, all) => {
16486
+ if (all.empty) {
16487
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16488
+ className: "daf-default-cell"
16489
+ });
16490
+ }
16491
+
16492
+ // const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
16493
+ const region = Object.values(all?.linking?.SCL || {}).find(obj => obj?.level === 'level_1')?.name;
16494
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16495
+ title: region,
16496
+ children: region
16497
+ }) : '-';
16498
+ }
16499
+ }, {
16500
+ dataIndex: 'territory',
16501
+ title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
16502
+ ellipsis: true,
16503
+ show: true,
16504
+ render: (v, all) => {
16505
+ if (all.empty) {
16506
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16507
+ className: "daf-default-cell"
16508
+ });
16509
+ }
16510
+ const district = Object.values(all?.linking?.SCL || {}).find(obj => obj?.level === 'level_2')?.name;
16511
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16512
+ title: district,
16513
+ children: district
16514
+ }) : '-';
16515
+ }
16516
+ }, {
16517
+ dataIndex: 'lastUpdate',
16518
+ title: t('Last Update'),
16519
+ ellipsis: true,
16520
+ show: true,
16521
+ render: (v, all) => {
16522
+ if (all.empty) {
16523
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16524
+ className: "daf-default-cell"
16525
+ });
16526
+ }
16527
+ const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
16528
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16529
+ title: date,
16530
+ children: date
16531
+ });
16532
+ }
16533
+ }, {
16534
+ id: 'actions',
16535
+ title: "",
16536
+ width: 60,
16537
+ render: (_, all) => {
16538
+ if (all.empty) {
16539
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16540
+ className: "daf-default-cell"
16541
+ });
16542
+ }
16543
+ const moreMenuItems = [{
16544
+ label: t("Summary"),
16545
+ value: "Summary",
16546
+ onClick: () => {
16547
+ let link = `/app/mine-summary/${all.datastakeId}`;
16548
+ goTo(getRedirectLink(link));
16549
+ }
16550
+ }, {
16551
+ label: t("Details"),
16552
+ value: "details",
16553
+ onClick: () => {
16554
+ let link = `/app/view/production-sites/${all.datastakeId}`;
16555
+ goTo(getRedirectLink(link));
16556
+ }
16557
+ }];
16558
+ return /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
16559
+ items: moreMenuItems
16560
+ });
16561
+ }
16562
+ }];
16563
+
16564
+ function ProductionSites({
16565
+ t = () => {},
16566
+ options = {},
16567
+ user = {},
16568
+ goTo = () => {},
16569
+ getRedirectLink = () => {},
16570
+ data = [],
16571
+ loading = false
16572
+ }) {
16573
+ const productionSites = React.useMemo(() => {
16574
+ if (Array.isArray(data?.productionSites)) {
16575
+ return data?.productionSites;
16576
+ }
16577
+ return data?.data?.productionSites || [];
16578
+ }, [data?.productionSites, data?.data?.productionSites]);
16579
+ const Wrapper = React.useMemo(() => {
16580
+ return productionSites?.length > 5 ? ComponentWithFocus : "div";
16581
+ }, [productionSites]);
16582
+ const columns = React.useMemo(() => {
16583
+ return getColumns$i({
16584
+ t,
16585
+ options,
16586
+ user,
16587
+ goTo,
16588
+ getRedirectLink
16589
+ });
16590
+ }, [t, options, user, goTo, getRedirectLink]);
16591
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
16592
+ title: t("Production Sites"),
16593
+ className: "with-border-header no-px-body",
16594
+ loading: loading,
16595
+ children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
16596
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$9, {
16597
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
16598
+ className: "daf-table-wrapper",
16599
+ style: {
16600
+ maxHeight: "526px",
16601
+ overflowY: "auto"
16602
+ },
16603
+ children: /*#__PURE__*/jsxRuntime.jsx(StickyTable, {
16604
+ columns: columns,
16605
+ dataSource: productionSites || [],
16606
+ hideOnLoading: false,
16607
+ doEmptyRows: true
16608
+ })
16609
+ })
16610
+ })
16611
+ })
16612
+ });
16613
+ }
16614
+
16395
16615
  const Style$8 = styled__default["default"].div`
16616
+ max-width: 98%;
16617
+ margin-left: var(--size-lg);
16396
16618
  overflow: hidden;
16397
-
16398
- .daf-table {
16399
- padding: 0px;
16400
- margin-top: 0px;
16401
-
16402
- .ant-tag {
16403
- text-align: center;
16404
- }
16405
- }
16406
-
16407
- .daf-select-filters .filters {
16408
- padding-top: 16px;
16409
- padding-left: 0;
16410
- padding-right: 0;
16411
- }
16412
-
16413
- .daf-table {
16414
- padding-top: 16px;
16415
- }
16416
- `;
16417
-
16418
- const getColumns$i = ({
16419
- t = () => {},
16420
- options = {},
16421
- user = {},
16422
- goTo = () => {},
16423
- getRedirectLink = () => {}
16424
- }) => [{
16425
- title: t("ID"),
16426
- dataIndex: "datastakeId",
16427
- key: "datastakeId",
16428
- render: (v, all) => {
16429
- if (all.empty) {
16430
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16431
- className: "daf-default-cell"
16432
- });
16433
- }
16434
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16435
- title: v,
16436
- children: v
16437
- });
16438
- }
16439
- }, {
16440
- title: t("Name"),
16441
- dataIndex: "name",
16442
- key: "name",
16443
- render: (v, all) => {
16444
- if (all.empty) {
16445
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16446
- className: "daf-default-cell"
16447
- });
16448
- }
16449
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16450
- title: v,
16451
- children: v
16452
- });
16453
- }
16454
- }, {
16455
- dataIndex: 'category',
16456
- title: t('type'),
16457
- ellipsis: true,
16458
- show: true,
16459
- render: (v, all) => {
16460
- if (all.empty) {
16461
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16462
- className: "daf-default-cell"
16463
- });
16464
- }
16465
- const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
16466
- const category = findOptions(v, locationCategories);
16467
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16468
- title: category,
16469
- children: category
16470
- });
16471
- }
16472
- }, {
16473
- dataIndex: 'region',
16474
- title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
16475
- ellipsis: true,
16476
- show: true,
16477
- render: (v, all) => {
16478
- if (all.empty) {
16479
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16480
- className: "daf-default-cell"
16481
- });
16482
- }
16483
-
16484
- // const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
16485
- const region = Object.values(all?.linking?.SCL || {}).find(obj => obj?.level === 'level_1')?.name;
16486
- return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16487
- title: region,
16488
- children: region
16489
- }) : '-';
16490
- }
16491
- }, {
16492
- dataIndex: 'territory',
16493
- title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
16494
- ellipsis: true,
16495
- show: true,
16496
- render: (v, all) => {
16497
- if (all.empty) {
16498
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16499
- className: "daf-default-cell"
16500
- });
16501
- }
16502
- const district = Object.values(all?.linking?.SCL || {}).find(obj => obj?.level === 'level_2')?.name;
16503
- return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16504
- title: district,
16505
- children: district
16506
- }) : '-';
16507
- }
16508
- }, {
16509
- dataIndex: 'lastUpdate',
16510
- title: t('Last Update'),
16511
- ellipsis: true,
16512
- show: true,
16513
- render: (v, all) => {
16514
- if (all.empty) {
16515
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16516
- className: "daf-default-cell"
16517
- });
16518
- }
16519
- const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
16520
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16521
- title: date,
16522
- children: date
16523
- });
16524
- }
16525
- }, {
16526
- id: 'actions',
16527
- title: "",
16528
- width: 60,
16529
- render: (_, all) => {
16530
- if (all.empty) {
16531
- return /*#__PURE__*/jsxRuntime.jsx("div", {
16532
- className: "daf-default-cell"
16533
- });
16534
- }
16535
- const moreMenuItems = [{
16536
- label: t("Summary"),
16537
- value: "Summary",
16538
- onClick: () => {
16539
- let link = `/app/mine-summary/${all.datastakeId}`;
16540
- goTo(getRedirectLink(link));
16541
- }
16542
- }, {
16543
- label: t("Details"),
16544
- value: "details",
16545
- onClick: () => {
16546
- let link = `/app/view/production-sites/${all.datastakeId}`;
16547
- goTo(getRedirectLink(link));
16548
- }
16549
- }];
16550
- return /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
16551
- items: moreMenuItems
16552
- });
16553
- }
16554
- }];
16555
-
16556
- function ProductionSites({
16557
- t = () => {},
16558
- options = {},
16559
- user = {},
16560
- goTo = () => {},
16561
- getRedirectLink = () => {},
16562
- data = [],
16563
- loading = false
16564
- }) {
16565
- const productionSites = React.useMemo(() => {
16566
- if (Array.isArray(data?.productionSites)) {
16567
- return data?.productionSites;
16568
- }
16569
- return data?.data?.productionSites || [];
16570
- }, [data?.productionSites, data?.data?.productionSites]);
16571
- const Wrapper = React.useMemo(() => {
16572
- return productionSites?.length > 5 ? ComponentWithFocus : "div";
16573
- }, [productionSites]);
16574
- const columns = React.useMemo(() => {
16575
- return getColumns$i({
16576
- t,
16577
- options,
16578
- user,
16579
- goTo,
16580
- getRedirectLink
16581
- });
16582
- }, [t, options, user, goTo, getRedirectLink]);
16583
- return /*#__PURE__*/jsxRuntime.jsx(Widget, {
16584
- title: t("Production Sites"),
16585
- className: "with-border-header no-px-body",
16586
- loading: loading,
16587
- children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
16588
- children: /*#__PURE__*/jsxRuntime.jsx(Style$8, {
16589
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
16590
- className: "daf-table-wrapper",
16591
- style: {
16592
- maxHeight: "526px",
16593
- overflowY: "auto"
16594
- },
16595
- children: /*#__PURE__*/jsxRuntime.jsx(StickyTable, {
16596
- columns: columns,
16597
- dataSource: productionSites || [],
16598
- hideOnLoading: false,
16599
- doEmptyRows: true
16600
- })
16601
- })
16602
- })
16603
- })
16604
- });
16605
- }
16606
-
16607
- const Style$7 = styled__default["default"].div`
16608
- max-width: 98%;
16609
- margin-left: var(--size-lg);
16610
- overflow: hidden;
16611
- padding-right: 24px;
16619
+ padding-right: 24px;
16612
16620
 
16613
16621
  .daf-table {
16614
16622
  padding: 0px;
@@ -17094,7 +17102,7 @@ function AssociatedInformation$1({
17094
17102
  const {
17095
17103
  data,
17096
17104
  loading
17097
- } = useWidgetFetch({
17105
+ } = useWidgetFetch$1({
17098
17106
  config: defaultConfig
17099
17107
  });
17100
17108
  console.log({
@@ -17127,7 +17135,7 @@ function AssociatedInformation$1({
17127
17135
  onChange: setActiveTab,
17128
17136
  value: activeTab,
17129
17137
  className: "mt-0"
17130
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$7, {
17138
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
17131
17139
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
17132
17140
  children: /*#__PURE__*/jsxRuntime.jsx(SearchFilters, {
17133
17141
  t: t
@@ -21991,12 +21999,12 @@ function Geolocation$1({
21991
21999
  }
21992
22000
 
21993
22001
  const {
21994
- useToken: useToken$6
22002
+ useToken: useToken$7
21995
22003
  } = antd.theme;
21996
22004
  function Smart() {
21997
22005
  const {
21998
22006
  token
21999
- } = useToken$6();
22007
+ } = useToken$7();
22000
22008
  const [isOpen, setIsOpen] = React.useState(false);
22001
22009
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
22002
22010
  style: {
@@ -22080,7 +22088,7 @@ function SmartWidget({
22080
22088
  }) {
22081
22089
  const {
22082
22090
  token
22083
- } = useToken$6();
22091
+ } = useToken$7();
22084
22092
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
22085
22093
  noTitle: true,
22086
22094
  className: "no-p-body p-xs",
@@ -22296,7 +22304,7 @@ function View$1({
22296
22304
  });
22297
22305
  }
22298
22306
 
22299
- const Style$6 = styled__default["default"].div`
22307
+ const Style$7 = styled__default["default"].div`
22300
22308
  position: absolute;
22301
22309
  right: 25px;
22302
22310
  top: 60px;
@@ -22328,7 +22336,7 @@ function RiskComment({
22328
22336
  const {
22329
22337
  t
22330
22338
  } = useEditContext();
22331
- return isShown ? /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
22339
+ return isShown ? /*#__PURE__*/jsxRuntime.jsxs(Style$7, {
22332
22340
  id: id,
22333
22341
  children: [comment, /*#__PURE__*/jsxRuntime.jsx("div", {
22334
22342
  className: "comment-shown",
@@ -23539,7 +23547,7 @@ FormPopover.propTypes = {
23539
23547
  };
23540
23548
 
23541
23549
  const {
23542
- useToken: useToken$5
23550
+ useToken: useToken$6
23543
23551
  } = antd.theme;
23544
23552
  const disabledTypes = ["dataLink"];
23545
23553
  function Versions({
@@ -23552,7 +23560,7 @@ function Versions({
23552
23560
  }) {
23553
23561
  const {
23554
23562
  token
23555
- } = useToken$5();
23563
+ } = useToken$6();
23556
23564
  const dataSource = React.useMemo(() => {
23557
23565
  if (!versionsDatapoints) {
23558
23566
  return [];
@@ -23716,7 +23724,7 @@ function Comments({
23716
23724
  });
23717
23725
  }
23718
23726
 
23719
- var Style$5 = styled__default["default"].div`
23727
+ var Style$6 = styled__default["default"].div`
23720
23728
  border: 1px solid var(--base-gray-40);
23721
23729
  padding: 12px;
23722
23730
  background: var(--base-gray-20);
@@ -23862,7 +23870,7 @@ function GroupInfoHOC({
23862
23870
  meta,
23863
23871
  t
23864
23872
  });
23865
- return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
23873
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
23866
23874
  className: formatClassname([!isExpanded && 'collapsed', className, isSuccess && 'success']),
23867
23875
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
23868
23876
  className: "cont-header",
@@ -24019,7 +24027,7 @@ function GroupInfo({
24019
24027
  });
24020
24028
  }
24021
24029
  };
24022
- return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
24030
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
24023
24031
  className: formatClassname([!isExpanded && 'collapsed', className]),
24024
24032
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
24025
24033
  className: "cont-header",
@@ -24060,7 +24068,7 @@ function GroupInfos({
24060
24068
  }, key));
24061
24069
  }
24062
24070
 
24063
- const Style$4 = styled__default["default"].div`
24071
+ const Style$5 = styled__default["default"].div`
24064
24072
  gap: 16px;
24065
24073
  display: flex;
24066
24074
  max-width: 465px;
@@ -24082,7 +24090,7 @@ function EvaluationPopover({
24082
24090
  t = s => s,
24083
24091
  evaluationConfig = []
24084
24092
  }) {
24085
- return /*#__PURE__*/jsxRuntime.jsx(Style$4, {
24093
+ return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
24086
24094
  children: evaluationConfig.map(c =>
24087
24095
  /*#__PURE__*/
24088
24096
  //? ASK REDI
@@ -26060,7 +26068,7 @@ const useMapHelper = ({
26060
26068
  };
26061
26069
  };
26062
26070
 
26063
- const Style$3 = styled__default["default"].div`
26071
+ const Style$4 = styled__default["default"].div`
26064
26072
  width: 100%;
26065
26073
  height: 20rem;
26066
26074
  flex: 1;
@@ -26187,7 +26195,7 @@ function PolygonSelector({
26187
26195
  searchForLocation(mapRef);
26188
26196
  }
26189
26197
  }, [searchValue, mapRef]);
26190
- return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
26198
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$4, {
26191
26199
  className: "polygon-selector",
26192
26200
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
26193
26201
  className: "map-container",
@@ -34138,7 +34146,7 @@ const inputTypeComponent$1 = {
34138
34146
  opts = JSON.parse(JSON.stringify(opts || []));
34139
34147
  opts = opts.map(o => getSelectOptions$1(o, formsValue));
34140
34148
  if (optionsFilter && Array.isArray(optionsFilter)) {
34141
- opts = filterOptions$1(opts, optionsFilter, formsValue, repeatValues, filterCond);
34149
+ opts = filterOptions$2(opts, optionsFilter, formsValue, repeatValues, filterCond);
34142
34150
  }
34143
34151
  const uniqueDefaultKeys = getUniqueDefaultKeys(options);
34144
34152
 
@@ -34314,7 +34322,7 @@ const inputTypeComponent$1 = {
34314
34322
  opts = JSON.parse(JSON.stringify(opts));
34315
34323
  opts = opts.map(o => getSelectOptions$1(o, formsValue));
34316
34324
  if (optionsFilter && Array.isArray(optionsFilter)) {
34317
- opts = filterOptions$1(opts, optionsFilter, formsValue, repeatValues, filterCond);
34325
+ opts = filterOptions$2(opts, optionsFilter, formsValue, repeatValues, filterCond);
34318
34326
  }
34319
34327
  if (propHasValue$1(value) && Array.isArray(value) && value.length > 0) {
34320
34328
  try {
@@ -37815,7 +37823,7 @@ const inputTypeComponent = {
37815
37823
  opts = JSON.parse(JSON.stringify(opts));
37816
37824
  opts = opts.map(o => getSelectOptions(o, formsValue));
37817
37825
  if (optionsFilter && Array.isArray(optionsFilter)) {
37818
- opts = filterOptions$1(opts, optionsFilter, formsValue, repeatValues, filterCond);
37826
+ opts = filterOptions$2(opts, optionsFilter, formsValue, repeatValues, filterCond);
37819
37827
  }
37820
37828
  if (propHasValue(value)) {
37821
37829
  const selectOption = opts.find(o => o.value === value);
@@ -37934,7 +37942,7 @@ const inputTypeComponent = {
37934
37942
  opts = JSON.parse(JSON.stringify(opts));
37935
37943
  opts = opts.map(o => getSelectOptions(o, formsValue));
37936
37944
  if (optionsFilter && Array.isArray(optionsFilter)) {
37937
- opts = filterOptions$1(opts, optionsFilter, formsValue, repeatValues, filterCond);
37945
+ opts = filterOptions$2(opts, optionsFilter, formsValue, repeatValues, filterCond);
37938
37946
  }
37939
37947
  if (propHasValue(value) && Array.isArray(value) && value.length > 0 && !tags) {
37940
37948
  try {
@@ -40635,7 +40643,7 @@ const useGetQueryParams = ({
40635
40643
  return params;
40636
40644
  };
40637
40645
 
40638
- const Style$2 = styled__default["default"].div`
40646
+ const Style$3 = styled__default["default"].div`
40639
40647
  display: flex;
40640
40648
  gap: 8px;
40641
40649
  justify-content: center;
@@ -40658,7 +40666,7 @@ function Footer({
40658
40666
  disabledFooterText,
40659
40667
  disabledFooter
40660
40668
  }) {
40661
- return /*#__PURE__*/jsxRuntime.jsxs(Style$2, {
40669
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
40662
40670
  className: className,
40663
40671
  children: [disabledFooterText ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
40664
40672
  title: t(disabledFooterText),
@@ -41167,7 +41175,7 @@ const viewConfig$b = {
41167
41175
  };
41168
41176
 
41169
41177
  const {
41170
- useToken: useToken$4
41178
+ useToken: useToken$5
41171
41179
  } = antd.theme;
41172
41180
  const MAX_LENGTH = 3;
41173
41181
  function AvatarGroup({
@@ -41178,7 +41186,7 @@ function AvatarGroup({
41178
41186
  const count = items.length === maxLength + 1 ? items.length : maxLength;
41179
41187
  const {
41180
41188
  token
41181
- } = useToken$4();
41189
+ } = useToken$5();
41182
41190
  return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
41183
41191
  max: {
41184
41192
  count: count,
@@ -42781,11 +42789,11 @@ const getColumns$b = ({
42781
42789
  className: "daf-default-cell"
42782
42790
  });
42783
42791
  }
42784
- const type = findOptions(v, data?.options?.eventsType);
42785
- return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
42792
+ const type = findOptions(v, options?.eventType || options?.eventsType);
42793
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
42786
42794
  title: type,
42787
42795
  children: type
42788
- }) : '-';
42796
+ });
42789
42797
  }
42790
42798
  }, {
42791
42799
  dataIndex: 'keyStakeholder',
@@ -44112,7 +44120,7 @@ const getColumns$8 = ({
44112
44120
  className: "daf-default-cell"
44113
44121
  });
44114
44122
  }
44115
- const type = findOptions(title, data?.options?.testimonialsType);
44123
+ const type = findOptions(title, options?.testimonialsType);
44116
44124
  return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44117
44125
  title: type,
44118
44126
  children: type
@@ -44358,7 +44366,7 @@ const getColumns$7 = ({
44358
44366
  className: "daf-default-cell"
44359
44367
  });
44360
44368
  }
44361
- const locationCategories = [...(data?.options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
44369
+ const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
44362
44370
  const category = findOptions(v, locationCategories);
44363
44371
  return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44364
44372
  title: category,
@@ -46129,7 +46137,7 @@ const KeyInformation$2 = ({
46129
46137
  };
46130
46138
 
46131
46139
  const {
46132
- useToken: useToken$3
46140
+ useToken: useToken$4
46133
46141
  } = antd.theme;
46134
46142
  /**
46135
46143
  * RadialBarChart Component
@@ -46190,7 +46198,7 @@ function RadialBarChart({
46190
46198
  const chartRef = React__default["default"].useRef(null);
46191
46199
  const {
46192
46200
  token
46193
- } = useToken$3();
46201
+ } = useToken$4();
46194
46202
  const {
46195
46203
  legendEnabled,
46196
46204
  legendItems,
@@ -46403,7 +46411,7 @@ const InformationAvailability = ({
46403
46411
  const {
46404
46412
  data,
46405
46413
  loading
46406
- } = useWidgetFetch({
46414
+ } = useWidgetFetch$1({
46407
46415
  config: defaultFetchConfig
46408
46416
  });
46409
46417
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
@@ -46621,7 +46629,7 @@ const useTradeRelationship = ({
46621
46629
  }), [id, filters?.products, selectedPartners?.partners, selectedPartners?.loading]);
46622
46630
  const {
46623
46631
  data
46624
- } = useWidgetFetch({
46632
+ } = useWidgetFetch$1({
46625
46633
  config: config
46626
46634
  });
46627
46635
  const mapItem$1 = data => {
@@ -47653,7 +47661,7 @@ const Governance = ({
47653
47661
  const {
47654
47662
  data,
47655
47663
  loading
47656
- } = useWidgetFetch({
47664
+ } = useWidgetFetch$1({
47657
47665
  config: defaultFetchConfig
47658
47666
  });
47659
47667
  const graphData = React.useMemo(() => {
@@ -48231,7 +48239,7 @@ styled__default["default"].div`
48231
48239
  direction: PropTypes__default["default"].oneOf(["horizontal", "vertical"])
48232
48240
  });
48233
48241
 
48234
- const Style$1 = styled__default["default"].div`
48242
+ const Style$2 = styled__default["default"].div`
48235
48243
  display: grid;
48236
48244
  grid-template-columns: 1fr 1fr;
48237
48245
  gap: 0;
@@ -48399,7 +48407,7 @@ function ActivityIndicatorsWidget({
48399
48407
  className: formatClassname(["flex-1 with-border-header h-w-btn-header no-p-body", widgetClassName]),
48400
48408
  title: noTitle ? undefined : t(title),
48401
48409
  noTitle: noTitle,
48402
- children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$1, {
48410
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$2, {
48403
48411
  className: formatClassname(["activity-indicators-grid", className]),
48404
48412
  children: filteredConfig.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
48405
48413
  className: "indicator-item",
@@ -49711,7 +49719,7 @@ ImageCarousel.propTypes = {
49711
49719
  emptyText: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].node])
49712
49720
  };
49713
49721
 
49714
- const Style = styled__default["default"].div`
49722
+ const Style$1 = styled__default["default"].div`
49715
49723
  background: #ffffff;
49716
49724
  border-radius: 8px;
49717
49725
  border: 1px solid #E5E7EB;
@@ -49829,7 +49837,7 @@ const StatCard = ({
49829
49837
  return isNaN(numValue) || numValue === 0;
49830
49838
  };
49831
49839
  const shouldShowChange = change && !isChangeZero();
49832
- return /*#__PURE__*/jsxRuntime.jsxs(Style, {
49840
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$1, {
49833
49841
  ...changeColors,
49834
49842
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
49835
49843
  className: "stat-card-header",
@@ -51867,7 +51875,7 @@ styled__default["default"](antd.Tabs)`
51867
51875
  });
51868
51876
 
51869
51877
  const {
51870
- useToken: useToken$2
51878
+ useToken: useToken$3
51871
51879
  } = antd.theme;
51872
51880
 
51873
51881
  /**
@@ -51974,7 +51982,7 @@ function ColumnChart({
51974
51982
  const chartRef = React__default["default"].useRef(null);
51975
51983
  const {
51976
51984
  token
51977
- } = useToken$2();
51985
+ } = useToken$3();
51978
51986
  const {
51979
51987
  legendEnabled,
51980
51988
  legendItems,
@@ -52068,7 +52076,7 @@ function ColumnChart({
52068
52076
  }
52069
52077
 
52070
52078
  const {
52071
- useToken: useToken$1
52079
+ useToken: useToken$2
52072
52080
  } = antd.theme;
52073
52081
 
52074
52082
  /**
@@ -52145,7 +52153,7 @@ function DonutPie({
52145
52153
  const chartRef = React.useRef(null);
52146
52154
  const {
52147
52155
  token
52148
- } = useToken$1();
52156
+ } = useToken$2();
52149
52157
  const {
52150
52158
  legendEnabled,
52151
52159
  legendItems,
@@ -52226,7 +52234,7 @@ function DonutPie({
52226
52234
  });
52227
52235
  }
52228
52236
 
52229
- styled__default["default"].div`
52237
+ const Style = styled__default["default"].div`
52230
52238
  .timeline {
52231
52239
  display: flex;
52232
52240
  justify-content: space-between;
@@ -52401,6 +52409,267 @@ styled__default["default"].div`
52401
52409
  }
52402
52410
  `;
52403
52411
 
52412
+ const {
52413
+ useToken: useToken$1
52414
+ } = antd.theme;
52415
+ /**
52416
+ * StackChart Component
52417
+ *
52418
+ * A reusable stacked chart component for visualizing grouped categorical data.
52419
+ * This chart displays data as stacked blocks with hover-enabled popover tooltips.
52420
+ *
52421
+ * Props:
52422
+ * - `data` (Array):
52423
+ * Dataset to render. Each item should include the key defined by `xFieldKey` (for grouping)
52424
+ * and `seriesField` (for categorization).
52425
+ * Default: `[]`
52426
+ *
52427
+ * - `xFieldKey` (string):
52428
+ * The field name to group data items on the X-axis (e.g., "label", "day").
52429
+ * Default: `"label"`
52430
+ *
52431
+ * - `seriesField` (string):
52432
+ * The field used to determine category color/grouping (e.g., "type").
52433
+ * Required for coloring and grouping logic.
52434
+ *
52435
+ * - `className` (string):
52436
+ * Optional additional class for custom styling.
52437
+ *
52438
+ *
52439
+ * - `renderTooltip` (function):
52440
+ * Custom function to render a tooltip for hovered items. Receives an object:
52441
+ * `{ item, itemGroup, mouseX, mouseY }`.
52442
+ * Returns JSX.
52443
+ *
52444
+ * - `yOffset` (number):
52445
+ * Vertical boundary constraint for tooltip positioning.
52446
+ * Default: `130`
52447
+ *
52448
+ * - `xOffset` (number):
52449
+ * Horizontal boundary constraint for tooltip positioning.
52450
+ * Default: `230`
52451
+ *
52452
+ * - `mouseXOffset` (number):
52453
+ * X-offset in pixels from the cursor for tooltip rendering.
52454
+ * Default: `30`
52455
+ *
52456
+ * - `mouseYOffset` (number):
52457
+ * Y-offset in pixels from the cursor for tooltip rendering.
52458
+ * Default: `50`
52459
+ *
52460
+ * - `doConstraints` (boolean):
52461
+ * Enables or disables tooltip boundary checking to avoid overflow.
52462
+ * Default: `true`
52463
+ *
52464
+ * - `colors` (string[] | object):
52465
+ * Optional custom color map or array for categories.
52466
+ * If an array is passed, colors are mapped in order to unique values from `seriesField`.
52467
+ * If an object is passed, it should map specific `seriesField` values to color strings.
52468
+ *
52469
+ * - `valueField` (string):
52470
+ * The field name that contains the numeric value. Items with falsy values (0, null, undefined)
52471
+ * in this field will not render visual blocks but will still show the label.
52472
+ * Default: `"value"`
52473
+ *
52474
+ * Behavior:
52475
+ * - Dynamically computes the height of each stacked item based on the maximum group size.
52476
+ * - Uses Ant Design's `Popover` component for rendering tooltips on hover.
52477
+ * - Fallbacks to theme's `colorPrimary7` if no color is matched.
52478
+ */
52479
+ function StackChart({
52480
+ data = [],
52481
+ xFieldKey = "label",
52482
+ seriesField = "type",
52483
+ className,
52484
+ // noProvider = false,
52485
+ renderTooltip,
52486
+ yOffset = 130,
52487
+ xOffset = 230,
52488
+ mouseXOffset = 30,
52489
+ mouseYOffset = 50,
52490
+ doConstraints = true,
52491
+ colors,
52492
+ valueField = "value",
52493
+ height = 300,
52494
+ isPdf = false,
52495
+ t = s => s,
52496
+ legendConfig = {}
52497
+ }) {
52498
+ const ref = React__default["default"].useRef();
52499
+ const {
52500
+ token
52501
+ } = useToken$1();
52502
+ const isEmpty = !data.length;
52503
+ const [mouseY, setMouseY] = React__default["default"].useState(0);
52504
+ const [mouseX, setMouseX] = React__default["default"].useState(0);
52505
+ const [hoveredGroup, setHoveredGroup] = React__default["default"].useState(null);
52506
+ const allUniqueLabels = React__default["default"].useMemo(() => {
52507
+ const uniqueLabels = new Set();
52508
+ data.forEach(item => {
52509
+ if (item[xFieldKey]) {
52510
+ uniqueLabels.add(item[xFieldKey]);
52511
+ }
52512
+ });
52513
+ return Array.from(uniqueLabels);
52514
+ }, [data, xFieldKey]);
52515
+ const {
52516
+ legendEnabled,
52517
+ legendItems,
52518
+ legendPosition,
52519
+ legendLayout,
52520
+ legendInteractive,
52521
+ legendStyle
52522
+ } = useLegendConfig({
52523
+ legendConfig,
52524
+ isPdf
52525
+ });
52526
+ const groupedByLabel = React__default["default"].useMemo(() => {
52527
+ return data.reduce((acc, item) => {
52528
+ const label = item[xFieldKey];
52529
+ if (!acc[label]) {
52530
+ acc[label] = [];
52531
+ }
52532
+ acc[label].push(item);
52533
+ return acc;
52534
+ }, {});
52535
+ }, [data, xFieldKey]);
52536
+ const seriesColors = React__default["default"].useMemo(() => {
52537
+ if (isEmpty) return {};
52538
+ if (Array.isArray(colors)) {
52539
+ const uniqueSeries = Array.from(new Set(data.map(item => item[seriesField])));
52540
+ return uniqueSeries.reduce((acc, seriesValue, idx) => {
52541
+ acc[seriesValue] = colors[idx % colors?.length];
52542
+ return acc;
52543
+ }, {});
52544
+ }
52545
+ if (typeof colors === "string") {
52546
+ return data.reduce((acc, item) => {
52547
+ acc[item[seriesField]] = colors;
52548
+ return acc;
52549
+ }, {});
52550
+ }
52551
+ return colors || {};
52552
+ }, [seriesField, colors, data, isEmpty]);
52553
+ let max = 0;
52554
+ allUniqueLabels.forEach(label => {
52555
+ if ((groupedByLabel[label] || [])?.length > max) {
52556
+ max = (groupedByLabel[label] || [])?.length || 0;
52557
+ }
52558
+ });
52559
+ const getEventHeight = columnItemCount => {
52560
+ // if (columnItemCount === 0) return 35;
52561
+ // const MARGIN = 2;
52562
+ // const availableHeight = (height || 300) - (columnItemCount < 4 ? 50 : 40);
52563
+
52564
+ // const totalGapSpace = (columnItemCount - 1) * MARGIN;
52565
+ // const availableForEvents = availableHeight - totalGapSpace;
52566
+ // const calculatedHeight = Math.abs(parseFloat((availableForEvents / columnItemCount).toFixed(2)));
52567
+
52568
+ // return calculatedHeight < 1 ? 1 : calculatedHeight;
52569
+
52570
+ const MARGIN = 2;
52571
+ const _height = Math.abs(parseFloat(((height - max * MARGIN) / max).toFixed(2)));
52572
+ return _height > 35 ? 35 : _height - 2;
52573
+ };
52574
+ const eventHeight = getEventHeight();
52575
+ const content = () => {
52576
+ if (isEmpty || !allUniqueLabels.length) {
52577
+ return null;
52578
+ }
52579
+ return allUniqueLabels.map((ev, index) => {
52580
+ const filteredItems = (groupedByLabel?.[ev] || []).filter(item => {
52581
+ return item[valueField] && item[valueField] !== 0;
52582
+ });
52583
+
52584
+ // const eventHeight = getEventHeight(filteredItems.length);
52585
+
52586
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
52587
+ className: "weekDay",
52588
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
52589
+ className: "dayCol",
52590
+ style: {
52591
+ height: `${height - 20}px`
52592
+ },
52593
+ children: filteredItems.map((e, ind) => {
52594
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
52595
+ overlayClassName: "event-popover",
52596
+ content: renderTooltipJsx(renderTooltip({
52597
+ item: {
52598
+ ...(e || {}),
52599
+ color: seriesColors[e[seriesField]] || token.colorPrimary7
52600
+ },
52601
+ itemGroup: groupedByLabel?.[ev] || []
52602
+ })),
52603
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
52604
+ className: "event",
52605
+ style: {
52606
+ background: seriesColors[e[seriesField]] || token.colorPrimary7,
52607
+ height: `${eventHeight < 1 ? 1 : eventHeight}px`
52608
+ }
52609
+ })
52610
+ }, ind);
52611
+ })
52612
+ }), ev]
52613
+ }, index);
52614
+ });
52615
+ };
52616
+ const onMouseLeaveHandler = React__default["default"].useCallback((e, hG, id) => {
52617
+ let x = e.clientX - ref.current.getBoundingClientRect().left + mouseXOffset;
52618
+ let y = e.clientY - ref.current.getBoundingClientRect().top + mouseYOffset;
52619
+ if (doConstraints && ref.current.clientWidth - x < xOffset) {
52620
+ x = ref.current.clientWidth - xOffset;
52621
+ }
52622
+ if (doConstraints && ref.current.clientHeight - y < yOffset) {
52623
+ y = 0;
52624
+ x = ref.current.clientWidth / 2 - 100;
52625
+ }
52626
+ setMouseY(y);
52627
+ setMouseX(x);
52628
+ if (hoveredGroup === null) {
52629
+ setHoveredGroup({
52630
+ ...hG,
52631
+ id
52632
+ });
52633
+ }
52634
+ }, [hoveredGroup]);
52635
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
52636
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Style, {
52637
+ ...(isEmpty ? {
52638
+ onMouseEnter: () => {
52639
+ setHoveredGroup({
52640
+ id: 0
52641
+ });
52642
+ },
52643
+ onMouseLeave: () => {
52644
+ setHoveredGroup(null);
52645
+ },
52646
+ onMouseMove: e => onMouseLeaveHandler(e, {}, 0)
52647
+ } : {}),
52648
+ className: formatClassname(["riskProfile", className]),
52649
+ ref: ref,
52650
+ style: {
52651
+ height: `${height}px`
52652
+ },
52653
+ children: [typeof renderTooltip === "function" && !isEmpty ? hoveredGroup !== null ? renderTooltip({
52654
+ mouseX,
52655
+ mouseY,
52656
+ item: hoveredGroup
52657
+ }) : null : null, /*#__PURE__*/jsxRuntime.jsx("div", {
52658
+ className: "timeline",
52659
+ style: {
52660
+ height: `${height}px`
52661
+ },
52662
+ children: content()
52663
+ })]
52664
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
52665
+ items: legendItems,
52666
+ layout: legendLayout,
52667
+ interactive: legendInteractive,
52668
+ style: legendStyle
52669
+ })]
52670
+ });
52671
+ }
52672
+
52404
52673
  const {
52405
52674
  useToken
52406
52675
  } = antd.theme;
@@ -52604,7 +52873,7 @@ const RadarChart = ({
52604
52873
  * @param {boolean} doubleDigit - Whether to ensure single digit numbers are padded with a leading zero
52605
52874
  * @returns {string} Formatted number string or '--' if input is not a number
52606
52875
  */
52607
- const renderNumber = (val, doubleDigit = false) => {
52876
+ const renderNumber$1 = (val, doubleDigit = false) => {
52608
52877
  if (typeof val !== 'number') {
52609
52878
  return '-';
52610
52879
  }
@@ -54057,6 +54326,344 @@ const getRedirectLink = (link, APP) => {
54057
54326
  return link;
54058
54327
  };
54059
54328
 
54329
+ const buildBreadCrumbs = ({
54330
+ config,
54331
+ items,
54332
+ t,
54333
+ breadCrumbsLabels,
54334
+ id,
54335
+ getRedirectLink,
54336
+ createOnClick,
54337
+ goTo,
54338
+ view,
54339
+ skipInteractions = false
54340
+ }) => {
54341
+ const pathConfig = config.path || [];
54342
+ pathConfig.forEach(pathItem => {
54343
+ if (typeof pathItem === 'string') {
54344
+ items.push({
54345
+ label: t(breadCrumbsLabels[pathItem]),
54346
+ onClick: () => {}
54347
+ });
54348
+ } else if (typeof pathItem === 'object') {
54349
+ const {
54350
+ key,
54351
+ link,
54352
+ useRedirect
54353
+ } = pathItem;
54354
+ if (key === 'id' && id) {
54355
+ const resolvedLink = typeof link === 'function' ? link(id) : link;
54356
+ const finalLink = useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
54357
+ items.push({
54358
+ label: id,
54359
+ onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
54360
+ });
54361
+ } else {
54362
+ const resolvedLink = typeof link === 'function' ? link(view, id) : link;
54363
+ const finalLink = resolvedLink && useRedirect ? getRedirectLink(resolvedLink) : resolvedLink;
54364
+ items.push({
54365
+ label: t(breadCrumbsLabels[key]),
54366
+ onClick: skipInteractions ? () => {} : finalLink ? createOnClick(() => goTo(finalLink)) : () => {}
54367
+ });
54368
+ }
54369
+ }
54370
+ });
54371
+ if (config.includeId && id && id !== 'user') {
54372
+ items.push({
54373
+ label: id,
54374
+ onClick: () => {}
54375
+ });
54376
+ }
54377
+ if (config.suffix) {
54378
+ config.suffix.forEach(suffixItem => {
54379
+ items.push({
54380
+ label: t(breadCrumbsLabels[suffixItem]),
54381
+ onClick: () => {}
54382
+ });
54383
+ });
54384
+ }
54385
+ };
54386
+ const renderBreadCrumbs = ({
54387
+ t = () => {},
54388
+ goTo = () => {},
54389
+ view,
54390
+ isAnalysis = false,
54391
+ isEdit = false,
54392
+ isView = false,
54393
+ isDataStore = false,
54394
+ id,
54395
+ addedItems = [],
54396
+ changeNotificationState,
54397
+ breadCrumbConfig = {},
54398
+ breadCrumbsLabels = {},
54399
+ getRedirectLink = () => {},
54400
+ condition,
54401
+ conditionFallback = 'show-non-interactive' // 'show-non-interactive' | 'hide' | 'show-simplified'
54402
+ }) => {
54403
+ const items = [];
54404
+ const createOnClick = callback => {
54405
+ if (!callback) return () => {};
54406
+ return () => {
54407
+ if (changeNotificationState) {
54408
+ changeNotificationState({
54409
+ onYes: callback
54410
+ });
54411
+ } else {
54412
+ callback();
54413
+ }
54414
+ };
54415
+ };
54416
+ const evaluateCondition = (cond, context) => {
54417
+ if (cond === undefined) return true; // No condition = always pass
54418
+ if (typeof cond === 'function') return cond(context); // Function condition
54419
+ return Boolean(cond); // Boolean condition
54420
+ };
54421
+ const config = breadCrumbConfig[view];
54422
+ if (config) {
54423
+ const conditionContext = {
54424
+ isDataStore,
54425
+ isAnalysis,
54426
+ isEdit,
54427
+ isView,
54428
+ id,
54429
+ view,
54430
+ t,
54431
+ goTo,
54432
+ getRedirectLink,
54433
+ changeNotificationState,
54434
+ addedItems
54435
+ };
54436
+ const externalConditionPassed = evaluateCondition(condition, conditionContext);
54437
+ const configConditionPassed = evaluateCondition(config.condition, conditionContext);
54438
+ if (!configConditionPassed) {
54439
+ if (config.fallback) {
54440
+ buildBreadCrumbs({
54441
+ config: config.fallback,
54442
+ items,
54443
+ t,
54444
+ breadCrumbsLabels,
54445
+ id,
54446
+ getRedirectLink,
54447
+ createOnClick,
54448
+ goTo,
54449
+ view
54450
+ });
54451
+ }
54452
+ } else if (!externalConditionPassed) {
54453
+ if (config.fallback) {
54454
+ // Use config fallback when prop condition fails
54455
+ buildBreadCrumbs({
54456
+ config: config.fallback,
54457
+ items,
54458
+ t,
54459
+ breadCrumbsLabels,
54460
+ id,
54461
+ getRedirectLink,
54462
+ createOnClick,
54463
+ goTo,
54464
+ view
54465
+ });
54466
+ } else {
54467
+ switch (conditionFallback) {
54468
+ case 'hide':
54469
+ break;
54470
+ case 'show-simplified':
54471
+ {
54472
+ const simplifiedConfig = {
54473
+ ...config,
54474
+ path: config.path.slice(0, 2),
54475
+ includeId: false,
54476
+ suffix: undefined
54477
+ };
54478
+ buildBreadCrumbs({
54479
+ config: simplifiedConfig,
54480
+ items,
54481
+ t,
54482
+ breadCrumbsLabels,
54483
+ id,
54484
+ getRedirectLink,
54485
+ createOnClick,
54486
+ goTo,
54487
+ view
54488
+ });
54489
+ break;
54490
+ }
54491
+ case 'show-non-interactive':
54492
+ default:
54493
+ buildBreadCrumbs({
54494
+ config,
54495
+ items,
54496
+ t,
54497
+ breadCrumbsLabels,
54498
+ id,
54499
+ getRedirectLink,
54500
+ createOnClick,
54501
+ goTo,
54502
+ view,
54503
+ skipInteractions: true
54504
+ });
54505
+ break;
54506
+ }
54507
+ }
54508
+ } else {
54509
+ buildBreadCrumbs({
54510
+ config,
54511
+ items,
54512
+ t,
54513
+ breadCrumbsLabels,
54514
+ id,
54515
+ getRedirectLink,
54516
+ createOnClick,
54517
+ goTo,
54518
+ view
54519
+ });
54520
+ }
54521
+ }
54522
+ if (isView) {
54523
+ items.push({
54524
+ label: t(breadCrumbsLabels.details)
54525
+ });
54526
+ } else if (isEdit) {
54527
+ items.push({
54528
+ label: t(breadCrumbsLabels.edit)
54529
+ });
54530
+ } else if (isAnalysis) {
54531
+ items.push({
54532
+ label: t(breadCrumbsLabels.summary)
54533
+ });
54534
+ }
54535
+ items.push(...addedItems);
54536
+ return items.filter(v => !!v.label);
54537
+ };
54538
+
54539
+ // Breadcrumbs Config Helper
54540
+
54541
+ // 1.Simple static path
54542
+ // 'country-overview': {
54543
+ // path: ['analysis', 'country-overview'],
54544
+ // }
54545
+ // Result: Analysis > Country Overview
54546
+ // Neither is clickable
54547
+
54548
+ // 2.Clickable Parents with Links
54549
+ // 'mines': {
54550
+ // path: [
54551
+ // 'modules', // Not clickable
54552
+ // { key: 'mines', link: '/app/mines' } // Clickable, navigates to /app/mines
54553
+ // ],
54554
+ // }
54555
+ // Result: Modules > Mines (clickable)
54556
+
54557
+ // 3.Include ID at the end
54558
+ // 'partners': {
54559
+ // path: ['modules', { key: 'partners', link: '/app/partners', useRedirect: true }],
54560
+ // includeId: true, // ← ID will be added at the end
54561
+ // }
54562
+ // With id='ABC123':
54563
+ // Result: Modules > Partners (clickable) > ABC123 (not clickable)
54564
+
54565
+ // 4.Dynamic Id in the middle
54566
+ // 'mine-evaluation': {
54567
+ // path: [
54568
+ // 'modules',
54569
+ // { key: 'mines', link: '/app/mines' },
54570
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // ← ID here
54571
+ // 'evaluation',
54572
+ // ],
54573
+ // }
54574
+ // With id='MINE-456':
54575
+ // Result: Modules > Mines > MINE-456 (clickable to /app/mines/MINE-456) > Evaluation
54576
+
54577
+ // 5. Dynamic Links using functions
54578
+ // 'producers': {
54579
+ // path: [
54580
+ // 'modules',
54581
+ // {
54582
+ // key: 'producers',
54583
+ // link: (view) => `/app/${view}`, // ← Uses 'view' parameter
54584
+ // useRedirect: true
54585
+ // }
54586
+ // ],
54587
+ // includeId: true,
54588
+ // }
54589
+ // With view='producers':
54590
+ // Result: Modules > Producers (navigates to /app/producers)
54591
+
54592
+ // 6.use Redirect link
54593
+ // 'settings': {
54594
+ // path: [
54595
+ // {
54596
+ // key: 'settings',
54597
+ // link: '/app/view/settings',
54598
+ // useRedirect: true // ← Wraps with getRedirectLink()
54599
+ // }
54600
+ // ],
54601
+ // }
54602
+ // Navigation will use getRedirectLink('/app/view/settings')
54603
+
54604
+ // 7.Conditional Rendering
54605
+ // 'entities': {
54606
+ // condition: (opts) => opts.isDataStore, // ← Only shows if isDataStore=true
54607
+ // path: [
54608
+ // 'data',
54609
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
54610
+ // { key: 'entities', link: '/app/data-store/entities', useRedirect: true },
54611
+ // ],
54612
+ // }
54613
+ // With isDataStore=false: No breadcrumbs shown
54614
+ // With isDataStore=true: Data > Store > Entities
54615
+
54616
+ // 8.Conditional Fallback
54617
+ // 'locations': {
54618
+ // condition: (opts) => opts.isDataStore,
54619
+ // path: [
54620
+ // 'data',
54621
+ // { key: 'data-store', link: '/app/data-store', useRedirect: true },
54622
+ // { key: 'locations', link: '/app/data-store/locations', useRedirect: true },
54623
+ // ],
54624
+ // fallback: { // ← Alternative when condition is false
54625
+ // path: [
54626
+ // 'modules',
54627
+ // 'linkedSubjects',
54628
+ // { key: 'locations', link: '/app/locations', useRedirect: true },
54629
+ // ],
54630
+ // includeId: true,
54631
+ // },
54632
+ // }
54633
+ // isDataStore=true: Data > Store > Locations
54634
+ // isDataStore=false: Modules > Associated Information > Locations > {id}
54635
+
54636
+ // 9. Suffix items
54637
+ // 'mine-monitoring': {
54638
+ // path: [
54639
+ // 'modules',
54640
+ // { key: 'mines', link: '/app/mines' }
54641
+ // ],
54642
+ // includeId: true,
54643
+ // suffix: ['visits'], // ← Added at the end
54644
+ // }
54645
+ // With id='MINE-789':
54646
+ // Result: Modules > Mines > MINE-789 > Visits
54647
+
54648
+ // 10. Complex multi level path
54649
+ // 'monitoringReport': {
54650
+ // path: [
54651
+ // 'modules', // Static label
54652
+ // { key: 'mines', link: '/app/mines' }, // Clickable parent
54653
+ // { key: 'id', link: (id) => `/app/mines/${id}` }, // Dynamic ID with link
54654
+ // 'monitoringReport', // Static label at end
54655
+ // ],
54656
+ // }
54657
+ // With id='MINE-999':
54658
+ // Result: Modules > Mines (→/app/mines) > MINE-999 (→/app/mines/MINE-999) > Executive Monitoring Report
54659
+
54660
+ // 11. Access multiple options in condition
54661
+ // 'custom-view': {
54662
+ // condition: (opts) => opts.isDataStore && opts.isEdit && opts.id,
54663
+ // path: ['data', 'custom'],
54664
+ // }
54665
+ // Available in opts: { isDataStore, isAnalysis, isEdit, isView, id, view }
54666
+
54060
54667
  styled__default["default"].div`
54061
54668
  display: flex;
54062
54669
  flex-direction: column;
@@ -54918,7 +55525,7 @@ const PlantingLocations = ({
54918
55525
  const {
54919
55526
  loading: plantingLocationsLoading,
54920
55527
  data: plantingLocationsData
54921
- } = useWidgetFetch({
55528
+ } = useWidgetFetch$1({
54922
55529
  config: defaultConfig,
54923
55530
  getData: customGetData
54924
55531
  });
@@ -55063,7 +55670,7 @@ const getFormatDate = (date, breakLine = false, timeFilter = 'monthly') => {
55063
55670
  case "daily":
55064
55671
  return date.format("DD/MM");
55065
55672
  case "weekly":
55066
- return `W${renderNumber(date.week())}`;
55673
+ return `W${renderNumber$1(date.week())}`;
55067
55674
  default:
55068
55675
  // Monthly format: "Dec 24", "Jan 25", etc.
55069
55676
 
@@ -55616,7 +56223,7 @@ const CycleOutcomes = ({
55616
56223
  const {
55617
56224
  loading: dataDetailsLoading,
55618
56225
  data: dataDetails
55619
- } = useWidgetFetch({
56226
+ } = useWidgetFetch$1({
55620
56227
  config: defaultConfig,
55621
56228
  getData: customGetData
55622
56229
  });
@@ -55952,7 +56559,7 @@ const getHealthAndSafetyTooltipChildren = (item, isEmpty, healthAndSafetyDistrib
55952
56559
  });
55953
56560
  };
55954
56561
 
55955
- const filterOptions = [{
56562
+ const filterOptions$1 = [{
55956
56563
  value: 'aidKitAccessible',
55957
56564
  label: 'Aid kit availability'
55958
56565
  }, {
@@ -56004,7 +56611,7 @@ const HealthAndSafety = ({
56004
56611
  const {
56005
56612
  loading: pieChartLoading,
56006
56613
  data: pieChartData
56007
- } = useWidgetFetch({
56614
+ } = useWidgetFetch$1({
56008
56615
  config: defaultConfig,
56009
56616
  getData: customGetData
56010
56617
  });
@@ -56053,7 +56660,7 @@ const HealthAndSafety = ({
56053
56660
 
56054
56661
  // Get the label for the selected field to use as tooltip title
56055
56662
  const selectedFieldLabel = React.useMemo(() => {
56056
- const selectedOption = filterOptions.find(opt => opt.value === selectedField);
56663
+ const selectedOption = filterOptions$1.find(opt => opt.value === selectedField);
56057
56664
  return selectedOption ? selectedOption.label : 'Health and Safety';
56058
56665
  }, [selectedField]);
56059
56666
  const getTooltipChildren = React.useCallback(item => getHealthAndSafetyTooltipChildren(item, isEmpty, healthAndSafetyDistributionData, t, renderTooltipJsx, selectedFieldLabel), [t, isEmpty, healthAndSafetyDistributionData, selectedFieldLabel]);
@@ -56076,7 +56683,7 @@ const HealthAndSafety = ({
56076
56683
  width: 180
56077
56684
  },
56078
56685
  onChange: handleFilterChange,
56079
- options: filterOptions.map(opt => ({
56686
+ options: filterOptions$1.map(opt => ({
56080
56687
  ...opt,
56081
56688
  label: t(opt.label)
56082
56689
  })),
@@ -56133,7 +56740,7 @@ const CycleIndicators = ({
56133
56740
  const {
56134
56741
  loading: indicatorsLoading,
56135
56742
  data: indicatorsData
56136
- } = useWidgetFetch({
56743
+ } = useWidgetFetch$1({
56137
56744
  config: defaultConfig,
56138
56745
  getData: customGetData
56139
56746
  });
@@ -56642,7 +57249,7 @@ const CommunityParticipation = ({
56642
57249
  const {
56643
57250
  loading: communityParticipationLoading,
56644
57251
  data: communityParticipationData
56645
- } = useWidgetFetch({
57252
+ } = useWidgetFetch$1({
56646
57253
  config: defaultConfig,
56647
57254
  getData: customGetData
56648
57255
  });
@@ -57363,7 +57970,7 @@ const AssociatedInformation = ({
57363
57970
  loading: associatedInformationLoading,
57364
57971
  data: associatedInformationData,
57365
57972
  setData
57366
- } = useWidgetFetch({
57973
+ } = useWidgetFetch$1({
57367
57974
  config: defaultConfig,
57368
57975
  getData: customGetData
57369
57976
  });
@@ -57497,7 +58104,7 @@ const KeyInformation$1 = ({
57497
58104
  const {
57498
58105
  loading: keyInformationLoading,
57499
58106
  data: keyInformationData
57500
- } = useWidgetFetch({
58107
+ } = useWidgetFetch$1({
57501
58108
  config: defaultConfig,
57502
58109
  getData: customGetData
57503
58110
  });
@@ -57647,7 +58254,7 @@ const KeyInformation = ({
57647
58254
  const {
57648
58255
  loading: keyInformationLoading,
57649
58256
  data: keyInformationData
57650
- } = useWidgetFetch({
58257
+ } = useWidgetFetch$1({
57651
58258
  config: defaultConfig,
57652
58259
  getData: customGetData
57653
58260
  });
@@ -57704,7 +58311,7 @@ const MonitoringScopeAndFindings = ({
57704
58311
  const {
57705
58312
  loading: monitoringScopeLoading,
57706
58313
  data: monitoringScopeData
57707
- } = useWidgetFetch({
58314
+ } = useWidgetFetch$1({
57708
58315
  config: defaultConfig,
57709
58316
  getData: customGetData
57710
58317
  });
@@ -58492,7 +59099,7 @@ const MangroveGrowth = ({
58492
59099
  const {
58493
59100
  loading: outcomesLoading,
58494
59101
  data: outcomesData
58495
- } = useWidgetFetch({
59102
+ } = useWidgetFetch$1({
58496
59103
  config: defaultConfig,
58497
59104
  getData: customGetData
58498
59105
  });
@@ -58772,7 +59379,7 @@ const BiodiversityHabitat = ({
58772
59379
  const {
58773
59380
  loading: outcomesLoading,
58774
59381
  data: outcomesData
58775
- } = useWidgetFetch({
59382
+ } = useWidgetFetch$1({
58776
59383
  config: defaultConfig,
58777
59384
  getData: customGetData
58778
59385
  });
@@ -59047,7 +59654,7 @@ const SalinityLevels = ({
59047
59654
  title: options?.soilTypes?.find(option => option.value === item?.soilType)?.label || title,
59048
59655
  items: [{
59049
59656
  label: t("Average salinity"),
59050
- value: `${renderNumber(item?.value || 0)} dS/m`
59657
+ value: `${renderNumber$1(item?.value || 0)} dS/m`
59051
59658
  }]
59052
59659
  };
59053
59660
  }
@@ -59164,7 +59771,7 @@ const SoilWaterProfile = ({
59164
59771
  const {
59165
59772
  loading: outcomesLoading,
59166
59773
  data: outcomesData
59167
- } = useWidgetFetch({
59774
+ } = useWidgetFetch$1({
59168
59775
  config: defaultConfig,
59169
59776
  getData: customGetData
59170
59777
  });
@@ -59402,7 +60009,7 @@ const StakeholderMapping = ({
59402
60009
  const {
59403
60010
  data,
59404
60011
  loading
59405
- } = useWidgetFetch({
60012
+ } = useWidgetFetch$1({
59406
60013
  config: defaultFilter
59407
60014
  });
59408
60015
  const graphData = React.useMemo(() => {
@@ -59593,7 +60200,7 @@ const MineDetailsSection = ({
59593
60200
  const {
59594
60201
  data,
59595
60202
  loading: loadingData
59596
- } = useWidgetFetch({
60203
+ } = useWidgetFetch$1({
59597
60204
  config: defaultFetchConfig
59598
60205
  });
59599
60206
  return /*#__PURE__*/jsxRuntime.jsxs("section", {
@@ -59779,7 +60386,7 @@ const getKeyIndicatorsRowConfig = ({
59779
60386
  }, {
59780
60387
  label: t('Monitored Area'),
59781
60388
  render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
59782
- children: data?.totalAreaParcelMonitored ? `${renderNumber(data?.totalAreaParcelMonitored)} ha` : '0 ha'
60389
+ children: data?.totalAreaParcelMonitored ? `${renderNumber$1(data?.totalAreaParcelMonitored)} ha` : '0 ha'
59783
60390
  })
59784
60391
  }];
59785
60392
  const getSiteConditionsConfig = ({
@@ -59822,12 +60429,12 @@ const getEnvironmentalMetricsConfig = ({
59822
60429
  }, {
59823
60430
  label: t('Soil Salinity'),
59824
60431
  render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
59825
- children: data?.soilSalinity ? `${renderNumber(data.soilSalinity)} ${data?.soilSalinityUnit || 'dS/m'}` : '-'
60432
+ children: data?.soilSalinity ? `${renderNumber$1(data.soilSalinity)} ${data?.soilSalinityUnit || 'dS/m'}` : '-'
59826
60433
  })
59827
60434
  }, {
59828
60435
  label: t('pH Level'),
59829
60436
  render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
59830
- children: renderNumber(data?.phLevel) || '-'
60437
+ children: renderNumber$1(data?.phLevel) || '-'
59831
60438
  })
59832
60439
  }, {
59833
60440
  label: t('Water Quality'),
@@ -62902,6 +63509,1068 @@ const Edit = ({
62902
63509
  });
62903
63510
  };
62904
63511
 
63512
+ const renderNumber = (number, locale = 'en') => {
63513
+ return new Intl.NumberFormat(locale).format(number);
63514
+ };
63515
+ const getRowConfig = ({
63516
+ t,
63517
+ data = {},
63518
+ goTo,
63519
+ getRedirectLink,
63520
+ theme = {}
63521
+ }) => [{
63522
+ label: /*#__PURE__*/jsxRuntime.jsxs("div", {
63523
+ className: "flex",
63524
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
63525
+ className: "flex-1",
63526
+ children: t("Identified Armed Groups")
63527
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
63528
+ className: "cursor-pointer",
63529
+ onClick: () => goTo(getRedirectLink("/app/armed-groups")),
63530
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
63531
+ name: "LinkNewTab",
63532
+ width: 16,
63533
+ height: 16,
63534
+ color: theme.colorPrimary
63535
+ })
63536
+ })]
63537
+ }),
63538
+ render: () => {
63539
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
63540
+ children: renderNumber(data.armedGroups ?? 0, "en")
63541
+ });
63542
+ }
63543
+ }, {
63544
+ label: /*#__PURE__*/jsxRuntime.jsxs("div", {
63545
+ className: "flex",
63546
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
63547
+ className: "flex-1",
63548
+ children: t("Reported Incidents")
63549
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
63550
+ className: "cursor-pointer",
63551
+ onClick: () => goTo(getRedirectLink("/app/incident")),
63552
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
63553
+ name: "LinkNewTab",
63554
+ width: 16,
63555
+ height: 16,
63556
+ color: theme.colorPrimary
63557
+ })
63558
+ })]
63559
+ }),
63560
+ render: () => /*#__PURE__*/jsxRuntime.jsx("span", {
63561
+ children: renderNumber(data?.incidents ?? 0, "en")
63562
+ })
63563
+ }, {
63564
+ label: /*#__PURE__*/jsxRuntime.jsxs("div", {
63565
+ className: "flex",
63566
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
63567
+ className: "flex-1",
63568
+ children: t("Monitored Locations")
63569
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
63570
+ className: "cursor-pointer",
63571
+ onClick: () => goTo(getRedirectLink("/app/locations")),
63572
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
63573
+ name: "LinkNewTab",
63574
+ width: 16,
63575
+ height: 16,
63576
+ color: theme.colorPrimary
63577
+ })
63578
+ })]
63579
+ }),
63580
+ render: () => /*#__PURE__*/jsxRuntime.jsx("span", {
63581
+ children: renderNumber(data.locations ?? 0, "en")
63582
+ })
63583
+ }, {
63584
+ label: /*#__PURE__*/jsxRuntime.jsxs("div", {
63585
+ className: "flex",
63586
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
63587
+ className: "flex-1",
63588
+ children: t("Testimonials")
63589
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
63590
+ className: "cursor-pointer",
63591
+ onClick: () => goTo(getRedirectLink("/app/testimonials")),
63592
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
63593
+ name: "LinkNewTab",
63594
+ width: 16,
63595
+ height: 16,
63596
+ color: theme.colorPrimary
63597
+ })
63598
+ })]
63599
+ }),
63600
+ render: () => /*#__PURE__*/jsxRuntime.jsx("span", {
63601
+ children: renderNumber(data.testimonials ?? 0, "en")
63602
+ })
63603
+ }, {
63604
+ label: /*#__PURE__*/jsxRuntime.jsxs("div", {
63605
+ className: "flex",
63606
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
63607
+ className: "flex-1",
63608
+ children: t("Information Sources")
63609
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
63610
+ className: "cursor-pointer",
63611
+ onClick: () => goTo(getRedirectLink("/app/partners")),
63612
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
63613
+ name: "LinkNewTab",
63614
+ width: 16,
63615
+ height: 16,
63616
+ color: theme.colorPrimary
63617
+ })
63618
+ })]
63619
+ }),
63620
+ render: () => /*#__PURE__*/jsxRuntime.jsx("span", {
63621
+ children: renderNumber(data.partners ?? 0, "en")
63622
+ })
63623
+ }];
63624
+
63625
+ const defaultFetchConfig = {
63626
+ url: "/informations",
63627
+ filters: {},
63628
+ basepath: "dashboard/conflict-management"
63629
+ };
63630
+ function KeyIndicators({
63631
+ selectedPartners = {},
63632
+ partners = 0,
63633
+ t = s => s,
63634
+ goTo = () => {},
63635
+ getRedirectLink = s => s,
63636
+ theme = {}
63637
+ }) {
63638
+ const fetchConfig = React.useMemo(() => ({
63639
+ ...defaultFetchConfig,
63640
+ filters: {
63641
+ sources: selectedPartners?.partners || []
63642
+ },
63643
+ stop: selectedPartners?.loading
63644
+ }), [selectedPartners]);
63645
+ const {
63646
+ data,
63647
+ loading
63648
+ } = useWidgetFetch$1({
63649
+ config: fetchConfig
63650
+ });
63651
+ const config = React.useMemo(() => getRowConfig({
63652
+ t,
63653
+ data: {
63654
+ ...data,
63655
+ partners
63656
+ },
63657
+ goTo,
63658
+ getRedirectLink,
63659
+ theme
63660
+ }), [t, data, goTo, getRedirectLink, partners, theme]);
63661
+ return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
63662
+ t: t,
63663
+ config: config,
63664
+ loading: loading,
63665
+ title: t("Key Information"),
63666
+ className: "small-content"
63667
+ });
63668
+ }
63669
+
63670
+ const areaColors = ["#6698E4", "#B37FEB", "#FF9C6E", "#95DE64", "#FF85C0"];
63671
+
63672
+ const TERRITORY_MAP = "territory";
63673
+ const EVENT_MAP = "event";
63674
+ function MineSites({
63675
+ selectedPartners = {},
63676
+ t = s => s,
63677
+ goTo = () => {},
63678
+ getRedirectLink = s => s,
63679
+ theme = {},
63680
+ APP,
63681
+ options = {},
63682
+ user = {}
63683
+ }) {
63684
+ const tabs = React.useMemo(() => [{
63685
+ value: TERRITORY_MAP,
63686
+ label: t("Armed Groups")
63687
+ }, {
63688
+ value: EVENT_MAP,
63689
+ label: t("Incidents")
63690
+ }], [t]);
63691
+ const [filters, setFilters] = React.useState({});
63692
+ const [activeTab, setActiveTab] = React.useState(tabs[0].value);
63693
+
63694
+ // useEffect(() => {
63695
+ // setFilters({});
63696
+ // }, [activeTab]);
63697
+
63698
+ const defaultFetchConfig = React.useMemo(() => ({
63699
+ basepath: "analytics",
63700
+ url: "/widgets/gps-monitoring",
63701
+ filters: {
63702
+ activeTab,
63703
+ sources: selectedPartners?.partners || [],
63704
+ ...filters,
63705
+ ...(activeTab === 'event' ? {
63706
+ eventTypes: ['incident']
63707
+ } : {})
63708
+ },
63709
+ defaultData: [],
63710
+ stop: selectedPartners?.loading
63711
+ }), [activeTab, selectedPartners, filters]);
63712
+ const {
63713
+ data,
63714
+ loading
63715
+ } = useWidgetFetch$1({
63716
+ config: defaultFetchConfig
63717
+ });
63718
+ // const { user } = useSelector((state) => state.authentication);
63719
+
63720
+ const filtersConfig = React.useMemo(() => {
63721
+ if (activeTab === EVENT_MAP) {
63722
+ return [{
63723
+ label: t("Location type"),
63724
+ placeholder: t("Select"),
63725
+ key: "category",
63726
+ type: "select",
63727
+ value: filters?.category || "all",
63728
+ options: [{
63729
+ label: t("All"),
63730
+ value: "all"
63731
+ }, ...(options?.locationCategories || [])]
63732
+ }];
63733
+ }
63734
+ }, [activeTab, filters, t, options.locationCategories]);
63735
+ const onFilterChange = filters => {
63736
+ setFilters(p => ({
63737
+ ...p,
63738
+ ...filters
63739
+ }));
63740
+ };
63741
+ const renderTooltip = data => {
63742
+ if (activeTab === TERRITORY_MAP) {
63743
+ return [{
63744
+ label: t("Members"),
63745
+ value: data.numberOfMembers || "--"
63746
+ }, {
63747
+ label: t("Location"),
63748
+ value: data?.headquarters || "--"
63749
+ }];
63750
+ } else {
63751
+ return [{
63752
+ label: t("Major Incidents"),
63753
+ color: "#F04438",
63754
+ value: data?.totals?.major
63755
+ }, {
63756
+ label: t("Moderate Incidents"),
63757
+ color: "#FF7A45",
63758
+ value: data?.totals?.moderate
63759
+ }, {
63760
+ label: t("Minor Incidents"),
63761
+ color: "#FFC069",
63762
+ value: data?.totals?.minor
63763
+ }];
63764
+ }
63765
+ };
63766
+ const onClickLink = data => {
63767
+ const sourceId = data?.authorId;
63768
+ const getLink = link => getRedirectLink(sourceId && sourceId !== user?.company?.id ? `${link}?sourceId=${sourceId}` : link);
63769
+ if (activeTab === TERRITORY_MAP) {
63770
+ goTo(`/app/view/armed-groups/${data?.datastakeId}`);
63771
+ } else {
63772
+ switch (data?.category) {
63773
+ case "mineSite":
63774
+ return goTo(getLink(`/app/mine-summary/${data?.datastakeId}`));
63775
+ case "area":
63776
+ return goTo(getLink(`/app/view/conflict-areas/${data?.datastakeId}`));
63777
+ default:
63778
+ goTo(getLink(`/app/view/locations/${data?.datastakeId}`));
63779
+ }
63780
+ }
63781
+ };
63782
+ const mapData = React.useMemo(() => {
63783
+ if (activeTab === TERRITORY_MAP) {
63784
+ const safeData = Array.isArray(data) ? data : [];
63785
+ if (safeData.length === 0) return [];
63786
+ return safeData.map((d, index) => {
63787
+ return {
63788
+ ...d,
63789
+ area: d?.areaOfInfluence?.areaOfInfluence || {},
63790
+ gps: {
63791
+ latitude: 7,
63792
+ longitude: 1
63793
+ },
63794
+ color: areaColors[index % areaColors.length]
63795
+ };
63796
+ });
63797
+ } else {
63798
+ const safeData = Array.isArray(data) ? data : [];
63799
+ if (safeData.length === 0) return [];
63800
+ const locations = {};
63801
+ data.filter(d => d?.location).forEach(d => {
63802
+ const {
63803
+ location,
63804
+ ...rest
63805
+ } = d;
63806
+ const event = {
63807
+ ...rest,
63808
+ type: rest.severity ? `${rest.severity}_incident` : ""
63809
+ };
63810
+ if (locations[location.datastakeId]) {
63811
+ locations[location.datastakeId].data.push(event);
63812
+ } else {
63813
+ locations[location.datastakeId] = {
63814
+ gps: location.gps,
63815
+ name: location.name,
63816
+ datastakeId: location.datastakeId,
63817
+ authorId: location?.authorId,
63818
+ data: [event],
63819
+ type: options.locationCategories.find(c => c.value === location.category)?.label,
63820
+ category: location.category
63821
+ };
63822
+ }
63823
+ });
63824
+ return Object.values(locations).map(d => {
63825
+ d.data.forEach(d => {
63826
+ if (Array.isArray(d.sources)) {
63827
+ d.sources.forEach(s => {
63828
+ });
63829
+ }
63830
+ });
63831
+ return {
63832
+ ...d,
63833
+ total: d.data.length || 0
63834
+ };
63835
+ });
63836
+ }
63837
+ }, [activeTab, data.length, data, options.locationCategory, filters.type]);
63838
+ const _mapData = React.useMemo(() => {
63839
+ return mapData?.filter(d => d?.gps);
63840
+ }, [activeTab, mapData]);
63841
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
63842
+ loading: loading,
63843
+ title: t("Conflict Map"),
63844
+ className: "v2-widget no-px no-pb-body h-w-btn-header",
63845
+ tabsConfig: {
63846
+ tabs,
63847
+ value: activeTab,
63848
+ onChange: setActiveTab
63849
+ },
63850
+ children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
63851
+ t: t,
63852
+ app: APP,
63853
+ showSider: false,
63854
+ user: user,
63855
+ data: _mapData,
63856
+ mapConfig: {
63857
+ maxZoom: 10
63858
+ },
63859
+ primaryLink: true,
63860
+ type: activeTab,
63861
+ onFilterChange: onFilterChange,
63862
+ filtersConfig: activeTab === TERRITORY_MAP ? undefined : filtersConfig,
63863
+ renderTooltip: renderTooltip,
63864
+ onClickLink: onClickLink,
63865
+ link: true
63866
+ }, activeTab)
63867
+ });
63868
+ }
63869
+
63870
+ function useIncidentsTimeline({
63871
+ t = () => {},
63872
+ options = {}
63873
+ }) {
63874
+ const [filters, setFilters] = React.useState({
63875
+ severity: "all"
63876
+ });
63877
+ const filtersConfig = React.useMemo(() => ({
63878
+ filtersConfig: {
63879
+ severity: {
63880
+ type: "select",
63881
+ label: "",
63882
+ placeholder: t => t(""),
63883
+ style: {
63884
+ flex: 1
63885
+ },
63886
+ labelStyle: {
63887
+ flex: 1
63888
+ }
63889
+ }
63890
+ },
63891
+ onApply: val => setFilters(val),
63892
+ options: {
63893
+ severity: [{
63894
+ value: "all",
63895
+ label: t("All")
63896
+ }, ...(options?.severityOptions || [])]
63897
+ },
63898
+ selectedFilters: filters,
63899
+ type: "small",
63900
+ t
63901
+ }), [t, filters, options?.severityOptions]);
63902
+ return {
63903
+ filters,
63904
+ filtersConfig
63905
+ };
63906
+ }
63907
+
63908
+ function IncidentsTime({
63909
+ selectedRange,
63910
+ selectedPartners = {},
63911
+ t = () => {},
63912
+ goTo = s => s,
63913
+ getRedirectLink = s => s,
63914
+ theme = {},
63915
+ APP,
63916
+ options = {}
63917
+ }) {
63918
+ const {
63919
+ filters,
63920
+ filtersConfig
63921
+ } = useIncidentsTimeline({
63922
+ t,
63923
+ options
63924
+ });
63925
+ const {
63926
+ user
63927
+ } = useSelector(state => state.authentication);
63928
+ React.useCallback(sourceId => {
63929
+ if (user?.company?.id !== sourceId) {
63930
+ return `?sourceId=${sourceId}`;
63931
+ }
63932
+ return "";
63933
+ }, [user?.company?.id]);
63934
+ const defaultFetchConfig = React.useMemo(() => ({
63935
+ url: `/incidents-timeline`,
63936
+ filters: {
63937
+ ...filters,
63938
+ severity: filters.severity ? filters.severity : "all",
63939
+ period: selectedRange,
63940
+ sources: selectedPartners?.partners || []
63941
+ },
63942
+ defaultData: [],
63943
+ stop: selectedPartners?.loading
63944
+ }), [filters, selectedRange, selectedPartners]);
63945
+ const chartConfig = {};
63946
+ const {
63947
+ data,
63948
+ loading
63949
+ } = useWidgetFetch(defaultFetchConfig);
63950
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
63951
+ loading: loading,
63952
+ filtersConfig: filtersConfig,
63953
+ title: t("Incidents Timeline"),
63954
+ className: "with-border-header",
63955
+ t: t,
63956
+ children: /*#__PURE__*/jsxRuntime.jsx(StackChart, {
63957
+ ...chartConfig,
63958
+ height: "400px",
63959
+ t: t
63960
+ })
63961
+ });
63962
+ }
63963
+ IncidentsTime.propTypes = {
63964
+ selectedRange: PropTypes__default["default"].string,
63965
+ selectedPartners: PropTypes__default["default"].object,
63966
+ t: PropTypes__default["default"].func,
63967
+ goTo: PropTypes__default["default"].func,
63968
+ getRedirectLink: PropTypes__default["default"].func,
63969
+ theme: PropTypes__default["default"].object,
63970
+ APP: PropTypes__default["default"].string,
63971
+ options: PropTypes__default["default"].object
63972
+ };
63973
+
63974
+ function useTerritorialDistribution({
63975
+ t = s => {
63976
+ },
63977
+ options = {}
63978
+ }) {
63979
+ const [filters, setFilters] = React.useState({
63980
+ filter1: 'all',
63981
+ filter2: 'all'
63982
+ });
63983
+ const filtersConfig = React.useMemo(t => ({
63984
+ onApply: val => setFilters(val),
63985
+ options: {
63986
+ filter1: [{
63987
+ label: t('All'),
63988
+ value: 'all'
63989
+ }],
63990
+ filter2: [{
63991
+ label: t('All'),
63992
+ value: 'all'
63993
+ }]
63994
+ },
63995
+ selectedFilters: filters,
63996
+ type: 'small',
63997
+ t
63998
+ }), [t, filters]);
63999
+ return {
64000
+ filters,
64001
+ filtersConfig,
64002
+ setFilters,
64003
+ t
64004
+ };
64005
+ }
64006
+ const getColors = theme => {
64007
+ return [theme.colorPrimary8, theme.colorPrimary7, theme.colorPrimary5, theme.colorPrimary6, theme.colorPrimary4];
64008
+ };
64009
+
64010
+ function TerritorialDistribution({
64011
+ selectedPartners = {},
64012
+ loading: parentLoading = false,
64013
+ t = s => s,
64014
+ theme = {},
64015
+ category = "conflict",
64016
+ selectedRange,
64017
+ goTo = () => {},
64018
+ getRedirectLink = () => {}
64019
+ }) {
64020
+ const {
64021
+ filters,
64022
+ filtersConfig
64023
+ } = useTerritorialDistribution({
64024
+ t
64025
+ });
64026
+ const colors = getColors(theme);
64027
+ const defaultFetchConfig = React.useMemo(() => ({
64028
+ url: "/territorial-distribution",
64029
+ filters: {
64030
+ ...filters,
64031
+ category,
64032
+ period: selectedRange,
64033
+ sources: selectedPartners?.partners || []
64034
+ },
64035
+ defaultData: [],
64036
+ stop: selectedPartners?.loading
64037
+ }), [filters, category, selectedRange, selectedPartners]);
64038
+ const {
64039
+ data,
64040
+ loading
64041
+ } = useWidgetFetch$1({
64042
+ config: defaultFetchConfig
64043
+ });
64044
+ const pieData = React.useMemo(() => {
64045
+ if (!data || Array.isArray(data)) return [];
64046
+ const all = Object.keys(data);
64047
+ const totalEvents = all.reduce((acc, key) => acc + (data[key]?.events?.length || 0), 0);
64048
+ return all.sort((a, b) => (data[b]?.events?.length || 0) - (data[a]?.events?.length || 0)).map((key, index) => {
64049
+ const item = data[key];
64050
+ return {
64051
+ value: item?.events?.length,
64052
+ label: item?.locationData?.name,
64053
+ locationData: item?.locationData,
64054
+ color: colors[index % colors.length],
64055
+ percent: totalEvents ? item?.events?.length / totalEvents : 0
64056
+ };
64057
+ });
64058
+ }, [data, colors]);
64059
+ const isEmpty = !pieData.length;
64060
+ const getTooltipChildren = React.useCallback(items => {
64061
+ const item = items[0];
64062
+ return renderTooltipJsx({
64063
+ title: item?.label || t("Undetermined"),
64064
+ link: true,
64065
+ onClickLink: () => {
64066
+ if (item?.label) {
64067
+ goTo(`/app/incident?administrativeLevel1=${item?.locationData?.administrativeLevel1}&administrativeLevel2=${item?.locationData?.administrativeLevel2}&country=${item?.locationData?.country}`);
64068
+ } else {
64069
+ goTo("/app/incident");
64070
+ }
64071
+ },
64072
+ items: [{
64073
+ label: t("Number of incidents"),
64074
+ value: item?.value
64075
+ }]
64076
+ });
64077
+ }, [t, goTo]);
64078
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
64079
+ loading: loading || parentLoading,
64080
+ title: t("Territorial Distribution"),
64081
+ className: "with-border-header",
64082
+ filtersConfig: filtersConfig,
64083
+ children: /*#__PURE__*/jsxRuntime.jsx(Chart, {
64084
+ mouseXOffset: 10,
64085
+ mouseYOffset: 10,
64086
+ changeOpacityOnHover: false,
64087
+ data: pieData,
64088
+ doConstraints: false,
64089
+ isPie: true,
64090
+ t: t,
64091
+ isEmpty: isEmpty,
64092
+ getTooltipChildren: getTooltipChildren
64093
+ })
64094
+ });
64095
+ }
64096
+ TerritorialDistribution.propTypes = {
64097
+ selectedPartners: PropTypes__default["default"].object,
64098
+ loading: PropTypes__default["default"].bool,
64099
+ t: PropTypes__default["default"].func,
64100
+ theme: PropTypes__default["default"].object,
64101
+ category: PropTypes__default["default"].string,
64102
+ selectedRange: PropTypes__default["default"].string
64103
+ };
64104
+
64105
+ function useProblemSolvers(t = () => {}) {
64106
+ const [filters, setFilters] = React.useState({
64107
+ administrativeLevel1: "all"
64108
+ });
64109
+ const [filterOptions, setFilterOptions] = React.useState([]);
64110
+ React.useEffect(() => {
64111
+ async function fetchOptions() {
64112
+ try {
64113
+ const {
64114
+ data
64115
+ } = await DashboardService$1.getWidget({
64116
+ url: "/problem-solvers"
64117
+ });
64118
+ const rawOptions = Object.keys(data).map(agentKey => {
64119
+ const actions = data[agentKey]?.actions || [];
64120
+ return actions.map(action => {
64121
+ const lvl1 = action?.location?.administrativeLevel1;
64122
+ const name = action?.location?.name || action?.location?.administrativeLevel1 || null;
64123
+ if (!lvl1 || !name) return undefined;
64124
+ return {
64125
+ label: name,
64126
+ value: lvl1
64127
+ };
64128
+ }).filter(Boolean);
64129
+ }).flat();
64130
+ const unique = [...new Map(rawOptions.map(item => [item.value, item])).values()];
64131
+ setFilterOptions(unique);
64132
+ } catch (err) {
64133
+ console.error("Problem Solvers fetch failed:", err);
64134
+ }
64135
+ }
64136
+ fetchOptions();
64137
+ }, []);
64138
+ const filtersConfig = React.useMemo(() => ({
64139
+ filtersConfig: {
64140
+ administrativeLevel1: {
64141
+ type: "select",
64142
+ label: "",
64143
+ placeholder: t("Select"),
64144
+ style: {
64145
+ flex: 1
64146
+ },
64147
+ labelStyle: {
64148
+ flex: 1
64149
+ }
64150
+ }
64151
+ },
64152
+ onApply: val => setFilters(val),
64153
+ options: {
64154
+ administrativeLevel1: [{
64155
+ label: t("All"),
64156
+ value: "all"
64157
+ }, ...filterOptions]
64158
+ },
64159
+ selectedFilters: filters,
64160
+ type: "small",
64161
+ t
64162
+ }), [t, filters, filterOptions]);
64163
+ return {
64164
+ filters,
64165
+ filtersConfig
64166
+ };
64167
+ }
64168
+
64169
+ const distributionColors = ["#3061A8", "#6698E4", "#A6C3EF", "#D6E3F8", "#E6EEFB"];
64170
+ function ProblemSolvers({
64171
+ selectedPartners = {},
64172
+ loading: parentLoading = false,
64173
+ t = () => {},
64174
+ theme = {},
64175
+ selectedRange,
64176
+ goTo = () => {},
64177
+ getRedirectLink = () => {}
64178
+ }) {
64179
+ const {
64180
+ filters,
64181
+ filtersConfig
64182
+ } = useProblemSolvers();
64183
+ const defaultFetchConfig = React.useMemo(() => ({
64184
+ basepath: "conflict-management",
64185
+ url: "/problem-solvers",
64186
+ filters: {
64187
+ ...filters,
64188
+ period: selectedRange,
64189
+ sources: selectedPartners?.partners || []
64190
+ },
64191
+ defaultData: [],
64192
+ stop: selectedPartners?.loading
64193
+ }), [filters, selectedRange, selectedPartners]);
64194
+ const {
64195
+ data,
64196
+ loading
64197
+ } = useWidgetFetch$1({
64198
+ config: defaultFetchConfig
64199
+ });
64200
+ const pieData = React.useMemo(() => {
64201
+ if (!data || Array.isArray(data)) return [];
64202
+ const all = Object.keys(data);
64203
+ const totalActions = all.reduce((acc, key) => acc + (data[key]?.actions?.length || 0), 0);
64204
+ return all.sort((a, b) => (data[b]?.actions?.length || 0) - (data[a]?.actions?.length || 0)).map((key, index) => {
64205
+ const item = data[key];
64206
+ return {
64207
+ value: item?.actions?.length,
64208
+ label: item?.implementerData?.name,
64209
+ implementerData: item?.implementerData,
64210
+ color: distributionColors[index % distributionColors.length],
64211
+ percent: totalActions ? item?.actions?.length / totalActions : 0
64212
+ };
64213
+ });
64214
+ }, [data]);
64215
+ const isEmpty = !pieData.length;
64216
+ const getTooltipChildren = React.useCallback(items => {
64217
+ const item = items[0];
64218
+ return renderTooltipJsx({
64219
+ title: item?.label || t("Undetermined"),
64220
+ link: true,
64221
+ onClickLink: () => {
64222
+ goTo("/app/corrective-actions");
64223
+ },
64224
+ items: [{
64225
+ label: t("Number of actions"),
64226
+ value: item?.value
64227
+ }]
64228
+ });
64229
+ }, [t, goTo]);
64230
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
64231
+ loading: loading || parentLoading,
64232
+ title: t("Problem Solvers"),
64233
+ filtersConfig: filtersConfig,
64234
+ className: "with-border-header",
64235
+ children: /*#__PURE__*/jsxRuntime.jsx(Chart, {
64236
+ mouseXOffset: 10,
64237
+ mouseYOffset: 10,
64238
+ changeOpacityOnHover: false,
64239
+ data: pieData,
64240
+ doConstraints: false,
64241
+ isPie: true,
64242
+ t: t,
64243
+ isEmpty: isEmpty,
64244
+ getTooltipChildren: getTooltipChildren
64245
+ })
64246
+ });
64247
+ }
64248
+ ProblemSolvers.propTypes = {
64249
+ selectedPartners: PropTypes__default["default"].object,
64250
+ loading: PropTypes__default["default"].bool,
64251
+ t: PropTypes__default["default"].func,
64252
+ theme: PropTypes__default["default"].object,
64253
+ selectedRange: PropTypes__default["default"].string
64254
+ };
64255
+
64256
+ const filterOptions = [{
64257
+ label: '12 months',
64258
+ value: '12'
64259
+ }, {
64260
+ label: '3 months',
64261
+ value: '3'
64262
+ }];
64263
+
64264
+ function RisksWidget({
64265
+ title = "Analytics",
64266
+ selectedPartners = {},
64267
+ t = s => s,
64268
+ goTo = () => {},
64269
+ getRedirectLink = s => s,
64270
+ theme = {},
64271
+ APP,
64272
+ options = {},
64273
+ category = "conflict",
64274
+ user = {}
64275
+ }) {
64276
+ const [range, setRange] = React.useState(filterOptions[0].value);
64277
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
64278
+ title: t(title),
64279
+ className: "with-border-header month-select-header",
64280
+ addedHeader: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
64281
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
64282
+ className: "flex-1"
64283
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
64284
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
64285
+ value: range,
64286
+ className: "custom-select white month-select",
64287
+ onChange: val => setRange(val),
64288
+ children: filterOptions.map(o => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
64289
+ value: o.value,
64290
+ children: t(o.label)
64291
+ }, o.value))
64292
+ })
64293
+ })]
64294
+ }),
64295
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
64296
+ className: "flex flex-row flex-col-mobile gap-6",
64297
+ children: [/*#__PURE__*/jsxRuntime.jsx(IncidentsTime, {
64298
+ selectedRange: range,
64299
+ selectedPartners: selectedPartners,
64300
+ t: t,
64301
+ theme: theme,
64302
+ goTo: goTo,
64303
+ getRedirectLink: getRedirectLink,
64304
+ options: options,
64305
+ user: user
64306
+ }), /*#__PURE__*/jsxRuntime.jsx(TerritorialDistribution, {
64307
+ category: category,
64308
+ selectedRange: range,
64309
+ selectedPartners: selectedPartners,
64310
+ t: t,
64311
+ theme: theme,
64312
+ goTo: goTo,
64313
+ getRedirectLink: getRedirectLink
64314
+ }), /*#__PURE__*/jsxRuntime.jsx(ProblemSolvers, {
64315
+ selectedRange: range,
64316
+ selectedPartners: selectedPartners,
64317
+ t: t,
64318
+ theme: theme,
64319
+ goTo: goTo,
64320
+ getRedirectLink: getRedirectLink
64321
+ })]
64322
+ })
64323
+ });
64324
+ }
64325
+
64326
+ function useSource({
64327
+ user = {},
64328
+ t = () => {},
64329
+ getData = () => {},
64330
+ id
64331
+ }) {
64332
+ const [loading, setLoading] = React.useState(true);
64333
+ const [partners, setPartners] = React.useState([]);
64334
+ const [selectedPartners, setSelectedPartners] = React.useState({
64335
+ loading: true
64336
+ });
64337
+ React.useEffect(() => {
64338
+ async function fetchPartners() {
64339
+ try {
64340
+ setLoading(true);
64341
+ const {
64342
+ data
64343
+ } = await getData({
64344
+ page: 1,
64345
+ pageSize: 100,
64346
+ type: "partners"
64347
+ });
64348
+ if (id === undefined) {
64349
+ const _partners = [{
64350
+ nickName: t("Own Data"),
64351
+ id: user?.company?.id
64352
+ }, ...(data.data || []).filter(v => v.status === "active" && ["source", "exchange"].includes(v.partnershipType)).map(v => ({
64353
+ ...v,
64354
+ id: v?.company?.id
64355
+ }))];
64356
+ setPartners(_partners);
64357
+ setSelectedPartners({
64358
+ partners: _partners.map(s => s.id),
64359
+ channels: user?.channels?.map(s => ({
64360
+ id: s.id,
64361
+ type: s.type,
64362
+ inbound: s?.inbound?.id,
64363
+ outbound: s?.outbound?.id
64364
+ })),
64365
+ loading: false
64366
+ });
64367
+ } else {
64368
+ setPartners(data?.map(p => {
64369
+ return {
64370
+ ...p,
64371
+ nickName: p?.name,
64372
+ id: p.id
64373
+ };
64374
+ }));
64375
+ setSelectedPartners({
64376
+ partners: data?.map(p => p.id),
64377
+ loading: false
64378
+ });
64379
+ }
64380
+ } catch (error) {
64381
+ console.error("Error fetching partners:", error);
64382
+ }
64383
+ }
64384
+ fetchPartners();
64385
+ }, [user.language, id]);
64386
+ function handleSelectedPartnersChange(selected) {
64387
+ setSelectedPartners(prev => ({
64388
+ ...prev,
64389
+ partners: selected,
64390
+ loading: false
64391
+ }));
64392
+ }
64393
+ // }
64394
+
64395
+ return {
64396
+ loading,
64397
+ partners,
64398
+ selectedPartners,
64399
+ setSelectedPartners,
64400
+ onSelectPartnersChange: handleSelectedPartnersChange
64401
+ };
64402
+ }
64403
+ const useSources = ({
64404
+ type,
64405
+ id,
64406
+ user,
64407
+ t = () => {},
64408
+ stop
64409
+ }) => {
64410
+ function getData(params) {
64411
+ if (stop) return Promise.resolve({
64412
+ data: []
64413
+ });
64414
+ if (id !== undefined && id !== null) {
64415
+ return SourceService$1.getSources({
64416
+ type,
64417
+ id
64418
+ });
64419
+ } else {
64420
+ return SourceService$1.get(null, params);
64421
+ }
64422
+ }
64423
+ const {
64424
+ onSelectPartnersChange,
64425
+ partners,
64426
+ selectedPartners,
64427
+ setSelectedPartners
64428
+ } = useSource({
64429
+ user,
64430
+ t,
64431
+ getData: getData,
64432
+ id
64433
+ });
64434
+ const informationSources = partners?.length > 0 ? partners?.length - 1 : 0;
64435
+ return {
64436
+ partners,
64437
+ selectedPartners,
64438
+ setSelectedPartners,
64439
+ user,
64440
+ informationSources: informationSources,
64441
+ onSelectPartnersChange
64442
+ };
64443
+ };
64444
+
64445
+ function ConflictManagement({
64446
+ t = () => {},
64447
+ user = {},
64448
+ APP,
64449
+ goTo = () => {},
64450
+ getRedirectLink = s => s,
64451
+ theme = {},
64452
+ options = {}
64453
+ }) {
64454
+ const {
64455
+ partners,
64456
+ selectedPartners,
64457
+ setSelectedPartners,
64458
+ informationSources
64459
+ } = useSources({
64460
+ user,
64461
+ t
64462
+ });
64463
+
64464
+ // const { pushPath } = useHistory();
64465
+
64466
+ // useEffect(() => {
64467
+ // pushPath(`/app/conflict-management`);
64468
+ // }, []);
64469
+
64470
+ const breadCrumbs = React.useMemo(() => {
64471
+ return renderBreadCrumbs({
64472
+ t,
64473
+ view: "conflict-management",
64474
+ mod: APP,
64475
+ goTo
64476
+ });
64477
+ }, [t, APP, goTo]);
64478
+ const sourceOptions = React.useMemo(() => {
64479
+ return partners.map(partner => {
64480
+ const isOwnData = partner.id === user?.company?.id;
64481
+ return {
64482
+ label: partner.nickName,
64483
+ value: partner.id,
64484
+ avatar: isOwnData ? /*#__PURE__*/jsxRuntime.jsx("span", {
64485
+ children: "OWN"
64486
+ }) : /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
64487
+ name: "Search02",
64488
+ width: 14,
64489
+ height: 14
64490
+ }),
64491
+ background: isOwnData ? theme.colorPrimary7 : undefined,
64492
+ color: isOwnData ? "white" : undefined
64493
+ };
64494
+ });
64495
+ }, [partners, user, theme]);
64496
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
64497
+ className: "daf-analysis",
64498
+ children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
64499
+ title: t("conflict-management"),
64500
+ breadcrumbs: breadCrumbs,
64501
+ supportText: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
64502
+ children: [t("Supported by"), " ", /*#__PURE__*/jsxRuntime.jsx("a", {
64503
+ href: "https://www.eeas.europa.eu/delegations/dr-congo-kinshasa_en?s=94",
64504
+ target: "_blank",
64505
+ rel: "noreferrer",
64506
+ children: t("European Union")
64507
+ })]
64508
+ }),
64509
+ addedHeader: /*#__PURE__*/jsxRuntime.jsxs("div", {
64510
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
64511
+ className: "flex-1"
64512
+ }), /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
64513
+ options: [...sourceOptions],
64514
+ isAvatarGroup: true,
64515
+ canUnselectLast: false,
64516
+ onChange: selected => {
64517
+ setSelectedPartners(prev => ({
64518
+ ...prev,
64519
+ partners: selected,
64520
+ loading: false
64521
+ }));
64522
+ },
64523
+ dropDownWidth: 200,
64524
+ selectionType: "checkbox",
64525
+ defaultSelected: partners.map(p => p.id) || []
64526
+ }, partners?.length)]
64527
+ })
64528
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
64529
+ className: "content",
64530
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
64531
+ className: "view-content",
64532
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
64533
+ className: "daf-analysis-layout",
64534
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
64535
+ className: "sections-cont w-pt",
64536
+ children: [/*#__PURE__*/jsxRuntime.jsx("section", {
64537
+ children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicators, {
64538
+ selectedPartners: selectedPartners,
64539
+ partners: informationSources > 0 ? informationSources : selectedPartners?.partners?.length > 0 ? selectedPartners?.partners?.length : 0,
64540
+ t: t,
64541
+ goTo: goTo,
64542
+ getRedirectLink: getRedirectLink,
64543
+ theme: theme
64544
+ })
64545
+ }), /*#__PURE__*/jsxRuntime.jsx("section", {
64546
+ children: /*#__PURE__*/jsxRuntime.jsx(MineSites, {
64547
+ selectedPartners: selectedPartners,
64548
+ t: t,
64549
+ goTo: goTo,
64550
+ getRedirectLink: getRedirectLink,
64551
+ theme: theme,
64552
+ APP: APP,
64553
+ options: options
64554
+ })
64555
+ }), /*#__PURE__*/jsxRuntime.jsx("section", {
64556
+ children: /*#__PURE__*/jsxRuntime.jsx(RisksWidget, {
64557
+ selectedPartners: selectedPartners,
64558
+ t: t,
64559
+ goTo: goTo,
64560
+ getRedirectLink: getRedirectLink,
64561
+ theme: theme,
64562
+ APP: APP,
64563
+ options: options
64564
+ })
64565
+ })]
64566
+ })
64567
+ })
64568
+ })
64569
+ })]
64570
+ });
64571
+ }
64572
+
64573
+ exports.ConflictManagement = ConflictManagement;
62905
64574
  exports.Edit = Edit;
62906
64575
  exports.MineSummary = MineSummary;
62907
64576
  exports.MonitoringActivitySummary = MonitoringActivitySummary;