@strapi/plugin-users-permissions 5.0.0-beta.16 → 5.0.0-beta.17

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 (36) hide show
  1. package/admin/src/components/Permissions/PermissionRow/SubCategory.jsx +2 -2
  2. package/admin/src/pages/Providers/index.jsx +1 -1
  3. package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +1 -1
  4. package/dist/_chunks/{index-GRvR2Ufg.js → index-B3Yss4_X.js} +8 -8
  5. package/dist/_chunks/{index-GRvR2Ufg.js.map → index-B3Yss4_X.js.map} +1 -1
  6. package/dist/_chunks/{index-Bk2QJpV0.mjs → index-B6yBcJnO.mjs} +3 -3
  7. package/dist/_chunks/index-B6yBcJnO.mjs.map +1 -0
  8. package/dist/_chunks/{index-B38p2u_S.mjs → index-BAJGMzXv.mjs} +4 -4
  9. package/dist/_chunks/index-BAJGMzXv.mjs.map +1 -0
  10. package/dist/_chunks/{index-Cl-Izig3.js → index-BaDNXywU.js} +3 -3
  11. package/dist/_chunks/index-BaDNXywU.js.map +1 -0
  12. package/dist/_chunks/{index-B4UZW3Xs.mjs → index-BjBAUX-X.mjs} +2 -2
  13. package/dist/_chunks/{index-B4UZW3Xs.mjs.map → index-BjBAUX-X.mjs.map} +1 -1
  14. package/dist/_chunks/{index-D650mZNK.js → index-CSTRwxO1.js} +8 -8
  15. package/dist/_chunks/index-CSTRwxO1.js.map +1 -0
  16. package/dist/_chunks/{index-DGmf44kb.mjs → index-CU8gSdhZ.mjs} +3 -3
  17. package/dist/_chunks/{index-DGmf44kb.mjs.map → index-CU8gSdhZ.mjs.map} +1 -1
  18. package/dist/_chunks/{index-D_FhYNtQ.js → index-CyFC4O8A.js} +4 -4
  19. package/dist/_chunks/{index-D_FhYNtQ.js.map → index-CyFC4O8A.js.map} +1 -1
  20. package/dist/_chunks/{index-txiSTl89.mjs → index-Cz5OWx31.mjs} +8 -8
  21. package/dist/_chunks/{index-txiSTl89.mjs.map → index-Cz5OWx31.mjs.map} +1 -1
  22. package/dist/_chunks/{index--gftNN7z.js → index-DJ9BXKML.js} +2 -2
  23. package/dist/_chunks/{index--gftNN7z.js.map → index-DJ9BXKML.js.map} +1 -1
  24. package/dist/_chunks/{index-3zwKJbP6-CFuKTauZ.mjs → index-Hmzyjkc3-BHUgmsKx.mjs} +52 -74
  25. package/dist/_chunks/index-Hmzyjkc3-BHUgmsKx.mjs.map +1 -0
  26. package/dist/_chunks/{index-3zwKJbP6-D4dU4aLL.js → index-Hmzyjkc3-qR3QHvSP.js} +54 -76
  27. package/dist/_chunks/index-Hmzyjkc3-qR3QHvSP.js.map +1 -0
  28. package/dist/admin/index.js +1 -1
  29. package/dist/admin/index.mjs +1 -1
  30. package/package.json +4 -4
  31. package/dist/_chunks/index-3zwKJbP6-CFuKTauZ.mjs.map +0 -1
  32. package/dist/_chunks/index-3zwKJbP6-D4dU4aLL.js.map +0 -1
  33. package/dist/_chunks/index-B38p2u_S.mjs.map +0 -1
  34. package/dist/_chunks/index-Bk2QJpV0.mjs.map +0 -1
  35. package/dist/_chunks/index-Cl-Izig3.js.map +0 -1
  36. package/dist/_chunks/index-D650mZNK.js.map +0 -1
@@ -14,6 +14,8 @@ import { unstable_batchedUpdates } from "react-dom";
14
14
  import createNextState2, { enableES5, isDraftable, isDraft, enablePatches, applyPatches, produceWithPatches, original, produce } from "immer";
15
15
  import { shallowEqual, batch, useDispatch, useSelector, useStore } from "react-redux";
16
16
  import pipe from "lodash/fp/pipe";
17
+ import clone from "lodash/clone";
18
+ import toPath from "lodash/toPath";
17
19
  import isEqual from "lodash/isEqual";
18
20
  import "lodash/defaultsDeep";
19
21
  import { createGlobalStyle, styled } from "styled-components";
@@ -22,8 +24,6 @@ import "lodash/get";
22
24
  import "lodash/set";
23
25
  import "lodash/camelCase";
24
26
  import * as yup from "yup";
25
- import clone from "lodash/clone";
26
- import toPath from "lodash/toPath";
27
27
  import "lodash/omit";
28
28
  import "formik";
29
29
  import "lodash/throttle";
@@ -8762,6 +8762,46 @@ React.createContext({
8762
8762
  toggleNotification: () => {
8763
8763
  }
8764
8764
  });
