@strapi/plugin-users-permissions 5.0.0-beta.15 → 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 (40) hide show
  1. package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.jsx +3 -2
  2. package/admin/src/components/Permissions/PermissionRow/SubCategory.jsx +2 -2
  3. package/admin/src/pages/EmailTemplates/components/EmailTable.jsx +17 -12
  4. package/admin/src/pages/Providers/index.jsx +1 -1
  5. package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +6 -5
  6. package/dist/_chunks/{index-Dn02HqR-.js → index-B3Yss4_X.js} +8 -8
  7. package/dist/_chunks/{index-Dn02HqR-.js.map → index-B3Yss4_X.js.map} +1 -1
  8. package/dist/_chunks/{index-BmKoOPi2.mjs → index-B6yBcJnO.mjs} +11 -9
  9. package/dist/_chunks/index-B6yBcJnO.mjs.map +1 -0
  10. package/dist/_chunks/{index-e_o9V2Wo.mjs → index-BAJGMzXv.mjs} +4 -4
  11. package/dist/_chunks/index-BAJGMzXv.mjs.map +1 -0
  12. package/dist/_chunks/{index-CaRLqKnp.js → index-BaDNXywU.js} +11 -9
  13. package/dist/_chunks/index-BaDNXywU.js.map +1 -0
  14. package/dist/_chunks/{index-CdoferYp.mjs → index-BjBAUX-X.mjs} +2 -2
  15. package/dist/_chunks/{index-CdoferYp.mjs.map → index-BjBAUX-X.mjs.map} +1 -1
  16. package/dist/_chunks/{index-CksPZFrJ.js → index-CSTRwxO1.js} +8 -8
  17. package/dist/_chunks/index-CSTRwxO1.js.map +1 -0
  18. package/dist/_chunks/{index-C16Q3b-4.mjs → index-CU8gSdhZ.mjs} +8 -8
  19. package/dist/_chunks/index-CU8gSdhZ.mjs.map +1 -0
  20. package/dist/_chunks/{index-CdFgSV2w.js → index-CyFC4O8A.js} +8 -8
  21. package/dist/_chunks/index-CyFC4O8A.js.map +1 -0
  22. package/dist/_chunks/{index-CXQHoG6E.mjs → index-Cz5OWx31.mjs} +8 -8
  23. package/dist/_chunks/{index-CXQHoG6E.mjs.map → index-Cz5OWx31.mjs.map} +1 -1
  24. package/dist/_chunks/{index-DLg3QAaR.js → index-DJ9BXKML.js} +2 -2
  25. package/dist/_chunks/{index-DLg3QAaR.js.map → index-DJ9BXKML.js.map} +1 -1
  26. package/dist/_chunks/{index-IU9ZrCxt-C2hh56U0.mjs → index-Hmzyjkc3-BHUgmsKx.mjs} +86 -76
  27. package/dist/_chunks/index-Hmzyjkc3-BHUgmsKx.mjs.map +1 -0
  28. package/dist/_chunks/{index-IU9ZrCxt-DDk7Gyez.js → index-Hmzyjkc3-qR3QHvSP.js} +87 -77
  29. package/dist/_chunks/index-Hmzyjkc3-qR3QHvSP.js.map +1 -0
  30. package/dist/admin/index.js +1 -1
  31. package/dist/admin/index.mjs +1 -1
  32. package/package.json +4 -4
  33. package/dist/_chunks/index-BmKoOPi2.mjs.map +0 -1
  34. package/dist/_chunks/index-C16Q3b-4.mjs.map +0 -1
  35. package/dist/_chunks/index-CaRLqKnp.js.map +0 -1
  36. package/dist/_chunks/index-CdFgSV2w.js.map +0 -1
  37. package/dist/_chunks/index-CksPZFrJ.js.map +0 -1
  38. package/dist/_chunks/index-IU9ZrCxt-C2hh56U0.mjs.map +0 -1
  39. package/dist/_chunks/index-IU9ZrCxt-DDk7Gyez.js.map +0 -1
  40. package/dist/_chunks/index-e_o9V2Wo.mjs.map +0 -1
