1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dci_jJno.js","assets/index-D66GGtHU.css"])))=>i.map(i=>d[i]); 2import{c as V,r,j as e,B as n,I as q,aV as we,b as K,f as Ce,u as Te,d as B,m as ee}from"./index-Dci_jJno.js";import{u as ne}from"./useMutation-DOIVzkfi.js";import{C as v,a as k,b as ce,c as Se}from"./card-BebN6SXj.js";import{B as Z}from"./badge-D_hVK-aO.js";import{A as Ee,a as Re}from"./alert-DJqlm7os.js";import{D as he,a as ge,b as ue,c as pe,d as Le}from"./dialog-CbOvNZpN.js";import{L as H}from"./label-fG4cXIBY.js";import{S as Ie}from"./switch-F2tYJD5I.js";import{S as De,a as Me,b as Ae,c as Be,d as He}from"./select-CNTfxrTc.js";import{Z as Ve}from"./zap-C853piMM.js";import{U as ze}from"./user-check-PhIvLyx8.js";import{I as Fe}from"./info-DZKlOuGH.js";import{C as Pe}from"./check-DqTXOUsg.js";import{C as Oe}from"./copy-CIa098fe.js";import{L as de}from"./link-v2HSzc4A.js";import{S as Ue}from"./send-BZPQhOij.js";import{C as Ge}from"./circle-check-big-Thn5nELk.js";import{C as $e}from"./circle-alert-B2baUo0l.js";import{P as oe}from"./plus-CrJLQVlx.js";import{E as qe}from"./eye-Czr7YCSO.js";import{S as Qe}from"./square-pen--U2vZ0Hi.js";import"./index-DL5p_O24.js";import"./index-2pNUjjD_.js";import"./index-qpB6SCQY.js";/** 3 * @license lucide-react v0.475.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Ye=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Ke=V("Bold",Ye);/** 8 * @license lucide-react v0.475.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Ze=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],We=V("Italic",Ze);/** 13 * @license lucide-react v0.475.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Je=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],Xe=V("Redo",Je);/** 18 * @license lucide-react v0.475.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const es=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],ss=V("Underline",es);/** 23 * @license lucide-react v0.475.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const as=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],ts=V("Undo",as);function rs({open:u,onOpenChange:x,template:s,variables:w=[],triggerInfo:l=null,availableTriggers:m=[],triggerLabels:b={},triggerInfoMap:I={},triggerVariablesMap:h={},triggersWithDaysBefore:d=[],onSave:j}){const[p,E]=r.useState(""),[C,f]=r.useState(""),[z,F]=r.useState(""),[P,O]=r.useState(!0),[_,T]=r.useState(""),[U,t]=r.useState(7),[y,g]=r.useState(null),[D,se]=r.useState(!1),N=r.useRef(null),W=r.useRef(!1),[ae,G]=r.useState(null),[te,re]=r.useState(""),J=!(s!=null&&s.id)&&!(s!=null&&s.trigger_type),R=(s==null?void 0:s.trigger_type)||_,X=l||(R?I[R]:null),ie=w.length>0?w:R?h[R]||[]:[],le=(s==null?void 0:s.trigger_name)||(R?b[R]:"");r.useEffect(()=>{u&&s&&(E(s.subject||""),f(s.body_html||""),F(s.cc_email||""),O(s.is_active!==!1),T(s.trigger_type||""),t(s.reminder_days_before??7),W.current=!1)},[u,s]);const ye=(s==null?void 0:s.trigger_type)||_,be=d.includes(ye);r.useEffect(()=>{if(!N.current||W.current||!u)return;const a=N.current,i=setTimeout(()=>{const o=a.contentDocument;o&&(o.open(),o.write(`<!DOCTYPE html> 28<html dir="rtl"> 29<head> 30 <meta charset="utf-8"> 31 <style> 32 body { 33 font-family: Arial, Helvetica, sans-serif; 34 margin: 0; 35 padding: 16px; 36 direction: rtl; 37 background: #f9fafb; 38 min-height: 100%; 39 } 40 body:focus { 41 outline: none; 42 } 43 [contenteditable]:focus { 44 outline: 2px solid #3b82f6; 45 outline-offset: 2px; 46 border-radius: 4px; 47 } 48 ::selection { 49 background: #bfdbfe; 50 } 51 </style> 52</head> 53<body contenteditable="true">${C}</body> 54</html>`),o.close(),o.body.addEventListener("input",()=>{f(o.body.innerHTML)}),o.body.addEventListener("click",S=>{S.preventDefault();const L=S.target.closest("a");L?(S.stopPropagation(),G(L),re(L.getAttribute("href")||"")):G(null)}),W.current=!0)},100);return()=>clearTimeout(i)},[u,C]);const M=r.useCallback((a,c=null)=>{var o;const i=(o=N.current)==null?void 0:o.contentDocument;i&&(i.body.focus(),i.execCommand(a,!1,c),f(i.body.innerHTML))},[]),je=r.useCallback(()=>{var i;const a=(i=N.current)==null?void 0:i.contentDocument;if(!a)return;const c=prompt("××× ×ת××ת URL:");c&&(a.body.focus(),a.execCommand("createLink",!1,c),f(a.body.innerHTML))},[]),fe=r.useCallback(a=>{var i;const c=(i=N.current)==null?void 0:i.contentDocument;c&&(c.body.focus(),c.execCommand("insertText",!1,a),f(c.body.innerHTML))},[]),_e=async()=>{var L;se(!0);const a=(L=N.current)==null?void 0:L.contentDocument,c=a?a.body.innerHTML:C,i=(s==null?void 0:s.trigger_type)||_,o=(s==null?void 0:s.trigger_name)||b[_]||"",S={trigger_type:i,trigger_name:o,subject:p,body_html:c,cc_email:z,is_active:P};if(d.includes(i)&&(S.reminder_days_before=Number(U)||7),i==="campaign_expiring_reminder"&&(s!=null&&s.id)&&(s==null?void 0:s.reminder_days_before)!==S.reminder_days_before)try{const{base44:$}=await we(async()=>{const{base44:A}=await import("./index-Dci_jJno.js").then(ke=>ke.aY);return{base44:A}},__vite__mapDeps([0,1])),ve=await $.entities.Campaign.filter({});await Promise.all(ve.filter(A=>A.last_reminder_sent_for_end_date).map(A=>$.entities.Campaign.update(A.id,{last_reminder_sent_for_end_date:null})))}catch($){console.error("Failed to reset reminder tracking on campaigns",$)}await j(S),se(!1)},Ne=a=>{navigator.clipboard.writeText(a),g(a),setTimeout(()=>g(null),2e3)};return e.jsx(he,{open:u,onOpenChange:x,children:e.jsxs(ge,{className:"max-w-5xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[e.jsxs(ue,{children:[e.jsx(pe,{className:"text-xl font-bold",children:s!=null&&s.id?"ער××ת ת×× ×ת ××××":"×צ×רת ת×× ×ת ××××"}),le&&!J&&e.jsxs("p",{className:"text-gray-600",children:["×ר××ר: ",le]})]}),e.jsxs("div",{className:"space-y-4",children:[J&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(H,{htmlFor:"trigger_type",className:"font-medium",children:["××ר ×ר××ר ×ת×× ×ת ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs(De,{value:_,onValueChange:T,children:[e.jsx(Me,{id:"trigger_type",dir:"rtl",children:e.jsx(Ae,{placeholder:"××ר ×ר××ר ××××..."})}),e.jsx(Be,{dir:"rtl",children:m.length===0?e.jsx("div",{className:"px-2 py-3 text-sm text-gray-500 text-center",children:"××× ×ר××ר×× ×××× ×× - ××× ××ר××ר×× ××ר ×ש ת×× ××ת"}):m.map(a=>e.jsx(He,{value:a,children:b[a]},a))})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"××× ×ר××ר ××××× ××××ת רק ת×× ×ת ××ת. ××ר××ר×× ××××ר×× ××§×× ××ער×ת ×××× ××× × × ××ª× ×× ×ש×× ××."})]}),X&&e.jsx(v,{className:"border-purple-200 bg-purple-50",children:e.jsxs(k,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ve,{className:"w-5 h-5 text-purple-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900 mb-1",children:"××ª× ××××× × ×©××?"}),e.jsx("p",{className:"text-sm text-gray-700",children:X.when})]})]}),e.jsxs("div",{className:"flex items-start gap-2 pt-3 border-t border-purple-200",children:[e.jsx(ze,{className:"w-5 h-5 text-purple-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium text-gray-900 mb-1",children:"××× × ×©×× ×××××?"}),e.jsx("p",{className:"text-sm text-gray-700",children:X.recipient})]})]})]})}),e.jsx(v,{className:"border-blue-200 bg-blue-50",children:e.jsxs(k,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[e.jsx(Fe,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"××©×ª× ×× ×××× ××"}),e.jsx("p",{className:"text-sm text-gray-600",children:'×××¥ ××עתק×, ×× "××× ×¡" ××××¡×¤× ×ש××¨× ×ת×××'})]})]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:ie.length===0?e.jsx("p",{className:"text-sm text-gray-500 italic",children:"××ר ×ר××ר ×ר×××ת ×××©×ª× ×× ××××× ××"}):ie.map(a=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>Ne(a.key),className:"gap-1 bg-white",children:[y===a.key?e.jsx(Pe,{className:"w-3 h-3 text-green-600"}):e.jsx(Oe,{className:"w-3 h-3"}),e.jsx("span",{className:"font-mono text-xs",children:a.key}),e.jsxs("span",{className:"text-gray-500",children:["(",a.label,")"]})]}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>fe(a.key),className:"text-xs text-blue-600 px-2 h-7",children:"××× ×¡"})]},a.key))})]})}),be&&e.jsxs("div",{className:"space-y-2 p-4 bg-amber-50 border border-amber-200 rounded-lg",children:[e.jsx(H,{htmlFor:"reminder_days_before",className:"font-medium",children:"××× ×××× ××¤× × ×ª×ר×× ×ס××× ×ש××× ×ת ×ת×××רת"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{id:"reminder_days_before",type:"number",min:"1",max:"365",value:U,onChange:a=>t(a.target.value),className:"w-32"}),e.jsx("span",{className:"text-sm text-gray-600",children:"×××× ××¤× ×"})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"×ר×רת ××××: 7 ××××. ×× ×ª×©× × ×ת ××¢×¨× ×××ר שש××× × ×ª×××רת - ××× ×× ×× ×ת×פס ××ש×× ×©×× ××ת×× ×××××¨× ×××ש×."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(H,{htmlFor:"subject",children:"× ××©× ×××××"}),e.jsx(q,{id:"subject",value:p,onChange:a=>E(a.target.value),placeholder:"××× ×ת × ××©× ×××××...",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(H,{htmlFor:"cc_email",children:"×עתק ×××× (CC)"}),e.jsx(q,{id:"cc_email",type:"email",value:z,onChange:a=>F(a.target.value),placeholder:"×ת××ת ×××× ××§××ת ×עתק (××פצ××× ××)...",dir:"ltr",className:"text-left"}),e.jsx("p",{className:"text-xs text-gray-500",children:"×× ×ª××× ×¡ ×ת××ת, ××× ×ª×§×× ×עתק ×©× ×× ×××× ×©××ש×× ×ת×× ×ת ××"})]}),e.jsxs("div",{className:"flex items-center gap-1 p-2 bg-gray-100 rounded-t-lg border border-b-0 border-gray-300",children:[e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>M("bold"),className:"h-8 w-8 p-0",title:"××××ש",children:e.jsx(Ke,{className:"w-4 h-4"})}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>M("italic"),className:"h-8 w-8 p-0",title:"× ×××",children:e.jsx(We,{className:"w-4 h-4"})}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>M("underline"),className:"h-8 w-8 p-0",title:"×§× ×ª×ת××",children:e.jsx(ss,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),e.jsx(n,{variant:"ghost",size:"sm",onClick:je,className:"h-8 w-8 p-0",title:"××ספת ×§×ש×ר",children:e.jsx(de,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>M("undo"),className:"h-8 w-8 p-0",title:"×××",children:e.jsx(ts,{className:"w-4 h-4"})}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>M("redo"),className:"h-8 w-8 p-0",title:"×××ר",children:e.jsx(Xe,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),e.jsx("span",{className:"text-xs text-gray-500 mr-2",children:"×××¥ ×¢× ×××§×¡× ×ת×× ×ת ××× ×ער×× ××ת×"})]}),ae&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-amber-50 border border-amber-300 rounded-lg",children:[e.jsx(de,{className:"w-4 h-4 text-amber-600 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-gray-700 flex-shrink-0",children:"×§×ש×ר:"}),e.jsx(q,{value:te,onChange:a=>re(a.target.value),className:"flex-1 h-8 text-sm",dir:"ltr",placeholder:"https://..."}),e.jsx(n,{size:"sm",className:"h-8 bg-amber-600 hover:bg-amber-700",onClick:()=>{var a,c,i;ae.setAttribute("href",te),f(((i=(c=(a=N.current)==null?void 0:a.contentDocument)==null?void 0:c.body)==null?void 0:i.innerHTML)||C),G(null)},children:"ש××ר"}),e.jsx(n,{variant:"ghost",size:"sm",className:"h-8",onClick:()=>G(null),children:"×××××"})]}),e.jsx("div",{className:"border border-gray-300 rounded-b-lg overflow-hidden",children:e.jsx("iframe",{ref:N,className:"w-full border-0",style:{height:"450px"},title:"ער××ת ת×× ×ת"})}),e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx(H,{htmlFor:"is_active",className:"font-medium",children:"ת×× ×ת פע×××"}),e.jsx("p",{className:"text-sm text-gray-500",children:"××שר פע×××, ×××××× ××ש××× ××ת×× ××ר××ר"})]}),e.jsx(Ie,{id:"is_active",checked:P,onCheckedChange:O})]})]}),e.jsxs(Le,{className:"gap-2",children:[e.jsx(n,{variant:"outline",onClick:()=>x(!1),children:"×××××"}),e.jsx(n,{onClick:_e,disabled:!p||!C||D||J&&!_,className:"bg-blue-600 hover:bg-blue-700",children:D?"ש××ר...":"ש××ר ת×× ×ת"})]})]})})}function is({open:u,onOpenChange:x,template:s,variables:w=[]}){if(!s)return null;const l={"{{user_name}}":"×שר×× ×שר×××","{{trip_name}}":"×××× ×ספר 5 - × ×× ×¢×¨×××ת","{{trip_date}}":"15/02/2026"},m=d=>{if(!d)return"";let j=d;return Object.entries(l).forEach(([p,E])=>{j=j.replace(new RegExp(p.replace(/[{}]/g,"\\$&"),"g"),E)}),j},b=m(s.subject),h=`<div dir="rtl" style="text-align: right; font-family: Arial, sans-serif;">${m(s.body_html)}</div>`;return e.jsx(he,{open:u,onOpenChange:x,children:e.jsxs(ge,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",dir:"rtl",children:[e.jsxs(ue,{children:[e.jsxs(pe,{className:"text-xl font-bold flex items-center gap-2",children:[e.jsx(K,{className:"w-5 h-5 text-blue-600"}),"תצ××× ××§××××"]}),e.jsx("p",{className:"text-gray-600",children:s.trigger_name})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(v,{className:"border-gray-200 bg-gray-50",children:e.jsxs(k,{className:"p-4",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2 font-medium",children:"ער××× ××××××:"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(d=>e.jsxs(Z,{variant:"secondary",className:"text-xs",children:[d.label,": ",l[d.key]]},d.key))})]})}),e.jsxs(v,{className:"border-blue-200",children:[e.jsx(ce,{className:"border-b bg-gray-50 py-3",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"× ×ש×:"}),e.jsx("span",{className:"font-medium",children:b})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"××:"}),e.jsx("span",{className:"text-sm",children:"[email protected]"})]})]})}),e.jsx(k,{className:"p-6",children:e.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:h}})})]}),e.jsxs(v,{className:"border-gray-200",children:[e.jsx(ce,{className:"py-3",children:e.jsx(Se,{className:"text-sm font-medium text-gray-700",children:"×§×× HTML ש××ש××"})}),e.jsx(k,{className:"p-4",children:e.jsx("pre",{className:"text-xs bg-gray-100 p-3 rounded overflow-x-auto whitespace-pre-wrap",dir:"ltr",children:h})})]})]})]})})}const Q={waiting_list_spot_available:"××ª×¤× × ××§×× ×רש××ת ×××ª× ×",public_trip_purchase:"××ש×ר ר××שת ×××× (×××ש×× ××ש××)",existing_user_trip_purchase:"××ש×ר ר××שת ×××× (×שת×ש ×§×××)",lead_subscription_invite:"×××× × ××ער×ת ×××¨× ××××¨× ×-CRM",trip_reminder:"ת×××רת ××¤× × ×××× (10 ××××)",campaign_expiring_reminder
54:"ת×××רת ×¢× ×§×פ××× ×©×¢××× ××סת×××",guide_monthly_report:"××× ××××©× ×××ר×× (ש×××× ××× ×ת)"},me=["campaign_expiring_reminder"],xe={waiting_list_spot_available:{when:"××שר ××ª×¤× × ××§×× ××××× ×©×שת×ש ××ת×× ×× ×רש××ת ××××ª× ×",recipient:"××שת×ש ×××ת×× ×©×ª××¨× ××××¢ ×רש××ת ××××ª× ×"},public_trip_purchase:{when:"××× ×××ר ר××שת ×××× ××¨× ×××£ ×צ××××¨× ×¢× ××× ×××ש ××ש (×שת×ש ש××× × ×¨×©×× ××ער×ת)",recipient:"×ר××ש ×××ש (××¤× ×ת××ת ××××× ×©×××× × ×××פס ×ר××ש×)"},existing_user_trip_purchase:{when:"××שר ×שת×ש ×§××× ××ער×ת ר××ש ×××× ×תש××× (×××× ×©××× × ×××× ××× ×× ×©××, ×× ×¨××שת ×××× × ×סף)",recipient:"××שת×ש ××§××× ×©×¨×ש ×ת ×××××"},lead_subscription_invite:{when:"××שר ××× ×-CRM ×ס××× ×××××¨× ××××¤× ××× ×× ××ער×ת",recipient:"×××§×× ×©××¤× ××× ×× (××¤× ××××× ×©×× ×-CRM)"},trip_reminder:{when:"10 ×××× ××¤× × ×××¢× ××××× (× ×©×× ×××××××ת ××× ××× ××××××× ××¢××××× ××ª× ××)",recipient:"×× ××שתתפ×× ×רש×××× ×××××"},campaign_expiring_reminder:{when:"×ספר ×××× ×©×ª×××ר ××¤× × ×ª×ר×× ×ס××× ×©× ×× ×§×פ××× ×¤×¢×× (×ר×רת ××××: 7 ××××). ×× ××©× ×× ×ת ת×ר×× ×ס××× ×× ×ת ×××¢× ×ש×××× ×××ר ×©× ×©××× ×ª×××רת - ××× ×× ×× ×ת×פס ××ש×× ×©××.",recipient:"×× ××שת×ש×× ×××§×שר×× ××§××צ×ת ×××¢× ×©× ××§×פ××× ×©×¢×××× ×× ×¨××©× ××¢×××× ×× ×¨×©×××× ××¢×× ×"},guide_monthly_report:{when:"× ×©×× ××× ×ת ×ת×× ×¢××× ×¤×ר×× ××ר××, ×××××¦× ×¢× 'ש×× ××× ×××××' ×××§×ר×××× ×©× ×××ש. צ×ר××£ ×§×××¥ ××§×¡× ×¢× ×¤×ר×× ××××××× ××ש×ר.",recipient:"×ת××ת ××××× ×©× ×××ר×× (ש×× '××××' ××ר××ס ×××ר××)"}},Y={waiting_list_spot_available:[{key:"{{user_name}}",label:"×©× ××שת×ש"},{key:"{{trip_name}}",label:"×©× ×××××"},{key:"{{trip_date}}",label:"ת×ר×× ×××××"}],public_trip_purchase:[{key:"{{buyer_name}}",label:"×©× ×ר××ש"},{key:"{{trip_name}}",label:"×©× ×××××"},{key:"{{trip_date}}",label:"ת×ר×× ×××××"},{key:"{{trip_time}}",label:"שעת ×××××"},{key:"{{meeting_point}}",label:"× ×§××ת ×פ×ש"},{key:"{{price}}",label:"×××ר"},{key:"{{registration_link}}",label:"×§×ש×ר ××רש×× ××ער×ת"}],existing_user_trip_purchase:[{key:"{{buyer_name}}",label:"×©× ×ר××ש"},{key:"{{trip_name}}",label:"×©× ×××××"},{key:"{{trip_date}}",label:"ת×ר×× ×××××"},{key:"{{trip_time}}",label:"שעת ×××××"},{key:"{{meeting_point}}",label:"× ×§××ת ×פ×ש"},{key:"{{price}}",label:"×××ר"},{key:"{{login_link}}",label:"×§×ש×ר ××ת××ר×ת ××ער×ת"}],lead_subscription_invite:[{key:"{{buyer_name}}",label:"×©× ×××§××"},{key:"{{registration_link}}",label:"×§×ש×ר ××רש×× ××ער×ת"}],trip_reminder:[{key:"{{user_name}}",label:"×©× ××שת×ש"},{key:"{{trip_name}}",label:"×©× ×××××"},{key:"{{trip_date}}",label:"ת×ר×× ×××××"},{key:"{{trip_time}}",label:"שעת ×××××"},{key:"{{meeting_point}}",label:"× ×§××ת ×פ×ש"},{key:"{{meeting_point_link}}",label:"××× ×§ ×× ×§××ת ×פ×ש"},{key:"{{trip_type}}",label:"ס×× ×××××"},{key:"{{system_link}}",label:"×§×ש×ר ××ער×ת"}],campaign_expiring_reminder:[{key:"{{user_name}}",label:"×©× ××שת×ש"},{key:"{{campaign_title}}",label:"××תרת ××§×פ×××"},{key:"{{campaign_description}}",label:"ת×××ר ××§×פ×××"},{key:"{{campaign_price}}",label:"×××ר"},{key:"{{campaign_max_payments}}",label:"×ספר תש××××× ×קס××××"},{key:"{{campaign_end_date}}",label:"ת×ר×× ×¡××× ××§×פ×××"},{key:"{{days_left}}",label:"××× ×××× × ×תר×"},{key:"{{season_label}}",label:"ת×××ר ××¢×× ×"},{key:"{{system_link}}",label:"×§×ש×ר ××ער×ת"}],guide_monthly_report:[{key:"{{guide_name}}",label:"×©× ×××ר××"},{key:"{{month_name}}",label:"×©× ××××ש"},{key:"{{year}}",label:"×©× ×"}]};
54function Ls(){const[u,x]=r.useState(!1),[s,w]=r.useState(!1),[l,m]=r.useState(null),[b,I]=r.useState(!1),[h,d]=r.useState(null),j=Ce(),{data:p=[],isLoading:E}=Te({queryKey:["email-templates"],queryFn:()=>B.entities.EmailTemplate.list()}),C=ne({mutationFn:t=>B.entities.EmailTemplate.create(t),onSuccess:()=>{j.invalidateQueries({queryKey:["email-templates"]})}}),f=ne({mutationFn:({id:t,data:y})=>B.entities.EmailTemplate.update(t,y),onSuccess:()=>{j.invalidateQueries({queryKey:["email-templates"]})}}),z=t=>{m(t),x(!0)},F=t=>{m(t),w(!0)},P=t=>{m({trigger_type:t,trigger_name:Q[t],subject:"",body_html:"",is_active:!0,reminder_days_before:me.includes(t)?7:void 0}),x(!0)},O=async t=>{l!=null&&l.id?await f.mutateAsync({id:l.id,data:t}):await C.mutateAsync(t),x(!1),m(null)},_=p.map(t=>t.trigger_type),T=Object.keys(Q).filter(t=>!_.includes(t)),U=async()=>{var t,y;I(!0),d(null);try{const g=await B.auth.me(),D=await B.functions.invoke("sendEmail",{to:g.email,subject:"×××קת ××××ר ×××× - ×¢× ×ש×××",body_html:"<h2>×××××§× ×צ××××! ð</h2><p>×××× ×× × ×©×× ××¨× Resend.</p><p>×× ××ª× ×¨××× ××××¢× ××, ×××××ר תק××.</p>"});(t=D.data)!=null&&t.success?d({success:!0,message:`×××× ××××§× × ×©×× ×-${g.email}`}):d({success:!1,message:((y=D.data)==null?void 0:y.error)||"ש×××× ×ש××××"})}catch(g){d({success:!1,message:g.message||"ש×××× ×ש××××"})}finally{I(!1)}};return e.jsxs("div",{className:"min-h-screen p-4 md:p-8 bg-gray-50",dir:"rtl",children:[e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx(ee.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"mb-8",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"× ×××× ××××××"}),e.jsx("p",{className:"text-gray-600",children:"×××רת ת×× ××ת ×××× ×ש×××× ××¨× Resend"})]}),e.jsxs(n,{onClick:U,variant:"outline",className:"gap-2",disabled:b,children:[e.jsx(Ue,{className:"w-4 h-4"}),b?"ש×××...":"ש×× ×××× ××××§×"]})]})}),e.jsxs(ee.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"mb-8 space-y-3",children:[e.jsx(v,{className:"border-2 border-green-200 bg-green-50",children:e.jsx(k,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 rounded-full flex items-center justify-center",children:e.jsx(K,{className:"w-5 h-5 text-green-700"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:"Resend - שרת ×××××× ×¨×ש×"}),e.jsx("p",{className:"text-sm text-gray-600",children:"×××××× × ×©×××× ××¨× Resend API ×ש×ר×ת ×××ער×ת"})]}),e.jsx(Z,{className:"bg-green-500 text-white mr-auto",children:"××××ר"})]})})}),h&&e.jsxs(Ee,{className:h.success?"border-green-200 bg-green-50":"border-red-200 bg-red-50",children:[h.success?e.jsx(Ge,{className:"w-4 h-4 text-green-600"}):e.jsx($e,{className:"w-4 h-4 text-red-600"}),e.jsx(Re,{className:h.success?"text-green-800":"text-red-800",children:h.message})]})]}),e.jsxs(ee.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(K,{className:"w-5 h-5 text-blue-600"}),"ת×× ××ת ××××"]}),T.length>0&&e.jsxs(n,{onClick:()=>{m({trigger_type:"",trigger_name:"",subject:"",body_html:"",is_active:!0}),x(!0)},className:"gap-2 bg-blue-600 hover:bg-blue-700",children:[e.jsx(oe,{className:"w-4 h-4"}),"ת×× ×ת ××ש×"]})]}),E?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):e.jsxs("div",{className:"space-y-4",children:[p.map(t=>{var y;return e.jsx(v,{className:"hover:shadow-md transition-shadow",children:e.jsx(k,{className:"p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t.trigger_name}),e.jsx(Z,{className:t.is_active?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600",children:t.is_active?"פע××":"×× ×¤×¢××"})]}),e.jsxs("p",{className:"text-gray-600 mb-2",children:[e.jsx("span",{className:"font-medium",children:"× ×ש×:"})," ",t.subject||"×× ××××ר"]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:(y=Y[t.trigger_type])==null?void 0:y.map(g=>e.jsx(Z,{variant:"outline",className:"text-xs",children:g.label},g.key))})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>
54F(t),children:[e.jsx(qe,{className:"w-4 h-4 ml-1"}),"תצ××× ××§××××"]}),e.jsxs(n,{size:"sm",onClick:()=>z(t),className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(Qe,{className:"w-4 h-4 ml-1"}),"ער×××"]})]})]})})},t.id)}),T.map(t=>e.jsx(v,{className:"border-dashed border-2 border-gray-300 hover:border-blue-400 transition-colors",children:e.jsx(k,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-gray-700",children:Q[t]}),e.jsx("p",{className:"text-sm text-gray-500",children:"×× ×××××¨× ×ª×× ×ת"})]}),e.jsxs(n,{variant:"outline",onClick:()=>P(t),className:"gap-2",children:[e.jsx(oe,{className:"w-4 h-4"}),"צ×ר ת×× ×ת"]})]})})},t)),p.length===0&&T.length===0&&e.jsxs("div",{className:"text-center py-12 bg-gray-100 rounded-lg",children:[e.jsx(K,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"××× ×ª×× ××ת ××××"})]})]})]})]}),e.jsx(rs,{open:u,onOpenChange:x,template:l,variables:l?Y[l.trigger_type]:[],triggerInfo:l?xe[l.trigger_type]:null,availableTriggers:T,triggerLabels:Q,triggerInfoMap:xe,triggerVariablesMap:Y,triggersWithDaysBefore:me,onSave:O}),e.jsx(is,{open:s,onOpenChange:w,template:l,variables:l?Y[l.trigger_type]:[]})]})}export{Ls 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.