strapi-identity 0.2.0 → 0.3.0

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.
@@ -2,8 +2,8 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { W as WarningAlert } from "./WarningAlert-VU011LVF.mjs";
4
4
  import { Box, Flex, Typography, Grid, Button } from "@strapi/design-system";
5
- import { g as getTranslation } from "./index-BfC6z9N5.mjs";
6
- import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
5
+ import { g as getTranslation } from "./index-C_4USMnn.mjs";
6
+ import { g as getToken } from "./tokenHelpers-CKVyT1sz.mjs";
7
7
  import { useIntl } from "react-intl";
8
8
  const AdminReset = ({ id }) => {
9
9
  const { formatMessage } = useIntl();
@@ -4,8 +4,8 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const WarningAlert = require("./WarningAlert-DFE5euMk.js");
6
6
  const designSystem = require("@strapi/design-system");
7
- const index = require("./index-D03zlFnm.js");
8
- const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
7
+ const index = require("./index-C9K2h5UC.js");
8
+ const tokenHelpers = require("./tokenHelpers-B54WRTn1.js");
9
9
  const reactIntl = require("react-intl");
10
10
  const AdminReset = ({ id }) => {
11
11
  const { formatMessage } = reactIntl.useIntl();
@@ -4,10 +4,10 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const styled = require("styled-components");
7
- const index = require("./index-D03zlFnm.js");
7
+ const index = require("./index-C9K2h5UC.js");
8
8
  const qrcode_react = require("qrcode.react");
9
9
  const reactIntl = require("react-intl");
10
- const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
10
+ const tokenHelpers = require("./tokenHelpers-B54WRTn1.js");
11
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
12
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
13
13
  function ConfirmModal({
@@ -2,10 +2,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { Modal, Flex, Typography, Grid, Button, TextInput, Box, Field, Toggle } from "@strapi/design-system";
4
4
  import styled from "styled-components";
5
- import { g as getTranslation, I as InputOTP, a as InputOTPGroup, b as InputOTPSlot, c as InputOTPSeparator } from "./index-BfC6z9N5.mjs";
5
+ import { g as getTranslation, I as InputOTP, a as InputOTPGroup, b as InputOTPSlot, c as InputOTPSeparator } from "./index-C_4USMnn.mjs";
6
6
  import { QRCodeCanvas } from "qrcode.react";
7
7
  import { useIntl } from "react-intl";
8
- import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
8
+ import { g as getToken } from "./tokenHelpers-CKVyT1sz.mjs";
9
9
  function ConfirmModal({
10
10
  open,
11
11
  onOpenChange,
@@ -4,8 +4,8 @@ import { W as WarningAlert } from "./WarningAlert-VU011LVF.mjs";
4
4
  import { useNotification, Page, Layouts } from "@strapi/strapi/admin";
5
5
  import { Button, Flex, Typography, Grid, Field, Toggle, TextInput, Textarea } from "@strapi/design-system";
6
6
  import { Check } from "@strapi/icons";
7
- import { g as getTranslation } from "./index-BfC6z9N5.mjs";
8
- import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
7
+ import { g as getTranslation } from "./index-C_4USMnn.mjs";
8
+ import { g as getToken } from "./tokenHelpers-CKVyT1sz.mjs";
9
9
  import { useIntl } from "react-intl";
10
10
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
11
11
  var lodash$1 = { exports: {} };
@@ -6,8 +6,8 @@ const WarningAlert = require("./WarningAlert-DFE5euMk.js");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-D03zlFnm.js");
10
- const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
9
+ const index = require("./index-C9K2h5UC.js");
10
+ const tokenHelpers = require("./tokenHelpers-B54WRTn1.js");
11
11
  const reactIntl = require("react-intl");
12
12
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
13
13
  var lodash$1 = { exports: {} };
@@ -1540,12 +1540,9 @@ const plugin = {
1540
1540
  defaultMessage: "Strapi Identity Settings"
1541
1541
  },
1542
1542
  id: "strapi-identity-settings",
1543
- to: `/settings/${PLUGIN_ID}`,
1544
- Component: async () => Promise.resolve().then(() => require("./SettingsPage-DAxGIv_E.js")),
1545
- permissions: [
1546
- { action: "plugin::strapi-identity.settings.read" },
1547
- { action: "plugin::strapi-identity.settings.read" }
1548
- ]
1543
+ to: `/${PLUGIN_ID}`,
1544
+ Component: () => Promise.resolve().then(() => require("./SettingsPage-DulEjadb.js")),
1545
+ permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1549
1546
  });
1550
1547
  app.addMiddlewares([mfaRedirect]);
1551
1548
  const injections = strapiAdminPortal.initialiseInjections(app);
@@ -1553,13 +1550,14 @@ const plugin = {
1553
1550
  id: "profile-toggle",
1554
1551
  route: "/admin/me",
1555
1552
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1556
- Component: async () => Promise.resolve().then(() => require("./ProfileToggle-BRYjt5Lu.js"))
1553
+ Component: () => Promise.resolve().then(() => require("./ProfileToggle-H31GHNDA.js"))
1557
1554
  });
1558
1555
  injections.registerRoute({
1559
1556
  id: "admin-reset",
1560
1557
  route: "/admin/settings/users/:id",
1561
1558
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1562
- Component: async () => Promise.resolve().then(() => require("./AdminReset-CqHhVBS_.js"))
1559
+ permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1560
+ Component: () => Promise.resolve().then(() => require("./AdminReset-QClQP2Il.js"))
1563
1561
  });
1564
1562
  InjectVerify(app);
1565
1563
  },
@@ -1520,12 +1520,9 @@ const plugin = {
1520
1520
  defaultMessage: "Strapi Identity Settings"
1521
1521
  },
1522
1522
  id: "strapi-identity-settings",
1523
- to: `/settings/${PLUGIN_ID}`,
1524
- Component: async () => import("./SettingsPage-7Ytl01jH.mjs"),
1525
- permissions: [
1526
- { action: "plugin::strapi-identity.settings.read" },
1527
- { action: "plugin::strapi-identity.settings.read" }
1528
- ]
1523
+ to: `/${PLUGIN_ID}`,
1524
+ Component: () => import("./SettingsPage-DgPikS3m.mjs"),
1525
+ permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1529
1526
  });
