@universe-platform/ui 0.1.0-beta.26 → 0.1.0-beta.27
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/globals.css +71 -0
- package/dist/index.js +652 -340
- package/dist/index.mjs +652 -340
- package/package.json +1 -1
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
|
|
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,678 @@ 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) => {
|
|
13628
|
+
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
|
+
setIsLoading(false);
|
|
13639
|
+
}, []);
|
|
13640
|
+
useEffect15(() => {
|
|
13641
|
+
fetchConversations();
|
|
13642
|
+
const interval = setInterval(() => {
|
|
13643
|
+
fetchConversations();
|
|
13644
|
+
if (activeConversationId) {
|
|
13645
|
+
fetchMessages(activeConversationId);
|
|
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) => [...prev, tempMsg]);
|
|
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 messagesEndRef = useRef16(null);
|
|
13745
|
+
const scrollToBottom = () => {
|
|
13746
|
+
var _a;
|
|
13747
|
+
(_a = messagesEndRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
13748
|
+
};
|
|
13749
|
+
useEffect16(() => {
|
|
13750
|
+
scrollToBottom();
|
|
13751
|
+
}, [messages]);
|
|
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
|
+
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) => {
|
|
13774
|
+
const isOutbound = msg.direction === "OUTBOUND";
|
|
13775
|
+
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: [
|
|
13776
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm whitespace-pre-wrap", children: msg.content }),
|
|
13777
|
+
/* @__PURE__ */ jsxs20("div", { className: "text-[10px] text-slate-400 mt-1 text-left flex items-center justify-end gap-1", children: [
|
|
13778
|
+
new Date(msg.createdAt).toLocaleTimeString("he-IL", { hour: "2-digit", minute: "2-digit" }),
|
|
13779
|
+
isOutbound && /* @__PURE__ */ jsx21("span", { className: msg.status === "READ" || msg.status === "DELIVERED" ? "text-blue-500" : "text-slate-400", children: msg.status === "READ" ? "\u2713\u2713" : msg.status === "DELIVERED" ? "\u2713\u2713" : "\u2713" })
|
|
13780
|
+
] })
|
|
13781
|
+
] }) }, msg.id || idx);
|
|
13782
|
+
}),
|
|
13783
|
+
/* @__PURE__ */ jsx21("div", { ref: messagesEndRef })
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
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:
|
|
13651
|
-
className:
|
|
13652
|
-
children: "\
|
|
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__ */
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
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
|
-
|
|
13687
|
-
|
|
13688
|
-
{
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
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
|
-
|
|
13704
|
-
|
|
13917
|
+
},
|
|
13918
|
+
sendInboxMessageAction: async (convId, text, currentOrgId) => {
|
|
13919
|
+
const res = await fetch(`/api/whatsapp/inbox/send`, {
|
|
13920
|
+
method: "POST",
|
|
13921
|
+
headers: { "Content-Type": "application/json" },
|
|
13922
|
+
body: JSON.stringify({ conversationId: convId, text, orgId: currentOrgId })
|
|
13923
|
+
});
|
|
13924
|
+
return res.json();
|
|
13925
|
+
}
|
|
13926
|
+
}
|
|
13927
|
+
) }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
13928
|
+
state.feedback && /* @__PURE__ */ jsxs22(
|
|
13929
|
+
"div",
|
|
13930
|
+
{
|
|
13931
|
+
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"}`,
|
|
13932
|
+
children: [
|
|
13933
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
|
|
13934
|
+
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" }),
|
|
13935
|
+
/* @__PURE__ */ jsx23("span", { children: state.feedback.message })
|
|
13936
|
+
] }),
|
|
13937
|
+
/* @__PURE__ */ jsx23(
|
|
13938
|
+
"button",
|
|
13939
|
+
{
|
|
13940
|
+
type: "button",
|
|
13941
|
+
onClick: () => state.setFeedback(null),
|
|
13942
|
+
className: "text-slate-400 hover:text-slate-700 cursor-pointer",
|
|
13943
|
+
children: /* @__PURE__ */ jsx23(X12, { className: "w-4 h-4" })
|
|
13944
|
+
}
|
|
13945
|
+
)
|
|
13946
|
+
]
|
|
13947
|
+
}
|
|
13948
|
+
),
|
|
13949
|
+
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: [
|
|
13950
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2", children: [
|
|
13951
|
+
/* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
13952
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
13953
|
+
"\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05DE-Meta: ",
|
|
13954
|
+
state.fetchError
|
|
13955
|
+
] })
|
|
13956
|
+
] }),
|
|
13957
|
+
/* @__PURE__ */ jsx23(
|
|
13958
|
+
"button",
|
|
13705
13959
|
{
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
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
|
|
13960
|
+
type: "button",
|
|
13961
|
+
onClick: state.loadTemplates,
|
|
13962
|
+
className: "font-bold underline cursor-pointer",
|
|
13963
|
+
children: "\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1"
|
|
13746
13964
|
}
|
|
13747
13965
|
)
|
|
13748
13966
|
] }),
|
|
13749
|
-
/* @__PURE__ */
|
|
13750
|
-
/* @__PURE__ */
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13967
|
+
/* @__PURE__ */ jsxs22("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
13968
|
+
/* @__PURE__ */ jsxs22("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
|
|
13969
|
+
/* @__PURE__ */ jsx23(
|
|
13970
|
+
TemplateSelectionBlock,
|
|
13971
|
+
{
|
|
13972
|
+
selectedTemplate: state.selectedTemplate,
|
|
13973
|
+
selectedTemplateId: state.selectedTemplateId,
|
|
13974
|
+
setSelectedTemplateId: state.setSelectedTemplateId,
|
|
13975
|
+
templates: state.templates,
|
|
13976
|
+
isLoadingTemplates: state.isLoadingTemplates,
|
|
13977
|
+
isDropdownOpen: state.isDropdownOpen,
|
|
13978
|
+
setIsDropdownOpen: state.setIsDropdownOpen,
|
|
13979
|
+
templateBodyText: state.templateBodyText,
|
|
13980
|
+
templateHeaderComp: state.templateHeaderComp,
|
|
13981
|
+
headerMediaUrl: state.headerMediaUrl,
|
|
13982
|
+
handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
|
|
13983
|
+
handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
|
|
13984
|
+
templateVariables: state.templateVariables,
|
|
13985
|
+
variableMapping: state.variableMapping,
|
|
13986
|
+
handleVariableTypeChange: state.handleVariableTypeChange,
|
|
13987
|
+
handleVariableValueChange: state.handleVariableValueChange,
|
|
13988
|
+
textableColumnOptions: state.textableColumnOptions,
|
|
13989
|
+
handleDeleteTemplate: state.handleDeleteTemplate,
|
|
13990
|
+
isDeleting: state.isDeleting,
|
|
13991
|
+
setIsModalOpen: state.setIsModalOpen,
|
|
13992
|
+
setFeedback: state.setFeedback,
|
|
13993
|
+
isUploadingMedia: state.isUploadingMedia,
|
|
13994
|
+
handleFileUpload: state.handleFileUpload
|
|
13995
|
+
}
|
|
13996
|
+
),
|
|
13997
|
+
/* @__PURE__ */ jsx23(
|
|
13998
|
+
DynamicFiltersBlock,
|
|
13999
|
+
{
|
|
14000
|
+
filterableColumns: state.filterableColumns,
|
|
14001
|
+
filters: state.filters,
|
|
14002
|
+
handleFilterChange: state.handleFilterChange,
|
|
14003
|
+
handleClearFilters: state.handleClearFilters,
|
|
14004
|
+
activeFiltersCount: state.activeFiltersCount,
|
|
14005
|
+
relationOptions: state.relationOptions,
|
|
14006
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14007
|
+
selectedRowIds: state.selectedRowIds,
|
|
14008
|
+
filteredRecordsCount: state.filteredRecords.length,
|
|
14009
|
+
rawRecordsCount: state.rawRecords.length,
|
|
14010
|
+
loadTableData: state.loadTableData,
|
|
14011
|
+
isLoadingTableData: state.isLoadingTableData
|
|
14012
|
+
}
|
|
14013
|
+
),
|
|
14014
|
+
/* @__PURE__ */ jsx23(
|
|
14015
|
+
SettingsAndActionsBlock,
|
|
14016
|
+
{
|
|
14017
|
+
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
14018
|
+
targetPhoneOptions: state.targetPhoneOptions,
|
|
14019
|
+
phoneColumnId: state.phoneColumnId,
|
|
14020
|
+
setPhoneColumnId: state.setPhoneColumnId,
|
|
14021
|
+
selectedPhoneOption: state.selectedPhoneOption,
|
|
14022
|
+
autoSelectCount: state.autoSelectCount,
|
|
14023
|
+
setAutoSelectCount: state.setAutoSelectCount,
|
|
14024
|
+
subtableFilterColumn: state.subtableFilterColumn,
|
|
14025
|
+
setSubtableFilterColumn: state.setSubtableFilterColumn,
|
|
14026
|
+
subtableFilterValue: state.subtableFilterValue,
|
|
14027
|
+
setSubtableFilterValue: state.setSubtableFilterValue,
|
|
14028
|
+
subtableSendLimit: state.subtableSendLimit,
|
|
14029
|
+
setSubtableSendLimit: state.setSubtableSendLimit,
|
|
14030
|
+
subtableFilterableColumns: state.subtableFilterableColumns,
|
|
14031
|
+
selectedSubtableFilterCol: state.selectedSubtableFilterCol,
|
|
14032
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14033
|
+
relationOptions: state.relationOptions,
|
|
14034
|
+
enablePostSendAction: state.enablePostSendAction,
|
|
14035
|
+
setEnablePostSendAction: state.setEnablePostSendAction,
|
|
14036
|
+
postSendActionColumn: state.postSendActionColumn,
|
|
14037
|
+
setPostSendActionColumn: state.setPostSendActionColumn,
|
|
14038
|
+
postSendActionValue: state.postSendActionValue,
|
|
14039
|
+
setPostSendActionValue: state.setPostSendActionValue,
|
|
14040
|
+
postSendActionTargetType: state.postSendActionTargetType,
|
|
14041
|
+
setPostSendActionTargetType: state.setPostSendActionTargetType,
|
|
14042
|
+
postSendActionTargetOptions: state.postSendActionTargetOptions,
|
|
14043
|
+
selectedPostSendOption: state.selectedPostSendCol,
|
|
14044
|
+
isTestDisabled: state.isTestDisabled,
|
|
14045
|
+
testButtonTitle: state.testButtonTitle,
|
|
14046
|
+
setIsTestPromptOpen: state.setIsTestPromptOpen,
|
|
14047
|
+
isSendDisabled: state.isSendDisabled,
|
|
14048
|
+
sendButtonTitle: state.sendButtonTitle,
|
|
14049
|
+
handleSendMessages: state.handleSendMessages,
|
|
14050
|
+
selectedRowIdsCount: state.selectedRowIds.length,
|
|
14051
|
+
finalRecipientCount: state.finalRecipientCount,
|
|
14052
|
+
validMainRowsCount: state.validMainRowsCount,
|
|
14053
|
+
isSendingBroadcast: state.isSendingBroadcast,
|
|
14054
|
+
broadcastProgress: state.broadcastProgress,
|
|
14055
|
+
broadcastSummary: state.broadcastSummary,
|
|
14056
|
+
clearBroadcastSummary: state.clearBroadcastSummary
|
|
14057
|
+
}
|
|
14058
|
+
)
|
|
14059
|
+
] }),
|
|
14060
|
+
/* @__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: [
|
|
14061
|
+
/* @__PURE__ */ jsx23(Loader28, { className: "w-6 h-6 animate-spin text-emerald-600" }),
|
|
14062
|
+
/* @__PURE__ */ jsx23("span", { children: "\u05D8\u05D5\u05E2\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4..." })
|
|
14063
|
+
] }) : 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: [
|
|
14064
|
+
/* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
14065
|
+
/* @__PURE__ */ jsx23("span", { children: state.tableError })
|
|
14066
|
+
] }) : !(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(
|
|
14067
|
+
TableBlockClient,
|
|
14068
|
+
{
|
|
14069
|
+
settings: {
|
|
14070
|
+
tableMetaId: settings.tableMetaId,
|
|
14071
|
+
tableId: settings.tableMetaId,
|
|
14072
|
+
title: "",
|
|
14073
|
+
columns: state.tableColumns
|
|
14074
|
+
},
|
|
14075
|
+
data: state.filteredRecords,
|
|
14076
|
+
readOnly: true,
|
|
14077
|
+
selectedRowIds: state.selectedRowIds,
|
|
14078
|
+
onSelectionChange: state.handleSelectionChange,
|
|
14079
|
+
onRowToggle: state.handleRowToggle,
|
|
14080
|
+
executeAction: state.embeddedTableExecuteAction,
|
|
14081
|
+
orgId,
|
|
14082
|
+
componentId: `${componentId || "whatsapp"}-embedded-table`,
|
|
14083
|
+
className: "h-full flex-1 border-0 rounded-2xl shadow-none",
|
|
14084
|
+
rowStatusMap: state.rowStatusMap
|
|
14085
|
+
}
|
|
14086
|
+
) })
|
|
14087
|
+
] }),
|
|
14088
|
+
/* @__PURE__ */ jsx23(
|
|
14089
|
+
CreateTemplateModal,
|
|
13757
14090
|
{
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
columns: state.tableColumns
|
|
14091
|
+
isOpen: state.isModalOpen,
|
|
14092
|
+
onClose: () => state.setIsModalOpen(false),
|
|
14093
|
+
onSuccess: () => {
|
|
14094
|
+
state.loadTemplates();
|
|
13763
14095
|
},
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
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
|
|
14096
|
+
existingTemplates: state.templates,
|
|
14097
|
+
existingTemplateNames: state.existingTemplateNames,
|
|
14098
|
+
executeAction,
|
|
14099
|
+
orgId: state.orgId || orgId
|
|
13774
14100
|
}
|
|
13775
|
-
)
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
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 })
|
|
14101
|
+
),
|
|
14102
|
+
state.isTestPromptOpen && /* @__PURE__ */ jsx23(
|
|
14103
|
+
"div",
|
|
14104
|
+
{
|
|
14105
|
+
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",
|
|
14106
|
+
dir: "rtl",
|
|
14107
|
+
onClick: () => {
|
|
14108
|
+
state.setIsTestPromptOpen(false);
|
|
14109
|
+
state.setTestFeedback(null);
|
|
14110
|
+
},
|
|
14111
|
+
children: /* @__PURE__ */ jsxs22(
|
|
14112
|
+
"div",
|
|
14113
|
+
{
|
|
14114
|
+
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",
|
|
14115
|
+
role: "dialog",
|
|
14116
|
+
"aria-modal": "true",
|
|
14117
|
+
"aria-labelledby": "test-modal-title",
|
|
14118
|
+
onClick: (e) => e.stopPropagation(),
|
|
14119
|
+
children: [
|
|
14120
|
+
/* @__PURE__ */ jsxs22("div", { className: "px-5 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
14121
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-2.5", children: [
|
|
14122
|
+
/* @__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" }) }),
|
|
14123
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
14124
|
+
/* @__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)" }),
|
|
14125
|
+
/* @__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" })
|
|
14126
|
+
] })
|
|
14127
|
+
] }),
|
|
14128
|
+
/* @__PURE__ */ jsx23(
|
|
14129
|
+
"button",
|
|
14130
|
+
{
|
|
14131
|
+
type: "button",
|
|
14132
|
+
disabled: state.isSendingTest,
|
|
14133
|
+
onClick: () => {
|
|
14134
|
+
if (state.isSendingTest) return;
|
|
14135
|
+
state.setIsTestPromptOpen(false);
|
|
14136
|
+
state.setTestFeedback(null);
|
|
14137
|
+
},
|
|
14138
|
+
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"}`,
|
|
14139
|
+
title: "\u05E1\u05D2\u05D5\u05E8",
|
|
14140
|
+
children: /* @__PURE__ */ jsx23(X12, { className: "w-4 h-4" })
|
|
14141
|
+
}
|
|
14142
|
+
)
|
|
13841
14143
|
] }),
|
|
13842
|
-
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
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: "*" })
|
|
14144
|
+
/* @__PURE__ */ jsxs22("div", { className: "p-5 space-y-4", children: [
|
|
14145
|
+
/* @__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: [
|
|
14146
|
+
/* @__PURE__ */ jsx23("span", { className: "text-slate-500 font-medium", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05E0\u05D1\u05D7\u05E8\u05EA:" }),
|
|
14147
|
+
/* @__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
14148
|
] }),
|
|
13877
|
-
/* @__PURE__ */
|
|
13878
|
-
/* @__PURE__ */
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
e
|
|
13893
|
-
|
|
14149
|
+
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: [
|
|
14150
|
+
/* @__PURE__ */ jsx23("span", { className: "text-emerald-800 font-medium", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3:" }),
|
|
14151
|
+
/* @__PURE__ */ jsx23("span", { className: "font-bold text-emerald-950 font-mono", children: state.selectedPhoneOption.label })
|
|
14152
|
+
] }),
|
|
14153
|
+
state.templateHeaderComp && (() => {
|
|
14154
|
+
const headerFormat = (state.templateHeaderComp.format || "").toUpperCase();
|
|
14155
|
+
const docFilename = resolveDocumentFilename(state.templateHeaderComp, state.headerMediaUrl);
|
|
14156
|
+
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: [
|
|
14157
|
+
/* @__PURE__ */ jsx23("div", { className: "flex items-center gap-2 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
14158
|
+
/* @__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(
|
|
14159
|
+
"img",
|
|
14160
|
+
{
|
|
14161
|
+
src: state.headerMediaUrl,
|
|
14162
|
+
alt: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA",
|
|
14163
|
+
className: "w-full h-full object-cover",
|
|
14164
|
+
onError: (e) => {
|
|
14165
|
+
e.currentTarget.style.display = "none";
|
|
14166
|
+
}
|
|
13894
14167
|
}
|
|
13895
|
-
},
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
14168
|
+
) : /* @__PURE__ */ jsx23(ImageIcon3, { className: "w-3.5 h-3.5 text-emerald-600" }) }),
|
|
14169
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
14170
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
14171
|
+
/* @__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" }) }),
|
|
14172
|
+
/* @__PURE__ */ jsxs22("div", { className: "overflow-hidden", children: [
|
|
14173
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
14174
|
+
/* @__PURE__ */ jsx23("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: docFilename, children: docFilename })
|
|
14175
|
+
] })
|
|
14176
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
14177
|
+
/* @__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" }) }),
|
|
14178
|
+
/* @__PURE__ */ jsx23("span", { className: "font-semibold text-slate-800 truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
14179
|
+
] }) }),
|
|
14180
|
+
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" })
|
|
14181
|
+
] });
|
|
14182
|
+
})(),
|
|
14183
|
+
/* @__PURE__ */ jsxs22("div", { className: "space-y-1.5", children: [
|
|
14184
|
+
/* @__PURE__ */ jsxs22("label", { className: "text-xs font-semibold text-slate-700 block", children: [
|
|
14185
|
+
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05DC\u05D8\u05E1\u05D8 ",
|
|
14186
|
+
/* @__PURE__ */ jsx23("span", { className: "text-rose-500", children: "*" })
|
|
14187
|
+
] }),
|
|
14188
|
+
/* @__PURE__ */ jsxs22("div", { className: "relative", children: [
|
|
14189
|
+
/* @__PURE__ */ jsx23(
|
|
14190
|
+
"input",
|
|
14191
|
+
{
|
|
14192
|
+
type: "tel",
|
|
14193
|
+
dir: "ltr",
|
|
14194
|
+
autoFocus: true,
|
|
14195
|
+
disabled: state.isSendingTest,
|
|
14196
|
+
value: state.testPhoneNumber,
|
|
14197
|
+
onChange: (e) => {
|
|
14198
|
+
state.handleTestPhoneChange(e.target.value);
|
|
14199
|
+
if (state.testFeedback) state.setTestFeedback(null);
|
|
14200
|
+
},
|
|
14201
|
+
onKeyDown: (e) => {
|
|
14202
|
+
if (e.key === "Enter" && state.testPhoneNumber.trim() && !state.isSendingTest) {
|
|
14203
|
+
e.preventDefault();
|
|
14204
|
+
state.handleSendTest();
|
|
14205
|
+
}
|
|
14206
|
+
},
|
|
14207
|
+
placeholder: "\u05DC\u05D3\u05D5\u05D2\u05DE\u05D4: 0501234567",
|
|
14208
|
+
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"
|
|
14209
|
+
}
|
|
14210
|
+
),
|
|
14211
|
+
/* @__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" })
|
|
14212
|
+
] }),
|
|
14213
|
+
/* @__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
14214
|
] }),
|
|
13902
|
-
/* @__PURE__ */
|
|
14215
|
+
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: [
|
|
14216
|
+
/* @__PURE__ */ jsx23(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
14217
|
+
/* @__PURE__ */ jsx23("span", { children: state.testFeedback })
|
|
14218
|
+
] })
|
|
13903
14219
|
] }),
|
|
13904
|
-
|
|
13905
|
-
/* @__PURE__ */
|
|
13906
|
-
|
|
14220
|
+
/* @__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: [
|
|
14221
|
+
/* @__PURE__ */ jsx23(
|
|
14222
|
+
"button",
|
|
14223
|
+
{
|
|
14224
|
+
type: "button",
|
|
14225
|
+
disabled: state.isSendingTest,
|
|
14226
|
+
onClick: () => {
|
|
14227
|
+
if (state.isSendingTest) return;
|
|
14228
|
+
state.setIsTestPromptOpen(false);
|
|
14229
|
+
state.setTestFeedback(null);
|
|
14230
|
+
},
|
|
14231
|
+
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"}`,
|
|
14232
|
+
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
14233
|
+
}
|
|
14234
|
+
),
|
|
14235
|
+
/* @__PURE__ */ jsx23(
|
|
14236
|
+
"button",
|
|
14237
|
+
{
|
|
14238
|
+
type: "button",
|
|
14239
|
+
disabled: !state.testPhoneNumber.trim() || state.isSendingTest || state.isTestDisabled,
|
|
14240
|
+
onClick: state.handleSendTest,
|
|
14241
|
+
title: state.testButtonTitle,
|
|
14242
|
+
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"}`,
|
|
14243
|
+
children: state.isSendingTest ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
14244
|
+
/* @__PURE__ */ jsx23(Loader28, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
14245
|
+
/* @__PURE__ */ jsx23("span", { children: "\u05E9\u05D5\u05DC\u05D7..." })
|
|
14246
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
14247
|
+
/* @__PURE__ */ jsx23(Send3, { className: "w-3.5 h-3.5" }),
|
|
14248
|
+
/* @__PURE__ */ jsx23("span", { children: "\u05E9\u05DC\u05D7 \u05E2\u05DB\u05E9\u05D9\u05D5" })
|
|
14249
|
+
] })
|
|
14250
|
+
}
|
|
14251
|
+
)
|
|
13907
14252
|
] })
|
|
13908
|
-
]
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
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
|
-
)
|
|
14253
|
+
]
|
|
14254
|
+
}
|
|
14255
|
+
)
|
|
14256
|
+
}
|
|
14257
|
+
)
|
|
14258
|
+
] })
|
|
13947
14259
|
]
|
|
13948
14260
|
}
|
|
13949
14261
|
);
|
|
13950
14262
|
}
|
|
13951
14263
|
|
|
13952
14264
|
// src/components/FormBlock/FormBlock.tsx
|
|
13953
|
-
import { useState as
|
|
13954
|
-
import { Loader2 as
|
|
13955
|
-
import { jsx as
|
|
14265
|
+
import { useState as useState19, useEffect as useEffect17 } from "react";
|
|
14266
|
+
import { Loader2 as Loader29, CheckCircle2 as CheckCircle25 } from "lucide-react";
|
|
14267
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
13956
14268
|
function FormBlock({ settings: schema, executeAction, componentId, className = "", onSuccess }) {
|
|
13957
14269
|
const { showError, addToast } = useToast();
|
|
13958
|
-
const [formData, setFormData] =
|
|
13959
|
-
const [isSubmitting, setIsSubmitting] =
|
|
13960
|
-
const [isSubmitted, setIsSubmitted] =
|
|
13961
|
-
const [columns, setColumns] =
|
|
13962
|
-
const [isLoadingSchema, setIsLoadingSchema] =
|
|
14270
|
+
const [formData, setFormData] = useState19({});
|
|
14271
|
+
const [isSubmitting, setIsSubmitting] = useState19(false);
|
|
14272
|
+
const [isSubmitted, setIsSubmitted] = useState19(false);
|
|
14273
|
+
const [columns, setColumns] = useState19((schema == null ? void 0 : schema.columns) || []);
|
|
14274
|
+
const [isLoadingSchema, setIsLoadingSchema] = useState19(false);
|
|
13963
14275
|
const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
13964
|
-
|
|
14276
|
+
useEffect17(() => {
|
|
13965
14277
|
let isMounted = true;
|
|
13966
14278
|
if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction) {
|
|
13967
14279
|
setIsLoadingSchema(true);
|
|
@@ -14043,21 +14355,21 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
|
|
|
14043
14355
|
}
|
|
14044
14356
|
};
|
|
14045
14357
|
if (isLoadingSchema) {
|
|
14046
|
-
return /* @__PURE__ */
|
|
14047
|
-
/* @__PURE__ */
|
|
14048
|
-
/* @__PURE__ */
|
|
14358
|
+
return /* @__PURE__ */ jsxs23("div", { className: "p-8 flex items-center justify-center gap-2 text-slate-500", children: [
|
|
14359
|
+
/* @__PURE__ */ jsx24(Loader29, { className: "w-5 h-5 animate-spin text-brand" }),
|
|
14360
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E9\u05D3\u05D5\u05EA \u05D8\u05D5\u05E4\u05E1..." })
|
|
14049
14361
|
] });
|
|
14050
14362
|
}
|
|
14051
14363
|
if (!formColumns || formColumns.length === 0) {
|
|
14052
|
-
return /* @__PURE__ */
|
|
14364
|
+
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
14365
|
}
|
|
14054
14366
|
if (isSubmitted) {
|
|
14055
14367
|
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__ */
|
|
14057
|
-
/* @__PURE__ */
|
|
14058
|
-
/* @__PURE__ */
|
|
14059
|
-
/* @__PURE__ */
|
|
14060
|
-
/* @__PURE__ */
|
|
14368
|
+
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: [
|
|
14369
|
+
/* @__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" }) }),
|
|
14370
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-2xl font-bold text-slate-800 mb-2", children: "\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4" }),
|
|
14371
|
+
/* @__PURE__ */ jsx24("p", { className: "text-slate-600 text-base max-w-md mx-auto whitespace-pre-wrap", children: customMessage }),
|
|
14372
|
+
/* @__PURE__ */ jsx24(
|
|
14061
14373
|
"button",
|
|
14062
14374
|
{
|
|
14063
14375
|
type: "button",
|
|
@@ -14068,20 +14380,20 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
|
|
|
14068
14380
|
)
|
|
14069
14381
|
] });
|
|
14070
14382
|
}
|
|
14071
|
-
return /* @__PURE__ */
|
|
14072
|
-
(schema == null ? void 0 : schema.title) && /* @__PURE__ */
|
|
14073
|
-
/* @__PURE__ */
|
|
14383
|
+
return /* @__PURE__ */ jsxs23("div", { id: componentId, className: `bg-white p-6 rounded-xl shadow-xs border border-slate-200 dir-rtl ${className}`, children: [
|
|
14384
|
+
(schema == null ? void 0 : schema.title) && /* @__PURE__ */ jsx24("h2", { className: "text-xl font-bold text-slate-800 mb-6", children: schema.title }),
|
|
14385
|
+
/* @__PURE__ */ jsxs23("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
14074
14386
|
formColumns.map((col) => {
|
|
14075
14387
|
var _a, _b;
|
|
14076
14388
|
const colType = ((_a = col.type) == null ? void 0 : _a.toUpperCase()) || "DEFAULT";
|
|
14077
14389
|
const InputComponent = FORM_INPUTS[colType] || FORM_INPUTS.DEFAULT;
|
|
14078
|
-
return /* @__PURE__ */
|
|
14079
|
-
/* @__PURE__ */
|
|
14390
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col gap-1.5", children: [
|
|
14391
|
+
/* @__PURE__ */ jsxs23("label", { className: "text-sm font-semibold text-slate-700", children: [
|
|
14080
14392
|
col.name,
|
|
14081
14393
|
" ",
|
|
14082
|
-
col.isRequired && /* @__PURE__ */
|
|
14394
|
+
col.isRequired && /* @__PURE__ */ jsx24("span", { className: "text-rose-500", children: "*" })
|
|
14083
14395
|
] }),
|
|
14084
|
-
/* @__PURE__ */
|
|
14396
|
+
/* @__PURE__ */ jsx24("div", { className: "border border-slate-200 rounded-lg min-h-[40px] relative", children: /* @__PURE__ */ jsx24(
|
|
14085
14397
|
InputComponent,
|
|
14086
14398
|
{
|
|
14087
14399
|
column: col,
|
|
@@ -14096,15 +14408,15 @@ function FormBlock({ settings: schema, executeAction, componentId, className = "
|
|
|
14096
14408
|
) })
|
|
14097
14409
|
] }, col.name);
|
|
14098
14410
|
}),
|
|
14099
|
-
/* @__PURE__ */
|
|
14411
|
+
/* @__PURE__ */ jsx24("div", { className: "pt-4 border-t border-slate-100 flex justify-end", children: /* @__PURE__ */ jsxs23(
|
|
14100
14412
|
"button",
|
|
14101
14413
|
{
|
|
14102
14414
|
type: "submit",
|
|
14103
14415
|
disabled: isSubmitting,
|
|
14104
14416
|
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
14417
|
children: [
|
|
14106
|
-
isSubmitting && /* @__PURE__ */
|
|
14107
|
-
/* @__PURE__ */
|
|
14418
|
+
isSubmitting && /* @__PURE__ */ jsx24(Loader29, { className: "w-4 h-4 animate-spin" }),
|
|
14419
|
+
/* @__PURE__ */ jsx24("span", { children: isSubmitting ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05DC\u05D9\u05D7\u05D4" })
|
|
14108
14420
|
]
|
|
14109
14421
|
}
|
|
14110
14422
|
) })
|