datastake-daf 0.6.846 → 0.6.848

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 (42) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/components/index.js +180 -4
  7. package/dist/hooks/index.js +4 -5
  8. package/dist/pages/index.js +1028 -866
  9. package/dist/services/index.js +11 -11
  10. package/dist/utils/index.js +14 -11
  11. package/package.json +1 -1
  12. package/src/@daf/core/components/Screens/TableScreen/StandardTablePage/index.jsx +108 -0
  13. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -2
  14. package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +13 -3
  15. package/src/@daf/hooks/useWidgetFetch.js +40 -34
  16. package/src/@daf/pages/Edit/index.jsx +3 -0
  17. package/src/@daf/pages/Partners/columns.js +2 -2
  18. package/src/@daf/pages/Partners/config.js +22 -0
  19. package/src/@daf/pages/Partners/hook.js +7 -11
  20. package/src/@daf/pages/Partners/index.jsx +128 -140
  21. package/src/@daf/pages/ResetPassword/index.jsx +2 -3
  22. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +3 -2
  23. package/src/@daf/pages/TablePage/hook.js +51 -42
  24. package/src/@daf/pages/TablePage/index.jsx +95 -61
  25. package/src/@daf/{core/components/Screens → pages}/Users/columns.js +15 -10
  26. package/src/@daf/{core/components/Screens → pages}/Users/create.jsx +2 -1
  27. package/src/@daf/pages/Users/index.jsx +128 -0
  28. package/src/@daf/pages/View/hooks/useCallToGetData.js +5 -1
  29. package/src/@daf/pages/View/index.jsx +6 -3
  30. package/src/@daf/pages/hook.js +26 -7
  31. package/src/@daf/services/EventsService.js +2 -2
  32. package/src/@daf/services/MineSiteService.js +2 -2
  33. package/src/@daf/services/OperatorService.js +2 -2
  34. package/src/@daf/services/PartnerService.js +2 -2
  35. package/src/@daf/services/SourceService.js +1 -1
  36. package/src/@daf/services/WorkersService.js +2 -2
  37. package/src/@daf/utils/timeFilterUtils.js +250 -233
  38. package/src/constants/locales/fr/translation.js +14 -11
  39. package/src/index.js +1 -1
  40. package/src/pages.js +1 -1
  41. package/src/@daf/core/components/Screens/Users/index.jsx +0 -173
  42. /package/src/@daf/{core/components/Screens → pages}/Users/config.js +0 -0
Binary file
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -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
@@ -42171,7 +42171,10 @@ const useCombinedPrefilledValues = (combinedPrefilledValues, values, parentValue
42171
42171
  }
42172
42172
  });
42173
42173
  if (hasChanges) {
42174
- setValues(prevValues => _objectSpread2(_objectSpread2({}, prevValues), resolvedValues));
42174
+ setValues(prevValues => ({
42175
+ ...prevValues,
42176
+ ...resolvedValues
42177
+ }));
42175
42178
  MainForm.setFieldsValue(resolvedValues);
42176
42179
  }
42177
42180
  }, [values, parentValues, combinedPrefilledValues, setValues, MainForm]);
@@ -65340,7 +65343,7 @@ const Style$1 = styled__default["default"].div`
65340
65343
  margin-top: 28px;
65341
65344
  }
65342
65345
  `;
65343
- function ResetPassword({
65346
+ function ResetPassword$1({
65344
65347
  config = {},
65345
65348
  onPasswordChange,
65346
65349
  t = key => key
@@ -65525,7 +65528,7 @@ function EditForm({
65525
65528
  if (input.disabled) {
65526
65529
  return null;
65527
65530
  }
65528
- return /*#__PURE__*/jsxRuntime.jsx(ResetPassword, {
65531
+ return /*#__PURE__*/jsxRuntime.jsx(ResetPassword$1, {
65529
65532
  config: config,
65530
65533
  t: t
65531
65534
  }, input.key);
@@ -65859,6 +65862,178 @@ function Settings(_ref) {
65859
65862
  });
65860
65863
  }
65861
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
+
65862
66037
  exports.ACTIVE_FORM_KEY = ACTIVE_FORM_KEY;
65863
66038
  exports.AccountTable = AccountTable;
65864
66039
  exports.ActionWidget = ActionWidget;
@@ -65966,6 +66141,7 @@ exports.ProjectWidget = ProjectWidget;
65966
66141
  exports.RadarChart = RadarChart;
65967
66142
  exports.RadialBarChart = RadialBarChart;
65968
66143
  exports.Records = Records;
66144
+ exports.ResetPassword = ResetPassword;
65969
66145
  exports.SDGIcons = SDGIcons;
65970
66146
  exports.SDGWidget = SDGWidget;
65971
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
@@ -2295,6 +2295,7 @@ var DashboardService$1 = createLazyService(DashboardService);
2295
2295
  // url: string
2296
2296
  // basePath: string,
2297
2297
  // }
2298
+
2298
2299
  const useWidgetFetch = ({
2299
2300
  config,
2300
2301
  getData = DashboardService$1.getWidget,
@@ -2313,7 +2314,7 @@ const useWidgetFetch = ({
2313
2314
  const {
2314
2315
  data
2315
2316
  } = await getData(rest);
2316
- setData(data);
2317
+ setData(data || defaultData);
2317
2318
  if (isErrorResponse(data)) {
2318
2319
  const errorMessage = getErrorMessage(data);
2319
2320
  antd.message.error(errorMessage);
@@ -2322,13 +2323,11 @@ const useWidgetFetch = ({
2322
2323
  onFetch();
2323
2324
  } catch (err) {
2324
2325
  console.log(err);
2325
- } finally {
2326
- setLoading(false);
2327
2326
  }
2327
+ setLoading(false);
2328
2328
  };
2329
2329
  React.useEffect(() => {
2330
2330
  if (!stop) {
2331
- console.log('fetching data');
2332
2331
  fetchData();
2333
2332
  }
2334
2333
  }, [JSON.stringify(config), stop]);