@universe-platform/ui 0.1.0-beta.26 → 0.1.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -8677,7 +8677,8 @@ var PlacementBlock = (props) => {
8677
8677
  };
8678
8678
 
8679
8679
  // src/components/WhatsAppComponent/WhatsAppComponent.tsx
8680
- import { CheckCircle2 as CheckCircle24, AlertCircle as AlertCircle5, X as X12, Loader2 as Loader27, Phone as Phone4, Send as Send2, Image as ImageIcon3, FileText as FileText4, Video as Video3 } from "lucide-react";
8680
+ import React18 from "react";
8681
+ import { CheckCircle2 as CheckCircle24, AlertCircle as AlertCircle5, X as X12, Loader2 as Loader28, Phone as Phone4, Send as Send3, Image as ImageIcon3, FileText as FileText4, Video as Video3 } from "lucide-react";
8681
8682
 
8682
8683
  // src/components/WhatsAppComponent/CreateTemplateModal.tsx
8683
8684
  import { useState as useState15, useEffect as useEffect13, useRef as useRef12, useMemo as useMemo8 } from "react";
@@ -13601,367 +13602,683 @@ function SettingsAndActionsBlock({
13601
13602
  ] });
13602
13603
  }
13603
13604
 
13605
+ // src/components/WhatsAppComponent/inbox/useInboxState.ts
13606
+ import { useState as useState17, useEffect as useEffect15, useCallback as useCallback14, useRef as useRef15 } from "react";
13607
+ function useInboxState(orgId, actions) {
13608
+ const [conversations, setConversations] = useState17([]);
13609
+ const [activeConversationId, setActiveConversationId] = useState17(null);
13610
+ const [messages, setMessages] = useState17([]);
13611
+ const [isLoading, setIsLoading] = useState17(false);
13612
+ const [isSending, setIsSending] = useState17(false);
13613
+ const [error, setError] = useState17(null);
13614
+ const actionsRef = useRef15(actions);
13615
+ useEffect15(() => {
13616
+ actionsRef.current = actions;
13617
+ });
13618
+ const fetchConversations = useCallback14(async () => {
13619
+ if (!orgId) return;
13620
+ const res = await actionsRef.current.getConversations(orgId);
13621
+ if (res.success && res.data) {
13622
+ setConversations(res.data);
13623
+ } else if (res.error) {
13624
+ setError(res.error);
13625
+ }
13626
+ }, [orgId]);
13627
+ const fetchMessages = useCallback14(async (conversationId, silent = false) => {
13628
+ if (!silent) setIsLoading(true);
13629
+ const res = await actionsRef.current.getMessages(conversationId);
13630
+ if (res.success && res.data) {
13631
+ setMessages(res.data);
13632
+ setConversations(
13633
+ (prev) => prev.map((c) => c.id === conversationId ? __spreadProps(__spreadValues({}, c), { unreadCount: 0 }) : c)
13634
+ );
13635
+ } else if (res.error) {
13636
+ setError(res.error);
13637
+ }
13638
+ if (!silent) setIsLoading(false);
13639
+ }, []);
13640
+ useEffect15(() => {
13641
+ fetchConversations();
13642
+ const interval = setInterval(() => {
13643
+ fetchConversations();
13644
+ if (activeConversationId) {
13645
+ fetchMessages(activeConversationId, true);
13646
+ }
13647
+ }, 5e3);
13648
+ return () => clearInterval(interval);
13649
+ }, [fetchConversations, activeConversationId, fetchMessages]);
13650
+ const handleSelectConversation = (id) => {
13651
+ setActiveConversationId(id);
13652
+ fetchMessages(id);
13653
+ };
13654
+ const handleSendMessage = async (text) => {
13655
+ if (!activeConversationId || !text.trim()) return;
13656
+ setIsSending(true);
13657
+ const tempMsg = {
13658
+ id: Date.now().toString(),
13659
+ direction: "OUTBOUND",
13660
+ content: text,
13661
+ status: "SENDING",
13662
+ createdAt: /* @__PURE__ */ new Date()
13663
+ };
13664
+ setMessages((prev) => [tempMsg, ...prev]);
13665
+ const res = await actions.sendMessage(activeConversationId, text, orgId);
13666
+ if (res.success && res.data) {
13667
+ setMessages((prev) => prev.map((m) => m.id === tempMsg.id ? res.data : m));
13668
+ fetchConversations();
13669
+ } else {
13670
+ setError("\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4");
13671
+ setMessages((prev) => prev.filter((m) => m.id !== tempMsg.id));
13672
+ }
13673
+ setIsSending(false);
13674
+ };
13675
+ return {
13676
+ conversations,
13677
+ activeConversationId,
13678
+ messages,
13679
+ isLoading,
13680
+ isSending,
13681
+ error,
13682
+ handleSelectConversation,
13683
+ handleSendMessage
13684
+ };
13685
+ }
13686
+
13687
+ // src/components/WhatsAppComponent/inbox/ConversationList.tsx
13688
+ import { Search as Search4, User } from "lucide-react";
13689
+ import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
13690
+ function ConversationList({ conversations, activeId, onSelect }) {
13691
+ return /* @__PURE__ */ jsxs19("div", { className: "w-80 border-l border-slate-200 bg-white flex flex-col h-full shrink-0", children: [
13692
+ /* @__PURE__ */ jsxs19("div", { className: "p-4 border-b border-slate-100 bg-slate-50", children: [
13693
+ /* @__PURE__ */ jsx20("h2", { className: "text-lg font-bold text-slate-800 mb-3", children: "\u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05DB\u05E0\u05E1\u05D5\u05EA" }),
13694
+ /* @__PURE__ */ jsxs19("div", { className: "relative", children: [
13695
+ /* @__PURE__ */ jsx20(Search4, { className: "w-4 h-4 absolute right-3 top-1/2 -translate-y-1/2 text-slate-400" }),
13696
+ /* @__PURE__ */ jsx20(
13697
+ "input",
13698
+ {
13699
+ type: "text",
13700
+ placeholder: "\u05D7\u05D9\u05E4\u05D5\u05E9 \u05DC\u05E4\u05D9 \u05E9\u05DD \u05D0\u05D5 \u05DE\u05E1\u05E4\u05E8...",
13701
+ className: "w-full pl-3 pr-9 py-2 bg-white border border-slate-200 rounded-xl text-xs focus:outline-none focus:border-emerald-500"
13702
+ }
13703
+ )
13704
+ ] })
13705
+ ] }),
13706
+ /* @__PURE__ */ jsx20("div", { className: "flex-1 overflow-y-auto", children: (() => {
13707
+ const sortedConversations = [...conversations].sort(
13708
+ (a, b) => new Date(b.lastMessageAt).getTime() - new Date(a.lastMessageAt).getTime()
13709
+ );
13710
+ return sortedConversations.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "p-6 text-center text-sm text-slate-400", children: "\u05D0\u05D9\u05DF \u05E9\u05D9\u05D7\u05D5\u05EA \u05E4\u05E2\u05D9\u05DC\u05D5\u05EA" }) : sortedConversations.map((conv) => {
13711
+ var _a, _b;
13712
+ return /* @__PURE__ */ jsxs19(
13713
+ "button",
13714
+ {
13715
+ onClick: () => onSelect(conv.id),
13716
+ className: `w-full text-right p-4 border-b border-slate-100 transition-colors hover:bg-slate-50 flex items-start gap-3 ${activeId === conv.id ? "bg-emerald-50/50 border-r-4 border-r-emerald-500" : "border-r-4 border-r-transparent"}`,
13717
+ children: [
13718
+ /* @__PURE__ */ jsx20("div", { className: "w-10 h-10 rounded-full bg-slate-200 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx20(User, { className: "w-5 h-5 text-slate-500" }) }),
13719
+ /* @__PURE__ */ jsxs19("div", { className: "flex-1 overflow-hidden", children: [
13720
+ /* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center mb-1", children: [
13721
+ /* @__PURE__ */ jsx20("span", { className: "font-semibold text-slate-800 text-sm truncate", children: conv.contactName || conv.contactPhone }),
13722
+ /* @__PURE__ */ jsx20("span", { className: "text-[10px] text-slate-400", children: new Date(conv.lastMessageAt).toLocaleTimeString("he-IL", { hour: "2-digit", minute: "2-digit" }) })
13723
+ ] }),
13724
+ /* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center", children: [
13725
+ /* @__PURE__ */ jsx20("p", { className: "text-xs text-slate-500 truncate w-4/5", children: ((_b = (_a = conv.messages) == null ? void 0 : _a[0]) == null ? void 0 : _b.content) || "\u05D0\u05D9\u05DF \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA" }),
13726
+ conv.unreadCount > 0 && /* @__PURE__ */ jsx20("span", { className: "bg-emerald-500 text-white text-[10px] font-bold px-1.5 py-0.5 rounded-full min-w-[20px] text-center", children: conv.unreadCount })
13727
+ ] })
13728
+ ] })
13729
+ ]
13730
+ },
13731
+ conv.id
13732
+ );
13733
+ });
13734
+ })() })
13735
+ ] });
13736
+ }
13737
+
13738
+ // src/components/WhatsAppComponent/inbox/ChatWindow.tsx
13739
+ import { useState as useState18, useRef as useRef16, useEffect as useEffect16 } from "react";
13740
+ import { Send as Send2, User as User2, Loader2 as Loader27 } from "lucide-react";
13741
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
13742
+ function ChatWindow({ activeConversation, messages, isLoading, isSending, onSendMessage }) {
13743
+ const [inputText, setInputText] = useState18("");
13744
+ const messagesTopRef = useRef16(null);
13745
+ const scrollToTop = () => {
13746
+ var _a;
13747
+ (_a = messagesTopRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
13748
+ };
13749
+ useEffect16(() => {
13750
+ scrollToTop();
13751
+ }, [messages.length, activeConversation == null ? void 0 : activeConversation.id]);
13752
+ const handleSend = (e) => {
13753
+ e.preventDefault();
13754
+ if (!inputText.trim() || isSending) return;
13755
+ onSendMessage(inputText);
13756
+ setInputText("");
13757
+ };
13758
+ if (!activeConversation) {
13759
+ return /* @__PURE__ */ jsxs20("div", { className: "flex-1 bg-slate-50 flex items-center justify-center flex-col gap-4 text-slate-400", children: [
13760
+ /* @__PURE__ */ jsx21("div", { className: "w-16 h-16 rounded-full bg-slate-200 flex items-center justify-center", children: /* @__PURE__ */ jsx21("svg", { className: "w-8 h-8 text-slate-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) }),
13761
+ /* @__PURE__ */ jsx21("p", { children: "\u05D1\u05D7\u05E8 \u05E9\u05D9\u05D7\u05D4 \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC" })
13762
+ ] });
13763
+ }
13764
+ return /* @__PURE__ */ jsxs20("div", { className: "flex-1 flex flex-col bg-[#efeae2] h-full relative", children: [
13765
+ /* @__PURE__ */ jsxs20("div", { className: "h-16 bg-white border-b border-slate-200 px-6 flex items-center gap-3 shrink-0 z-10 shadow-sm", children: [
13766
+ /* @__PURE__ */ jsx21("div", { className: "w-10 h-10 rounded-full bg-slate-200 flex items-center justify-center", children: /* @__PURE__ */ jsx21(User2, { className: "w-5 h-5 text-slate-500" }) }),
13767
+ /* @__PURE__ */ jsxs20("div", { children: [
13768
+ /* @__PURE__ */ jsx21("h3", { className: "font-bold text-slate-800", children: activeConversation.contactName || activeConversation.contactPhone }),
13769
+ /* @__PURE__ */ jsx21("p", { className: "text-xs text-slate-500", dir: "ltr", children: activeConversation.contactPhone })
13770
+ ] })
13771
+ ] }),
13772
+ /* @__PURE__ */ jsxs20("div", { className: "flex-1 overflow-y-auto p-6 space-y-4", children: [
13773
+ /* @__PURE__ */ jsx21("div", { ref: messagesTopRef }),
13774
+ isLoading ? /* @__PURE__ */ jsx21("div", { className: "flex justify-center py-10", children: /* @__PURE__ */ jsx21(Loader27, { className: "w-6 h-6 animate-spin text-emerald-600" }) }) : messages.map((msg, idx) => {
13775
+ const isOutbound = msg.direction === "OUTBOUND";
13776
+ return /* @__PURE__ */ jsx21("div", { className: `flex ${isOutbound ? "justify-start" : "justify-end"}`, children: /* @__PURE__ */ jsxs20("div", { className: `max-w-[70%] rounded-2xl px-4 py-2 shadow-sm relative ${isOutbound ? "bg-[#d9fdd3] text-slate-900 rounded-tr-none" : "bg-white text-slate-900 rounded-tl-none"}`, children: [
13777
+ /* @__PURE__ */ jsx21("p", { className: "text-sm whitespace-pre-wrap", children: msg.content }),
13778
+ /* @__PURE__ */ jsxs20("div", { className: "text-[11px] text-slate-600 mt-1 text-left flex items-center justify-end gap-1", children: [
13779
+ new Date(msg.createdAt).toLocaleString("he-IL", { day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit" }),
13780
+ isOutbound && /* @__PURE__ */ jsx21("span", { className: msg.status === "READ" || msg.status === "DELIVERED" ? "text-blue-500" : "text-slate-500", children: msg.status === "READ" ? "\u2713\u2713" : msg.status === "DELIVERED" ? "\u2713\u2713" : "\u2713" })
13781
+ ] })
13782
+ ] }) }, msg.id || idx);
13783
+ })
13784
+ ] }),
13785
+ /* @__PURE__ */ jsx21("div", { className: "bg-slate-50 p-4 border-t border-slate-200 shrink-0", children: /* @__PURE__ */ jsxs20("form", { onSubmit: handleSend, className: "flex items-end gap-2 max-w-4xl mx-auto", children: [
13786
+ /* @__PURE__ */ jsx21("div", { className: "flex-1 bg-white border border-slate-300 rounded-2xl overflow-hidden focus-within:border-emerald-500 focus-within:ring-1 focus-within:ring-emerald-500", children: /* @__PURE__ */ jsx21(
13787
+ "textarea",
13788
+ {
13789
+ rows: 1,
13790
+ value: inputText,
13791
+ onChange: (e) => setInputText(e.target.value),
13792
+ onKeyDown: (e) => {
13793
+ if (e.key === "Enter" && !e.shiftKey) {
13794
+ e.preventDefault();
13795
+ handleSend(e);
13796
+ }
13797
+ },
13798
+ placeholder: "\u05D4\u05E7\u05DC\u05D3 \u05D4\u05D5\u05D3\u05E2\u05D4...",
13799
+ className: "w-full max-h-32 min-h-[44px] p-3 text-sm bg-transparent outline-none resize-none"
13800
+ }
13801
+ ) }),
13802
+ /* @__PURE__ */ jsx21(
13803
+ "button",
13804
+ {
13805
+ type: "submit",
13806
+ disabled: !inputText.trim() || isSending,
13807
+ className: `w-11 h-11 rounded-full flex items-center justify-center shrink-0 transition-colors ${!inputText.trim() || isSending ? "bg-slate-200 text-slate-400" : "bg-emerald-600 hover:bg-emerald-700 text-white shadow-md"}`,
13808
+ children: isSending ? /* @__PURE__ */ jsx21(Loader27, { className: "w-5 h-5 animate-spin" }) : /* @__PURE__ */ jsx21(Send2, { className: "w-5 h-5 -ml-1" })
13809
+ }
13810
+ )
13811
+ ] }) })
13812
+ ] });
13813
+ }
13814
+
13815
+ // src/components/WhatsAppComponent/inbox/WhatsAppInbox.tsx
13816
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
13817
+ function WhatsAppInbox({
13818
+ orgId,
13819
+ getConversationsAction,
13820
+ getMessagesAction,
13821
+ sendInboxMessageAction
13822
+ }) {
13823
+ const {
13824
+ conversations,
13825
+ activeConversationId,
13826
+ messages,
13827
+ isLoading,
13828
+ isSending,
13829
+ handleSelectConversation,
13830
+ handleSendMessage
13831
+ } = useInboxState(orgId, {
13832
+ getConversations: getConversationsAction,
13833
+ getMessages: getMessagesAction,
13834
+ sendMessage: sendInboxMessageAction
13835
+ });
13836
+ const activeConversation = conversations.find((c) => c.id === activeConversationId);
13837
+ return /* @__PURE__ */ jsxs21("div", { className: "flex h-[calc(100vh-140px)] min-h-[600px] w-full border border-slate-200 rounded-2xl overflow-hidden bg-white shadow-xs", dir: "rtl", children: [
13838
+ /* @__PURE__ */ jsx22(
13839
+ ConversationList,
13840
+ {
13841
+ conversations,
13842
+ activeId: activeConversationId,
13843
+ onSelect: handleSelectConversation
13844
+ }
13845
+ ),
13846
+ /* @__PURE__ */ jsx22(
13847
+ ChatWindow,
13848
+ {
13849
+ activeConversation,
13850
+ messages,
13851
+ isLoading,
13852
+ isSending,
13853
+ onSendMessage: handleSendMessage
13854
+ }
13855
+ )
13856
+ ] });
13857
+ }
13858
+
13604
13859
  // src/components/WhatsAppComponent/WhatsAppComponent.tsx
13605
- import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
13860
+ import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
13606
13861
  function WhatsAppComponent(props) {
13607
13862
  var _a;
13608
13863
  const { className = "", settings, orgId, componentId, executeAction } = props;
13609
13864
  const state = useWhatsAppState(props);
13610
- return /* @__PURE__ */ jsxs19(
13865
+ const [activeTab, setActiveTab] = React18.useState("broadcast");
13866
+ return /* @__PURE__ */ jsxs22(
13611
13867
  "div",
13612
13868
  {
13613
13869
  className: `w-full flex flex-col bg-white border border-slate-200 rounded-2xl shadow-xs overflow-hidden ${className}`,
13614
13870
  "data-testid": "whatsapp-component",
13615
13871
  dir: "rtl",
13616
13872
  children: [
13617
- state.feedback && /* @__PURE__ */ jsxs19(
13618
- "div",
13619
- {
13620
- className: `px-6 py-3 border-b text-xs flex items-center justify-between gap-3 ${state.feedback.type === "success" ? "bg-emerald-50 border-emerald-200 text-emerald-800" : "bg-rose-50 border-rose-200 text-rose-800"}`,
13621
- children: [
13622
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
13623
- state.feedback.type === "success" ? /* @__PURE__ */ jsx20(CheckCircle24, { className: "w-4 h-4 text-emerald-600 shrink-0" }) : /* @__PURE__ */ jsx20(AlertCircle5, { className: "w-4 h-4 text-rose-600 shrink-0" }),
13624
- /* @__PURE__ */ jsx20("span", { children: state.feedback.message })
13625
- ] }),
13626
- /* @__PURE__ */ jsx20(
13627
- "button",
13628
- {
13629
- type: "button",
13630
- onClick: () => state.setFeedback(null),
13631
- className: "text-slate-400 hover:text-slate-700 cursor-pointer",
13632
- children: /* @__PURE__ */ jsx20(X12, { className: "w-4 h-4" })
13633
- }
13634
- )
13635
- ]
13636
- }
13637
- ),
13638
- state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */ jsxs19("div", { className: "px-6 py-3 bg-amber-50 border-b border-amber-200 text-xs text-amber-900 flex items-center justify-between", children: [
13639
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
13640
- /* @__PURE__ */ jsx20(AlertCircle5, { className: "w-4 h-4 text-amber-600 shrink-0" }),
13641
- /* @__PURE__ */ jsxs19("span", { children: [
13642
- "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05DE-Meta: ",
13643
- state.fetchError
13644
- ] })
13645
- ] }),
13646
- /* @__PURE__ */ jsx20(
13873
+ /* @__PURE__ */ jsxs22("div", { className: "flex border-b border-slate-200 bg-slate-50 px-6 pt-3 gap-4 shrink-0", children: [
13874
+ /* @__PURE__ */ jsx23(
13875
+ "button",
13876
+ {
13877
+ type: "button",
13878
+ onClick: () => setActiveTab("broadcast"),
13879
+ className: `pb-3 text-sm font-bold border-b-2 transition-colors cursor-pointer ${activeTab === "broadcast" ? "border-emerald-600 text-emerald-700" : "border-transparent text-slate-500 hover:text-slate-800"}`,
13880
+ children: "\u{1F4E4} \u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05D5\u05EA\u05E4\u05D5\u05E6\u05D4"
13881
+ }
13882
+ ),
13883
+ /* @__PURE__ */ jsx23(
13647
13884
  "button",
13648
13885
  {
13649
13886
  type: "button",
13650
- onClick: state.loadTemplates,
13651
- className: "font-bold underline cursor-pointer",
13652
- children: "\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1"
13887
+ onClick: () => setActiveTab("inbox"),
13888
+ className: `pb-3 text-sm font-bold border-b-2 transition-colors cursor-pointer ${activeTab === "inbox" ? "border-emerald-600 text-emerald-700" : "border-transparent text-slate-500 hover:text-slate-800"}`,
13889
+ children: "\u{1F4AC} \u05EA\u05D9\u05D1\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA (Inbox)"
13653
13890
  }
13654
13891
  )
13655
13892
  ] }),
13656
- /* @__PURE__ */ jsxs19("div", { className: "p-4 flex flex-col gap-4", children: [
13657
- /* @__PURE__ */ jsxs19("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
13658
- /* @__PURE__ */ jsx20(
13659
- TemplateSelectionBlock,
13660
- {
13661
- selectedTemplate: state.selectedTemplate,
13662
- selectedTemplateId: state.selectedTemplateId,
13663
- setSelectedTemplateId: state.setSelectedTemplateId,
13664
- templates: state.templates,
13665
- isLoadingTemplates: state.isLoadingTemplates,
13666
- isDropdownOpen: state.isDropdownOpen,
13667
- setIsDropdownOpen: state.setIsDropdownOpen,
13668
- templateBodyText: state.templateBodyText,
13669
- templateHeaderComp: state.templateHeaderComp,
13670
- headerMediaUrl: state.headerMediaUrl,
13671
- handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
13672
- handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
13673
- templateVariables: state.templateVariables,
13674
- variableMapping: state.variableMapping,
13675
- handleVariableTypeChange: state.handleVariableTypeChange,
13676
- handleVariableValueChange: state.handleVariableValueChange,
13677
- textableColumnOptions: state.textableColumnOptions,
13678
- handleDeleteTemplate: state.handleDeleteTemplate,
13679
- isDeleting: state.isDeleting,
13680
- setIsModalOpen: state.setIsModalOpen,
13681
- setFeedback: state.setFeedback,
13682
- isUploadingMedia: state.isUploadingMedia,
13683
- handleFileUpload: state.handleFileUpload
13893
+ activeTab === "inbox" ? /* @__PURE__ */ jsx23("div", { className: "p-4 flex-1", children: /* @__PURE__ */ jsx23(
13894
+ WhatsAppInbox,
13895
+ {
13896
+ orgId: orgId || props.organizationId || "",
13897
+ getConversationsAction: async (id) => {
13898
+ if (!executeAction) return { success: false, error: "executeAction missing" };
13899
+ try {
13900
+ const data = await executeAction("GET_WHATSAPP_CONVERSATIONS", { orgId: id });
13901
+ return { success: true, data };
13902
+ } catch (e) {
13903
+ return { success: false, error: (e == null ? void 0 : e.message) || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA" };
13684
13904
  }
13685
- ),
13686
- /* @__PURE__ */ jsx20(
13687
- DynamicFiltersBlock,
13688
- {
13689
- filterableColumns: state.filterableColumns,
13690
- filters: state.filters,
13691
- handleFilterChange: state.handleFilterChange,
13692
- handleClearFilters: state.handleClearFilters,
13693
- activeFiltersCount: state.activeFiltersCount,
13694
- relationOptions: state.relationOptions,
13695
- getRelationOptionsForCol: state.getRelationOptionsForCol,
13696
- selectedRowIds: state.selectedRowIds,
13697
- filteredRecordsCount: state.filteredRecords.length,
13698
- rawRecordsCount: state.rawRecords.length,
13699
- loadTableData: state.loadTableData,
13700
- isLoadingTableData: state.isLoadingTableData
13905
+ },
13906
+ getMessagesAction: async (convId) => {
13907
+ if (!executeAction) return { success: false, error: "executeAction missing" };
13908
+ try {
13909
+ const data = await executeAction("GET_WHATSAPP_MESSAGES", {
13910
+ conversationId: convId,
13911
+ orgId: orgId || props.organizationId || ""
13912
+ });
13913
+ return { success: true, data };
13914
+ } catch (e) {
13915
+ return { success: false, error: (e == null ? void 0 : e.message) || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA" };
13701
13916
  }
13702
- ),
13703
- /* @__PURE__ */ jsx20(
13704
- SettingsAndActionsBlock,
13917
+ },
13918
+ sendInboxMessageAction: async (convId, text, currentOrgId) => {
13919
+ if (!executeAction) return { success: false, error: "executeAction missing" };
13920
+ try {
13921
+ const data = await executeAction("SEND_WHATSAPP_INBOX_MESSAGE", {
13922
+ conversationId: convId,
13923
+ text,
13924
+ orgId: currentOrgId
13925
+ });
13926
+ return { success: true, data };
13927
+ } catch (e) {
13928
+ return { success: false, error: (e == null ? void 0 : e.message) || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" };
13929
+ }
13930
+ }
13931
+ }
13932
+ ) }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
13933
+ state.feedback && /* @__PURE__ */ jsxs22(
13934
+ "div",
13935
+ {
13936
+ className: `px-6 py-3 border-b text-xs flex items-center justify-between gap-3 ${state.feedback.type === "success" ? "bg-emerald-50 border-emerald-200 text-emerald-800" : "bg-rose-50 border-rose-200 text-rose-800"}`,
13937
+ children: [
13938
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
13939
+ state.feedback.type === "success" ? /* @__PURE__ */ jsx23(CheckCircle24, { className: "w-4 h-4 text-emerald-600 shrink-0" }) : /* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-rose-600 shrink-0" }),
13940
+ /* @__PURE__ */ jsx23("span", { children: state.feedback.message })
13941
+ ] }),
13942
+ /* @__PURE__ */ jsx23(
13943
+ "button",
13944
+ {
13945
+ type: "button",
13946
+ onClick: () => state.setFeedback(null),
13947
+ className: "text-slate-400 hover:text-slate-700 cursor-pointer",
13948
+ children: /* @__PURE__ */ jsx23(X12, { className: "w-4 h-4" })
13949
+ }
13950
+ )
13951
+ ]
13952
+ }
13953
+ ),
13954
+ state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */ jsxs22("div", { className: "px-6 py-3 bg-amber-50 border-b border-amber-200 text-xs text-amber-900 flex items-center justify-between", children: [
13955
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
13956
+ /* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-amber-600 shrink-0" }),
13957
+ /* @__PURE__ */ jsxs22("span", { children: [
13958
+ "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05DE-Meta: ",
13959
+ state.fetchError
13960
+ ] })
13961
+ ] }),
13962
+ /* @__PURE__ */ jsx23(
13963
+ "button",
13705
13964
  {
13706
- isScanningPhoneColumns: state.isScanningPhoneColumns,
13707
- targetPhoneOptions: state.targetPhoneOptions,
13708
- phoneColumnId: state.phoneColumnId,
13709
- setPhoneColumnId: state.setPhoneColumnId,
13710
- selectedPhoneOption: state.selectedPhoneOption,
13711
- autoSelectCount: state.autoSelectCount,
13712
- setAutoSelectCount: state.setAutoSelectCount,
13713
- subtableFilterColumn: state.subtableFilterColumn,
13714
- setSubtableFilterColumn: state.setSubtableFilterColumn,
13715
- subtableFilterValue: state.subtableFilterValue,
13716
- setSubtableFilterValue: state.setSubtableFilterValue,
13717
- subtableSendLimit: state.subtableSendLimit,
13718
- setSubtableSendLimit: state.setSubtableSendLimit,
13719
- subtableFilterableColumns: state.subtableFilterableColumns,
13720
- selectedSubtableFilterCol: state.selectedSubtableFilterCol,
13721
- getRelationOptionsForCol: state.getRelationOptionsForCol,
13722
- relationOptions: state.relationOptions,
13723
- enablePostSendAction: state.enablePostSendAction,
13724
- setEnablePostSendAction: state.setEnablePostSendAction,
13725
- postSendActionColumn: state.postSendActionColumn,
13726
- setPostSendActionColumn: state.setPostSendActionColumn,
13727
- postSendActionValue: state.postSendActionValue,
13728
- setPostSendActionValue: state.setPostSendActionValue,
13729
- postSendActionTargetType: state.postSendActionTargetType,
13730
- setPostSendActionTargetType: state.setPostSendActionTargetType,
13731
- postSendActionTargetOptions: state.postSendActionTargetOptions,
13732
- selectedPostSendOption: state.selectedPostSendCol,
13733
- isTestDisabled: state.isTestDisabled,
13734
- testButtonTitle: state.testButtonTitle,
13735
- setIsTestPromptOpen: state.setIsTestPromptOpen,
13736
- isSendDisabled: state.isSendDisabled,
13737
- sendButtonTitle: state.sendButtonTitle,
13738
- handleSendMessages: state.handleSendMessages,
13739
- selectedRowIdsCount: state.selectedRowIds.length,
13740
- finalRecipientCount: state.finalRecipientCount,
13741
- validMainRowsCount: state.validMainRowsCount,
13742
- isSendingBroadcast: state.isSendingBroadcast,
13743
- broadcastProgress: state.broadcastProgress,
13744
- broadcastSummary: state.broadcastSummary,
13745
- clearBroadcastSummary: state.clearBroadcastSummary
13965
+ type: "button",
13966
+ onClick: state.loadTemplates,
13967
+ className: "font-bold underline cursor-pointer",
13968
+ children: "\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1"
13746
13969
  }
13747
13970
  )
13748
13971
  ] }),
13749
- /* @__PURE__ */ jsx20("div", { className: "w-full h-[calc(100vh-420px)] min-h-[320px] overflow-hidden border border-slate-200 rounded-2xl shadow-xs bg-white flex flex-col", children: state.isLoadingTableData && state.rawRecords.length === 0 ? /* @__PURE__ */ jsxs19("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
13750
- /* @__PURE__ */ jsx20(Loader27, { className: "w-6 h-6 animate-spin text-emerald-600" }),
13751
- /* @__PURE__ */ jsx20("span", { children: "\u05D8\u05D5\u05E2\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4..." })
13752
- ] }) : state.tableError ? /* @__PURE__ */ jsxs19("div", { className: "flex-1 flex items-center justify-center p-6 text-center text-xs text-rose-600 bg-rose-50 gap-2", children: [
13753
- /* @__PURE__ */ jsx20(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
13754
- /* @__PURE__ */ jsx20("span", { children: state.tableError })
13755
- ] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */ jsx20("div", { className: "flex-1 flex items-center justify-center p-10 text-center text-xs text-slate-400", children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 \u05E2\u05D1\u05D5\u05E8 \u05E8\u05DB\u05D9\u05D1 WhatsApp \u05D6\u05D4" }) : /* @__PURE__ */ jsx20(
13756
- TableBlockClient,
13972
+ /* @__PURE__ */ jsxs22("div", { className: "p-4 flex flex-col gap-4", children: [
13973
+ /* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
13974
+ /* @__PURE__ */ jsx23(
13975
+ TemplateSelectionBlock,
13976
+ {
13977
+ selectedTemplate: state.selectedTemplate,
13978
+ selectedTemplateId: state.selectedTemplateId,
13979
+ setSelectedTemplateId: state.setSelectedTemplateId,
13980
+ templates: state.templates,
13981
+ isLoadingTemplates: state.isLoadingTemplates,
13982
+ isDropdownOpen: state.isDropdownOpen,
13983
+ setIsDropdownOpen: state.setIsDropdownOpen,
13984
+ templateBodyText: state.templateBodyText,
13985
+ templateHeaderComp: state.templateHeaderComp,
13986
+ headerMediaUrl: state.headerMediaUrl,
13987
+ handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
13988
+ handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
13989
+ templateVariables: state.templateVariables,
13990
+ variableMapping: state.variableMapping,
13991
+ handleVariableTypeChange: state.handleVariableTypeChange,
13992
+ handleVariableValueChange: state.handleVariableValueChange,
13993
+ textableColumnOptions: state.textableColumnOptions,
13994
+ handleDeleteTemplate: state.handleDeleteTemplate,
13995
+ isDeleting: state.isDeleting,
13996
+ setIsModalOpen: state.setIsModalOpen,
13997
+ setFeedback: state.setFeedback,
13998
+ isUploadingMedia: state.isUploadingMedia,
13999
+ handleFileUpload: state.handleFileUpload
14000
+ }
14001
+ ),
14002
+ /* @__PURE__ */ jsx23(
14003
+ DynamicFiltersBlock,
14004
+ {
14005
+ filterableColumns: state.filterableColumns,
14006
+ filters: state.filters,
14007
+ handleFilterChange: state.handleFilterChange,
14008
+ handleClearFilters: state.handleClearFilters,
14009
+ activeFiltersCount: state.activeFiltersCount,
14010
+ relationOptions: state.relationOptions,
14011
+ getRelationOptionsForCol: state.getRelationOptionsForCol,
14012
+ selectedRowIds: state.selectedRowIds,
14013
+ filteredRecordsCount: state.filteredRecords.length,
14014
+ rawRecordsCount: state.rawRecords.length,
14015
+ loadTableData: state.loadTableData,
14016
+ isLoadingTableData: state.isLoadingTableData
14017
+ }
14018
+ ),
14019
+ /* @__PURE__ */ jsx23(
14020
+ SettingsAndActionsBlock,
14021
+ {
14022
+ isScanningPhoneColumns: state.isScanningPhoneColumns,
14023
+ targetPhoneOptions: state.targetPhoneOptions,
14024
+ phoneColumnId: state.phoneColumnId,
14025
+ setPhoneColumnId: state.setPhoneColumnId,
14026
+ selectedPhoneOption: state.selectedPhoneOption,
14027
+ autoSelectCount: state.autoSelectCount,
14028
+ setAutoSelectCount: state.setAutoSelectCount,
14029
+ subtableFilterColumn: state.subtableFilterColumn,
14030
+ setSubtableFilterColumn: state.setSubtableFilterColumn,
14031
+ subtableFilterValue: state.subtableFilterValue,
14032
+ setSubtableFilterValue: state.setSubtableFilterValue,
14033
+ subtableSendLimit: state.subtableSendLimit,
14034
+ setSubtableSendLimit: state.setSubtableSendLimit,
14035
+ subtableFilterableColumns: state.subtableFilterableColumns,
14036
+ selectedSubtableFilterCol: state.selectedSubtableFilterCol,
14037
+ getRelationOptionsForCol: state.getRelationOptionsForCol,
14038
+ relationOptions: state.relationOptions,
14039
+ enablePostSendAction: state.enablePostSendAction,
14040
+ setEnablePostSendAction: state.setEnablePostSendAction,
14041
+ postSendActionColumn: state.postSendActionColumn,
14042
+ setPostSendActionColumn: state.setPostSendActionColumn,
14043
+ postSendActionValue: state.postSendActionValue,
14044
+ setPostSendActionValue: state.setPostSendActionValue,
14045
+ postSendActionTargetType: state.postSendActionTargetType,
14046
+ setPostSendActionTargetType: state.setPostSendActionTargetType,
14047
+ postSendActionTargetOptions: state.postSendActionTargetOptions,
14048
+ selectedPostSendOption: state.selectedPostSendCol,
14049
+ isTestDisabled: state.isTestDisabled,
14050
+ testButtonTitle: state.testButtonTitle,
14051
+ setIsTestPromptOpen: state.setIsTestPromptOpen,
14052
+ isSendDisabled: state.isSendDisabled,
14053
+ sendButtonTitle: state.sendButtonTitle,
14054
+ handleSendMessages: state.handleSendMessages,
14055
+ selectedRowIdsCount: state.selectedRowIds.length,
14056
+ finalRecipientCount: state.finalRecipientCount,
14057
+ validMainRowsCount: state.validMainRowsCount,
14058
+ isSendingBroadcast: state.isSendingBroadcast,
14059
+ broadcastProgress: state.broadcastProgress,
14060
+ broadcastSummary: state.broadcastSummary,
14061
+ clearBroadcastSummary: state.clearBroadcastSummary
14062
+ }
14063
+ )
14064
+ ] }),
14065
+ /* @__PURE__ */ jsx23("div", { className: "w-full h-[calc(100vh-420px)] min-h-[320px] overflow-hidden border border-slate-200 rounded-2xl shadow-xs bg-white flex flex-col", children: state.isLoadingTableData && state.rawRecords.length === 0 ? /* @__PURE__ */ jsxs22("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
14066
+ /* @__PURE__ */ jsx23(Loader28, { className: "w-6 h-6 animate-spin text-emerald-600" }),
14067
+ /* @__PURE__ */ jsx23("span", { children: "\u05D8\u05D5\u05E2\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4..." })
14068
+ ] }) : state.tableError ? /* @__PURE__ */ jsxs22("div", { className: "flex-1 flex items-center justify-center p-6 text-center text-xs text-rose-600 bg-rose-50 gap-2", children: [
14069
+ /* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
14070
+ /* @__PURE__ */ jsx23("span", { children: state.tableError })
14071
+ ] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */ jsx23("div", { className: "flex-1 flex items-center justify-center p-10 text-center text-xs text-slate-400", children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 \u05E2\u05D1\u05D5\u05E8 \u05E8\u05DB\u05D9\u05D1 WhatsApp \u05D6\u05D4" }) : /* @__PURE__ */ jsx23(
14072
+ TableBlockClient,
14073
+ {
14074
+ settings: {
14075
+ tableMetaId: settings.tableMetaId,
14076
+ tableId: settings.tableMetaId,
14077
+ title: "",
14078
+ columns: state.tableColumns
14079
+ },
14080
+ data: state.filteredRecords,
14081
+ readOnly: true,
14082
+ selectedRowIds: state.selectedRowIds,
14083
+ onSelectionChange: state.handleSelectionChange,
14084
+ onRowToggle: state.handleRowToggle,
14085
+ executeAction: state.embeddedTableExecuteAction,
14086
+ orgId,
14087
+ componentId: `${componentId || "whatsapp"}-embedded-table`,
14088
+ className: "h-full flex-1 border-0 rounded-2xl shadow-none",
14089
+ rowStatusMap: state.rowStatusMap
14090
+ }
14091
+ ) })
14092
+ ] }),
14093
+ /* @__PURE__ */ jsx23(
14094
+ CreateTemplateModal,
13757
14095
  {
13758
- settings: {
13759
- tableMetaId: settings.tableMetaId,
13760
- tableId: settings.tableMetaId,
13761
- title: "",
13762
- columns: state.tableColumns
14096
+ isOpen: state.isModalOpen,
14097
+ onClose: () => state.setIsModalOpen(false),
14098
+ onSuccess: () => {
14099
+ state.loadTemplates();
13763
14100
  },
13764
- data: state.filteredRecords,
13765
- readOnly: true,
13766
- selectedRowIds: state.selectedRowIds,
13767
- onSelectionChange: state.handleSelectionChange,
13768
- onRowToggle: state.handleRowToggle,
13769
- executeAction: state.embeddedTableExecuteAction,
13770
- orgId,
13771
- componentId: `${componentId || "whatsapp"}-embedded-table`,
13772
- className: "h-full flex-1 border-0 rounded-2xl shadow-none",
13773
- rowStatusMap: state.rowStatusMap
14101
+ existingTemplates: state.templates,
14102
+ existingTemplateNames: state.existingTemplateNames,
14103
+ executeAction,
14104
+ orgId: state.orgId || orgId
13774
14105
  }
13775
- ) })
13776
- ] }),
13777
- /* @__PURE__ */ jsx20(
13778
- CreateTemplateModal,
13779
- {
13780
- isOpen: state.isModalOpen,
13781
- onClose: () => state.setIsModalOpen(false),
13782
- onSuccess: () => {
13783
- state.loadTemplates();
13784
- },
13785
- existingTemplates: state.templates,
13786
- existingTemplateNames: state.existingTemplateNames,
13787
- executeAction,
13788
- orgId: state.orgId || orgId
13789
- }
13790
- ),
13791
- state.isTestPromptOpen && /* @__PURE__ */ jsx20(
13792
- "div",
13793
- {
13794
- className: "fixed inset-0 bg-slate-900/60 backdrop-blur-xs z-50 flex items-center justify-center p-4 overflow-y-auto animate-in fade-in duration-150",
13795
- dir: "rtl",
13796
- onClick: () => {
13797
- state.setIsTestPromptOpen(false);
13798
- state.setTestFeedback(null);
13799
- },
13800
- children: /* @__PURE__ */ jsxs19(
13801
- "div",
13802
- {
13803
- className: "bg-white rounded-2xl border border-slate-200 shadow-2xl w-full max-w-md flex flex-col overflow-hidden animate-in zoom-in-95 duration-150",
13804
- role: "dialog",
13805
- "aria-modal": "true",
13806
- "aria-labelledby": "test-modal-title",
13807
- onClick: (e) => e.stopPropagation(),
13808
- children: [
13809
- /* @__PURE__ */ jsxs19("div", { className: "px-5 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
13810
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2.5", children: [
13811
- /* @__PURE__ */ jsx20("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx20(Phone4, { className: "w-4 h-4" }) }),
13812
- /* @__PURE__ */ jsxs19("div", { children: [
13813
- /* @__PURE__ */ jsx20("h3", { id: "test-modal-title", className: "text-sm font-bold text-slate-900", children: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4 (\u05D8\u05E1\u05D8)" }),
13814
- /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-slate-500", children: "\u05D1\u05D3\u05D9\u05E7\u05EA \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA \u05DE\u05D5\u05DC \u05E0\u05DE\u05E2\u05DF \u05D1\u05D5\u05D3\u05D3 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05D3\u05D5\u05E8 \u05E8\u05D7\u05D1" })
13815
- ] })
13816
- ] }),
13817
- /* @__PURE__ */ jsx20(
13818
- "button",
13819
- {
13820
- type: "button",
13821
- disabled: state.isSendingTest,
13822
- onClick: () => {
13823
- if (state.isSendingTest) return;
13824
- state.setIsTestPromptOpen(false);
13825
- state.setTestFeedback(null);
13826
- },
13827
- className: `w-8 h-8 rounded-lg flex items-center justify-center transition-colors ${state.isSendingTest ? "text-slate-300 cursor-not-allowed" : "text-slate-400 hover:text-slate-700 hover:bg-slate-200/50 cursor-pointer"}`,
13828
- title: "\u05E1\u05D2\u05D5\u05E8",
13829
- children: /* @__PURE__ */ jsx20(X12, { className: "w-4 h-4" })
13830
- }
13831
- )
13832
- ] }),
13833
- /* @__PURE__ */ jsxs19("div", { className: "p-5 space-y-4", children: [
13834
- /* @__PURE__ */ jsxs19("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
13835
- /* @__PURE__ */ jsx20("span", { className: "text-slate-500 font-medium", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05E0\u05D1\u05D7\u05E8\u05EA:" }),
13836
- /* @__PURE__ */ jsx20("span", { className: "font-bold text-slate-800 font-mono", children: ((_a = state.selectedTemplate) == null ? void 0 : _a.name) || "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" })
13837
- ] }),
13838
- state.selectedPhoneOption && /* @__PURE__ */ jsxs19("div", { className: "p-2 bg-emerald-50/50 border border-emerald-200/60 rounded-xl flex items-center justify-between text-[11px]", children: [
13839
- /* @__PURE__ */ jsx20("span", { className: "text-emerald-800 font-medium", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3:" }),
13840
- /* @__PURE__ */ jsx20("span", { className: "font-bold text-emerald-950 font-mono", children: state.selectedPhoneOption.label })
14106
+ ),
14107
+ state.isTestPromptOpen && /* @__PURE__ */ jsx23(
14108
+ "div",
14109
+ {
14110
+ className: "fixed inset-0 bg-slate-900/60 backdrop-blur-xs z-50 flex items-center justify-center p-4 overflow-y-auto animate-in fade-in duration-150",
14111
+ dir: "rtl",
14112
+ onClick: () => {
14113
+ state.setIsTestPromptOpen(false);
14114
+ state.setTestFeedback(null);
14115
+ },
14116
+ children: /* @__PURE__ */ jsxs22(
14117
+ "div",
14118
+ {
14119
+ className: "bg-white rounded-2xl border border-slate-200 shadow-2xl w-full max-w-md flex flex-col overflow-hidden animate-in zoom-in-95 duration-150",
14120
+ role: "dialog",
14121
+ "aria-modal": "true",
14122
+ "aria-labelledby": "test-modal-title",
14123
+ onClick: (e) => e.stopPropagation(),
14124
+ children: [
14125
+ /* @__PURE__ */ jsxs22("div", { className: "px-5 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
14126
+ /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2.5", children: [
14127
+ /* @__PURE__ */ jsx23("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx23(Phone4, { className: "w-4 h-4" }) }),
14128
+ /* @__PURE__ */ jsxs22("div", { children: [
14129
+ /* @__PURE__ */ jsx23("h3", { id: "test-modal-title", className: "text-sm font-bold text-slate-900", children: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05EA \u05D1\u05D3\u05D9\u05E7\u05D4 (\u05D8\u05E1\u05D8)" }),
14130
+ /* @__PURE__ */ jsx23("p", { className: "text-[11px] text-slate-500", children: "\u05D1\u05D3\u05D9\u05E7\u05EA \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA \u05DE\u05D5\u05DC \u05E0\u05DE\u05E2\u05DF \u05D1\u05D5\u05D3\u05D3 \u05DC\u05E4\u05E0\u05D9 \u05E9\u05D9\u05D3\u05D5\u05E8 \u05E8\u05D7\u05D1" })
14131
+ ] })
14132
+ ] }),
14133
+ /* @__PURE__ */ jsx23(
14134
+ "button",
14135
+ {
14136
+ type: "button",
14137
+ disabled: state.isSendingTest,
14138
+ onClick: () => {
14139
+ if (state.isSendingTest) return;
14140
+ state.setIsTestPromptOpen(false);
14141
+ state.setTestFeedback(null);
14142
+ },
14143
+ className: `w-8 h-8 rounded-lg flex items-center justify-center transition-colors ${state.isSendingTest ? "text-slate-300 cursor-not-allowed" : "text-slate-400 hover:text-slate-700 hover:bg-slate-200/50 cursor-pointer"}`,
14144
+ title: "\u05E1\u05D2\u05D5\u05E8",
14145
+ children: /* @__PURE__ */ jsx23(X12, { className: "w-4 h-4" })
14146
+ }
14147
+ )
13841
14148
  ] }),
13842
- state.templateHeaderComp && (() => {
13843
- const headerFormat = (state.templateHeaderComp.format || "").toUpperCase();
13844
- const docFilename = resolveDocumentFilename(state.templateHeaderComp, state.headerMediaUrl);
13845
- return /* @__PURE__ */ jsxs19("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
13846
- /* @__PURE__ */ jsx20("div", { className: "flex items-center gap-2 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs19(Fragment8, { children: [
13847
- /* @__PURE__ */ jsx20("div", { className: "w-7 h-7 rounded-md overflow-hidden border border-slate-200 shrink-0 bg-slate-100 flex items-center justify-center", children: state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ jsx20(
13848
- "img",
13849
- {
13850
- src: state.headerMediaUrl,
13851
- alt: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA",
13852
- className: "w-full h-full object-cover",
13853
- onError: (e) => {
13854
- e.currentTarget.style.display = "none";
13855
- }
13856
- }
13857
- ) : /* @__PURE__ */ jsx20(ImageIcon3, { className: "w-3.5 h-3.5 text-emerald-600" }) }),
13858
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-slate-800 truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" })
13859
- ] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs19(Fragment8, { children: [
13860
- /* @__PURE__ */ jsx20("div", { className: "w-7 h-7 rounded-md bg-rose-50 text-rose-600 border border-rose-100 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx20(FileText4, { className: "w-3.5 h-3.5" }) }),
13861
- /* @__PURE__ */ jsxs19("div", { className: "overflow-hidden", children: [
13862
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
13863
- /* @__PURE__ */ jsx20("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: docFilename, children: docFilename })
13864
- ] })
13865
- ] }) : /* @__PURE__ */ jsxs19(Fragment8, { children: [
13866
- /* @__PURE__ */ jsx20("div", { className: "w-7 h-7 rounded-md bg-indigo-50 text-indigo-600 border border-indigo-100 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx20(Video3, { className: "w-3.5 h-3.5" }) }),
13867
- /* @__PURE__ */ jsx20("span", { className: "font-semibold text-slate-800 truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" })
13868
- ] }) }),
13869
- state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ jsx20("span", { className: "text-[10px] text-emerald-700 bg-emerald-50 border border-emerald-200 px-1.5 py-0.5 rounded font-medium shrink-0", children: "\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF" }) : /* @__PURE__ */ jsx20("span", { className: "text-[10px] text-amber-700 bg-amber-50 border border-amber-200 px-1.5 py-0.5 rounded font-medium shrink-0", children: "\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5" })
13870
- ] });
13871
- })(),
13872
- /* @__PURE__ */ jsxs19("div", { className: "space-y-1.5", children: [
13873
- /* @__PURE__ */ jsxs19("label", { className: "text-xs font-semibold text-slate-700 block", children: [
13874
- "\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05DC\u05D8\u05E1\u05D8 ",
13875
- /* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
14149
+ /* @__PURE__ */ jsxs22("div", { className: "p-5 space-y-4", children: [
14150
+ /* @__PURE__ */ jsxs22("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
14151
+ /* @__PURE__ */ jsx23("span", { className: "text-slate-500 font-medium", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05E0\u05D1\u05D7\u05E8\u05EA:" }),
14152
+ /* @__PURE__ */ jsx23("span", { className: "font-bold text-slate-800 font-mono", children: ((_a = state.selectedTemplate) == null ? void 0 : _a.name) || "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" })
13876
14153
  ] }),
13877
- /* @__PURE__ */ jsxs19("div", { className: "relative", children: [
13878
- /* @__PURE__ */ jsx20(
13879
- "input",
13880
- {
13881
- type: "tel",
13882
- dir: "ltr",
13883
- autoFocus: true,
13884
- disabled: state.isSendingTest,
13885
- value: state.testPhoneNumber,
13886
- onChange: (e) => {
13887
- state.handleTestPhoneChange(e.target.value);
13888
- if (state.testFeedback) state.setTestFeedback(null);
13889
- },
13890
- onKeyDown: (e) => {
13891
- if (e.key === "Enter" && state.testPhoneNumber.trim() && !state.isSendingTest) {
13892
- e.preventDefault();
13893
- state.handleSendTest();
14154
+ state.selectedPhoneOption && /* @__PURE__ */ jsxs22("div", { className: "p-2 bg-emerald-50/50 border border-emerald-200/60 rounded-xl flex items-center justify-between text-[11px]", children: [
14155
+ /* @__PURE__ */ jsx23("span", { className: "text-emerald-800 font-medium", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3:" }),
14156
+ /* @__PURE__ */ jsx23("span", { className: "font-bold text-emerald-950 font-mono", children: state.selectedPhoneOption.label })
14157
+ ] }),
14158
+ state.templateHeaderComp && (() => {
14159
+ const headerFormat = (state.templateHeaderComp.format || "").toUpperCase();
14160
+ const docFilename = resolveDocumentFilename(state.templateHeaderComp, state.headerMediaUrl);
14161
+ return /* @__PURE__ */ jsxs22("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
14162
+ /* @__PURE__ */ jsx23("div", { className: "flex items-center gap-2 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
14163
+ /* @__PURE__ */ jsx23("div", { className: "w-7 h-7 rounded-md overflow-hidden border border-slate-200 shrink-0 bg-slate-100 flex items-center justify-center", children: state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ jsx23(
14164
+ "img",
14165
+ {
14166
+ src: state.headerMediaUrl,
14167
+ alt: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA",
14168
+ className: "w-full h-full object-cover",
14169
+ onError: (e) => {
14170
+ e.currentTarget.style.display = "none";
14171
+ }
13894
14172
  }
13895
- },
13896
- placeholder: "\u05DC\u05D3\u05D5\u05D2\u05DE\u05D4: 0501234567",
13897
- className: "w-full h-10 px-3 pr-3 pl-8 text-sm rounded-xl border border-slate-200 bg-white text-slate-900 placeholder:text-slate-400 focus:outline-hidden focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500 transition-all font-mono disabled:opacity-60 disabled:cursor-not-allowed"
13898
- }
13899
- ),
13900
- /* @__PURE__ */ jsx20(Phone4, { className: "w-4 h-4 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
14173
+ ) : /* @__PURE__ */ jsx23(ImageIcon3, { className: "w-3.5 h-3.5 text-emerald-600" }) }),
14174
+ /* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" })
14175
+ ] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
14176
+ /* @__PURE__ */ jsx23("div", { className: "w-7 h-7 rounded-md bg-rose-50 text-rose-600 border border-rose-100 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx23(FileText4, { className: "w-3.5 h-3.5" }) }),
14177
+ /* @__PURE__ */ jsxs22("div", { className: "overflow-hidden", children: [
14178
+ /* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
14179
+ /* @__PURE__ */ jsx23("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: docFilename, children: docFilename })
14180
+ ] })
14181
+ ] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
14182
+ /* @__PURE__ */ jsx23("div", { className: "w-7 h-7 rounded-md bg-indigo-50 text-indigo-600 border border-indigo-100 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx23(Video3, { className: "w-3.5 h-3.5" }) }),
14183
+ /* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" })
14184
+ ] }) }),
14185
+ state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ jsx23("span", { className: "text-[10px] text-emerald-700 bg-emerald-50 border border-emerald-200 px-1.5 py-0.5 rounded font-medium shrink-0", children: "\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF" }) : /* @__PURE__ */ jsx23("span", { className: "text-[10px] text-amber-700 bg-amber-50 border border-amber-200 px-1.5 py-0.5 rounded font-medium shrink-0", children: "\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5" })
14186
+ ] });
14187
+ })(),
14188
+ /* @__PURE__ */ jsxs22("div", { className: "space-y-1.5", children: [
14189
+ /* @__PURE__ */ jsxs22("label", { className: "text-xs font-semibold text-slate-700 block", children: [
14190
+ "\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05DC\u05D8\u05E1\u05D8 ",
14191
+ /* @__PURE__ */ jsx23("span", { className: "text-rose-500", children: "*" })
14192
+ ] }),
14193
+ /* @__PURE__ */ jsxs22("div", { className: "relative", children: [
14194
+ /* @__PURE__ */ jsx23(
14195
+ "input",
14196
+ {
14197
+ type: "tel",
14198
+ dir: "ltr",
14199
+ autoFocus: true,
14200
+ disabled: state.isSendingTest,
14201
+ value: state.testPhoneNumber,
14202
+ onChange: (e) => {
14203
+ state.handleTestPhoneChange(e.target.value);
14204
+ if (state.testFeedback) state.setTestFeedback(null);
14205
+ },
14206
+ onKeyDown: (e) => {
14207
+ if (e.key === "Enter" && state.testPhoneNumber.trim() && !state.isSendingTest) {
14208
+ e.preventDefault();
14209
+ state.handleSendTest();
14210
+ }
14211
+ },
14212
+ placeholder: "\u05DC\u05D3\u05D5\u05D2\u05DE\u05D4: 0501234567",
14213
+ className: "w-full h-10 px-3 pr-3 pl-8 text-sm rounded-xl border border-slate-200 bg-white text-slate-900 placeholder:text-slate-400 focus:outline-hidden focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500 transition-all font-mono disabled:opacity-60 disabled:cursor-not-allowed"
14214
+ }
14215
+ ),
14216
+ /* @__PURE__ */ jsx23(Phone4, { className: "w-4 h-4 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
14217
+ ] }),
14218
+ /* @__PURE__ */ jsx23("p", { className: "text-[11px] text-slate-500 leading-normal", children: "\u05D4\u05D5\u05D3\u05E2\u05EA \u05D4\u05D1\u05D3\u05D9\u05E7\u05D4 \u05EA\u05D9\u05E9\u05DC\u05D7 \u05D9\u05E9\u05D9\u05E8\u05D5\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4 \u05DC\u05E6\u05D5\u05E8\u05DA \u05D5\u05D9\u05D3\u05D5\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA \u05EA\u05D5\u05DB\u05DF \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05D5\u05D4\u05E2\u05D9\u05E6\u05D5\u05D1." })
13901
14219
  ] }),
13902
- /* @__PURE__ */ jsx20("p", { className: "text-[11px] text-slate-500 leading-normal", children: "\u05D4\u05D5\u05D3\u05E2\u05EA \u05D4\u05D1\u05D3\u05D9\u05E7\u05D4 \u05EA\u05D9\u05E9\u05DC\u05D7 \u05D9\u05E9\u05D9\u05E8\u05D5\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D6\u05D4 \u05DC\u05E6\u05D5\u05E8\u05DA \u05D5\u05D9\u05D3\u05D5\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA \u05EA\u05D5\u05DB\u05DF \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05D5\u05D4\u05E2\u05D9\u05E6\u05D5\u05D1." })
14220
+ state.testFeedback && /* @__PURE__ */ jsxs22("div", { className: "p-2.5 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-700 flex items-center gap-2", children: [
14221
+ /* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
14222
+ /* @__PURE__ */ jsx23("span", { children: state.testFeedback })
14223
+ ] })
13903
14224
  ] }),
13904
- state.testFeedback && /* @__PURE__ */ jsxs19("div", { className: "p-2.5 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-700 flex items-center gap-2", children: [
13905
- /* @__PURE__ */ jsx20(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
13906
- /* @__PURE__ */ jsx20("span", { children: state.testFeedback })
14225
+ /* @__PURE__ */ jsxs22("div", { className: "px-5 py-3.5 bg-slate-50/70 border-t border-slate-100 flex items-center justify-end gap-2", children: [
14226
+ /* @__PURE__ */ jsx23(
14227
+ "button",
14228
+ {
14229
+ type: "button",
14230
+ disabled: state.isSendingTest,
14231
+ onClick: () => {
14232
+ if (state.isSendingTest) return;
14233
+ state.setIsTestPromptOpen(false);
14234
+ state.setTestFeedback(null);
14235
+ },
14236
+ className: `px-4 py-2 text-xs font-semibold text-slate-600 rounded-xl transition-colors ${state.isSendingTest ? "opacity-50 cursor-not-allowed" : "hover:text-slate-800 hover:bg-slate-200/50 cursor-pointer"}`,
14237
+ children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
14238
+ }
14239
+ ),
14240
+ /* @__PURE__ */ jsx23(
14241
+ "button",
14242
+ {
14243
+ type: "button",
14244
+ disabled: !state.testPhoneNumber.trim() || state.isSendingTest || state.isTestDisabled,
14245
+ onClick: state.handleSendTest,
14246
+ title: state.testButtonTitle,
14247
+ className: `px-4 py-2 text-xs font-bold rounded-xl transition-all flex items-center gap-1.5 ${!state.testPhoneNumber.trim() || state.isSendingTest || state.isTestDisabled ? "bg-emerald-600/40 text-white/70 cursor-not-allowed" : "bg-emerald-600 hover:bg-emerald-700 active:scale-[0.98] text-white shadow-xs cursor-pointer"}`,
14248
+ children: state.isSendingTest ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
14249
+ /* @__PURE__ */ jsx23(Loader28, { className: "w-3.5 h-3.5 animate-spin" }),
14250
+ /* @__PURE__ */ jsx23("span", { children: "\u05E9\u05D5\u05DC\u05D7..." })
14251
+ ] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
14252
+ /* @__PURE__ */ jsx23(Send3, { className: "w-3.5 h-3.5" }),
14253
+ /* @__PURE__ */ jsx23("span", { children: "\u05E9\u05DC\u05D7 \u05E2\u05DB\u05E9\u05D9\u05D5" })
14254
+ ] })
14255
+ }
14256
+ )
13907
14257
  ] })
13908
- ] }),
13909
- /* @__PURE__ */ jsxs19("div", { className: "px-5 py-3.5 bg-slate-50/70 border-t border-slate-100 flex items-center justify-end gap-2", children: [
13910
- /* @__PURE__ */ jsx20(
13911
- "button",
13912
- {
13913
- type: "button",
13914
- disabled: state.isSendingTest,
13915
- onClick: () => {
13916
- if (state.isSendingTest) return;
13917
- state.setIsTestPromptOpen(false);
13918
- state.setTestFeedback(null);
13919
- },
13920
- className: `px-4 py-2 text-xs font-semibold text-slate-600 rounded-xl transition-colors ${state.isSendingTest ? "opacity-50 cursor-not-allowed" : "hover:text-slate-800 hover:bg-slate-200/50 cursor-pointer"}`,
13921
- children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
13922
- }
13923
- ),
13924
- /* @__PURE__ */ jsx20(
13925
- "button",
13926
- {
13927
- type: "button",
13928
- disabled: !state.testPhoneNumber.trim() || state.isSendingTest || state.isTestDisabled,
13929
- onClick: state.handleSendTest,
13930
- title: state.testButtonTitle,
13931
- className: `px-4 py-2 text-xs font-bold rounded-xl transition-all flex items-center gap-1.5 ${!state.testPhoneNumber.trim() || state.isSendingTest || state.isTestDisabled ? "bg-emerald-600/40 text-white/70 cursor-not-allowed" : "bg-emerald-600 hover:bg-emerald-700 active:scale-[0.98] text-white shadow-xs cursor-pointer"}`,
13932
- children: state.isSendingTest ? /* @__PURE__ */ jsxs19(Fragment8, { children: [
13933
- /* @__PURE__ */ jsx20(Loader27, { className: "w-3.5 h-3.5 animate-spin" }),
13934
- /* @__PURE__ */ jsx20("span", { children: "\u05E9\u05D5\u05DC\u05D7..." })
13935
- ] }) : /* @__PURE__ */ jsxs19(Fragment8, { children: [
13936
- /* @__PURE__ */ jsx20(Send2, { className: "w-3.5 h-3.5" }),
13937
- /* @__PURE__ */ jsx20("span", { children: "\u05E9\u05DC\u05D7 \u05E2\u05DB\u05E9\u05D9\u05D5" })
13938
- ] })
13939
- }
13940
- )
13941
- ] })
13942
- ]
13943
- }
13944
- )
13945
- }
13946
- )
14258
+ ]
14259
+ }
14260
+ )
14261
+ }
14262
+ )
14263
+ ] })
13947
14264
  ]
13948
14265
  }
13949
14266
  );
13950
14267
  }
13951
14268
 
13952
14269
  // src/components/FormBlock/FormBlock.tsx
13953
- import { useState as useState17, useEffect as useEffect15 } from "react";
13954
- import { Loader2 as Loader28, CheckCircle2 as CheckCircle25 } from "lucide-react";
13955
- import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
14270
+ import { useState as useState19, useEffect as useEffect17 } from "react";
14271
+ import { Loader2 as Loader29, CheckCircle2 as CheckCircle25 } from "lucide-react";
14272
+ import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
13956
14273
  function FormBlock({ settings: schema, executeAction, componentId, className = "", onSuccess }) {
13957
14274
  const { showError, addToast } = useToast();
13958
- const [formData, setFormData] = useState17({});
13959
- const [isSubmitting, setIsSubmitting] = useState17(false);
13960
- const [isSubmitted, setIsSubmitted] = useState17(false);
13961
- const [columns, setColumns] = useState17((schema == null ? void 0 : schema.columns) || []);
13962
- const [isLoadingSchema, setIsLoadingSchema] = useState17(false);
14275
+ const [formData, setFormData] = useState19({});
14276
+ const [isSubmitting, setIsSubmitting] = useState19(false);
14277
+ const [isSubmitted, setIsSubmitted] = useState19(false);
14278
+ const [columns, setColumns] = useState19((schema == null ? void 0 : schema.columns) || []);
14279
+ const [isLoadingSchema, setIsLoadingSchema] = useState19(false);
13963
14280
  const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
13964
- useEffect15(() => {
14281
+ useEffect17(() => {
13965
14282
  let isMounted = true;
13966
14283
  if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction) {
13967
14284
  setIsLoadingSchema(true);
@@ -14043,21 +14360,21 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
14043
14360
  }
14044
14361
  };
14045
14362
  if (isLoadingSchema) {
14046
- return /* @__PURE__ */ jsxs20("div", { className: "p-8 flex items-center justify-center gap-2 text-slate-500", children: [
14047
- /* @__PURE__ */ jsx21(Loader28, { className: "w-5 h-5 animate-spin text-brand" }),
14048
- /* @__PURE__ */ jsx21("span", { className: "text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E9\u05D3\u05D5\u05EA \u05D8\u05D5\u05E4\u05E1..." })
14363
+ return /* @__PURE__ */ jsxs23("div", { className: "p-8 flex items-center justify-center gap-2 text-slate-500", children: [
14364
+ /* @__PURE__ */ jsx24(Loader29, { className: "w-5 h-5 animate-spin text-brand" }),
14365
+ /* @__PURE__ */ jsx24("span", { className: "text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E9\u05D3\u05D5\u05EA \u05D8\u05D5\u05E4\u05E1..." })
14049
14366
  ] });
14050
14367
  }
14051
14368
  if (!formColumns || formColumns.length === 0) {
14052
- return /* @__PURE__ */ jsx21("div", { className: "p-4 text-center text-slate-500", children: "\u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8\u05D5 \u05E9\u05D3\u05D5\u05EA \u05DC\u05D8\u05D5\u05E4\u05E1 \u05D6\u05D4." });
14369
+ return /* @__PURE__ */ jsx24("div", { className: "p-4 text-center text-slate-500", children: "\u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8\u05D5 \u05E9\u05D3\u05D5\u05EA \u05DC\u05D8\u05D5\u05E4\u05E1 \u05D6\u05D4." });
14053
14370
  }
14054
14371
  if (isSubmitted) {
14055
14372
  const customMessage = (schema == null ? void 0 : schema.successMessage) || "\u05EA\u05D5\u05D3\u05D4 \u05E8\u05D1\u05D4! \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05D4\u05EA\u05E7\u05D1\u05DC\u05D5 \u05D1\u05D4\u05E6\u05DC\u05D7\u05D4.";
14056
- return /* @__PURE__ */ jsxs20("div", { id: componentId, className: `bg-white p-8 rounded-xl shadow-xs border border-slate-200 text-center dir-rtl ${className}`, children: [
14057
- /* @__PURE__ */ jsx21("div", { className: "w-16 h-16 bg-emerald-50 text-emerald-600 rounded-full flex items-center justify-center mx-auto mb-4 animate-in zoom-in duration-200", children: /* @__PURE__ */ jsx21(CheckCircle25, { className: "w-8 h-8" }) }),
14058
- /* @__PURE__ */ jsx21("h3", { className: "text-2xl font-bold text-slate-800 mb-2", children: "\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4" }),
14059
- /* @__PURE__ */ jsx21("p", { className: "text-slate-600 text-base max-w-md mx-auto whitespace-pre-wrap", children: customMessage }),
14060
- /* @__PURE__ */ jsx21(
14373
+ return /* @__PURE__ */ jsxs23("div", { id: componentId, className: `bg-white p-8 rounded-xl shadow-xs border border-slate-200 text-center dir-rtl ${className}`, children: [
14374
+ /* @__PURE__ */ jsx24("div", { className: "w-16 h-16 bg-emerald-50 text-emerald-600 rounded-full flex items-center justify-center mx-auto mb-4 animate-in zoom-in duration-200", children: /* @__PURE__ */ jsx24(CheckCircle25, { className: "w-8 h-8" }) }),
14375
+ /* @__PURE__ */ jsx24("h3", { className: "text-2xl font-bold text-slate-800 mb-2", children: "\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4" }),
14376
+ /* @__PURE__ */ jsx24("p", { className: "text-slate-600 text-base max-w-md mx-auto whitespace-pre-wrap", children: customMessage }),
14377
+ /* @__PURE__ */ jsx24(
14061
14378
  "button",
14062
14379
  {
14063
14380
  type: "button",
@@ -14068,20 +14385,20 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
14068
14385
  )
14069
14386
  ] });
14070
14387
  }
14071
- return /* @__PURE__ */ jsxs20("div", { id: componentId, className: `bg-white p-6 rounded-xl shadow-xs border border-slate-200 dir-rtl ${className}`, children: [
14072
- (schema == null ? void 0 : schema.title) && /* @__PURE__ */ jsx21("h2", { className: "text-xl font-bold text-slate-800 mb-6", children: schema.title }),
14073
- /* @__PURE__ */ jsxs20("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
14388
+ return /* @__PURE__ */ jsxs23("div", { id: componentId, className: `bg-white p-6 rounded-xl shadow-xs border border-slate-200 dir-rtl ${className}`, children: [
14389
+ (schema == null ? void 0 : schema.title) && /* @__PURE__ */ jsx24("h2", { className: "text-xl font-bold text-slate-800 mb-6", children: schema.title }),
14390
+ /* @__PURE__ */ jsxs23("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
14074
14391
  formColumns.map((col) => {
14075
14392
  var _a, _b;
14076
14393
  const colType = ((_a = col.type) == null ? void 0 : _a.toUpperCase()) || "DEFAULT";
14077
14394
  const InputComponent = FORM_INPUTS[colType] || FORM_INPUTS.DEFAULT;
14078
- return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col gap-1.5", children: [
14079
- /* @__PURE__ */ jsxs20("label", { className: "text-sm font-semibold text-slate-700", children: [
14395
+ return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1.5", children: [
14396
+ /* @__PURE__ */ jsxs23("label", { className: "text-sm font-semibold text-slate-700", children: [
14080
14397
  col.name,
14081
14398
  " ",
14082
- col.isRequired && /* @__PURE__ */ jsx21("span", { className: "text-rose-500", children: "*" })
14399
+ col.isRequired && /* @__PURE__ */ jsx24("span", { className: "text-rose-500", children: "*" })
14083
14400
  ] }),
14084
- /* @__PURE__ */ jsx21("div", { className: "border border-slate-200 rounded-lg min-h-[40px] relative", children: /* @__PURE__ */ jsx21(
14401
+ /* @__PURE__ */ jsx24("div", { className: "border border-slate-200 rounded-lg min-h-[40px] relative", children: /* @__PURE__ */ jsx24(
14085
14402
  InputComponent,
14086
14403
  {
14087
14404
  column: col,
@@ -14096,15 +14413,15 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
14096
14413
  ) })
14097
14414
  ] }, col.name);
14098
14415
  }),
14099
- /* @__PURE__ */ jsx21("div", { className: "pt-4 border-t border-slate-100 flex justify-end", children: /* @__PURE__ */ jsxs20(
14416
+ /* @__PURE__ */ jsx24("div", { className: "pt-4 border-t border-slate-100 flex justify-end", children: /* @__PURE__ */ jsxs23(
14100
14417
  "button",
14101
14418
  {
14102
14419
  type: "submit",
14103
14420
  disabled: isSubmitting,
14104
14421
  className: "flex items-center gap-2 px-6 py.2.5 bg-brand hover:bg-brand-hover text-white font-bold rounded-lg shadow-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
14105
14422
  children: [
14106
- isSubmitting && /* @__PURE__ */ jsx21(Loader28, { className: "w-4 h-4 animate-spin" }),
14107
- /* @__PURE__ */ jsx21("span", { children: isSubmitting ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05DC\u05D9\u05D7\u05D4" })
14423
+ isSubmitting && /* @__PURE__ */ jsx24(Loader29, { className: "w-4 h-4 animate-spin" }),
14424
+ /* @__PURE__ */ jsx24("span", { children: isSubmitting ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05DC\u05D9\u05D7\u05D4" })
14108
14425
  ]
14109
14426
  }
14110
14427
  ) })