strapi-plugin-comments 3.0.2 → 3.0.4

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 (27) hide show
  1. package/dist/_chunks/{index-BoLOt7pX.js → index-BMAhFLKR.js} +2 -2
  2. package/dist/_chunks/{index-ChxSaqbf.mjs → index-CK1XCSqz.mjs} +2 -2
  3. package/dist/_chunks/{index-Czdnz9Ci.js → index-DCKroyap.js} +6 -6
  4. package/dist/_chunks/{index-7Geqfcar.js → index-DHhRVslt.js} +2 -2
  5. package/dist/_chunks/{index-Ct7A5TFY.mjs → index-DUWJDJLu.mjs} +2 -2
  6. package/dist/_chunks/{index-CIBI9Is6.mjs → index-PCqyAKE7.mjs} +10 -4
  7. package/dist/_chunks/{index-CiJKS9C3.js → index-_4jTpBrc.js} +10 -4
  8. package/dist/_chunks/{index-JWxk4wBa.mjs → index-yhf78avJ.mjs} +6 -6
  9. package/dist/admin/index.js +1 -1
  10. package/dist/admin/index.mjs +1 -1
  11. package/dist/admin/src/api/client.d.ts +10 -10
  12. package/dist/admin/src/api/schemas.d.ts +126 -126
  13. package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
  14. package/dist/admin/src/hooks/useAPI.d.ts +10 -10
  15. package/dist/admin/src/hooks/useCommentsAll.d.ts +2 -2
  16. package/dist/admin/src/hooks/useReports.d.ts +2 -2
  17. package/dist/server/index.js +34 -19
  18. package/dist/server/index.mjs +34 -19
  19. package/dist/server/src/controllers/index.d.ts +526 -1
  20. package/dist/server/src/index.d.ts +2281 -181
  21. package/dist/server/src/services/admin/admin.service.d.ts +526 -1
  22. package/dist/server/src/services/admin/utils.d.ts +9 -1
  23. package/dist/server/src/services/client.service.d.ts +526 -1
  24. package/dist/server/src/services/common.service.d.ts +1 -1
  25. package/dist/server/src/services/index.d.ts +1800 -225
  26. package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +527 -2
  27. package/package.json +1 -2
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const index$2 = require("./index-7Geqfcar.js");
4
+ const index$2 = require("./index-DHhRVslt.js");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const reactQuery = require("@tanstack/react-query");
7
- const index$1 = require("./index-CiJKS9C3.js");
7
+ const index$1 = require("./index-_4jTpBrc.js");
8
8
  const React = require("react");
9
9
  const styled = require("styled-components");
10
10
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -1,8 +1,8 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { a1 as Alert, e as Button, f as ForwardRef$4x, B as Box, a2 as ForwardRef$1f, F as Flex, T as Typography, Z as Grid, m as Field, a3 as MultiSelect, a4 as MultiSelectOption, a5 as Accordion, a6 as SwitchImpl, a7 as Toggle, a8 as ForwardRef$59 } from "./index-Ct7A5TFY.mjs";
2
+ import { a1 as Alert, e as Button, f as ForwardRef$4x, B as Box, a2 as ForwardRef$1f, F as Flex, T as Typography, Z as Grid, m as Field, a3 as MultiSelect, a4 as MultiSelectOption, a5 as Accordion, a6 as SwitchImpl, a7 as Toggle, a8 as ForwardRef$59 } from "./index-DUWJDJLu.mjs";
3
3
  import { useTracking, useNotification, Page, Layouts, Form } from "@strapi/strapi/admin";
4
4
  import { useMutation, useQuery, useQueryClient, QueryClient } from "@tanstack/react-query";
5
- import { u as useAPI, f as CommonProviders, a as usePermissions, g as getMessage, l as lodashExports, e as ConfirmationDialog } from "./index-CIBI9Is6.mjs";
5
+ import { u as useAPI, f as CommonProviders, a as usePermissions, g as getMessage, l as lodashExports, e as ConfirmationDialog } from "./index-PCqyAKE7.mjs";
6
6
  import { useMemo, useRef, useState, useCallback } from "react";
7
7
  import styled from "styled-components";