8765
+ function getIn(obj, key, def, pathStartIndex = 0) {
8766
+ const path = toPath(key);
8767
+ while (obj && pathStartIndex < path.length) {
8768
+ obj = obj[path[pathStartIndex++]];
8769
+ }
8770
+ if (pathStartIndex !== path.length && !obj) {
8771
+ return def;
8772
+ }
8773
+ return obj === void 0 ? def : obj;
8774
+ }
8775
+ const isObject = (obj) => obj !== null && typeof obj === "object" && !Array.isArray(obj);
8776
+ const isInteger = (obj) => String(Math.floor(Number(obj))) === obj;
8777
+ function setIn(obj, path, value) {
8778
+ const res = clone(obj);
8779
+ let resVal = res;
8780
+ let i = 0;
8781
+ const pathArray = toPath(path);
8782
+ for (; i < pathArray.length - 1; i++) {
8783
+ const currentPath = pathArray[i];
8784
+ const currentObj = getIn(obj, pathArray.slice(0, i + 1));
8785
+ if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {
8786
+ resVal = resVal[currentPath] = clone(currentObj);
8787
+ } else {
8788
+ const nextPath = pathArray[i + 1];
8789
+ resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
8790
+ }
8791
+ }
8792
+ if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
8793
+ return obj;
8794
+ }
8795
+ if (value === void 0) {
8796
+ delete resVal[pathArray[i]];
8797
+ } else {
8798
+ resVal[pathArray[i]] = value;
8799
+ }
8800
+ if (i === 0 && value === void 0) {
8801
+ delete res[pathArray[i]];
8802
+ }
8803
+ return res;
8804
+ }
8765
8805
  const [AppInfoProvider, useAppInfo] = createContext("AppInfo", {});
8766
8806
  const TrackingContext = React.createContext({
8767
8807
  uuid: false
@@ -10116,46 +10156,6 @@ const Layouts = {
10116
10156
  Action: ActionLayout,
10117
10157
  Content: ContentLayout
10118
10158
  };
10119
- function getIn(obj, key, def, pathStartIndex = 0) {
10120
- const path = toPath(key);
10121
- while (obj && pathStartIndex < path.length) {
10122
- obj = obj[path[pathStartIndex++]];
10123
- }
10124
- if (pathStartIndex !== path.length && !obj) {
10125
- return def;
10126
- }
10127
- return obj === void 0 ? def : obj;
10128
- }
10129
- const isObject = (obj) => obj !== null && typeof obj === "object" && !Array.isArray(obj);
10130
- const isInteger = (obj) => String(Math.floor(Number(obj))) === obj;
10131
- function setIn(obj, path, value) {
10132
- const res = clone(obj);
10133
- let resVal = res;
10134
- let i = 0;
10135
- const pathArray = toPath(path);
10136
- for (; i < pathArray.length - 1; i++) {
10137
- const currentPath = pathArray[i];
10138
- const currentObj = getIn(obj, pathArray.slice(0, i + 1));
10139
- if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {
10140
- resVal = resVal[currentPath] = clone(currentObj);
10141
- } else {
10142
- const nextPath = pathArray[i + 1];
10143
- resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
10144
- }
10145
- }
10146
- if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
10147
- return obj;
10148
- }
10149
- if (value === void 0) {
10150
- delete resVal[pathArray[i]];
10151
- } else {
10152
- resVal[pathArray[i]] = value;
10153
- }
10154
- if (i === 0 && value === void 0) {
10155
- delete res[pathArray[i]];
10156
- }
10157
- return res;
10158
- }
10159
10159
  const ERR_MSG = "The Form Component has not been initialised, ensure you are using this hook within a Form component";
10160
10160
  const [FormProvider, useForm] = createContext("Form", {
10161
10161
  disabled: false,
@@ -10505,7 +10505,7 @@ const reducer = (state, action) => produce(state, (draft) => {
10505
10505
  draft.values = setIn(
10506
10506
  state.values,
10507
10507
  action.payload.field,
10508
- newValue.length > 0 ? newValue : void 0
10508
+ newValue.length > 0 ? newValue : []
10509
10509
  );
10510
10510
  break;
10511
10511
  }
@@ -10535,36 +10535,14 @@ const useField = (path) => {
10535
10535
  (state) => getIn(state.values, path)
10536
10536
  );
10537
10537
  const handleChange = useForm("useField", (state) => state.onChange);
10538
- const formatNestedErrorMessages = (stateErrors) => {
10539
- const nestedErrors = {};
10540
- Object.entries(stateErrors).forEach(([key, value2]) => {
10541
- let current = nestedErrors;
10542
- const pathParts = key.split(".");
10543
- pathParts.forEach((part, index) => {
10544
- const isLastPart = index === pathParts.length - 1;
10545
- if (isLastPart) {
10546
- if (typeof value2 === "string") {
10547
- current[part] = value2;
10548
- } else if (isErrorMessageDescriptor(value2)) {
10549
- current[part] = formatMessage(value2);
10550
- } else {
10551
- setIn(current, part, value2);
10552
- }
10553
- } else {
10554
- if (!current[part]) {
10555
- const isArray2 = !isNaN(Number(pathParts[index + 1]));
10556
- current[part] = isArray2 ? [] : {};
10557
- }
10558
- current = current[part];
10559
- }
10560
- });
10561
- });
10562
- return nestedErrors;
10563
- };
10564
- const error = useForm(
10565
- "useField",
10566
- (state) => getIn(formatNestedErrorMessages(state.errors), path)
10567
- );
10538
+ const error = useForm("useField", (state) => {
10539
+ const error2 = getIn(state.errors, path);
10540
+ if (isErrorMessageDescriptor(error2)) {
10541
+ const { values, ...message } = error2;
10542
+ return formatMessage(message, values);
10543
+ }
10544
+ return error2;
10545
+ });
10568
10546
  return {
10569
10547
  initialValue,
10570
10548
  /**
@@ -11508,4 +11486,4 @@ export {
11508
11486
  Layouts as L,
11509
11487
  useTracking as u
11510
11488
  };
11511
- //# sourceMappingURL=index-3zwKJbP6-CFuKTauZ.mjs.map
11489
+ //# sourceMappingURL=index-Hmzyjkc3-BHUgmsKx.mjs.map