@@ -8,12 +8,14 @@ import { NavLink, useLocation, useNavigate } from "react-router-dom";
8
8
  import * as React from "react";
9
9
  import { createContext as createContext$1, useRef, useState, createElement, useEffect, useLayoutEffect, useContext, useReducer, useCallback, useMemo, useDebugValue, forwardRef, memo } from "react";
10
10
  import { useIntl } from "react-intl";
11
- import { ArrowLeft, Eye, EyeStriked, Filter, CaretDown } from "@strapi/icons";
11
+ import { ArrowLeft, Eye, EyeStriked, WarningCircle, Filter, CaretDown } from "@strapi/icons";
12
12
  import "@strapi/icons/symbols";
13
13
  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";
@@ -8533,6 +8533,10 @@ function createContext(rootComponentName, defaultContext) {
8533
8533
  return [Provider2, useContext2];
8534
8534
  }
8535
8535
  createContext("StrapiApp");
8536
+ const STORAGE_KEYS$1 = {
8537
+ TOKEN: "jwtToken",
8538
+ USER: "userInfo"
8539
+ };
8536
8540
  const THEME_LOCAL_STORAGE_KEY = "STRAPI_THEME";
8537
8541
  const LANGUAGE_LOCAL_STORAGE_KEY = "strapi-admin-language";
8538
8542
  const adminSlice = createSlice({
@@ -8547,7 +8551,8 @@ const adminSlice = createSlice({
8547
8551
  theme: {
8548
8552
  availableThemes: [],
8549
8553
  currentTheme: localStorage.getItem(THEME_LOCAL_STORAGE_KEY) || "system"
8550
- }
8554
+ },
8555
+ token: null
8551
8556
  };
8552
8557
  },
8553
8558
  reducers: {
@@ -8562,6 +8567,25 @@ const adminSlice = createSlice({
8562
8567
  state.language.locale = action.payload;
8563
8568
  window.localStorage.setItem(LANGUAGE_LOCAL_STORAGE_KEY, action.payload);
8564
8569
  document.documentElement.setAttribute("lang", action.payload);
8570
+ },
8571
+ setToken(state, action) {
8572
+ state.token = action.payload;
8573
+ },
8574
+ login(state, action) {
8575
+ const { token, persist } = action.payload;
8576
+ if (!persist) {
8577
+ window.sessionStorage.setItem(STORAGE_KEYS$1.TOKEN, JSON.stringify(token));
8578
+ } else {
8579
+ window.localStorage.setItem(STORAGE_KEYS$1.TOKEN, JSON.stringify(token));
8580
+ }
8581
+ state.token = token;
8582
+ },
8583
+ logout(state) {
8584
+ state.token = null;
8585
+ window.localStorage.removeItem(STORAGE_KEYS$1.TOKEN);
8586
+ window.localStorage.removeItem(STORAGE_KEYS$1.USER);
8587
+ window.sessionStorage.removeItem(STORAGE_KEYS$1.TOKEN);
8588
+ window.sessionStorage.removeItem(STORAGE_KEYS$1.USER);
8565
8589
  }
8566
8590
  }
8567
8591
  });