8
8
  const RenderIf = ({
@@ -3,9 +3,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const admin = require("@strapi/strapi/admin");
5
5
  const reactRouterDom = require("react-router-dom");
6
- const index = require("./index-7Geqfcar.js");
6
+ const index = require("./index-DHhRVslt.js");
7
7
  const reactQuery = require("@tanstack/react-query");
8
- const index$1 = require("./index-CiJKS9C3.js");
8
+ const index$1 = require("./index-_4jTpBrc.js");
9
9
  const react = require("zustand/react");
10
10
  const React = require("react");
11
11
  const styled = require("styled-components");
@@ -50915,7 +50915,7 @@ const AdminAvatar = ({ children }) => /* @__PURE__ */ jsxRuntime.jsxs(index.Box,
50915
50915
  ] });
50916
50916
  const UserAvatar = ({ avatar, isAdminComment, name }) => {
50917
50917
  if (avatar) {
50918
- const image3 = "formats" in avatar ? avatar.formats?.thumbnail?.url ?? avatar.url : avatar.url;
50918
+ const image3 = index$1.lodashExports.isObject(avatar) ? "formats" in avatar ? avatar.formats?.thumbnail?.url : avatar.url : avatar;
50919
50919
  if (isAdminComment) {
50920
50920
  return /* @__PURE__ */ jsxRuntime.jsx(AdminAvatar, { children: image3 ? /* @__PURE__ */ jsxRuntime.jsx(index.Avatar.Item, { src: image3, alt: name }) : null });
50921
50921
  }
@@ -51274,7 +51274,7 @@ const CommentRow = ({ item }) => {
51274
51274
  item.author && /* @__PURE__ */ jsxRuntime.jsx(
51275
51275
  UserAvatar,
51276
51276
  {
51277
- name,
51277
+ name: name || "",
51278
51278
  avatar,
51279
51279
  isAdminComment: item.isAdminComment
51280
51280
  }
@@ -51283,7 +51283,7 @@ const CommentRow = ({ item }) => {
51283
51283
  ] })
51284
51284
  }
51285
51285
  ) }),
51286
- /* @__PURE__ */ jsxRuntime.jsx(index.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { ellipsis: true, children: item.content }) }),
51286
+ /* @__PURE__ */ jsxRuntime.jsx(index.Td, { maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { ellipsis: true, children: item.content }) }),
51287
51287
  /* @__PURE__ */ jsxRuntime.jsx(index.Td, { children: item.threadOf ? /* @__PURE__ */ jsxRuntime.jsx(index.Link, { href: `discover/${item.threadOf.id}`, onClick: onClickDetails(item.threadOf.id), children: index$1.getMessage(
51288
51288
  {
51289
51289
  id: "page.discover.table.cell.thread",
@@ -51291,7 +51291,7 @@ const CommentRow = ({ item }) => {
51291
51291
  },
51292
51292
  "#" + item.threadOf.id
51293
51293
  ) }) : "-" }),
51294
- /* @__PURE__ */ jsxRuntime.jsx(index.Td, { children: contentTypeLink }),
51294
+ /* @__PURE__ */ jsxRuntime.jsx(index.Td, { maxWidth: "200px", children: contentTypeLink }),
51295
51295
  /* @__PURE__ */ jsxRuntime.jsx(index.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(index.Typography, { children: formatDate(item.updatedAt || item.createdAt, {
51296
51296
  dateStyle: "long",
51297
51297
  timeStyle: "short"
@@ -51206,7 +51206,7 @@ const index = {
51206
51206
  id: `${pluginId}.plugin.name`,
51207
51207
  defaultMessage: displayName
51208
51208
  },
51209
- Component: () => Promise.resolve().then(() => require("./index-Czdnz9Ci.js")),
51209
+ Component: () => Promise.resolve().then(() => require("./index-DCKroyap.js")),
51210
51210
  permissions: pluginPermissions.access
51211
51211
  });
51212
51212
  app.createSettingSection(
@@ -51225,7 +51225,7 @@ const index = {
51225
51225
  },
51226
51226
  id: "comments",
51227
51227
  to: `/settings/${pluginId}`,
51228
- Component: () => Promise.resolve().then(() => require("./index-BoLOt7pX.js")),
51228
+ Component: () => Promise.resolve().then(() => require("./index-BMAhFLKR.js")),
51229
51229
  permissions: pluginPermissions.settings
51230
51230
  }
51231
51231
  ]
@@ -51188,7 +51188,7 @@ const index = {
51188
51188
  id: `${pluginId}.plugin.name`,
51189
51189
  defaultMessage: displayName
51190
51190
  },
51191
- Component: () => import("./index-JWxk4wBa.mjs"),
51191
+ Component: () => import("./index-yhf78avJ.mjs"),
51192
51192
  permissions: pluginPermissions.access
51193
51193
  });
51194
51194
  app.createSettingSection(
@@ -51207,7 +51207,7 @@ const index = {
51207
51207
  },
51208
51208
  id: "comments",
51209
51209
  to: `/settings/${pluginId}`,
51210
- Component: () => import("./index-ChxSaqbf.mjs"),
51210
+ Component: () => import("./index-CK1XCSqz.mjs"),
51211
51211
  permissions: pluginPermissions.settings
51212
51212
  }
51213
51213
  ]
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { a9 as darkTheme, aa as lightTheme, ab as DesignSystemProvider, ac as pluginPermissions, ad as __assign, ae as __rest, p as pluginId, af as Dialog, F as Flex, ag as ForwardRef$3, T as Typography, e as Button } from "./index-Ct7A5TFY.mjs";
2
+ import { a9 as darkTheme, aa as lightTheme, ab as DesignSystemProvider, ac as pluginPermissions, ad as __assign, ae as __rest, p as pluginId, af as Dialog, F as Flex, ag as ForwardRef$3, T as Typography, e as Button } from "./index-DUWJDJLu.mjs";
3
3
  import { useQuery, QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
4
  import * as React from "react";
5
5
  import { useMemo, createContext, useState } from "react";
@@ -7660,7 +7660,7 @@ const relatedSchema = z.intersection(
7660
7660
  );
7661
7661
  const authorSchema = z.object({
7662
7662
  id: z.union([z.number(), z.string()]),
7663
- name: z.string().optional(),
7663
+ name: z.string().optional().nullable(),
7664
7664
  email: z.string(),
7665
7665
  avatar: z.union([
7666
7666
  z.object({
@@ -7673,7 +7673,8 @@ const authorSchema = z.object({
7673
7673
  url: z.string()
7674
7674
  }).nullable()
7675
7675
  })
7676
- })
7676
+ }),
7677
+ z.string()
7677
7678
  ]).nullable().optional()
