datastake-daf 0.6.811 → 0.6.813

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 (57) hide show
  1. package/dist/components/index.js +1509 -379
  2. package/dist/hooks/index.js +11 -4
  3. package/dist/pages/index.js +138 -16
  4. package/dist/services/index.js +56 -6
  5. package/dist/utils/index.js +28 -5
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/AuthForm/index.jsx +12 -3
  8. package/src/@daf/core/components/Dashboard/Widget/FaunaWidget/index.jsx +1 -2
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +0 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +0 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -3
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -1
  14. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +56 -31
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +36 -10
  16. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
  17. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +37 -10
  18. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  19. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +81 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +77 -0
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -0
  22. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +22 -30
  23. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +25 -13
  24. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +127 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +43 -0
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +201 -0
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +146 -0
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +58 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +176 -0
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +17 -2
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +27 -13
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
  33. package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +4 -2
  34. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +3 -0
  35. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +12 -9
  36. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -4
  37. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +9 -17
  38. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +9 -8
  39. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +124 -99
  40. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +48 -1
  41. package/src/@daf/hooks/useAdminDashboard.js +7 -4
  42. package/src/@daf/pages/Summary/Activities/Monitoring/components/BiodiversityAndHabitat/index.jsx +2 -2
  43. package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +24 -0
  44. package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
  45. package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
  46. package/src/@daf/pages/View/index.jsx +29 -4
  47. package/src/@daf/services/AdminService.js +47 -5
  48. package/src/@daf/services/DashboardService.js +3 -3
  49. package/src/@daf/utils/filters.js +13 -15
  50. package/src/constants/locales/en/translation.js +13 -0
  51. package/src/helpers/copyToClipboard.js +60 -0
  52. package/build/favicon.ico +0 -0
  53. package/build/logo192.png +0 -0
  54. package/build/logo512.png +0 -0
  55. package/build/manifest.json +0 -25
  56. package/build/robots.txt +0 -3
  57. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -8011,7 +8011,7 @@ const MultiSelectStyled = styled__default["default"](antd.Select)`
8011
8011
 
8012
8012
  const _excluded$y = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
8013
8013
  const {
8014
- useToken: useToken$n
8014
+ useToken: useToken$p
8015
8015
  } = antd.theme;
8016
8016
 
8017
8017
  /**
@@ -8105,7 +8105,7 @@ function Multiselect(_ref) {
8105
8105
  restProps = _objectWithoutProperties(_ref, _excluded$y);
8106
8106
  const {
8107
8107
  token
8108
- } = useToken$n();
8108
+ } = useToken$p();
8109
8109
  const [selectValue, setSelectValue] = React.useState(Array.isArray(defaultSelected) ? defaultSelected.length > 0 ? defaultSelected : [] : [defaultSelected]);
8110
8110
  function onSelectChange(value) {
8111
8111
  if (!canUnselectLast && value.length === 0) {
@@ -8659,7 +8659,7 @@ const useHeader = _ref => {
8659
8659
  };
8660
8660
 
8661
8661
  const {
8662
- useToken: useToken$m
8662
+ useToken: useToken$o
8663
8663
  } = antd.theme;
8664
8664
  function BreadCrumbs({
8665
8665
  breadcrumbs = [],
@@ -8668,7 +8668,7 @@ function BreadCrumbs({
8668
8668
  const [splitIndex, setSplitIndex] = React.useState(0);
8669
8669
  const {
8670
8670
  token
8671
- } = useToken$m();
8671
+ } = useToken$o();
8672
8672
  const _renderBreadcrumb = (b, i, isLast, noOnClickLast = false) => {
8673
8673
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
8674
8674
  className: "flex breadcrumb-item",
@@ -18410,7 +18410,7 @@ const {
18410
18410
  Meta
18411
18411
  } = antd.Card;
18412
18412
  const {
18413
- useToken: useToken$l
18413
+ useToken: useToken$n
18414
18414
  } = antd.theme;
18415
18415
  function ProjectWidget(_ref) {
18416
18416
  let {
@@ -18429,7 +18429,7 @@ function ProjectWidget(_ref) {
18429
18429
  const [isHovered, setIsHovered] = React__default["default"].useState(false);
18430
18430
  const {
18431
18431
  token
18432
- } = useToken$l();
18432
+ } = useToken$n();
18433
18433
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
18434
18434
  style: {
18435
18435
  // flex: 1,
@@ -18533,7 +18533,7 @@ const Style$E = styled__default["default"].div`
18533
18533
  `;
18534
18534
 
18535
18535
  const {
18536
- useToken: useToken$k
18536
+ useToken: useToken$m
18537
18537
  } = antd.theme;
18538
18538
  const WidgetCard = _ref => {
18539
18539
  let {
@@ -18552,7 +18552,7 @@ const WidgetCard = _ref => {
18552
18552
  width,
18553
18553
  t = () => {}
18554
18554
  } = _ref;
18555
- useToken$k();
18555
+ useToken$m();
18556
18556
  return /*#__PURE__*/jsxRuntime.jsx(Style$E, {
18557
18557
  backgroundColor: backgroundColor,
18558
18558
  backgroundBorderColor: backgroundBorderColor,
@@ -19415,8 +19415,6 @@ function FaunaWidget(_ref) {
19415
19415
  $itemWidth: itemWidth,
19416
19416
  $itemHeight: itemHeight,
19417
19417
  children: faunaConfig.map(item => {
19418
- // Use colored SVG if the item's key exists in faunaPresent array
19419
- // Otherwise use default SVG
19420
19418
  const isPresent = Array.isArray(faunaPresent) && faunaPresent.includes(item.key);
19421
19419
  const shouldUseColored = isPresent;
19422
19420
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
@@ -19860,12 +19858,12 @@ function GroupInfos({
19860
19858
  }
19861
19859
 
19862
19860
  const {
19863
- useToken: useToken$j
19861
+ useToken: useToken$l
19864
19862
  } = antd.theme;
19865
19863
  function Smart() {
19866
19864
  const {
19867
19865
  token
19868
- } = useToken$j();
19866
+ } = useToken$l();
19869
19867
  const [isOpen, setIsOpen] = React.useState(false);
19870
19868
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
19871
19869
  style: {
@@ -19949,7 +19947,7 @@ function SmartWidget({
19949
19947
  }) {
19950
19948
  const {
19951
19949
  token
19952
- } = useToken$j();
19950
+ } = useToken$l();
19953
19951
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
19954
19952
  noTitle: true,
19955
19953
  className: "no-p-body p-xs",
@@ -20994,7 +20992,7 @@ function DataLink$1({
20994
20992
  }
20995
20993
 
20996
20994
  const {
20997
- useToken: useToken$i
20995
+ useToken: useToken$k
20998
20996
  } = antd.theme;
20999
20997
  const disabledTypes = ["dataLink"];
21000
20998
  function Versions({
@@ -21007,7 +21005,7 @@ function Versions({
21007
21005
  }) {
21008
21006
  const {
21009
21007
  token
21010
- } = useToken$i();
21008
+ } = useToken$k();
21011
21009
  const dataSource = React.useMemo(() => {
21012
21010
  if (!versionsDatapoints) {
21013
21011
  return [];
@@ -42981,12 +42979,17 @@ function AuthForm(_ref) {
42981
42979
  errors,
42982
42980
  t = key => key,
42983
42981
  executeRecaptcha = () => {},
42984
- getCurrentStep = () => {}
42982
+ getCurrentStep = () => {},
42983
+ theme
42985
42984
  } = _ref;
42986
42985
  const [formInstance] = antd.Form.useForm(form);
42987
42986
  const [currentStep, setCurrentStep] = React.useState(0);
42988
42987
  const [allFormValues, setAllFormValues] = React.useState(initialValues);
42989
42988
  const [formErrors, setFormErrors] = React.useState(null);
42989
+ const buttonStyle = theme !== null && theme !== void 0 && theme.colorPrimary ? {
42990
+ backgroundColor: theme.colorPrimary,
42991
+ borderColor: theme.colorPrimary
42992
+ } : {};
42990
42993
  const isMultiStep = !!steps;
42991
42994
  const currentFields = isMultiStep ? steps === null || steps === void 0 || (_steps$currentStep = steps[currentStep]) === null || _steps$currentStep === void 0 ? void 0 : _steps$currentStep.fields : fields || [];
42992
42995
  React.useEffect(() => {
@@ -43127,6 +43130,7 @@ function AuthForm(_ref) {
43127
43130
  name: field.name,
43128
43131
  label: field.label,
43129
43132
  rules: field.rules,
43133
+ dependencies: field.dependencies,
43130
43134
  style: {
43131
43135
  marginBottom: 0
43132
43136
  }
@@ -43173,6 +43177,7 @@ function AuthForm(_ref) {
43173
43177
  disabled: isLastStep && !allFieldsFilled,
43174
43178
  block: true,
43175
43179
  className: "normal-br",
43180
+ style: buttonStyle,
43176
43181
  children: isLastStep ? submitText : t("Next")
43177
43182
  })
43178
43183
  });
@@ -43186,6 +43191,7 @@ function AuthForm(_ref) {
43186
43191
  onClick: prev,
43187
43192
  block: true,
43188
43193
  className: "normal-br",
43194
+ style: buttonStyle,
43189
43195
  children: t("Back")
43190
43196
  })
43191
43197
  })]
@@ -43199,6 +43205,7 @@ function AuthForm(_ref) {
43199
43205
  htmlType: "submit",
43200
43206
  block: true,
43201
43207
  className: "normal-br",
43208
+ style: buttonStyle,
43202
43209
  children: isMultiStep ? t("Next") : submitText
43203
43210
  })
43204
43211
  })]
@@ -45228,11 +45235,11 @@ function DataStore(_ref) {
45228
45235
  });
45229
45236
  }
45230
45237
 
45231
- const filtersConfig$c = {
45238
+ const filtersConfig$e = {
45232
45239
  datastakeId: '',
45233
45240
  name: ''
45234
45241
  };
45235
- const selectFiltersConfig$c = {
45242
+ const selectFiltersConfig$e = {
45236
45243
  country: {
45237
45244
  type: 'select',
45238
45245
  label: 'Country',
@@ -45273,7 +45280,7 @@ const selectFiltersConfig$c = {
45273
45280
  getValue: option => option.value
45274
45281
  }
45275
45282
  };
45276
- const checkboxConfig$c = {
45283
+ const checkboxConfig$e = {
45277
45284
  datastakeId: 'ID',
45278
45285
  name: 'Name'
45279
45286
  };
@@ -45590,14 +45597,15 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
45590
45597
  });
45591
45598
  return o;
45592
45599
  };
45600
+ const NEW_PAGINATION_APPS = ["nashiriki"];
45593
45601
  const filterParams = (value, module) => {
45594
45602
  const {
45595
45603
  activeFilters,
45596
45604
  ...rest
45597
45605
  } = value;
45598
45606
  const {
45599
- page = 1,
45600
- pageSize = 20,
45607
+ page,
45608
+ pageSize,
45601
45609
  sortDir,
45602
45610
  sortBy,
45603
45611
  search,
@@ -45606,10 +45614,9 @@ const filterParams = (value, module) => {
45606
45614
  } = activeFilters || {};
45607
45615
  const params = {};
45608
45616
  params.pagination = JSON.stringify({
45609
- page,
45610
- pageSize
45617
+ [NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
45618
+ [NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
45611
45619
  });
45612
- params.filters = JSON.stringify(filters);
45613
45620
  if (search && searchParams) {
45614
45621
  params.search = JSON.stringify({
45615
45622
  qs: search,
@@ -45622,6 +45629,16 @@ const filterParams = (value, module) => {
45622
45629
  by: sortBy
45623
45630
  });
45624
45631
  }
45632
+ if (Object.keys(filters).length) {
45633
+ if (value.sourceId && value.sourceId === "overview") {
45634
+ params.filters = JSON.stringify(filters);
45635
+ } else {
45636
+ params.filters = JSON.stringify({
45637
+ ...filters,
45638
+ authorId: undefined
45639
+ });
45640
+ }
45641
+ }
45625
45642
  return {
45626
45643
  ...rest,
45627
45644
  ...params
@@ -45999,12 +46016,12 @@ function DataStoreTable$1(_ref) {
45999
46016
  goNext,
46000
46017
  setPagination
46001
46018
  } = useFilters({
46002
- selectFiltersConfig: selectFiltersConfig$c,
46019
+ selectFiltersConfig: selectFiltersConfig$e,
46003
46020
  view,
46004
46021
  goTo,
46005
46022
  location,
46006
46023
  module: mod,
46007
- filtersConfig: filtersConfig$c,
46024
+ filtersConfig: filtersConfig$e,
46008
46025
  getRedirectLink,
46009
46026
  defaultPageSize
46010
46027
  });
@@ -46077,7 +46094,7 @@ function DataStoreTable$1(_ref) {
46077
46094
  hasError: hasError,
46078
46095
  setHasError: setHasError,
46079
46096
  filtersConfig: newFiltersConfig,
46080
- checkboxConfig: checkboxConfig$c,
46097
+ checkboxConfig: checkboxConfig$e,
46081
46098
  onSearch: onSearch,
46082
46099
  activeFilters: activeFilters,
46083
46100
  canClear: canClearSearch,
@@ -46093,7 +46110,7 @@ function DataStoreTable$1(_ref) {
46093
46110
  rowKey: "key",
46094
46111
  doEmptyRows: true,
46095
46112
  selectOptions,
46096
- filtersConfig: selectFiltersConfig$c,
46113
+ filtersConfig: selectFiltersConfig$e,
46097
46114
  onFilterChange: onFiltersChange,
46098
46115
  showFilters,
46099
46116
  defaultFilters,
@@ -47920,7 +47937,7 @@ StyledTabs.propTypes = {
47920
47937
  };
47921
47938
 
47922
47939
  const {
47923
- useToken: useToken$h
47940
+ useToken: useToken$j
47924
47941
  } = antd.theme;
47925
47942
  const MAX_LENGTH = 3;
47926
47943
  function AvatarGroup(_ref) {
@@ -47932,7 +47949,7 @@ function AvatarGroup(_ref) {
47932
47949
  const count = items.length === maxLength + 1 ? items.length : maxLength;
47933
47950
  const {
47934
47951
  token
47935
- } = useToken$h();
47952
+ } = useToken$j();
47936
47953
  return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
47937
47954
  max: {
47938
47955
  count: count,
@@ -47976,7 +47993,7 @@ const Container$1 = styled__default["default"].div`
47976
47993
 
47977
47994
  const _excluded$9 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
47978
47995
  const {
47979
- useToken: useToken$g
47996
+ useToken: useToken$i
47980
47997
  } = antd.theme;
47981
47998
 
