geno/wp-content/plugins/mailpoet/assets/dist/js/settings.js

1 line
52 KiB
JavaScript
Raw Normal View History

2024-02-01 17:24:18 +05:30
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[571],{68062:function(e,t,i){i(55014);var s=i(2226),n=i(14526),a=i(37441),r=i(92883),l=i(9515),o=i(44584),c=i(23584),m=i(59355),d=i(44259),u=i(38358),p=i(35250);function h(e){let{title:t,description:i,htmlFor:s}=e;return(0,p.jsxs)("div",{className:"mailpoet-settings-label",children:[(0,p.jsx)("label",{className:"mailpoet-settings-label-title",htmlFor:s,children:t}),i&&(0,p.jsx)("p",{className:"description",children:i})]})}function x(e){let{children:t}=e;return(0,p.jsx)("div",{className:"mailpoet-settings-inputs",children:t})}var g=i(70079),j=i(69177),b=i(49773),_=i(19613),v=i(34352),f=i.n(v);const y=(e,t,i)=>{if("deactivate"!==e){if("reactivate"===e){const e=f()(j.MailPoet.I18n.t("re-engagementReactivatedNotice"),/\[link\](.*?)\[\/link\]/g,(e=>(0,p.jsx)("a",{href:"?page=mailpoet-newsletters#/re_engagement",rel:"noopener noreferrer",children:e},"reEngagementEmailsTabLink")));i((0,p.jsx)("p",{children:e}),{scroll:!0})}}else t((0,p.jsx)("p",{children:j.MailPoet.I18n.t("re-engagementDisabledNotice")}),{scroll:!0})};function k(){const[e,t]=(0,g.useState)(!1),i=(0,_.v9)("isSaving")(),s=(0,_.v9)("hasErrorFlag")(),a=(0,_.v9)("getSavingError")(),r=(0,_.v9)("hasReEngagementNotice")(),l=(0,_.v9)("getReEngagementAction")(),o=(0,_.BH)("saveSettings"),{notices:c}=(0,g.useContext)(n.k),m=c.error,d=c.success;return(0,g.useEffect)((()=>{e&&!i&&(a?m(a.map((e=>(0,p.jsx)("p",{children:e}))),{scroll:!0}):(d((0,p.jsx)("p",{children:j.MailPoet.I18n.t("settingsSaved")}),{scroll:!0}),r&&y(l,m,d)))}),[e,a,i,m,d,r,l]),(0,p.jsx)("div",{className:"mailpoet-settings-save",children:(0,p.jsx)(b.z,{type:"button",automationId:"settings-submit-button",isDisabled:i||s,onClick:()=>{t(!0),o()},children:j.MailPoet.I18n.t("saveSettings")})})}var w=i(46166);function C(e){const t=e.segmentsSelector?e.segmentsSelector:"getDefaultSegments",i=(0,_.v9)(t)().map((e=>({value:e.id,label:e.name,count:e.subscribers}))),s=i.filter((t=>e.value.includes(t.value)));return(0,p.jsx)(w.ReactSelect,{isMulti:!0,defaultValue:s,id:e.id,placeholder:e.placeholder,options:i,onChange:t=>{e.setValue((t||[]).map((e=>e.value)))}})}var F=i(67902);function S(e){const t=(0,_.v9)("getPages")();let i=t.find((t=>t.id===parseInt(e.value,10)));return i||(i=t[0]),(0,p.jsxs)("div",{className:"mailpoet-settings-inputs-row mailpoet-settings-inputs-row-centered",children:[(0,p.jsx)(F.Select,{id:e.id,automationId:e.automationId,value:i.id,onChange:(0,o.z2)(e.setValue),isMinWidth:!0,dimension:"small",children:t.map((e=>(0,p.jsx)("option",{value:e.id,children:`${e.title}`},e.id)))}),(0,p.jsx)("span",{className:"mailpoet-gap"}),(0,p.jsx)("a",{className:"mailpoet-link",target:"_blank",title:(0,o.t)("previewPage"),rel:"noopener noreferrer",href:i.url[e.preview],"data-automation-id":e.linkAutomationId,children:(0,o.t)("preview")})]})}var N=i(3537),I=i(86656),z=i(50438);function T(){const e=(0,_.v9)("isMssActive")(),[t,i]=(0,_.yu)("sender","name"),[s,n]=(0,_.yu)("sender","address"),[a,r]=(0,g.useState)(!0),[l,c]=(0,g.useState)(!1),[m,d]=(0,_.yu)("reply_to","name"),[u,b]=(0,_.yu)("reply_to","address"),v=(0,_.BH)("setErrorFlag"),f=s&&!(0,o.Jh)(s),y=u&&!(0,o.Jh)(u);return(0,g.useEffect)((()=>{v(f||y||!a&&e)}),[y,f,v,a,e]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(h,{title:(0,o.t)("defaultSenderTitle"),description:(0,o.t)("defaultSenderDescription"),htmlFor:"sender-name"}),(0,p.jsxs)(x,{children:[(0,p.jsx)("label",{htmlFor:"sender-name",children:(0,o.t)("from")}),(0,p.jsx)("br",{}),(0,p.jsx)(N.I,{dimension:"small",type:"text",id:"sender-name",placeholder:(0,o.t)("yourName"),"data-automation-id":"from-name-field",value:t,onChange:(0,o.z2)(i)}),(0,p.jsx)("br",{}),(0,p.jsx)(N.I,{dimension:"small",type:"text",placeholder:"from@mydomain.com","data-automation-id":"from-email-field",value:s,onChange:(0,o.z2)((0,o.pz)((e=>{r(!0),c(!1),n(e)}))),onBlur:(0,o.z2)((t=>{if(!e)return;const i=(0,o.DA)(t);window.mailpoet_verified_sender_domains.includes(i)||((e=>{r(window.mailpoet_authorized_emails.includes(e))})(t),j.MailPoet.freeMailDomains.indexOf(i)>-1||(0,z.g)(t,