7678
7679
  });
7679
7680
  const approvalStatusSchema = z.union([
@@ -7737,7 +7738,12 @@ const commentsSchema = z.object({
7737
7738
  });
7738
7739
  const commentDetailsSchema = z.object({
7739
7740
  entity: relatedSchema,
7740
- selected: baseCommentSchema.merge(z.object({ related: z.string(), threadOf: getCommentSchema().omit({ related: true }).merge(z.object({ related: z.string() })).nullable().optional() })).nullable(),
7741
+ selected: baseCommentSchema.merge(
7742
+ z.object({
7743
+ related: z.string(),
7744
+ threadOf: getCommentSchema().omit({ related: true }).merge(z.object({ related: z.string() })).nullable().optional()
7745
+ })
7746
+ ).nullable(),
7741
7747
  level: z.array(getCommentSchema().omit({ threadOf: true, related: true }))
7742
7748
  });
7743
7749
  const singleContentTypeSchema = z.object({
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const index = require("./index-7Geqfcar.js");
3
+ const index = require("./index-DHhRVslt.js");
4
4
  const reactQuery = require("@tanstack/react-query");
5
5
  const React = require("react");
6
6
  const admin = require("@strapi/strapi/admin");
@@ -7678,7 +7678,7 @@ const relatedSchema = zod.z.intersection(
7678
7678
  );
7679
7679
  const authorSchema = zod.z.object({
7680
7680
  id: zod.z.union([zod.z.number(), zod.z.string()]),
7681
- name: zod.z.string().optional(),
7681
+ name: zod.z.string().optional().nullable(),
7682
7682
  email: zod.z.string(),
7683
7683
  avatar: zod.z.union([
7684
7684
  zod.z.object({
@@ -7691,7 +7691,8 @@ const authorSchema = zod.z.object({
7691
7691
  url: zod.z.string()
7692
7692
  }).nullable()
7693
7693
  })
7694
- })
7694
+ }),
7695
+ zod.z.string()
7695
7696
  ]).nullable().optional()
7696
7697
  });
