PageSourceSearch

https://molly88.net/cp/javascript/components/pages/SendMassMailPage.js?d0af205cb828a48f0468

js molly88.net collected 2026-10-05 06:50:24 UTC 13,900 bytes, 11 lines download raw bytes

1(globalThis.webpackChunkPlesk||=[]).push([["components/pages/SendMassMailPage"],{2818(e,n,s){"use strict";s.r(n),s.d(n,{default:()=>v});var i=s(342),a=s(798),l=s(95),t=s(782),d=s.n(t),o=s(341),r=s(803),m=s.n(r),c=s(797),u=s(2819);const p=l.Locale.getSection("components.forms.MassMailForm"),f=({customers:e,resellers:n,loading:s,mutation:l,onSuccess:t,values:d,onChange:r,children:f=null,footer:v=null,errors:k={},submitButtonProps:T={},hideNameField:b=!1,onSubmit:h=e=>e,applyButton:g=!1})=>{const S=(0,o.useMemo)(()=>n.map(({id:e,name:n,email:s})=>{const i=atob(e).split(":")[1];return{id:i,title:`${n} (${s})`,selected:d.resellers?.includes(i)}}),[n,d.resellers]),N=(0,o.useMemo)(()=>e.map(({id:e,name:n,email:s})=>{const i=atob(e).split(":")[1];return{id:i,title:`${n} (${s})`,selected:d.clients?.includes(i)}}),[e,d.clients]);return(0,o.jsxs)(a.default,{state:s?"submit":null,values:d,onFieldChange:r,mutation:l,onSuccess:t,onSubmit:e=>h({...e,sendToResellersMode:e.sendToResellers?e.sendToResellersMode:"all",sendToClientsMode:e.sendToClients?e.sendToClientsMode:"all",resellers:(e.resellers??[]).map(Number),clients:(e.clients??[]).map(Number)}),errors:k,submitButton:{"data-testid":"btn-submit",...T},applyButton:g,cancelButton:{"data-testid":"btn-cancel",component:c.default,to:"/cp/server/mass-mail"},children:[f,!b&&(0,o.jsx)(i.FormFieldText,{required:!0,size:"xl",label:p.lmsg("name"),name:"name"}),(0,o.jsx)(i.FormFieldText,{required:!0,size:"xl",label:p.lmsg("fromEmail"),name:"fromEmail"}),(0,o.jsx)(i.FormFieldCheckbox,{label:p.lmsg("sendToAdmins"),name:"sendToAdmins"}),(0,o.jsx)(i.FormFieldCheckbox,{label:p.lmsg("sendToResellers"),name:"sendToResellers"}),(0,o.jsxs)("div",{className:m()({"mass-mail-form-block-hidden":!d.sendToResellers}),children:[(0,o.jsxs)(i.FormFieldSelect,{size:"lg",name:"sendToResellersMode",label:p.lmsg("sendToResellersMode"),children:[(0,o.jsx)("option",{value:"all",children:p.lmsg("sendToResellersModeAll")}),(0,o.jsx)("option",{value:"select",children:p.lmsg("sendToResellersModeSelect")}),(0,o.jsx)("option",{value:"except",children:p.lmsg("sendToResellersModeExcept")})]}),(0,o.jsx)(i.FormField,{className:m()({"mass-mail-form-block-hidden":"all"===d.sendToResellersMode}),name:"resellers",children:({setValue:e})=>(0,o.jsx)(u.default,{name:"select-reseller",onChange:e,options:S})})]}),(0,o.jsx)(i.FormFieldCheckbox,{label:p.lmsg("sendToClients"),name:"sendToClients"}),(0,o.jsxs)("div",{className:m()({"mass-mail-form-block-hidden":!d.sendToClients}),children:[(0,o.jsxs)(i.FormFieldSelect,{size:"lg",name:"sendToClientsMode",label:p.lmsg("sendToClientsMode"),children:[(0,o.jsx)("option",{value:"all",children:p.lmsg("sendToClientsModeAll")}),(0,o.jsx)("option",{value:"select",children:p.lmsg("sendToClientsModeSelect")}),(0,o.jsx)("option",{value:"except",children:p.lmsg("sendToClientsModeExcept")})]}),(0,o.jsx)(i.FormField,{className:m()({"mass-mail-form-block-hidden":"all"===d.sendToClientsMode}),name:"clients",children:({setValue:e})=>(0,o.jsx)(u.default,{name:"select-client",onChange:e,options:N})})]}),(0,o.jsx)(i.FormFieldText,{required:!0,size:"xl",label:p.lmsg("subject"),name:"subject"}),(0,o.jsx)(i.FormFieldText,{description:p.lmsg("bodyDescription"),required:!0,size:"fill",rows:10,multiline:!0,label:p.lmsg("body"),name:"body"}),v]})};f.propTypes={customers:d().array.isRequired,resellers:d().array.isRequired,loading:d().bool.isRequired,mutation:d().func.isRequired,onSuccess:d().func.isRequired,onSubmit:d().func,values:d().object.isRequired,submitButtonProps:d().object,onChange:d().func.isRequired,children:d().node,footer:d().node,errors:d().object,hideNameField:d().bool,applyButton:d().oneOf([d().object,d().bool])};const v=f},2817(e,n,s){"use strict";s.r(n),s.d(n,{default:()=>i.default});var i=s(2818)},2819(e,n,s){"use strict";s.r(n),s.d(n,{default:()=>m});var i=s(341),a=s(95),l=s(796),t=s(782),d=s.n(t);const o=a.Locale.getSection("components.elements.double-list-selector"),r=({name:e,options:n,onChange:s=()=>{},...t})=>{const[d,r]=(0,i.useState)(null),m=(0,i.useRef)(n);return(0,i.useEffect)(()=>{const i=new a.EnhancedDoubleListSelector({list:n,applyTo:e,isSearchable:!0,locale:o,name:e,onCh
1ange:e=>{const n=Object.keys(e).reduce((n,s)=>e[s]?[...n,s]:n,[]);s(n)},...t});return r(i),()=>{i.remove(),r(null)}},[]),(0,i.useEffect)(()=>{d&&m.current!==n&&n.forEach((e,n)=>{m.current[n].selected!==e.selected&&(d._toggleItemSelection(n,!e.selected),m.current[n].selected=e.selected)})},[d,n]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{id:e}),d&&(0,i.jsx)(l.default,{children:d})]})};r.propTypes={name:d().string.isRequired,options:d().arrayOf(d().shape({selected:d().bool,id:d().any,title:d().string,description:d().string,icons:d().arrayOf(d().shape({src:d().string,title:d().string}))})).isRequired,isSearchable:d().bool,onChange:d().func};const m=r},2820(e,n,s){"use strict";s.r(n),s.d(n,{default:()=>M});var i=s(755),a=s(628),l=s(811),t=s(785),d=s(342),o=s(718),r=s(95),m=s(341),c=s(772),u=s(486),p=s(2815),f=s(1363),v=s.n(f),k=s(2821),T=s.n(k),b=s(2816),h=s.n(b),g=s(2817);const S=i.gql`
2    mutation SendMassEmail($input: SendMassEmailInput!) {
3        sendMassEmail(input: $input) {
4            errors {
5                email
6                error
7            }
8        }
9    }
10`,N=r.Locale.getSection("components.pages.SendMassMailPage"),M=()=>{const{data:{viewer:{customers:e,resellers:n},massEmail:{templates:{nodes:s}}}}=(0,t.useQuery)(v()),[i]=(0,c.useSearchParams)(),[r,f]=(0,m.useState)(()=>({sendToClientsMode:"all",sendToResellersMode:"all",sendToAdmins:!1,sendToClients:!1,sendToResellers:!1,selectedTempalteId:i.get("templateId")})),[k,b]=(0,m.useState)({});(0,m.useEffect)(()=>{const e=r.selectedTempalteId;e&&u.default.query({query:T(),variables:{numericId:Number(e),id:btoa(`MassEmailTemplate:${e}`)}}).then(({data:{massEmail:{template:e,templateClients:n,templateResellers:s}}})=>{f(i=>({...i,fromEmail:e.fromEmail,body:e.body,subject:e.subject,sendToClientsMode:e.sendToClientsMode,sendToResellersMode:e.sendToResellersMode,sendToAdmins:e.sendToAdmins,sendToClients:e.sendToClients,sendToResellers:e.sendToResellers,clients:n.contacts.map(({id:e})=>atob(e).split(":")[1]),resellers:s.contacts.map(({id:e})=>atob(e).split(":")[1])}))})},[r.selectedTempalteId]);const M=(0,c.useNavigate)(),[x,{loading:F}]=(0,l.useMutation)(S,{update:p.evictMassEmailCache}),[y,{loading:E}]=(0,l.useMutation)(h());return(0,m.jsx)(g.default,{onSuccess:async()=>{if(r.saveAsTemplate){const{selectedTempalteId:e,saveAsTemplate:n,newTemplateName:s,clients:i=[],resellers:l=[],...t}=r;try{await y({variables:{input:{...t,name:s,clients:i.map(Number),resellers:l.map(Number)}}})}catch(e){if(!(e instanceof Error))throw e;if(!a.CombinedGraphQLErrors.is(e)||!e.errors.length)return void(0,o.addToast)({intent:"danger",message:e.message});const{errors:n}=e;if("validate"===n[0].extensions?.category){const e=n[0].extensions.messages;b(e)}else(0,o.addToast)({intent:"danger",message:n[0].extensions?.debugMessage||n[0].message});return}}(0,o.addToast)({intent:"success",message:N.formatMessage("emailSent")}
10),M("..")},mutation:x,loading:F||E,customers:e,resellers:n,onChange:(e,n)=>{f(s=>(0,d.setIn)(s,e,n))},values:r,hideNameField:!0,onSubmit:e=>{if(e.saveAsTemplate&&!e.newTemplateName)return b({newTemplateName:{required:N.lmsg("fieldIsRequired")}}),null;const{selectedTempalteId:n,saveAsTemplate:s,newTemplateName:i,...a}=e;return a},errors:k,submitButtonProps:{children:N.lmsg("send")},footer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.FormFieldCheckbox,{label:N.lmsg("saveAsTemplate"),name:"saveAsTemplate"}),r.saveAsTemplate&&(0,m.jsx)(d.FormFieldText,{required:!0,size:"xl",label:N.lmsg("newTemplateName"),name:"newTemplateName"})]}),children:!!s.length&&(0,m.jsx)(d.FormFieldSelect,{size:"xl",name:"selectedTempalteId",label:N.lmsg("selectedTemplate"),children:s.map(({templateId:e,name:n})=>(0,m.jsx)("option",{value:e.toString(),children:n},e))})})}},2815(e,n,s){"use strict";s.r(n),s.d(n,{evictMassEmailCache:()=>i});const i=e=>{e.evict({id:e.identify({__typename:"Query"}),fieldName:"massEmail"})}},2816(e){var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"AddMassEmailTemplate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"AddMassEmailTemplateInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"addMassEmailTemplate"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"errors"}}]}}]}}],loc:{start:0,end:133}};n.loc.source={body:"mutation AddMassEmailTemplate($input: AddMassEmailTemplateInput!) {\n    addMassEmailTemplate(input: $input) {\n        errors\n    }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function s(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var i=e.type;"NamedType"===i.kind&&n.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(e){s(e,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){s(e,n)}),e.definitions&&e.definitions.forEach(function(e){s(e,n)})}var i={};function a(e,n){for(var s=0;s<e.definitions.length;s++){var i=e.definitions[s];if(i.name&&i.name.value==n)return i}}n.definitions.forEach(function(e){if(e.name){var n=new Set;s(e,n),i[e.name.value]=n}}),e.exports=n,e.exports.AddMassEmailTemplate=function(e,n){var s={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(s.loc=e.loc);var l=i[n]||new Set,t=new Set,d=new Set;for(l.forEach(function(e){d.add(e)});d.size>0;){var o=d;d=new Set,o.forEach(function(e){t.has(e)||(t.add(e),(i[e]||new Set).forEach(function(e){d.add(e)}))})}return t.forEach(function(n){var i=a(e,n);i&&s.definitions.push(i)}),s}(n,"AddMassEmailTemplate")},2821(e){var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"MassMailTemplate"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"numericId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"massEmail"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"template"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"fromEmail"}},{kind:"Field",name:{kind:"Name",value:"sendToAdmins"}},{kind:"Field",name:{kind:"Name",value:"sendToResellers"}},{kind:"Field",name:{kind:"Name",value:"sendToResellersMode"}},{kind:"Field",name:{kind:"Name",value:"sendToClients"}},{kind:"Field",name:{kind:"Name",value:"sendToClientsMode"}},{kind:"Field",name:{kind:"Name",value:"subject"}},{kind:"Field",name:{kind:"Name",value:"body"}}]}},{kind:"Field",name:{kind:"Name",value:"templateResellers"},arguments:[{kind:"Argument",name:{kind:"Name",value:"templateId"},value:{kind:"Variable",name:{kind:"Name",value:"numericId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"contacts"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"templateClients"},arguments:[{kind:"Argument",name:{kind:"Name",value:"templateId"},value:{kind:"Variable",name:{kind:"Name",value:"numericId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"contacts"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}}]}}]}}]}}]}}],loc:{start:0,end:566}};n.loc.source={body:"query MassMailTemplate($id: ID!, $numericId: Int!) {\n    massEmail {\n        template(id: $id) {\n            name\n            fromEmail\n            sendToAdmins\n            sendToResellers\n            sendToResellersMode\n            sendToClients\n            sendToClientsMode\n            subject\n            body\n        }
10\n        templateResellers(templateId: $numericId) {\n            contacts {\n                id\n            }\n        }\n        templateClients(templateId: $numericId) {\n            contacts {\n                id\n            }\n        }\n    }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function s(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var i=e.type;"NamedType"===i.kind&&n.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(e){s(e,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){s(e,n)}),e.definitions&&e.definitions.forEach(function(e){s(e,n)})}var i={};function a(e,n){for(var s=0;s<e.definitions.length;s++){var i=e.definitions[s];if(i.name&&i.name.value==n)return i}}n.definitions.forEach(function(e){if(e.name){var n=new Set;s(e,n),i[e.name.value]=n}}),e.exports=n,e.exports.MassMailTemplate=function(e,n){var s={kind:e.kind,definitions:[a(e,n)]};e.hasOwnProperty("loc")&&(s.loc=e.loc);var l=i[n]||new Set,t=new Set,d=new Set;for(l.forEach(function(e){d.add(e)});d.size>0;){var o=d;d=new Set,o.forEach(function(e){t.has(e)||(t.add(e),(i[e]||new Set).forEach(function(e){d.add(e)}))})}return t.forEach(function(n){var i=a(e,n);i&&s.definitions.push(i)}),s}(n,"MassMailTemplate")}}]);
11//# sourceMappingURL=SendMassMailPage.js.map?d0af205cb828a48f0468

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.