1530
1527
  app.addMiddlewares([mfaRedirect]);
1531
1528
  const injections = initialiseInjections(app);
@@ -1533,13 +1530,14 @@ const plugin = {
1533
1530
  id: "profile-toggle",
1534
1531
  route: "/admin/me",
1535
1532
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1536
- Component: async () => import("./ProfileToggle-BCtCsOvj.mjs")
1533
+ Component: () => import("./ProfileToggle-gPuH6dGP.mjs")
1537
1534
  });
1538
1535
  injections.registerRoute({
1539
1536
  id: "admin-reset",
1540
1537
  route: "/admin/settings/users/:id",
1541
1538
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1542
- Component: async () => import("./AdminReset-B-WGECOX.mjs")
1539
+ permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1540
+ Component: () => import("./AdminReset-CCGgw-0k.mjs")
1543
1541
  });
1544
1542
  InjectVerify(app);
1545
1543
  },
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-D03zlFnm.js");
3
+ const index = require("./index-C9K2h5UC.js");
4
4
  require("strapi-admin-portal");
5
5
  exports.default = index.plugin;
@@ -1,4 +1,4 @@
1
- import { p } from "./index-BfC6z9N5.mjs";
1
+ import { p } from "./index-C_4USMnn.mjs";
2
2
  import "strapi-admin-portal";
3
3
  export {
4
4
  p as default
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
  const getCookieValue = (name) => {
3
- let result = null;
4
3
  const cookieArray = document.cookie.split(";");
5
- cookieArray.forEach((cookie) => {
4
+ return cookieArray.reduce((result, cookie) => {
6
5
  const [key, value] = cookie.split("=").map((item) => item.trim());
7
- if (key === name) {
8
- result = decodeURIComponent(value);
9
- }
10
- });
11
- return result;
6
+ return key === name ? decodeURIComponent(value) : result;
7
+ }, null);
12
8
  };
13
9
  const getToken = () => {
14
10
  const fromLocalStorage = localStorage.getItem("jwtToken");
15
- if (fromLocalStorage) {
16
- return JSON.parse(fromLocalStorage);
17
- }
11
+ if (fromLocalStorage) return JSON.parse(fromLocalStorage);
18
12
  const fromCookie = getCookieValue("jwtToken");
19
13
  return fromCookie ?? null;
20
14
  };
@@ -1,19 +1,13 @@
1
1
  const getCookieValue = (name) => {
2
- let result = null;
3
2
  const cookieArray = document.cookie.split(";");
4
- cookieArray.forEach((cookie) => {
3
+ return cookieArray.reduce((result, cookie) => {
5
4
  const [key, value] = cookie.split("=").map((item) => item.trim());
6
- if (key === name) {
7
- result = decodeURIComponent(value);
8
- }
9
- });
10
- return result;
5
+ return key === name ? decodeURIComponent(value) : result;
6
+ }, null);
11
7
  };
12
8
  const getToken = () => {
13
9
  const fromLocalStorage = localStorage.getItem("jwtToken");
14
- if (fromLocalStorage) {
15
- return JSON.parse(fromLocalStorage);
16
- }
10
+ if (fromLocalStorage) return JSON.parse(fromLocalStorage);
17
11
  const fromCookie = getCookieValue("jwtToken");
18
12
  return fromCookie ?? null;
19
13
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.3.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "plugin",
@@ -40,11 +40,11 @@
40
40
  "input-otp": "^1.4.2",
41
41
  "otpauth": "^9.5.0",
42
42
  "qrcode.react": "^4.2.0",
43
- "strapi-admin-portal": "^0.2.2"
43
+ "strapi-admin-portal": "^0.3.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@strapi/sdk-plugin": "^6.0.1",
47
- "@strapi/typescript-utils": "^5.39.0",
47
+ "@strapi/typescript-utils": "^5.40.0",
48
48
  "@types/bcryptjs": "^2.4.6",
49
49
  "@types/react": "^18.3.27",
50
50
  "@types/react-dom": "^18.3.7",