47982
47999
  /**
@@ -48069,7 +48086,7 @@ function BarChart(_ref) {
48069
48086
  const chartRef = React__default["default"].useRef(null);
48070
48087
  const {
48071
48088
  token
48072
- } = useToken$g();
48089
+ } = useToken$i();
48073
48090
  const {
48074
48091
  legendEnabled,
48075
48092
  legendItems,
@@ -48150,7 +48167,7 @@ function BarChart(_ref) {
48150
48167
 
48151
48168
  const _excluded$8 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "legendConfig", "width", "yAxis", "xAxis"];
48152
48169
  const {
48153
- useToken: useToken$f
48170
+ useToken: useToken$h
48154
48171
  } = antd.theme;
48155
48172
 
48156
48173
  /**
@@ -48242,7 +48259,7 @@ function LineChart(_ref) {
48242
48259
  const chartRef = React__default["default"].useRef(null);
48243
48260
  const {
48244
48261
  token
48245
- } = useToken$f();
48262
+ } = useToken$h();
48246
48263
  const {
48247
48264
  legendEnabled,
48248
48265
  legendItems,
@@ -48341,7 +48358,7 @@ function LineChart(_ref) {
48341
48358
 
48342
48359
  const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "width", "legendConfig", "isPdf", "yAxis", "xAxis"];
48343
48360
  const {
48344
- useToken: useToken$e
48361
+ useToken: useToken$g
48345
48362
  } = antd.theme;
48346
48363
 
48347
48364
  /**
@@ -48449,7 +48466,7 @@ function ColumnChart(_ref) {
48449
48466
  const chartRef = React__default["default"].useRef(null);
48450
48467
  const {
48451
48468
  token
48452
- } = useToken$e();
48469
+ } = useToken$g();
48453
48470
  const {
48454
48471
  legendEnabled,
48455
48472
  legendItems,
@@ -48539,7 +48556,7 @@ function ColumnChart(_ref) {
48539
48556
  }
48540
48557
 
48541
48558
  const {
48542
- useToken: useToken$d
48559
+ useToken: useToken$f
48543
48560
  } = antd.theme;
48544
48561
  /**
48545
48562
  * RadialBarChart Component
@@ -48601,7 +48618,7 @@ function RadialBarChart(_ref) {
48601
48618
  const chartRef = React__default["default"].useRef(null);
48602
48619
  const {
48603
48620
  token
48604
- } = useToken$d();
48621
+ } = useToken$f();
48605
48622
  const {
48606
48623
  legendEnabled,
48607
48624
  legendItems,
@@ -48714,7 +48731,7 @@ function RadialBarChart(_ref) {
48714
48731
 
48715
48732
  const _excluded$6 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
48716
48733
  const {
48717
- useToken: useToken$c
48734
+ useToken: useToken$e
48718
48735
  } = antd.theme;
48719
48736
 
48720
48737
  /**
@@ -48792,7 +48809,7 @@ function DonutPie(_ref) {
48792
48809
  const chartRef = React.useRef(null);
48793
48810
  const {
48794
48811
  token
48795
- } = useToken$c();
48812
+ } = useToken$e();
48796
48813
  const {
48797
48814
  legendEnabled,
48798
48815
  legendItems,
@@ -49047,7 +49064,7 @@ styled__default["default"].div`
49047
49064
  `;
49048
49065
 
49049
49066
  const {
49050
- useToken: useToken$b
49067
+ useToken: useToken$d
49051
49068
  } = antd.theme;
49052
49069
  /**
49053
49070
  * StackChart Component
@@ -49136,7 +49153,7 @@ function StackChart(_ref) {
49136
49153
  const ref = React__default["default"].useRef();
49137
49154
  const {
49138
49155
  token
49139
- } = useToken$b();
49156
+ } = useToken$d();
49140
49157
  const isEmpty = !data.length;
49141
49158
  const [mouseY, setMouseY] = React__default["default"].useState(0);
49142
49159
  const [mouseX, setMouseX] = React__default["default"].useState(0);
@@ -49309,7 +49326,7 @@ function StackChart(_ref) {
49309
49326
 
49310
49327
  const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
49311
49328
  const {
49312
- useToken: useToken$a
49329
+ useToken: useToken$c
49313
49330
  } = antd.theme;
49314
49331
 
49315
49332
  /**
@@ -49389,7 +49406,7 @@ const AreaChart = _ref => {
49389
49406
  const chartRef = React.useRef(null);
49390
49407
  const {
49391
49408
  token
49392
- } = useToken$a();
49409
+ } = useToken$c();
49393
49410
  const {
49394
49411
  legendEnabled,
49395
49412
  legendItems,
@@ -49474,7 +49491,7 @@ const AreaChart = _ref => {
49474
49491
 
49475
49492
  const _excluded$4 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
49476
49493
  const {
49477
- useToken: useToken$9
49494
+ useToken: useToken$b
49478
49495
  } = antd.theme;
49479
49496
  const RadarChart = _ref => {
49480
49497
  let {
@@ -49502,7 +49519,7 @@ const RadarChart = _ref => {
49502
49519
  const chartRef = React.useRef(null);
49503
49520
  const {
49504
49521
  token
49505
- } = useToken$9();
49522
+ } = useToken$b();
49506
49523
  const {
49507
49524
  legendEnabled,
49508
49525
  legendItems,
@@ -49617,7 +49634,7 @@ const RadarChart = _ref => {
49617
49634
  };
49618
49635
 
49619
49636
  const {
49620
- useToken: useToken$8
49637
+ useToken: useToken$a
49621
49638
  } = antd.theme;
49622
49639
  function DualAxesChart(_ref) {
49623
49640
  let {
@@ -49639,7 +49656,7 @@ function DualAxesChart(_ref) {
49639
49656
  const chartRef = React__default["default"].useRef(null);
49640
49657
  const {
49641
49658
  token
49642
- } = useToken$8();
49659
+ } = useToken$a();
49643
49660
  const {
49644
49661
  legendEnabled,
49645
49662
  legendItems,
@@ -50102,14 +50119,14 @@ const Style$k = styled__default["default"].div`
50102
50119
  // components/Nodes/NameNode.jsx
50103
50120
  const NAME_CARD_WIDTH = 315;
50104
50121
  const {
50105
- useToken: useToken$7
50122
+ useToken: useToken$9
50106
50123
  } = antd.theme;
50107
50124
  function NameNode({
50108
50125
  data
50109
50126
  }) {
50110
50127
  const {
50111
50128
  token
50112
- } = useToken$7();
50129
+ } = useToken$9();
50113
50130
  const translateFN = typeof data?.t === "function" ? data.t : key => key;
50114
50131
  const isPdf = data?.isPdf;
50115
50132
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -51979,33 +51996,27 @@ const BaseScreen = _ref => {
51979
51996
 
51980
51997
  function AppInvitation(_ref) {
51981
51998
  let {
51982
- // Redux State
51983
51999
  errors,
51984
52000
  user,
51985
52001
  invitationSuccess,
51986
- // Actions
51987
52002
  confirmInvitation,
51988
52003
  getUserFromInvitation,
51989
- // Configuration
52004
+ theme,
51990
52005
  Layout,
51991
52006
  redirectPath = "/",
51992
52007
  loginPath = "/login",
51993
52008
  appRedirectPath = "/app",
51994
- params: propParams = {}
51995
- } = _ref;
51996
- const {
52009
+ params: propParams = {},
52010
+ goTo,
52011
+ isMobile = false,
51997
52012
  t
51998
- } = useTranslation();
51999
- const routeParams = useParams();
52013
+ } = _ref;
52000
52014
  const {
52001
52015
  app,
52002
52016
  companyCode,
52003
52017
  userCode
52004
- } = _objectSpread2(_objectSpread2({}, routeParams), propParams);
52005
- const [passwords] = antd.Form.useForm();
52018
+ } = propParams;
52006
52019
  const [checking, setChecking] = React.useState(true);
52007
- const goTo = useNavigate();
52008
- const [termsAgreed, setTermsAgreed] = React.useState(false);
52009
52020
  const [passwordReseted, setPasswordReseted] = React.useState(false);
52010
52021
  React.useEffect(() => {
52011
52022
  if (companyCode && userCode) {
@@ -52026,32 +52037,114 @@ function AppInvitation(_ref) {
52026
52037
  localStorage.setItem('token', data.token);
52027
52038
  }
52028
52039
  antd.message.success(t('Invitation accepted'));
52029
- // Fix: ensure we don't rely on a variable from useParams that might not exist
52030
- // Just use the configured redirectPath
52031
- goTo(redirectPath);
52040
+ if (goTo && typeof goTo === 'function') {
52041
+ goTo(redirectPath);
52042
+ } else {
52043
+ window.location.href = redirectPath;
52044
+ }
52032
52045
  }, {
52033
52046
  companyCode,
52034
52047
  userCode
52035
52048
  });
52036
52049
  }
52037
52050
  }, [invitationSuccess, user, confirmInvitation, goTo, redirectPath, companyCode, userCode, t]);
52038
- const displayError = name => {
52039
- return errors && errors[name] && errors[name].length > 0 && {
52040
- help: errors[name][0],
52041
- validateStatus: 'error'
52042
- };
52043
- };
52051
+ React.useEffect(() => {
52052
+ const isInInvitationFlow = checking || invitationSuccess && user && user.inviteToken || invitationSuccess && user && !user.inviteToken;
52053
+ if (!isInInvitationFlow) {
52054
+ if (user) {
52055
+ if (goTo && typeof goTo === 'function') {
52056
+ goTo(appRedirectPath);
52057
+ } else {
52058
+ window.location.href = appRedirectPath;
52059
+ }
52060
+ } else {
52061
+ if (goTo && typeof goTo === 'function') {
52062
+ goTo(redirectPath);
52063
+ } else {
52064
+ window.location.href = redirectPath;
52065
+ }
52066
+ }
52067
+ }
52068
+ }, [user, goTo, appRedirectPath, redirectPath, checking, invitationSuccess]);
52044
52069
  const subTitle = !passwordReseted ? 'Set up your password and agree with out terms and conditions.' : isMobile ? 'Your account has been successfully set up. To log in use a desktop device.' : 'Your account has been successfully set up. Please click the button below to log in.';
52045
52070
  const title = passwordReseted ? 'Thank You!' : undefined;
52071
+ const fields = [{
52072
+ name: 'email',
52073
+ label: t("Email"),
52074
+ type: 'input',
52075
+ disabled: true
52076
+ }, {
52077
+ name: 'password',
52078
+ label: t("Password"),
52079
+ type: 'password',
52080
+ required: true,
52081
+ rules: [{
52082
+ required: true,
52083
+ message: t("errors::password should not be empty")
52084
+ }],
52085
+ placeholder: t("Password")
52086
+ }, {
52087
+ name: 'confirmPassword',
52088
+ label: t("Confirm Password"),
52089
+ type: 'password',
52090
+ required: true,
52091
+ dependencies: ['password'],
52092
+ rules: [{
52093
+ required: true,
52094
+ message: t("errors::password should not be empty")
52095
+ }, _ref2 => {
52096
+ let {
52097
+ getFieldValue
52098
+ } = _ref2;
52099
+ return {
52100
+ validator(rule, value) {
52101
+ if (!value || getFieldValue('password') === value) {
52102
+ return Promise.resolve();
52103
+ }
52104
+ return Promise.reject(t('errors::passwordNotMatch'));
52105
+ }
52106
+ };
52107
+ }],
52108
+ placeholder: t("Confirm Password")
52109
+ }, {
52110
+ name: 'mailUpdates',
52111
+ type: 'custom',
52112
+ valuePropName: 'checked',
52113
+ component: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52114
+ children: t("Sign up to receive updates")
52115
+ })
52116
+ }, {
52117
+ name: 'agreeTerms',
52118
+ type: 'custom',
52119
+ valuePropName: 'checked',
52120
+ rules: [{
52121
+ validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error(t('You must agree to the terms and conditions')))
52122
+ }],
52123
+ component: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52124
+ children: /*#__PURE__*/jsxRuntime.jsx("p", {
52125
+ className: "mb-0",
52126
+ children: t('Agree to the Terms of Use of this application and the Privacy Policy')
52127
+ })
52128
+ })
52129
+ }];
52130
+ const handleSubmit = values => {
52131
+ const {
52132
+ password,
52133
+ mailUpdates
52134
+ } = values;
52135
+ confirmInvitation({
52136
+ password,
52137
+ mailUpdates
52138
+ }, () => {}, {
52139
+ companyCode,
52140
+ userCode
52141
+ });
52142
+ setPasswordReseted(true);
52143
+ };
52046
52144
  if (checking && !invitationSuccess) {
52047
52145
  return /*#__PURE__*/jsxRuntime.jsx(Loading, {});
52048
52146
  }
52049
-
52050
- // If auto-confirming (inviteToken present), we might want to show loading or nothing until redirect
52051
52147
  if (invitationSuccess && user && user.inviteToken) {
52052
- // The useEffect will handle the redirect/confirm.
52053
- // We can show loading here too or just return null.
52054
- // Original code: checks invitationSuccess && !user.inviteToken for form, else redirect.
52055
52148
  return /*#__PURE__*/jsxRuntime.jsx(Loading, {});
52056
52149
  }
52057
52150
  if (invitationSuccess && !user.inviteToken) {
@@ -52060,106 +52153,29 @@ function AppInvitation(_ref) {
52060
52153
  children: isMobile ? null : /*#__PURE__*/jsxRuntime.jsx(DafButton, {
52061
52154
  type: "primary",
52062
52155
  className: "normal-br",
52156
+ style: theme || window.theme ? {
52157
+ backgroundColor: (theme || window.theme).colorPrimary,
52158
+ borderColor: (theme || window.theme).colorPrimary
52159
+ } : {},
52063
52160
  onClick: () => {
52064
52161
  window.location.href = loginPath;
52065
52162
  },
52066
52163
  children: t('Log In')
52067
52164
  })
52068
- }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
52069
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
52070
- name: "password",
52071
- layout: "vertical",
52072
- form: passwords,
52073
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, _objectSpread2(_objectSpread2({
52074
- required: true,
52075
- name: "password"
52076
- }, displayError('password')), {}, {
52077
- label: t("Password"),
52078
- rules: [{
52079
- required: true,
52080
- message: t("errors::password should not be empty")
52081
- }],
52082
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.Password, {
52083
- size: "large",
52084
- placeholder: t("Password")
52085
- })
52086
- })), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, _objectSpread2(_objectSpread2({
52087
- required: true,
52088
- name: "confirmPassword"
52089
- }, displayError('confirmPassword')), {}, {
52090
- label: t("Confirm Password"),
52091
- dependencies: ['password'],
52092
- rules: [{
52093
- required: true,
52094
- message: t("errors::password should not be empty")
52095
- }, _ref2 => {
52096
- let {
52097
- getFieldValue
52098
- } = _ref2;
52099
- return {
52100
- validator(rule, value) {
52101
- if (!value || getFieldValue('password') === value) {
52102
- return Promise.resolve();
52103
- }
52104
- return Promise.reject(t('errors::passwordNotMatch'));
52105
- }
52106
- };
52107
- }],
52108
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.Password, {
52109
- size: "large",
52110
- placeholder: t("Confirm Password")
52111
- })
52112
- })), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
52113
- name: "mailUpdates",
52114
- valuePropName: "checked",
52115
- noStyle: true,
52116
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52117
- children: t("Sign up to receive updates")
52118
- })
52119
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
52120
- name: "agreeTerms",
52121
- valuePropName: "checked",
52122
- noStyle: true,
52123
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52124
- checked: termsAgreed,
52125
- onChange: e => setTermsAgreed(e.target.checked),
52126
- children: /*#__PURE__*/jsxRuntime.jsx("p", {
52127
- className: "mb-0",
52128
- children: t('Agree to the Terms of Use of this application and the Privacy Policy')
52129
- })
52130
- })
52131
- })]
52132
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
52133
- className: "buttons",
52134
- children: /*#__PURE__*/jsxRuntime.jsx(DafButton, {
52135
- className: "normal-br",
52136
- type: "primary",
52137
- block: true,
52138
- size: "large",
52139
- disabled: !termsAgreed,
52140
- onClick: () => {
52141
- passwords.validateFields().then(data => {
52142
- const {
52143
- password,
52144
- mailUpdates
52145
- } = data;
52146
- confirmInvitation({
52147
- password,
52148
- mailUpdates
52149
- }, () => {}, {
52150
- companyCode,
52151
- userCode
52152
- });
52153
- setPasswordReseted(true);
52154
- });
52155
- },
52156
- children: t("Confirm")
52157
- })
52158
- })]
52165
+ }) : /*#__PURE__*/jsxRuntime.jsx(AuthForm, {
52166
+ fields: fields,
52167
+ onSubmit: handleSubmit,
52168
+ submitText: t("Confirm"),
52169
+ initialValues: {
52170
+ email: user === null || user === void 0 ? void 0 : user.email
52171
+ },
52172
+ errors: errors,
52173
+ t: t,
52174
+ executeRecaptcha: () => Promise.resolve(true),
52175
+ theme: theme || window.theme
52159
52176
  })
