@strapi/admin 4.11.0-exp.push-transfer-push-stuck → 4.11.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.
- package/admin/src/components/Providers/index.js +32 -32
- package/admin/src/components/Theme/index.js +5 -3
- package/admin/src/content-manager/components/ComponentIcon/ComponentIcon.js +16 -26
- package/admin/src/content-manager/components/ComponentIcon/constants.js +133 -0
- package/admin/src/content-manager/components/DynamicTable/BulkActionsBar/index.js +307 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +20 -4
- package/admin/src/content-manager/components/DynamicZone/components/AddComponentButton.js +32 -95
- package/admin/src/content-manager/components/DynamicZone/components/ComponentCard.js +10 -2
- package/admin/src/content-manager/components/DynamicZone/components/ComponentCategory.js +63 -15
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker.js +50 -63
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +132 -58
- package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +29 -37
- package/admin/src/content-manager/components/DynamicZone/index.js +131 -83
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +31 -8
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +18 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/index.js +0 -1
- package/admin/src/content-manager/components/Inputs/index.js +18 -11
- package/admin/src/content-manager/components/Inputs/utils/index.js +0 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/DynamicZoneList.js +7 -1
- package/admin/src/content-manager/pages/EditView/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +118 -2
- package/admin/src/content-manager/utils/index.js +2 -0
- package/admin/src/content-manager/{components/EditViewDataManagerProvider/utils → utils}/schema.js +1 -1
- package/admin/src/hooks/useContentTypes/useContentTypes.js +0 -2
- package/admin/src/index.js +4 -3
- package/admin/src/injectionZones.js +6 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/EventTableCE.js +13 -0
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +3 -0
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js +331 -0
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/Combobox.js +54 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js +12 -23
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +129 -116
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/utils/makeWebhookValidationSchema.js +62 -0
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +59 -64
- package/admin/src/translations/ar.json +684 -1
- package/admin/src/translations/en.json +12 -1
- package/build/3562.e0b1a0b3.chunk.js +50 -0
- package/build/371.6e4e2c1f.chunk.js +71 -0
- package/build/5297.31c9ffdc.chunk.js +39 -0
- package/build/5542.64b623c9.chunk.js +63 -0
- package/build/{5563.79950369.chunk.js → 5563.badbffde.chunk.js} +2 -2
- package/build/6691.f7a3b5ac.chunk.js +105 -0
- package/build/6970.d456705f.chunk.js +1 -0
- package/build/{7259.5cc67413.chunk.js → 7259.5d0de931.chunk.js} +1 -1
- package/build/8976.0022f5a3.chunk.js +50 -0
- package/build/{1657.ca8562dd.chunk.js → 9932.5ef475c5.chunk.js} +54 -62
- package/build/Admin-authenticatedApp.ab2b5910.chunk.js +79 -0
- package/build/{Admin_InternalErrorPage.96ceaae1.chunk.js → Admin_InternalErrorPage.f25f04f3.chunk.js} +1 -1
- package/build/Admin_homePage.05063e43.chunk.js +73 -0
- package/build/Admin_marketplace.005d2d5b.chunk.js +55 -0
- package/build/Admin_pluginsPage.5d9d4060.chunk.js +6 -0
- package/build/{Admin_profilePage.a8fa3a56.chunk.js → Admin_profilePage.ab7b94d7.chunk.js} +2 -2
- package/build/Admin_settingsPage.07a6a5f0.chunk.js +79 -0
- package/build/{Upload_ConfigureTheView.aa64ed9a.chunk.js → Upload_ConfigureTheView.121deffb.chunk.js} +1 -1
- package/build/admin-app.7cc667be.chunk.js +63 -0
- package/build/{admin-edit-roles-page.0d12b741.chunk.js → admin-edit-roles-page.bfe3304d.chunk.js} +3 -3
- package/build/{admin-edit-users.f9ce7844.chunk.js → admin-edit-users.6efe0382.chunk.js} +2 -2
- package/build/admin-roles-list.b2577370.chunk.js +23 -0
- package/build/admin-users.4af49ccf.chunk.js +26 -0
- package/build/{api-tokens-create-page.973d2816.chunk.js → api-tokens-create-page.65411a36.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.29725c5e.chunk.js → api-tokens-edit-page.60312cb6.chunk.js} +1 -1
- package/build/{api-tokens-list-page.66c4fbdd.chunk.js → api-tokens-list-page.01a4d5cd.chunk.js} +2 -2
- package/build/ar-json.f530bc3f.chunk.js +1 -0
- package/build/audit-logs-settings-page.b165679b.chunk.js +16 -0
- package/build/content-manager.8cc6c3f9.chunk.js +1094 -0
- package/build/content-type-builder-list-view.58f9ed20.chunk.js +211 -0
- package/build/{content-type-builder-translation-en-json.af293c9e.chunk.js → content-type-builder-translation-en-json.f592325b.chunk.js} +1 -1
- package/build/content-type-builder.baeb0413.chunk.js +132 -0
- package/build/email-settings-page.8caad83f.chunk.js +11 -0
- package/build/en-json.a8f34002.chunk.js +1 -0
- package/build/i18n-settings-page.579d5eab.chunk.js +9 -0
- package/build/i18n-translation-en-json.1ec7becf.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.1d678f7b.js +2926 -0
- package/build/{review-workflows-settings.56cab253.chunk.js → review-workflows-settings.3a7bae25.chunk.js} +2 -2
- package/build/{runtime~main.adbe36a4.js → runtime~main.9dbd4553.js} +2 -2
- package/build/{sso-settings-page.265e3d72.chunk.js → sso-settings-page.4bb073e0.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.170acee6.chunk.js → transfer-tokens-create-page.9ec277d7.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.6cf23295.chunk.js → transfer-tokens-edit-page.fa5ade14.chunk.js} +1 -1
- package/build/{transfer-tokens-list-page.c3fec4c1.chunk.js → transfer-tokens-list-page.5d68d590.chunk.js} +2 -2
- package/build/upload-settings.2c1565d6.chunk.js +14 -0
- package/build/upload.257b2aef.chunk.js +26 -0
- package/build/users-advanced-settings-page.ddd29040.chunk.js +9 -0
- package/build/users-email-settings-page.717e2a51.chunk.js +24 -0
- package/build/users-providers-settings-page.c7eae829.chunk.js +29 -0
- package/build/{users-roles-settings-page.2549794b.chunk.js → users-roles-settings-page.63cf2838.chunk.js} +1 -1
- package/build/webhook-edit-page.8576742e.chunk.js +31 -0
- package/build/webhook-list-page.abf5747c.chunk.js +63 -0
- package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/EventTableEE.js +23 -0
- package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/index.js +3 -0
- package/ee/server/services/review-workflows/review-workflows.js +4 -0
- package/package.json +22 -24
- package/server/controllers/webhooks.js +6 -6
- package/admin/src/content-manager/components/DynamicTable/ConfirmDialogDeleteAll/index.js +0 -73
- package/admin/src/content-manager/components/DynamicZone/utils/connect.js +0 -12
- package/admin/src/content-manager/components/DynamicZone/utils/select.js +0 -53
- package/admin/src/content-manager/components/Inputs/utils/getStep.js +0 -13
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/EventRow.js +0 -70
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +0 -174
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/keys.js +0 -39
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/utils/fieldsRegex.js +0 -4
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/utils/schema.js +0 -35
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/reducer.js +0 -100
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/utils/formatData.js +0 -20
- package/build/3081.c2cdfac8.chunk.js +0 -108
- package/build/3816.60f858cf.chunk.js +0 -211
- package/build/462.a073ff1f.chunk.js +0 -71
- package/build/5542.002522eb.chunk.js +0 -71
- package/build/617.87b2fe96.chunk.js +0 -155
- package/build/6858.85d76858.chunk.js +0 -50
- package/build/6970.6a329e15.chunk.js +0 -1
- package/build/Admin-authenticatedApp.d425b485.chunk.js +0 -79
- package/build/Admin_homePage.107a9fe0.chunk.js +0 -73
- package/build/Admin_marketplace.717bd7ca.chunk.js +0 -55
- package/build/Admin_pluginsPage.7df6b5a9.chunk.js +0 -6
- package/build/Admin_settingsPage.1394aaf2.chunk.js +0 -79
- package/build/admin-app.ac5b1f59.chunk.js +0 -63
- package/build/admin-roles-list.e8bf9685.chunk.js +0 -31
- package/build/admin-users.751b28b2.chunk.js +0 -34
- package/build/ar-json.39e54aba.chunk.js +0 -1
- package/build/audit-logs-settings-page.3c6cea81.chunk.js +0 -129
- package/build/content-manager.70548048.chunk.js +0 -1123
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +0 -215
- package/build/content-type-builder.b10576e7.chunk.js +0 -126
- package/build/email-settings-page.dba83275.chunk.js +0 -11
- package/build/en-json.d965e364.chunk.js +0 -1
- package/build/i18n-settings-page.55628f74.chunk.js +0 -114
- package/build/i18n-translation-en-json.60af6722.chunk.js +0 -1
- package/build/main.d9d9ed10.js +0 -2630
- package/build/upload-settings.63d99bf5.chunk.js +0 -14
- package/build/upload.c50d8c7a.chunk.js +0 -34
- package/build/users-advanced-settings-page.4f49ca57.chunk.js +0 -9
- package/build/users-email-settings-page.d2429d0a.chunk.js +0 -24
- package/build/users-providers-settings-page.50c5ba27.chunk.js +0 -29
- package/build/webhook-edit-page.ddd5963d.chunk.js +0 -128
- package/build/webhook-list-page.e2fca9f8.chunk.js +0 -71
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[4121],{32393:function(R,E,t){t.r(E),t.d(E,{default:function(){return ce}});var e=t(32735),s=t(69262),c=t(83983),h=t(53038),f=t(67879),p=t(20108),T=t(94638),D=t(96709),S=t(27649),i=t(82055),P=t(99223),m=t(49372),I=t(41415),q=t(17e3),U=t(72850),_=t(56755),ee=t(73269),te=t(33827),K=t(94547),r=t(19786),V=t(82884),ne=t(3685),ae=t(35658),k=t(87933),b=t(74512),F=t(8471);const j=F.ZP.div`
|
|
2
|
+
background: ${({theme:o})=>o.colors.danger500};
|
|
3
|
+
border: none;
|
|
4
|
+
border-radius: 16px;
|
|
5
|
+
position: relative;
|
|
6
|
+
height: ${24/16}rem;
|
|
7
|
+
width: ${40/16}rem;
|
|
8
|
+
|
|
9
|
+
& span {
|
|
10
|
+
font-size: ${({visibleLabels:o})=>o?"1rem":0};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:before {
|
|
14
|
+
content: '';
|
|
15
|
+
background: ${({theme:o})=>o.colors.neutral0};
|
|
16
|
+
width: 1rem;
|
|
17
|
+
height: 1rem;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
position: absolute;
|
|
20
|
+
transition: all 0.5s;
|
|
21
|
+
left: ${({theme:o})=>o.spaces[1]};
|
|
22
|
+
top: ${({theme:o})=>o.spaces[1]};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (prefers-reduced-motion: reduce) {
|
|
26
|
+
&:before {
|
|
27
|
+
transition: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`,se=F.ZP.button`
|
|
31
|
+
background: transparent;
|
|
32
|
+
padding: 0;
|
|
33
|
+
border: none;
|
|
34
|
+
|
|
35
|
+
&[aria-checked='true'] ${j} {
|
|
36
|
+
background: ${({theme:o})=>o.colors.success500};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&[aria-checked='true'] ${j}:before {
|
|
40
|
+
transform: translateX(1rem);
|
|
41
|
+
}
|
|
42
|
+
`,oe=e.forwardRef(({label:o,onChange:u,onLabel:v="On",offLabel:d="Off",selected:a,visibleLabels:g=!1,...x},$)=>(0,b.jsx)(se,{ref:$,role:"switch","aria-checked":a,"aria-label":o,onClick:u,visibleLabels:g,type:"button",...x,children:(0,b.jsxs)(k.k,{children:[(0,b.jsxs)(j,{children:[(0,b.jsx)("span",{children:v}),(0,b.jsx)("span",{children:d})]}),g&&(0,b.jsx)(U.x,{as:"span","aria-hidden":!0,paddingLeft:2,color:a?"success600":"danger600",children:a?v:d})]})}));var z=t(50563),le=t(9695),w=t(19406),H=t(4038),re=t(68625),ie=t(54725),de=()=>{const[o,u]=(0,e.useState)(!1),[v,d]=(0,e.useState)([]),{formatMessage:a}=(0,f.Z)(),{formatAPIError:g}=(0,s.So)(),x=(0,s.lm)();(0,s.go)();const{push:$}=(0,h.k6)(),{pathname:N}=(0,h.TH)(),{isLoading:me,allowedActions:{canCreate:O,canUpdate:Q,canDelete:Y}}=(0,s.ss)(c.Z.settings.webhooks),{get:he,post:ue,put:ge}=(0,s.kY)(),{notifyStatus:G}=(0,T.G)(),Ee="webhooks",{isLoading:fe,data:M,error:Z,refetch:X}=(0,p.useQuery)(Ee,async()=>{const{data:{data:n}}=await he("/admin/webhooks");return n});(0,e.useEffect)(()=>{if(Z){x({type:"warning",message:g(Z)});return}M&&G(a({id:"Settings.webhooks.list.loading.success",defaultMessage:"Webhooks have been loaded"}))},[M,Z,x,a,G,g]);const J=(0,p.useMutation)(async()=>{await ue("/admin/webhooks/batch-delete",{ids:v})},{onError(n){x({type:"warning",message:g(n)}),u(!1)},onSuccess(){d([]),u(!1),X()}}),be=(0,p.useMutation)(async({isEnabled:n,id:l})=>{const{id:L,...W}=M.find(Ce=>Ce.id===l)??{},pe={...W,isEnabled:n};await ge(`/admin/webhooks/${l}`,pe)},{onError(n){x({type:"warning",message:g(n)})},onSuccess(){X()}}),ve=()=>J.mutate(),xe=n=>d(n?M.map(l=>l.id):[]),Me=(n,l)=>d(n?L=>[...L,l]:L=>L.filter(W=>W!==l)),A=n=>$(`${N}/${n}`),B=me||fe,y=M?.length??0,C=v.length;return e.createElement(D.A,null,e.createElement(s.SL,{name:"Webhooks"}),e.createElement(S.o,{"aria-busy":B},e.createElement(i.T,{title:a({id:"Settings.webhooks.title",defaultMessage:"Webhooks"}),subtitle:a({id:"Settings.webhooks.list.description",defaultMessage:"Get POST changes notifications"}),primaryAction:O&&!B&&e.createElement(s.Qj,{startIcon:e.createElement(w.Z,null),variant:"default",to:`${N}/create`,size:"S"},a({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))}),C>0&&Y&&e.createElement(P.Z,{startActions:e.createElement(e.Fragment,null,e.createElement(m.Z,{variant:"epsilon",textColor:"neutral600"},a({id:"Settings.webhooks.to.delete",defaultMessage:"{webhooksToDeleteLength, plural, one {# webhook} other {# webhooks}} selected"},{webhooksToDeleteLength:C})),e.createElement(I.z,{onClick:()=>u(!0),startIcon:e.createElement(H.Z,null),size:"L",variant:"danger-light"},a({id:"global.delete",defaultMessage:"Delete"})))}),e.createElement(q.D,null,B?e.createElement(U.x,{background:"neutral0",padding:6,shadow:"filterShadow",hasRadius:!0},e.createElement(s.dO,null)):y>0?e.createElement(_.i,{colCount:5,rowCount:y+1,footer:e.createElement(ee.c,{onClick:()=>O?A("create"):{},icon:e.createElement(w.Z,null)},a({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))},e.createElement(te.h,null,e.createElement(K.Tr,null,e.createElement(r.Th,null,e.createElement(V.C,{"aria-label":a({id:"global.select-all-entries",defaultMessage:"Select all entries"}),indeterminate:C>0&&C<y,value:C===y,onValueChange:xe})),e.createElement(r.Th,{width:"20%"},e.createElement(m.Z,{variant:"sigma",textColor:"neutral600"},a({id:"global.name",defaultMessage:"Name"}))),e.createElement(r.Th,{width:"60%"},e.createElement(m.Z,{variant:"sigma",textColor:"neutral600"},a({id:"Settings.webhooks.form.url",defaultMessage:"URL"}))),e.createElement(r.Th,{width:"20%"},e.createElement(m.Z,{variant:"sigma",textColor:"neutral600"},a({id:"Settings.webhooks.list.th.status",defaultMessage:"Status"}))),e.createElement(r.Th,null,e.createElement(ne.T,null,a({id:"Settings.webhooks.list.th.actions",defaultMessage:"Actions"}))))),e.createElement(ae.p,null,M.map(n=>e.createElement(K.Tr,{key:n.id,...(0,s.X7)({fn:()=>A(n.id),condition:Q})},e.createElement(r.Td,{...s.UW},e.createElement(V.C,{"aria-label":`${a({id:"global.select",defaultMessage:"Select"})} ${n.name}`,value:v?.includes(n.id),onValueChange:l=>Me(l,n.id),name:"select"})),e.createElement(r.Td,null,e.createElement(m.Z,{fontWeight:"semiBold",textColor:"neutral800"},n.name)),e.createElement(r.Td,null,e.createElement(m.Z,{textColor:"neutral800"},n.url)),e.createElement(r.Td,null,e.createElement(k.k,null,e.createElement(oe,{onLabel:a({id:"global.enabled",defaultMessage:"Enabled"}),offLabel:a({id:"global.disabled",defaultMessage:"Disabled"}),label:`${n.name} ${a({id:"Settings.webhooks.list.th.status",defaultMessage:"Status"})}`,selected:n.isEnabled,onChange:l=>{l.stopPropagation(),be.mutate({isEnabled:!n.isEnabled,id:n.id})},visibleLabels:!0}))),e.createElement(r.Td,null,e.createElement(k.k,{gap:1},Q&&e.createElement(z.h,{label:a({id:"Settings.webhooks.events.update",defaultMessage:"Update"}),icon:e.createElement(re.Z,null),noBorder:!0}),Y&&e.createElement(z.h,{onClick:l=>{l.stopPropagation(),d([n.id]),u(!0)},label:a({id:"Settings.webhooks.events.delete",defaultMessage:"Delete webhook"}),icon:e.createElement(H.Z,null),noBorder:!0}))))))):e.createElement(le.x,{icon:e.createElement(ie.Z,{width:"160px"}),content:a({id:"Settings.webhooks.list.empty.description",defaultMessage:"No webhooks found"}),action:e.createElement(I.z,{variant:"secondary",startIcon:e.createElement(w.Z,null),onClick:()=>O?A("create"):{}},a({id:"Settings.webhooks.list.button.add",defaultMessage:"Create new webhook"}))}))),e.createElement(s.QH,{isOpen:o,onToggleDialog:()=>u(n=>!n),onConfirm:ve,isConfirmButtonLoading:J.isLoading}))},ce=()=>e.createElement(s.O4,{permissions:c.Z.settings.webhooks.main},e.createElement(de,null))},99223:function(R,E,t){t.d(E,{Z:function(){return c}});var e=t(74512),s=t(87933);const c=({startActions:h,endActions:f})=>!h&&!f?null:(0,e.jsxs)(s.k,{justifyContent:"space-between",alignItems:"flex-start",paddingBottom:4,paddingLeft:10,paddingRight:10,children:[(0,e.jsx)(s.k,{gap:2,wrap:"wrap",children:h}),(0,e.jsx)(s.k,{gap:2,shrink:0,wrap:"wrap",children:f})]})},73269:function(R,E,t){t.d(E,{c:function(){return S}});var e=t(74512),s=t(8471),c=t(72850),h=t(9026),f=t(87933),p=t(49372);const T=(0,s.ZP)(c.x)`
|
|
43
|
+
height: ${24/16}rem;
|
|
44
|
+
width: ${24/16}rem;
|
|
45
|
+
border-radius: 50%;
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
|
|
50
|
+
svg {
|
|
51
|
+
height: ${10/16}rem;
|
|
52
|
+
width: ${10/16}rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
svg path {
|
|
56
|
+
fill: ${({theme:i})=>i.colors.primary600};
|
|
57
|
+
}
|
|
58
|
+
`,D=(0,s.ZP)(c.x)`
|
|
59
|
+
border-radius: 0 0 ${({theme:i})=>i.borderRadius} ${({theme:i})=>i.borderRadius};
|
|
60
|
+
display: block;
|
|
61
|
+
width: 100%;
|
|
62
|
+
border: none;
|
|
63
|
+
`,S=({children:i,icon:P,...m})=>(0,e.jsxs)("div",{children:[(0,e.jsx)(h.i,{}),(0,e.jsx)(D,{as:"button",background:"primary100",padding:5,...m,children:(0,e.jsxs)(f.k,{children:[(0,e.jsx)(T,{"aria-hidden":!0,background:"primary200",children:P}),(0,e.jsx)(c.x,{paddingLeft:3,children:(0,e.jsx)(p.Z,{variant:"pi",fontWeight:"bold",textColor:"primary600",children:i})})]})})]})}}]);
|
package/ee/admin/pages/SettingsPage/pages/Webhooks/EditView/components/EventTable/EventTableEE.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import EventTable from '../../../../../../../../../admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events';
|
|
4
|
+
|
|
5
|
+
// const events = {
|
|
6
|
+
// 'review-workflows': ['workflows.updateEntryStage'],
|
|
7
|
+
// };
|
|
8
|
+
|
|
9
|
+
// TODO: extend this to support review workflow events once the BE logic is ready
|
|
10
|
+
// const getHeaders = () => {
|
|
11
|
+
// return [{ id: 'review-workflows.updateEntryStage', defaultMessage: 'Stage Change' }];
|
|
12
|
+
// };
|
|
13
|
+
|
|
14
|
+
export function EventTableEE() {
|
|
15
|
+
return (
|
|
16
|
+
<EventTable.Root>
|
|
17
|
+
<EventTable.Headers />
|
|
18
|
+
<EventTable.Body />
|
|
19
|
+
{/* <EventTable.Headers getHeaders={getHeaders} />
|
|
20
|
+
<EventTable.Body providedEvents={events} /> */}
|
|
21
|
+
</EventTable.Root>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -108,12 +108,16 @@ function persistStagesJoinTables({ strapi }) {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
const registerWebhookEvents = async ({ strapi }) =>
|
|
112
|
+
strapi.webhookStore.addAllowedEvent('WORKFLOW_UPDATE_STAGE', 'workflow.updateEntryStage');
|
|
113
|
+
|
|
111
114
|
module.exports = ({ strapi }) => {
|
|
112
115
|
const workflowsService = getService('workflows', { strapi });
|
|
113
116
|
const stagesService = getService('stages', { strapi });
|
|
114
117
|
|
|
115
118
|
return {
|
|
116
119
|
async bootstrap() {
|
|
120
|
+
await registerWebhookEvents({ strapi });
|
|
117
121
|
await initDefaultWorkflow({ workflowsService, stagesService, strapi });
|
|
118
122
|
},
|
|
119
123
|
async register() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.11.0
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"@casl/ability": "^5.4.3",
|
|
49
49
|
"@fingerprintjs/fingerprintjs": "3.4.1",
|
|
50
50
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
51
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.11.0
|
|
52
|
-
"@strapi/data-transfer": "4.11.0
|
|
53
|
-
"@strapi/design-system": "1.
|
|
54
|
-
"@strapi/helper-plugin": "4.11.0
|
|
55
|
-
"@strapi/icons": "1.
|
|
56
|
-
"@strapi/permissions": "4.11.0
|
|
57
|
-
"@strapi/provider-audit-logs-local": "4.11.0
|
|
58
|
-
"@strapi/typescript-utils": "4.11.0
|
|
59
|
-
"@strapi/utils": "4.11.0
|
|
60
|
-
"axios": "1.
|
|
51
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.11.0",
|
|
52
|
+
"@strapi/data-transfer": "4.11.0",
|
|
53
|
+
"@strapi/design-system": "1.8.0",
|
|
54
|
+
"@strapi/helper-plugin": "4.11.0",
|
|
55
|
+
"@strapi/icons": "1.8.0",
|
|
56
|
+
"@strapi/permissions": "4.11.0",
|
|
57
|
+
"@strapi/provider-audit-logs-local": "4.11.0",
|
|
58
|
+
"@strapi/typescript-utils": "4.11.0",
|
|
59
|
+
"@strapi/utils": "4.11.0",
|
|
60
|
+
"axios": "1.4.0",
|
|
61
61
|
"babel-loader": "^9.1.2",
|
|
62
62
|
"babel-plugin-styled-components": "2.1.1",
|
|
63
63
|
"bcryptjs": "2.4.3",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"chokidar": "^3.5.1",
|
|
68
68
|
"codemirror5": "npm:codemirror@^5.65.11",
|
|
69
69
|
"cross-env": "^7.0.3",
|
|
70
|
-
"css-loader": "^6.
|
|
70
|
+
"css-loader": "^6.8.1",
|
|
71
71
|
"date-fns": "2.30.0",
|
|
72
72
|
"dotenv": "8.5.1",
|
|
73
73
|
"esbuild-loader": "^2.21.0",
|
|
@@ -75,12 +75,11 @@
|
|
|
75
75
|
"fast-deep-equal": "3.1.3",
|
|
76
76
|
"find-root": "1.1.0",
|
|
77
77
|
"fork-ts-checker-webpack-plugin": "7.3.0",
|
|
78
|
-
"formik": "^2.
|
|
78
|
+
"formik": "^2.4.0",
|
|
79
79
|
"fractional-indexing": "3.2.0",
|
|
80
80
|
"fs-extra": "10.0.0",
|
|
81
81
|
"highlight.js": "^10.4.1",
|
|
82
82
|
"history": "^4.9.0",
|
|
83
|
-
"hoist-non-react-statics": "^3.3.0",
|
|
84
83
|
"html-loader": "^4.2.0",
|
|
85
84
|
"html-webpack-plugin": "5.5.0",
|
|
86
85
|
"immer": "9.0.19",
|
|
@@ -107,17 +106,17 @@
|
|
|
107
106
|
"p-map": "4.0.0",
|
|
108
107
|
"passport-local": "1.0.0",
|
|
109
108
|
"pluralize": "8.0.0",
|
|
110
|
-
"prop-types": "^15.
|
|
109
|
+
"prop-types": "^15.8.1",
|
|
111
110
|
"qs": "6.11.1",
|
|
112
|
-
"react": "^
|
|
111
|
+
"react": "^18.2.0",
|
|
113
112
|
"react-dnd": "15.1.2",
|
|
114
113
|
"react-dnd-html5-backend": "15.1.3",
|
|
115
|
-
"react-dom": "^
|
|
114
|
+
"react-dom": "^18.2.0",
|
|
116
115
|
"react-error-boundary": "3.1.4",
|
|
117
116
|
"react-helmet": "^6.1.0",
|
|
118
117
|
"react-intl": "6.4.1",
|
|
119
|
-
"react-is": "^
|
|
120
|
-
"react-query": "3.
|
|
118
|
+
"react-is": "^18.2.0",
|
|
119
|
+
"react-query": "3.39.3",
|
|
121
120
|
"react-redux": "8.0.5",
|
|
122
121
|
"react-refresh": "0.14.0",
|
|
123
122
|
"react-router-dom": "5.3.4",
|
|
@@ -131,7 +130,7 @@
|
|
|
131
130
|
"sift": "16.0.1",
|
|
132
131
|
"style-loader": "3.3.1",
|
|
133
132
|
"styled-components": "5.3.3",
|
|
134
|
-
"typescript": "5.
|
|
133
|
+
"typescript": "5.1.3",
|
|
135
134
|
"webpack": "^5.82.0",
|
|
136
135
|
"webpack-cli": "^5.1.0",
|
|
137
136
|
"webpack-dev-server": "^4.15.0",
|
|
@@ -139,9 +138,8 @@
|
|
|
139
138
|
"yup": "^0.32.9"
|
|
140
139
|
},
|
|
141
140
|
"devDependencies": {
|
|
142
|
-
"@testing-library/dom": "
|
|
143
|
-
"@testing-library/react": "
|
|
144
|
-
"@testing-library/react-hooks": "8.0.1",
|
|
141
|
+
"@testing-library/dom": "9.2.0",
|
|
142
|
+
"@testing-library/react": "14.0.0",
|
|
145
143
|
"@testing-library/user-event": "14.4.3",
|
|
146
144
|
"duplicate-dependencies-webpack-plugin": "^1.0.2",
|
|
147
145
|
"glob": "8.0.3",
|
|
@@ -165,5 +163,5 @@
|
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
165
|
},
|
|
168
|
-
"gitHead": "
|
|
166
|
+
"gitHead": "0de06a008d1dfbe67ebfee3562cc8ca0603d2255"
|
|
169
167
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const _ = require('lodash');
|
|
4
|
-
const { yup,
|
|
4
|
+
const { yup, validateYupSchema } = require('@strapi/utils');
|
|
5
5
|
|
|
6
6
|
const urlRegex =
|
|
7
7
|
/^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9_]-*)*[a-z\u00a1-\uffff0-9_]+)(?:\.(?:[a-z\u00a1-\uffff0-9_]-*)*[a-z\u00a1-\uffff0-9_]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/;
|
|
@@ -23,7 +23,7 @@ const webhookValidator = yup
|
|
|
23
23
|
)
|
|
24
24
|
.required();
|
|
25
25
|
}),
|
|
26
|
-
events: yup.array().of(yup.string()
|
|
26
|
+
events: yup.array().of(yup.string()).required(),
|
|
27
27
|
})
|
|
28
28
|
.noUnknown();
|
|
29
29
|
|
|
@@ -111,10 +111,10 @@ module.exports = {
|
|
|
111
111
|
for (const id of ids) {
|
|
112
112
|
const webhook = await strapi.webhookStore.findWebhook(id);
|
|
113
113
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
if (webhook) {
|
|
115
|
+
await strapi.webhookStore.deleteWebhook(id);
|
|
116
|
+
strapi.webhookRunner.remove(webhook);
|
|
117
|
+
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
ctx.send({ data: ids });
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { Dialog, DialogBody, DialogFooter, Flex, Typography, Button } from '@strapi/design-system';
|
|
5
|
-
import { ExclamationMarkCircle, Trash } from '@strapi/icons';
|
|
6
|
-
import InjectionZoneList from '../../InjectionZoneList';
|
|
7
|
-
import { getTrad } from '../../../utils';
|
|
8
|
-
|
|
9
|
-
const ConfirmDialogDeleteAll = ({ isConfirmButtonLoading, isOpen, onToggleDialog, onConfirm }) => {
|
|
10
|
-
const { formatMessage } = useIntl();
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Dialog
|
|
14
|
-
onClose={onToggleDialog}
|
|
15
|
-
title={formatMessage({
|
|
16
|
-
id: 'app.components.ConfirmDialog.title',
|
|
17
|
-
defaultMessage: 'Confirmation',
|
|
18
|
-
})}
|
|
19
|
-
labelledBy="confirmation"
|
|
20
|
-
describedBy="confirm-description"
|
|
21
|
-
isOpen={isOpen}
|
|
22
|
-
>
|
|
23
|
-
<DialogBody icon={<ExclamationMarkCircle />}>
|
|
24
|
-
<Flex direction="column" alignItems="stretch" gap={2}>
|
|
25
|
-
<Flex justifyContent="center">
|
|
26
|
-
<Typography id="confirm-description">
|
|
27
|
-
{formatMessage({
|
|
28
|
-
id: getTrad('popUpWarning.bodyMessage.contentType.delete.all'),
|
|
29
|
-
defaultMessage: 'Are you sure you want to delete these entries?',
|
|
30
|
-
})}
|
|
31
|
-
</Typography>
|
|
32
|
-
</Flex>
|
|
33
|
-
<Flex>
|
|
34
|
-
<InjectionZoneList area="contentManager.listView.deleteModalAdditionalInfos" />
|
|
35
|
-
</Flex>
|
|
36
|
-
</Flex>
|
|
37
|
-
</DialogBody>
|
|
38
|
-
<DialogFooter
|
|
39
|
-
startAction={
|
|
40
|
-
<Button onClick={onToggleDialog} variant="tertiary">
|
|
41
|
-
{formatMessage({
|
|
42
|
-
id: 'app.components.Button.cancel',
|
|
43
|
-
defaultMessage: 'Cancel',
|
|
44
|
-
})}
|
|
45
|
-
</Button>
|
|
46
|
-
}
|
|
47
|
-
endAction={
|
|
48
|
-
<Button
|
|
49
|
-
onClick={onConfirm}
|
|
50
|
-
variant="danger-light"
|
|
51
|
-
startIcon={<Trash />}
|
|
52
|
-
id="confirm-delete"
|
|
53
|
-
loading={isConfirmButtonLoading}
|
|
54
|
-
>
|
|
55
|
-
{formatMessage({
|
|
56
|
-
id: 'app.components.Button.confirm',
|
|
57
|
-
defaultMessage: 'Confirm',
|
|
58
|
-
})}
|
|
59
|
-
</Button>
|
|
60
|
-
}
|
|
61
|
-
/>
|
|
62
|
-
</Dialog>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
ConfirmDialogDeleteAll.propTypes = {
|
|
67
|
-
isConfirmButtonLoading: PropTypes.bool.isRequired,
|
|
68
|
-
isOpen: PropTypes.bool.isRequired,
|
|
69
|
-
onConfirm: PropTypes.func.isRequired,
|
|
70
|
-
onToggleDialog: PropTypes.func.isRequired,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default ConfirmDialogDeleteAll;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
function connect(WrappedComponent, select) {
|
|
4
|
-
return (props) => {
|
|
5
|
-
// eslint-disable-next-line react/prop-types
|
|
6
|
-
const selectors = select(props.name);
|
|
7
|
-
|
|
8
|
-
return <WrappedComponent {...props} {...selectors} />;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default connect;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
-
|
|
5
|
-
function useSelect(name) {
|
|
6
|
-
const {
|
|
7
|
-
addComponentToDynamicZone,
|
|
8
|
-
createActionAllowedFields,
|
|
9
|
-
isCreatingEntry,
|
|
10
|
-
formErrors,
|
|
11
|
-
modifiedData,
|
|
12
|
-
moveComponentField,
|
|
13
|
-
removeComponentFromDynamicZone,
|
|
14
|
-
readActionAllowedFields,
|
|
15
|
-
updateActionAllowedFields,
|
|
16
|
-
} = useCMEditViewDataManager();
|
|
17
|
-
|
|
18
|
-
const dynamicDisplayedComponents = useMemo(
|
|
19
|
-
() =>
|
|
20
|
-
get(modifiedData, [name], []).map((data) => {
|
|
21
|
-
return {
|
|
22
|
-
componentUid: data.__component,
|
|
23
|
-
id: data.id ?? data.__temp_key__,
|
|
24
|
-
};
|
|
25
|
-
}),
|
|
26
|
-
[modifiedData, name]
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const isFieldAllowed = useMemo(() => {
|
|
30
|
-
const allowedFields = isCreatingEntry ? createActionAllowedFields : updateActionAllowedFields;
|
|
31
|
-
|
|
32
|
-
return allowedFields.includes(name);
|
|
33
|
-
}, [name, isCreatingEntry, createActionAllowedFields, updateActionAllowedFields]);
|
|
34
|
-
|
|
35
|
-
const isFieldReadable = useMemo(() => {
|
|
36
|
-
const allowedFields = isCreatingEntry ? [] : readActionAllowedFields;
|
|
37
|
-
|
|
38
|
-
return allowedFields.includes(name);
|
|
39
|
-
}, [name, isCreatingEntry, readActionAllowedFields]);
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
addComponentToDynamicZone,
|
|
43
|
-
formErrors,
|
|
44
|
-
isCreatingEntry,
|
|
45
|
-
isFieldAllowed,
|
|
46
|
-
isFieldReadable,
|
|
47
|
-
moveComponentField,
|
|
48
|
-
removeComponentFromDynamicZone,
|
|
49
|
-
dynamicDisplayedComponents,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default useSelect;
|
package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/EventRow.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { BaseCheckbox, Checkbox } from '@strapi/design-system';
|
|
4
|
-
import upperFirst from 'lodash/upperFirst';
|
|
5
|
-
|
|
6
|
-
const EventRow = ({ disabledEvents, name, events, inputValue, handleChange, handleChangeAll }) => {
|
|
7
|
-
const enabledCheckboxes = events.filter((event) => {
|
|
8
|
-
return !disabledEvents.includes(event);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const areAllCheckboxesSelected = inputValue.length === enabledCheckboxes.length;
|
|
12
|
-
const hasSomeCheckboxSelected = inputValue.length > 0;
|
|
13
|
-
|
|
14
|
-
const onChangeAll = ({ target: { name } }) => {
|
|
15
|
-
const valueToSet = !areAllCheckboxesSelected;
|
|
16
|
-
|
|
17
|
-
handleChangeAll({
|
|
18
|
-
target: { name, value: valueToSet },
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<tr>
|
|
24
|
-
<td>
|
|
25
|
-
<Checkbox
|
|
26
|
-
indeterminate={hasSomeCheckboxSelected && !areAllCheckboxesSelected}
|
|
27
|
-
aria-label="Select all entries"
|
|
28
|
-
name={name}
|
|
29
|
-
onChange={onChangeAll}
|
|
30
|
-
value={areAllCheckboxesSelected}
|
|
31
|
-
>
|
|
32
|
-
{upperFirst(name)}
|
|
33
|
-
</Checkbox>
|
|
34
|
-
</td>
|
|
35
|
-
|
|
36
|
-
{events.map((event) => {
|
|
37
|
-
return (
|
|
38
|
-
<td key={event}>
|
|
39
|
-
<BaseCheckbox
|
|
40
|
-
disabled={disabledEvents.includes(event)}
|
|
41
|
-
aria-label={event}
|
|
42
|
-
name={event}
|
|
43
|
-
value={inputValue.includes(event)}
|
|
44
|
-
onValueChange={(value) => handleChange({ target: { name: event, value } })}
|
|
45
|
-
/>
|
|
46
|
-
</td>
|
|
47
|
-
);
|
|
48
|
-
})}
|
|
49
|
-
</tr>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
EventRow.defaultProps = {
|
|
54
|
-
disabledEvents: [],
|
|
55
|
-
events: [],
|
|
56
|
-
inputValue: [],
|
|
57
|
-
handleChange() {},
|
|
58
|
-
handleChangeAll() {},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
EventRow.propTypes = {
|
|
62
|
-
disabledEvents: PropTypes.array,
|
|
63
|
-
events: PropTypes.array,
|
|
64
|
-
inputValue: PropTypes.array,
|
|
65
|
-
handleChange: PropTypes.func,
|
|
66
|
-
handleChangeAll: PropTypes.func,
|
|
67
|
-
name: PropTypes.string.isRequired,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default EventRow;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { FieldLabel, Flex, Typography } from '@strapi/design-system';
|
|
4
|
-
import { useFormikContext } from 'formik';
|
|
5
|
-
import { useIntl } from 'react-intl';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import EventRow from './EventRow';
|
|
8
|
-
|
|
9
|
-
export const formatValue = (value) =>
|
|
10
|
-
value.reduce((acc, curr) => {
|
|
11
|
-
const key = curr.split('.')[0];
|
|
12
|
-
|
|
13
|
-
if (!acc[key]) {
|
|
14
|
-
acc[key] = [];
|
|
15
|
-
}
|
|
16
|
-
acc[key].push(curr);
|
|
17
|
-
|
|
18
|
-
return acc;
|
|
19
|
-
}, {});
|
|
20
|
-
|
|
21
|
-
const StyledTable = styled.table`
|
|
22
|
-
td {
|
|
23
|
-
height: ${52 / 16}rem;
|
|
24
|
-
width: 10%;
|
|
25
|
-
vertical-align: middle;
|
|
26
|
-
text-align: center;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
tbody tr:nth-child(odd) {
|
|
30
|
-
background: ${({ theme }) => theme.colors.neutral100};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
tbody tr td:first-child {
|
|
34
|
-
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
const displayedData = {
|
|
39
|
-
headers: {
|
|
40
|
-
default: [
|
|
41
|
-
{ id: 'Settings.webhooks.events.create', defaultMessage: 'Create' },
|
|
42
|
-
{ id: 'Settings.webhooks.events.update', defaultMessage: 'Update' },
|
|
43
|
-
{ id: 'app.utils.delete', defaultMessage: 'Delete' },
|
|
44
|
-
],
|
|
45
|
-
draftAndPublish: [
|
|
46
|
-
{ id: 'Settings.webhooks.events.create', defaultMessage: 'Create' },
|
|
47
|
-
{ id: 'Settings.webhooks.events.update', defaultMessage: 'Update' },
|
|
48
|
-
{ id: 'app.utils.delete', defaultMessage: 'Delete' },
|
|
49
|
-
{ id: 'app.utils.publish', defaultMessage: 'Publish' },
|
|
50
|
-
{ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
events: {
|
|
54
|
-
default: {
|
|
55
|
-
entry: ['entry.create', 'entry.update', 'entry.delete'],
|
|
56
|
-
media: ['media.create', 'media.update', 'media.delete'],
|
|
57
|
-
},
|
|
58
|
-
draftAndPublish: {
|
|
59
|
-
entry: ['entry.create', 'entry.update', 'entry.delete', 'entry.publish', 'entry.unpublish'],
|
|
60
|
-
media: ['media.create', 'media.update', 'media.delete'],
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const EventInput = ({ isDraftAndPublish }) => {
|
|
66
|
-
const headersName = isDraftAndPublish
|
|
67
|
-
? displayedData.headers.draftAndPublish
|
|
68
|
-
: displayedData.headers.default;
|
|
69
|
-
|
|
70
|
-
const events = isDraftAndPublish
|
|
71
|
-
? displayedData.events.draftAndPublish
|
|
72
|
-
: displayedData.events.default;
|
|
73
|
-
|
|
74
|
-
const { formatMessage } = useIntl();
|
|
75
|
-
const { values, handleChange: onChange } = useFormikContext();
|
|
76
|
-
|
|
77
|
-
const inputName = 'events';
|
|
78
|
-
const inputValue = values.events;
|
|
79
|
-
|
|
80
|
-
const disabledEvents = [];
|
|
81
|
-
|
|
82
|
-
const formattedValue = formatValue(inputValue);
|
|
83
|
-
|
|
84
|
-
const handleChange = ({ target: { name, value } }) => {
|
|
85
|
-
let set = new Set(inputValue);
|
|
86
|
-
|
|
87
|
-
if (value) {
|
|
88
|
-
set.add(name);
|
|
89
|
-
} else {
|
|
90
|
-
set.delete(name);
|
|
91
|
-
}
|
|
92
|
-
onChange({ target: { name: inputName, value: Array.from(set) } });
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const handleChangeAll = ({ target: { name, value } }) => {
|
|
96
|
-
let set = new Set(inputValue);
|
|
97
|
-
|
|
98
|
-
if (value) {
|
|
99
|
-
events[name].forEach((event) => {
|
|
100
|
-
if (!disabledEvents.includes(event)) {
|
|
101
|
-
set.add(event);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
events[name].forEach((event) => set.delete(event));
|
|
106
|
-
}
|
|
107
|
-
onChange({ target: { name: inputName, value: Array.from(set) } });
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<Flex direction="column" alignItems="stretch" gap={1}>
|
|
112
|
-
<FieldLabel>
|
|
113
|
-
{formatMessage({
|
|
114
|
-
id: 'Settings.webhooks.form.events',
|
|
115
|
-
defaultMessage: 'Events',
|
|
116
|
-
})}
|
|
117
|
-
</FieldLabel>
|
|
118
|
-
<StyledTable>
|
|
119
|
-
<thead>
|
|
120
|
-
<tr>
|
|
121
|
-
<td />
|
|
122
|
-
{headersName.map((header) => {
|
|
123
|
-
if (header === 'app.utils.publish' || header === 'app.utils.unpublish') {
|
|
124
|
-
return (
|
|
125
|
-
<td
|
|
126
|
-
key={header.id}
|
|
127
|
-
title={formatMessage({
|
|
128
|
-
id: 'Settings.webhooks.event.publish-tooltip',
|
|
129
|
-
defaultMessage:
|
|
130
|
-
'This event only exists for content with draft & publish enabled',
|
|
131
|
-
})}
|
|
132
|
-
>
|
|
133
|
-
<Typography variant="sigma" textColor="neutral600">
|
|
134
|
-
{formatMessage(header)}
|
|
135
|
-
</Typography>
|
|
136
|
-
</td>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<td key={header.id}>
|
|
142
|
-
<Typography variant="sigma" textColor="neutral600">
|
|
143
|
-
{formatMessage(header)}
|
|
144
|
-
</Typography>
|
|
145
|
-
</td>
|
|
146
|
-
);
|
|
147
|
-
})}
|
|
148
|
-
</tr>
|
|
149
|
-
</thead>
|
|
150
|
-
<tbody>
|
|
151
|
-
{Object.keys(events).map((event) => {
|
|
152
|
-
return (
|
|
153
|
-
<EventRow
|
|
154
|
-
disabledEvents={disabledEvents}
|
|
155
|
-
key={event}
|
|
156
|
-
name={event}
|
|
157
|
-
events={events[event]}
|
|
158
|
-
inputValue={formattedValue[event]}
|
|
159
|
-
handleChange={handleChange}
|
|
160
|
-
handleChangeAll={handleChangeAll}
|
|
161
|
-
/>
|
|
162
|
-
);
|
|
163
|
-
})}
|
|
164
|
-
</tbody>
|
|
165
|
-
</StyledTable>
|
|
166
|
-
</Flex>
|
|
167
|
-
);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
EventInput.propTypes = {
|
|
171
|
-
isDraftAndPublish: PropTypes.bool.isRequired,
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export default EventInput;
|