datastake-daf 0.6.812 → 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 (54) hide show
  1. package/dist/components/index.js +1564 -412
  2. package/dist/hooks/index.js +11 -4
  3. package/dist/pages/index.js +112 -12
  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/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +0 -1
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +0 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -3
  11. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +56 -31
  14. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +36 -10
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
  16. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +37 -10
  17. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  18. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +81 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +77 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -0
  21. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +22 -30
  22. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +25 -13
  23. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +127 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +43 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +201 -0
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +146 -0
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +58 -0
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +176 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +17 -2
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +27 -13
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +4 -2
  33. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +3 -0
  34. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +12 -9
  35. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -4
  36. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +9 -17
  37. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +9 -8
  38. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +124 -99
  39. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +48 -1
  40. package/src/@daf/hooks/useAdminDashboard.js +7 -4
  41. package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
  42. package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
  43. package/src/@daf/pages/View/index.jsx +29 -4
  44. package/src/@daf/services/AdminService.js +47 -5
  45. package/src/@daf/services/DashboardService.js +3 -3
  46. package/src/@daf/utils/filters.js +13 -15
  47. package/src/constants/locales/en/translation.js +13 -0
  48. package/src/helpers/copyToClipboard.js +60 -0
  49. package/build/favicon.ico +0 -0
  50. package/build/logo192.png +0 -0
  51. package/build/logo512.png +0 -0
  52. package/build/manifest.json +0 -25
  53. package/build/robots.txt +0 -3
  54. 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,