7697
7698
  const approvalStatusSchema = zod.z.union([
@@ -7755,7 +7756,12 @@ const commentsSchema = zod.z.object({
7755
7756
  });
7756
7757
  const commentDetailsSchema = zod.z.object({
7757
7758
  entity: relatedSchema,
7758
- selected: baseCommentSchema.merge(zod.z.object({ related: zod.z.string(), threadOf: getCommentSchema().omit({ related: true }).merge(zod.z.object({ related: zod.z.string() })).nullable().optional() })).nullable(),
7759
+ selected: baseCommentSchema.merge(
7760
+ zod.z.object({
7761
+ related: zod.z.string(),
7762
+ threadOf: getCommentSchema().omit({ related: true }).merge(zod.z.object({ related: zod.z.string() })).nullable().optional()
7763
+ })
7764
+ ).nullable(),
7759
7765
  level: zod.z.array(getCommentSchema().omit({ threadOf: true, related: true }))
7760
7766
  });
7761
7767
  const singleContentTypeSchema = zod.z.object({
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useNotification, Form, Page, Layouts, useTracking, useQueryParams, SearchInput, Pagination } from "@strapi/strapi/admin";
3
3
  import { useNavigate, useParams, Routes, Route, Navigate } from "react-router-dom";
4
- import { S as SubNav, a as SubNavHeader, b as SubNavSections, c as SubNavSection, d as SubNavLink, p as pluginId, B as Box, T as Typography, D as Divider, F as Flex, C as CheckboxImpl, e as Button, I as IconButton, f as ForwardRef$4x, g as ForwardRef$3$, h as Badge, i as IconButtonGroup$1, P as Portal$1, j as FocusTrap, k as ForwardRef$45, l as ForwardRef$3B, m as Field, n as SingleSelect, o as SingleSelectOption, q as ForwardRef$4X, r as ForwardRef$2v, s as ForwardRef$f, t as ForwardRef$1R, u as Popover, v as ForwardRef$v, w as ForwardRef$4R, x as ForwardRef$1L, y as ForwardRef$4d, z as ForwardRef$2l, A as ForwardRef$11, M as Modal, E as Table, G as Thead, H as Tr, J as Th, K as Tbody, L as ForwardRef$1r, N as ForwardRef$j, O as ForwardRef$3x, Q as ForwardRef$1d, R as ForwardRef$R, U as Avatar, V as TooltipImpl, W as Loader, X as Link, Y as ForwardRef$51, Z as Grid, _ as Td, $ as SimpleMenu, a0 as MenuItem } from "./index-Ct7A5TFY.mjs";
4
+ import { S as SubNav, a as SubNavHeader, b as SubNavSections, c as SubNavSection, d as SubNavLink, p as pluginId, B as Box, T as Typography, D as Divider, F as Flex, C as CheckboxImpl, e as Button, I as IconButton, f as ForwardRef$4x, g as ForwardRef$3$, h as Badge, i as IconButtonGroup$1, P as Portal$1, j as FocusTrap, k as ForwardRef$45, l as ForwardRef$3B, m as Field, n as SingleSelect, o as SingleSelectOption, q as ForwardRef$4X, r as ForwardRef$2v, s as ForwardRef$f, t as ForwardRef$1R, u as Popover, v as ForwardRef$v, w as ForwardRef$4R, x as ForwardRef$1L, y as ForwardRef$4d, z as ForwardRef$2l, A as ForwardRef$11, M as Modal, E as Table, G as Thead, H as Tr, J as Th, K as Tbody, L as ForwardRef$1r, N as ForwardRef$j, O as ForwardRef$3x, Q as ForwardRef$1d, R as ForwardRef$R, U as Avatar, V as TooltipImpl, W as Loader, X as Link, Y as ForwardRef$51, Z as Grid, _ as Td, $ as SimpleMenu, a0 as MenuItem } from "./index-DUWJDJLu.mjs";
5
5
  import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query";
6
- import { u as useAPI, l as lodashExports, C as COMMENT_STATUS, R as REPORT_STATUS, g as getMessage, a as usePermissions, U as UserContext, b as getDefaultExportFromCjs, c as useIntl, d as REPORT_REASON, e as ConfirmationDialog, f as CommonProviders } from "./index-CIBI9Is6.mjs";
6
+ import { u as useAPI, l as lodashExports, C as COMMENT_STATUS, R as REPORT_STATUS, g as getMessage, a as usePermissions, U as UserContext, b as getDefaultExportFromCjs, c as useIntl, d as REPORT_REASON, e as ConfirmationDialog, f as CommonProviders } from "./index-PCqyAKE7.mjs";
7
7
  import { create } from "zustand/react";
8
8
  import * as React from "react";
9
9
  import { useCallback, useMemo, useContext, useState, useRef, Fragment as Fragment$1 } from "react";
@@ -50891,7 +50891,7 @@ const AdminAvatar = ({ children }) => /* @__PURE__ */ jsxs(Box, { position: "rel
50891
50891
  ] });
50892
50892
  const UserAvatar = ({ avatar, isAdminComment, name }) => {
50893
50893
  if (avatar) {
50894
- const image3 = "formats" in avatar ? avatar.formats?.thumbnail?.url ?? avatar.url : avatar.url;
50894
+ const image3 = lodashExports.isObject(avatar) ? "formats" in avatar ? avatar.formats?.thumbnail?.url : avatar.url : avatar;
50895
50895
  if (isAdminComment) {
50896
50896
  return /* @__PURE__ */ jsx(AdminAvatar, { children: image3 ? /* @__PURE__ */ jsx(Avatar.Item, { src: image3, alt: name }) : null });
50897
50897
  }
@@ -51250,7 +51250,7 @@ const CommentRow = ({ item }) => {
51250
51250
  item.author && /* @__PURE__ */ jsx(
51251
51251
  UserAvatar,
51252
51252
  {
51253
- name,
51253
+ name: name || "",
51254
51254
  avatar,
51255
51255
  isAdminComment: item.isAdminComment
51256
51256
  }
@@ -51259,7 +51259,7 @@ const CommentRow = ({ item }) => {
51259
51259
  ] })
51260
51260
  }
51261
51261
  ) }),
