strapi-plugin-comments 3.2.1 → 3.2.2
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/dist/_chunks/{index-CrjZ1-we.mjs → index-BFK8nlhm.mjs} +2 -2
- package/dist/_chunks/{index-BLBuBesY.js → index-BIcDaXS9.js} +1 -1
- package/dist/_chunks/{index-Bos1nB7H.mjs → index-BXQcm9IU.mjs} +2 -2
- package/dist/_chunks/index-BqopobY7.js +44 -0
- package/dist/_chunks/{index-B9qwk6Sf.js → index-C4g76XDn.js} +1 -1
- package/dist/_chunks/index-CWULkNp0.mjs +5700 -0
- package/dist/_chunks/{index-xIUKJDL-.mjs → index-CzeSZ5qw.mjs} +1 -1
- package/dist/_chunks/{index-B19IlxIY.js → index-D_8HT5__.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/_chunks/index-BvWdv1a2.mjs +0 -5704
- package/dist/_chunks/index-CD-Ke6qY.js +0 -44
|
@@ -3,7 +3,7 @@ import { Button as F, Box as p, Flex as q, Typography as m, Grid as s, Field as
|
|
|
3
3
|
import { Check as se, Play as le, ArrowClockwise as N } from "@strapi/icons";
|
|
4
4
|
import { useNotification as ae, Page as W, Layouts as j, Form as ce } from "@strapi/strapi/admin";
|
|
5
5
|
import { useMutation as T, useQuery as P, useQueryClient as de } from "@tanstack/react-query";
|
|
6
|
-
import { u as U, f as ge, a as he, g as t, l as D, e as pe } from "./index-
|
|
6
|
+
import { u as U, f as ge, a as he, g as t, l as D, e as pe } from "./index-CWULkNp0.mjs";
|
|
7
7
|
import { useMemo as me, useRef as ue, useState as be, useCallback as Q } from "react";
|
|
8
8
|
import fe from "styled-components";
|
|
9
9
|
const M = ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),z=require("@strapi/strapi/admin"),Se=require("react-router-dom"),b=require("@strapi/design-system"),h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),z=require("@strapi/strapi/admin"),Se=require("react-router-dom"),b=require("@strapi/design-system"),h=require("./index-BqopobY7.js"),Q=require("@tanstack/react-query"),ed=require("zustand/react"),ee=require("react"),K=require("@strapi/icons"),ge=require("styled-components"),ho=require("./index-BIcDaXS9.js"),td=require("codemirror5"),nd=require("punycode"),rd=require("sanitize-html");require("codemirror5/addon/display/placeholder");const _t=t=>t&&t.__esModule?t:{default:t};function ad(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 _e=ad(ee),Fe=_t(ge),go=_t(td),od=_t(nd),id=_t(rd),sd=(t="")=>`/plugins/${ho.pluginId}/${t}`,cd=(t=null,e=null,n="app.components.notification.error")=>{throw e({type:"warning",message:`${ho.pluginId}.${n}`}),t||new Error("error")},qo=(t="")=>h.lodashExports.isString(t)?t.split(" ").map(e=>h.lodashExports.first(e)).join("").toUpperCase():"",ld=({removed:t,blocked:e,blockedThread:n,approvalStatus:r,reviewFlowEnabled:a})=>{const o=!h.lodashExports.isNil(r);if(t)return h.COMMENT_STATUS.REMOVED;if(e||n)return h.COMMENT_STATUS.BLOCKED;if(a)return h.COMMENT_STATUS.TO_REVIEW;if(o){const i=r.toUpperCase();return Object.keys(h.COMMENT_STATUS).includes(i)?i:h.COMMENT_STATUS.UNKNOWN}return h.COMMENT_STATUS.OPEN},_d=t=>{if(Object.values(h.COMMENT_STATUS).includes(t))switch(t){case h.COMMENT_STATUS.REMOVED:return"secondary";case h.COMMENT_STATUS.TO_REVIEW:case h.COMMENT_STATUS.REJECTED:return"warning";case h.COMMENT_STATUS.BLOCKED:return"danger";case h.COMMENT_STATUS.OPEN:case h.COMMENT_STATUS.APPROVED:return"success"}return"secondary"},dd=({resolved:t,related:{blocked:e,blockedThread:n},approvalStatus:r})=>{const a=!h.lodashExports.isNil(r);if(e||n)return h.REPORT_STATUS.BLOCKED;if(t)return h.REPORT_STATUS.RESOLVED;if(a){const o=r.toUpperCase();return Object.keys(h.REPORT_STATUS).includes(o)?o:h.REPORT_STATUS.PENDING}return h.REPORT_STATUS.PENDING},ud=t=>{switch(t){case h.REPORT_STATUS.PENDING:return"primary";case h.REPORT_STATUS.RESOLVED:return"success";case h.REPORT_STATUS.BLOCKED:return"danger";default:return"primary"}},Yo=t=>{const[e,n]=t.split("/").filter(r=>r.length>0);return{value:e,flags:n}},pd=()=>d.jsxs(d.Fragment,{children:[d.jsxs(b.SubNav,{"aria-label":"Comments sub nav",display:{initial:"none",large:"block"},children:[d.jsx(b.SubNavHeader,{label:h.getMessage("plugin.name")}),d.jsx(b.SubNavSections,{children:d.jsxs(b.SubNavSection,{label:h.getMessage("nav.header.moderation"),children:[d.jsx(b.SubNavLink,{href:"/admin/plugins/comments/discover",children:h.getMessage("nav.item.discover")}),d.jsx(b.SubNavLink,{href:"/admin/plugins/comments/reports",withBullet:!1,children:h.getMessage("nav.item.reports")})]})})]}),d.jsx(b.Box,{display:{initial:"flex",large:"none"},top:"80px",right:"20px",position:"absolute",children:d.jsxs(b.Flex,{direction:"column",gap:2,children:[d.jsx(b.Link,{href:"/admin/plugins/comments/discover",children:h.getMessage("nav.item.discover")}),d.jsx(b.Link,{href:"/admin/plugins/comments/reports",children:h.getMessage("nav.item.reports")})]})})]}),md=t=>{const e=h.useAPI();return Q.useQuery({queryKey:e.config.getKey(),queryFn:()=>e.config.query().then(n=>(t(n),n))})},gd=ed.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})})),Ed=({config:t,entity:e,filters:n,onChangeFilters:r,schema:a})=>{const{entryLabel:o={}}=t,{attributes:i={}}=a,{removed:c=!1}=n;Q.useQueryClient();const s=Object.keys(i),l=h.lodashExports.first(o[e?.uid]),m=h.lodashExports.take(s.filter(S=>i[S].type==="string"&&!h.lodashExports.isNil(e[S])&&S!==l),5),p=(S="")=>S.split("_").map(E=>h.lodashExports.capitalize(E)).join(" "),u=e&&!h.lodashExports.isEmpty(e)&&(!h.lodashExports.isEmpty(m)||e[l]),g=ee.useCallback(S=>{r({...n,removed:S||void 0})},[r,n]);return d.jsxs(b.Box,{padding:4,background:"neutral0",width:"100%",children:[u&&d.jsxs(b.Box,{marginBottom:4,children:[d.jsx(b.Typography,{variant:"sigma",textColor:"neutral600",id:"entity-details",children:h.getMessage("page.details.panel.entity","Details")}),d.jsx(b.Box,{paddingTop:2,paddingBottom:4,children:d.jsx(b.Divider,{})}),d.jsxs(b.Flex,{children:[d.jsxs(b.Flex,{direction:"column",alignItems:"flex-start",children:[d.jsx(b.Typography,{fontWeight:"bold",children:p(l)}),d.jsx(b.Typography,{children:e[l]})]}),d.jsx(b.Flex,{space:4,children:m.map(S=>d.jsxs(b.Flex,{direction:"column",alignItems:"flex-start",children:[d.jsx(b.Typography,{fontWeight:"bold",children:p(S)}),d.jsx(b.Typography,{children:e[S]})]},`prop_${S}`))})]})]}),d.jsxs(b.Box,{children:[d.jsx(b.Typography,{variant:"sigma",textColor:"neutral600",id:"view-filters",children:h.getMessage("page.details.filters.label","View")}),d.jsx(b.Box,{paddingTop:2,paddingBottom:4,children:d.jsx(b.Divider,{})}),d.jsx(b.Flex,{children:d.jsx(b.Checkbox,{checked:c,onCheckedChange:g,children:h.getMessage("page.details.filters.removed.visibility","Show removed comments")})})]})]})},Be=(t={comment:{},report:{}})=>{const e=h.useAPI(),{canModerate:n}=h.usePermissions(),r=S=>n?S:void 0,a=Q.useMutation({mutationFn:r(e.comments.block),onSuccess:t.comment?.blockSuccess,onError:t.comment?.blockError}),o=Q.useMutation({mutationFn:r(e.comments.unblock),onSuccess:t.comment?.unBlockSuccess,onError:t.comment?.unBlockError}),i=Q.useMutation({mutationFn:r(e.comments.blockThread),onSuccess:t.comment?.blockThreadSuccess,onError:t.comment?.blockThreadError}),c=Q.useMutation({mutationFn:r(e.comments.unBlockThread),onSuccess:t.comment?.unBlockThreadSuccess,onError:t.comment?.unBlockThreadError}),s=Q.useMutation({mutationFn:r(e.comments.delete),onSuccess:t.comment?.deleteSuccess,onError:t.comment?.deleteError}),l=Q.useMutation({mutationFn:r(e.comments.postComment),onSuccess:t.comment?.postCommentSuccess,onError:t.comment?.postCommentError}),_=Q.useMutation({mutationFn:r(e.reports.resolveMultipleReports),onSuccess:t.report?.resolveMultipleSuccess,onError:t.report?.resolveMultipleError}),m=Q.useMutation({mutationFn:r(e.reports.resolveCommentMultipleReports),onSuccess:t.report?.resolveCommentMultipleReportsSuccess,onError:t.report?.resolveCommentMultipleReportsError}),p=Q.useMutation({mutationFn:r(e.reports.resolve),onSuccess:t.report?.resolveSuccess,onError:t.report?.resolveError}),u=Q.useMutation({mutationFn:r(e.reports.resolveAllAbuseReportsForComment),onSuccess:t.report?.resolveAllAbuseSuccess,onError:t.report?.resolveAllAbuseError}),g=Q.useMutation({mutationFn:r(e.reports.resolveAllAbuseReportsForThread),onSuccess:t.report?.resolveAllAbuseThreadSuccess,onError:t.report?.resolveAllAbuseThreadError});return ee.useMemo(()=>({commentMutation:{block:a,unBlock:o,blockThread:i,unBlockThread:c,delete:s,postComment:l},reportMutation:{resolve:p,resolveMultiple:_,resolveAllAbuse:u,resolveAllAbuseThread:g,resolveCommentMultipleReports:m}}),[a,o,i,c,_,u,g,s,p])},Co=()=>{const t=ee.useContext(h.UserContext);if(!t)throw new Error("UserContext is not provided");return t},Eo=Fe.default(b.Button)(({isSingle:t})=>({padding:"7px 16px",marginLeft:t?"0":".5rem",whiteSpace:"nowrap"})),g_=({id:t,canModerate:e,queryKey:n})=>{const{toggleNotification:r}=z.useNotification(),{formatMessage:a}=h.useIntl(),o=Q.useQueryClient(),i=h.useAPI(),c=u=>async()=>{await o.invalidateQueries({exact:!1,queryKey:n}),r({type:"success",message:a({id:`${ho.pluginId}.${u}`,defaultMessage:u})})},s=u=>{cd(u,r)},l=Q.useMutation({mutationKey:["approveItem",t],mutationFn:i.comments.approve,onSuccess:c("success.approveItem"),onError:s}),_=()=>{l.mutate(t)},m=Q.useMutation({mutationKey:["rejectItem",t],mutationFn:i.comments.reject,onSuccess:c("success.rejectItem"),onError:s}),p=()=>{m.mutate(t)};return e?d.jsxs(d.Fragment,{children:[d.jsx(b.IconButton,{onClick:_,label:h.getMessage("page.details.actions.comment.reports.approve","Approve"),children:d.jsx(K.Check,{})}),d.jsx(b.IconButton,{label:h.getMessage("page.details.actions.comment.reports.reject","Reject"),onClick:p,children:d.jsx(K.Cross,{})})]}):null},Sd=Fe.default(b.Badge)`
|
|
2
2
|
padding: 5px 8px;
|
|
3
3
|
border: 1px ${({theme:t,color:e})=>{if(!e)return t.colors.neutral200;const n=`${e}200`;return t.colors[n]||t.colors.neutral200}} solid;
|
|
4
4
|
|
package/dist/admin/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("../_chunks/index-
|
|
1
|
+
"use strict";const e=require("../_chunks/index-BIcDaXS9.js");require("react");require("@strapi/design-system");require("@strapi/icons");module.exports=e.index;
|
package/dist/admin/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-comments",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Strapi - Comments plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "comments",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@jest/types": "29.5.x",
|
|
65
65
|
"@sensinum/strapi-utils": "^1.0.10",
|
|
66
|
-
"@strapi/plugin-cloud": "^5.
|
|
67
|
-
"@strapi/plugin-graphql": "^5.
|
|
68
|
-
"@strapi/plugin-users-permissions": "^5.
|
|
66
|
+
"@strapi/plugin-cloud": "^5.37.0",
|
|
67
|
+
"@strapi/plugin-graphql": "^5.37.0",
|
|
68
|
+
"@strapi/plugin-users-permissions": "^5.37.0",
|
|
69
69
|
"@strapi/sdk-plugin": "^5.3.2",
|
|
70
|
-
"@strapi/strapi": "^5.
|
|
71
|
-
"@strapi/types": "^5.
|
|
70
|
+
"@strapi/strapi": "^5.37.0",
|
|
71
|
+
"@strapi/types": "^5.37.0",
|
|
72
72
|
"@types/jest": "^30.0.0",
|
|
73
73
|
"@types/koa": "^2.15.0",
|
|
74
74
|
"@types/minimatch": "3.0.5",
|