@@ -8738,6 +8762,46 @@ React.createContext({
8738
8762
  toggleNotification: () => {
8739
8763
  }
8740
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
+ }
8741
8805
  const [AppInfoProvider, useAppInfo] = createContext("AppInfo", {});
8742
8806
  const TrackingContext = React.createContext({
8743
8807
  uuid: false
@@ -10092,46 +10156,6 @@ const Layouts = {
10092
10156
  Action: ActionLayout,
10093
10157
  Content: ContentLayout
10094
10158
  };
10095
- function getIn(obj, key, def, pathStartIndex = 0) {
10096
- const path = toPath(key);
10097
- while (obj && pathStartIndex < path.length) {
10098
- obj = obj[path[pathStartIndex++]];
10099
- }
10100
- if (pathStartIndex !== path.length && !obj) {
10101
- return def;
10102
- }
10103
- return obj === void 0 ? def : obj;
10104
- }
10105
- const isObject = (obj) => obj !== null && typeof obj === "object" && !Array.isArray(obj);
10106
- const isInteger = (obj) => String(Math.floor(Number(obj))) === obj;
10107
- function setIn(obj, path, value) {
10108
- const res = clone(obj);
10109
- let resVal = res;
10110
- let i = 0;
10111
- const pathArray = toPath(path);
10112
- for (; i < pathArray.length - 1; i++) {
10113
- const currentPath = pathArray[i];
10114
- const currentObj = getIn(obj, pathArray.slice(0, i + 1));
10115
- if (currentObj && (isObject(currentObj) || Array.isArray(currentObj))) {
10116
- resVal = resVal[currentPath] = clone(currentObj);
10117
- } else {
10118
- const nextPath = pathArray[i + 1];
10119
- resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
10120
- }
10121
- }
10122
- if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
10123
- return obj;
10124
- }
10125
- if (value === void 0) {
10126
- delete resVal[pathArray[i]];
10127
- } else {
10128
- resVal[pathArray[i]] = value;
10129
- }
10130
- if (i === 0 && value === void 0) {
10131
- delete res[pathArray[i]];
10132
- }
10133
- return res;
10134
- }
10135
10159
  const ERR_MSG = "The Form Component has not been initialised, ensure you are using this hook within a Form component";
10136
10160
  const [FormProvider, useForm] = createContext("Form", {
10137
10161
  disabled: false,
@@ -10481,7 +10505,7 @@ const reducer = (state, action) => produce(state, (draft) => {
10481
10505
  draft.values = setIn(
10482
10506
  state.values,
10483
10507
  action.payload.field,
10484
- newValue.length > 0 ? newValue : void 0
10508
+ newValue.length > 0 ? newValue : []
10485
10509
  );
10486
10510
  break;
10487
10511
  }
@@ -10511,36 +10535,14 @@ const useField = (path) => {
10511
10535
  (state) => getIn(state.values, path)
10512
10536
  );
10513
10537
  const handleChange = useForm("useField", (state) => state.onChange);
10514
- const formatNestedErrorMessages = (stateErrors) => {
10515
- const nestedErrors = {};
10516
- Object.entries(stateErrors).forEach(([key, value2]) => {
10517
- let current = nestedErrors;
10518
- const pathParts = key.split(".");
10519
- pathParts.forEach((part, index) => {
10520
- const isLastPart = index === pathParts.length - 1;
10521
- if (isLastPart) {
10522
- if (typeof value2 === "string") {
10523
- current[part] = value2;
10524
- } else if (isErrorMessageDescriptor(value2)) {
10525
- current[part] = formatMessage(value2);
10526
- } else {
10527
- setIn(current, part, value2);
10528
- }
10529
- } else {
10530
- if (!current[part]) {
10531
- const isArray2 = !isNaN(Number(pathParts[index + 1]));
10532
- current[part] = isArray2 ? [] : {};
10533
- }
10534
- current = current[part];
10535
- }
10536
- });
10537
- });
10538
- return nestedErrors;
10539
- };
10540
- const error = useForm(
10541
- "useField",
10542
- (state) => getIn(formatNestedErrorMessages(state.errors), path)
10543
- );
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
+ });
10544
10546
  return {
10545
10547
  initialValue,
10546
10548
  /**
@@ -11202,6 +11204,14 @@ yup.object().shape({
11202
11204
  [adminApi.reducerPath]: adminApi.reducer,
11203
11205
  admin_app: reducer$1
11204
11206
  });
11207
+ styled(WarningCircle)`
11208
+ width: 24px;
11209
+ height: 24px;
11210
+
11211
+ path {
11212
+ fill: ${({ theme }) => theme.colors.danger600};
11213
+ }
11214
+ `;
11205
11215
  React.memo(
11206
11216
  ({ description, id, props, update }) => {
11207
11217
  const comp = description(props);
@@ -11476,4 +11486,4 @@ export {
11476
11486
  Layouts as L,
11477
11487
  useTracking as u
11478
11488
  };
11479
- //# sourceMappingURL=index-IU9ZrCxt-C2hh56U0.mjs.map
11489
+ //# sourceMappingURL=index-Hmzyjkc3-BHUgmsKx.mjs.map