52160
52177
  });
52161
52178
  if (Layout) {
52162
- // Assuming Layout accepts these props as per Nashiriki AuthLayout
52163
52179
  return /*#__PURE__*/jsxRuntime.jsx(Layout, {
52164
52180
  app: app,
52165
52181
  step: 1,
@@ -52181,11 +52197,7 @@ function AppInvitation(_ref) {
52181
52197
  }), Content]
52182
52198
  });
52183
52199
  }
52184
- return user ? /*#__PURE__*/jsxRuntime.jsx(Navigate, {
52185
- to: appRedirectPath
52186
- }) : /*#__PURE__*/jsxRuntime.jsx(Navigate, {
52187
- to: redirectPath
52188
- });
52200
+ return null;
52189
52201
  }
52190
52202
 
52191
52203
  /**
@@ -52498,7 +52510,7 @@ const getRangeOfTicks = max => {
52498
52510
  };
52499
52511
 
52500
52512
  const {
52501
- useToken: useToken$6
52513
+ useToken: useToken$8
52502
52514
  } = antd.theme;
52503
52515
  function useUserGrowth({
52504
52516
  container,
@@ -52510,8 +52522,7 @@ function useUserGrowth({
52510
52522
  const [data, setData] = React.useState([]);
52511
52523
  const {
52512
52524
  token
52513
- } = useToken$6();
52514
- console.log("mainData", mainData);
52525
+ } = useToken$8();
52515
52526
  const fetchData = () => {
52516
52527
  const {
52517
52528
  dates = []
@@ -52647,12 +52658,11 @@ function UserGrowth({
52647
52658
  t,
52648
52659
  translationKeys
52649
52660
  });
52650
- console.log("usergrowthhhhh", data);
52651
52661
  React.useEffect(() => {
52652
52662
  if (typeof fetchUserGrowth === "function") {
52653
52663
  fetchUserGrowth(selectValue);
52654
52664
  }
52655
- }, [selectValue]);
52665
+ }, [selectValue, fetchUserGrowth]);
52656
52666
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
52657
52667
  title: t(`admin::user-growth`),
52658
52668
  loading: loading,
@@ -52686,7 +52696,7 @@ function UserGrowth({
52686
52696
  }
52687
52697
 
52688
52698
  const {
52689
- useToken: useToken$5
52699
+ useToken: useToken$7
52690
52700
  } = antd.theme;
52691
52701
  function useTopContributors({
52692
52702
  container,
@@ -52696,7 +52706,7 @@ function useTopContributors({
52696
52706
  const [mainGraph, setMainGraph] = React.useState(null);
52697
52707
  const {
52698
52708
  token
52699
- } = useToken$5();
52709
+ } = useToken$7();
52700
52710
  React.useEffect(() => {
52701
52711
  if (container.current) {
52702
52712
  if (mainGraph) {
@@ -52775,7 +52785,6 @@ function TopContributors({
52775
52785
  data,
52776
52786
  t
52777
52787
  });
52778
- console.log("topcontributorshhhh", data);
52779
52788
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
52780
52789
  title: t(`admin::top-contributors`),
52781
52790
  className: "with-border-header overflow-hidden h-w-btn-header",
@@ -52907,6 +52916,7 @@ function AdminTable({
52907
52916
  breadcrumbs,
52908
52917
  children
52909
52918
  }) {
52919
+ console.log(tabs, "tabs");
52910
52920
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
52911
52921
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
52912
52922
  className: "semibold form-input-output daf-create-view",
@@ -52920,7 +52930,7 @@ function AdminTable({
52920
52930
  className: "mt-6 ml-6 mr-6",
52921
52931
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
52922
52932
  className: "flex flex-row",
52923
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
52933
+ children: [tabs && tabs.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
52924
52934
  className: "mr-2",
52925
52935
  children: /*#__PURE__*/jsxRuntime.jsx(Tabs, {
52926
52936
  t: t,
@@ -53171,7 +53181,7 @@ const renderTypeTag = ({
53171
53181
  });
53172
53182
  };
53173
53183
 
53174
- const getColumns$7 = ({
53184
+ const getColumns$9 = ({
53175
53185
  t,
53176
53186
  show = "show",
53177
53187
  selectOptions,
@@ -53445,11 +53455,11 @@ const getColumns$7 = ({
53445
53455
  }];
53446
53456
  return cols.filter(c => c[show]);
53447
53457
  };
53448
- const checkboxConfig$b = {
53458
+ const checkboxConfig$d = {
53449
53459
  name: "Name",
53450
53460
  datastakeId: "ID"
53451
53461
  };
53452
- const selectFiltersConfig$b = {
53462
+ const selectFiltersConfig$d = {
53453
53463
  account: {
53454
53464
  type: "select",
53455
53465
  label: "Account",
@@ -53490,12 +53500,12 @@ const selectFiltersConfig$b = {
53490
53500
  getValue: option => option.value
53491
53501
  }
53492
53502
  };
53493
- const filtersConfig$b = {
53503
+ const filtersConfig$d = {
53494
53504
  name: "",
53495
53505
  datastakeId: ""
53496
53506
  };
53497
53507
  const view$2 = "admin-users";
53498
- const defaultUrlParams$4 = {
53508
+ const defaultUrlParams$5 = {
53499
53509
  activeTab: "active"
53500
53510
  };
53501
53511
  const defaultTableFilters$2 = {};
@@ -53542,6 +53552,7 @@ function useAdminTable({
53542
53552
  defaultPageSize: defaultPageSize || 20,
53543
53553
  getRedirectLink
53544
53554
  });
53555
+ console.log(filter, "filter.activeFilters");
53545
53556
  const activeTab = React.useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
53546
53557
  const canClearSearch = React.useMemo(() => {
53547
53558
  return !!filter.activeFilters.search;
@@ -53573,6 +53584,7 @@ function useAdminTable({
53573
53584
  const params = filterParams({
53574
53585
  activeFilters: filter.activeFilters
53575
53586
  });
53587
+ console.log(params, "params");
53576
53588
  const {
53577
53589
  data
53578
53590
  } = await getData({
@@ -53639,11 +53651,11 @@ function UserTable(_ref) {
53639
53651
  } = useAdminTable({
53640
53652
  goTo,
53641
53653
  location,
53642
- selectFiltersConfig: selectFiltersConfig$b,
53654
+ selectFiltersConfig: selectFiltersConfig$d,
53643
53655
  view: view$2,
53644
- defaultUrlParams: defaultUrlParams$4,
53656
+ defaultUrlParams: defaultUrlParams$5,
53645
53657
  module,
53646
- filtersConfig: filtersConfig$b,
53658
+ filtersConfig: filtersConfig$d,
53647
53659
  getRedirectLink,
53648
53660
  getData,
53649
53661
  defaultPageSize,
@@ -53656,7 +53668,7 @@ function UserTable(_ref) {
53656
53668
  role: config.userRoles.filter(c => !c.isForAppAdmin)
53657
53669
  };
53658
53670
  }, [config.userRoles, config.accountTypes, accounts]);
53659
- const columns = React.useMemo(() => getColumns$7({
53671
+ const columns = React.useMemo(() => getColumns$9({
53660
53672
  t,
53661
53673
  show: activeTab,
53662
53674
  selectOptions,
@@ -53712,7 +53724,7 @@ function UserTable(_ref) {
53712
53724
  hasError: hasError,
53713
53725
  setHasError: setHasError,
53714
53726
  canClearSearch: canClearSearch,
53715
- checkboxConfig: checkboxConfig$b,
53727
+ checkboxConfig: checkboxConfig$d,
53716
53728
  defaultTableFilters: defaultTableFilters$2,
53717
53729
  children: /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
53718
53730
  columns: columns,
@@ -53721,7 +53733,7 @@ function UserTable(_ref) {
53721
53733
  pagination: filter.pagination,
53722
53734
  selectOptions: selectOptions,
53723
53735
  setShowFilters: setShowFilters,
53724
- filtersConfig: selectFiltersConfig$b,
53736
+ filtersConfig: selectFiltersConfig$d,
53725
53737
  onFilterChange: filter.onFiltersChange,
53726
53738
  showFilters: showFilters,
53727
53739
  defaultFilters: filter.defaultFilters,
@@ -53752,7 +53764,7 @@ function UserTable(_ref) {
53752
53764
  });
53753
53765
  }
53754
53766
 
53755
- const getColumns$6 = ({
53767
+ const getColumns$8 = ({
53756
53768
  t,
53757
53769
  goTo,
53758
53770
  show = "show",
@@ -54018,11 +54030,7 @@ const getColumns$6 = ({
54018
54030
  })
54019
54031
  });
54020
54032
  }
54021
- const moreMenuItems = !val.emailVerified ? [{
54022
- label: t("admin::cancel-invitation"),
54023
- value: "cancel",
54024
- onClick: () => onCanelVerification(val)
54025
- }] : [{
54033
+ const moreMenuItems = [{
54026
54034
  label: t("Edit"),
54027
54035
  value: "edit",
54028
54036
  onClick: () => setAddAccountVisible(val)
@@ -54049,11 +54057,11 @@ const getColumns$6 = ({
54049
54057
  }];
54050
54058
  return cols.filter(c => c[show]);
54051
54059
  };
54052
- const checkboxConfig$a = {
54060
+ const checkboxConfig$c = {
54053
54061
  name: "Name",
54054
54062
  datastakeId: "ID"
54055
54063
  };
54056
- const selectFiltersConfig$a = {
54064
+ const selectFiltersConfig$c = {
54057
54065
  type: {
54058
54066
  type: "select",
54059
54067
  label: "Type",
@@ -54081,12 +54089,12 @@ const selectFiltersConfig$a = {
54081
54089
  getValue: option => option.value
54082
54090
  }
54083
54091
  };
54084
- const filtersConfig$a = {
54092
+ const filtersConfig$c = {
54085
54093
  name: "",
54086
54094
  datastakeId: ""
54087
54095
  };
54088
54096
  const view$1 = "accounts";
54089
- const defaultUrlParams$3 = {
54097
+ const defaultUrlParams$4 = {
54090
54098
  activeTab: "active"
54091
54099
  };
54092
54100
  const defaultTableFilters$1 = {};
@@ -54105,7 +54113,7 @@ const getTabs$2 = ({
54105
54113
  label: t("Suspended")
54106
54114
  }];
54107
54115
 
54108
- const getColumns$5 = ({
54116
+ const getColumns$7 = ({
54109
54117
  t,
54110
54118
  selectOptions,
54111
54119
  module
@@ -54212,7 +54220,7 @@ const Container = styled__default["default"].div`
54212
54220
  `;
54213
54221
 
54214
54222
  const {
54215
- useToken: useToken$4
54223
+ useToken: useToken$6
54216
54224
  } = antd.theme;
54217
54225
  function CombineAccountModal({
54218
54226
  isOpen,
@@ -54225,10 +54233,10 @@ function CombineAccountModal({
54225
54233
  }) {
54226
54234
  const {
54227
54235
  token
54228
- } = useToken$4();
54236
+ } = useToken$6();
54229
54237
  const [MainForm] = antd.Form.useForm();
54230
54238
  const columns = React.useMemo(() => {
54231
- return getColumns$5({
54239
+ return getColumns$7({
54232
54240
  t,
54233
54241
  selectOptions,
54234
54242
  module
@@ -54363,37 +54371,60 @@ function NewAccount({
54363
54371
  t,
54364
54372
  isOpen,
54365
54373
  onClose,
54366
- accountTypes = [],
54374
+ accountTypes,
54367
54375
  fetchData,
54368
- inviteAccount
54376
+ updateAccount,
54377
+ inviteAccount,
54378
+ isPending = false,
54379
+ accountToEdit
54369
54380
  }) {
54370
54381
  const [MainForm] = antd.Form.useForm();
54371
54382
  const [loading, setLoading] = React.useState(false);
54372
54383
  const [accountUsed, setAccountUsed] = React.useState(false);
54373
- const isEdit = React.useMemo(() => isOpen && typeof isOpen === "object", [isOpen]);
54384
+ console.log("typesssssssss", accountToEdit);
54385
+ const isEdit = React.useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
54374
54386
  React.useEffect(() => {
54375
- if (isOpen && typeof isOpen === "object") {
54387
+ if (accountToEdit && typeof accountToEdit === "object") {
54376
54388
  MainForm.setFieldsValue({
54377
- name: isOpen.name,
54378
- email: isOpen?.admin?.email
54389
+ name: accountToEdit.name,
54390
+ email: accountToEdit.email,
54391
+ type: accountToEdit?.otherData?.interface
54379
54392
  });
54380
54393
  } else {
54381
54394
  MainForm.resetFields();
54382
54395
  }
54383
- }, [isOpen, MainForm]);
54384
- const onSubmit = () => {
54385
- MainForm.validateFields().then(async val => {
54386
- try {
54387
- setLoading(true);
54396
+ }, [accountToEdit, MainForm]);
54397
+ const onSubmit = async () => {
54398
+ try {
54399
+ const val = await MainForm.validateFields();
54400
+ console.log(val, "val");
54401
+ setLoading(true);
54402
+ if (isEdit && accountToEdit?.id) {
54403
+ // Update existing account
54404
+ await updateAccount({
54405
+ id: accountToEdit.id,
54406
+ data: val,
54407
+ isPending: accountToEdit.status === 'pending' || isPending
54408
+ });
54409
+ } else {
54410
+ // Create new account
54411
+ if (!inviteAccount) {
54412
+ throw new Error("inviteAccount function is required for creating new accounts");
54413
+ }
54388
54414
  await inviteAccount(val);
54389
- setLoading(false);
54390
- fetchData();
54391
- onClose();
54392
- } catch (err) {
54393
- console.log(err);
54394
- setLoading(false);
54395
54415
  }
54396
- }).catch(() => {});
54416
+ setLoading(false);
54417
+ fetchData();
54418
+ onClose();
54419
+ MainForm.resetFields();
54420
+ } catch (err) {
54421
+ console.log(err);
54422
+ setLoading(false);
54423
+ if (err.errorFields) {
54424
+ // Validation errors, don't show error message
54425
+ return;
54426
+ }
54427
+ }
54397
54428
  };
54398
54429
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
54399
54430
  t: t,
@@ -54415,16 +54446,6 @@ function NewAccount({
54415
54446
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
54416
54447
  placeholder: t("Type")
54417
54448
  })
54418
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54419
- name: "type",
54420
- label: t("Type"),
54421
- rules: [{
54422
- required: true
54423
- }],
54424
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
54425
- placeholder: t("Select"),
54426
- options: accountTypes
54427
- })
54428
54449
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54429
54450
  name: "email",
54430
54451
  label: t("Email"),
@@ -54433,12 +54454,17 @@ function NewAccount({
54433
54454
  type: "email"
54434
54455
  }],
54435
54456
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
54436
- placeholder: t("Type"),
54437
- onChange: () => {
54438
- if (accountUsed) {
54439
- setAccountUsed(false);
54440
- }
54441
- }
54457
+ placeholder: t("Type")
54458
+ })
54459
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54460
+ name: "type",
54461
+ label: t("Type"),
54462
+ rules: [{
54463
+ required: true
54464
+ }],
54465
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
54466
+ placeholder: t("Select"),
54467
+ options: accountTypes || []
54442
54468
  })
54443
54469
  }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
54444
54470
  message: t("FB00001"),
@@ -54467,6 +54493,7 @@ function AccountTable(_ref) {
54467
54493
  actionButton,
54468
54494
  inviteAccount
54469
54495
  } = _ref;
54496
+ const accountTypes = config === null || config === void 0 ? void 0 : config.accountTypes;
54470
54497
  const [showFilters, setShowFilters] = React.useState(false);
54471
54498
  const [hasError, setHasError] = React.useState(false);
54472
54499
  const [selectedAccounts, setSelectedAccounts] = React.useState([]);
@@ -54484,12 +54511,12 @@ function AccountTable(_ref) {
54484
54511
  } = useAdminTable({
54485
54512
  goTo,
54486
54513
  location,
54487
- selectFiltersConfig: selectFiltersConfig$a,
54514
+ selectFiltersConfig: selectFiltersConfig$c,
54488
54515
  view: view$1,
54489
- defaultUrlParams: defaultUrlParams$3,
54516
+ defaultUrlParams: defaultUrlParams$4,
54490
54517
  module,
54491
54518
  defaultPageSize,
54492
- filtersConfig: filtersConfig$a,
54519
+ filtersConfig: filtersConfig$c,
54493
54520
  getRedirectLink,
54494
54521
  getData,
54495
54522
  fetchPendingOnMount: true
@@ -54498,9 +54525,9 @@ function AccountTable(_ref) {
54498
54525
  var _config$options;
54499
54526
  return {
54500
54527
  country: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.countries,
54501
- type: config.accountTypes
54528
+ type: accountTypes
54502
54529
  };
54503
- }, [config.options, config.accountTypes]);
54530
+ }, [config.options, accountTypes]);
54504
54531
  React.useEffect(() => {
54505
54532
  if (initFetchDone) {
54506
54533
  filter.setActiveFilters(_objectSpread2(_objectSpread2({}, filter.activeFilters), {}, {
@@ -54532,7 +54559,16 @@ function AccountTable(_ref) {
54532
54559
  onCancel: () => {}
54533
54560
  });
54534
54561
  }, [t, fetchData, fetchPendingAccounts]);
54535
- const columns = React.useMemo(() => getColumns$6({
54562
+ const onResendInvitation = React.useCallback(async user => {
54563
+ try {
54564
+ await config.onTableClick.onResendInvitation(user);
54565
+ antd.message.success(t("Email successfully sent"));
54566
+ } catch (error) {
54567
+ console.error("Failed to resend invitation:", error);
54568
+ antd.message.error(t("Failed to resend invitation"));
54569
+ }
54570
+ }, [t, config.onTableClick]);
54571
+ const columns = React.useMemo(() => getColumns$8({
54536
54572
  t,
54537
54573
  show: activeTab,
54538
54574
  selectOptions,
@@ -54541,7 +54577,7 @@ function AccountTable(_ref) {
54541
54577
  getRedirectLink,
54542
54578
  onCanelVerification: onCanelVerification,
54543
54579
  onCopyInvitation: config.onTableClick.onCopyInvitation,
54544
- onResendInvitation: config.onTableClick.onResendInvitation,
54580
+ onResendInvitation: onResendInvitation,
54545
54581
  setAddAccountVisible: config.onTableClick.setAddAccountVisible,
54546
54582
  setSelectedAccounts: setSelectedAccounts,
54547
54583
  selectedAccounts: selectedAccounts
@@ -54551,13 +54587,15 @@ function AccountTable(_ref) {
54551
54587
  filters: filter,
54552
54588
  t: t,
54553
54589
  headerTitle: headerTitle,
54554
- actionButton: [...actionButton, {
54555
- icon: "Merge",
54556
- // type: "primary",
54557
- onClick: () => setCombineAccountVisible(true),
54558
- tooltip: "Combine",
54559
- disabled: selectedAccounts.length < 2
54560
- }],
54590
+ actionButton: [...actionButton
54591
+ // {
54592
+ // icon: "Merge",
54593
+ // // type: "primary",
54594
+ // onClick: () => setCombineAccountVisible(true),
54595
+ // tooltip: "Combine",
54596
+ // disabled: selectedAccounts.length < 2,
54597
+ // },
54598
+ ],
54561
54599
  tabs: getTabs$2({
54562
54600
  totalPending: totalPending,
54563
54601
  t
@@ -54570,7 +54608,7 @@ function AccountTable(_ref) {
54570
54608
  setHasError: setHasError,
54571
54609
  canClearSearch: canClearSearch,
54572
54610
  selectOptions: selectOptions,
54573
- checkboxConfig: checkboxConfig$a,
54611
+ checkboxConfig: checkboxConfig$c,
54574
54612
  defaultTableFilters: defaultTableFilters$1,
54575
54613
  children: [selectedAccounts.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
54576
54614
  className: "flex flex-row ml-6 mt-5",
@@ -54601,7 +54639,7 @@ function AccountTable(_ref) {
54601
54639
  doEmptyRows: true,
54602
54640
  selectOptions: selectOptions,
54603
54641
  setShowFilters: setShowFilters,
54604
- filtersConfig: selectFiltersConfig$a,
54642
+ filtersConfig: selectFiltersConfig$c,
54605
54643
  onFilterChange: filter.onFiltersChange,
54606
54644
  showFilters: showFilters,
54607
54645
  defaultFilters: filter.defaultFilters,
@@ -54617,7 +54655,7 @@ function AccountTable(_ref) {
54617
54655
  fetchData();
54618
54656
  fetchPendingAccounts();
54619
54657
  },
54620
- accountTypes: config.accountTypes,
54658
+ accountTypes: accountTypes,
54621
54659
  inviteAccount: inviteAccount
54622
54660
  }), /*#__PURE__*/jsxRuntime.jsx(CombineAccountModal, {
54623
54661
  isOpen: combineAccountVisible,
@@ -54651,7 +54689,7 @@ const getTabs$1 = ({
54651
54689
  label: t("Suspended")
54652
54690
  }];
54653
54691
  };
54654
- const selectFiltersConfig$9 = {
54692
+ const selectFiltersConfig$b = {
54655
54693
  category: {
54656
54694
  type: "select",
54657
54695
  label: "Category",
@@ -54692,14 +54730,14 @@ const selectFiltersConfig$9 = {
54692
54730
  getValue: option => option.value
54693
54731
  }
54694
54732
  };
54695
- const filtersConfig$9 = {
54733
+ const filtersConfig$b = {
54696
54734
  name: "",
54697
54735
  datastakeId: ""
54698
54736
  };
54699
- const defaultUrlParams$2 = {
54737
+ const defaultUrlParams$3 = {
54700
54738
  activeTab: "active"
54701
54739
  };
54702
- const checkboxConfig$9 = {
54740
+ const checkboxConfig$b = {
54703
54741
  name: "Name",
54704
54742
  datastakeId: "ID"
54705
54743
  };
@@ -54709,7 +54747,7 @@ const getAdminLevelName = (data, level) => {
54709
54747
  return entry?.name || "-";
54710
54748
  };
54711
54749
 
54712
- const getColumns$4 = ({
54750
+ const getColumns$6 = ({
54713
54751
  t,
54714
54752
  goTo = () => {},
54715
54753
  show = "show",
@@ -54932,7 +54970,7 @@ const getColumns$4 = ({
54932
54970
  return cols.filter(c => c[show]);
54933
54971
  };
54934
54972
 
54935
- const getColumns$3 = ({
54973
+ const getColumns$5 = ({
54936
54974
  t,
54937
54975
  selectOptions,
54938
54976
  module,
@@ -55023,7 +55061,7 @@ const getColumns$3 = ({
55023
55061
  };
55024
55062
 
55025
55063
  const {
55026
- useToken: useToken$3
55064
+ useToken: useToken$5
55027
55065
  } = antd.theme;
55028
55066
  function CombineLocationModal({
55029
55067
  isOpen,
@@ -55037,11 +55075,11 @@ function CombineLocationModal({
55037
55075
  }) {
55038
55076
  const {
55039
55077
  token
55040
- } = useToken$3();
55078
+ } = useToken$5();
55041
55079
  const [MainForm] = antd.Form.useForm();
55042
55080
  const [isDisabled, setIsDisabled] = React.useState(true);
55043
55081
  const columns = React.useMemo(() => {
55044
- return getColumns$3({
55082
+ return getColumns$5({
55045
55083
  t,
55046
55084
  selectOptions,
55047
55085
  module,
@@ -55194,7 +55232,7 @@ function CombineLocationModal({
55194
55232
 
55195
55233
  const _excluded$2 = ["pagination", "tab", "filters", "search", "sort"];
55196
55234
  const {
55197
- useToken: useToken$2
55235
+ useToken: useToken$4
55198
55236
  } = antd.theme;
55199
55237
  function LocationTable(_ref) {
55200
55238
  let {
@@ -55220,7 +55258,7 @@ function LocationTable(_ref) {
55220
55258
  const [selectedLocations, setSelectedLocations] = React.useState([]);
55221
55259
  const {
55222
55260
  token
55223
- } = useToken$2();
55261
+ } = useToken$4();
55224
55262
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
55225
55263
  const getDataWithStringPagination = async _ref2 => {
55226
55264
  let {
@@ -55245,6 +55283,14 @@ function LocationTable(_ref) {
55245
55283
  console.error('Failed to parse pagination', e);
55246
55284
  }
55247
55285
  }
55286
+ const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
55287
+ let pageNumber = 1;
55288
+ if (paginationObj.page || paginationObj.current) {
55289
+ pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
55290
+ } else if (typeof paginationObj.skip === 'number') {
55291
+ pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
55292
+ }
55293
+ pageNumber = pageNumber || 1;
55248
55294
  let activeTab = tab || "active";
55249
55295
  if (!tab && filters) {
55250
55296
  try {
@@ -55256,8 +55302,8 @@ function LocationTable(_ref) {
55256
55302
  }
55257
55303
  const transformedParams = {
55258
55304
  pagination: {
55259
- skip: String(paginationObj.page || 1),
55260
- take: String(paginationObj.pageSize || 20)
55305
+ skip: pageNumber,
55306
+ take: pageSize
55261
55307
  },
55262
55308
  tab: activeTab
55263
55309
  };
@@ -55279,12 +55325,12 @@ function LocationTable(_ref) {
55279
55325
  } = useAdminTable({
55280
55326
  goTo,
55281
55327
  location,
55282
- selectFiltersConfig: selectFiltersConfig$9,
55328
+ selectFiltersConfig: selectFiltersConfig$b,
55283
55329
  view,
55284
- defaultUrlParams: defaultUrlParams$2,
55330
+ defaultUrlParams: defaultUrlParams$3,
55285
55331
  module,
55286
55332
  defaultPageSize,
55287
- filtersConfig: filtersConfig$9,
55333
+ filtersConfig: filtersConfig$b,
55288
55334
  getRedirectLink,
55289
55335
  getData: getDataWithStringPagination,
55290
55336
  refetchTrigger
@@ -55298,7 +55344,7 @@ function LocationTable(_ref) {
55298
55344
  };
55299
55345
  }, [config.options]);
55300
55346
  const columns = React.useMemo(() => {
55301
- return getColumns$4({
55347
+ return getColumns$6({
55302
55348
  t,
55303
55349
  goTo,
55304
55350
  token,
@@ -55334,7 +55380,7 @@ function LocationTable(_ref) {
55334
55380
  setHasError: setHasError,
55335
55381
  canClearSearch: canClearSearch,
55336
55382
  selectOptions: selectOptions,
55337
- checkboxConfig: checkboxConfig$9,
55383
+ checkboxConfig: checkboxConfig$b,
55338
55384
  defaultTableFilters: {},
55339
55385
  breadcrumbs: breadcrumbs,
55340
55386
  children: [selectedLocations.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -55366,7 +55412,7 @@ function LocationTable(_ref) {
55366
55412
  selectOptions: selectOptions,
55367
55413
  doEmptyRows: true,
55368
55414
  setShowFilters: setShowFilters,
55369
- filtersConfig: selectFiltersConfig$9,
55415
+ filtersConfig: selectFiltersConfig$b,
55370
55416
  onFilterChange: filter.onFiltersChange,
55371
55417
  showFilters: showFilters,
55372
55418
  defaultFilters: filter.defaultFilters,
@@ -55410,7 +55456,7 @@ const getTabs = ({
55410
55456
  label: t("Suspended")
55411
55457
  }];
55412
55458
  };
55413
- const selectFiltersConfig$8 = {
55459
+ const selectFiltersConfig$a = {
55414
55460
  category: {
55415
55461
  type: "select",
55416
55462
  label: "Category",
@@ -55451,19 +55497,19 @@ const selectFiltersConfig$8 = {
55451
55497
  getValue: option => option.value
55452
55498
  }
55453
55499
  };
55454
- const filtersConfig$8 = {
55500
+ const filtersConfig$a = {
55455
55501
  name: "",
55456
55502
  datastakeId: ""
55457
55503
  };
55458
- const defaultUrlParams$1 = {
55504
+ const defaultUrlParams$2 = {
55459
55505
  activeTab: "active"
55460
55506
  };
55461
- const checkboxConfig$8 = {
55507
+ const checkboxConfig$a = {
55462
55508
  name: "Name",
55463
55509
  datastakeId: "ID"
55464
55510
  };
55465
55511
 
55466
- const getColumns$2 = ({
55512
+ const getColumns$4 = ({
55467
55513
  t,
55468
55514
  goTo = () => {},
55469
55515
  show = "show",
@@ -55704,7 +55750,7 @@ const mapToSelectOptions = (items, valueKey, selectOptions, optionKey, customMap
55704
55750
  }).filter((option, index, self) => index === self.findIndex(o => o.value === option.value));
55705
55751
  };
55706
55752
 
55707
- const getColumns$1 = ({
55753
+ const getColumns$3 = ({
55708
55754
  t,
55709
55755
  selectOptions,
55710
55756
  module,
@@ -55795,7 +55841,7 @@ const getColumns$1 = ({
55795
55841
  };
55796
55842
 
55797
55843
  const {
55798
- useToken: useToken$1
55844
+ useToken: useToken$3
55799
55845
  } = antd.theme;
55800
55846
  function CombineSubjectsModal({
55801
55847
  isOpen,
@@ -55809,11 +55855,11 @@ function CombineSubjectsModal({
55809
55855
  }) {
55810
55856
  const {
55811
55857
  token
55812
- } = useToken$1();
55858
+ } = useToken$3();
55813
55859
  const [MainForm] = antd.Form.useForm();
55814
55860
  const [isDisabled, setIsDisabled] = React.useState(true);
55815
55861
  const columns = React.useMemo(() => {
55816
- return getColumns$1({
55862
+ return getColumns$3({
55817
55863
  t,
55818
55864
  selectOptions,
55819
55865
  module,
@@ -55824,6 +55870,8 @@ function CombineSubjectsModal({
55824
55870
  const onSubmit = () => {
55825
55871
  MainForm.validateFields().then(data => {
55826
55872
  const ids = selectedSubjects.map(subject => subject.id);
55873
+ console.log(ids, "ids");
55874
+ console.log(data, "data");
55827
55875
  onSuccess({
55828
55876
  ids,
55829
55877
  data
@@ -55886,7 +55934,10 @@ function CombineSubjectsModal({
55886
55934
  className: "flex-1",
55887
55935
  name: "id",
55888
55936
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
55889
- options: mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null),
55937
+ options: selectedSubjects.map(s => ({
55938
+ label: s?.datastakeId || "-",
55939
+ value: s?.id || "-"
55940
+ })),
55890
55941
  placeholder: t("ID")
55891
55942
  })
55892
55943
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
@@ -55949,7 +56000,7 @@ function CombineSubjectsModal({
55949
56000
 
55950
56001
  const _excluded$1 = ["pagination", "tab", "filters", "search", "sort"];
55951
56002
  const {
55952
- useToken
56003
+ useToken: useToken$2
55953
56004
  } = antd.theme;
55954
56005
  function SubjectsTable(_ref) {
55955
56006
  let {
@@ -55975,7 +56026,7 @@ function SubjectsTable(_ref) {
55975
56026
  const [selectedSubjects, setSelectedSubjects] = React.useState([]);
55976
56027
  const {
55977
56028
  token
55978
- } = useToken();
56029
+ } = useToken$2();
55979
56030
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
55980
56031
  const getDataWithStringPagination = async _ref2 => {
55981
56032
  let {
@@ -56000,6 +56051,14 @@ function SubjectsTable(_ref) {
56000
56051
  console.error('Failed to parse pagination', e);
56001
56052
  }
56002
56053
  }
56054
+ const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
56055
+ let pageNumber = 1;
56056
+ if (paginationObj.page || paginationObj.current) {
56057
+ pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
56058
+ } else if (typeof paginationObj.skip === 'number') {
56059
+ pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
56060
+ }
56061
+ pageNumber = pageNumber || 1;
56003
56062
  let activeTab = tab || "active";
56004
56063
  if (!tab && filters) {
56005
56064
  try {
@@ -56011,8 +56070,8 @@ function SubjectsTable(_ref) {
56011
56070
  }
56012
56071
  const transformedParams = {
56013
56072
  pagination: {
56014
- skip: String(paginationObj.page || 1),
56015
- take: String(paginationObj.pageSize || 20)
56073
+ skip: pageNumber,
56074
+ take: pageSize
56016
56075
  },
56017
56076
  tab: activeTab
56018
56077
  };
@@ -56034,12 +56093,12 @@ function SubjectsTable(_ref) {
56034
56093
  } = useAdminTable({
56035
56094
  goTo,
56036
56095
  location,
56037
- selectFiltersConfig: selectFiltersConfig$8,
56096
+ selectFiltersConfig: selectFiltersConfig$a,
56038
56097
  view,
56039
- defaultUrlParams: defaultUrlParams$1,
56098
+ defaultUrlParams: defaultUrlParams$2,
56040
56099
  module,
56041
56100
  defaultPageSize,
56042
- filtersConfig: filtersConfig$8,
56101
+ filtersConfig: filtersConfig$a,
56043
56102
  getRedirectLink,
56044
56103
  getData: getDataWithStringPagination,
56045
56104
  refetchTrigger
@@ -56053,7 +56112,7 @@ function SubjectsTable(_ref) {
56053
56112
  };
56054
56113
  }, [config.options]);
56055
56114
  const columns = React.useMemo(() => {
56056
- return getColumns$2({
56115
+ return getColumns$4({
56057
56116
  t,
56058
56117
  goTo,
56059
56118
  token,
@@ -56074,7 +56133,7 @@ function SubjectsTable(_ref) {
56074
56133
  actionButton: [{
56075
56134
  icon: "Merge",
56076
56135
  onClick: () => setIsModalOpen(true),
56077
- tooltip: t("admin::merge-subjects"),
56136
+ tooltip: t("merge-subjects"),
56078
56137
  disabled: selectedSubjects.length < 2
56079
56138
  }],
56080
56139
  tabs: getTabs({
@@ -56088,7 +56147,7 @@ function SubjectsTable(_ref) {
56088
56147
  setHasError: setHasError,
56089
56148
  canClearSearch: canClearSearch,
56090
56149
  selectOptions: selectOptions,
56091
- checkboxConfig: checkboxConfig$8,
56150
+ checkboxConfig: checkboxConfig$a,
56092
56151
  defaultTableFilters: {},
56093
56152
  breadcrumbs: breadcrumbs,
56094
56153
  children: [selectedSubjects.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -56120,7 +56179,7 @@ function SubjectsTable(_ref) {
56120
56179
  selectOptions: selectOptions,
56121
56180
  doEmptyRows: true,
56122
56181
  setShowFilters: setShowFilters,
56123
- filtersConfig: selectFiltersConfig$8,
56182
+ filtersConfig: selectFiltersConfig$a,
56124
56183
  onFilterChange: filter.onFiltersChange,
56125
56184
  showFilters: showFilters,
56126
56185
  defaultFilters: filter.defaultFilters,
@@ -56133,11 +56192,13 @@ function SubjectsTable(_ref) {
56133
56192
  onSuccess: data => {
56134
56193
  setIsModalOpen(false);
56135
56194
  setLoading(true);
56136
- antd.message.success(t("Subjects successfully merged."));
56137
56195
  if (typeof mergeSubjectsFunction === 'function') {
56138
- mergeSubjectsFunction(data).finally(() => {
56196
+ mergeSubjectsFunction(data).then(() => {
56197
+ setTimeout(() => {
56198
+ fetchData();
56199
+ }, 500);
56200
+ }).finally(() => {
56139
56201
  setSelectedSubjects([]);
56140
- fetchData();
56141
56202
  });
56142
56203
  }
56143
56204
  },
@@ -56254,7 +56315,7 @@ function TransferRights({
56254
56315
  };
56255
56316
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
56256
56317
  t: t,
56257
- title: t("admin::transfer-admin-rights"),
56318
+ title: t("admin::transfer-account-admin-rights"),
56258
56319
  open: isOpen,
56259
56320
  onClose: onClose,
56260
56321
  loading: loading,
@@ -56304,11 +56365,16 @@ function NewUser({
56304
56365
  module = "straatos",
56305
56366
  inviteCompanyAccount = () => {},
56306
56367
  companyId,
56307
- handleError = () => {}
56368
+ handleError = () => {},
56369
+ existingEmails = []
56308
56370
  }) {
56309
56371
  const [MainForm] = antd.Form.useForm();
56310
56372
  const [accountUsed, setAccountUsed] = React.useState(false);
56311
56373
  const [loading, setLoading] = React.useState(false);
56374
+ const checkEmailExists = email => {
56375
+ if (!email) return false;
56376
+ return existingEmails.includes(email.toLowerCase());
56377
+ };
56312
56378
  React.useEffect(() => {
56313
56379
  if (defaultData) {
56314
56380
  MainForm.setFieldsValue({
@@ -56320,6 +56386,10 @@ function NewUser({
56320
56386
  const onSubmit = async () => {
56321
56387
  try {
56322
56388
  const val = await MainForm.validateFields();
56389
+ if (checkEmailExists(val.email)) {
56390
+ setAccountUsed(true);
56391
+ return;
56392
+ }
56323
56393
  setLoading(true);
56324
56394
  const apiPayload = {
56325
56395
  firstName: val.firstName,
@@ -56336,7 +56406,8 @@ function NewUser({
56336
56406
  });
56337
56407
  const localUserData = {
56338
56408
  ...apiPayload,
56339
- status: 'pending'
56409
+ status: 'pending',
56410
+ id: apiPayload.email // Add a unique ID for the table key
56340
56411
  // apps: {
56341
56412
  // [module]: {
56342
56413
  // role: val.role,
@@ -56394,12 +56465,22 @@ function NewUser({
56394
56465
  }],
56395
56466
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
56396
56467
  placeholder: t("Type"),
56397
- onChange: () => {
56398
- if (accountUsed) {
56399
- setAccountUsed(false);
56400
- }
56468
+ onChange: e => {
56469
+ const emailExists = checkEmailExists(e.target.value);
56470
+ setAccountUsed(emailExists);
56471
+ },
56472
+ onBlur: e => {
56473
+ const emailExists = checkEmailExists(e.target.value);
56474
+ setAccountUsed(emailExists);
56401
56475
  }
56402
56476
  })
56477
+ }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
56478
+ message: t("This email corresponds to another account."),
56479
+ type: "error",
56480
+ className: "mb-2",
56481
+ showIcon: true,
56482
+ closable: true,
56483
+ onClose: () => setAccountUsed(false)
56403
56484
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56404
56485
  name: "role",
56405
56486
  label: t("Role"),
@@ -56419,34 +56500,31 @@ const renderStatus = ({
56419
56500
  val,
56420
56501
  t = s => s
56421
56502
  }) => {
56422
- // switch (val) {
56423
- // case "active":
56424
- // return <Tag color="green">{t("Active")}</Tag>;
56425
- // case "unsaved":
56426
- // return <Tag color="red">{t("Unsaved")}</Tag>;
56427
- // case "inactive":
56428
- // case "suspended":
56429
- // return <Tag color="red">{t("Suspended")}</Tag>;
56430
- // case "pending":
56431
- // return <Tag color="orange">{t("Pending")}</Tag>;
56432
- // default:
56433
- // return <Tag color="default">{t("Unknown")}</Tag>;
56434
- // }
56435
-
56436
- if (val) {
56503
+ if (val === 'pending') {
56437
56504
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56438
- color: "green",
56439
- children: t("Active")
56505
+ color: "orange",
56506
+ children: t("Pending")
56440
56507
  });
56441
- } else {
56508
+ }
56509
+ if (val === 'unsaved') {
56442
56510
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56443
56511
  color: "red",
56444
- children: t("Suspended")
56512
+ children: t("Unsaved")
56513
+ });
56514
+ }
56515
+ if (val === 'active' || val === true) {
56516
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56517
+ color: "green",
56518
+ children: t("Active")
56445
56519
  });
56446
56520
  }
56521
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56522
+ color: "red",
56523
+ children: t("Suspended")
56524
+ });
56447
56525
  };
56448
56526
 
56449
- const getColumns = ({
56527
+ const getColumns$2 = ({
56450
56528
  t,
56451
56529
  isView,
56452
56530
  selectOptions = {},
@@ -56618,8 +56696,8 @@ const getColumns = ({
56618
56696
  }];
56619
56697
  return cols.filter(v => v.show);
56620
56698
  };
56621
- const checkboxConfig$7 = {};
56622
- const selectFiltersConfig$7 = {
56699
+ const checkboxConfig$9 = {};
56700
+ const selectFiltersConfig$9 = {
56623
56701
  userRole: {
56624
56702
  type: "select",
56625
56703
  label: "Role",
@@ -56647,10 +56725,10 @@ const selectFiltersConfig$7 = {
56647
56725
  getValue: option => option.value
56648
56726
  }
56649
56727
  };
56650
- const filtersConfig$7 = {
56728
+ const filtersConfig$9 = {
56651
56729
  search: ""
56652
56730
  };
56653
- const defaultUrlParams = {
56731
+ const defaultUrlParams$1 = {
56654
56732
  search: "",
56655
56733
  userRole: null,
56656
56734
  status: null
@@ -56695,10 +56773,10 @@ function Users({
56695
56773
  } = useFilters({
56696
56774
  goTo,
56697
56775
  location,
56698
- selectFiltersConfig: selectFiltersConfig$7,
56699
- defaultUrlParams,
56776
+ selectFiltersConfig: selectFiltersConfig$9,
56777
+ defaultUrlParams: defaultUrlParams$1,
56700
56778
  module,
56701
- filtersConfig: filtersConfig$7,
56779
+ filtersConfig: filtersConfig$9,
56702
56780
  getRedirectLink
56703
56781
  });
56704
56782
  const selectOptions = React.useMemo(() => {
@@ -56712,9 +56790,14 @@ function Users({
56712
56790
  }, [activeFilters]);
56713
56791
  const onDeleteUserClick = React.useCallback(id => {
56714
56792
  antd.Modal.confirm({
56715
- title: t("sbg-admin::remove-user-title"),
56793
+ title: t("Are-you-sure-you-want-to-remove-the-user-from-this-account?"),
56716
56794
  icon: /*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleOutlined, {}),
56717
- content: t("sbg-admin::remove-user-body"),
56795
+ content: /*#__PURE__*/jsxRuntime.jsx("span", {
56796
+ style: {
56797
+ color: "#888"
56798
+ },
56799
+ children: t("The-user-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.")
56800
+ }),
56718
56801
  okText: t("Yes"),
56719
56802
  cancelText: t("No"),
56720
56803
  onOk: () => {
@@ -56725,9 +56808,14 @@ function Users({
56725
56808
  }, [deleteUser]);
56726
56809
  const data = React.useMemo(() => {
56727
56810
  const {
56728
- users = []
56811
+ users = [],
56812
+ pendingUsers = []
56729
56813
  } = accountData;
56730
- let filtered = [...users];
56814
+ let filtered = [...users, ...pendingUsers.map(u => ({
56815
+ ...u,
56816
+ status: 'pending',
56817
+ id: u.invitationToken || u.email // ensure pending users have an ID
56818
+ }))];
56731
56819
  if (!isEmptyOrSpaces(activeFilters.search)) {
56732
56820
  const search = activeFilters.search.toLowerCase();
56733
56821
  filtered = filtered.filter(u => `${u.firstName} ${u.lastName}`.toLowerCase().indexOf(search) !== -1 || u.email.toLowerCase().indexOf(search) !== -1);
@@ -56743,7 +56831,7 @@ function Users({
56743
56831
  isAdmin: accountData?.admin?.id === user?.id
56744
56832
  }));
56745
56833
  }, [accountData, activeFilters]);
56746
- const columns = React.useMemo(() => getColumns({
56834
+ const columns = React.useMemo(() => getColumns$2({
56747
56835
  t,
56748
56836
  isView,
56749
56837
  selectOptions,
@@ -56763,7 +56851,7 @@ function Users({
56763
56851
  hasError: hasError,
56764
56852
  setHasError: setHasError,
56765
56853
  filtersConfig: newFiltersConfig,
56766
- checkboxConfig: checkboxConfig$7,
56854
+ checkboxConfig: checkboxConfig$9,
56767
56855
  onSearch: onSearch,
56768
56856
  activeFilters: activeFilters,
56769
56857
  canClear: canClearSearch,
@@ -56783,7 +56871,7 @@ function Users({
56783
56871
  selectOptions: selectOptions,
56784
56872
  setShowFilters: setShowFilters,
56785
56873
  sourcesKey: "authorId",
56786
- filtersConfig: selectFiltersConfig$7,
56874
+ filtersConfig: selectFiltersConfig$9,
56787
56875
  onFilterChange: onFiltersChange,
56788
56876
  showFilters: showFilters,
56789
56877
  defaultFilters: defaultFilters,
@@ -56805,7 +56893,8 @@ function Users({
56805
56893
  module: module,
56806
56894
  inviteCompanyAccount: inviteCompanyAccount,
56807
56895
  companyId: companyId,
56808
- handleError: handleError
56896
+ handleError: handleError,
56897
+ existingEmails: [...(accountData?.users || []).map(u => u.email?.toLowerCase()), ...(accountData?.pendingUsers || []).map(u => u.email?.toLowerCase())].filter(Boolean)
56809
56898
  })]
56810
56899
  });
56811
56900
  }
@@ -56833,6 +56922,20 @@ class AdminService extends BaseService {
56833
56922
  data
56834
56923
  });
56835
56924
  }
56925
+ resendInvitation({
56926
+ invitationToken
56927
+ }) {
56928
+ return this.apiPost({
56929
+ url: `/accounts/resendInvitation/${invitationToken}`
56930
+ });
56931
+ }
56932
+ copyInvitation({
56933
+ invitationToken
56934
+ }) {
56935
+ return this.apiPost({
56936
+ url: `/accounts/copyInvitation/${invitationToken}`
56937
+ });
56938
+ }
56836
56939
  inviteAccount(data) {
56837
56940
  return this.apiPost({
56838
56941
  url: `/accounts/inviteAccount`,
@@ -56849,8 +56952,15 @@ class AdminService extends BaseService {
56849
56952
  }
56850
56953
  updateAccount({
56851
56954
  data,
56852
- id
56955
+ id,
56956
+ isPending = false
56853
56957
  }) {
56958
+ if (isPending) {
56959
+ return this.apiPut({
56960
+ data,
56961
+ url: `/accounts/invitation/${id}`
56962
+ });
56963
+ }
56854
56964
  return this.apiPut({
56855
56965
  data,
56856
56966
  url: `/accounts/${id}`
@@ -56965,6 +57075,21 @@ class AdminService extends BaseService {
56965
57075
  url: `/management/subject/${subject}/${id}`
56966
57076
  });
56967
57077
  }
57078
+ getItems({
57079
+ item
57080
+ }) {
57081
+ return this.apiGet({
57082
+ url: `/management/items/${item}`
57083
+ });
57084
+ }
57085
+ getItemData({
57086
+ item,
57087
+ id
57088
+ }) {
57089
+ return this.apiGet({
57090
+ url: `/management/item/${item}/${id}`
57091
+ });
57092
+ }
56968
57093
  viewLocation({
56969
57094
  id
56970
57095
  }) {
@@ -56987,7 +57112,7 @@ class AdminService extends BaseService {
56987
57112
  const type = subject === 'location' ? 'location' : 'stakeholder';
56988
57113
  return this.apiPut({
56989
57114
  url: `/management/subject/${type}/${id}`,
56990
- data: filterCreateData(data)
57115
+ data: data
56991
57116
  });
56992
57117
  }
56993
57118
  deleteSubject({
@@ -56999,14 +57124,25 @@ class AdminService extends BaseService {
56999
57124
  url: `/management/subject/${type}/${id}`
57000
57125
  });
57001
57126
  }
57002
- getUserGrowth(activeFilter) {
57003
- return this.apiGet({
57127
+ async getUserGrowth(activeFilter) {
57128
+ const {
57129
+ data
57130
+ } = await this.apiGet({
57004
57131
  url: `/accounts/dashboard/user-growth`,
57005
57132
  isUserManager: true,
57006
57133
  params: {
57007
57134
  activeFilter
57008
57135
  }
57009
57136
  });
57137
+ return data;
57138
+ }
57139
+ removeUserFromAccount({
57140
+ accountId,
57141
+ userId
57142
+ }) {
57143
+ return this.apiPut({
57144
+ url: `/companies/${accountId}/remove-user/${userId}`
57145
+ });
57010
57146
  }
57011
57147
  }
57012
57148
  var AdminService$1 = createLazyService(AdminService);
@@ -57223,11 +57359,18 @@ function Edit({
57223
57359
  removeCheck();
57224
57360
  }
57225
57361
  }, [isChanged, addCheck, removeCheck]);
57226
- const deleteUser = React.useCallback(id => {
57227
- // TODO: add call
57228
- console.log("DELETE", id);
57229
- fetchData();
57230
- }, [fetchData]);
57362
+ const deleteUser = React.useCallback(async id => {
57363
+ try {
57364
+ await AdminService$1.removeUserFromAccount({
57365
+ accountId: data.id,
57366
+ userId: id
57367
+ });
57368
+ antd.message.success(t("User removed successfully"));
57369
+ fetchData();
57370
+ } catch (err) {
57371
+ handleError(err);
57372
+ }
57373
+ }, [fetchData, data.id, t, handleError]);
57231
57374
  const updateUser = React.useCallback((id, val) => {
57232
57375
  setIsChanged(true);
57233
57376
  setData(prev => ({
@@ -57255,9 +57398,14 @@ function Edit({
57255
57398
  }, []);
57256
57399
  const onSuspend = () => {
57257
57400
  antd.Modal.confirm({
57258
- title: t("sbg-admin::suspend-title"),
57401
+ title: t("Are-you-sure-you-want-to-suspend-this-account?"),
57259
57402
  icon: /*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleOutlined, {}),
57260
- content: t("sbg-admin::suspend-content"),
57403
+ content: /*#__PURE__*/jsxRuntime.jsx("span", {
57404
+ style: {
57405
+ color: "#888"
57406
+ },
57407
+ children: t("Associated-users-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.")
57408
+ }),
57261
57409
  okText: t("Yes"),
57262
57410
  cancelText: t("No"),
57263
57411
  onOk: async () => {
@@ -57573,13 +57721,15 @@ function AdminView(_ref) {
57573
57721
  } = user,
57574
57722
  userDataToInvite = _objectWithoutProperties(user, _excluded2);
57575
57723
  console.log('Sending invitation for:', user.email, userDataToInvite);
57576
- await inviteCompanyAccount({
57577
- companyId: editData.id,
57578
- data: _objectSpread2(_objectSpread2({}, userDataToInvite), {}, {
57579
- pendingCompanyId
57580
- })
57581
- });
57582
- console.log('Invitation sent successfully for:', user.email);
57724
+ // Use the standalone invite function, don't mix it with updateAccount
57725
+ // await inviteCompanyAccount({
57726
+ // companyId: editData.id,
57727
+ // data: {
57728
+ // ...userDataToInvite,
57729
+ // pendingCompanyId,
57730
+ // },
57731
+ // });
57732
+ // console.log('Invitation sent successfully for:', user.email);
57583
57733
  } catch (inviteError) {
57584
57734
  console.error('Failed to invite user:', user.email, inviteError);
57585
57735
  handleError(inviteError);
@@ -57688,8 +57838,7 @@ function AdminDashboardScreen({
57688
57838
  }), [data?.keyIndicators, data?.keyInformation, getRedirectLink, getKeyIndicatorsConfig]);
57689
57839
  const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
57690
57840
  const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
57691
- const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
57692
- console.log("safeUserGrowth", safeUserGrowth);
57841
+ const safeUserGrowth = userGrowthData || data?.userGrowthData || [];
57693
57842
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
57694
57843
  t: t,
57695
57844
  goTo: goTo,
@@ -57698,6 +57847,7 @@ function AdminDashboardScreen({
57698
57847
  loadingUserGrowth: userGrowthDataLoading,
57699
57848
  fetchUserGrowth: fetchUserGrowth,
57700
57849
  adminTranslationIdentifier: appName,
57850
+ userGrowthData: safeUserGrowth,
57701
57851
  data: {
57702
57852
  keyIndicatorsData: keyIndicatorsConfig,
57703
57853
  userActivityData: safeUserActivity,
@@ -57797,6 +57947,77 @@ function AdminUsersScreen({
57797
57947
  });
57798
57948
  }
57799
57949
 
57950
+ /**
57951
+ * Copies text content from an element to the clipboard.
57952
+ *
57953
+ * This function takes an element ID, selects the text content from that element,
57954
+ * and copies it to the clipboard. It handles browser compatibility issues
57955
+ * between IE and modern browsers.
57956
+ *
57957
+ * @param {string} id - The ID of the HTML element containing text to copy
57958
+ * @returns {boolean} - Returns true if copying succeeded, false otherwise
57959
+ *
57960
+ * @example
57961
+ * // HTML: <input id="myText" value="Text to copy" />
57962
+ * copyToClipboard('myText'); // Copies "Text to copy" to clipboard
57963
+ */
57964
+
57965
+ /**
57966
+ * Copies a string directly to the clipboard.
57967
+ *
57968
+ * This function takes a string and copies it to the clipboard.
57969
+ * It handles browser compatibility issues between IE and modern browsers.
57970
+ *
57971
+ * @param {string} text - The string to copy to clipboard
57972
+ * @returns {Promise<boolean>} - Returns true if copying succeeded, false otherwise
57973
+ *
57974
+ * @example
57975
+ * copyStringToClipboard('Text to copy'); // Copies "Text to copy" to clipboard
57976
+ */
57977
+ const copyStringToClipboard = async text => {
57978
+ if (!text) {
57979
+ console.warn("No text provided to copy");
57980
+ return false;
57981
+ }
57982
+
57983
+ // Try modern Clipboard API first
57984
+ if (navigator.clipboard && navigator.clipboard.writeText) {
57985
+ try {
57986
+ await navigator.clipboard.writeText(text);
57987
+ return true;
57988
+ } catch (ex) {
57989
+ console.warn("Clipboard API failed, trying fallback:", ex);
57990
+ // Fall through to fallback methods
57991
+ }
57992
+ }
57993
+
57994
+ // Fallback for older browsers or when Clipboard API fails
57995
+ if (window.clipboardData && window.clipboardData.setData) {
57996
+ // IE: prevent textarea being shown while dialog is visible
57997
+ return window.clipboardData.setData("Text", text);
57998
+ } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
57999
+ var textarea = document.createElement("textarea");
58000
+ textarea.textContent = text;
58001
+ // Prevent scrolling to bottom of page in MS Edge
58002
+ textarea.style.position = "fixed";
58003
+ textarea.style.opacity = "0";
58004
+ textarea.style.left = "-9999px";
58005
+ document.body.appendChild(textarea);
58006
+ textarea.select();
58007
+ try {
58008
+ // Security exception may be thrown by some browsers
58009
+ const success = document.execCommand("copy");
58010
+ return success;
58011
+ } catch (ex) {
58012
+ console.warn("Copy to clipboard failed.", ex);
58013
+ return false;
58014
+ } finally {
58015
+ document.body.removeChild(textarea);
58016
+ }
58017
+ }
58018
+ return false;
58019
+ };
58020
+
57800
58021
  function AdminAccountsScreen({
57801
58022
  config
57802
58023
  }) {
@@ -57812,31 +58033,50 @@ function AdminAccountsScreen({
57812
58033
  AdminService,
57813
58034
  options,
57814
58035
  useQuery,
57815
- NewAccountModal
58036
+ NewAccountModal,
58037
+ appUrl
57816
58038
  } = config;
58039
+ console.log(accountTypes, "accountTypes");
58040
+ // const userTypes = useMemo(() => accountTypes.map((c) => ({
58041
+ // label: c.label,
58042
+ // value: c.value,
58043
+ // })), [accountTypes]);
58044
+
57817
58045
  const AccountModal = NewAccountModal || NewAccount;
57818
58046
  const query = useQuery ? useQuery() : {
57819
58047
  get: () => null
57820
58048
  };
57821
58049
  const [addAccountVisible, setAddAccountVisible] = React.useState(!!query.get("create"));
57822
- const onResendInvitation = React.useCallback(() => {
57823
- antd.message.success(t("Invitation email resent"));
57824
- }, [t]);
57825
- const onCopyInvitation = React.useCallback(() => {
57826
- antd.message.success(t("Invitation link copied"));
57827
- }, [t]);
58050
+ const [accountToEdit, setAccountToEdit] = React.useState(null);
57828
58051
  const actionButtons = React.useMemo(() => [{
57829
58052
  type: "primary",
57830
58053
  onClick: () => setAddAccountVisible(true),
57831
58054
  tooltip: t("Add"),
57832
58055
  icon: "Add"
57833
58056
  }], [t]);
58057
+ function handleAccountModal(data) {
58058
+ console.log(data, "data");
58059
+ setAddAccountVisible(true);
58060
+ setAccountToEdit(data);
58061
+ }
57834
58062
  function handleGetData(params) {
57835
58063
  return AdminService.getAccounts(params);
57836
58064
  }
57837
58065
  function handleCancelVerification(token) {
57838
58066
  return AdminService.cancelInvitation(token);
57839
58067
  }
58068
+ function handleResendInvitation(account) {
58069
+ console.log("account", account);
58070
+ const token = account.invitationToken || account.users?.[0]?.invitationToken || account.admin?.invitationToken;
58071
+ return AdminService.resendInvitation({
58072
+ invitationToken: token
58073
+ });
58074
+ }
58075
+ function handleCopyInvitation(account) {
58076
+ const link = `${appUrl}/register?code=${account.invitationToken}`;
58077
+ copyStringToClipboard(link);
58078
+ antd.message.success(t("Invitation link copied"));
58079
+ }
57840
58080
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
57841
58081
  children: [/*#__PURE__*/jsxRuntime.jsx(AccountTable, {
57842
58082
  t: t,
@@ -57850,23 +58090,38 @@ function AdminAccountsScreen({
57850
58090
  getData: handleGetData,
57851
58091
  config: {
57852
58092
  accountTypes,
58093
+ addAccountVisible,
57853
58094
  options: {
57854
58095
  countries: options?.countries
57855
58096
  },
57856
58097
  onTableClick: {
57857
58098
  onCanelVerification: handleCancelVerification,
57858
- onCopyInvitation,
57859
- onResendInvitation,
57860
- setAddAccountVisible
58099
+ onCopyInvitation: handleCopyInvitation,
58100
+ onResendInvitation: handleResendInvitation,
58101
+ setAddAccountVisible: handleAccountModal
57861
58102
  }
57862
58103
  }
57863
58104
  }), /*#__PURE__*/jsxRuntime.jsx(AccountModal, {
57864
58105
  t: t,
57865
58106
  isOpen: addAccountVisible,
57866
- onClose: () => setAddAccountVisible(false),
58107
+ onClose: () => {
58108
+ setAddAccountVisible(false);
58109
+ setAccountToEdit(null);
58110
+ },
57867
58111
  accountTypes: accountTypes,
58112
+ countriesOptions: options?.countries,
57868
58113
  fetchData: () => {},
57869
- inviteAccount: data => AdminService.inviteAccount(data)
58114
+ inviteAccount: data => AdminService.inviteAccount(data),
58115
+ updateAccount: ({
58116
+ data,
58117
+ id,
58118
+ isPending
58119
+ }) => AdminService.updateAccount({
58120
+ data,
58121
+ id,
58122
+ isPending
58123
+ }),
58124
+ accountToEdit: accountToEdit
57870
58125
  })]
57871
58126
  });
57872
58127
  }
@@ -57990,7 +58245,7 @@ function AdminSubjectsScreen({
57990
58245
  });
57991
58246
  }
57992
58247
 
57993
- function AdminLocationScreen({
58248
+ function AdminLocationScreen$1({
57994
58249
  config
57995
58250
  }) {
57996
58251
  const {
@@ -58062,6 +58317,855 @@ function AdminLocationScreen({
58062
58317
  });
58063
58318
  }
58064
58319
 
58320
+ const selectFiltersConfig$8 = {
58321
+ category: {
58322
+ type: "select",
58323
+ label: "Category",
58324
+ placeholder: t => t("Category"),
58325
+ style: {
58326
+ flex: 1
58327
+ },
58328
+ labelStyle: {
58329
+ flex: 1
58330
+ },
58331
+ getLabel: option => option.label,
58332
+ getValue: option => option.value
58333
+ },
58334
+ country: {
58335
+ type: "select",
58336
+ label: "Country",
58337
+ placeholder: t => t("Country"),
58338
+ style: {
58339
+ flex: 1
58340
+ },
58341
+ labelStyle: {
58342
+ flex: 1
58343
+ },
58344
+ getLabel: option => option.label,
58345
+ getValue: option => option.value
58346
+ },
58347
+ sources: {
58348
+ type: "select",
58349
+ label: "Sources",
58350
+ placeholder: t => t("Sources"),
58351
+ style: {
58352
+ flex: 1
58353
+ },
58354
+ labelStyle: {
58355
+ flex: 1
58356
+ },
58357
+ getLabel: option => option.label,
58358
+ getValue: option => option.value
58359
+ }
58360
+ };
58361
+ const filtersConfig$8 = {
58362
+ name: "",
58363
+ datastakeId: ""
58364
+ };
58365
+ const checkboxConfig$8 = {
58366
+ name: "Name",
58367
+ datastakeId: "ID"
58368
+ };
58369
+
58370
+ const getColumns$1 = ({
58371
+ t,
58372
+ goTo = () => {},
58373
+ show = "show",
58374
+ getRedirectLink = () => {},
58375
+ token,
58376
+ selectedSubjects,
58377
+ setSelectedSubjects,
58378
+ selectOptions,
58379
+ entity,
58380
+ options
58381
+ }) => {
58382
+ const cols = [{
58383
+ title: "",
58384
+ dataIndex: "select",
58385
+ key: "select",
58386
+ width: 50,
58387
+ show: true,
58388
+ render: (v, all) => {
58389
+ if (all.empty) {
58390
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58391
+ className: "daf-default-cell"
58392
+ });
58393
+ }
58394
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
58395
+ onChange: () => setSelectedSubjects(prev => {
58396
+ const isSelected = prev?.some(p => p.id === all.id);
58397
+ if (isSelected) {
58398
+ return prev.filter(p => p.id !== all.id);
58399
+ }
58400
+ return [...prev, all];
58401
+ }),
58402
+ checked: selectedSubjects?.some(p => p.id === all.id),
58403
+ disabled: selectedSubjects?.length >= 3 && !selectedSubjects?.some(p => p.id === all.id)
58404
+ });
58405
+ }
58406
+ }, {
58407
+ title: t("ID"),
58408
+ dataIndex: "datastakeId",
58409
+ key: "datastakeId",
58410
+ ellipsis: true,
58411
+ show: true,
58412
+ render: (value, all) => {
58413
+ if (all.empty) {
58414
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58415
+ className: "daf-default-cell"
58416
+ });
58417
+ }
58418
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58419
+ title: value,
58420
+ children: value
58421
+ });
58422
+ }
58423
+ }, {
58424
+ title: t("Title"),
58425
+ dataIndex: "name",
58426
+ key: "name",
58427
+ ellipsis: true,
58428
+ show: true,
58429
+ render: (value, all) => {
58430
+ if (all.empty) {
58431
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58432
+ className: "daf-default-cell"
58433
+ });
58434
+ }
58435
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58436
+ title: value,
58437
+ children: value
58438
+ });
58439
+ }
58440
+ }, {
58441
+ title: t("Date"),
58442
+ dataIndex: "date",
58443
+ key: "date",
58444
+ show: true,
58445
+ render: (value, all) => {
58446
+ if (all.empty) {
58447
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58448
+ className: "daf-default-cell"
58449
+ });
58450
+ }
58451
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58452
+ title: renderDateFormatted(value, "DD MMM YYYY", 'en'),
58453
+ children: renderDateFormatted(value, "DD MMM YYYY", 'en')
58454
+ });
58455
+ }
58456
+ }, {
58457
+ title: t("Last Update"),
58458
+ dataIndex: "updatedAt",
58459
+ key: "updatedAt",
58460
+ show: true,
58461
+ render: (value, all) => {
58462
+ if (all.empty) {
58463
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58464
+ className: "daf-default-cell"
58465
+ });
58466
+ }
58467
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58468
+ title: renderDateFormatted(value, "DD MMM YYYY", 'en'),
58469
+ children: renderDateFormatted(value, "DD MMM YYYY", 'en')
58470
+ });
58471
+ }
58472
+ }, {
58473
+ title: "",
58474
+ dataIndex: "actions",
58475
+ key: "actions",
58476
+ width: 60,
58477
+ show: true,
58478
+ render: (value, all) => {
58479
+ if (all.empty) {
58480
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58481
+ className: "daf-default-cell"
58482
+ });
58483
+ }
58484
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58485
+ className: "cursor-pointer",
58486
+ onClick: () => {
58487
+ goTo(getRedirectLink(`/app/view/management-document/${all.id}`));
58488
+ },
58489
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
58490
+ name: "Link",
58491
+ width: 18,
58492
+ height: 18
58493
+ })
58494
+ });
58495
+ }
58496
+ }];
58497
+ return cols.filter(c => c[show]);
58498
+ };
58499
+
58500
+ const {
58501
+ useToken: useToken$1
58502
+ } = antd.theme;
58503
+ function DocumentsTable({
58504
+ t = text => text,
58505
+ isMobile,
58506
+ goTo,
58507
+ getRedirectLink,
58508
+ location,
58509
+ getData,
58510
+ module,
58511
+ config,
58512
+ defaultPageSize = 20,
58513
+ view,
58514
+ headerTitle,
58515
+ breadcrumbs,
58516
+ refetchTrigger,
58517
+ user,
58518
+ options
58519
+ }) {
58520
+ const [showFilters, setShowFilters] = React.useState(false);
58521
+ const [hasError, setHasError] = React.useState(false);
58522
+ const [selectedDocuments, setSelectedDocuments] = React.useState([]);
58523
+ const {
58524
+ token
58525
+ } = useToken$1();
58526
+ const getDataWithStringPagination = async ({
58527
+ params
58528
+ }) => {
58529
+ const {
58530
+ pagination,
58531
+ tab,
58532
+ filters,
58533
+ search,
58534
+ sort,
58535
+ ...otherParams
58536
+ } = params;
58537
+ let paginationObj = {
58538
+ page: 1,
58539
+ pageSize: 20
58540
+ };
58541
+ if (pagination) {
58542
+ try {
58543
+ paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
58544
+ } catch (e) {
58545
+ console.error('Failed to parse pagination', e);
58546
+ }
58547
+ }
58548
+ const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
58549
+ let pageNumber = 1;
58550
+ if (paginationObj.page || paginationObj.current) {
58551
+ pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
58552
+ } else if (typeof paginationObj.skip === 'number') {
58553
+ pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
58554
+ }
58555
+ pageNumber = pageNumber || 1;
58556
+ let activeTab = tab || "active";
58557
+ if (!tab && filters) {
58558
+ try {
58559
+ const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
58560
+ activeTab = parsedFilters.activeTab || "active";
58561
+ } catch (e) {
58562
+ activeTab = "active";
58563
+ }
58564
+ }
58565
+ const transformedParams = {
58566
+ pagination: {
58567
+ skip: pageNumber,
58568
+ take: pageSize
58569
+ },
58570
+ tab: activeTab
58571
+ };
58572
+ return getData({
58573
+ params: transformedParams
58574
+ });
58575
+ };
58576
+ const {
58577
+ filter,
58578
+ activeTab,
58579
+ canClearSearch,
58580
+ totalPending,
58581
+ data,
58582
+ loading,
58583
+ initFetchDone,
58584
+ fetchData,
58585
+ fetchPendingAccounts,
58586
+ setLoading
58587
+ } = useAdminTable({
58588
+ goTo,
58589
+ location,
58590
+ selectFiltersConfig: selectFiltersConfig$8,
58591
+ view,
58592
+ // defaultUrlParams,
58593
+ module,
58594
+ defaultPageSize,
58595
+ filtersConfig: filtersConfig$8,
58596
+ getRedirectLink,
58597
+ getData: getDataWithStringPagination,
58598
+ refetchTrigger
58599
+ });
58600
+ const selectOptions = React.useMemo(() => {
58601
+ return {
58602
+ category: config.options?.category,
58603
+ country: config.options?.countries,
58604
+ sources: []
58605
+ };
58606
+ }, [config.options]);
58607
+ const columns = React.useMemo(() => {
58608
+ return getColumns$1({
58609
+ t,
58610
+ goTo,
58611
+ token,
58612
+ module,
58613
+ selectedDocuments,
58614
+ setSelectedDocuments,
58615
+ getRedirectLink,
58616
+ selectOptions,
58617
+ entity: headerTitle,
58618
+ options
58619
+ });
58620
+ }, [t, goTo, module, token, selectedDocuments, getRedirectLink, selectOptions, headerTitle, options]);
58621
+ console.log({
58622
+ data
58623
+ }, "data");
58624
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
58625
+ children: /*#__PURE__*/jsxRuntime.jsxs(AdminTable, {
58626
+ filters: filter,
58627
+ t: t,
58628
+ headerTitle: headerTitle
58629
+ // actionButton={[
58630
+ // {
58631
+ // icon: "Merge",
58632
+ // onClick: () => setIsModalOpen(true),
58633
+ // tooltip: t("merge-subjects"),
58634
+ // disabled: selectedDocuments.length < 2,
58635
+ // },
58636
+ // ]}
58637
+ // tabs={getTabs({ t })}
58638
+ ,
58639
+ isMobile: isMobile
58640
+ // activeTab={activeTab}
58641
+ ,
58642
+ showFilters: showFilters,
58643
+ setShowFilters: setShowFilters,
58644
+ hasError: hasError,
58645
+ setHasError: setHasError,
58646
+ canClearSearch: canClearSearch,
58647
+ selectOptions: selectOptions,
58648
+ checkboxConfig: checkboxConfig$8,
58649
+ defaultTableFilters: {},
58650
+ breadcrumbs: breadcrumbs,
58651
+ children: [selectedDocuments.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
58652
+ className: "flex flex-row ml-6 mt-5",
58653
+ style: {
58654
+ flexWrap: "wrap",
58655
+ gap: "8px"
58656
+ },
58657
+ children: selectedDocuments.map(document => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
58658
+ className: "flex flex-row gap-2 items-center",
58659
+ onClick: () => setSelectedDocuments(prev => prev.filter(a => a.id !== document.id)),
58660
+ style: {
58661
+ cursor: "pointer"
58662
+ },
58663
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
58664
+ children: document.name
58665
+ }), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
58666
+ name: "Close",
58667
+ size: 10
58668
+ })]
58669
+ }, document.id))
58670
+ }), /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
58671
+ columns: columns,
58672
+ data: data,
58673
+ loading: loading,
58674
+ hideOnLoading: false,
58675
+ pagination: filter.pagination,
58676
+ rowKey: "id",
58677
+ selectOptions: selectOptions,
58678
+ doEmptyRows: true,
58679
+ setShowFilters: setShowFilters,
58680
+ filtersConfig: selectFiltersConfig$8,
58681
+ onFilterChange: filter.onFiltersChange,
58682
+ showFilters: showFilters,
58683
+ defaultFilters: filter.defaultFilters,
58684
+ onChange: filter.onTableChange
58685
+ })]
58686
+ })
58687
+ });
58688
+ }
58689
+
58690
+ function AdminLocationScreen({
58691
+ config
58692
+ }) {
58693
+ const {
58694
+ appName = "app",
58695
+ module,
58696
+ goTo,
58697
+ t,
58698
+ location,
58699
+ isMobile,
58700
+ getRedirectLink,
58701
+ AdminService,
58702
+ options,
58703
+ handleError,
58704
+ defaultPageSize = 20,
58705
+ view,
58706
+ headerTitle = "documents",
58707
+ breadcrumbs,
58708
+ refetchTrigger,
58709
+ getData,
58710
+ user
58711
+ } = config;
58712
+ const getSubjects = React.useCallback(params => {
58713
+ if (getData) {
58714
+ return getData(params);
58715
+ }
58716
+ return AdminService.getItems({
58717
+ item: 'document',
58718
+ params
58719
+ });
58720
+ }, [getData, AdminService]);
58721
+ return /*#__PURE__*/jsxRuntime.jsx(DocumentsTable, {
58722
+ t: t,
58723
+ goTo: goTo,
58724
+ getRedirectLink: getRedirectLink,
58725
+ location: location,
58726
+ module: module,
58727
+ headerTitle: headerTitle,
58728
+ getData: getSubjects,
58729
+ isMobile: isMobile,
58730
+ defaultPageSize: defaultPageSize,
58731
+ view: view,
58732
+ breadcrumbs: breadcrumbs,
58733
+ refetchTrigger: refetchTrigger,
58734
+ config: {
58735
+ options: {
58736
+ category: options?.category,
58737
+ countries: options?.countries
58738
+ }
58739
+ },
58740
+ user: user,
58741
+ options: options
58742
+ });
58743
+ }
58744
+
58745
+ const selectFiltersConfig$7 = {
58746
+ category: {
58747
+ type: "select",
58748
+ label: "Category",
58749
+ placeholder: t => t("Category"),
58750
+ style: {
58751
+ flex: 1
58752
+ },
58753
+ labelStyle: {
58754
+ flex: 1
58755
+ },
58756
+ getLabel: option => option.label,
58757
+ getValue: option => option.value
58758
+ },
58759
+ country: {
58760
+ type: "select",
58761
+ label: "Country",
58762
+ placeholder: t => t("Country"),
58763
+ style: {
58764
+ flex: 1
58765
+ },
58766
+ labelStyle: {
58767
+ flex: 1
58768
+ },
58769
+ getLabel: option => option.label,
58770
+ getValue: option => option.value
58771
+ },
58772
+ sources: {
58773
+ type: "select",
58774
+ label: "Sources",
58775
+ placeholder: t => t("Sources"),
58776
+ style: {
58777
+ flex: 1
58778
+ },
58779
+ labelStyle: {
58780
+ flex: 1
58781
+ },
58782
+ getLabel: option => option.label,
58783
+ getValue: option => option.value
58784
+ }
58785
+ };
58786
+ const filtersConfig$7 = {
58787
+ name: "",
58788
+ datastakeId: ""
58789
+ };
58790
+ const defaultUrlParams = {
58791
+ activeTab: "active"
58792
+ };
58793
+ const checkboxConfig$7 = {
58794
+ name: "Name",
58795
+ datastakeId: "ID"
58796
+ };
58797
+
58798
+ const getColumns = ({
58799
+ t,
58800
+ goTo = () => {},
58801
+ show = "show",
58802
+ getRedirectLink = () => {},
58803
+ token,
58804
+ selectedSubjects,
58805
+ setSelectedSubjects,
58806
+ selectOptions,
58807
+ entity,
58808
+ options
58809
+ }) => {
58810
+ const cols = [{
58811
+ title: "",
58812
+ dataIndex: "select",
58813
+ key: "select",
58814
+ width: 50,
58815
+ show: true,
58816
+ render: (v, all) => {
58817
+ if (all.empty) {
58818
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58819
+ className: "daf-default-cell"
58820
+ });
58821
+ }
58822
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
58823
+ onChange: () => setSelectedSubjects(prev => {
58824
+ const isSelected = prev?.some(p => p.id === all.id);
58825
+ if (isSelected) {
58826
+ return prev.filter(p => p.id !== all.id);
58827
+ }
58828
+ return [...prev, all];
58829
+ }),
58830
+ checked: selectedSubjects?.some(p => p.id === all.id),
58831
+ disabled: selectedSubjects?.length >= 3 && !selectedSubjects?.some(p => p.id === all.id)
58832
+ });
58833
+ }
58834
+ }, {
58835
+ title: t("ID"),
58836
+ dataIndex: "datastakeId",
58837
+ key: "datastakeId",
58838
+ ellipsis: true,
58839
+ show: true,
58840
+ render: (value, all) => {
58841
+ if (all.empty) {
58842
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58843
+ className: "daf-default-cell"
58844
+ });
58845
+ }
58846
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58847
+ title: value,
58848
+ children: value
58849
+ });
58850
+ }
58851
+ }, {
58852
+ title: t("Title"),
58853
+ dataIndex: "name",
58854
+ key: "name",
58855
+ ellipsis: true,
58856
+ show: true,
58857
+ render: (value, all) => {
58858
+ if (all.empty) {
58859
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58860
+ className: "daf-default-cell"
58861
+ });
58862
+ }
58863
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58864
+ title: value,
58865
+ children: value
58866
+ });
58867
+ }
58868
+ }, {
58869
+ title: t("type"),
58870
+ dataIndex: "typeOfEvent",
58871
+ key: "typeOfEvent",
58872
+ ellipsis: true,
58873
+ show: true,
58874
+ render: (value, all) => {
58875
+ if (all.empty) {
58876
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58877
+ className: "daf-default-cell"
58878
+ });
58879
+ }
58880
+ (options?.eventCategoryOptions || options?.categoryOptions || [])?.map(item => ({
58881
+ value: item.value,
58882
+ label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
58883
+ }));
58884
+ const type = findOptions(value, options?.eventsType || []) || "-";
58885
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58886
+ title: type,
58887
+ children: type
58888
+ });
58889
+ }
58890
+ }, {
58891
+ title: t("Date"),
58892
+ dataIndex: "date",
58893
+ key: "date",
58894
+ render: (value, all) => {
58895
+ if (all.empty) {
58896
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58897
+ className: "daf-default-cell"
58898
+ });
58899
+ }
58900
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58901
+ title: value,
58902
+ children: value
58903
+ });
58904
+ }
58905
+ }, {
58906
+ title: t("Scope"),
58907
+ dataIndex: "scope",
58908
+ key: "scope",
58909
+ render: (value, all) => {
58910
+ if (all.empty) {
58911
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58912
+ className: "daf-default-cell"
58913
+ });
58914
+ }
58915
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
58916
+ title: value,
58917
+ children: value
58918
+ });
58919
+ }
58920
+ }, {
58921
+ title: "",
58922
+ dataIndex: "actions",
58923
+ key: "actions",
58924
+ width: 60,
58925
+ show: true,
58926
+ render: (value, all) => {
58927
+ if (all.empty) {
58928
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58929
+ className: "daf-default-cell"
58930
+ });
58931
+ }
58932
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
58933
+ className: "cursor-pointer",
58934
+ onClick: () => {
58935
+ goTo(getRedirectLink(`/app/view/management-event/${all.id}`));
58936
+ },
58937
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
58938
+ name: "Link",
58939
+ width: 18,
58940
+ height: 18
58941
+ })
58942
+ });
58943
+ }
58944
+ }];
58945
+ return cols.filter(c => c[show]);
58946
+ };
58947
+
58948
+ const {
58949
+ useToken
58950
+ } = antd.theme;
58951
+ function EventsTable({
58952
+ t = text => text,
58953
+ isMobile,
58954
+ goTo,
58955
+ getRedirectLink,
58956
+ location,
58957
+ getData,
58958
+ module,
58959
+ config,
58960
+ defaultPageSize = 20,
58961
+ view,
58962
+ headerTitle,
58963
+ breadcrumbs,
58964
+ refetchTrigger,
58965
+ user,
58966
+ options
58967
+ }) {
58968
+ const [showFilters, setShowFilters] = React.useState(false);
58969
+ const [hasError, setHasError] = React.useState(false);
58970
+ const [selectedEvents, setSelectedEvents] = React.useState([]);
58971
+ const {
58972
+ token
58973
+ } = useToken();
58974
+ const getDataWithStringPagination = async ({
58975
+ params
58976
+ }) => {
58977
+ const {
58978
+ pagination,
58979
+ tab,
58980
+ filters,
58981
+ search,
58982
+ sort,
58983
+ ...otherParams
58984
+ } = params;
58985
+
58986
+ // Don't send pagination to API - we'll fetch all data and slice on frontend
58987
+ let activeTab = tab || "active";
58988
+ if (!tab && filters) {
58989
+ try {
58990
+ const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
58991
+ activeTab = parsedFilters.activeTab || "active";
58992
+ } catch (e) {
58993
+ activeTab = "active";
58994
+ }
58995
+ }
58996
+
58997
+ // Fetch all data without pagination - we'll slice on frontend based on URL params
58998
+ const transformedParams = {
58999
+ tab: activeTab,
59000
+ ...otherParams
59001
+ };
59002
+ return getData({
59003
+ params: transformedParams
59004
+ });
59005
+ };
59006
+ const {
59007
+ filter,
59008
+ // activeTab,
59009
+ canClearSearch,
59010
+ totalPending,
59011
+ data,
59012
+ loading,
59013
+ initFetchDone,
59014
+ fetchData,
59015
+ fetchPendingAccounts,
59016
+ setLoading
59017
+ } = useAdminTable({
59018
+ goTo,
59019
+ location,
59020
+ selectFiltersConfig: selectFiltersConfig$7,
59021
+ view,
59022
+ defaultUrlParams,
59023
+ module,
59024
+ defaultPageSize,
59025
+ filtersConfig: filtersConfig$7,
59026
+ getRedirectLink,
59027
+ getData: getDataWithStringPagination,
59028
+ refetchTrigger
59029
+ });
59030
+ const selectOptions = React.useMemo(() => {
59031
+ return {
59032
+ category: config.options?.category,
59033
+ country: config.options?.countries,
59034
+ sources: []
59035
+ };
59036
+ }, [config.options]);
59037
+ const columns = React.useMemo(() => {
59038
+ return getColumns({
59039
+ t,
59040
+ goTo,
59041
+ token,
59042
+ module,
59043
+ selectedEvents,
59044
+ setSelectedEvents,
59045
+ getRedirectLink,
59046
+ selectOptions,
59047
+ entity: headerTitle,
59048
+ options
59049
+ });
59050
+ }, [t, goTo, module, token, selectedEvents, getRedirectLink, selectOptions, headerTitle, options]);
59051
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
59052
+ children: /*#__PURE__*/jsxRuntime.jsxs(AdminTable, {
59053
+ filters: filter,
59054
+ t: t,
59055
+ headerTitle: headerTitle
59056
+ // actionButton={[
59057
+ // {
59058
+ // icon: "Merge",
59059
+ // onClick: () => setIsModalOpen(true),
59060
+ // tooltip: t("merge-subjects"),
59061
+ // disabled: selectedEvents.length < 2,
59062
+ // },
59063
+ // ]}
59064
+ // tabs={getTabs({ t })}
59065
+ ,
59066
+ isMobile: isMobile
59067
+ // activeTab={activeTab}
59068
+ ,
59069
+ showFilters: showFilters,
59070
+ setShowFilters: setShowFilters,
59071
+ hasError: hasError,
59072
+ setHasError: setHasError,
59073
+ canClearSearch: canClearSearch,
59074
+ selectOptions: selectOptions,
59075
+ checkboxConfig: checkboxConfig$7,
59076
+ defaultTableFilters: {},
59077
+ breadcrumbs: breadcrumbs,
59078
+ children: [selectedEvents.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
59079
+ className: "flex flex-row ml-6 mt-5",
59080
+ style: {
59081
+ flexWrap: "wrap",
59082
+ gap: "8px"
59083
+ },
59084
+ children: selectedEvents.map(event => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
59085
+ className: "flex flex-row gap-2 items-center",
59086
+ onClick: () => setSelectedEvents(prev => prev.filter(a => a.id !== event.id)),
59087
+ style: {
59088
+ cursor: "pointer"
59089
+ },
59090
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
59091
+ children: event.title
59092
+ }), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
59093
+ name: "Close",
59094
+ size: 10
59095
+ })]
59096
+ }, event.id))
59097
+ }), /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
59098
+ columns: columns,
59099
+ data: data,
59100
+ loading: loading,
59101
+ hideOnLoading: false,
59102
+ pagination: filter.pagination,
59103
+ rowKey: "id",
59104
+ selectOptions: selectOptions,
59105
+ doEmptyRows: true,
59106
+ setShowFilters: setShowFilters,
59107
+ filtersConfig: selectFiltersConfig$7,
59108
+ onFilterChange: filter.onFiltersChange,
59109
+ showFilters: showFilters,
59110
+ defaultFilters: filter.defaultFilters,
59111
+ onChange: filter.onTableChange
59112
+ })]
59113
+ })
59114
+ });
59115
+ }
59116
+
59117
+ function AdminEventsScreen({
59118
+ config
59119
+ }) {
59120
+ const {
59121
+ appName = "app",
59122
+ module,
59123
+ goTo,
59124
+ t,
59125
+ location,
59126
+ isMobile,
59127
+ getRedirectLink,
59128
+ AdminService,
59129
+ options,
59130
+ handleError,
59131
+ defaultPageSize = 20,
59132
+ view,
59133
+ headerTitle = "events",
59134
+ breadcrumbs,
59135
+ refetchTrigger,
59136
+ getData,
59137
+ user
59138
+ } = config;
59139
+ const getSubjects = React.useCallback(params => {
59140
+ if (getData) {
59141
+ return getData(params);
59142
+ }
59143
+ return AdminService.getItems({
59144
+ item: 'event',
59145
+ params
59146
+ });
59147
+ }, [getData, AdminService]);
59148
+ return /*#__PURE__*/jsxRuntime.jsx(EventsTable, {
59149
+ t: t,
59150
+ goTo: goTo,
59151
+ getRedirectLink: getRedirectLink,
59152
+ location: location,
59153
+ module: module,
59154
+ headerTitle: headerTitle,
59155
+ getData: getSubjects,
59156
+ isMobile: isMobile,
59157
+ defaultPageSize: defaultPageSize,
59158
+ view: view,
59159
+ breadcrumbs: breadcrumbs,
59160
+ refetchTrigger: refetchTrigger,
59161
+ config: {
59162
+ options: options
59163
+ },
59164
+ user: user,
59165
+ options: options
59166
+ });
59167
+ }
59168
+
58065
59169
  function getAdminRoutes(config) {
58066
59170
  const {
58067
59171
  appName,
@@ -58073,6 +59177,8 @@ function getAdminRoutes(config) {
58073
59177
  useAdminLocationConfig,
58074
59178
  useAdminSubjectsViewConfig,
58075
59179
  useAdminLocationViewConfig,
59180
+ useAdminDocumentsConfig,
59181
+ useAdminEventsConfig,
58076
59182
  userIsAdmin
58077
59183
  } = config;
58078
59184
  const APP_PREFIX = "APP_".concat(appName.toUpperCase());
@@ -58108,11 +59214,23 @@ function getAdminRoutes(config) {
58108
59214
  }
58109
59215
  function LocationWrapper() {
58110
59216
  const locationConfig = typeof useAdminLocationConfig === "function" ? useAdminLocationConfig() : undefined;
58111
- return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen, {
59217
+ return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen$1, {
58112
59218
  config: locationConfig
58113
59219
  });
58114
59220
  }
58115
- const subjectsIndexComponent = typeof useAdminLocationConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {}) : typeof useAdminSubjectsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {}) : /*#__PURE__*/jsxRuntime.jsx("div", {});
59221
+ function DocumentsWrapper() {
59222
+ const documentsConfig = typeof useAdminDocumentsConfig === "function" ? useAdminDocumentsConfig() : undefined;
59223
+ return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen, {
59224
+ config: documentsConfig
59225
+ });
59226
+ }
59227
+ function EventsWrapper() {
59228
+ const eventsConfig = typeof useAdminEventsConfig === "function" ? useAdminEventsConfig() : undefined;
59229
+ return /*#__PURE__*/jsxRuntime.jsx(AdminEventsScreen, {
59230
+ config: eventsConfig
59231
+ });
59232
+ }
59233
+ const subjectsIndexComponent = typeof useAdminLocationConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {}) : typeof useAdminSubjectsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {}) : typeof useAdminDocumentsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(DocumentsWrapper, {}) : typeof useAdminEventsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(EventsWrapper, {}) : /*#__PURE__*/jsxRuntime.jsx("div", {});
58116
59234
  const routes = [{
58117
59235
  path: "",
58118
59236
  key: "".concat(APP_PREFIX, "_DASHBOARD"),
@@ -58155,6 +59273,18 @@ function getAdminRoutes(config) {
58155
59273
  exact: true,
58156
59274
  visible: user => userIsAdmin(user),
58157
59275
  component: /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {})
59276
+ }] : []), ...(typeof useAdminDocumentsConfig === "function" ? [{
59277
+ path: "management/subjects/document",
59278
+ key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_DOCUMENTS"),
59279
+ exact: true,
59280
+ visible: user => userIsAdmin(user),
59281
+ component: /*#__PURE__*/jsxRuntime.jsx(DocumentsWrapper, {})
59282
+ }] : []), ...(typeof useAdminEventsConfig === "function" ? [{
59283
+ path: "management/subjects/event",
59284
+ key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_EVENTS"),
59285
+ exact: true,
59286
+ visible: user => userIsAdmin(user),
59287
+ component: /*#__PURE__*/jsxRuntime.jsx(EventsWrapper, {})
58158
59288
  }] : [])];
58159
59289
  return routes;
58160
59290
  }
@@ -64413,7 +65543,7 @@ exports.AdminAccountsScreen = AdminAccountsScreen;
64413
65543
  exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
64414
65544
  exports.AdminDashboard = AdminDashboard;
64415
65545
  exports.AdminDashboardScreen = AdminDashboardScreen;
64416
- exports.AdminLocationScreen = AdminLocationScreen;
65546
+ exports.AdminLocationScreen = AdminLocationScreen$1;
64417
65547
  exports.AdminSubjectsScreen = AdminSubjectsScreen;
64418
65548
  exports.AdminUsersScreen = AdminUsersScreen;
64419
65549
  exports.AdminView = AdminView$1;