datastake-daf 0.6.847 → 0.6.849

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 (56) hide show
  1. package/dist/components/index.js +191 -57
  2. package/dist/hooks/index.js +9 -8
  3. package/dist/pages/index.js +5216 -5489
  4. package/dist/services/index.js +11 -11
  5. package/dist/utils/index.js +23 -12
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +1 -1
  8. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +59 -77
  9. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +1 -8
  10. package/src/@daf/core/components/Screens/TableScreen/StandardTablePage/index.jsx +108 -0
  11. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -2
  12. package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +13 -3
  13. package/src/@daf/hooks/useSources.js +6 -4
  14. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/config.js +3 -0
  15. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +69 -4
  16. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +29 -92
  17. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +59 -34
  18. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +36 -69
  19. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/hook.js +56 -0
  20. package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +50 -75
  21. package/src/@daf/pages/Dashboards/ConflictManagement/index.js +14 -14
  22. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +46 -51
  23. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +20 -20
  24. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +26 -2
  25. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +0 -1
  26. package/src/@daf/pages/Dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +2 -1
  27. package/src/@daf/pages/Dashboards/UserDashboard/index.jsx +1 -0
  28. package/src/@daf/pages/Dashboards/helper.js +25 -20
  29. package/src/@daf/pages/Edit/index.jsx +3 -0
  30. package/src/@daf/pages/Partners/columns.js +2 -2
  31. package/src/@daf/pages/Partners/config.js +22 -0
  32. package/src/@daf/pages/Partners/hook.js +7 -11
  33. package/src/@daf/pages/Partners/index.jsx +128 -140
  34. package/src/@daf/pages/ResetPassword/index.jsx +2 -3
  35. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +3 -2
  36. package/src/@daf/pages/TablePage/hook.js +51 -42
  37. package/src/@daf/pages/TablePage/index.jsx +95 -61
  38. package/src/@daf/{core/components/Screens → pages}/Users/columns.js +15 -10
  39. package/src/@daf/{core/components/Screens → pages}/Users/config.js +6 -16
  40. package/src/@daf/{core/components/Screens → pages}/Users/create.jsx +1 -1
  41. package/src/@daf/pages/Users/index.jsx +129 -0
  42. package/src/@daf/pages/View/hooks/useCallToGetData.js +5 -1
  43. package/src/@daf/pages/View/index.jsx +6 -3
  44. package/src/@daf/pages/hook.js +26 -7
  45. package/src/@daf/services/EventsService.js +2 -2
  46. package/src/@daf/services/MineSiteService.js +2 -2
  47. package/src/@daf/services/OperatorService.js +2 -2
  48. package/src/@daf/services/PartnerService.js +2 -2
  49. package/src/@daf/services/SourceService.js +1 -1
  50. package/src/@daf/services/WorkersService.js +2 -2
  51. package/src/constants/locales/fr/translation.js +23 -11
  52. package/src/constants/locales/sp/translation.js +1 -0
  53. package/src/index.js +1 -1
  54. package/src/pages.js +1 -1
  55. package/dist/style/datastake/mapbox-gl.css +0 -330
  56. package/src/@daf/core/components/Screens/Users/index.jsx +0 -173
@@ -25847,7 +25847,7 @@ class SourceService extends BaseService {
25847
25847
  ...rest
25848
25848
  } = filters;
