1import{r as s,j as e,aM as S,I as z,u as H,a as J,b as E,aN as k,aO as T,B as v,M as W,c as Q,aP as B,aQ as V}from"./index-LlVqR4BX.js";import{B as X}from"./BackButton-CfsNDHuu.js";import{J as Y,j as q}from"./jodit-react-d0sAIeQP.js";function G(){const[y,r]=s.useState("Copy"),[c,d]=s.useState(null),[x,w]=s.useState(null),g=(o,a)=>{if(!navigator.clipboard){const n=document.createElement("textarea");n.value=o,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),r("Copied"),d(a);return}navigator.clipboard.writeText(o).then(()=>{r("Copied"),d(a)}).catch(n=>{console.error("Error copying text to clipboard:",n)}),setTimeout(()=>{r("Copy"),d(null)},600)};return e.jsx("div",{className:"email-fields",children:e.jsx("div",{className:"email-field-wrapper mt-2",children:e.jsxs("div",{className:"bg-white rounded-[10px] shadow-card p-[10px] lg:p-[14px]",children:[e.jsx("p",{className:"text-base lg:text-lg font-medium text-black",children:"Use following fields to customize your email"}),e.jsx("div",{className:"mt-3",children:S.map((o,a)=>e.jsx("div",{className:" mb-2",children:e.jsx("p",{className:"!text-sm lg:!text-base text-black font-semibold",children:`${o.title} - ${o.subtitle}`})},a))}),e.jsx("div",{className:"block lg:flex gap-1 w-full flex-wrap mt-2",children:S.map((o,a)=>e.jsxs("div",{className:"lg:w-max mb-[10px] lg:mb-0 flex gap-[6px] justify-between items-center lg:block cursor-pointer relative",children:[e.jsxs("div",{onClick:()=>g(o.title,a),className:`email-field flex w-full gap-1 justify-between lg:justify-center items-center copy-block ${c===a?"!bg-secondary":"bg-light_green"} py-3 px-3 lg:py-3 lg:px-[10px] rounded-[10px]`,children:[e.jsx("p",{className:"!text-sm lg:!text-xs title font-bold text-primary text-center break-all",children:o.title}),e.jsxs("span",{className:"copy-icon",children:[e.jsx(z,{name:"copy"}),e.jsx("div",{className:`tooltip-wrapper hidden z-10 absolute right-[65px] lg:right-auto -translate-y-1/2 lg:translate-y-0 top-1/2 lg:-top-10 ${c===a?"!bg-primary":"!bg-white"} p-[6px] lg:p-[10px] rounded-[10px] shadow-form `,children:e.jsx("p",{className:` ${c===a?"text-white":"text-black"} !text-sm lg:!text-base font-bold text-center`,children:y})})]})]}),e.jsx("div",{})]},a))})]})})})}function K(){const y=s.useRef(null),[r,c]=s.useState(""),[d,x]=s.useState(!1),[w,g]=s.useState(!1),[o,a]=s.useState(!0),[n,j]=s.useState(!1),[N,P]=s.useState(!1);let h;const m=H(),C=J(),f=()=>P(!N),M={placeholder:"Start Typing......",toolbar:d,showCharsCounter:!1,showWordsCounter:!1,showXPathInStatusbar:!1,readonly:o,uploader:{insertImageAsBase64URI:!1},extraButtons:["uploadImage"],askBeforePasteHTML:!1,askBeforePasteFromWord:!0,events:{afterOpenPasteDialog:(t,l,i,b)=>{t.close(),b()}}},p=E(t=>t.practitionerInfo.isPractitionerChangeStatus),u=E(t=>t.emailInfo.template),I=s.useRef({isPractitionerChangeStatus:p}).current,$=()=>{q.Jodit.defaultOptions.controls.uploadImage={name:"Upload image",iconURL:"https://www.kindpng.com/picc/m/261-2619141_cage-clipart-victorian-cloud-upload-icon-svg-hd.png",exec:async t=>{await R(t)}}},R=t=>{const l=document.createElement("input");l.setAttribute("type","file"),l.setAttribute("accept","image/*"),l.click(),l.onchange=(async function(){const i=l.files[0];if(!i||!i.name.match(/\.(jpg|jpeg|png)$/))return;const _=await`https://femologist-images.s3.amazonaws.com${await A(i)}`;U(t,_)}).bind(this)},U=(t,l)=>{const i=t.selection.j.createInside.element("img");i.setAttribute("src",l),t.selection.insertNode(i)},A=async t=>{const l=await B.post("https://backoffice.femologist.com/api/practitioner/email/template/upload/image/v1",{sFileName:t.name,sContentType:t.type},{headers:{Authorization:localStorage.getItem("token")}}),i=l.data.data.sUrl,b=l.data.data.sPath;return await B.put(i,t,{headers:{"Content-Type":t.type}}),b};s.useEffect(()=>{m(k()),m(T(C)),$()},[]),s.useEffect(()=>{var t;((t=Object.keys(u))==null?void 0:t.length)>0&&c(u==null?void 0:u.template)},[u]),s.useEffect(()=>(I.isPractitionerChangeStatus!==p&&p&&m(T(C)),()=>{I.isPractitionerChangeStatus=p}),[p]);const L=()=>{x(!0),a(!1),j(!0),h=r},O=()=>{g(!0),x(!1),a(!0),j(!1),m(V({template:r},()=>{g(!1),f()}))},D=()=>{x(!1),a(!0),j(!1),m(k())},F=t=>{h=t};return e.jsxs("div",{className:"email-edit mt-5",children:[e.jsxs("div",{className:"bg-white rounded-[10px] shadow-card p-[10px] lg:p-[14px]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-base lg:text-lg font-medium text-black",children:"Email"}),e.jsxs("div",{children:[!n&&e.jsx("div",{className:"max-w-20 lg:max-w-[105px] w-full ",children:e.jsx(v,{label:"Edit",iconName:"edit",type:"small",bgColor:"secondary_border",alignment:"center",onClick:t=>L()})}),n&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{children:e.jsx(v,{label:"Discard Changes",iconName:"
1cancle",type:"small",bgColor:"secondary_border",alignment:"center",mobileIconHide:!0,onClick:t=>D()})}),e.jsx("div",{children:e.jsx(v,{label:"Save",iconName:"save",type:"small",bgColor:"primary",alignment:"center",mobileIconHide:!0,onClick:()=>{h!==void 0&&c(h),f()}})})]})]})]}),e.jsx("div",{className:"email-editor mt-5",children:e.jsx(Y,{ref:y,value:r,onBlur:t=>F(t),config:M})})]}),e.jsx(W,{selector:"sub-modal",show:N,close:()=>f(),type:"message",title:"Are You Sure?",children:e.jsxs("div",{className:"flex justify-center items-center",children:[e.jsx("button",{onClick:()=>f(),className:"mr-4 rounded-[10px] py-[10px] px-5 text-center border border-solid border-secondary hover:bg-secondary hover:text-white",children:"Cancel"}),e.jsx("button",{onClick:O,className:"rounded-[10px] py-[10px] px-5 text-center border border-solid border-primary bg-primary text-white w-24 ",children:w?e.jsx(Q,{type:"small"}):"Save"})]})})]})}function ae(){return e.jsxs("div",{className:"email-settings",children:[e.jsx(X,{pageTitle:"Email Settings"}),e.jsx(G,{}),e.jsx(K,{})]})}export{ae as default};
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.