datastake-daf 0.6.765 → 0.6.767

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/components/index.js +482 -245
  2. package/dist/layouts/index.js +0 -3
  3. package/dist/pages/index.js +299 -241
  4. package/dist/services/index.js +18 -0
  5. package/dist/utils/index.js +328 -5
  6. package/package.json +4 -2
  7. package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +1 -1
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -9
  10. package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +31 -1
  12. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
  13. package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
  14. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +10 -7
  15. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
  16. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
  17. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
  21. package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  26. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
  27. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/create.jsx +106 -0
  28. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +115 -0
  29. package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
  30. package/src/@daf/hooks/useMapHelper.js +5 -0
  31. package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
  32. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
  33. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +11 -5
  34. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
  35. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
  36. package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
  37. package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
  38. package/src/@daf/pages/Data/Channels/columns.js +175 -0
  39. package/src/@daf/pages/Data/Channels/config.js +0 -0
  40. package/src/@daf/pages/Data/Channels/create.jsx +0 -0
  41. package/src/@daf/pages/Data/Channels/index.jsx +0 -0
  42. package/src/@daf/pages/Events/Activities/columns.js +1 -4
  43. package/src/@daf/pages/Events/helper.js +2 -2
  44. package/src/@daf/pages/Events/index.jsx +1 -1
  45. package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
  46. package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
  47. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +1 -0
  48. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
  49. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
  50. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
  51. package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
  52. package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
  53. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
  54. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
  55. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
  56. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +10 -3
  57. package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
  58. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
  59. package/src/@daf/services/AdminService.js +14 -0
  60. package/src/constants/locales/en/translation.js +109 -2
  61. package/src/constants/locales/fr/translation.js +109 -1
  62. package/src/constants/locales/sp/translation.js +104 -1
  63. package/src/index.js +2 -0
  64. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -6384,7 +6384,10 @@ function MoreTags(_ref) {
6384
6384
  values = [],
6385
6385
  maxWidthCont = 120,
6386
6386
  maxTextCont = 100,
6387
- diff = 30
6387
+ diff = 30,
6388
+ style = {},
6389
+ tagColor,
6390
+ limit
6388
6391
  } = _ref;
6389
6392
  const ref = React.useRef();
6390
6393
  const [width, setWidth] = React.useState(0);
@@ -6399,6 +6402,11 @@ function MoreTags(_ref) {
6399
6402
  return () => resizeObserver.disconnect();
6400
6403
  }, []);
6401
6404
  const _calculate = () => {
6405
+ // If limit prop is provided and valid, use it instead of calculating
6406
+ if (typeof limit === 'number' && limit > 0) {
6407
+ setIndexToReturn(Math.min(limit - 1, values.length - 1));
6408
+ return;
6409
+ }
6402
6410
  const tabs = ref.current.querySelectorAll(".check-tabs");
6403
6411
  let filled = 0;
6404
6412
  let indexToReturn;
@@ -6425,34 +6433,36 @@ function MoreTags(_ref) {
6425
6433
  const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
6426
6434
  React.useEffect(() => {
6427
6435
  _calculate();
6428
- }, [width, values]);
6436
+ }, [width, values, limit]);
6429
6437
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
6430
6438
  className: "daf-more-tags",
6431
6439
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
6432
6440
  className: "list",
6433
6441
  children: [toShow.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag() : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
6434
- style: {
6442
+ style: _objectSpread2({
6435
6443
  maxWidth: _maxWidthCont,
6436
6444
  overflow: "hidden",
6437
6445
  textOverflow: "ellipsis",
6438
6446
  whiteSpace: "nowrap"
6439
- },
6440
- color: ac.color,
6447
+ }, style),
6448
+ color: tagColor || ac.color,
6441
6449
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
6442
6450
  title: typeof ac === "object" ? ac.label : ac,
6443
6451
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
6444
- style: {
6452
+ style: _objectSpread2({
6445
6453
  maxWidth: _maxWidthTxt,
6446
6454
  overflow: "hidden",
6447
6455
  textOverflow: "ellipsis",
6448
6456
  whiteSpace: "nowrap"
6449
- },
6457
+ }, style),
6450
6458
  children: typeof ac === "object" ? ac.label : ac
6451
6459
  })
6452
6460
  })
6453
6461
  }, "".concat(typeof ac === "object" ? ac.value : ac, "-").concat(i))), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
6454
6462
  title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
6455
6463
  children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
6464
+ color: tagColor || 'default',
6465
+ style: style,
6456
6466
  children: ["+", other.length]
6457
6467
  })
6458
6468
  }) : null]
