strapi-plugin-comments 3.0.11 → 3.0.13
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.
- package/README.md +17 -0
- package/dist/_chunks/{index-CLWGT_vP.js → index-B4cSir6s.js} +1 -1
- package/dist/_chunks/{index-DexwEcn3.mjs → index-B7F5_QGF.mjs} +2 -2
- package/dist/_chunks/{index-tUit0Fx4.mjs → index-BNUfJ5rK.mjs} +2 -2
- package/dist/_chunks/{index-BcTMW0bl.mjs → index-B_ImEGPI.mjs} +8135 -7897
- package/dist/_chunks/index-CKnhBcNh.js +2228 -0
- package/dist/_chunks/{index-CFRFtK93.mjs → index-CQD92qgD.mjs} +471 -462
- package/dist/_chunks/index-DO4U1xys.js +18 -0
- package/dist/_chunks/{index-670UMREc.js → index-nX8EInHC.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/api/client.d.ts +1 -5
- package/dist/admin/src/api/schemas.d.ts +3 -23
- package/dist/admin/src/hooks/useAPI.d.ts +1 -5
- package/dist/admin/src/hooks/useConfig.d.ts +1 -5
- package/dist/admin/src/pages/Settings/hooks/useSettingsAPI.d.ts +1 -5
- package/dist/server/index.js +24 -24
- package/dist/server/index.mjs +507 -478
- package/dist/server/src/controllers/index.d.ts +2787 -1
- package/dist/server/src/index.d.ts +11403 -256
- package/dist/server/src/services/admin/admin.service.d.ts +2787 -0
- package/dist/server/src/services/client.service.d.ts +2787 -0
- package/dist/server/src/services/index.d.ts +8679 -318
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +2787 -0
- package/package.json +9 -3
- package/dist/_chunks/index-BgxJUAmG.js +0 -2238
- package/dist/_chunks/index-QMZY5BnX.js +0 -18
package/README.md
CHANGED
|
@@ -421,6 +421,23 @@ _Strapi user_
|
|
|
421
421
|
}
|
|
422
422
|
```
|
|
423
423
|
|
|
424
|
+
_Multi-language entities_
|
|
425
|
+
|
|
426
|
+
> When posting comments to entities with multiple locales, you must provide the `locale` field in the payload to match the entity's locale:
|
|
427
|
+
|
|
428
|
+
```json
|
|
429
|
+
{
|
|
430
|
+
"author": {
|
|
431
|
+
"id": 518,
|
|
432
|
+
"name": "Author",
|
|
433
|
+
"email": "author@example.com",
|
|
434
|
+
"avatar": "<Link to avatar file>"
|
|
435
|
+
},
|
|
436
|
+
"content": "Test",
|
|
437
|
+
"locale": "fr" // Locale must be the same as the provided entity
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
424
441
|
**Example response body**
|
|
425
442
|
|
|
426
443
|
```json
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),W=require("@strapi/strapi/admin"),he=require("react-router-dom"),g=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),W=require("@strapi/strapi/admin"),he=require("react-router-dom"),g=require("./index-CKnhBcNh.js"),K=require("@tanstack/react-query"),O=require("./index-DO4U1xys.js"),X_=require("zustand/react"),ee=require("react"),me=require("styled-components"),Z_=require("codemirror5"),J_=require("sanitize-html"),ed=require("punycode");require("codemirror5/addon/display/placeholder");const lt=t=>t&&t.__esModule?t:{default:t};function td(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const se=td(ee),Ue=lt(me),mo=lt(Z_),Bo=lt(J_),nd=lt(ed),rd=()=>d.jsxs(g.SubNav,{ariaLabel:"Comments sub nav",children:[d.jsx(g.SubNavHeader,{label:"Comments"}),d.jsx(g.SubNavSections,{children:d.jsxs(g.SubNavSection,{label:"Moderation",children:[d.jsx(g.SubNavLink,{href:"/admin/plugins/comments/discover",children:"Discover"}),d.jsx(g.SubNavLink,{href:"/admin/plugins/comments/reports",withBullet:!1,children:"Reports"})]})})]}),ad=t=>{const e=O.useAPI();return K.useQuery({queryKey:e.config.getKey(),queryFn:()=>e.config.query().then(n=>(t(n),n))})},od=X_.create(t=>({settings:{entryLabel:{},approvalFlow:[],blockedAuthorProps:[],reportReasons:{BAD_LANGUAGE:"BAD_LANGUAGE",DISCRIMINATION:"DISCRIMINATION",OTHER:"OTHER"},regex:{uid:"",relatedUid:"",email:"",sorting:""},enabledCollections:[],moderatorRoles:[],isGQLPluginEnabled:!1,client:{url:"",contactEmail:""}},setSettings:e=>t({settings:e})})),id=(t="")=>`/plugins/${g.pluginId}/${t}`,sd=(t=null,e=null,n="app.components.notification.error")=>{throw e({type:"warning",message:`${g.pluginId}.${n}`}),t||new Error("error")},Go=(t="")=>g.lodashExports.isString(t)?t.split(" ").map(e=>g.lodashExports.first(e)).join("").toUpperCase():"",cd=({removed:t,blocked:e,blockedThread:n,approvalStatus:r,reviewFlowEnabled:a})=>{const i=!g.lodashExports.isNil(r);if(t)return O.COMMENT_STATUS.REMOVED;if(e||n)return O.COMMENT_STATUS.BLOCKED;if(a)return O.COMMENT_STATUS.TO_REVIEW;if(i){const o=r.toUpperCase();return Object.keys(O.COMMENT_STATUS).includes(o)?o:O.COMMENT_STATUS.UNKNOWN}return O.COMMENT_STATUS.OPEN},ld=t=>{if(Object.values(O.COMMENT_STATUS).includes(t))switch(t){case O.COMMENT_STATUS.REMOVED:return"secondary";case O.COMMENT_STATUS.TO_REVIEW:case O.COMMENT_STATUS.REJECTED:return"warning";case O.COMMENT_STATUS.BLOCKED:return"danger";case O.COMMENT_STATUS.OPEN:case O.COMMENT_STATUS.APPROVED:return"success"}return"secondary"},_d=({resolved:t,related:{blocked:e,blockedThread:n},approvalStatus:r})=>{const a=!g.lodashExports.isNil(r);if(e||n)return O.REPORT_STATUS.BLOCKED;if(t)return O.REPORT_STATUS.RESOLVED;if(a){const i=r.toUpperCase();return Object.keys(O.REPORT_STATUS).includes(i)?i:O.REPORT_STATUS.PENDING}return O.REPORT_STATUS.PENDING},dd=t=>{switch(t){case O.REPORT_STATUS.PENDING:return"primary";case O.REPORT_STATUS.RESOLVED:return"success";case O.REPORT_STATUS.BLOCKED:return"danger";default:return"primary"}},qo=t=>{const[e,n]=t.split("/").filter(r=>r.length>0);return{value:e,flags:n}},ud=({config:t,entity:e,filters:n,onChangeFilters:r,schema:a})=>{const{entryLabel:i={}}=t,{attributes:o={}}=a,{removed:c=!1}=n;K.useQueryClient();const s=Object.keys(o),l=g.lodashExports.first(i[e?.uid]),m=g.lodashExports.take(s.filter(f=>o[f].type==="string"&&!g.lodashExports.isNil(e[f])&&f!==l),5),u=(f="")=>f.split("_").map(E=>g.lodashExports.capitalize(E)).join(" "),p=e&&!g.lodashExports.isEmpty(e)&&(!g.lodashExports.isEmpty(m)||e[l]),S=ee.useCallback(f=>{r({...n,removed:f||void 0})},[r,n]);return d.jsxs(g.Box,{padding:4,background:"neutral0",width:"100%",children:[p&&d.jsxs(g.Box,{marginBottom:4,children:[d.jsx(g.Typography,{variant:"sigma",textColor:"neutral600",id:"entity-details",children:O.getMessage("page.details.panel.entity","Details")}),d.jsx(g.Box,{paddingTop:2,paddingBottom:4,children:d.jsx(g.Divider,{})}),d.jsxs(g.Flex,{children:[d.jsxs(g.Flex,{direction:"column",alignItems:"flex-start",children:[d.jsx(g.Typography,{fontWeight:"bold",children:u(l)}),d.jsx(g.Typography,{children:e[l]})]}),d.jsx(g.Flex,{space:4,children:m.map(f=>d.jsxs(g.Flex,{direction:"column",alignItems:"flex-start",children:[d.jsx(g.Typography,{fontWeight:"bold",children:u(f)}),d.jsx(g.Typography,{children:e[f]})]},`prop_${f}`))})]})]}),d.jsxs(g.Box,{children:[d.jsx(g.Typography,{variant:"sigma",textColor:"neutral600",id:"view-filters",children:O.getMessage("page.details.filters.label","View")}),d.jsx(g.Box,{paddingTop:2,paddingBottom:4,children:d.jsx(g.Divider,{})}),d.jsx(g.Flex,{children:d.jsx(g.CheckboxImpl,{checked:c,onCheckedChange:S,children:O.getMessage("page.details.filters.removed.label","Show removed comments")})})]})]})},Fe=(t={comment:{},report:{}})=>{const e=O.useAPI(),{canModerate:n}=O.usePermissions(),r=f=>n?f:void 0,a=K.useMutation({mutationFn:r(e.comments.block),onSuccess:t.comment?.blockSuccess,onError:t.comment?.blockError}),i=K.useMutation({mutationFn:r(e.comments.unblock),onSuccess:t.comment?.unBlockSuccess,onError:t.comment?.unBlockError}),o=K.useMutation({mutationFn:r(e.comments.blockThread),onSuccess:t.comment?.blockThreadSuccess,onError:t.comment?.blockThreadError}),c=K.useMutation({mutationFn:r(e.comments.unBlockThread),onSuccess:t.comment?.unBlockThreadSuccess,onError:t.comment?.unBlockThreadError}),s=K.useMutation({mutationFn:r(e.comments.delete),onSuccess:t.comment?.deleteSuccess,onError:t.comment?.deleteError}),l=K.useMutation({mutationFn:r(e.comments.postComment),onSuccess:t.comment?.postCommentSuccess,onError:t.comment?.postCommentError}),_=K.useMutation({mutationFn:r(e.reports.resolveMultipleReports),onSuccess:t.report?.resolveMultipleSuccess,onError:t.report?.resolveMultipleError}),m=K.useMutation({mutationFn:r(e.reports.resolveCommentMultipleReports),onSuccess:t.report?.resolveCommentMultipleReportsSuccess,onError:t.report?.resolveCommentMultipleReportsError}),u=K.useMutation({mutationFn:r(e.reports.resolve),onSuccess:t.report?.resolveSuccess,onError:t.report?.resolveError}),p=K.useMutation({mutationFn:r(e.reports.resolveAllAbuseReportsForComment),onSuccess:t.report?.resolveAllAbuseSuccess,onError:t.report?.resolveAllAbuseError}),S=K.useMutation({mutationFn:r(e.reports.resolveAllAbuseReportsForThread),onSuccess:t.report?.resolveAllAbuseThreadSuccess,onError:t.report?.resolveAllAbuseThreadError});return ee.useMemo(()=>({commentMutation:{block:a,unBlock:i,blockThread:o,unBlockThread:c,delete:s,postComment:l},reportMutation:{resolve:u,resolveMultiple:_,resolveAllAbuse:p,resolveAllAbuseThread:S,resolveCommentMultipleReports:m}}),[a,i,o,c,_,p,S,s,u])},To=()=>{const t=ee.useContext(O.UserContext);if(!t)throw new Error("UserContext is not provided");return t},go=Ue.default(g.Button)(({isSingle:t})=>({padding:"7px 16px",marginLeft:t?"0":".5rem",whiteSpace:"nowrap"})),m_=({id:t,canModerate:e,queryKey:n})=>{const{toggleNotification:r}=W.useNotification(),a=K.useQueryClient(),i=O.useAPI(),o=u=>async()=>{await a.invalidateQueries({exact:!1,queryKey:n}),r({type:"success",message:`${g.pluginId}.${u}`})},c=u=>{sd(u,r)},s=K.useMutation({mutationKey:["approveItem",t],mutationFn:i.comments.approve,onSuccess:o("success.approveItem"),onError:c}),l=()=>{s.mutate(t)},_=K.useMutation({mutationKey:["rejectItem",t],mutationFn:i.comments.reject,onSuccess:o("success.rejectItem"),onError:c}),m=()=>{_.mutate(t)};return e?d.jsxs(d.Fragment,{children:[d.jsx(g.IconButton,{onClick:l,label:"Approve",children:d.jsx(g.ForwardRef$4F,{})}),d.jsx(g.IconButton,{label:"Reject",onClick:m,children:d.jsx(g.ForwardRef$45,{})})]}):null},pd=Ue.default(g.Badge)`
|
|
2
2
|
padding: 5px 8px;
|
|
3
3
|
border: 1px ${({theme:t,color:e})=>t.colors[`${e}200`]} solid;
|
|
4
4
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as w, jsx as m, Fragment as tt } from "react/jsx-runtime";
|
|
2
2
|
import { useNotification as rt, Form as cd, Page as Fe, Layouts as Oe, useQueryParams as ld, SearchInput as _d, Pagination as Je } from "@strapi/strapi/admin";
|
|
3
3
|
import { useNavigate as dd, useParams as Xd, Routes as Zd, Route as Ot, Navigate as Jd } from "react-router-dom";
|
|
4
|
-
import { S as jd, a as eu, b as tu, c as nu, d as Oi, p as ni, l as oe, B as ie, T as K, D as $o, F as W, C as mt, e as Se, I as ee, f as ft, g as ru, h as au, i as Ut, j as Ae, P as ou, k as iu, m as su, n as cu, o as Ze, q as Wo, r as be, s as Ai, t as yi, u as Ii, v as Di, w as Jt, x as lu, y as _u, z as du, A as uu, E as pu, G as mu, M as re, H as ri, J as ai, K as nt, L as te, N as oi, O as gu, Q as Eu, R as ii, U as Su, V as fu, W as At, X as Ko, Y as bu, Z as Qo, _ as Tu, $ as jt, a0 as Ee, a1 as hu, a2 as yt } from "./index-
|
|
4
|
+
import { S as jd, a as eu, b as tu, c as nu, d as Oi, p as ni, l as oe, B as ie, T as K, D as $o, F as W, C as mt, e as Se, I as ee, f as ft, g as ru, h as au, i as Ut, j as Ae, P as ou, k as iu, m as su, n as cu, o as Ze, q as Wo, r as be, s as Ai, t as yi, u as Ii, v as Di, w as Jt, x as lu, y as _u, z as du, A as uu, E as pu, G as mu, M as re, H as ri, J as ai, K as nt, L as te, N as oi, O as gu, Q as Eu, R as ii, U as Su, V as fu, W as At, X as Ko, Y as bu, Z as Qo, _ as Tu, $ as jt, a0 as Ee, a1 as hu, a2 as yt } from "./index-B_ImEGPI.mjs";
|
|
5
5
|
import { useQuery as gt, useQueryClient as ye, useMutation as ge } from "@tanstack/react-query";
|
|
6
|
-
import { u as fe, C as J, R as Ce, g as x, a as bt, U as Ru, b as We, c as wi, d as Mi, e as Cu } from "./index-
|
|
6
|
+
import { u as fe, C as J, R as Ce, g as x, a as bt, U as Ru, b as We, c as wi, d as Mi, e as Cu } from "./index-CQD92qgD.mjs";
|
|
7
7
|
import { create as Nu } from "zustand/react";
|
|
8
8
|
import * as ue from "react";
|
|
9
9
|
import { useCallback as Ft, useMemo as Bt, useContext as vu, useState as Ge, useRef as ud, Fragment as Ou } from "react";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e, Fragment as O, jsxs as i } from "react/jsx-runtime";
|
|
2
|
-
import { l as j, e as L, f as ae, B as p, a3 as re, F as q, T as m, $ as r, o as n, a4 as T, a5 as x, a6 as f, a7 as se, a8 as N, a9 as Q, aa as le } from "./index-
|
|
2
|
+
import { l as j, e as L, f as ae, B as p, a3 as re, F as q, T as m, $ as r, o as n, a4 as T, a5 as x, a6 as f, a7 as se, a8 as N, a9 as Q, aa as le } from "./index-B_ImEGPI.mjs";
|
|
3
3
|
import { useTracking as ce, useNotification as de, Page as W, Layouts as D, Form as ge } from "@strapi/strapi/admin";
|
|
4
4
|
import { useMutation as A, useQuery as M, useQueryClient as he, QueryClient as pe } from "@tanstack/react-query";
|
|
5
5
|
import { useMemo as me, useRef as ue, useState as be, useCallback as $ } from "react";
|
|
6
6
|
import fe from "styled-components";
|
|
7
|
-
import { u as U, e as ye, a as Se, g as t, d as we } from "./index-
|
|
7
|
+
import { u as U, e as ye, a as Se, g as t, d as we } from "./index-CQD92qgD.mjs";
|
|
8
8
|
const P = ({
|
|
9
9
|
children: d,
|
|
10
10
|
condition: l
|