51262
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { ellipsis: true, children: item.content }) }),
51262
+ /* @__PURE__ */ jsx(Td, { maxWidth: "200px", children: /* @__PURE__ */ jsx(Typography, { ellipsis: true, children: item.content }) }),
51263
51263
  /* @__PURE__ */ jsx(Td, { children: item.threadOf ? /* @__PURE__ */ jsx(Link, { href: `discover/${item.threadOf.id}`, onClick: onClickDetails(item.threadOf.id), children: getMessage(
51264
51264
  {
51265
51265
  id: "page.discover.table.cell.thread",
@@ -51267,7 +51267,7 @@ const CommentRow = ({ item }) => {
51267
51267
  },
51268
51268
  "#" + item.threadOf.id
51269
51269
  ) }) : "-" }),
51270
- /* @__PURE__ */ jsx(Td, { children: contentTypeLink }),
51270
+ /* @__PURE__ */ jsx(Td, { maxWidth: "200px", children: contentTypeLink }),
51271
51271
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: formatDate(item.updatedAt || item.createdAt, {
51272
51272
  dateStyle: "long",
51273
51273
  timeStyle: "short"
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-7Geqfcar.js");
2
+ const index = require("../_chunks/index-DHhRVslt.js");
3
3
  require("react");
4
4
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { ah } from "../_chunks/index-Ct7A5TFY.mjs";
1
+ import { ah } from "../_chunks/index-DUWJDJLu.mjs";
2
2
  import "react";
3
3
  export {
4
4
  ah as default
@@ -152,8 +152,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
152
152
  author: {
153
153
  email: string;
154
154
  id: string | number;
155
- name?: string | undefined;
156
- avatar?: {
155
+ name?: string | null | undefined;
156
+ avatar?: string | {
157
157
  url: string;
158
158
  } | {
159
159
  url: string;
@@ -190,8 +190,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
190
190
  author: {
191
191
  email: string;
192
192
  id: string | number;
193
- name?: string | undefined;
194
- avatar?: {
193
+ name?: string | null | undefined;
194
+ avatar?: string | {
195
195
  url: string;
196
196
  } | {
197
197
  url: string;
@@ -227,8 +227,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
227
227
  author: {
228
228
  email: string;
229
229
  id: string | number;
230
- name?: string | undefined;
231
- avatar?: {
230
+ name?: string | null | undefined;
231
+ avatar?: string | {
232
232
  url: string;
233
233
  } | {
234
234
  url: string;
@@ -270,8 +270,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
270
270
  author: {
271
271
  email: string;
272
272
  id: string | number;
273
- name?: string | undefined;
274
- avatar?: {
273
+ name?: string | null | undefined;
274
+ avatar?: string | {
275
275
  url: string;
276
276
  } | {
277
277
  url: string;
@@ -343,8 +343,8 @@ export declare const getApiClient: (fetch: ReturnType<typeof getFetchClient>) =>
343
343
  author: {
344
344
  email: string;
345
345
  id: string | number;
346
- name?: string | undefined;
347
- avatar?: {
346
+ name?: string | null | undefined;
347
+ avatar?: string | {
348
348
  url: string;
349
349
  } | {
350
350
  url: string;