@@ -6460,11 +6470,11 @@ function MoreTags(_ref) {
6460
6470
  className: "list hidden",
6461
6471
  ref: ref,
6462
6472
  children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
6463
- color: ac.color,
6473
+ color: tagColor || ac.color,
6464
6474
  className: "check-tabs",
6465
- style: {
6475
+ style: _objectSpread2({
6466
6476
  maxWidth: _maxWidthCont
6467
- },
6477
+ }, style),
6468
6478
  children: /*#__PURE__*/jsxRuntime.jsx(Text$1, {
6469
6479
  ellipsis: {
6470
6480
  tooltip: typeof ac === "object" ? ac.label : ac
@@ -6482,7 +6492,8 @@ MoreTags.propTypes = {
6482
6492
  values: PropTypes__default["default"].array,
6483
6493
  maxWidthCont: PropTypes__default["default"].number,
6484
6494
  maxTextCont: PropTypes__default["default"].number,
6485
- diff: PropTypes__default["default"].number
6495
+ diff: PropTypes__default["default"].number,
6496
+ limit: PropTypes__default["default"].number
6486
6497
  };
6487
6498
 
6488
6499
  const pageValues = [10, 20, 50, 100];
@@ -9511,29 +9522,24 @@ const processConditionalTableKeys = (tableKeys, item) => {
9511
9522
  });
9512
9523
  return processedKeys;
9513
9524
  };
9514
- const renderFieldData = function (type, value, user, config) {
9515
- let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
9516
- let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
9517
- let app = arguments.length > 6 ? arguments[6] : undefined;
9518
- let allValues = arguments.length > 7 ? arguments[7] : undefined;
9519
- let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
9525
+ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
9520
9526
  switch (type) {
9521
9527
  case 'year':
9522
9528
  return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
9523
9529
  case 'date':
9524
9530
  {
9525
- const language = user !== null && user !== void 0 && user.language && (user === null || user === void 0 ? void 0 : user.language) === 'sp' ? 'es' : user === null || user === void 0 ? void 0 : user.language;
9531
+ const language = user?.language && user?.language === 'sp' ? 'es' : user?.language;
9526
9532
  return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
9527
9533
  }
9528
9534
  case 'select':
9529
9535
  {
9530
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9536
+ const options = config?.options || [];
9531
9537
  const option = findOptions(value, options);
9532
9538
  return option;
9533
9539
  }
9534
9540
  case 'multiselect':
9535
9541
  {
9536
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9542
+ const options = config?.options || [];
9537
9543
  const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
9538
9544
  const option = findOptions(_val, options);
9539
9545
  return option.join(', ');
@@ -9548,7 +9554,7 @@ const renderFieldData = function (type, value, user, config) {
9548
9554
  formValues: formValues
9549
9555
  });
9550
9556
  case 'percentage':
9551
- return value === '-' || value === null || value === undefined ? '-' : "".concat(value, " %");
9557
+ return value === '-' || value === null || value === undefined ? '-' : `${value} %`;
9552
9558
  case 'geolocation':
9553
9559
  {
9554
9560
  const val = JSON.parse(value) || {};
@@ -9562,7 +9568,7 @@ const renderFieldData = function (type, value, user, config) {
9562
9568
  case 'upload':
9563
9569
  case 'videoUpload':
9564
9570
  {
9565
- const documentName = allValues === null || allValues === void 0 ? void 0 : allValues.map(item => item === null || item === void 0 ? void 0 : item.name).join(', ');
9571
+ const documentName = allValues?.map(item => item?.name).join(', ');
9566
9572
  return documentName;
9567
9573
  }
9568
9574
  default:
@@ -9570,27 +9576,25 @@ const renderFieldData = function (type, value, user, config) {
9570
9576
  }
9571
9577
  };
9572
9578
 
9573
- const renderValue = _ref => {
9574
- let {
9575
- value,
9576
- hasChildren,
9577
- config,
9578
- user,
9579
- getApiBaseUrl = () => {},
9580
- getAppHeader = () => {},
9581
- app,
9582
- allData = {}
9583
- } = _ref;
9584
- if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
9585
- if (!(config !== null && config !== void 0 && config.inputs)) return null;
9579
+ const renderValue = ({
9580
+ value,
9581
+ hasChildren,
9582
+ config,
9583
+ user,
9584
+ getApiBaseUrl = () => {},
9585
+ getAppHeader = () => {},
9586
+ app,
9587
+ allData = {}
9588
+ }) => {
9589
+ if (config?.type === 'groupInputs') {
9590
+ if (!config?.inputs) return null;
9586
9591
  const inputKeys = Object.keys(config.inputs).sort((a, b) => {
9587
- var _config$inputs$a, _config$inputs$b;
9588
- const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
9589
- const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
9592
+ const positionA = config.inputs[a]?.position || 0;
9593
+ const positionB = config.inputs[b]?.position || 0;
9590
9594
  return positionA - positionB;
9591
9595
  });
9592
9596
  const values = inputKeys.map(inputKey => {
9593
- let inputValue = value === null || value === void 0 ? void 0 : value[inputKey];
9597
+ let inputValue = value?.[inputKey];
9594
9598
  if (inputValue === null || inputValue === undefined || inputValue === '') {
9595
9599
  return '';
9596
9600
  } else if (typeof inputValue === 'object' && inputValue !== null) {
@@ -9631,8 +9635,8 @@ const renderValue = _ref => {
9631
9635
  } else {
9632
9636
  displayValue = String(value);
9633
9637
  }
9634
- const fieldType = (config === null || config === void 0 ? void 0 : config.type) || 'text';
9635
- let cssClass = "tree-value ".concat(fieldType, "-type");
9638
+ const fieldType = config?.type || 'text';
9639
+ let cssClass = `tree-value ${fieldType}-type`;
9636
9640
  if (displayValue === '-') {
9637
9641
  cssClass += ' empty';
9638
9642
  }
@@ -9642,21 +9646,19 @@ const renderValue = _ref => {
9642
9646
  children: displayValue
9643
9647
  });
9644
9648
  };
9645
- const determineHasChildren = _ref2 => {
9646
- var _config$meta;
9647
- let {
9648
- config,
9649
- level
9650
- } = _ref2;
9651
- if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
9649
+ const determineHasChildren = ({
9650
+ config,
9651
+ level
9652
+ }) => {
9653
+ if (config?.type === 'groupInputs') {
9652
9654
  return false;
9653
9655
  }
9654
- if ((config === null || config === void 0 ? void 0 : config.type) === 'header' && config !== null && config !== void 0 && config.inputs && Object.keys(config.inputs).length > 0) {
9656
+ if (config?.type === 'header' && config?.inputs && Object.keys(config.inputs).length > 0) {
9655
9657
  return true;
9656
9658
  }
9657
- return (config === null || config === void 0 ? void 0 : config.inputs) || (config === null || config === void 0 ? void 0 : config.type) === 'group' || (config === null || config === void 0 ? void 0 : config.type) === 'dataLinkGroup' || (config === null || config === void 0 ? void 0 : config.type) === 'section' || (config === null || config === void 0 ? void 0 : config.type) === 'ajaxSubGroup' ||
9659
+ return config?.inputs || config?.type === 'group' || config?.type === 'dataLinkGroup' || config?.type === 'section' || config?.type === 'ajaxSubGroup' ||
9658
9660
  // Add this line
9659
- (config === null || config === void 0 ? void 0 : config.type) === 'dataLink' && (config === null || config === void 0 || (_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.tableKeys) || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
9661
+ config?.type === 'dataLink' && config?.meta?.tableKeys || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
9660
9662
  };
9661
9663
 
9662
9664
  const sortByPosition = (items, getConfig) => {
@@ -9930,44 +9932,44 @@ function useAjaxModal$2({
9930
9932
  }
9931
9933
 
9932
9934
  const mergeObject = obj => {
9933
- return Object.entries(obj || {}).reduce((acc, [key, value]) => {
9935
+ return Object.entries(obj || {}).reduce((acc, _ref) => {
9936
+ let [key, value] = _ref;
9934
9937
  if (typeof value === "object" && !Array.isArray(value) && value !== null) {
9935
- return {
9936
- ...acc,
9937
- ...value
9938
- };
9938
+ return _objectSpread2(_objectSpread2({}, acc), value);
9939
9939
  }
9940
- return {
9941
- ...acc,
9940
+ return _objectSpread2(_objectSpread2({}, acc), {}, {
9942
9941
  [key]: value
9943
- };
9942
+ });
9944
9943
  }, {});
9945
9944
  };
9946
- const handleDataLinkGroupWithTableKeys = ({
9947
- config,
9948
- inputConfig,
9949
- inputKey,
9950
- value,
9951
- level,
9952
- t,
9953
- rootForm,
9954
- allData,
9955
- user,
9956
- getApiBaseUrl = () => {},
9957
- getAppHeader = () => {},
9958
- app,
9959
- TreeNodeComponent
9960
- }) => {
9945
+ const handleDataLinkGroupWithTableKeys = _ref2 => {
9946
+ var _inputConfig$meta, _config$meta2, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
9947
+ let {
9948
+ config,
9949
+ inputConfig,
9950
+ inputKey,
9951
+ value,
9952
+ level,
9953
+ t,
9954
+ rootForm,
9955
+ allData,
9956
+ user,
9957
+ getApiBaseUrl = () => {},
9958
+ getAppHeader = () => {},
9959
+ app,
9960
+ TreeNodeComponent
9961
+ } = _ref2;
9961
9962
  if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
9962
9963
  return null;
9963
9964
  }
9964
- if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
9965
+ if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
9965
9966
  const parentInputKeys = Object.keys(config.inputs || {});
9966
9967
  const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
9967
9968
  const otherConfig = config.inputs[otherInputKey];
9968
- if (otherConfig?.type === 'dataLink') {
9969
- const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
9970
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
9969
+ if ((otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.type) === 'dataLink') {
9970
+ var _otherConfig$meta, _config$meta;
9971
+ const siblingTableKeys = (otherConfig === null || otherConfig === void 0 || (_otherConfig$meta = otherConfig.meta) === null || _otherConfig$meta === void 0 ? void 0 : _otherConfig$meta.tableKeys) || [];
9972
+ const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
9971
9973
  const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
9972
9974
  return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
9973
9975
  }
@@ -9981,23 +9983,26 @@ const handleDataLinkGroupWithTableKeys = ({
9981
9983
  return null;
9982
9984
  }
9983
9985
  const tableKeys = inputConfig.meta.tableKeys;
9984
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
9986
+ const additionalTableKeys = ((_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.additionalTableKeys) || [];
9985
9987
  const parentInputKeys = Object.keys(config.inputs || {});
9986
9988
  const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
9987
9989
  [...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
9988
- const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
9990
+ const isAjaxModal = React.useMemo(() => {
9991
+ var _inputConfig$meta2;
9992
+ return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
9993
+ }, [inputConfig]);
9989
9994
  const ajaxModalValues = useAjaxModal$2({
9990
9995
  name: inputKey,
9991
9996
  user,
9992
- namespace: inputConfig?.meta?.namespace,
9993
- skipFetch: inputConfig?.meta?.skipFetch,
9997
+ namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
9998
+ skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
9994
9999
  isAjaxModal,
9995
- formScope: inputConfig?.meta?.formScope,
10000
+ formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
9996
10001
  APP: app,
9997
10002
  apiBaseUrl: getApiBaseUrl(),
9998
10003
  _getAppHeader: getAppHeader
9999
10004
  });
10000
- const dataLinkForm = ajaxModalValues?.form;
10005
+ const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
10001
10006
  const createInputsAndValues = item => {
10002
10007
  const inputs = {};
10003
10008
  const values = {};
@@ -10009,12 +10014,12 @@ const handleDataLinkGroupWithTableKeys = ({
10009
10014
  'videos': 'Video'
10010
10015
  };
10011
10016
  tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
10012
- const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
10017
+ var _dataLinkForm$identif;
10018
+ const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
10013
10019
  if (formInputConfig) {
10014
- inputs[tableKey] = {
10015
- ...formInputConfig,
10020
+ inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10016
10021
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
10017
- };
10022
+ });
10018
10023
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10019
10024
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10020
10025
  let resolvedLabel = null;
@@ -10022,7 +10027,7 @@ const handleDataLinkGroupWithTableKeys = ({
10022
10027
  const parts = labelKey.split(' is ');
10023
10028
  if (parts.length === 2) {
10024
10029
  const [conditionKey, conditionValue] = parts;
10025
- if (item?.[conditionKey] === conditionValue) {
10030
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10026
10031
  resolvedLabel = formInputConfig.label[labelKey];
10027
10032
  break;
10028
10033
  }
@@ -10030,37 +10035,37 @@ const handleDataLinkGroupWithTableKeys = ({
10030
10035
  }
10031
10036
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
10032
10037
  }
10033
- values[tableKey] = item?.[tableKey];
10038
+ values[tableKey] = item === null || item === void 0 ? void 0 : item[tableKey];
10034
10039
  } else {
10040
+ var _item$linking;
10035
10041
  inputs[tableKey] = {
10036
10042
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
10037
- type: inputConfig?.type
10043
+ type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10038
10044
  };
10039
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
10045
+ values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10040
10046
  }
10041
10047
  });
10042
10048
  siblingInputsMatchingTableKeys.forEach(siblingKey => {
10043
10049
  const siblingConfig = config.inputs[siblingKey];
10044
10050
  if (siblingConfig) {
10045
- inputs[siblingKey] = {
10046
- ...siblingConfig,
10051
+ inputs[siblingKey] = _objectSpread2(_objectSpread2({}, siblingConfig), {}, {
10047
10052
  label: siblingConfig.label || siblingKey
10048
- };
10049
- values[siblingKey] = item?.[siblingKey];
10053
+ });
10054
+ values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
10050
10055
  }
10051
10056
  });
10052
- if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10057
+ if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10053
10058
  Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
10054
10059
  const formInputConfig = dataLinkForm.identification[fieldKey];
10055
10060
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10056
10061
  }).forEach(fieldKey => {
10062
+ var _item$linking2;
10057
10063
  const formInputConfig = dataLinkForm.identification[fieldKey];
10058
- inputs[fieldKey] = {
10059
- ...formInputConfig,
10064
+ inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10060
10065
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10061
- };
10062
- if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
10063
- const dynamicLabelKeys = Object.keys(formInputConfig?.label);
10066
+ });
10067
+ if (formInputConfig !== null && formInputConfig !== void 0 && formInputConfig.label && typeof (formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label) === 'object') {
10068
+ const dynamicLabelKeys = Object.keys(formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label);
10064
10069
  let resolvedLabel = null;
10065
10070
  for (const labelKey of dynamicLabelKeys) {
10066
10071
  const parts = labelKey.split(' is ');
@@ -10069,7 +10074,7 @@ const handleDataLinkGroupWithTableKeys = ({
10069
10074
  const flattenedItem = Object.assign({}, item.location, {
10070
10075
  address: item.address
10071
10076
  });
10072
- if (flattenedItem?.[conditionKey] === conditionValue) {
10077
+ if ((flattenedItem === null || flattenedItem === void 0 ? void 0 : flattenedItem[conditionKey]) === conditionValue) {
10073
10078
  resolvedLabel = formInputConfig.label[labelKey];
10074
10079
  break;
10075
10080
  }
@@ -10077,7 +10082,7 @@ const handleDataLinkGroupWithTableKeys = ({
10077
10082
  }
10078
10083
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10079
10084
  }
10080
- values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
10085
+ values[fieldKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10081
10086
  });
10082
10087
  }
10083
10088
  return {
@@ -10087,16 +10092,17 @@ const handleDataLinkGroupWithTableKeys = ({
10087
10092
  };
10088
10093
  if (Array.isArray(value)) {
10089
10094
  return value.map((item, itemIndex) => {
10095
+ var _merged$inputKey;
10090
10096
  const merged = mergeObject(item);
10091
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10097
+ const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey = merged[inputKey]) === null || _merged$inputKey === void 0 ? void 0 : _merged$inputKey.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10092
10098
  const {
10093
10099
  inputs,
10094
10100
  values
10095
10101
  } = createInputsAndValues(merged);
10096
10102
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10097
- nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10103
+ nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10098
10104
  config: {
10099
- label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10105
+ label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10100
10106
  type: 'custom-datalink-group',
10101
10107
  inputs: inputs
10102
10108
  },
@@ -10110,11 +10116,12 @@ const handleDataLinkGroupWithTableKeys = ({
10110
10116
  getApiBaseUrl: getApiBaseUrl,
10111
10117
  getAppHeader: getAppHeader,
10112
10118
  app: app
10113
- }, `${inputKey}-${itemIndex}`);
10119
+ }, "".concat(inputKey, "-").concat(itemIndex));
10114
10120
  });
10115
10121
  } else {
10122
+ var _merged$inputKey2;
10116
10123
  const merged = mergeObject(value);
10117
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10124
+ const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey2 = merged[inputKey]) === null || _merged$inputKey2 === void 0 ? void 0 : _merged$inputKey2.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10118
10125
  const {
10119
10126
  inputs,
10120
10127
  values
@@ -10136,41 +10143,46 @@ const handleDataLinkGroupWithTableKeys = ({
10136
10143
  getApiBaseUrl: getApiBaseUrl,
10137
10144
  getAppHeader: getAppHeader,
10138
10145
  app: app
10139
- }, `${inputKey}-group`);
10146
+ }, "".concat(inputKey, "-group"));
10140
10147
  }
10141
10148
  };
10142
10149
 
10143
- const handleDataLinkWithTableKeys = ({
10144
- inputConfig,
10145
- inputKey,
10146
- value,
10147
- level,
10148
- t,
10149
- rootForm,
10150
- allData,
10151
- user,
10152
- getApiBaseUrl = () => {},
10153
- getAppHeader = () => {},
10154
- app,
10155
- TreeNodeComponent
10156
- }) => {
10157
- if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
10150
+ const handleDataLinkWithTableKeys = _ref => {
10151
+ var _inputConfig$meta, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
10152
+ let {
10153
+ inputConfig,
10154
+ inputKey,
10155
+ value,
10156
+ level,
10157
+ t,
10158
+ rootForm,
10159
+ allData,
10160
+ user,
10161
+ getApiBaseUrl = () => {},
10162
+ getAppHeader = () => {},
10163
+ app,
10164
+ TreeNodeComponent
10165
+ } = _ref;
10166
+ if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
10158
10167
  return null;
10159
10168
  }
10160
10169
  const tableKeys = inputConfig.meta.tableKeys;
10161
- const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
10170
+ const isAjaxModal = React.useMemo(() => {
10171
+ var _inputConfig$meta2;
10172
+ return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
10173
+ }, [inputConfig]);
10162
10174
  const ajaxModalValues = useAjaxModal$2({
10163
10175
  name: inputKey,
10164
10176
  user,
10165
- namespace: inputConfig?.meta?.namespace,
10166
- skipFetch: inputConfig?.meta?.skipFetch,
10177
+ namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
10178
+ skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
10167
10179
  isAjaxModal,
10168
- formScope: inputConfig?.meta?.formScope,
10180
+ formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
10169
10181
  APP: app,
10170
10182
  apiBaseUrl: getApiBaseUrl(),
10171
10183
  _getAppHeader: getAppHeader
10172
10184
  });
10173
- const dataLinkForm = ajaxModalValues?.form;
10185
+ const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
10174
10186
  const createInputsAndValues = item => {
10175
10187
  const inputs = {};
10176
10188
  const values = {};
@@ -10183,19 +10195,20 @@ const handleDataLinkWithTableKeys = ({
10183
10195
  };
10184
10196
  const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
10185
10197
  if (uploadTypeFields.includes(fieldKey)) {
10186
- const itemValue = itemToCheck?.[fieldKey];
10198
+ const itemValue = itemToCheck === null || itemToCheck === void 0 ? void 0 : itemToCheck[fieldKey];
10187
10199
  return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
10188
10200
  }
10189
10201
  return false;
10190
10202
  };
10191
10203
  const processedTableKeys = processConditionalTableKeys(tableKeys, item);
10192
10204
  processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
10193
- const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
10205
+ var _dataLinkForm$identif;
10206
+ const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
10194
10207
  if (formInputConfig) {
10195
- inputs[tableKey] = {
10196
- ...formInputConfig,
10208
+ var _item$linking, _formInputConfig$meta, _formInputConfig$tabl;
10209
+ inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10197
10210
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
10198
- };
10211
+ });
10199
10212
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10200
10213
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10201
10214
  let resolvedLabel = null;
@@ -10203,7 +10216,7 @@ const handleDataLinkWithTableKeys = ({
10203
10216
  const parts = labelKey.split(' is ');
10204
10217
  if (parts.length === 2) {
10205
10218
  const [conditionKey, conditionValue] = parts;
10206
- if (item?.[conditionKey] === conditionValue) {
10219
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10207
10220
  resolvedLabel = formInputConfig.label[labelKey];
10208
10221
  break;
10209
10222
  }
@@ -10211,16 +10224,17 @@ const handleDataLinkWithTableKeys = ({
10211
10224
  }
10212
10225
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
10213
10226
  }
10214
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item[formInputConfig?.meta?.onNewSetValueKey] || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[tableKey];
10227
+ values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$meta = formInputConfig.meta) === null || _formInputConfig$meta === void 0 ? void 0 : _formInputConfig$meta.onNewSetValueKey] || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl = formInputConfig.tableLabel) === null || _formInputConfig$tabl === void 0 ? void 0 : _formInputConfig$tabl.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10215
10228
  } else {
10229
+ var _item$linking2;
10216
10230
  inputs[tableKey] = {
10217
10231
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
10218
- type: inputConfig?.type
10232
+ type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10219
10233
  };
10220
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
10234
+ values[tableKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10221
10235
  }
10222
10236
  });
10223
- if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10237
+ if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10224
10238
  Object.keys(dataLinkForm.identification).filter(fieldKey => {
10225
10239
  if (uploadTypeFields.includes(fieldKey)) {
10226
10240
  return !isUploadFieldEmpty(fieldKey, item);
@@ -10230,11 +10244,11 @@ const handleDataLinkWithTableKeys = ({
10230
10244
  const formInputConfig = dataLinkForm.identification[fieldKey];
10231
10245
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10232
10246
  }).forEach(fieldKey => {
10247
+ var _item$linking3, _formInputConfig$tabl2;
10233
10248
  const formInputConfig = dataLinkForm.identification[fieldKey];
10234
- inputs[fieldKey] = {
10235
- ...formInputConfig,
10249
+ inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10236
10250
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10237
- };
10251
+ });
10238
10252
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10239
10253
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10240
10254
  let resolvedLabel = null;
@@ -10242,7 +10256,7 @@ const handleDataLinkWithTableKeys = ({
10242
10256
  const parts = labelKey.split(' is ');
10243
10257
  if (parts.length === 2) {
10244
10258
  const [conditionKey, conditionValue] = parts;
10245
- if (item?.[conditionKey] === conditionValue) {
10259
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10246
10260
  resolvedLabel = formInputConfig.label[labelKey];
10247
10261
  break;
10248
10262
  }
@@ -10250,7 +10264,7 @@ const handleDataLinkWithTableKeys = ({
10250
10264
  }
10251
10265
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10252
10266
  }
10253
- values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[fieldKey];
10267
+ values[fieldKey] = (item === null || item === void 0 || (_item$linking3 = item.linking) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3.SCL) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking3 === void 0 ? void 0 : _item$linking3.name) || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl2 = formInputConfig.tableLabel) === null || _formInputConfig$tabl2 === void 0 ? void 0 : _formInputConfig$tabl2.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10254
10268
  });
10255
10269
  }
10256
10270
  return {
@@ -10260,7 +10274,7 @@ const handleDataLinkWithTableKeys = ({
10260
10274
  };
10261
10275
  if (Array.isArray(value)) {
10262
10276
  return value.map((item, itemIndex) => {
10263
- const datastakeIdValue = item?.datastakeId;
10277
+ const datastakeIdValue = item === null || item === void 0 ? void 0 : item.datastakeId;
10264
10278
  const {
10265
10279
  inputs,
10266
10280
  values
@@ -10269,9 +10283,9 @@ const handleDataLinkWithTableKeys = ({
10269
10283
  return null;
10270
10284
  }
10271
10285
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10272
- nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10286
+ nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10273
10287
  config: {
10274
- label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10288
+ label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10275
10289
  type: 'custom-datalink',
10276
10290
  inputs: inputs
10277
10291
  },
@@ -10285,10 +10299,10 @@ const handleDataLinkWithTableKeys = ({
10285
10299
  getApiBaseUrl: getApiBaseUrl,
10286
10300
  getAppHeader: getAppHeader,
10287
10301
  app: app
10288
- }, `${inputKey}-${itemIndex}`);
10302
+ }, "".concat(inputKey, "-").concat(itemIndex));
10289
10303
  });
10290
10304
  } else {
10291
- const datastakeIdValue = value?.datastakeId;
10305
+ const datastakeIdValue = value === null || value === void 0 ? void 0 : value.datastakeId;
10292
10306
  const {
10293
10307
  inputs,
10294
10308
  values
@@ -10313,7 +10327,7 @@ const handleDataLinkWithTableKeys = ({
10313
10327
  getApiBaseUrl: getApiBaseUrl,
10314
10328
  getAppHeader: getAppHeader,
10315
10329
  app: app
10316
- }, `${inputKey}-single`);
10330
+ }, "".concat(inputKey, "-single"));
10317
10331
  }
10318
10332
  };
10319
10333
 
@@ -12715,7 +12729,12 @@ const defaultMapConfig = {
12715
12729
  maxZoom: 18,
12716
12730
  preferCanvas: true,
12717
12731
  zoomControl: false,
12718
- maxBounds: maxBounds
12732
+ maxBounds: maxBounds,
12733
+ zoomSnap: 0.5,
12734
+ zoomDelta: 0.5,
12735
+ wheelPxPerZoomLevel: 150,
12736
+ zoomAnimation: true,
12737
+ zoomAnimationThreshold: 10
12719
12738
  };
12720
12739
  const filterValidGPS$1 = data => {
12721
12740
  const latCheck = lat => lat > -90 || lat < 90;
@@ -13616,7 +13635,7 @@ function StakeholderIcon$1({
13616
13635
  onClickLink(data);
13617
13636
  }
13618
13637
  }),
13619
- getPopupContainer: () => document.getElementById(data.datastakeId),
13638
+ getPopupContainer: () => document.getElementById("map"),
13620
13639
  children: /*#__PURE__*/jsxRuntime.jsx(StakeholderMarker, {
13621
13640
  className: `${data.type} ${isSelected ? "selected" : selectedMarkersId.length > 0 ? "unselected" : ""}
13622
13641
  ${isSmall ? "small" : isMedium ? "medium" : "large"}
@@ -13723,12 +13742,6 @@ function LocationIcon({
13723
13742
  }).addTo(mapRef);
13724
13743
  const div = document.getElementById(markerId);
13725
13744
  root.current = client.createRoot(div);
13726
- console.log({
13727
- locationID: data.datastakeId,
13728
- stakeholder,
13729
- index,
13730
- parentId: data.datastakeId
13731
- });
13732
13745
  root.current.render( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
13733
13746
  data: stakeholder,
13734
13747
  zoom: zoom,
@@ -13825,8 +13838,7 @@ function LocationIcon({
13825
13838
  // isHovering
13826
13839
  // }
13827
13840
  ,
13828
-
13829
- getPopupContainer: () => document.getElementById(i),
13841
+ getPopupContainer: () => document.getElementById("map"),
13830
13842
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
13831
13843
  style: {
13832
13844
  position: "relative",
@@ -13927,6 +13939,7 @@ function StakeholderIcon({
13927
13939
  link,
13928
13940
  onClickLink: () => onClickLink(marker)
13929
13941
  }),
13942
+ getPopupContainer: () => document.getElementById("map"),
13930
13943
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
13931
13944
  style: {
13932
13945
  position: "absolute",
@@ -13968,6 +13981,7 @@ function StakeholderIcon({
13968
13981
  link,
13969
13982
  onClickLink: () => onClickLink(marker)
13970
13983
  }),
13984
+ getPopupContainer: () => document.getElementById("map"),
13971
13985
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
13972
13986
  style: {
13973
13987
  position: "absolute",
@@ -14003,6 +14017,7 @@ function StakeholderIcon({
14003
14017
  link,
14004
14018
  onClickLink: () => onClickLink(marker)
14005
14019
  }),
14020
+ getPopupContainer: () => document.getElementById("map"),
14006
14021
  children: /*#__PURE__*/jsxRuntime.jsx(Style$K
14007
14022
  // onClick={toggleOpen}
14008
14023
  , {
@@ -14726,7 +14741,13 @@ const useMap$1 = ({
14726
14741
  if (mapRef) {
14727
14742
  L__namespace.control.scale().addTo(mapRef);
14728
14743
  L__namespace.tileLayer(TILE_LAYER_URL, {
14729
- access_token: MAP_TOKEN
14744
+ access_token: MAP_TOKEN,
14745
+ keepBuffer: 4,
14746
+ updateWhenZooming: false,
14747
+ updateInterval: 200,
14748
+ maxNativeZoom: 18,
14749
+ tileSize: 256,
14750
+ fadeAnimation: true
14730
14751
  }).addTo(mapRef);
14731
14752
  }
14732
14753
  }, [mapRef]);
@@ -14790,6 +14811,23 @@ const useMap$1 = ({
14790
14811
  mapRef.setView([marker.coordinates[0], marker.coordinates[1]], getZoom(mapRef));
14791
14812
  }
14792
14813
  }, [activeMarker, mapRef]);
14814
+ React.useEffect(() => {
14815
+ if (mapRef && type === "chain") {
14816
+ const handleMapClick = e => {
14817
+ const clickedElement = e.originalEvent.target;
14818
+ const isMarkerClick = clickedElement.closest('.marker-chain') || clickedElement.closest('.leaflet-marker-icon');
14819
+ if (!isMarkerClick && selectedMarkersId.length > 0) {
14820
+ setSelectedMarkersId([]);
14821
+ openPopupIdRef.current = null;
14822
+ setMarkerWithPopup(null);
14823
+ }
14824
+ };
14825
+ mapRef.on('click', handleMapClick);
14826
+ return () => {
14827
+ mapRef.off('click', handleMapClick);
14828
+ };
14829
+ }
14830
+ }, [mapRef, type, selectedMarkersId]);
14793
14831
  return {
14794
14832
  container,
14795
14833
  activeMarker,
@@ -46290,7 +46328,7 @@ const Container$1 = styled__default["default"].div`
46290
46328
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
46291
46329
  `;
46292
46330
 
46293
- const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width"];
46331
+ const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
46294
46332
  const {
46295
46333
  useToken: useToken$g
46296
46334
  } = antd.theme;
@@ -46377,7 +46415,8 @@ function BarChart(_ref) {
46377
46415
  t = s => s,
46378
46416
  isPdf = false,
46379
46417
  legendConfig = {},
46380
- width
46418
+ width,
46419
+ xAxisConfig = {}
46381
46420
  } = _ref;
46382
46421
  _objectWithoutProperties(_ref, _excluded$7);
46383
46422
  const containerRef = React__default["default"].useRef(null);
@@ -46404,14 +46443,14 @@ function BarChart(_ref) {
46404
46443
  data,
46405
46444
  xField: xFieldKey,
46406
46445
  yField: yFieldKey,
46407
- xAxis: _objectSpread2(_objectSpread2({}, isPercentage ? {
46446
+ xAxis: _objectSpread2(_objectSpread2(_objectSpread2({}, isPercentage ? {
46408
46447
  tickMethod: () => {
46409
46448
  return Array.from(new Array(11), (v, i) => i * 10);
46410
46449
  }
46411
- } : {}), {}, {
46412
- label: {
46450
+ } : {}), xAxisConfig), {}, {
46451
+ label: _objectSpread2({
46413
46452
  formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedXAxis
46414
- }
46453
+ }, xAxisConfig === null || xAxisConfig === void 0 ? void 0 : xAxisConfig.label)
46415
46454
  }),
46416
46455
  yAxis: {
46417
46456
  label: {
@@ -46435,7 +46474,7 @@ function BarChart(_ref) {
46435
46474
  } else {
46436
46475
  chartRef.current.update(config);
46437
46476
  }
46438
- }, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7]);
46477
+ }, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7, xAxisConfig]);
46439
46478
  React__default["default"].useEffect(() => {
46440
46479
  return () => {
46441
46480
  if (chartRef.current) {
@@ -49148,7 +49187,6 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49148
49187
  withDuration = true,
49149
49188
  onFilterChange,
49150
49189
  isPdf,
49151
- zoomOutTransition = false,
49152
49190
  ...props
49153
49191
  }, ref) {
49154
49192
  const {
@@ -49165,17 +49203,23 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49165
49203
  }
49166
49204
  return result;
49167
49205
  }, [nodes.length, mandatoryNodesToFit?.length, mandatoryNodesToFit]);
49206
+
49207
+ // In BaseGraph.jsx, replace the useEffect with:
49168
49208
  React.useEffect(() => {
49169
49209
  if (nodesToFit.length === 0) return;
49170
- requestAnimationFrame(() => {
49210
+
49211
+ // Use setTimeout instead of requestAnimationFrame to ensure nodes are rendered
49212
+ const timer = setTimeout(() => {
49171
49213
  fitView({
49172
49214
  padding: 0.4,
49173
49215
  nodes: [...nodesToFit],
49174
- duration: withDuration ? 300 : undefined,
49175
- maxZoom: 0.8
49216
+ // duration: withDuration ? 300 : undefined,
49217
+ maxZoom: 0.9
49176
49218
  });
49177
- });
49178
- }, [JSON.stringify(nodesToFit), withDuration]);
49219
+ }, 100); // Small delay to ensure nodes are rendered
49220
+
49221
+ return () => clearTimeout(timer);
49222
+ }, [nodesToFit.length, nodesToFit.map(n => `${n.id}-${n.width}-${n.height}`).join(','), withDuration]);
49179
49223
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
49180
49224
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
49181
49225
  style: {
@@ -49206,9 +49250,7 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49206
49250
  fitViewOptions: {
49207
49251
  padding: 0.2,
49208
49252
  //zoom out on default
49209
- ...(zoomOutTransition ? {
49210
- duration: withDuration ? 300 : undefined
49211
- } : {})
49253
+ duration: withDuration ? 300 : undefined
49212
49254
  },
49213
49255
  ...props,
49214
49256
  children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
@@ -49411,7 +49453,8 @@ function TradeRelationship(_ref) {
49411
49453
  filtersConfig,
49412
49454
  onFilterChange = () => {},
49413
49455
  renderTooltipItems = () => [],
49414
- getTotal = () => 0
49456
+ getTotal = () => 0,
49457
+ onRenderComplete = () => {}
49415
49458
  } = _ref;
49416
49459
  const reactFlowWrapper = React.useRef(null);
49417
49460
  const [nodes, setNodes] = react.useNodesState([]);
@@ -49424,6 +49467,23 @@ function TradeRelationship(_ref) {
49424
49467
  const [activeNode, setActiveNode] = React.useState(null);
49425
49468
  // const [initCenter, setInitCenter] = useState(true);
49426
49469
  const [associatedNodes, setAssociatedNodes] = React.useState(null);
49470
+ const isFullyRenderedRef = React.useRef(false);
49471
+ const [isFullyRendered, setIsFullyRendered] = React.useState(false);
49472
+ React.useEffect(() => {
49473
+ isFullyRenderedRef.current = false;
49474
+ setIsFullyRendered(false);
49475
+ setActiveNode(null);
49476
+ }, [data]);
49477
+ React.useEffect(() => {
49478
+ if (nodes.length > 0 && edges.length > 0 && !isFullyRenderedRef.current) {
49479
+ const timeoutId = setTimeout(() => {
49480
+ isFullyRenderedRef.current = true;
49481
+ setIsFullyRendered(true);
49482
+ onRenderComplete(true);
49483
+ }, 200);
49484
+ return () => clearTimeout(timeoutId);
49485
+ }
49486
+ }, [nodes.length, edges.length, associatedNodes]);
49427
49487
  React.useEffect(() => {
49428
49488
  setActiveNode(null);
49429
49489
  }, [data]);
@@ -49448,7 +49508,7 @@ function TradeRelationship(_ref) {
49448
49508
  })
49449
49509
  })), [edges, activeNode, associatedNodes]);
49450
49510
  React.useEffect(() => {
49451
- var _data$sources;
49511
+ var _data$sources, _data$id;
49452
49512
  let yInit = 0;
49453
49513
  let xInit = 0;
49454
49514
  const isBilateral = (data === null || data === void 0 || (_data$sources = data.sources) === null || _data$sources === void 0 ? void 0 : _data$sources.length) >= 1;
@@ -49460,7 +49520,7 @@ function TradeRelationship(_ref) {
49460
49520
  return;
49461
49521
  }
49462
49522
  const _nodes = [{
49463
- id: data.id,
49523
+ id: (_data$id = data.id) === null || _data$id === void 0 ? void 0 : _data$id.toString(),
49464
49524
  type: "expandedNode",
49465
49525
  position: {
49466
49526
  x: xInit,
@@ -49471,13 +49531,13 @@ function TradeRelationship(_ref) {
49471
49531
  const _edges = [];
49472
49532
  if (isBilateral) {
49473
49533
  (data.sources || []).forEach(source => {
49474
- var _data$id;
49534
+ var _data$id2;
49475
49535
  const hasPrev = false;
49476
- _edges.push({
49536
+ const edge = {
49477
49537
  id: "e-".concat(data.id, "-").concat(source),
49478
- source: source,
49479
- type: "default",
49480
- target: data === null || data === void 0 || (_data$id = data.id) === null || _data$id === void 0 ? void 0 : _data$id.toString(),
49538
+ source: source === null || source === void 0 ? void 0 : source.toString(),
49539
+ type: "defaultEdge",
49540
+ target: data === null || data === void 0 || (_data$id2 = data.id) === null || _data$id2 === void 0 ? void 0 : _data$id2.toString(),
49481
49541
  sourceHandle: "left",
49482
49542
  targetHandle: "right",
49483
49543
  data: _objectSpread2(_objectSpread2({
@@ -49490,7 +49550,8 @@ function TradeRelationship(_ref) {
49490
49550
  tooltipTitle,
49491
49551
  moreLeft: false
49492
49552
  })
49493
- });
49553
+ };
49554
+ _edges.push(edge);
49494
49555
  });
49495
49556
  }
49496
49557
  const mapChildren = _ref2 => {
@@ -49534,7 +49595,7 @@ function TradeRelationship(_ref) {
49534
49595
  var _ch$id2, _ch$id3;
49535
49596
  const hasPrev = _prevNodes.find(p => p.id === source);
49536
49597
  const isCustom = !hasPrev ? true : prevChildren.includes(source) ? false : true;
49537
- _edges.push({
49598
+ const edge = {
49538
49599
  id: "e-".concat(ch.id, "-").concat(source),
49539
49600
  source: hasPrev ? source : ch === null || ch === void 0 || (_ch$id2 = ch.id) === null || _ch$id2 === void 0 ? void 0 : _ch$id2.toString(),
49540
49601
  type: isCustom ? "verticalPath" : "defaultEdge",
@@ -49552,7 +49613,8 @@ function TradeRelationship(_ref) {
49552
49613
  tooltipTitle,
49553
49614
  moreLeft: prevChildren.length > children.length
49554
49615
  })
49555
- });
49616
+ };
49617
+ _edges.push(edge);
49556
49618
  if (isCustom) {
49557
49619
  customIndex += 1;
49558
49620
  }
@@ -49591,11 +49653,24 @@ function TradeRelationship(_ref) {
49591
49653
  prevChildren: !isBilateral ? [data.id] : [],
49592
49654
  maxHeight: 0
49593
49655
  });
49656
+
49657
+ // Check for potential ID mismatches
49658
+ const nodeIds = _nodes.map(n => n.id);
49659
+ _edges.filter(e => {
49660
+ const sourceExists = nodeIds.includes(e.source);
49661
+ const targetExists = nodeIds.includes(e.target);
49662
+ return !sourceExists || !targetExists;
49663
+ });
49664
+
49665
+ // Set nodes first
49594
49666
  setNodes(_nodes);
49595
- setEdges(_edges);
49596
- }, [data, activeNode]);
49667
+ const timeoutId = setTimeout(() => {
49668
+ setEdges(_edges);
49669
+ }, 100); // 100ms is imperceptible to users but ensures React Flow is ready
49597
49670
 
49598
- // Used to find associated nodes, when a node is selected
49671
+ // Cleanup to prevent memory leaks if component unmounts quickly
49672
+ return () => clearTimeout(timeoutId);
49673
+ }, [data, activeNode]);
49599
49674
  React.useEffect(() => {
49600
49675
  if (activeNode) {
49601
49676
  let _associatedNodesRight = [activeNode];
@@ -49662,7 +49737,7 @@ function TradeRelationship(_ref) {
49662
49737
  });
49663
49738
  },
49664
49739
  ref: reactFlowWrapper
49665
- });
49740
+ }, JSON.stringify(nodes) + JSON.stringify(edges));
49666
49741
  }
49667
49742
  var index$1 = withProvider(TradeRelationship);
49668
49743
 
@@ -49805,8 +49880,7 @@ function StakeholderMappings(_ref3) {
49805
49880
  iconOffsetY = 250,
49806
49881
  t = s => s,
49807
49882
  emptyString = undefined,
49808
- isPdf = false,
49809
- zoomOutTransition = false
49883
+ isPdf = false
49810
49884
  } = _ref3;
49811
49885
  const reactFlowWrapper = React.useRef(null);
49812
49886
  const [nodes, setNodes] = react.useNodesState([]);
@@ -50071,7 +50145,6 @@ function StakeholderMappings(_ref3) {
50071
50145
  });
50072
50146
  }, [reactFlowWrapper.current, JSON.stringify(data), JSON.stringify(selectedIconNodes), isAllOpenDefault, isSelectable, isChanged, emptyString]);
50073
50147
  return /*#__PURE__*/jsxRuntime.jsx(BaseGraph, {
50074
- zoomOutTransition: zoomOutTransition,
50075
50148
  nodes: nodes,
50076
50149
  mandatoryNodesToFit: mandatoryNodesToFit,
50077
50150
  edges: edges,
@@ -50266,7 +50339,7 @@ function getConfig(data, goTo, t) {
50266
50339
  className: "flex",
50267
50340
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50268
50341
  className: "flex-1",
50269
- children: t(`admin::${item.title}`)
50342
+ children: t(`${item.title}`)
50270
50343
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
50271
50344
  className: "cursor-pointer",
50272
50345
  onClick: () => goTo(item.goToPath),
@@ -50337,6 +50410,8 @@ const getColor = (users, items) => {
50337
50410
  };
50338
50411
  function useConfig(data) {
50339
50412
  const config = React.useMemo(() => {
50413
+ // Ensure data is an array to prevent "data.find is not a function" error
50414
+ const safeData = Array.isArray(data) ? data : [];
50340
50415
  const start = moment__default["default"]().add(-1, "years").format("MMM YY");
50341
50416
  let now = moment__default["default"](start, "MMM YY");
50342
50417
  const _config = [];
@@ -50349,7 +50424,7 @@ function useConfig(data) {
50349
50424
  while (true) {
50350
50425
  DAYS$1.forEach(d => {
50351
50426
  if (d === nowMonth.format("dd") && now.format("MMM YY") === nowMonth.format("MMM YY")) {
50352
- const users = data.find(d => d._id === nowMonth.format("YYYY-MM-DD"))?.count || 0;
50427
+ const users = safeData.find(d => d._id === nowMonth.format("YYYY-MM-DD"))?.count || 0;
50353
50428
  conf.push({
50354
50429
  date: nowMonth.format("DD MMM YY"),
50355
50430
  active: true,
@@ -50400,6 +50475,9 @@ function UserActivity({
50400
50475
  const {
50401
50476
  isCollapsed
50402
50477
  } = useResizeContext();
50478
+
50479
+ // console.log("userActivityyyyy",data);
50480
+
50403
50481
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
50404
50482
  title: t(`admin::user-activity`),
50405
50483
  loading: loading,
@@ -50843,6 +50921,13 @@ function UserStatistics({
50843
50921
  t,
50844
50922
  translationKeys
50845
50923
  }) {
50924
+ // console.log("UserStatistics:loading", loading);
50925
+ // console.log("UserStatistics:loadingUserGrowth", loadingUserGrowth);
50926
+ // console.log("UserStatistics:data", data);
50927
+ // console.log("UserStatistics:userActivityData", data?.userActivityData);
50928
+ // console.log("UserStatistics:topContributorsData", data?.topContributorsData);
50929
+ // console.log("UserStatistics:userGrowthData", data?.userGrowthData);
50930
+
50846
50931
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
50847
50932
  title: t(`${translationKeys}-admin::usage-statistics`),
50848
50933
  className: "with-border-header",
@@ -50850,18 +50935,18 @@ function UserStatistics({
50850
50935
  className: "flex flex-column gap-6",
50851
50936
  children: [/*#__PURE__*/jsxRuntime.jsx(UserActivity, {
50852
50937
  loading: loading,
50853
- data: data.userActivityData,
50938
+ data: data.userActivityData || [],
50854
50939
  t: t
50855
50940
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
50856
50941
  className: "flex flex-row flex-col-mobile gap-6",
50857
50942
  children: [/*#__PURE__*/jsxRuntime.jsx(TopContributors, {
50858
- data: data.topContributorsData,
50943
+ data: data.topContributorsData || [],
50859
50944
  loading: loading,
50860
50945
  t: t
50861
50946
  }), /*#__PURE__*/jsxRuntime.jsx(UserGrowth, {
50862
50947
  t: t,
50863
50948
  loading: loadingUserGrowth,
50864
- data: data.userGrowthData,
50949
+ data: data.userGrowthData || [],
50865
50950
  fetchUserGrowth: fetchUserGrowth,
50866
50951
  translationKeys: translationKeys
50867
50952
  })]
@@ -50879,11 +50964,11 @@ function AdminDashboard(_ref) {
50879
50964
  adminTranslationIdentifier,
50880
50965
  t,
50881
50966
  loadingUserGrowth,
50882
- fetchUserGrowth = () => {}
50967
+ fetchUserGrowth = () => {},
50968
+ userGrowthData
50883
50969
  } = _ref;
50884
- const {
50885
- keyIndicatorsData
50886
- } = data;
50970
+ const keyIndicatorsCards = Array.isArray(data === null || data === void 0 ? void 0 : data.keyIndicatorsData) ? data.keyIndicatorsData : [];
50971
+ console.log("AdminDashboard:data", data);
50887
50972
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
50888
50973
  className: "daf-analysis admin-dashboard",
50889
50974
  children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
@@ -50897,22 +50982,21 @@ function AdminDashboard(_ref) {
50897
50982
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
50898
50983
  className: "sections-cont w-pt",
50899
50984
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
50900
- children: actionWidgetConfig.map(widgetConfig => {
50901
- return /*#__PURE__*/jsxRuntime.jsx(ActionWidget, _objectSpread2(_objectSpread2({}, widgetConfig), {}, {
50902
- onClick: () => goTo(widgetConfig.goToPath),
50903
- title: t("admin::".concat(widgetConfig.title))
50904
- }), widgetConfig.title);
50905
- })
50985
+ children: actionWidgetConfig.map(widgetConfig => /*#__PURE__*/jsxRuntime.jsx(ActionWidget, _objectSpread2(_objectSpread2({}, widgetConfig), {}, {
50986
+ onClick: () => goTo(widgetConfig.goToPath),
50987
+ title: t("".concat(widgetConfig.title))
50988
+ }), widgetConfig.title))
50906
50989
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
50907
50990
  children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
50908
- data: keyIndicatorsData,
50991
+ data: keyIndicatorsCards,
50909
50992
  loading: loading,
50910
50993
  goTo: goTo,
50911
50994
  t: t
50912
50995
  })
50913
50996
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
50914
50997
  children: /*#__PURE__*/jsxRuntime.jsx(UserStatistics, {
50915
- data: data,
50998
+ data: _objectSpread2({}, data),
50999
+ userGrowthData: userGrowthData,
50916
51000
  loading: loading,
50917
51001
  t: t,
50918
51002
  loadingUserGrowth: loadingUserGrowth,
@@ -55038,45 +55122,34 @@ function AdminDashboardScreen({
55038
55122
  fetchUserGrowth,
55039
55123
  userGrowthDataLoading
55040
55124
  } = useWidgetFetch();
55125
+ console.log({
55126
+ userGrowthData
55127
+ });
55041
55128
  const actionsWidgetsConfig = React.useMemo(() => getActionWidgetsConfig({
55042
55129
  getRedirectLink
55043
- }), [getRedirectLink]);
55130
+ }), [getRedirectLink, getActionWidgetsConfig]);
55044
55131
  const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsConfig({
55045
55132
  getRedirectLink,
55046
- keyIndicatorsData: data?.keyInformation
55047
- }), [data?.keyInformation, getRedirectLink]);
55048
-
55049
- // Dummy data for top contributors if not provided
55050
- const TOTAL_DUMMY = [{
55051
- label: "Contributor 1",
55052
- Score: 0
55053
- }, {
55054
- label: "Contributor 2",
55055
- Score: 0
55056
- }, {
55057
- label: "Contributor 3",
55058
- Score: 0
55059
- }, {
55060
- label: "Contributor 4",
55061
- Score: 0
55062
- }, {
55063
- label: "Contributor 5",
55064
- Score: 0
55065
- }];
55133
+ keyIndicators: data?.keyIndicators ?? data?.keyInformation
55134
+ }), [data?.keyIndicators, data?.keyInformation, getRedirectLink, getKeyIndicatorsConfig]);
55135
+ const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
55136
+ const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
55137
+ const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
55066
55138
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
55067
55139
  t: t,
55068
- loading: loading,
55069
55140
  goTo: goTo,
55141
+ loading: loading,
55070
55142
  actionWidgetConfig: actionsWidgetsConfig,
55071
55143
  loadingUserGrowth: userGrowthDataLoading,
55072
55144
  fetchUserGrowth: fetchUserGrowth,
55145
+ adminTranslationIdentifier: appName,
55073
55146
  data: {
55074
55147
  keyIndicatorsData: keyIndicatorsConfig,
55075
- userActivityData: data?.userActivity,
55076
- topContributorsData: data?.topContributors || TOTAL_DUMMY,
55077
- userGrowthData: userGrowthData
55078
- },
55079
- adminTranslationIdentifier: appName
55148
+ userActivityData: safeUserActivity,
55149
+ topContributorsData: safeTopContributors,
55150
+ userGrowthData: safeUserGrowth,
55151
+ data: data
55152
+ }
55080
55153
  });
55081
55154
  }
55082
55155
 
@@ -55293,6 +55366,136 @@ function AdminAccountsViewScreen({
55293
55366
  });
55294
55367
  }
55295
55368
 
55369
+ function AdminSubjectsScreen({
55370
+ config
55371
+ }) {
55372
+ const {
55373
+ appName = "app",
55374
+ module,
55375
+ goTo,
55376
+ t,
55377
+ location,
55378
+ isMobile,
55379
+ getRedirectLink,
55380
+ AdminService,
55381
+ options,
55382
+ handleError,
55383
+ defaultPageSize = 20,
55384
+ view,
55385
+ headerTitle = "subjects",
55386
+ breadcrumbs,
55387
+ refetchTrigger,
55388
+ getData
55389
+ } = config;
55390
+ const handleMergeSubjects = React.useCallback(async mergeData => {
55391
+ try {
55392
+ if (AdminService.mergeSubjects) {
55393
+ await AdminService.mergeSubjects(mergeData);
55394
+ antd.message.success(t("Subjects merged successfully"));
55395
+ } else {
55396
+ console.warn("AdminService.mergeSubjects is not implemented");
55397
+ antd.message.success(t("Subjects merged successfully"));
55398
+ }
55399
+ } catch (err) {
55400
+ handleError?.(err);
55401
+ }
55402
+ }, [AdminService, t, handleError]);
55403
+
55404
+ // Use custom getData if provided, otherwise use default AdminService.getSubjects
55405
+ const getSubjects = React.useCallback(params => {
55406
+ if (getData) {
55407
+ return getData(params);
55408
+ }
55409
+ return AdminService.getSubjects(params);
55410
+ }, [getData, AdminService]);
55411
+ return /*#__PURE__*/jsxRuntime.jsx(SubjectsTable, {
55412
+ t: t,
55413
+ goTo: goTo,
55414
+ getRedirectLink: getRedirectLink,
55415
+ location: location,
55416
+ module: module,
55417
+ headerTitle: headerTitle,
55418
+ getData: getSubjects,
55419
+ isMobile: isMobile,
55420
+ defaultPageSize: defaultPageSize,
55421
+ view: view,
55422
+ breadcrumbs: breadcrumbs,
55423
+ mergeSubjectsFunction: handleMergeSubjects,
55424
+ refetchTrigger: refetchTrigger,
55425
+ config: {
55426
+ options: {
55427
+ category: options?.category,
55428
+ countries: options?.countries
55429
+ }
55430
+ }
55431
+ });
55432
+ }
55433
+
55434
+ function AdminLocationScreen({
55435
+ config
55436
+ }) {
55437
+ const {
55438
+ appName = "app",
55439
+ module,
55440
+ goTo,
55441
+ t,
55442
+ location,
55443
+ isMobile,
55444
+ getRedirectLink,
55445
+ AdminService,
55446
+ options,
55447
+ handleError,
55448
+ defaultPageSize = 20,
55449
+ view,
55450
+ headerTitle = "location",
55451
+ breadcrumbs,
55452
+ refetchTrigger,
55453
+ getData
55454
+ } = config;
55455
+ const handleMergeLocations = React.useCallback(async mergeData => {
55456
+ try {
55457
+ if (AdminService.mergeLocations) {
55458
+ await AdminService.mergeLocations(mergeData);
55459
+ antd.message.success(t("Locations merged successfully"));
55460
+ } else {
55461
+ console.warn("AdminService.mergeLocations is not implemented");
55462
+ antd.message.success(t("Locations merged successfully"));
55463
+ }
55464
+ } catch (err) {
55465
+ handleError?.(err);
55466
+ }
55467
+ }, [AdminService, t, handleError]);
55468
+
55469
+ // Use custom getData if provided, otherwise use default AdminService.getLocations
55470
+ const getLocations = React.useCallback(params => {
55471
+ if (getData) {
55472
+ return getData(params);
55473
+ }
55474
+ return AdminService.getLocations(params);
55475
+ }, [getData, AdminService]);
55476
+ return /*#__PURE__*/jsxRuntime.jsx(LocationTable, {
55477
+ t: t,
55478
+ goTo: goTo,
55479
+ getRedirectLink: getRedirectLink,
55480
+ location: location,
55481
+ module: module,
55482
+ headerTitle: headerTitle,
55483
+ getData: getLocations,
55484
+ isMobile: isMobile,
55485
+ defaultPageSize: defaultPageSize,
55486
+ view: view,
55487
+ breadcrumbs: breadcrumbs,
55488
+ mergeSubjectsFunction: handleMergeLocations,
55489
+ refetchTrigger: refetchTrigger,
55490
+ config: {
55491
+ options: {
55492
+ category: options?.category,
55493
+ countries: options?.countries
55494
+ }
55495
+ }
55496
+ });
55497
+ }
55498
+
55296
55499
  function getAdminRoutes(config) {
55297
55500
  const {
55298
55501
  appName,
@@ -55300,11 +55503,11 @@ function getAdminRoutes(config) {
55300
55503
  useAdminUsersConfig,
55301
55504
  useAdminAccountsConfig,
55302
55505
  useAdminAccountsViewConfig,
55506
+ useAdminSubjectsConfig,
55507
+ useAdminLocationConfig,
55303
55508
  userIsAdmin
55304
55509
  } = config;
55305
55510
  const APP_PREFIX = "APP_".concat(appName.toUpperCase());
55306
-
55307
- // Wrapper components that use the configuration hooks
55308
55511
  function DashboardWrapper() {
55309
55512
  const dashboardConfig = useAdminDashboardConfig();
55310
55513
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
@@ -55329,11 +55532,24 @@ function getAdminRoutes(config) {
55329
55532
  config: accountsViewConfig
55330
55533
  });
55331
55534
  }
55332
- return [{
55535
+ function SubjectsWrapper() {
55536
+ const subjectsConfig = typeof useAdminSubjectsConfig === "function" ? useAdminSubjectsConfig() : undefined;
55537
+ return /*#__PURE__*/jsxRuntime.jsx(AdminSubjectsScreen, {
55538
+ config: subjectsConfig
55539
+ });
55540
+ }
55541
+ function LocationWrapper() {
55542
+ const locationConfig = typeof useAdminLocationConfig === "function" ? useAdminLocationConfig() : undefined;
55543
+ return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen, {
55544
+ config: locationConfig
55545
+ });
55546
+ }
55547
+ const subjectsIndexComponent = typeof useAdminLocationConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {}) : typeof useAdminSubjectsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {}) : /*#__PURE__*/jsxRuntime.jsx("div", {});
55548
+ const routes = [{
55333
55549
  path: "",
55334
55550
  key: "".concat(APP_PREFIX, "_DASHBOARD"),
55335
55551
  exact: true,
55336
- visible: () => true,
55552
+ visible: user => userIsAdmin(user),
55337
55553
  component: /*#__PURE__*/jsxRuntime.jsx(DashboardWrapper, {})
55338
55554
  }, {
55339
55555
  path: "accounts",
@@ -55353,7 +55569,26 @@ function getAdminRoutes(config) {
55353
55569
  exact: true,
55354
55570
  visible: user => userIsAdmin(user),
55355
55571
  component: /*#__PURE__*/jsxRuntime.jsx(AccountsViewWrapper, {})
55356
- }];
55572
+ }, {
55573
+ path: "subjects",
55574
+ key: "".concat(APP_PREFIX, "_SUBJECTS_INDEX"),
55575
+ exact: true,
55576
+ visible: user => userIsAdmin(user),
55577
+ component: subjectsIndexComponent
55578
+ }, ...(typeof useAdminLocationConfig === "function" ? [{
55579
+ path: "subjects/location",
55580
+ key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_LOCATIONS"),
55581
+ exact: true,
55582
+ visible: user => userIsAdmin(user),
55583
+ component: /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {})
55584
+ }] : []), ...(typeof useAdminSubjectsConfig === "function" ? [{
55585
+ path: "subjects/stakeholder",
55586
+ key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_STAKEHOLDERS"),
55587
+ exact: true,
55588
+ visible: user => userIsAdmin(user),
55589
+ component: /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {})
55590
+ }] : [])];
55591
+ return routes;
55357
55592
  }
55358
55593
 
55359
55594
  const isUnderDevelopmentType = backgroundType => {
@@ -61581,6 +61816,8 @@ exports.AdminAccountsScreen = AdminAccountsScreen;
61581
61816
  exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
61582
61817
  exports.AdminDashboard = AdminDashboard;
61583
61818
  exports.AdminDashboardScreen = AdminDashboardScreen;
61819
+ exports.AdminLocationScreen = AdminLocationScreen;
61820
+ exports.AdminSubjectsScreen = AdminSubjectsScreen;
61584
61821
  exports.AdminUsersScreen = AdminUsersScreen;
61585
61822
  exports.AdminView = AdminView$1;
61586
61823
  exports.AjaxSelect = AjaxSelectMain;