@@ -19858,12 +19858,12 @@ function GroupInfos({
19858
19858
  }
19859
19859
 
19860
19860
  const {
19861
- useToken: useToken$j
19861
+ useToken: useToken$l
19862
19862
  } = antd.theme;
19863
19863
  function Smart() {
19864
19864
  const {
19865
19865
  token
19866
- } = useToken$j();
19866
+ } = useToken$l();
19867
19867
  const [isOpen, setIsOpen] = React.useState(false);
19868
19868
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
19869
19869
  style: {
@@ -19947,7 +19947,7 @@ function SmartWidget({
19947
19947
  }) {
19948
19948
  const {
19949
19949
  token
19950
- } = useToken$j();
19950
+ } = useToken$l();
19951
19951
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
19952
19952
  noTitle: true,
19953
19953
  className: "no-p-body p-xs",
@@ -20024,7 +20024,8 @@ function _checkValue(wantedValue, match, fieldValue) {
20024
20024
  }
20025
20025
  return false;
20026
20026
  }
20027
- function getInputProp$1(prop, formsValue = {}) {
20027
+ function getInputProp$1(prop) {
20028
+ let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20028
20029
  if (prop && typeof prop === 'object') {
20029
20030
  const validations = Object.keys(prop);
20030
20031
  const key = validations.find(v => {
@@ -20038,7 +20039,9 @@ function getInputProp$1(prop, formsValue = {}) {
20038
20039
  return prop;
20039
20040
  }
20040
20041
  }
20041
- function getInputLabel$2(input, formsValue = {}, asText = false) {
20042
+ function getInputLabel$2(input) {
20043
+ let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20044
+ let asText = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
20042
20045
  const label = getInputProp$1(input.label, formsValue);
20043
20046
  return input.description && typeof input.description === 'string' && !asText ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
20044
20047
  children: [ReactHtmlParser__default["default"](label), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
@@ -20245,14 +20248,22 @@ const sgbEvaluationIcons = getSgbEvaluationIcons(22, 22);
20245
20248
  const types = {
20246
20249
  MODAL: 'modal'
20247
20250
  };
20248
- const isGroupInput = (group, repeatable = false, data) => {
20251
+ const isGroupInput = function (group) {
20252
+ var _group$meta;
20253
+ let repeatable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20254
+ let data = arguments.length > 2 ? arguments[2] : undefined;
20249
20255
  let resp = group.inputs && Object.keys(group.inputs).length && group.repeatable === repeatable && group.type !== 'groupInputs' && group.type !== 'group' && group.type !== 'dataLinkGroup' && group.display !== 'group' && !group.viewGroup && !group.component;
20250
- if (group.showIf || group?.meta?.excludeFromView) {
20256
+ if (group.showIf || group !== null && group !== void 0 && (_group$meta = group.meta) !== null && _group$meta !== void 0 && _group$meta.excludeFromView) {
20251
20257
  resp = resp && showHideInput$3(group, data);
20252
20258
  }
20253
20259
  return resp;
20254
20260
  };
20255
- const repeatObjects = (obj, fn = () => {}, filter = null, sort = null) => filter ? Object.keys(obj).filter(key => filter(obj[key])).map(fn) : sort ? Object.keys(obj).sort(sort).map(fn) : Object.keys(obj).map(fn);
20261
+ const repeatObjects = function (obj) {
20262
+ let fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
20263
+ let filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
20264
+ let sort = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
20265
+ return filter ? Object.keys(obj).filter(key => filter(obj[key])).map(fn) : sort ? Object.keys(obj).sort(sort).map(fn) : Object.keys(obj).map(fn);
20266
+ };
20256
20267
  const conditions = new RegExp(/( is | and | not | notEmpty | includes )/gm);
20257
20268
  const getLastRow = (arr, cols) => {
20258
20269
  let currentInd = -1;
@@ -20318,28 +20329,32 @@ const checkCondition$3 = (condition, formsValue, repeatValues, input) => {
20318
20329
  }
20319
20330
  };
20320
20331
  const showHideInput$3 = (input, formsValue, repeatValues) => {
20321
- if (input.showIf && !input?.meta?.excludeFromView && !['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
20332
+ var _input$meta, _input$meta2, _input$meta5, _input$meta7;
20333
+ if (input.showIf && !(input !== null && input !== void 0 && (_input$meta = input.meta) !== null && _input$meta !== void 0 && _input$meta.excludeFromView) && !['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
20322
20334
  const isOrCond = input.showIf.indexOf('OR') >= 0;
20323
20335
  const allParts = input.showIf.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
20324
20336
  const parts = allParts.map(condition => checkCondition$3(condition, formsValue, repeatValues, input));
20325
20337
  return parts.length > 0 && (isOrCond && parts.filter(p => p).length >= 1 || parts.filter(p => !p).length === 0);
20326
20338
  }
20327
- if (typeof input?.meta?.excludeFromView === 'string') {
20328
- const isOrCond = input?.meta?.excludeFromView.indexOf('OR') >= 0;
20329
- const allParts = input?.meta?.excludeFromView.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
20339
+ if (typeof (input === null || input === void 0 || (_input$meta2 = input.meta) === null || _input$meta2 === void 0 ? void 0 : _input$meta2.excludeFromView) === 'string') {
20340
+ var _input$meta3, _input$meta4;
20341
+ const isOrCond = (input === null || input === void 0 || (_input$meta3 = input.meta) === null || _input$meta3 === void 0 ? void 0 : _input$meta3.excludeFromView.indexOf('OR')) >= 0;
20342
+ const allParts = input === null || input === void 0 || (_input$meta4 = input.meta) === null || _input$meta4 === void 0 ? void 0 : _input$meta4.excludeFromView.split(/( OR | && )/gmi).filter(c => !['OR', '&&'].includes(c.trim()));
20330
20343
  const parts = allParts.map(condition => checkCondition$3(condition, formsValue, repeatValues, input));
20331
20344
  const excludeFromView = parts.length > 0 && (isOrCond && parts.filter(p => p).length >= 1 || parts.filter(p => !p).length === 0);
20332
20345
  return !excludeFromView;
20333
20346
  }
20334
- if (typeof input?.meta?.excludeFromView === 'boolean') {
20335
- return !input?.meta?.excludeFromView;
20347
+ if (typeof (input === null || input === void 0 || (_input$meta5 = input.meta) === null || _input$meta5 === void 0 ? void 0 : _input$meta5.excludeFromView) === 'boolean') {
20348
+ var _input$meta6;
20349
+ return !(input !== null && input !== void 0 && (_input$meta6 = input.meta) !== null && _input$meta6 !== void 0 && _input$meta6.excludeFromView);
20336
20350
  }
20337
- if (input?.meta?.excludeFromView || ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
20351
+ if (input !== null && input !== void 0 && (_input$meta7 = input.meta) !== null && _input$meta7 !== void 0 && _input$meta7.excludeFromView || ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type)) {
20338
20352
  return false;
20339
20353
  }
20340
20354
  return true;
20341
20355
  };
20342
- const groupSubsections = (form, onlyConf = false) => {
20356
+ const groupSubsections = function (form) {
20357
+ let onlyConf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
20343
20358
  return Object.keys(form).reduce((f, fKey) => {
20344
20359
  if (form[fKey].subSection) {
20345
20360
  let subName = form[fKey].subSection;
@@ -20376,25 +20391,27 @@ const groupSubsections = (form, onlyConf = false) => {
20376
20391
  return f;
20377
20392
  }, {});
20378
20393
  };
20379
- const renderPlaceholder = ({
20380
- data,
20381
- config,
20382
- name,
20383
- withPlaceholder = true,
20384
- parent,
20385
- t
20386
- }) => {
20387
- if (((data?.meta?.inputs || {})[name] || {}).notApplicable) {
20394
+ const renderPlaceholder = _ref => {
20395
+ var _data$meta, _data$meta2, _config$meta;
20396
+ let {
20397
+ data,
20398
+ config,
20399
+ name,
20400
+ withPlaceholder = true,
20401
+ parent,
20402
+ t
20403
+ } = _ref;
20404
+ if ((((data === null || data === void 0 || (_data$meta = data.meta) === null || _data$meta === void 0 ? void 0 : _data$meta.inputs) || {})[name] || {}).notApplicable) {
20388
20405
  return /*#__PURE__*/jsxRuntime.jsx("span", {
20389
20406
  className: "text-muted",
20390
20407
  children: t('Not applicable')
20391
- }, `${parent}-${name}`);
20408
+ }, "".concat(parent, "-").concat(name));
20392
20409
  }
20393
- if (((data?.meta?.inputs || {})[name] || {}).notAvailable) {
20410
+ if ((((data === null || data === void 0 || (_data$meta2 = data.meta) === null || _data$meta2 === void 0 ? void 0 : _data$meta2.inputs) || {})[name] || {}).notAvailable) {
20394
20411
  return /*#__PURE__*/jsxRuntime.jsx("span", {
20395
20412
  className: "text-muted",
20396
20413
  children: t('No available information')
20397
- }, `${parent}-${name}`);
20414
+ }, "".concat(parent, "-").concat(name));
20398
20415
  }
20399
20416
  if (!withPlaceholder) {
20400
20417
  return '';
@@ -20402,9 +20419,9 @@ const renderPlaceholder = ({
20402
20419
  return config.noValue ? /*#__PURE__*/jsxRuntime.jsx("span", {
20403
20420
  className: "text-muted",
20404
20421
  children: config.noValue
20405
- }, `${parent}-${name}`) : /*#__PURE__*/jsxRuntime.jsxs("span", {
20422
+ }, "".concat(parent, "-").concat(name)) : /*#__PURE__*/jsxRuntime.jsxs("span", {
20406
20423
  className: "text-muted flex",
20407
- children: [t('Not answered'), config?.meta?.mandatory ? /*#__PURE__*/jsxRuntime.jsx("div", {
20424
+ children: [t('Not answered'), config !== null && config !== void 0 && (_config$meta = config.meta) !== null && _config$meta !== void 0 && _config$meta.mandatory ? /*#__PURE__*/jsxRuntime.jsx("div", {
20408
20425
  className: "ml-1",
20409
20426
  style: {
20410
20427
  marginTop: -1
@@ -20416,9 +20433,10 @@ const renderPlaceholder = ({
20416
20433
  color: "#FFC069"
20417
20434
  })
20418
20435
  }) : null]
20419
- }, `${parent}-${name}`);
20436
+ }, "".concat(parent, "-").concat(name));
20420
20437
  };
20421
- function getSelectOptions$2(option, formsValue = {}) {
20438
+ function getSelectOptions$2(option) {
20439
+ let formsValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20422
20440
  if (typeof option.label === 'object') {
20423
20441
  const validations = Object.keys(option.label);
20424
20442
  const key = validations.find(v => {
@@ -20447,13 +20465,15 @@ function numberWithCommas$1(x) {
20447
20465
  }
20448
20466
  const noLabelInputTypes = ['ajaxSubGroup', 'subGroup', 'group', 'groupExpandable'];
20449
20467
  const excludedKeys$1 = ['id', 'label', 'position', 'subTitle'];
20450
- const renderDate = ({
20451
- item,
20452
- inputName,
20453
- input
20454
- }) => {
20468
+ const renderDate = _ref2 => {
20469
+ var _input$meta8;
20470
+ let {
20471
+ item,
20472
+ inputName,
20473
+ input
20474
+ } = _ref2;
20455
20475
  const date = moment__default["default"].parseZone(item[inputName] ? item[inputName].toString() : null);
20456
- if (input?.meta?.checkExpiry) {
20476
+ if (input !== null && input !== void 0 && (_input$meta8 = input.meta) !== null && _input$meta8 !== void 0 && _input$meta8.checkExpiry) {
20457
20477
  const expired = date.isBefore(moment__default["default"]());
20458
20478
  if (expired) {
20459
20479
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -20972,7 +20992,7 @@ function DataLink$1({
20972
20992
  }
20973
20993
 
20974
20994
  const {
20975
- useToken: useToken$i
20995
+ useToken: useToken$k
20976
20996
  } = antd.theme;
20977
20997
  const disabledTypes = ["dataLink"];
20978
20998
  function Versions({
@@ -20985,7 +21005,7 @@ function Versions({
20985
21005
  }) {
20986
21006
  const {
20987
21007
  token
20988
- } = useToken$i();
21008
+ } = useToken$k();
20989
21009
  const dataSource = React.useMemo(() => {
20990
21010
  if (!versionsDatapoints) {
20991
21011
  return [];
@@ -42959,12 +42979,17 @@ function AuthForm(_ref) {
42959
42979
  errors,
42960
42980
  t = key => key,
42961
42981
  executeRecaptcha = () => {},
42962
- getCurrentStep = () => {}
42982
+ getCurrentStep = () => {},
42983
+ theme
42963
42984
  } = _ref;
42964
42985
  const [formInstance] = antd.Form.useForm(form);
42965
42986
  const [currentStep, setCurrentStep] = React.useState(0);
42966
42987
  const [allFormValues, setAllFormValues] = React.useState(initialValues);
42967
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
+ } : {};
42968
42993
  const isMultiStep = !!steps;
42969
42994
  const currentFields = isMultiStep ? steps === null || steps === void 0 || (_steps$currentStep = steps[currentStep]) === null || _steps$currentStep === void 0 ? void 0 : _steps$currentStep.fields : fields || [];
42970
42995
  React.useEffect(() => {
@@ -43105,6 +43130,7 @@ function AuthForm(_ref) {
43105
43130
  name: field.name,
43106
43131
  label: field.label,
43107
43132
  rules: field.rules,
43133
+ dependencies: field.dependencies,
43108
43134
  style: {
43109
43135
  marginBottom: 0
43110
43136
  }
@@ -43151,6 +43177,7 @@ function AuthForm(_ref) {
43151
43177
  disabled: isLastStep && !allFieldsFilled,
43152
43178
  block: true,
43153
43179
  className: "normal-br",
43180
+ style: buttonStyle,
43154
43181
  children: isLastStep ? submitText : t("Next")
43155
43182
  })
43156
43183
  });
@@ -43164,6 +43191,7 @@ function AuthForm(_ref) {
43164
43191
  onClick: prev,
43165
43192
  block: true,
43166
43193
  className: "normal-br",
43194
+ style: buttonStyle,
43167
43195
  children: t("Back")
43168
43196
  })
43169
43197
  })]
@@ -43177,6 +43205,7 @@ function AuthForm(_ref) {
43177
43205
  htmlType: "submit",
43178
43206
  block: true,
43179
43207
  className: "normal-br",
43208
+ style: buttonStyle,
43180
43209
  children: isMultiStep ? t("Next") : submitText
43181
43210
  })
43182
43211
  })]
@@ -45206,11 +45235,11 @@ function DataStore(_ref) {
45206
45235
  });
45207
45236
  }
45208
45237
 
45209
- const filtersConfig$c = {
45238
+ const filtersConfig$e = {
45210
45239
  datastakeId: '',
45211
45240
  name: ''
45212
45241
  };
45213
- const selectFiltersConfig$c = {
45242
+ const selectFiltersConfig$e = {
45214
45243
  country: {
45215
45244
  type: 'select',
45216
45245
  label: 'Country',
@@ -45251,7 +45280,7 @@ const selectFiltersConfig$c = {
45251
45280
  getValue: option => option.value
45252
45281
  }
45253
45282
  };
45254
- const checkboxConfig$c = {
45283
+ const checkboxConfig$e = {
45255
45284
  datastakeId: 'ID',
45256
45285
  name: 'Name'
45257
45286
  };
@@ -45568,14 +45597,15 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
45568
45597
  });
45569
45598
  return o;
45570
45599
  };
45600
+ const NEW_PAGINATION_APPS = ["nashiriki"];
45571
45601
  const filterParams = (value, module) => {
45572
45602
  const {
45573
45603
  activeFilters,
45574
45604
  ...rest
45575
45605
  } = value;
45576
45606
  const {
45577
- page = 1,
45578
- pageSize = 20,
45607
+ page,
45608
+ pageSize,
45579
45609
  sortDir,
45580
45610
  sortBy,
45581
45611
  search,
@@ -45584,10 +45614,9 @@ const filterParams = (value, module) => {
45584
45614
  } = activeFilters || {};
45585
45615
  const params = {};
45586
45616
  params.pagination = JSON.stringify({
45587
- page,
45588
- pageSize
45617
+ [NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
45618
+ [NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
45589
45619
  });
45590
- params.filters = JSON.stringify(filters);
45591
45620
  if (search && searchParams) {
45592
45621
  params.search = JSON.stringify({
45593
45622
  qs: search,
@@ -45600,6 +45629,16 @@ const filterParams = (value, module) => {
45600
45629
  by: sortBy
45601
45630
  });
45602
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
+ }
45603
45642
  return {
45604
45643
  ...rest,
45605
45644
  ...params
@@ -45977,12 +46016,12 @@ function DataStoreTable$1(_ref) {
45977
46016
  goNext,
45978
46017
  setPagination
45979
46018
  } = useFilters({
45980
- selectFiltersConfig: selectFiltersConfig$c,
46019
+ selectFiltersConfig: selectFiltersConfig$e,
45981
46020
  view,
45982
46021
  goTo,
45983
46022
  location,
45984
46023
  module: mod,
45985
- filtersConfig: filtersConfig$c,
46024
+ filtersConfig: filtersConfig$e,
45986
46025
  getRedirectLink,
45987
46026
  defaultPageSize
45988
46027
  });
@@ -46055,7 +46094,7 @@ function DataStoreTable$1(_ref) {
46055
46094
  hasError: hasError,
46056
46095
  setHasError: setHasError,
46057
46096
  filtersConfig: newFiltersConfig,
46058
- checkboxConfig: checkboxConfig$c,
46097
+ checkboxConfig: checkboxConfig$e,
46059
46098
  onSearch: onSearch,
46060
46099
  activeFilters: activeFilters,
46061
46100
  canClear: canClearSearch,
@@ -46071,7 +46110,7 @@ function DataStoreTable$1(_ref) {
46071
46110
  rowKey: "key",
46072
46111
  doEmptyRows: true,
46073
46112
  selectOptions,
46074
- filtersConfig: selectFiltersConfig$c,
46113
+ filtersConfig: selectFiltersConfig$e,
46075
46114
  onFilterChange: onFiltersChange,
46076
46115
  showFilters,
46077
46116
  defaultFilters,
@@ -47898,7 +47937,7 @@ StyledTabs.propTypes = {
47898
47937
  };
47899
47938
 
47900
47939
  const {
47901
- useToken: useToken$h
47940
+ useToken: useToken$j
47902
47941
  } = antd.theme;
47903
47942
  const MAX_LENGTH = 3;
47904
47943
  function AvatarGroup(_ref) {
@@ -47910,7 +47949,7 @@ function AvatarGroup(_ref) {
47910
47949
  const count = items.length === maxLength + 1 ? items.length : maxLength;
47911
47950
  const {
47912
47951
  token
47913
- } = useToken$h();
47952
+ } = useToken$j();
47914
47953
  return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
47915
47954
  max: {
47916
47955
  count: count,
@@ -47954,7 +47993,7 @@ const Container$1 = styled__default["default"].div`
47954
47993
 
47955
47994
  const _excluded$9 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
47956
47995
  const {
47957
- useToken: useToken$g
47996
+ useToken: useToken$i
47958
47997
  } = antd.theme;
47959
47998
 
47960
47999
  /**
@@ -48047,7 +48086,7 @@ function BarChart(_ref) {
48047
48086
  const chartRef = React__default["default"].useRef(null);
48048
48087
  const {
48049
48088
  token
48050
- } = useToken$g();
48089
+ } = useToken$i();
48051
48090
  const {
48052
48091
  legendEnabled,
48053
48092
  legendItems,
@@ -48128,7 +48167,7 @@ function BarChart(_ref) {
48128
48167
 
48129
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"];
48130
48169
  const {
48131
- useToken: useToken$f
48170
+ useToken: useToken$h
48132
48171
  } = antd.theme;
48133
48172
 
48134
48173
  /**
@@ -48220,7 +48259,7 @@ function LineChart(_ref) {
48220
48259
  const chartRef = React__default["default"].useRef(null);
48221
48260
  const {
48222
48261
  token
48223
- } = useToken$f();
48262
+ } = useToken$h();
48224
48263
  const {
48225
48264
  legendEnabled,
48226
48265
  legendItems,
@@ -48319,7 +48358,7 @@ function LineChart(_ref) {
48319
48358
 
48320
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"];
48321
48360
  const {
48322
- useToken: useToken$e
48361
+ useToken: useToken$g
48323
48362
  } = antd.theme;
48324
48363
 
48325
48364
  /**
@@ -48427,7 +48466,7 @@ function ColumnChart(_ref) {
48427
48466
  const chartRef = React__default["default"].useRef(null);
48428
48467
  const {
48429
48468
  token
48430
- } = useToken$e();
48469
+ } = useToken$g();
48431
48470
  const {
48432
48471
  legendEnabled,
48433
48472
  legendItems,
@@ -48517,7 +48556,7 @@ function ColumnChart(_ref) {
48517
48556
  }
48518
48557
 
48519
48558
  const {
48520
- useToken: useToken$d
48559
+ useToken: useToken$f
48521
48560
  } = antd.theme;
48522
48561
  /**
48523
48562
  * RadialBarChart Component
@@ -48579,7 +48618,7 @@ function RadialBarChart(_ref) {
48579
48618
  const chartRef = React__default["default"].useRef(null);
48580
48619
  const {
48581
48620
  token
48582
- } = useToken$d();
48621
+ } = useToken$f();
48583
48622
  const {
48584
48623
  legendEnabled,
48585
48624
  legendItems,
@@ -48692,7 +48731,7 @@ function RadialBarChart(_ref) {
48692
48731
 
48693
48732
  const _excluded$6 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
48694
48733
  const {
48695
- useToken: useToken$c
48734
+ useToken: useToken$e
48696
48735
  } = antd.theme;
48697
48736
 
48698
48737
  /**
@@ -48770,7 +48809,7 @@ function DonutPie(_ref) {
48770
48809
  const chartRef = React.useRef(null);
48771
48810
  const {
48772
48811
  token
48773
- } = useToken$c();
48812
+ } = useToken$e();
48774
48813
  const {
48775
48814
  legendEnabled,
48776
48815
  legendItems,
@@ -49025,7 +49064,7 @@ styled__default["default"].div`
49025
49064
  `;
49026
49065
 
49027
49066
  const {
49028
- useToken: useToken$b
49067
+ useToken: useToken$d
49029
49068
  } = antd.theme;
49030
49069
  /**
49031
49070
  * StackChart Component
@@ -49114,7 +49153,7 @@ function StackChart(_ref) {
49114
49153
  const ref = React__default["default"].useRef();
49115
49154
  const {
49116
49155
  token
49117
- } = useToken$b();
49156
+ } = useToken$d();
49118
49157
  const isEmpty = !data.length;
49119
49158
  const [mouseY, setMouseY] = React__default["default"].useState(0);
49120
49159
  const [mouseX, setMouseX] = React__default["default"].useState(0);
@@ -49287,7 +49326,7 @@ function StackChart(_ref) {
49287
49326
 
49288
49327
  const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
49289
49328
  const {
49290
- useToken: useToken$a
49329
+ useToken: useToken$c
49291
49330
  } = antd.theme;
49292
49331
 
49293
49332
  /**
@@ -49367,7 +49406,7 @@ const AreaChart = _ref => {
49367
49406
  const chartRef = React.useRef(null);
49368
49407
  const {
49369
49408
  token
49370
- } = useToken$a();
49409
+ } = useToken$c();
49371
49410
  const {
49372
49411
  legendEnabled,
49373
49412
  legendItems,
@@ -49452,7 +49491,7 @@ const AreaChart = _ref => {
49452
49491
 
49453
49492
  const _excluded$4 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
49454
49493
  const {
49455
- useToken: useToken$9
49494
+ useToken: useToken$b
49456
49495
  } = antd.theme;
49457
49496
  const RadarChart = _ref => {
49458
49497
  let {
@@ -49480,7 +49519,7 @@ const RadarChart = _ref => {
49480
49519
  const chartRef = React.useRef(null);
49481
49520
  const {
49482
49521
  token
49483
- } = useToken$9();
49522
+ } = useToken$b();
49484
49523
  const {
49485
49524
  legendEnabled,
49486
49525
  legendItems,
@@ -49595,7 +49634,7 @@ const RadarChart = _ref => {
49595
49634
  };
49596
49635
 
49597
49636
  const {
49598
- useToken: useToken$8
49637
+ useToken: useToken$a
49599
49638
  } = antd.theme;
49600
49639
  function DualAxesChart(_ref) {
49601
49640
  let {
@@ -49617,7 +49656,7 @@ function DualAxesChart(_ref) {
49617
49656
  const chartRef = React__default["default"].useRef(null);
49618
49657
  const {
49619
49658
  token
49620
- } = useToken$8();
49659
+ } = useToken$a();
49621
49660
  const {
49622
49661
  legendEnabled,
49623
49662
  legendItems,
@@ -50080,14 +50119,14 @@ const Style$k = styled__default["default"].div`
50080
50119
  // components/Nodes/NameNode.jsx
50081
50120
  const NAME_CARD_WIDTH = 315;
50082
50121
  const {
50083
- useToken: useToken$7
50122
+ useToken: useToken$9
50084
50123
  } = antd.theme;
50085
50124
  function NameNode({
50086
50125
  data
50087
50126
  }) {
50088
50127
  const {
50089
50128
  token
50090
- } = useToken$7();
50129
+ } = useToken$9();
50091
50130
  const translateFN = typeof data?.t === "function" ? data.t : key => key;
50092
50131
  const isPdf = data?.isPdf;
50093
50132
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -51957,33 +51996,27 @@ const BaseScreen = _ref => {
51957
51996
 
51958
51997
  function AppInvitation(_ref) {
51959
51998
  let {
51960
- // Redux State
51961
51999
  errors,
51962
52000
  user,
51963
52001
  invitationSuccess,
51964
- // Actions
51965
52002
  confirmInvitation,
51966
52003
  getUserFromInvitation,
51967
- // Configuration
52004
+ theme,
51968
52005
  Layout,
51969
52006
  redirectPath = "/",
51970
52007
  loginPath = "/login",
51971
52008
  appRedirectPath = "/app",
51972
- params: propParams = {}
51973
- } = _ref;
51974
- const {
52009
+ params: propParams = {},
52010
+ goTo,
52011
+ isMobile = false,
51975
52012
  t
51976
- } = useTranslation();
51977
- const routeParams = useParams();
52013
+ } = _ref;
51978
52014
  const {
51979
52015
  app,
51980
52016
  companyCode,
51981
52017
  userCode
51982
- } = _objectSpread2(_objectSpread2({}, routeParams), propParams);
51983
- const [passwords] = antd.Form.useForm();
52018
+ } = propParams;
51984
52019
  const [checking, setChecking] = React.useState(true);
51985
- const goTo = useNavigate();
51986
- const [termsAgreed, setTermsAgreed] = React.useState(false);
51987
52020
  const [passwordReseted, setPasswordReseted] = React.useState(false);
51988
52021
  React.useEffect(() => {
51989
52022
  if (companyCode && userCode) {
@@ -52004,32 +52037,114 @@ function AppInvitation(_ref) {
52004
52037
  localStorage.setItem('token', data.token);
52005
52038
  }
52006
52039
  antd.message.success(t('Invitation accepted'));
52007
- // Fix: ensure we don't rely on a variable from useParams that might not exist
52008
- // Just use the configured redirectPath
52009
- goTo(redirectPath);
52040
+ if (goTo && typeof goTo === 'function') {
52041
+ goTo(redirectPath);
52042
+ } else {
52043
+ window.location.href = redirectPath;
52044
+ }
52010
52045
  }, {
52011
52046
  companyCode,
52012
52047
  userCode
52013
52048
  });
52014
52049
  }
52015
52050
  }, [invitationSuccess, user, confirmInvitation, goTo, redirectPath, companyCode, userCode, t]);
52016
- const displayError = name => {
52017
- return errors && errors[name] && errors[name].length > 0 && {
52018
- help: errors[name][0],
52019
- validateStatus: 'error'
52020
- };
52021
- };
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]);
52022
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.';
52023
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
+ };
52024
52144
  if (checking && !invitationSuccess) {
52025
52145
  return /*#__PURE__*/jsxRuntime.jsx(Loading, {});
52026
52146
  }
52027
-
52028
- // If auto-confirming (inviteToken present), we might want to show loading or nothing until redirect
52029
52147
  if (invitationSuccess && user && user.inviteToken) {
52030
- // The useEffect will handle the redirect/confirm.
52031
- // We can show loading here too or just return null.
52032
- // Original code: checks invitationSuccess && !user.inviteToken for form, else redirect.
52033
52148
  return /*#__PURE__*/jsxRuntime.jsx(Loading, {});
52034
52149
  }
52035
52150
  if (invitationSuccess && !user.inviteToken) {
@@ -52038,106 +52153,29 @@ function AppInvitation(_ref) {
52038
52153
  children: isMobile ? null : /*#__PURE__*/jsxRuntime.jsx(DafButton, {
52039
52154
  type: "primary",
52040
52155
  className: "normal-br",
52156
+ style: theme || window.theme ? {
52157
+ backgroundColor: (theme || window.theme).colorPrimary,
52158
+ borderColor: (theme || window.theme).colorPrimary
52159
+ } : {},
52041
52160
  onClick: () => {
52042
52161
  window.location.href = loginPath;
52043
52162
  },
52044
52163
  children: t('Log In')
52045
52164
  })
52046
- }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
52047
- children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
52048
- name: "password",
52049
- layout: "vertical",
52050
- form: passwords,
52051
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, _objectSpread2(_objectSpread2({
52052
- required: true,
52053
- name: "password"
52054
- }, displayError('password')), {}, {
52055
- label: t("Password"),
52056
- rules: [{
52057
- required: true,
52058
- message: t("errors::password should not be empty")
52059
- }],
52060
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.Password, {
52061
- size: "large",
52062
- placeholder: t("Password")
52063
- })
52064
- })), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, _objectSpread2(_objectSpread2({
52065
- required: true,
52066
- name: "confirmPassword"
52067
- }, displayError('confirmPassword')), {}, {
52068
- label: t("Confirm Password"),
52069
- dependencies: ['password'],
52070
- rules: [{
52071
- required: true,
52072
- message: t("errors::password should not be empty")
52073
- }, _ref2 => {
52074
- let {
52075
- getFieldValue
52076
- } = _ref2;
52077
- return {
52078
- validator(rule, value) {
52079
- if (!value || getFieldValue('password') === value) {
52080
- return Promise.resolve();
52081
- }
52082
- return Promise.reject(t('errors::passwordNotMatch'));
52083
- }
52084
- };
52085
- }],
52086
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Input.Password, {
52087
- size: "large",
52088
- placeholder: t("Confirm Password")
52089
- })
52090
- })), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
52091
- name: "mailUpdates",
52092
- valuePropName: "checked",
52093
- noStyle: true,
52094
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52095
- children: t("Sign up to receive updates")
52096
- })
52097
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
52098
- name: "agreeTerms",
52099
- valuePropName: "checked",
52100
- noStyle: true,
52101
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
52102
- checked: termsAgreed,
52103
- onChange: e => setTermsAgreed(e.target.checked),
52104
- children: /*#__PURE__*/jsxRuntime.jsx("p", {
52105
- className: "mb-0",
52106
- children: t('Agree to the Terms of Use of this application and the Privacy Policy')
52107
- })
52108
- })
52109
- })]
52110
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
52111
- className: "buttons",
52112
- children: /*#__PURE__*/jsxRuntime.jsx(DafButton, {
52113
- className: "normal-br",
52114
- type: "primary",
52115
- block: true,
52116
- size: "large",
52117
- disabled: !termsAgreed,
52118
- onClick: () => {
52119
- passwords.validateFields().then(data => {
52120
- const {
52121
- password,
52122
- mailUpdates
52123
- } = data;
52124
- confirmInvitation({
52125
- password,
52126
- mailUpdates
52127
- }, () => {}, {
52128
- companyCode,
52129
- userCode
52130
- });
52131
- setPasswordReseted(true);
52132
- });
52133
- },
52134
- children: t("Confirm")
52135
- })
52136
- })]
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
52137
52176
  })
52138
52177
  });
52139
52178
  if (Layout) {
52140
- // Assuming Layout accepts these props as per Nashiriki AuthLayout
52141
52179
  return /*#__PURE__*/jsxRuntime.jsx(Layout, {
52142
52180
  app: app,
52143
52181
  step: 1,
@@ -52159,11 +52197,7 @@ function AppInvitation(_ref) {
52159
52197
  }), Content]
52160
52198
  });
52161
52199
  }
52162
- return user ? /*#__PURE__*/jsxRuntime.jsx(Navigate, {
52163
- to: appRedirectPath
52164
- }) : /*#__PURE__*/jsxRuntime.jsx(Navigate, {
52165
- to: redirectPath
52166
- });
52200
+ return null;
52167
52201
  }
52168
52202
 
52169
52203
  /**
@@ -52476,7 +52510,7 @@ const getRangeOfTicks = max => {
52476
52510
  };
52477
52511
 
52478
52512
  const {
52479
- useToken: useToken$6
52513
+ useToken: useToken$8
52480
52514
  } = antd.theme;
52481
52515
  function useUserGrowth({
52482
52516
  container,
@@ -52488,8 +52522,7 @@ function useUserGrowth({
52488
52522
  const [data, setData] = React.useState([]);
52489
52523
  const {
52490
52524
  token
52491
- } = useToken$6();
52492
- console.log("mainData", mainData);
52525
+ } = useToken$8();
52493
52526
  const fetchData = () => {
52494
52527
  const {
52495
52528
  dates = []
@@ -52625,12 +52658,11 @@ function UserGrowth({
52625
52658
  t,
52626
52659
  translationKeys
52627
52660
  });
52628
- console.log("usergrowthhhhh", data);
52629
52661
  React.useEffect(() => {
52630
52662
  if (typeof fetchUserGrowth === "function") {
52631
52663
  fetchUserGrowth(selectValue);
52632
52664
  }
52633
- }, [selectValue]);
52665
+ }, [selectValue, fetchUserGrowth]);
52634
52666
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
52635
52667
  title: t(`admin::user-growth`),
52636
52668
  loading: loading,
@@ -52664,7 +52696,7 @@ function UserGrowth({
52664
52696
  }
52665
52697
 
52666
52698
  const {
52667
- useToken: useToken$5
52699
+ useToken: useToken$7
52668
52700
  } = antd.theme;
52669
52701
  function useTopContributors({
52670
52702
  container,
@@ -52674,7 +52706,7 @@ function useTopContributors({
52674
52706
  const [mainGraph, setMainGraph] = React.useState(null);
52675
52707
  const {
52676
52708
  token
52677
- } = useToken$5();
52709
+ } = useToken$7();
52678
52710
  React.useEffect(() => {
52679
52711
  if (container.current) {
52680
52712
  if (mainGraph) {
@@ -52753,7 +52785,6 @@ function TopContributors({
52753
52785
  data,
52754
52786
  t
52755
52787
  });
52756
- console.log("topcontributorshhhh", data);
52757
52788
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
52758
52789
  title: t(`admin::top-contributors`),
52759
52790
  className: "with-border-header overflow-hidden h-w-btn-header",
@@ -52885,6 +52916,7 @@ function AdminTable({
52885
52916
  breadcrumbs,
52886
52917
  children
52887
52918
  }) {
52919
+ console.log(tabs, "tabs");
52888
52920
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
52889
52921
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
52890
52922
  className: "semibold form-input-output daf-create-view",
@@ -52898,7 +52930,7 @@ function AdminTable({
52898
52930
  className: "mt-6 ml-6 mr-6",
52899
52931
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
52900
52932
  className: "flex flex-row",
52901
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
52933
+ children: [tabs && tabs.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
52902
52934
  className: "mr-2",
52903
52935
  children: /*#__PURE__*/jsxRuntime.jsx(Tabs, {
52904
52936
  t: t,
@@ -53149,7 +53181,7 @@ const renderTypeTag = ({
53149
53181
  });
53150
53182
  };
53151
53183
 
53152
- const getColumns$7 = ({
53184
+ const getColumns$9 = ({
53153
53185
  t,
53154
53186
  show = "show",
53155
53187
  selectOptions,
@@ -53423,11 +53455,11 @@ const getColumns$7 = ({
53423
53455
  }];
53424
53456
  return cols.filter(c => c[show]);
53425
53457
  };
53426
- const checkboxConfig$b = {
53458
+ const checkboxConfig$d = {
53427
53459
  name: "Name",
53428
53460
  datastakeId: "ID"
53429
53461
  };
53430
- const selectFiltersConfig$b = {
53462
+ const selectFiltersConfig$d = {
53431
53463
  account: {
53432
53464
  type: "select",
53433
53465
  label: "Account",
@@ -53468,12 +53500,12 @@ const selectFiltersConfig$b = {
53468
53500
  getValue: option => option.value
53469
53501
  }
53470
53502
  };
53471
- const filtersConfig$b = {
53503
+ const filtersConfig$d = {
53472
53504
  name: "",
53473
53505
  datastakeId: ""
53474
53506
  };
53475
53507
  const view$2 = "admin-users";
53476
- const defaultUrlParams$4 = {
53508
+ const defaultUrlParams$5 = {
53477
53509
  activeTab: "active"
53478
53510
  };
53479
53511
  const defaultTableFilters$2 = {};
@@ -53520,6 +53552,7 @@ function useAdminTable({
53520
53552
  defaultPageSize: defaultPageSize || 20,
53521
53553
  getRedirectLink
53522
53554
  });
53555
+ console.log(filter, "filter.activeFilters");
53523
53556
  const activeTab = React.useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
53524
53557
  const canClearSearch = React.useMemo(() => {
53525
53558
  return !!filter.activeFilters.search;
@@ -53551,6 +53584,7 @@ function useAdminTable({
53551
53584
  const params = filterParams({
53552
53585
  activeFilters: filter.activeFilters
53553
53586
  });
53587
+ console.log(params, "params");
53554
53588
  const {
53555
53589
  data
53556
53590
  } = await getData({
@@ -53617,11 +53651,11 @@ function UserTable(_ref) {
53617
53651
  } = useAdminTable({
53618
53652
  goTo,
53619
53653
  location,
53620
- selectFiltersConfig: selectFiltersConfig$b,
53654
+ selectFiltersConfig: selectFiltersConfig$d,
53621
53655
  view: view$2,
53622
- defaultUrlParams: defaultUrlParams$4,
53656
+ defaultUrlParams: defaultUrlParams$5,
53623
53657
  module,
53624
- filtersConfig: filtersConfig$b,
53658
+ filtersConfig: filtersConfig$d,
53625
53659
  getRedirectLink,
53626
53660
  getData,
53627
53661
  defaultPageSize,
@@ -53634,7 +53668,7 @@ function UserTable(_ref) {
53634
53668
  role: config.userRoles.filter(c => !c.isForAppAdmin)
53635
53669
  };
53636
53670
  }, [config.userRoles, config.accountTypes, accounts]);
53637
- const columns = React.useMemo(() => getColumns$7({
53671
+ const columns = React.useMemo(() => getColumns$9({
53638
53672
  t,
53639
53673
  show: activeTab,
53640
53674
  selectOptions,
@@ -53690,7 +53724,7 @@ function UserTable(_ref) {
53690
53724
  hasError: hasError,
53691
53725
  setHasError: setHasError,
53692
53726
  canClearSearch: canClearSearch,
53693
- checkboxConfig: checkboxConfig$b,
53727
+ checkboxConfig: checkboxConfig$d,
53694
53728
  defaultTableFilters: defaultTableFilters$2,
53695
53729
  children: /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
53696
53730
  columns: columns,
@@ -53699,7 +53733,7 @@ function UserTable(_ref) {
53699
53733
  pagination: filter.pagination,
53700
53734
  selectOptions: selectOptions,
53701
53735
  setShowFilters: setShowFilters,
53702
- filtersConfig: selectFiltersConfig$b,
53736
+ filtersConfig: selectFiltersConfig$d,
53703
53737
  onFilterChange: filter.onFiltersChange,
53704
53738
  showFilters: showFilters,
53705
53739
  defaultFilters: filter.defaultFilters,
@@ -53730,7 +53764,7 @@ function UserTable(_ref) {
53730
53764
  });
53731
53765
  }
53732
53766
 
53733
- const getColumns$6 = ({
53767
+ const getColumns$8 = ({
53734
53768
  t,
53735
53769
  goTo,
53736
53770
  show = "show",
@@ -53996,11 +54030,7 @@ const getColumns$6 = ({
53996
54030
  })
53997
54031
  });
53998
54032
  }
53999
- const moreMenuItems = !val.emailVerified ? [{
54000
- label: t("admin::cancel-invitation"),
54001
- value: "cancel",
54002
- onClick: () => onCanelVerification(val)
54003
- }] : [{
54033
+ const moreMenuItems = [{
54004
54034
  label: t("Edit"),
54005
54035
  value: "edit",
54006
54036
  onClick: () => setAddAccountVisible(val)
@@ -54027,11 +54057,11 @@ const getColumns$6 = ({
54027
54057
  }];
54028
54058
  return cols.filter(c => c[show]);
54029
54059
  };
54030
- const checkboxConfig$a = {
54060
+ const checkboxConfig$c = {
54031
54061
  name: "Name",
54032
54062
  datastakeId: "ID"
54033
54063
  };
54034
- const selectFiltersConfig$a = {
54064
+ const selectFiltersConfig$c = {
54035
54065
  type: {
54036
54066
  type: "select",
54037
54067
  label: "Type",
@@ -54059,12 +54089,12 @@ const selectFiltersConfig$a = {
54059
54089
  getValue: option => option.value
54060
54090
  }
54061
54091
  };
54062
- const filtersConfig$a = {
54092
+ const filtersConfig$c = {
54063
54093
  name: "",
54064
54094
  datastakeId: ""
54065
54095
  };
54066
54096
  const view$1 = "accounts";
54067
- const defaultUrlParams$3 = {
54097
+ const defaultUrlParams$4 = {
54068
54098
  activeTab: "active"
54069
54099
  };
54070
54100
  const defaultTableFilters$1 = {};
@@ -54083,7 +54113,7 @@ const getTabs$2 = ({
54083
54113
  label: t("Suspended")
54084
54114
  }];
54085
54115
 
54086
- const getColumns$5 = ({
54116
+ const getColumns$7 = ({
54087
54117
  t,
54088
54118
  selectOptions,
54089
54119
  module
@@ -54190,7 +54220,7 @@ const Container = styled__default["default"].div`
54190
54220
  `;
54191
54221
 
54192
54222
  const {
54193
- useToken: useToken$4
54223
+ useToken: useToken$6
54194
54224
  } = antd.theme;
54195
54225
  function CombineAccountModal({
54196
54226
  isOpen,
@@ -54203,10 +54233,10 @@ function CombineAccountModal({
54203
54233
  }) {
54204
54234
  const {
54205
54235
  token
54206
- } = useToken$4();
54236
+ } = useToken$6();
54207
54237
  const [MainForm] = antd.Form.useForm();
54208
54238
  const columns = React.useMemo(() => {
54209
- return getColumns$5({
54239
+ return getColumns$7({
54210
54240
  t,
54211
54241
  selectOptions,
54212
54242
  module
@@ -54341,37 +54371,60 @@ function NewAccount({
54341
54371
  t,
54342
54372
  isOpen,
54343
54373
  onClose,
54344
- accountTypes = [],
54374
+ accountTypes,
54345
54375
  fetchData,
54346
- inviteAccount
54376
+ updateAccount,
54377
+ inviteAccount,
54378
+ isPending = false,
54379
+ accountToEdit
54347
54380
  }) {
54348
54381
  const [MainForm] = antd.Form.useForm();
54349
54382
  const [loading, setLoading] = React.useState(false);
54350
54383
  const [accountUsed, setAccountUsed] = React.useState(false);
54351
- const isEdit = React.useMemo(() => isOpen && typeof isOpen === "object", [isOpen]);
54384
+ console.log("typesssssssss", accountToEdit);
54385
+ const isEdit = React.useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
54352
54386
  React.useEffect(() => {
54353
- if (isOpen && typeof isOpen === "object") {
54387
+ if (accountToEdit && typeof accountToEdit === "object") {
54354
54388
  MainForm.setFieldsValue({
54355
- name: isOpen.name,
54356
- email: isOpen?.admin?.email
54389
+ name: accountToEdit.name,
54390
+ email: accountToEdit.email,
54391
+ type: accountToEdit?.otherData?.interface
54357
54392
  });
54358
54393
  } else {
54359
54394
  MainForm.resetFields();
54360
54395
  }
54361
- }, [isOpen, MainForm]);
54362
- const onSubmit = () => {
54363
- MainForm.validateFields().then(async val => {
54364
- try {
54365
- 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
+ }
54366
54414
  await inviteAccount(val);
54367
- setLoading(false);
54368
- fetchData();
54369
- onClose();
54370
- } catch (err) {
54371
- console.log(err);
54372
- setLoading(false);
54373
54415
  }
54374
- }).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
+ }
54375
54428
  };
54376
54429
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
54377
54430
  t: t,
@@ -54393,16 +54446,6 @@ function NewAccount({
54393
54446
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
54394
54447
  placeholder: t("Type")
54395
54448
  })
54396
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54397
- name: "type",
54398
- label: t("Type"),
54399
- rules: [{
54400
- required: true
54401
- }],
54402
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
54403
- placeholder: t("Select"),
54404
- options: accountTypes
54405
- })
54406
54449
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54407
54450
  name: "email",
54408
54451
  label: t("Email"),
@@ -54411,12 +54454,17 @@ function NewAccount({
54411
54454
  type: "email"
54412
54455
  }],
54413
54456
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
54414
- placeholder: t("Type"),
54415
- onChange: () => {
54416
- if (accountUsed) {
54417
- setAccountUsed(false);
54418
- }
54419
- }
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 || []
54420
54468
  })
54421
54469
  }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
54422
54470
  message: t("FB00001"),
@@ -54445,6 +54493,7 @@ function AccountTable(_ref) {
54445
54493
  actionButton,
54446
54494
  inviteAccount
54447
54495
  } = _ref;
54496
+ const accountTypes = config === null || config === void 0 ? void 0 : config.accountTypes;
54448
54497
  const [showFilters, setShowFilters] = React.useState(false);
54449
54498
  const [hasError, setHasError] = React.useState(false);
54450
54499
  const [selectedAccounts, setSelectedAccounts] = React.useState([]);
@@ -54462,12 +54511,12 @@ function AccountTable(_ref) {
54462
54511
  } = useAdminTable({
54463
54512
  goTo,
54464
54513
  location,
54465
- selectFiltersConfig: selectFiltersConfig$a,
54514
+ selectFiltersConfig: selectFiltersConfig$c,
54466
54515
  view: view$1,
54467
- defaultUrlParams: defaultUrlParams$3,
54516
+ defaultUrlParams: defaultUrlParams$4,
54468
54517
  module,
54469
54518
  defaultPageSize,
54470
- filtersConfig: filtersConfig$a,
54519
+ filtersConfig: filtersConfig$c,
54471
54520
  getRedirectLink,
54472
54521
  getData,
54473
54522
  fetchPendingOnMount: true
@@ -54476,9 +54525,9 @@ function AccountTable(_ref) {
54476
54525
  var _config$options;
54477
54526
  return {
54478
54527
  country: (_config$options = config.options) === null || _config$options === void 0 ? void 0 : _config$options.countries,
54479
- type: config.accountTypes
54528
+ type: accountTypes
54480
54529
  };
54481
- }, [config.options, config.accountTypes]);
54530
+ }, [config.options, accountTypes]);
54482
54531
  React.useEffect(() => {
54483
54532
  if (initFetchDone) {
54484
54533
  filter.setActiveFilters(_objectSpread2(_objectSpread2({}, filter.activeFilters), {}, {
@@ -54510,7 +54559,16 @@ function AccountTable(_ref) {
54510
54559
  onCancel: () => {}
54511
54560
  });
54512
54561
  }, [t, fetchData, fetchPendingAccounts]);
54513
- 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({
54514
54572
  t,
54515
54573
  show: activeTab,
54516
54574
  selectOptions,
@@ -54519,7 +54577,7 @@ function AccountTable(_ref) {
54519
54577
  getRedirectLink,
54520
54578
  onCanelVerification: onCanelVerification,
54521
54579
  onCopyInvitation: config.onTableClick.onCopyInvitation,
54522
- onResendInvitation: config.onTableClick.onResendInvitation,
54580
+ onResendInvitation: onResendInvitation,
54523
54581
  setAddAccountVisible: config.onTableClick.setAddAccountVisible,
54524
54582
  setSelectedAccounts: setSelectedAccounts,
54525
54583
  selectedAccounts: selectedAccounts
@@ -54529,13 +54587,15 @@ function AccountTable(_ref) {
54529
54587
  filters: filter,
54530
54588
  t: t,
54531
54589
  headerTitle: headerTitle,
54532
- actionButton: [...actionButton, {
54533
- icon: "Merge",
54534
- // type: "primary",
54535
- onClick: () => setCombineAccountVisible(true),
54536
- tooltip: "Combine",
54537
- disabled: selectedAccounts.length < 2
54538
- }],
54590
+ actionButton: [...actionButton
54591
+ // {
54592
+ // icon: "Merge",
54593
+ // // type: "primary",
54594
+ // onClick: () => setCombineAccountVisible(true),
54595
+ // tooltip: "Combine",
54596
+ // disabled: selectedAccounts.length < 2,
54597
+ // },
54598
+ ],
54539
54599
  tabs: getTabs$2({
54540
54600
  totalPending: totalPending,
54541
54601
  t
@@ -54548,7 +54608,7 @@ function AccountTable(_ref) {
54548
54608
  setHasError: setHasError,
54549
54609
  canClearSearch: canClearSearch,
54550
54610
  selectOptions: selectOptions,
54551
- checkboxConfig: checkboxConfig$a,
54611
+ checkboxConfig: checkboxConfig$c,
54552
54612
  defaultTableFilters: defaultTableFilters$1,
54553
54613
  children: [selectedAccounts.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
54554
54614
  className: "flex flex-row ml-6 mt-5",
@@ -54579,7 +54639,7 @@ function AccountTable(_ref) {
54579
54639
  doEmptyRows: true,
54580
54640
  selectOptions: selectOptions,
54581
54641
  setShowFilters: setShowFilters,
54582
- filtersConfig: selectFiltersConfig$a,
54642
+ filtersConfig: selectFiltersConfig$c,
54583
54643
  onFilterChange: filter.onFiltersChange,
54584
54644
  showFilters: showFilters,
54585
54645
  defaultFilters: filter.defaultFilters,
@@ -54595,7 +54655,7 @@ function AccountTable(_ref) {
54595
54655
  fetchData();
54596
54656
  fetchPendingAccounts();
54597
54657
  },
54598
- accountTypes: config.accountTypes,
54658
+ accountTypes: accountTypes,
54599
54659
  inviteAccount: inviteAccount
54600
54660
  }), /*#__PURE__*/jsxRuntime.jsx(CombineAccountModal, {
54601
54661
  isOpen: combineAccountVisible,
@@ -54629,7 +54689,7 @@ const getTabs$1 = ({
54629
54689
  label: t("Suspended")
54630
54690
  }];
54631
54691
  };
54632
- const selectFiltersConfig$9 = {
54692
+ const selectFiltersConfig$b = {
54633
54693
  category: {
54634
54694
  type: "select",
54635
54695
  label: "Category",
@@ -54670,14 +54730,14 @@ const selectFiltersConfig$9 = {
54670
54730
  getValue: option => option.value
54671
54731
  }
54672
54732
  };
54673
- const filtersConfig$9 = {
54733
+ const filtersConfig$b = {
54674
54734
  name: "",
54675
54735
  datastakeId: ""
54676
54736
  };
54677
- const defaultUrlParams$2 = {
54737
+ const defaultUrlParams$3 = {
54678
54738
  activeTab: "active"
54679
54739
  };
54680
- const checkboxConfig$9 = {
54740
+ const checkboxConfig$b = {
54681
54741
  name: "Name",
54682
54742
  datastakeId: "ID"
54683
54743
  };
@@ -54687,7 +54747,7 @@ const getAdminLevelName = (data, level) => {
54687
54747
  return entry?.name || "-";
54688
54748
  };
54689
54749
 
54690
- const getColumns$4 = ({
54750
+ const getColumns$6 = ({
54691
54751
  t,
54692
54752
  goTo = () => {},
54693
54753
  show = "show",
@@ -54910,7 +54970,7 @@ const getColumns$4 = ({
54910
54970
  return cols.filter(c => c[show]);
54911
54971
  };
54912
54972
 
54913
- const getColumns$3 = ({
54973
+ const getColumns$5 = ({
54914
54974
  t,
54915
54975
  selectOptions,
54916
54976
  module,
@@ -55001,7 +55061,7 @@ const getColumns$3 = ({
55001
55061
  };
55002
55062
 
55003
55063
  const {
55004
- useToken: useToken$3
55064
+ useToken: useToken$5
55005
55065
  } = antd.theme;
55006
55066
  function CombineLocationModal({
55007
55067
  isOpen,
@@ -55015,11 +55075,11 @@ function CombineLocationModal({
55015
55075
  }) {
55016
55076
  const {
55017
55077
  token
55018
- } = useToken$3();
55078
+ } = useToken$5();
55019
55079
  const [MainForm] = antd.Form.useForm();
55020
55080
  const [isDisabled, setIsDisabled] = React.useState(true);
55021
55081
  const columns = React.useMemo(() => {
55022
- return getColumns$3({
55082
+ return getColumns$5({
55023
55083
  t,
55024
55084
  selectOptions,
55025
55085
  module,
@@ -55172,7 +55232,7 @@ function CombineLocationModal({
55172
55232
 
55173
55233
  const _excluded$2 = ["pagination", "tab", "filters", "search", "sort"];
55174
55234
  const {
55175
- useToken: useToken$2
55235
+ useToken: useToken$4
55176
55236
  } = antd.theme;
55177
55237
  function LocationTable(_ref) {
55178
55238
  let {
@@ -55198,7 +55258,7 @@ function LocationTable(_ref) {
55198
55258
  const [selectedLocations, setSelectedLocations] = React.useState([]);
55199
55259
  const {
55200
55260
  token
55201
- } = useToken$2();
55261
+ } = useToken$4();
55202
55262
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
55203
55263
  const getDataWithStringPagination = async _ref2 => {
55204
55264
  let {
@@ -55223,6 +55283,14 @@ function LocationTable(_ref) {
55223
55283
  console.error('Failed to parse pagination', e);
55224
55284
  }
55225
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;
55226
55294
  let activeTab = tab || "active";
55227
55295
  if (!tab && filters) {
55228
55296
  try {
@@ -55234,8 +55302,8 @@ function LocationTable(_ref) {
55234
55302
  }
55235
55303
  const transformedParams = {
55236
55304
  pagination: {
55237
- skip: String(paginationObj.page || 1),
55238
- take: String(paginationObj.pageSize || 20)
55305
+ skip: pageNumber,
55306
+ take: pageSize
55239
55307
  },
55240
55308
  tab: activeTab
55241
55309
  };
@@ -55257,12 +55325,12 @@ function LocationTable(_ref) {
55257
55325
  } = useAdminTable({
55258
55326
  goTo,
55259
55327
  location,
55260
- selectFiltersConfig: selectFiltersConfig$9,
55328
+ selectFiltersConfig: selectFiltersConfig$b,
55261
55329
  view,
55262
- defaultUrlParams: defaultUrlParams$2,
55330
+ defaultUrlParams: defaultUrlParams$3,
55263
55331
  module,
55264
55332
  defaultPageSize,
55265
- filtersConfig: filtersConfig$9,
55333
+ filtersConfig: filtersConfig$b,
55266
55334
  getRedirectLink,
55267
55335
  getData: getDataWithStringPagination,
55268
55336
  refetchTrigger
@@ -55276,7 +55344,7 @@ function LocationTable(_ref) {
55276
55344
  };
55277
55345
  }, [config.options]);
55278
55346
  const columns = React.useMemo(() => {
55279
- return getColumns$4({
55347
+ return getColumns$6({
55280
55348
  t,
55281
55349
  goTo,
55282
55350
  token,
@@ -55312,7 +55380,7 @@ function LocationTable(_ref) {
55312
55380
  setHasError: setHasError,
55313
55381
  canClearSearch: canClearSearch,
55314
55382
  selectOptions: selectOptions,
55315
- checkboxConfig: checkboxConfig$9,
55383
+ checkboxConfig: checkboxConfig$b,
55316
55384
  defaultTableFilters: {},
55317
55385
  breadcrumbs: breadcrumbs,
55318
55386
  children: [selectedLocations.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -55344,7 +55412,7 @@ function LocationTable(_ref) {
55344
55412
  selectOptions: selectOptions,
55345
55413
  doEmptyRows: true,
55346
55414
  setShowFilters: setShowFilters,
55347
- filtersConfig: selectFiltersConfig$9,
55415
+ filtersConfig: selectFiltersConfig$b,
55348
55416
  onFilterChange: filter.onFiltersChange,
55349
55417
  showFilters: showFilters,
55350
55418
  defaultFilters: filter.defaultFilters,
@@ -55388,7 +55456,7 @@ const getTabs = ({
55388
55456
  label: t("Suspended")
55389
55457
  }];
55390
55458
  };
55391
- const selectFiltersConfig$8 = {
55459
+ const selectFiltersConfig$a = {
55392
55460
  category: {
55393
55461
  type: "select",
55394
55462
  label: "Category",
@@ -55429,19 +55497,19 @@ const selectFiltersConfig$8 = {
55429
55497
  getValue: option => option.value
55430
55498
  }
55431
55499
  };
55432
- const filtersConfig$8 = {
55500
+ const filtersConfig$a = {
55433
55501
  name: "",
55434
55502
  datastakeId: ""
55435
55503
  };
55436
- const defaultUrlParams$1 = {
55504
+ const defaultUrlParams$2 = {
55437
55505
  activeTab: "active"
55438
55506
  };
55439
- const checkboxConfig$8 = {
55507
+ const checkboxConfig$a = {
55440
55508
  name: "Name",
55441
55509
  datastakeId: "ID"
55442
55510
  };
55443
55511
 
55444
- const getColumns$2 = ({
55512
+ const getColumns$4 = ({
55445
55513
  t,
55446
55514
  goTo = () => {},
55447
55515
  show = "show",
@@ -55682,7 +55750,7 @@ const mapToSelectOptions = (items, valueKey, selectOptions, optionKey, customMap
55682
55750
  }).filter((option, index, self) => index === self.findIndex(o => o.value === option.value));
55683
55751
  };
55684
55752
 
55685
- const getColumns$1 = ({
55753
+ const getColumns$3 = ({
55686
55754
  t,
55687
55755
  selectOptions,
55688
55756
  module,
@@ -55773,7 +55841,7 @@ const getColumns$1 = ({
55773
55841
  };
55774
55842
 
55775
55843
  const {
55776
- useToken: useToken$1
55844
+ useToken: useToken$3
55777
55845
  } = antd.theme;
55778
55846
  function CombineSubjectsModal({
55779
55847
  isOpen,
@@ -55787,11 +55855,11 @@ function CombineSubjectsModal({
55787
55855
  }) {
55788
55856
  const {
55789
55857
  token
55790
- } = useToken$1();
55858
+ } = useToken$3();
55791
55859
  const [MainForm] = antd.Form.useForm();
55792
55860
  const [isDisabled, setIsDisabled] = React.useState(true);
55793
55861
  const columns = React.useMemo(() => {
55794
- return getColumns$1({
55862
+ return getColumns$3({
55795
55863
  t,
55796
55864
  selectOptions,
55797
55865
  module,
@@ -55802,6 +55870,8 @@ function CombineSubjectsModal({
55802
55870
  const onSubmit = () => {
55803
55871
  MainForm.validateFields().then(data => {
55804
55872
  const ids = selectedSubjects.map(subject => subject.id);
55873
+ console.log(ids, "ids");
55874
+ console.log(data, "data");
55805
55875
  onSuccess({
55806
55876
  ids,
55807
55877
  data
@@ -55864,7 +55934,10 @@ function CombineSubjectsModal({
55864
55934
  className: "flex-1",
55865
55935
  name: "id",
55866
55936
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
55867
- options: mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null),
55937
+ options: selectedSubjects.map(s => ({
55938
+ label: s?.datastakeId || "-",
55939
+ value: s?.id || "-"
55940
+ })),
55868
55941
  placeholder: t("ID")
55869
55942
  })
55870
55943
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
@@ -55927,7 +56000,7 @@ function CombineSubjectsModal({
55927
56000
 
55928
56001
  const _excluded$1 = ["pagination", "tab", "filters", "search", "sort"];
55929
56002
  const {
55930
- useToken
56003
+ useToken: useToken$2
55931
56004
  } = antd.theme;
55932
56005
  function SubjectsTable(_ref) {
55933
56006
  let {
@@ -55953,7 +56026,7 @@ function SubjectsTable(_ref) {
55953
56026
  const [selectedSubjects, setSelectedSubjects] = React.useState([]);
55954
56027
  const {
55955
56028
  token
55956
- } = useToken();
56029
+ } = useToken$2();
55957
56030
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
55958
56031
  const getDataWithStringPagination = async _ref2 => {
55959
56032
  let {
@@ -55978,6 +56051,14 @@ function SubjectsTable(_ref) {
55978
56051
  console.error('Failed to parse pagination', e);
55979
56052
  }
55980
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;
55981
56062
  let activeTab = tab || "active";
55982
56063
  if (!tab && filters) {
55983
56064
  try {
@@ -55989,8 +56070,8 @@ function SubjectsTable(_ref) {
55989
56070
  }
55990
56071
  const transformedParams = {
55991
56072
  pagination: {
55992
- skip: String(paginationObj.page || 1),
55993
- take: String(paginationObj.pageSize || 20)
56073
+ skip: pageNumber,
56074
+ take: pageSize
55994
56075
  },
55995
56076
  tab: activeTab
55996
56077
  };
@@ -56012,12 +56093,12 @@ function SubjectsTable(_ref) {
56012
56093
  } = useAdminTable({
56013
56094
  goTo,
56014
56095
  location,
56015
- selectFiltersConfig: selectFiltersConfig$8,
56096
+ selectFiltersConfig: selectFiltersConfig$a,
56016
56097
  view,
56017
- defaultUrlParams: defaultUrlParams$1,
56098
+ defaultUrlParams: defaultUrlParams$2,
56018
56099
  module,
56019
56100
  defaultPageSize,
56020
- filtersConfig: filtersConfig$8,
56101
+ filtersConfig: filtersConfig$a,
56021
56102
  getRedirectLink,
56022
56103
  getData: getDataWithStringPagination,
56023
56104
  refetchTrigger
@@ -56031,7 +56112,7 @@ function SubjectsTable(_ref) {
56031
56112
  };
56032
56113
  }, [config.options]);
56033
56114
  const columns = React.useMemo(() => {
56034
- return getColumns$2({
56115
+ return getColumns$4({
56035
56116
  t,
56036
56117
  goTo,
56037
56118
  token,
@@ -56052,7 +56133,7 @@ function SubjectsTable(_ref) {
56052
56133
  actionButton: [{
56053
56134
  icon: "Merge",
56054
56135
  onClick: () => setIsModalOpen(true),
56055
- tooltip: t("admin::merge-subjects"),
56136
+ tooltip: t("merge-subjects"),
56056
56137
  disabled: selectedSubjects.length < 2
56057
56138
  }],
56058
56139
  tabs: getTabs({
@@ -56066,7 +56147,7 @@ function SubjectsTable(_ref) {
56066
56147
  setHasError: setHasError,
56067
56148
  canClearSearch: canClearSearch,
56068
56149
  selectOptions: selectOptions,
56069
- checkboxConfig: checkboxConfig$8,
56150
+ checkboxConfig: checkboxConfig$a,
56070
56151
  defaultTableFilters: {},
56071
56152
  breadcrumbs: breadcrumbs,
56072
56153
  children: [selectedSubjects.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -56098,7 +56179,7 @@ function SubjectsTable(_ref) {
56098
56179
  selectOptions: selectOptions,
56099
56180
  doEmptyRows: true,
56100
56181
  setShowFilters: setShowFilters,
56101
- filtersConfig: selectFiltersConfig$8,
56182
+ filtersConfig: selectFiltersConfig$a,
56102
56183
  onFilterChange: filter.onFiltersChange,
56103
56184
  showFilters: showFilters,
56104
56185
  defaultFilters: filter.defaultFilters,
@@ -56111,11 +56192,13 @@ function SubjectsTable(_ref) {
56111
56192
  onSuccess: data => {
56112
56193
  setIsModalOpen(false);
56113
56194
  setLoading(true);
56114
- antd.message.success(t("Subjects successfully merged."));
56115
56195
  if (typeof mergeSubjectsFunction === 'function') {
56116
- mergeSubjectsFunction(data).finally(() => {
56196
+ mergeSubjectsFunction(data).then(() => {
56197
+ setTimeout(() => {
56198
+ fetchData();
56199
+ }, 500);
56200
+ }).finally(() => {
56117
56201
  setSelectedSubjects([]);
56118
- fetchData();
56119
56202
  });
56120
56203
  }
56121
56204
  },
@@ -56232,7 +56315,7 @@ function TransferRights({
56232
56315
  };
56233
56316
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
56234
56317
  t: t,
56235
- title: t("admin::transfer-admin-rights"),
56318
+ title: t("admin::transfer-account-admin-rights"),
56236
56319
  open: isOpen,
56237
56320
  onClose: onClose,
56238
56321
  loading: loading,
@@ -56282,11 +56365,16 @@ function NewUser({
56282
56365
  module = "straatos",
56283
56366
  inviteCompanyAccount = () => {},
56284
56367
  companyId,
56285
- handleError = () => {}
56368
+ handleError = () => {},
56369
+ existingEmails = []
56286
56370
  }) {
56287
56371
  const [MainForm] = antd.Form.useForm();
56288
56372
  const [accountUsed, setAccountUsed] = React.useState(false);
56289
56373
  const [loading, setLoading] = React.useState(false);
56374
+ const checkEmailExists = email => {
56375
+ if (!email) return false;
56376
+ return existingEmails.includes(email.toLowerCase());
56377
+ };
56290
56378
  React.useEffect(() => {
56291
56379
  if (defaultData) {
56292
56380
  MainForm.setFieldsValue({
@@ -56298,6 +56386,10 @@ function NewUser({
56298
56386
  const onSubmit = async () => {
56299
56387
  try {
56300
56388
  const val = await MainForm.validateFields();
56389
+ if (checkEmailExists(val.email)) {
56390
+ setAccountUsed(true);
56391
+ return;
56392
+ }
56301
56393
  setLoading(true);
56302
56394
  const apiPayload = {
56303
56395
  firstName: val.firstName,
@@ -56314,7 +56406,8 @@ function NewUser({
56314
56406
  });
56315
56407
  const localUserData = {
56316
56408
  ...apiPayload,
56317
- status: 'pending'
56409
+ status: 'pending',
56410
+ id: apiPayload.email // Add a unique ID for the table key
56318
56411
  // apps: {
56319
56412
  // [module]: {
56320
56413
  // role: val.role,
@@ -56372,12 +56465,22 @@ function NewUser({
56372
56465
  }],
56373
56466
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
56374
56467
  placeholder: t("Type"),
56375
- onChange: () => {
56376
- if (accountUsed) {
56377
- setAccountUsed(false);
56378
- }
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);
56379
56475
  }
56380
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)
56381
56484
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56382
56485
  name: "role",
56383
56486
  label: t("Role"),
@@ -56397,34 +56500,31 @@ const renderStatus = ({
56397
56500
  val,
56398
56501
  t = s => s
56399
56502
  }) => {
56400
- // switch (val) {
56401
- // case "active":
56402
- // return <Tag color="green">{t("Active")}</Tag>;
56403
- // case "unsaved":
56404
- // return <Tag color="red">{t("Unsaved")}</Tag>;
56405
- // case "inactive":
56406
- // case "suspended":
56407
- // return <Tag color="red">{t("Suspended")}</Tag>;
56408
- // case "pending":
56409
- // return <Tag color="orange">{t("Pending")}</Tag>;
56410
- // default:
56411
- // return <Tag color="default">{t("Unknown")}</Tag>;
56412
- // }
56413
-
56414
- if (val) {
56503
+ if (val === 'pending') {
56415
56504
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56416
- color: "green",
56417
- children: t("Active")
56505
+ color: "orange",
56506
+ children: t("Pending")
56418
56507
  });
56419
- } else {
56508
+ }
56509
+ if (val === 'unsaved') {
56420
56510
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56421
56511
  color: "red",
56422
- 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")
56423
56519
  });
56424
56520
  }
56521
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
56522
+ color: "red",
56523
+ children: t("Suspended")
56524
+ });
56425
56525
  };
56426
56526
 
56427
- const getColumns = ({
56527
+ const getColumns$2 = ({
56428
56528
  t,
56429
56529
  isView,
56430
56530
  selectOptions = {},
@@ -56596,8 +56696,8 @@ const getColumns = ({
56596
56696
  }];
56597
56697
  return cols.filter(v => v.show);
56598
56698
  };
56599
- const checkboxConfig$7 = {};
56600
- const selectFiltersConfig$7 = {
56699
+ const checkboxConfig$9 = {};
56700
+ const selectFiltersConfig$9 = {
56601
56701
  userRole: {
56602
56702
  type: "select",
56603
56703
  label: "Role",
@@ -56625,10 +56725,10 @@ const selectFiltersConfig$7 = {
56625
56725
  getValue: option => option.value
56626
56726
  }
56627
56727
  };
56628
- const filtersConfig$7 = {
56728
+ const filtersConfig$9 = {
56629
56729
  search: ""
56630
56730
  };
56631
- const defaultUrlParams = {
56731
+ const defaultUrlParams$1 = {
56632
56732
  search: "",
56633
56733
  userRole: null,
56634
56734
  status: null
@@ -56673,10 +56773,10 @@ function Users({
56673
56773
  } = useFilters({
56674
56774
  goTo,
56675
56775
  location,
56676
- selectFiltersConfig: selectFiltersConfig$7,
56677
- defaultUrlParams,
56776
+ selectFiltersConfig: selectFiltersConfig$9,
56777
+ defaultUrlParams: defaultUrlParams$1,
56678
56778
  module,
56679
- filtersConfig: filtersConfig$7,
56779
+ filtersConfig: filtersConfig$9,
56680
56780
  getRedirectLink
56681
56781
  });
56682
56782
  const selectOptions = React.useMemo(() => {
@@ -56690,9 +56790,14 @@ function Users({
56690
56790
  }, [activeFilters]);
56691
56791
  const onDeleteUserClick = React.useCallback(id => {
56692
56792
  antd.Modal.confirm({
56693
- title: t("sbg-admin::remove-user-title"),
56793
+ title: t("Are-you-sure-you-want-to-remove-the-user-from-this-account?"),
56694
56794
  icon: /*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleOutlined, {}),
56695
- 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
+ }),
56696
56801
  okText: t("Yes"),
56697
56802
  cancelText: t("No"),
56698
56803
  onOk: () => {
@@ -56703,9 +56808,14 @@ function Users({
56703
56808
  }, [deleteUser]);
56704
56809
  const data = React.useMemo(() => {
56705
56810
  const {
56706
- users = []
56811
+ users = [],
56812
+ pendingUsers = []
56707
56813
  } = accountData;
56708
- 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
+ }))];
56709
56819
  if (!isEmptyOrSpaces(activeFilters.search)) {
56710
56820
  const search = activeFilters.search.toLowerCase();
56711
56821
  filtered = filtered.filter(u => `${u.firstName} ${u.lastName}`.toLowerCase().indexOf(search) !== -1 || u.email.toLowerCase().indexOf(search) !== -1);
@@ -56721,7 +56831,7 @@ function Users({
56721
56831
  isAdmin: accountData?.admin?.id === user?.id
56722
56832
  }));
56723
56833
  }, [accountData, activeFilters]);
56724
- const columns = React.useMemo(() => getColumns({
56834
+ const columns = React.useMemo(() => getColumns$2({
56725
56835
  t,
56726
56836
  isView,
56727
56837
  selectOptions,
@@ -56741,7 +56851,7 @@ function Users({
56741
56851
  hasError: hasError,
56742
56852
  setHasError: setHasError,
56743
56853
  filtersConfig: newFiltersConfig,
56744
- checkboxConfig: checkboxConfig$7,
56854
+ checkboxConfig: checkboxConfig$9,
56745
56855
  onSearch: onSearch,
56746
56856
  activeFilters: activeFilters,
56747
56857
  canClear: canClearSearch,
@@ -56761,7 +56871,7 @@ function Users({
56761
56871
  selectOptions: selectOptions,
56762
56872
  setShowFilters: setShowFilters,
56763
56873
  sourcesKey: "authorId",
56764
- filtersConfig: selectFiltersConfig$7,
56874
+ filtersConfig: selectFiltersConfig$9,
56765
56875
  onFilterChange: onFiltersChange,
56766
56876
  showFilters: showFilters,
56767
56877
  defaultFilters: defaultFilters,
@@ -56783,7 +56893,8 @@ function Users({
56783
56893
  module: module,
56784
56894
  inviteCompanyAccount: inviteCompanyAccount,
56785
56895
  companyId: companyId,
56786
- handleError: handleError
56896
+ handleError: handleError,
56897
+ existingEmails: [...(accountData?.users || []).map(u => u.email?.toLowerCase()), ...(accountData?.pendingUsers || []).map(u => u.email?.toLowerCase())].filter(Boolean)
56787
56898
  })]
56788
56899
  });
56789
56900
  }
@@ -56811,6 +56922,20 @@ class AdminService extends BaseService {
56811
56922
  data
56812
56923
  });
56813
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
+ }
56814
56939
  inviteAccount(data) {
56815
56940
  return this.apiPost({
56816
56941
  url: `/accounts/inviteAccount`,
@@ -56827,8 +56952,15 @@ class AdminService extends BaseService {
56827
56952
  }
56828
56953
  updateAccount({
56829
56954
  data,
56830
- id
56955
+ id,
56956
+ isPending = false
56831
56957
  }) {
56958
+ if (isPending) {
56959
+ return this.apiPut({
56960
+ data,
56961
+ url: `/accounts/invitation/${id}`
56962
+ });
56963
+ }
56832
56964
  return this.apiPut({
56833
56965
  data,
56834
56966
  url: `/accounts/${id}`
@@ -56943,6 +57075,21 @@ class AdminService extends BaseService {
56943
57075
  url: `/management/subject/${subject}/${id}`
56944
57076
  });
56945
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
+ }
56946
57093
  viewLocation({
56947
57094
  id
56948
57095
  }) {
@@ -56965,7 +57112,7 @@ class AdminService extends BaseService {
56965
57112
  const type = subject === 'location' ? 'location' : 'stakeholder';
56966
57113
  return this.apiPut({
56967
57114
  url: `/management/subject/${type}/${id}`,
56968
- data: filterCreateData(data)
57115
+ data: data
56969
57116
  });
56970
57117
  }
56971
57118
  deleteSubject({
@@ -56977,14 +57124,25 @@ class AdminService extends BaseService {
56977
57124
  url: `/management/subject/${type}/${id}`
56978
57125
  });
56979
57126
  }
56980
- getUserGrowth(activeFilter) {
56981
- return this.apiGet({
57127
+ async getUserGrowth(activeFilter) {
57128
+ const {
57129
+ data
57130
+ } = await this.apiGet({
56982
57131
  url: `/accounts/dashboard/user-growth`,
56983
57132
  isUserManager: true,
56984
57133
  params: {
56985
57134
  activeFilter
56986
57135
  }
56987
57136
  });
57137
+ return data;
57138
+ }
57139
+ removeUserFromAccount({
57140
+ accountId,
57141
+ userId
57142
+ }) {
57143
+ return this.apiPut({
57144
+ url: `/companies/${accountId}/remove-user/${userId}`
57145
+ });
56988
57146
  }
56989
57147
  }
56990
57148
  var AdminService$1 = createLazyService(AdminService);
@@ -57201,11 +57359,18 @@ function Edit({
57201
57359
  removeCheck();
57202
57360
  }
57203
57361
  }, [isChanged, addCheck, removeCheck]);
57204
- const deleteUser = React.useCallback(id => {
57205
- // TODO: add call
57206
- console.log("DELETE", id);
57207
- fetchData();
57208
- }, [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]);
57209
57374
  const updateUser = React.useCallback((id, val) => {
57210
57375
  setIsChanged(true);
57211
57376
  setData(prev => ({
@@ -57233,9 +57398,14 @@ function Edit({
57233
57398
  }, []);
57234
57399
  const onSuspend = () => {
57235
57400
  antd.Modal.confirm({
57236
- title: t("sbg-admin::suspend-title"),
57401
+ title: t("Are-you-sure-you-want-to-suspend-this-account?"),
57237
57402
  icon: /*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleOutlined, {}),
57238
- 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
+ }),
57239
57409
  okText: t("Yes"),
57240
57410
  cancelText: t("No"),
57241
57411
  onOk: async () => {
@@ -57551,13 +57721,15 @@ function AdminView(_ref) {
57551
57721
  } = user,
57552
57722
  userDataToInvite = _objectWithoutProperties(user, _excluded2);
57553
57723
  console.log('Sending invitation for:', user.email, userDataToInvite);
57554
- await inviteCompanyAccount({
57555
- companyId: editData.id,
57556
- data: _objectSpread2(_objectSpread2({}, userDataToInvite), {}, {
57557
- pendingCompanyId
57558
- })
57559
- });
57560
- 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);
57561
57733
  } catch (inviteError) {
57562
57734
  console.error('Failed to invite user:', user.email, inviteError);
57563
57735
  handleError(inviteError);
@@ -57666,8 +57838,7 @@ function AdminDashboardScreen({
57666
57838
  }), [data?.keyIndicators, data?.keyInformation, getRedirectLink, getKeyIndicatorsConfig]);
57667
57839
  const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
57668
57840
  const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
57669
- const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
57670
- console.log("safeUserGrowth", safeUserGrowth);
57841
+ const safeUserGrowth = userGrowthData || data?.userGrowthData || [];
57671
57842
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
57672
57843
  t: t,
57673
57844
  goTo: goTo,
@@ -57676,6 +57847,7 @@ function AdminDashboardScreen({
57676
57847
  loadingUserGrowth: userGrowthDataLoading,
57677
57848
  fetchUserGrowth: fetchUserGrowth,
57678
57849
  adminTranslationIdentifier: appName,
57850
+ userGrowthData: safeUserGrowth,
57679
57851
  data: {
57680
57852
  keyIndicatorsData: keyIndicatorsConfig,
57681
57853
  userActivityData: safeUserActivity,
@@ -57775,6 +57947,77 @@ function AdminUsersScreen({
57775
57947
  });
57776
57948
  }
57777
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
+
57778
58021
  function AdminAccountsScreen({
57779
58022
  config
57780
58023
  }) {
@@ -57790,31 +58033,50 @@ function AdminAccountsScreen({
57790
58033
  AdminService,
57791
58034
  options,
57792
58035
  useQuery,
57793
- NewAccountModal
58036
+ NewAccountModal,
58037
+ appUrl
57794
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
+
57795
58045
  const AccountModal = NewAccountModal || NewAccount;
57796
58046
  const query = useQuery ? useQuery() : {
57797
58047
  get: () => null
57798
58048
  };
57799
58049
  const [addAccountVisible, setAddAccountVisible] = React.useState(!!query.get("create"));
57800
- const onResendInvitation = React.useCallback(() => {
57801
- antd.message.success(t("Invitation email resent"));
57802
- }, [t]);
57803
- const onCopyInvitation = React.useCallback(() => {
57804
- antd.message.success(t("Invitation link copied"));
57805
- }, [t]);
58050
+ const [accountToEdit, setAccountToEdit] = React.useState(null);
57806
58051
  const actionButtons = React.useMemo(() => [{
57807
58052
  type: "primary",
57808
58053
  onClick: () => setAddAccountVisible(true),
57809
58054
  tooltip: t("Add"),
57810
58055
  icon: "Add"
57811
58056
  }], [t]);
58057
+ function handleAccountModal(data) {
58058
+ console.log(data, "data");
58059
+ setAddAccountVisible(true);
58060
+ setAccountToEdit(data);
58061
+ }
57812
58062
  function handleGetData(params) {
57813
58063
  return AdminService.getAccounts(params);
57814
58064
  }
57815
58065
  function handleCancelVerification(token) {
57816
58066
  return AdminService.cancelInvitation(token);
57817
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
+ }
57818
58080
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
57819
58081
  children: [/*#__PURE__*/jsxRuntime.jsx(AccountTable, {
57820
58082
  t: t,
@@ -57828,23 +58090,38 @@ function AdminAccountsScreen({
57828
58090
  getData: handleGetData,
57829
58091
  config: {
57830
58092
  accountTypes,
58093
+ addAccountVisible,
57831
58094
  options: {
57832
58095
  countries: options?.countries
57833
58096
  },
57834
58097
  onTableClick: {
57835
58098
  onCanelVerification: handleCancelVerification,
57836
- onCopyInvitation,
57837
- onResendInvitation,
57838
- setAddAccountVisible
58099
+ onCopyInvitation: handleCopyInvitation,
58100
+ onResendInvitation: handleResendInvitation,
58101
+ setAddAccountVisible: handleAccountModal
57839
58102
  }
57840
58103
  }
57841
58104
  }), /*#__PURE__*/jsxRuntime.jsx(AccountModal, {
57842
58105
  t: t,
57843
58106
  isOpen: addAccountVisible,
57844
- onClose: () => setAddAccountVisible(false),
58107
+ onClose: () => {
58108
+ setAddAccountVisible(false);
58109
+ setAccountToEdit(null);
58110
+ },
57845
58111
  accountTypes: accountTypes,
58112
+ countriesOptions: options?.countries,
57846
58113
  fetchData: () => {},
57847
- 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
57848
58125
  })]
57849
58126
  });
57850
58127
  }
@@ -57968,7 +58245,7 @@ function AdminSubjectsScreen({
57968
58245
  });
57969
58246
  }
57970
58247
 
57971
- function AdminLocationScreen({
58248
+ function AdminLocationScreen$1({
57972
58249
  config
57973
58250
  }) {
57974
58251
  const {
@@ -58040,6 +58317,855 @@ function AdminLocationScreen({
58040
58317
  });
58041
58318
  }
58042
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
+
58043
59169
  function getAdminRoutes(config) {
58044
59170
  const {
58045
59171
  appName,
@@ -58051,6 +59177,8 @@ function getAdminRoutes(config) {
58051
59177
  useAdminLocationConfig,
58052
59178
  useAdminSubjectsViewConfig,
58053
59179
  useAdminLocationViewConfig,
59180
+ useAdminDocumentsConfig,
59181
+ useAdminEventsConfig,
58054
59182
  userIsAdmin
58055
59183
  } = config;
58056
59184
  const APP_PREFIX = "APP_".concat(appName.toUpperCase());
@@ -58086,11 +59214,23 @@ function getAdminRoutes(config) {
58086
59214
  }
58087
59215
  function LocationWrapper() {
58088
59216
  const locationConfig = typeof useAdminLocationConfig === "function" ? useAdminLocationConfig() : undefined;
58089
- return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen, {
59217
+ return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen$1, {
58090
59218
  config: locationConfig
58091
59219
  });
58092
59220
  }
58093
- 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", {});
58094
59234
  const routes = [{
58095
59235
  path: "",
58096
59236
  key: "".concat(APP_PREFIX, "_DASHBOARD"),
@@ -58133,6 +59273,18 @@ function getAdminRoutes(config) {
58133
59273
  exact: true,
58134
59274
  visible: user => userIsAdmin(user),
58135
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, {})
58136
59288
  }] : [])];
58137
59289
  return routes;
58138
59290
  }
@@ -64391,7 +65543,7 @@ exports.AdminAccountsScreen = AdminAccountsScreen;
64391
65543
  exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
64392
65544
  exports.AdminDashboard = AdminDashboard;
64393
65545
  exports.AdminDashboardScreen = AdminDashboardScreen;
64394
- exports.AdminLocationScreen = AdminLocationScreen;
65546
+ exports.AdminLocationScreen = AdminLocationScreen$1;
64395
65547
  exports.AdminSubjectsScreen = AdminSubjectsScreen;
64396
65548
  exports.AdminUsersScreen = AdminUsersScreen;
64397
65549
  exports.AdminView = AdminView$1;