D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
local
/
psa
/
admin
/
cp
/
public
/
javascript
/
views
/
admin
/
notifications
/
Filename :
index.js
back
Copy
(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/notifications/index"],{2344:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>x});var t=i(285),a=i(596),o=i.n(a),s=i(1420),l=i(628),d=i(286),c=i(89),r=i(1289),m=i(2345),u=i.n(m),f=i(2346),v=i.n(f);const k=c.Locale.getTranslate("components.notifications.drawer"),g=c.Locale.getTranslate("components.buttons"),p=()=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.FormField,{label:(0,t.jsx)(d.SkeletonText,{lines:1}),children:(0,t.jsx)(d.Skeleton,{height:28})}),(0,t.jsx)(d.FormField,{label:(0,t.jsx)(d.SkeletonText,{lines:1}),children:(0,t.jsx)(d.Skeleton,{height:170})})]}),S=({isOpen:e=!1,onClose:n,previewKey:i=null})=>{const[a,{data:o,loading:c}]=(0,s.useLazyQuery)(u(),{fetchPolicy:"network-only",variables:{code:i}}),[m]=(0,l.useMutation)(v()),[f,S]=(0,t.useState)({});(0,t.useEffect)((()=>{e&&i&&a({variables:{code:i}})}),[i,e,a]);const x=(0,t.useMemo)((()=>o?.notification.emailSettings[0]),[o]);(0,t.useEffect)((()=>{x&&S({subject:x.emailSubject,text:x.emailText})}),[x]);const h=()=>{n()};return(0,t.jsx)(d.Drawer,{"data-type":"edit-notice-drawer",title:(0,t.jsx)(k,{content:"title"}),size:"md",onClose:h,isOpen:e,form:(0,t.jsx)(r.default,{mutation:m,values:f,applyButton:!1,additionalButtons:[(0,t.jsx)(d.Button,{onClick:()=>{S({subject:x.emailDefaultSubject,text:x.emailDefaultText})},children:(0,t.jsx)(k,{content:"resetButton"})},"reset-button")],onSubmit:e=>({...e,code:i}),onSuccess:h,submitButton:{children:(0,t.jsx)(g,{content:"save"}),"data-action":"submit"},cancelButton:{children:(0,t.jsx)(g,{content:"cancel"}),onClick:h},children:c?(0,t.jsx)(p,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.FormFieldText,{name:"subject",size:"fill",required:!0,label:(0,t.jsx)(k,{content:"subject"}),inputProps:{maxLength:"255"}}),(0,t.jsx)(d.FormFieldText,{name:"text",required:!0,multiline:!0,autoheight:!0,size:"fill",rows:8,label:(0,t.jsx)(k,{content:"text"}),inputProps:{maxLength:"65535"}})]})})})};S.propTypes={onClose:o().func.isRequired,isOpen:o().bool,previewKey:o().string};const x=S},2343:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>S});var t=i(285),a=i(586),o=i(628),s=i(580),l=i(286),d=i(1289),c=i(646),r=i(89),m=i(536),u=i(2344),f=i(2347),v=i.n(f),k=i(2348),g=i.n(k);const p=r.Locale.getTranslate("components.lists.notifications"),S=()=>{const e=(0,s.useNavigate)(),{data:n}=(0,a.useQuery)(v()),[i]=(0,o.useMutation)(g()),{config:{notification:{htmlEmail:r}},os:{isWindows:f},mode:{canManageCustomers:k,canManageResellers:S},notification:{expirationWarningTime:x,emailSettings:h}}=n,[N,j]=(0,t.useState)({}),[T,b]=(0,t.useState)({}),[F]=(0,t.useState)({notifications:h.reduce(((e,{code:n,...i})=>(e[n]=i,e)),{}),expirationWarningTime:x}),y=(0,t.useMemo)((()=>[{key:"event",title:(0,t.jsxs)(l.Columns,{children:[(0,t.jsx)(l.Column,{fill:!0,children:(0,t.jsx)(p,{content:"headerEvent"})}),(0,t.jsx)(l.Column,{children:(0,t.jsx)(p,{content:"headerSendTo"})})]}),type:"title",render:({code:e,title:n})=>n||(0,t.jsx)(p,{content:e})},{key:"sendToAdmin",title:(0,t.jsx)(p,{content:"headerAdmin"}),align:"center",render:({code:e,sendToAdmin:n})=>(0,t.jsx)(l.FormFieldCheckbox,{value:n,name:`notifications[${e}][sendToAdmin]`})},S&&{key:"sendToReseller",title:(0,t.jsx)(p,{content:"headerReseller"}),align:"center",render:({code:e,sendToReseller:n})=>e.startsWith("admin_")?null:(0,t.jsx)(l.FormFieldCheckbox,{value:n,name:`notifications[${e}][sendToReseller]`})},k&&{key:"sendToClient",title:(0,t.jsx)(p,{content:"headerClient"}),align:"center",render:({code:e,sendToClient:n})=>e.startsWith("admin_")||e.startsWith("reseller_")?null:(0,t.jsx)(l.FormFieldCheckbox,{value:n,name:`notifications[${e}][sendToClient]`})},{key:"email",title:(0,t.jsx)(p,{content:"headerEmailAddress"}),type:"controls",render:({code:e})=>(0,t.jsxs)(l.Columns,{children:[(0,t.jsx)(l.Column,{style:{marginTop:"5px"},children:(0,t.jsx)(l.FormFieldCheckbox,{name:`notifications[${e}][sendToEmail]`})}),(0,t.jsx)(l.Column,{children:(0,t.jsx)(l.FormField,{label:null,size:"md",name:`notifications[${e}][email]`,children:({getId:n,getName:i,getValue:a,setValue:o,getValues:s})=>(0,t.jsx)(l.Input,{id:n(),name:i(),value:a(),onChange:({target:e})=>o(e.value),disabled:!s().notifications[e].sendToEmail})})})]})},{key:"actions",type:"actions",render:({code:e})=>(0,t.jsxs)(l.ListActions,{children:[(0,t.jsx)(l.ListAction,{"data-action":`edit-notice-${e}`,primary:!0,icon:"pencil",onClick:()=>E({code:e}),children:(0,t.jsx)(p,{content:"editHint"})}),r?(0,t.jsx)(l.ListAction,{primary:!0,icon:"panel-eye",target:"_blank",component:c.default,to:`/admin/notifications/preview?code=${e}`,children:(0,t.jsx)(p,{content:"previewHint"})}):null]})}]),[k,S,r]),E=({code:e})=>{j({isOpen:!0,previewKey:e})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(d.default,{mutation:i,applyButton:!1,values:F,onFieldChange:(e,n)=>{b((i=>(0,l.setIn)(i,e,n)))},onSubmit:()=>{if(T.notifications){const e=Object.entries(T.notifications).map((([e,n])=>({code:e,...n})));return{...T,notifications:e}}return T},cancelButton:{onClick:()=>e("/admin/server/tools/")},onSuccess:()=>{(0,m.addToast)({intent:"success",message:(0,t.jsx)(p,{content:"updated"})}),e("/admin/server/tools/")},children:[(0,t.jsx)(l.Section,{title:(0,t.jsx)(p,{content:"legendNotifications"}),children:(0,t.jsx)(l.List,{columns:y,data:h})}),(0,t.jsxs)(l.Section,{title:(0,t.jsx)(p,{content:"legendSettings"}),children:[(0,t.jsx)(l.FormField,{label:(0,t.jsx)(p,{content:"expirationTime"}),children:(0,t.jsxs)(l.Columns,{gap:"xs",children:[(0,t.jsx)(l.Column,{children:(0,t.jsx)(l.FormField,{"data-id":"expirationWarningTime",name:"expirationWarningTime",label:null,children:({getId:e,getName:n,getValue:i,setValue:a})=>(0,t.jsx)(l.Input,{min:0,defaultValue:10,type:"number",id:e(),name:n(),value:i(),onChange:({target:e})=>a(+e.value),size:null,style:{width:60,paddingRight:0}})})}),(0,t.jsx)(l.Column,{style:{alignSelf:"center"},children:(0,t.jsx)(p,{content:"days"})})]})}),f?(0,t.jsx)(p,{content:"smtpSettings",params:{link:(0,t.jsx)(c.default,{to:"/admin/mail-gate",children:(0,t.jsx)(p,{content:"smtpSettingsLink"})})}}):null]})]}),(0,t.jsx)(u.default,{...N,onClose:()=>{j({isOpen:!1})}})]})}},2342:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>c});var t=i(286),a=i(603),o=i(646),s=i(89),l=i(2343),d=i(285);const c=(0,a.withPageLayout)((e=>(0,d.jsxs)(t.Tabs,{children:[(0,d.jsx)(t.Tab,{title:s.Locale.getSection("admin.controllers.notifications.email-settings").lmsg("title"),component:o.default,to:"/cp/notifications/email-settings/",children:(0,d.jsx)(l.default,{...e})}),(0,d.jsx)(t.Tab,{title:s.Locale.getSection("admin.controllers.notifications.panel-settings").lmsg("title"),component:o.default,to:"/cp/notifications/panel-settings/"})]})))},2341:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>t.default});var t=i(2342)},2347:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"NotificationEmailSettings"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"os"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isWindows"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"config"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"notification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"htmlEmail"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"mode"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"canManageCustomers"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"canManageResellers"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"notification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"expirationWarningTime"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailSettings"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"code"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToEmail"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToAdmin"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToReseller"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToClient"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:455}};n.loc.source={body:"query NotificationEmailSettings {\n os {\n isWindows\n }\n config {\n notification {\n htmlEmail\n }\n }\n mode {\n canManageCustomers\n canManageResellers\n }\n notification {\n expirationWarningTime\n emailSettings {\n title\n code\n email\n sendToEmail\n sendToAdmin\n sendToReseller\n sendToClient\n }\n }\n}",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var t=e.type;"NamedType"===t.kind&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,n)})),e.definitions&&e.definitions.forEach((function(e){i(e,n)}))}var t={};function a(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}n.definitions.forEach((function(e){if(e.name){var n=new Set;i(e,n),t[e.name.value]=n}})),e.exports=n,e.exports.NotificationEmailSettings=function(e,n){var i={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var o=t[n]||new Set,s=new Set,l=new Set;for(o.forEach((function(e){l.add(e)}));l.size>0;){var d=l;l=new Set,d.forEach((function(e){s.has(e)||(s.add(e),(t[e]||new Set).forEach((function(e){l.add(e)})))}))}return s.forEach((function(n){var t=a(e,n);t&&i.definitions.push(t)})),i}(n,"NotificationEmailSettings")},2345:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"NotificationEmailSettingsNote"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"code"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"notification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"emailSettings"},arguments:[{kind:"Argument",name:{kind:"Name",value:"code"},value:{kind:"Variable",name:{kind:"Name",value:"code"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailSubject"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailDefaultSubject"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailText"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailDefaultText"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:253}};n.loc.source={body:"query NotificationEmailSettingsNote($code: String!) {\n notification {\n emailSettings(code: $code) {\n code\n emailSubject\n emailDefaultSubject\n emailText\n emailDefaultText\n }\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var t=e.type;"NamedType"===t.kind&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,n)})),e.definitions&&e.definitions.forEach((function(e){i(e,n)}))}var t={};function a(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}n.definitions.forEach((function(e){if(e.name){var n=new Set;i(e,n),t[e.name.value]=n}})),e.exports=n,e.exports.NotificationEmailSettingsNote=function(e,n){var i={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var o=t[n]||new Set,s=new Set,l=new Set;for(o.forEach((function(e){l.add(e)}));l.size>0;){var d=l;l=new Set,d.forEach((function(e){s.has(e)||(s.add(e),(t[e]||new Set).forEach((function(e){l.add(e)})))}))}return s.forEach((function(n){var t=a(e,n);t&&i.definitions.push(t)})),i}(n,"NotificationEmailSettingsNote")},2348:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateNotificationEmailSettings"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateNotificationEmailSettingsInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateNotificationEmailSettings"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"query"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"notification"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"expirationWarningTime"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailSettings"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"code"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToEmail"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToAdmin"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToReseller"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"sendToClient"},arguments:[],directives:[]}]}}]}}]}}]}}]}}],loc:{start:0,end:516}};n.loc.source={body:"mutation UpdateNotificationEmailSettings($input: UpdateNotificationEmailSettingsInput! ) {\n updateNotificationEmailSettings(input: $input) {\n query {\n notification {\n expirationWarningTime\n emailSettings {\n title\n code\n email\n sendToEmail\n sendToAdmin\n sendToReseller\n sendToClient\n }\n }\n }\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var t=e.type;"NamedType"===t.kind&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,n)})),e.definitions&&e.definitions.forEach((function(e){i(e,n)}))}var t={};function a(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}n.definitions.forEach((function(e){if(e.name){var n=new Set;i(e,n),t[e.name.value]=n}})),e.exports=n,e.exports.UpdateNotificationEmailSettings=function(e,n){var i={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var o=t[n]||new Set,s=new Set,l=new Set;for(o.forEach((function(e){l.add(e)}));l.size>0;){var d=l;l=new Set,d.forEach((function(e){s.has(e)||(s.add(e),(t[e]||new Set).forEach((function(e){l.add(e)})))}))}return s.forEach((function(n){var t=a(e,n);t&&i.definitions.push(t)})),i}(n,"UpdateNotificationEmailSettings")},2346:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateNotificationText"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateNotificationTextInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateNotificationText"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailSubject"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailDefaultSubject"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailText"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"emailDefaultText"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:230}};n.loc.source={body:"mutation UpdateNotificationText($input: UpdateNotificationTextInput! ) {\n updateNotificationText(input: $input) {\n code\n emailSubject\n emailDefaultSubject\n emailText\n emailDefaultText\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var t=e.type;"NamedType"===t.kind&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,n)})),e.definitions&&e.definitions.forEach((function(e){i(e,n)}))}var t={};function a(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}n.definitions.forEach((function(e){if(e.name){var n=new Set;i(e,n),t[e.name.value]=n}})),e.exports=n,e.exports.UpdateNotificationText=function(e,n){var i={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var o=t[n]||new Set,s=new Set,l=new Set;for(o.forEach((function(e){l.add(e)}));l.size>0;){var d=l;l=new Set,d.forEach((function(e){s.has(e)||(s.add(e),(t[e]||new Set).forEach((function(e){l.add(e)})))}))}return s.forEach((function(n){var t=a(e,n);t&&i.definitions.push(t)})),i}(n,"UpdateNotificationText")}}]); //# sourceMappingURL=index.js.map?14ffa7259b58d32183c4