25849
25849
  const params = {
25850
- filters: rest,
25850
+ ...rest,
25851
25851
  pagination: {
25852
25852
  skip: page,
25853
25853
  take: pageSize
@@ -54425,55 +54425,26 @@ const getColumns$8 = ({
54425
54425
  onCopyInvitation = () => {},
54426
54426
  onResendInvitation = () => {},
54427
54427
  onCanelVerification = () => {},
54428
- setAddAccountVisible = () => {},
54429
- setSelectedAccounts = () => {},
54430
- selectedAccounts = []
54428
+ setAddAccountVisible = () => {}
54431
54429
  }) => {
54432
54430
  const cols = [{
54433
- title: "",
54434
- dataIndex: "select",
54435
- key: "select",
54436
- width: 50,
54437
- active: true,
54438
- pending: true,
54439
- suspended: true,
54440
- show: true,
54441
- render: (v, all) => {
54442
- if (all.empty) {
54443
- return /*#__PURE__*/jsxRuntime.jsx("div", {
54444
- className: "daf-default-cell"
54445
- });
54446
- }
54447
- return /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
54448
- onChange: () => setSelectedAccounts(prev => {
54449
- const isSelected = prev.some(p => p.userId === all.userId);
54450
- if (isSelected) {
54451
- return prev.filter(p => p.userId !== all.userId);
54452
- }
54453
- return [...prev, all];
54454
- }),
54455
- checked: selectedAccounts.some(p => p.userId === all.userId),
54456
- disabled: selectedAccounts.length >= 3 && !selectedAccounts.some(p => p.userId === all.userId)
54457
- });
54458
- }
54459
- }, {
54460
54431
  title: t("ID"),
54461
- dataIndex: "userId",
54462
54432
  key: "userId",
54433
+ ellipsis: true,
54434
+ width: 160,
54463
54435
  active: true,
54464
54436
  pending: true,
54465
54437
  suspended: true,
54466
- ellipsis: true,
54467
- width: 160,
54468
- render: (v, all) => {
54438
+ render: (_, all) => {
54469
54439
  if (all.empty) {
54470
54440
  return /*#__PURE__*/jsxRuntime.jsx("div", {
54471
54441
  className: "daf-default-cell"
54472
54442
  });
54473
54443
  }
54444
+ const id = all.status === "pending" ? all.users?.[0]?.userId ?? all.invitedUser?.userId ?? all.datastakeId ?? "--" : all.userId ?? "--";
54474
54445
  return /*#__PURE__*/jsxRuntime.jsx("div", {
54475
54446
  className: "daf-default-cell",
54476
- children: v || "--"
54447
+ children: id
54477
54448
  });
54478
54449
  }
54479
54450
  }, {
@@ -54489,19 +54460,18 @@ const getColumns$8 = ({
54489
54460
  pending: true,
54490
54461
  suspended: true
54491
54462
  }, {
54492
- title: t("type"),
54493
- dataIndex: "apps",
54494
- key: "apps",
54495
- render: (apps, all) => {
54463
+ title: t("Type"),
54464
+ key: "type",
54465
+ render: (_, all) => {
54496
54466
  if (all.empty) {
54497
54467
  return /*#__PURE__*/jsxRuntime.jsx("div", {
54498
54468
  className: "daf-default-cell"
54499
54469
  });
54500
54470
  }
54501
- const sbg = all?.interface ? all : (apps || []).find(a => a.app === module);
54471
+ const typeValue = all.status === "pending" ? all.type ?? all.otherData?.interface : all.apps?.[0]?.interface;
54502
54472
  return renderTypeTag({
54503
- value: sbg?.interface,
54504
- label: findOptions(sbg?.interface, selectOptions.type)
54473
+ value: typeValue,
54474
+ label: findOptions(typeValue, selectOptions.type)
54505
54475
  });
54506
54476
  },
54507
54477
  active: true,
@@ -54576,7 +54546,8 @@ const getColumns$8 = ({
54576
54546
  className: "daf-default-cell"
54577
54547
  });
54578
54548
  }
54579
- return verified ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
54549
+ const isVerified = all.users?.[0]?.emailVerified ?? verified ?? all.emailVerfied;
54550
+ return isVerified ? /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
54580
54551
  color: "green",
54581
54552
  children: t("Yes")
54582
54553
  }) : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
@@ -56996,7 +56967,7 @@ function NewUser({
56996
56967
  const localUserData = {
56997
56968
  ...apiPayload,
56998
56969
  status: 'pending',
56999
- id: apiPayload.email // Add a unique ID for the table key
56970
+ id: apiPayload.email
57000
56971
  // apps: {
57001
56972
  // [module]: {
57002
56973
  // role: val.role,
@@ -58062,14 +58033,6 @@ function AdminView(_ref) {
58062
58033
  id: editData.id,
58063
58034
  data: newData
58064
58035
  });
58065
- console.log({
58066
- data
58067
- });
58068
- console.log('Checking for pending users...', {
58069
- hasPendingUsers: pendingUsers.length > 0,
58070
- hasInviteFunction: !!inviteCompanyAccount,
58071
- pendingUsers: pendingUsers
58072
- });
58073
58036
  if (pendingUsers.length > 0 && inviteCompanyAccount) {
58074
58037
  console.log('Inviting pending users:', pendingUsers.length);
58075
58038
  for (const user of pendingUsers) {
@@ -58079,8 +58042,6 @@ function AdminView(_ref) {
58079
58042
  status
58080
58043
  } = user,
58081
58044
  userDataToInvite = _objectWithoutProperties(user, _excluded2);
58082
- console.log('Sending invitation for:', user.email, userDataToInvite);
58083
- // Use the standalone invite function, don't mix it with updateAccount
58084
58045
  // await inviteCompanyAccount({
58085
58046
  // companyId: editData.id,
58086
58047
  // data: {
@@ -65382,7 +65343,7 @@ const Style$1 = styled__default["default"].div`
65382
65343
  margin-top: 28px;
65383
65344
  }
65384
65345
  `;
65385
- function ResetPassword({
65346
+ function ResetPassword$1({
65386
65347
  config = {},
65387
65348
  onPasswordChange,
65388
65349
  t = key => key
@@ -65567,7 +65528,7 @@ function EditForm({
65567
65528
  if (input.disabled) {
65568
65529
  return null;
65569
65530
  }
65570
- return /*#__PURE__*/jsxRuntime.jsx(ResetPassword, {
65531
+ return /*#__PURE__*/jsxRuntime.jsx(ResetPassword$1, {
65571
65532
  config: config,
65572
65533
  t: t
65573
65534
  }, input.key);
@@ -65901,6 +65862,178 @@ function Settings(_ref) {
65901
65862
  });
65902
65863
  }
65903
65864
 
65865
+ const step = 1;
65866
+ function ResetPassword(_ref) {
65867
+ let {
65868
+ resetRequestSuccedded,
65869
+ resetRequestError,
65870
+ submitting,
65871
+ requestResetPassword,
65872
+ resetPassword,
65873
+ params: propParams = {},
65874
+ Layout,
65875
+ goTo,
65876
+ t,
65877
+ theme,
65878
+ errors,
65879
+ loginPath: loginPathProp
65880
+ } = _ref;
65881
+ const {
65882
+ app,
65883
+ confirmationToken
65884
+ } = propParams;
65885
+ const getLogInLink = () => {
65886
+ if (loginPathProp) return loginPathProp;
65887
+ if (app) return "/".concat(app, "/login");
65888
+ return "/login";
65889
+ };
65890
+ const handleGoToLogin = () => {
65891
+ const link = getLogInLink();
65892
+ if (goTo && typeof goTo === "function") {
65893
+ goTo(link);
65894
+ } else {
65895
+ window.location.href = link;
65896
+ }
65897
+ };
65898
+ const title = !confirmationToken ? resetRequestSuccedded ? "Thank you" : "Reset Password" : resetRequestSuccedded ? "Password updated" : "Create Password";
65899
+ const subTitle = !confirmationToken ? resetRequestSuccedded ? "A password reset link has been sent to your email address. If you can’t find the message in your inbox, please check your spam folder!" : "Please enter your email, to get a link and request a new password." : resetRequestSuccedded ? "Your password has been updated, click in the button below to log in." : "Please set up your new password.";
65900
+ const requestResetFields = [{
65901
+ name: "email",
65902
+ label: t("Email"),
65903
+ type: "input",
65904
+ required: true,
65905
+ rules: [{
65906
+ required: true,
65907
+ message: t("errors::email should not be empty")
65908
+ }, {
65909
+ pattern: /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,
65910
+ message: t("errors::email is not valid")
65911
+ }],
65912
+ placeholder: t("Email")
65913
+ }];
65914
+ const resetPasswordFields = [{
65915
+ name: "password",
65916
+ label: t("Enter password"),
65917
+ type: "password",
65918
+ required: true,
65919
+ rules: [{
65920
+ required: true,
65921
+ message: t("errors::password should not be empty")
65922
+ }],
65923
+ placeholder: t("••••••••")
65924
+ }, {
65925
+ name: "confirmPassword",
65926
+ label: t("Confirm password"),
65927
+ type: "password",
65928
+ required: true,
65929
+ dependencies: ["password"],
65930
+ rules: [{
65931
+ required: true,
65932
+ message: t("errors::password should not be empty")
65933
+ }, _ref2 => {
65934
+ let {
65935
+ getFieldValue
65936
+ } = _ref2;
65937
+ return {
65938
+ validator(rule, value) {
65939
+ if (!value || getFieldValue("password") === value) {
65940
+ return Promise.resolve();
65941
+ }
65942
+ return Promise.reject(t("errors::passwordNotMatch"));
65943
+ }
65944
+ };
65945
+ }],
65946
+ placeholder: t("••••••••")
65947
+ }];
65948
+ const handleRequestResetSubmit = values => {
65949
+ requestResetPassword(values);
65950
+ };
65951
+ const handleResetPasswordSubmit = values => {
65952
+ resetPassword(_objectSpread2(_objectSpread2({}, values), {}, {
65953
+ passConfirmationToken: confirmationToken
65954
+ }));
65955
+ };
65956
+ const currentTheme = theme || window.theme;
65957
+ const Content = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
65958
+ children: [!resetRequestSuccedded && !confirmationToken && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
65959
+ children: [/*#__PURE__*/jsxRuntime.jsx(AuthForm, {
65960
+ fields: requestResetFields,
65961
+ onSubmit: handleRequestResetSubmit,
65962
+ submitText: t("Get Link"),
65963
+ errors: errors,
65964
+ t: t,
65965
+ executeRecaptcha: () => Promise.resolve(true),
65966
+ theme: currentTheme,
65967
+ submitButtonProps: {
65968
+ loading: submitting
65969
+ }
65970
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
65971
+ className: "mt-4",
65972
+ children: /*#__PURE__*/jsxRuntime.jsx(DafButton, {
65973
+ type: "default",
65974
+ className: "normal-br",
65975
+ style: currentTheme ? {
65976
+ borderColor: currentTheme.colorPrimary,
65977
+ color: currentTheme.colorPrimary
65978
+ } : {},
65979
+ onClick: handleGoToLogin,
65980
+ children: t("Back")
65981
+ })
65982
+ }), resetRequestError ? /*#__PURE__*/jsxRuntime.jsx("div", {
65983
+ className: "ant-form-item-explain errors-cont no-pt mt-3",
65984
+ style: {
65985
+ color: "#ff4d4f"
65986
+ },
65987
+ children: t(resetRequestError)
65988
+ }) : null]
65989
+ }), !resetRequestSuccedded && confirmationToken && /*#__PURE__*/jsxRuntime.jsx(AuthForm, {
65990
+ fields: resetPasswordFields,
65991
+ onSubmit: handleResetPasswordSubmit,
65992
+ submitText: t("Reset Password"),
65993
+ errors: errors,
65994
+ t: t,
65995
+ executeRecaptcha: () => Promise.resolve(true),
65996
+ theme: currentTheme,
65997
+ submitButtonProps: {
65998
+ loading: submitting
65999
+ }
66000
+ }), resetRequestSuccedded && confirmationToken && /*#__PURE__*/jsxRuntime.jsx("div", {
66001
+ className: "buttons",
66002
+ children: /*#__PURE__*/jsxRuntime.jsx(DafButton, {
66003
+ type: "primary",
66004
+ className: "normal-br",
66005
+ style: currentTheme ? {
66006
+ backgroundColor: currentTheme.colorPrimary,
66007
+ borderColor: currentTheme.colorPrimary
66008
+ } : {},
66009
+ onClick: handleGoToLogin,
66010
+ children: t("Log In")
66011
+ })
66012
+ }), resetRequestSuccedded && !confirmationToken && null]
66013
+ });
66014
+ if (Layout) {
66015
+ return /*#__PURE__*/jsxRuntime.jsx(Layout, {
66016
+ app: app,
66017
+ step: step,
66018
+ title: title,
66019
+ subTitle: subTitle,
66020
+ children: Content
66021
+ });
66022
+ }
66023
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
66024
+ style: {
66025
+ padding: 20,
66026
+ maxWidth: 400,
66027
+ margin: "0 auto"
66028
+ },
66029
+ children: [/*#__PURE__*/jsxRuntime.jsx("h2", {
66030
+ children: title
66031
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
66032
+ children: subTitle
66033
+ }), Content]
66034
+ });
66035
+ }
66036
+
65904
66037
  exports.ACTIVE_FORM_KEY = ACTIVE_FORM_KEY;
65905
66038
  exports.AccountTable = AccountTable;
65906
66039
  exports.ActionWidget = ActionWidget;
@@ -66008,6 +66141,7 @@ exports.ProjectWidget = ProjectWidget;
66008
66141
  exports.RadarChart = RadarChart;
66009
66142
  exports.RadialBarChart = RadialBarChart;
66010
66143
  exports.Records = Records;
66144
+ exports.ResetPassword = ResetPassword;
66011
66145
  exports.SDGIcons = SDGIcons;
66012
66146
  exports.SDGWidget = SDGWidget;
66013
66147
  exports.SearchFilters = SearchFilters;
@@ -1699,7 +1699,7 @@ class SourceService extends BaseService {
1699
1699
  ...rest
1700
1700
  } = filters;
1701
1701
  const params = {
1702
- filters: rest,
1702
+ ...rest,
1703
1703
  pagination: {
1704
1704
  skip: page,
1705
1705
  take: pageSize
@@ -1732,7 +1732,8 @@ function useSource({
1732
1732
  user = {},
1733
1733
  t = () => {},
1734
1734
  getData = () => {},
1735
- id
1735
+ id,
1736
+ stop
1736
1737
  }) {
1737
1738
  const [loading, setLoading] = React.useState(true);
1738
1739
  const [partners, setPartners] = React.useState([]);
@@ -1786,8 +1787,10 @@ function useSource({
1786
1787
  console.error("Error fetching partners:", error);
1787
1788
  }
1788
1789
  }
1789
- fetchPartners();
1790
- }, [user.language, id]);
1790
+ if (!stop) {
1791
+ fetchPartners();
1792
+ }
1793
+ }, [user.language, id, stop]);
1791
1794
  function handleSelectedPartnersChange(selected) {
1792
1795
  setSelectedPartners(prev => ({
1793
1796
  ...prev,
@@ -1813,9 +1816,6 @@ const useSources = ({
1813
1816
  stop
1814
1817
  }) => {
1815
1818
  function getData(params) {
1816
- if (stop) return Promise.resolve({
1817
- data: []
1818
- });
1819
1819
  if (id !== undefined && id !== null) {
1820
1820
  return SourceService$1.getSources({
1821
1821
  type,
@@ -1834,7 +1834,8 @@ const useSources = ({
1834
1834
  user,
1835
1835
  t,
1836
1836
  getData: getData,
1837
- id
1837
+ id,
1838
+ stop
1838
1839
  });
1839
1840
  const informationSources = partners?.length > 0 ? partners?.length - 1 : 0;
1840
1841
  return {