@universe-platform/ui 0.1.0-beta.60 → 0.1.0-beta.61
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 +25 -0
- package/dist/index.d.mts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.js +1977 -806
- package/dist/index.mjs +1972 -805
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9967,12 +9967,1174 @@ var PlacementBlock = (props) => {
|
|
|
9967
9967
|
] });
|
|
9968
9968
|
};
|
|
9969
9969
|
|
|
9970
|
+
// src/components/PaymentReportsBlock/PaymentReportsBlock.tsx
|
|
9971
|
+
import { useCallback as useCallback16, useEffect as useEffect15, useMemo as useMemo13, useRef as useRef17, useState as useState22 } from "react";
|
|
9972
|
+
|
|
9973
|
+
// src/components/PaymentReportsBlock/PaymentReportsBlock.types.ts
|
|
9974
|
+
var PAYMENT_REPORTS_REQUIRED = [
|
|
9975
|
+
"reportsTableId",
|
|
9976
|
+
"reportReporterColumn",
|
|
9977
|
+
"reportPaymentColumn",
|
|
9978
|
+
"reportAmountColumn",
|
|
9979
|
+
"paymentsTableId",
|
|
9980
|
+
"paymentTotalColumn",
|
|
9981
|
+
"paymentReceiptDateColumn"
|
|
9982
|
+
];
|
|
9983
|
+
function missingPaymentReportsFields(c) {
|
|
9984
|
+
return PAYMENT_REPORTS_REQUIRED.filter((k) => !c || !c[k]);
|
|
9985
|
+
}
|
|
9986
|
+
var PAYMENT_REPORTS_ACTIONS = {
|
|
9987
|
+
CREATE_PAYMENT: "PAYMENT_REPORTS_CREATE_PAYMENT",
|
|
9988
|
+
CANCEL_PAYMENT: "PAYMENT_REPORTS_CANCEL_PAYMENT",
|
|
9989
|
+
CONFIRM_RECEIPT: "PAYMENT_REPORTS_CONFIRM_RECEIPT",
|
|
9990
|
+
UNDO_RECEIPT: "PAYMENT_REPORTS_UNDO_RECEIPT",
|
|
9991
|
+
SET_PROOF: "PAYMENT_REPORTS_SET_PROOF"
|
|
9992
|
+
};
|
|
9993
|
+
|
|
9994
|
+
// src/components/PaymentReportsBlock/paymentReportsUtils.ts
|
|
9995
|
+
function normalizeRows2(records) {
|
|
9996
|
+
return (records || []).filter(Boolean).map((r) => {
|
|
9997
|
+
var _c, _d, _e;
|
|
9998
|
+
const data = r.data && typeof r.data === "object" ? r.data : r.values && typeof r.values === "object" ? r.values : ((_a) => {
|
|
9999
|
+
var _b = _a, { id, _id, recordId } = _b, rest = __objRest(_b, ["id", "_id", "recordId"]);
|
|
10000
|
+
return rest;
|
|
10001
|
+
})(r);
|
|
10002
|
+
return { id: String((_e = (_d = (_c = r.id) != null ? _c : r._id) != null ? _d : r.recordId) != null ? _e : ""), data };
|
|
10003
|
+
}).filter((r) => r.id);
|
|
10004
|
+
}
|
|
10005
|
+
function unpackTableResponse2(res) {
|
|
10006
|
+
var _a, _b, _c, _d, _e;
|
|
10007
|
+
const rawRecords = Array.isArray(res) ? res : Array.isArray(res == null ? void 0 : res.records) ? res.records : Array.isArray(res == null ? void 0 : res.data) ? res.data : Array.isArray((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.records) ? res.data.records : [];
|
|
10008
|
+
const columns = ((_b = res == null ? void 0 : res.schema) == null ? void 0 : _b.columns) || ((_d = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.schema) == null ? void 0 : _d.columns) || [];
|
|
10009
|
+
const relationOptions = (res == null ? void 0 : res.relationOptions) || ((_e = res == null ? void 0 : res.data) == null ? void 0 : _e.relationOptions) || {};
|
|
10010
|
+
return { rows: normalizeRows2(rawRecords), columns, relationOptions };
|
|
10011
|
+
}
|
|
10012
|
+
var PAGE_SIZE = 1e3;
|
|
10013
|
+
var MAX_PAGES = 20;
|
|
10014
|
+
async function fetchAllTableData(exec, tableId) {
|
|
10015
|
+
if (!exec) throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1");
|
|
10016
|
+
const out = { rows: [], columns: [], relationOptions: {} };
|
|
10017
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10018
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
10019
|
+
const res = await exec("FETCH_TABLE_DATA", { tableId, tableMetaId: tableId, limit: PAGE_SIZE, skip: page * PAGE_SIZE });
|
|
10020
|
+
if (res && res.success === false) throw new Error(res.error || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
|
|
10021
|
+
const part = unpackTableResponse2(res);
|
|
10022
|
+
if (page === 0) out.columns = part.columns;
|
|
10023
|
+
for (const r of part.rows) {
|
|
10024
|
+
if (!seen.has(r.id)) {
|
|
10025
|
+
seen.add(r.id);
|
|
10026
|
+
out.rows.push(r);
|
|
10027
|
+
}
|
|
10028
|
+
}
|
|
10029
|
+
for (const [col, opts] of Object.entries(part.relationOptions || {})) {
|
|
10030
|
+
const existing = out.relationOptions[col] || (out.relationOptions[col] = []);
|
|
10031
|
+
const ids = new Set(existing.map((o) => String(o.id)));
|
|
10032
|
+
for (const o of opts) if (!ids.has(String(o.id))) existing.push(o);
|
|
10033
|
+
}
|
|
10034
|
+
if (part.rows.length < PAGE_SIZE) break;
|
|
10035
|
+
}
|
|
10036
|
+
return out;
|
|
10037
|
+
}
|
|
10038
|
+
async function runAction(exec, type, payload) {
|
|
10039
|
+
if (!exec) throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1");
|
|
10040
|
+
const res = await exec(type, payload);
|
|
10041
|
+
if (res && res.success === false) throw new Error(res.error || res.message || "\u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05E0\u05DB\u05E9\u05DC\u05D4");
|
|
10042
|
+
return res && typeof res === "object" && "data" in res && "success" in res ? res.data : res;
|
|
10043
|
+
}
|
|
10044
|
+
function relationIds(v) {
|
|
10045
|
+
if (v === null || v === void 0 || v === "") return [];
|
|
10046
|
+
const arr = Array.isArray(v) ? v : [v];
|
|
10047
|
+
return arr.map((x) => {
|
|
10048
|
+
var _a, _b, _c;
|
|
10049
|
+
return typeof x === "object" && x !== null ? String((_c = (_b = (_a = x.id) != null ? _a : x._id) != null ? _b : x.value) != null ? _c : "") : String(x);
|
|
10050
|
+
}).filter(Boolean);
|
|
10051
|
+
}
|
|
10052
|
+
function toNumber(v) {
|
|
10053
|
+
if (typeof v === "number") return isFinite(v) ? v : 0;
|
|
10054
|
+
const n = Number(String(v != null ? v : "").replace(/[^0-9.-]/g, ""));
|
|
10055
|
+
return isFinite(n) ? n : 0;
|
|
10056
|
+
}
|
|
10057
|
+
function cellText2(v) {
|
|
10058
|
+
var _a, _b, _c, _d, _e;
|
|
10059
|
+
if (v === null || v === void 0) return "";
|
|
10060
|
+
if (Array.isArray(v)) return v.map(cellText2).filter(Boolean).join(", ");
|
|
10061
|
+
if (typeof v === "object") return String((_e = (_d = (_c = (_b = (_a = v.title) != null ? _a : v.label) != null ? _b : v.fileName) != null ? _c : v.name) != null ? _d : v.id) != null ? _e : "");
|
|
10062
|
+
return String(v);
|
|
10063
|
+
}
|
|
10064
|
+
function driveFiles(v) {
|
|
10065
|
+
if (!v) return [];
|
|
10066
|
+
const arr = Array.isArray(v) ? v : [v];
|
|
10067
|
+
return arr.filter((f) => f && typeof f === "object" && (f.fileId || f.fileUrl || f.url));
|
|
10068
|
+
}
|
|
10069
|
+
var DATE_RE = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
10070
|
+
function dateParts(v) {
|
|
10071
|
+
if (!v) return null;
|
|
10072
|
+
if (typeof v === "string") {
|
|
10073
|
+
const m = DATE_RE.exec(v);
|
|
10074
|
+
if (m) return { y: +m[1], m: +m[2], d: +m[3] };
|
|
10075
|
+
}
|
|
10076
|
+
const dt = new Date(v);
|
|
10077
|
+
if (isNaN(dt.getTime())) return null;
|
|
10078
|
+
return { y: dt.getFullYear(), m: dt.getMonth() + 1, d: dt.getDate() };
|
|
10079
|
+
}
|
|
10080
|
+
function formatDate(v) {
|
|
10081
|
+
const p = dateParts(v);
|
|
10082
|
+
return p ? `${p.d}.${p.m}.${p.y}` : "";
|
|
10083
|
+
}
|
|
10084
|
+
function monthKey(v) {
|
|
10085
|
+
const p = dateParts(v);
|
|
10086
|
+
return p ? `${p.y}-${String(p.m).padStart(2, "0")}` : null;
|
|
10087
|
+
}
|
|
10088
|
+
var HEB_MONTHS = ["\u05D9\u05E0\u05D5\u05D0\u05E8", "\u05E4\u05D1\u05E8\u05D5\u05D0\u05E8", "\u05DE\u05E8\u05E5", "\u05D0\u05E4\u05E8\u05D9\u05DC", "\u05DE\u05D0\u05D9", "\u05D9\u05D5\u05E0\u05D9", "\u05D9\u05D5\u05DC\u05D9", "\u05D0\u05D5\u05D2\u05D5\u05E1\u05D8", "\u05E1\u05E4\u05D8\u05DE\u05D1\u05E8", "\u05D0\u05D5\u05E7\u05D8\u05D5\u05D1\u05E8", "\u05E0\u05D5\u05D1\u05DE\u05D1\u05E8", "\u05D3\u05E6\u05DE\u05D1\u05E8"];
|
|
10089
|
+
function monthLabel(key) {
|
|
10090
|
+
const [y, m] = key.split("-").map(Number);
|
|
10091
|
+
return `${HEB_MONTHS[(m || 1) - 1]} ${y}`;
|
|
10092
|
+
}
|
|
10093
|
+
function formatMoney(n, symbol = "\u20AA") {
|
|
10094
|
+
return `${symbol}${(Math.round(n * 100) / 100).toLocaleString("he-IL", { maximumFractionDigits: 2 })}`;
|
|
10095
|
+
}
|
|
10096
|
+
function todayIso() {
|
|
10097
|
+
const d = /* @__PURE__ */ new Date();
|
|
10098
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
10099
|
+
}
|
|
10100
|
+
var labelOf = (options, id) => {
|
|
10101
|
+
const o = (options || []).find((x) => String(x.id) === id);
|
|
10102
|
+
return o ? String(o.label || "") : "";
|
|
10103
|
+
};
|
|
10104
|
+
function buildModel(config, reports, payments) {
|
|
10105
|
+
var _a, _b;
|
|
10106
|
+
const repOpts = (_a = reports.relationOptions) == null ? void 0 : _a[config.reportReporterColumn];
|
|
10107
|
+
const reportItems = reports.rows.map((r) => {
|
|
10108
|
+
const reporterId = relationIds(r.data[config.reportReporterColumn])[0] || "";
|
|
10109
|
+
return {
|
|
10110
|
+
id: r.id,
|
|
10111
|
+
data: r.data,
|
|
10112
|
+
reporterId,
|
|
10113
|
+
reporterLabel: labelOf(repOpts, reporterId) || (reporterId ? "\u2014" : ""),
|
|
10114
|
+
paymentId: relationIds(r.data[config.reportPaymentColumn])[0] || null,
|
|
10115
|
+
amount: toNumber(r.data[config.reportAmountColumn]),
|
|
10116
|
+
qty: config.reportQuantityColumn ? toNumber(r.data[config.reportQuantityColumn]) : 0,
|
|
10117
|
+
month: config.reportDateColumn ? monthKey(r.data[config.reportDateColumn]) : null
|
|
10118
|
+
};
|
|
10119
|
+
});
|
|
10120
|
+
const byPayment = /* @__PURE__ */ new Map();
|
|
10121
|
+
for (const r of reportItems) {
|
|
10122
|
+
if (!r.paymentId) continue;
|
|
10123
|
+
const list = byPayment.get(r.paymentId) || [];
|
|
10124
|
+
list.push(r);
|
|
10125
|
+
byPayment.set(r.paymentId, list);
|
|
10126
|
+
}
|
|
10127
|
+
const payOpts = config.paymentReporterColumn ? (_b = payments.relationOptions) == null ? void 0 : _b[config.paymentReporterColumn] : void 0;
|
|
10128
|
+
const paymentItems = payments.rows.map((p) => {
|
|
10129
|
+
var _a2;
|
|
10130
|
+
const linked = byPayment.get(p.id) || [];
|
|
10131
|
+
const payReporterId = config.paymentReporterColumn ? relationIds(p.data[config.paymentReporterColumn])[0] : "";
|
|
10132
|
+
const rawTotal = p.data[config.paymentTotalColumn];
|
|
10133
|
+
const hasTotal = rawTotal !== void 0 && rawTotal !== null && rawTotal !== "";
|
|
10134
|
+
return {
|
|
10135
|
+
id: p.id,
|
|
10136
|
+
data: p.data,
|
|
10137
|
+
reporterLabel: payReporterId && labelOf(payOpts, payReporterId) || ((_a2 = linked[0]) == null ? void 0 : _a2.reporterLabel) || "",
|
|
10138
|
+
total: hasTotal ? toNumber(rawTotal) : linked.reduce((s, r) => s + r.amount, 0),
|
|
10139
|
+
receiptDate: p.data[config.paymentReceiptDateColumn] || null,
|
|
10140
|
+
proof: config.paymentProofColumn ? driveFiles(p.data[config.paymentProofColumn]) : [],
|
|
10141
|
+
reports: linked,
|
|
10142
|
+
months: Array.from(new Set(linked.map((r) => r.month).filter(Boolean)))
|
|
10143
|
+
};
|
|
10144
|
+
});
|
|
10145
|
+
return { reports: reportItems, payments: paymentItems };
|
|
10146
|
+
}
|
|
10147
|
+
function displayCell(item, col, relationOptions, symbol) {
|
|
10148
|
+
const v = item.data[col.name];
|
|
10149
|
+
switch (col.type) {
|
|
10150
|
+
case "RELATION": {
|
|
10151
|
+
const opts = (relationOptions == null ? void 0 : relationOptions[col.name]) || [];
|
|
10152
|
+
return relationIds(v).map((id) => labelOf(opts, id) || "").filter(Boolean).join(", ");
|
|
10153
|
+
}
|
|
10154
|
+
case "DATE":
|
|
10155
|
+
return formatDate(v);
|
|
10156
|
+
case "BOOLEAN":
|
|
10157
|
+
return v === true ? "\u2713" : "";
|
|
10158
|
+
case "CURRENCY":
|
|
10159
|
+
return v === void 0 || v === null || v === "" ? "" : formatMoney(toNumber(v), symbol);
|
|
10160
|
+
case "NUMBER":
|
|
10161
|
+
return v === void 0 || v === null || v === "" ? "" : toNumber(v);
|
|
10162
|
+
case "GOOGLE_DRIVE_FILE":
|
|
10163
|
+
return driveFiles(v).map((f) => f.fileName).join(", ");
|
|
10164
|
+
default:
|
|
10165
|
+
return cellText2(v);
|
|
10166
|
+
}
|
|
10167
|
+
}
|
|
10168
|
+
|
|
10169
|
+
// src/components/PaymentReportsBlock/UnpaidReportsTab.tsx
|
|
10170
|
+
import { useMemo as useMemo10, useRef as useRef15, useState as useState19 } from "react";
|
|
10171
|
+
import { AgGridReact as AgGridReact2 } from "ag-grid-react";
|
|
10172
|
+
import { ModuleRegistry as ModuleRegistry2, AllCommunityModule as AllCommunityModule2 } from "ag-grid-community";
|
|
10173
|
+
|
|
10174
|
+
// src/components/PaymentReportsBlock/PaymentReportsModals.tsx
|
|
10175
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
10176
|
+
var Modal = ({ title, onClose, children, footer, wide }) => /* @__PURE__ */ jsx22(
|
|
10177
|
+
"div",
|
|
10178
|
+
{
|
|
10179
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
10180
|
+
dir: "rtl",
|
|
10181
|
+
onClick: onClose,
|
|
10182
|
+
children: /* @__PURE__ */ jsxs18(
|
|
10183
|
+
"div",
|
|
10184
|
+
{
|
|
10185
|
+
className: `bg-white rounded-xl shadow-xl w-full ${wide ? "max-w-3xl" : "max-w-md"} max-h-[85vh] flex flex-col`,
|
|
10186
|
+
onClick: (e) => e.stopPropagation(),
|
|
10187
|
+
children: [
|
|
10188
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between px-5 py-3 border-b border-slate-200", children: [
|
|
10189
|
+
/* @__PURE__ */ jsx22("h3", { className: "text-base font-bold text-slate-800", children: title }),
|
|
10190
|
+
/* @__PURE__ */ jsx22("button", { type: "button", onClick: onClose, className: "text-slate-400 hover:text-slate-600 text-xl leading-none cursor-pointer", children: "\xD7" })
|
|
10191
|
+
] }),
|
|
10192
|
+
/* @__PURE__ */ jsx22("div", { className: "p-5 overflow-auto text-sm text-slate-700", children }),
|
|
10193
|
+
footer && /* @__PURE__ */ jsx22("div", { className: "px-5 py-3 border-t border-slate-200 flex justify-end gap-2", children: footer })
|
|
10194
|
+
]
|
|
10195
|
+
}
|
|
10196
|
+
)
|
|
10197
|
+
}
|
|
10198
|
+
);
|
|
10199
|
+
var ConfirmModal = ({ title, message, confirmLabel, danger, busy, onConfirm, onClose }) => /* @__PURE__ */ jsx22(
|
|
10200
|
+
Modal,
|
|
10201
|
+
{
|
|
10202
|
+
title,
|
|
10203
|
+
onClose,
|
|
10204
|
+
footer: /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
10205
|
+
/* @__PURE__ */ jsx22(
|
|
10206
|
+
"button",
|
|
10207
|
+
{
|
|
10208
|
+
type: "button",
|
|
10209
|
+
onClick: onClose,
|
|
10210
|
+
className: "px-4 py-2 rounded-lg text-sm font-medium bg-white border border-slate-300 text-slate-600 hover:bg-slate-50 cursor-pointer",
|
|
10211
|
+
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
10212
|
+
}
|
|
10213
|
+
),
|
|
10214
|
+
/* @__PURE__ */ jsx22(
|
|
10215
|
+
"button",
|
|
10216
|
+
{
|
|
10217
|
+
type: "button",
|
|
10218
|
+
disabled: busy,
|
|
10219
|
+
onClick: onConfirm,
|
|
10220
|
+
className: `px-4 py-2 rounded-lg text-sm font-bold text-white disabled:opacity-50 cursor-pointer ${danger ? "bg-rose-600 hover:bg-rose-700" : "bg-blue-600 hover:bg-blue-700"}`,
|
|
10221
|
+
children: busy ? "\u05DE\u05D1\u05E6\u05E2..." : confirmLabel
|
|
10222
|
+
}
|
|
10223
|
+
)
|
|
10224
|
+
] }),
|
|
10225
|
+
children: message
|
|
10226
|
+
}
|
|
10227
|
+
);
|
|
10228
|
+
|
|
10229
|
+
// src/components/PaymentReportsBlock/useGridColumnWidths.ts
|
|
10230
|
+
import { useCallback as useCallback15, useState as useState18 } from "react";
|
|
10231
|
+
function useGridColumnWidths(storageKey) {
|
|
10232
|
+
const [widths, setWidths] = useState18(() => {
|
|
10233
|
+
if (typeof window === "undefined") return {};
|
|
10234
|
+
try {
|
|
10235
|
+
return JSON.parse(localStorage.getItem(storageKey) || "{}") || {};
|
|
10236
|
+
} catch (e) {
|
|
10237
|
+
return {};
|
|
10238
|
+
}
|
|
10239
|
+
});
|
|
10240
|
+
const onColumnResized = useCallback15(
|
|
10241
|
+
(e) => {
|
|
10242
|
+
var _a;
|
|
10243
|
+
if (!e.finished || e.source !== "uiColumnResized" || !((_a = e.columns) == null ? void 0 : _a.length)) return;
|
|
10244
|
+
setWidths((prev) => {
|
|
10245
|
+
const next = __spreadValues({}, prev);
|
|
10246
|
+
for (const c of e.columns) next[c.getColId()] = Math.round(c.getActualWidth());
|
|
10247
|
+
try {
|
|
10248
|
+
localStorage.setItem(storageKey, JSON.stringify(next));
|
|
10249
|
+
} catch (e2) {
|
|
10250
|
+
}
|
|
10251
|
+
return next;
|
|
10252
|
+
});
|
|
10253
|
+
},
|
|
10254
|
+
[storageKey]
|
|
10255
|
+
);
|
|
10256
|
+
const applyWidths = useCallback15(
|
|
10257
|
+
(defs) => defs.map((d) => {
|
|
10258
|
+
const w = d.colId ? widths[d.colId] : void 0;
|
|
10259
|
+
return w ? __spreadProps(__spreadValues({}, d), { width: w, flex: 0 }) : d;
|
|
10260
|
+
}),
|
|
10261
|
+
[widths]
|
|
10262
|
+
);
|
|
10263
|
+
return { onColumnResized, applyWidths };
|
|
10264
|
+
}
|
|
10265
|
+
|
|
10266
|
+
// src/components/PaymentReportsBlock/UnpaidReportsTab.tsx
|
|
10267
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
10268
|
+
ModuleRegistry2.registerModules([AllCommunityModule2]);
|
|
10269
|
+
var isUserColumn2 = (c) => !!(c == null ? void 0 : c.name) && c.name !== "_id" && c.name !== "id" && !c.isHidden;
|
|
10270
|
+
var EDITABLE_TYPES = ["STRING", "NUMBER", "CURRENCY"];
|
|
10271
|
+
var DeleteCell = (p) => {
|
|
10272
|
+
if (!p.data || p.data.paymentId) return null;
|
|
10273
|
+
return /* @__PURE__ */ jsx23(
|
|
10274
|
+
"button",
|
|
10275
|
+
{
|
|
10276
|
+
type: "button",
|
|
10277
|
+
title: "\u05DE\u05D7\u05E7 \u05D3\u05D9\u05D5\u05D5\u05D7",
|
|
10278
|
+
onClick: () => p.handlers.current.onDeleteReports([p.data.id]),
|
|
10279
|
+
className: "text-slate-400 hover:text-rose-600 cursor-pointer text-base",
|
|
10280
|
+
children: "\u{1F5D1}"
|
|
10281
|
+
}
|
|
10282
|
+
);
|
|
10283
|
+
};
|
|
10284
|
+
var UnpaidReportsTab = ({
|
|
10285
|
+
config,
|
|
10286
|
+
symbol,
|
|
10287
|
+
canEdit,
|
|
10288
|
+
reports,
|
|
10289
|
+
columns,
|
|
10290
|
+
relationOptions,
|
|
10291
|
+
search,
|
|
10292
|
+
showPaid,
|
|
10293
|
+
onToggleShowPaid,
|
|
10294
|
+
paymentLabels,
|
|
10295
|
+
handlers
|
|
10296
|
+
}) => {
|
|
10297
|
+
var _a;
|
|
10298
|
+
const apiRef = useRef15(null);
|
|
10299
|
+
const { onColumnResized, applyWidths } = useGridColumnWidths(`payment-reports:${config.reportsTableId}:unpaid`);
|
|
10300
|
+
const [selectedIds, setSelectedIds] = useState19([]);
|
|
10301
|
+
const [confirmOpen, setConfirmOpen] = useState19(false);
|
|
10302
|
+
const [paying, setPaying] = useState19(false);
|
|
10303
|
+
const displayCols = useMemo10(() => {
|
|
10304
|
+
var _a2;
|
|
10305
|
+
const byName = new Map(columns.filter(isUserColumn2).map((c) => [c.name, c]));
|
|
10306
|
+
const wanted = ((_a2 = config.reportDisplayColumns) == null ? void 0 : _a2.length) ? config.reportDisplayColumns : Array.from(byName.keys());
|
|
10307
|
+
return wanted.filter((n) => n !== config.reportPaymentColumn && n !== config.reportReporterColumn).map((n) => byName.get(n)).filter(Boolean);
|
|
10308
|
+
}, [columns, config.reportDisplayColumns, config.reportPaymentColumn, config.reportReporterColumn]);
|
|
10309
|
+
const colDefs = useMemo10(() => {
|
|
10310
|
+
const defs = [
|
|
10311
|
+
{ headerName: "\u05DE\u05D3\u05D5\u05D5\u05D7", colId: "__reporter", minWidth: 140, valueGetter: (p) => {
|
|
10312
|
+
var _a2;
|
|
10313
|
+
return ((_a2 = p.data) == null ? void 0 : _a2.reporterLabel) || "";
|
|
10314
|
+
} }
|
|
10315
|
+
];
|
|
10316
|
+
for (const col of displayCols) {
|
|
10317
|
+
const base = { headerName: col.name, colId: col.name, minWidth: 110 };
|
|
10318
|
+
if (EDITABLE_TYPES.includes(col.type)) {
|
|
10319
|
+
defs.push(__spreadProps(__spreadValues({}, base), {
|
|
10320
|
+
editable: (p) => canEdit && !!p.data && !p.data.paymentId,
|
|
10321
|
+
valueGetter: (p) => {
|
|
10322
|
+
var _a2, _b, _c;
|
|
10323
|
+
return (_c = (_b = (_a2 = p.data) == null ? void 0 : _a2.data) == null ? void 0 : _b[col.name]) != null ? _c : "";
|
|
10324
|
+
},
|
|
10325
|
+
valueFormatter: col.type === "CURRENCY" ? (p) => p.value === "" || p.value == null ? "" : formatMoney(toNumber(p.value), symbol) : void 0,
|
|
10326
|
+
valueSetter: (p) => {
|
|
10327
|
+
var _a2;
|
|
10328
|
+
if (p.data) {
|
|
10329
|
+
handlers.current.onEditCell(
|
|
10330
|
+
p.data.id,
|
|
10331
|
+
col.name,
|
|
10332
|
+
col.type === "STRING" ? String((_a2 = p.newValue) != null ? _a2 : "") : toNumber(p.newValue)
|
|
10333
|
+
);
|
|
10334
|
+
}
|
|
10335
|
+
return false;
|
|
10336
|
+
}
|
|
10337
|
+
}));
|
|
10338
|
+
} else {
|
|
10339
|
+
defs.push(__spreadProps(__spreadValues({}, base), {
|
|
10340
|
+
valueGetter: (p) => p.data ? displayCell(p.data, col, relationOptions, symbol) : ""
|
|
10341
|
+
}));
|
|
10342
|
+
}
|
|
10343
|
+
}
|
|
10344
|
+
if (showPaid) {
|
|
10345
|
+
defs.push({
|
|
10346
|
+
headerName: "\u05EA\u05E9\u05DC\u05D5\u05DD",
|
|
10347
|
+
colId: "__payment",
|
|
10348
|
+
minWidth: 130,
|
|
10349
|
+
valueGetter: (p) => {
|
|
10350
|
+
var _a2;
|
|
10351
|
+
return ((_a2 = p.data) == null ? void 0 : _a2.paymentId) ? paymentLabels[p.data.paymentId] || "\u05E9\u05D5\u05DC\u05DD" : "";
|
|
10352
|
+
}
|
|
10353
|
+
});
|
|
10354
|
+
}
|
|
10355
|
+
if (canEdit) {
|
|
10356
|
+
defs.push({
|
|
10357
|
+
headerName: "\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA",
|
|
10358
|
+
colId: "__actions",
|
|
10359
|
+
width: 90,
|
|
10360
|
+
sortable: false,
|
|
10361
|
+
filter: false,
|
|
10362
|
+
resizable: false,
|
|
10363
|
+
cellRenderer: DeleteCell,
|
|
10364
|
+
cellRendererParams: { handlers }
|
|
10365
|
+
});
|
|
10366
|
+
}
|
|
10367
|
+
return defs;
|
|
10368
|
+
}, [displayCols, canEdit, symbol, relationOptions, showPaid, paymentLabels, handlers]);
|
|
10369
|
+
const finalColDefs = useMemo10(() => applyWidths(colDefs), [applyWidths, colDefs]);
|
|
10370
|
+
const unpaid = useMemo10(() => reports.filter((r) => !r.paymentId), [reports]);
|
|
10371
|
+
const totals = useMemo10(() => {
|
|
10372
|
+
const amount = unpaid.reduce((s, r) => s + r.amount, 0);
|
|
10373
|
+
const qty = unpaid.reduce((s, r) => s + r.qty, 0);
|
|
10374
|
+
return { count: unpaid.length, amount, qty, avg: qty > 0 ? amount / qty : 0 };
|
|
10375
|
+
}, [unpaid]);
|
|
10376
|
+
const selected = useMemo10(
|
|
10377
|
+
() => unpaid.filter((r) => selectedIds.includes(r.id)),
|
|
10378
|
+
[unpaid, selectedIds]
|
|
10379
|
+
);
|
|
10380
|
+
const selectedTotal = selected.reduce((s, r) => s + r.amount, 0);
|
|
10381
|
+
const reporterIds = new Set(selected.map((r) => r.reporterId));
|
|
10382
|
+
const sameReporter = reporterIds.size === 1 && !reporterIds.has("");
|
|
10383
|
+
const reporterName = ((_a = selected[0]) == null ? void 0 : _a.reporterLabel) || "";
|
|
10384
|
+
const doPay = async () => {
|
|
10385
|
+
var _a2;
|
|
10386
|
+
setPaying(true);
|
|
10387
|
+
try {
|
|
10388
|
+
await handlers.current.onPay(selected.map((r) => r.id));
|
|
10389
|
+
(_a2 = apiRef.current) == null ? void 0 : _a2.deselectAll();
|
|
10390
|
+
setSelectedIds([]);
|
|
10391
|
+
setConfirmOpen(false);
|
|
10392
|
+
} catch (e) {
|
|
10393
|
+
} finally {
|
|
10394
|
+
setPaying(false);
|
|
10395
|
+
}
|
|
10396
|
+
};
|
|
10397
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3", children: [
|
|
10398
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
10399
|
+
/* @__PURE__ */ jsxs19("label", { className: "flex items-center gap-2 text-xs text-slate-600 cursor-pointer", children: [
|
|
10400
|
+
/* @__PURE__ */ jsx23("input", { type: "checkbox", checked: showPaid, onChange: (e) => onToggleShowPaid(e.target.checked) }),
|
|
10401
|
+
"\u05D4\u05E6\u05D2 \u05D2\u05DD \u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05E9\u05E9\u05D5\u05DC\u05DE\u05D5"
|
|
10402
|
+
] }),
|
|
10403
|
+
canEdit && /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-3", children: [
|
|
10404
|
+
selected.length > 0 && !sameReporter && /* @__PURE__ */ jsx23("span", { className: "text-xs text-rose-600", children: "\u05E0\u05D9\u05EA\u05DF \u05DC\u05E9\u05DC\u05DD \u05DC\u05DE\u05D3\u05D5\u05D5\u05D7 \u05D0\u05D7\u05D3 \u05D1\u05DB\u05DC \u05E4\u05E2\u05DD" }),
|
|
10405
|
+
selected.length > 0 && sameReporter && /* @__PURE__ */ jsxs19("span", { className: "text-xs text-slate-500", children: [
|
|
10406
|
+
selected.length,
|
|
10407
|
+
" \u05E0\u05D1\u05D7\u05E8\u05D5 \xB7 ",
|
|
10408
|
+
formatMoney(selectedTotal, symbol)
|
|
10409
|
+
] }),
|
|
10410
|
+
/* @__PURE__ */ jsx23(
|
|
10411
|
+
"button",
|
|
10412
|
+
{
|
|
10413
|
+
type: "button",
|
|
10414
|
+
disabled: selected.length === 0 || !sameReporter || paying,
|
|
10415
|
+
onClick: () => setConfirmOpen(true),
|
|
10416
|
+
className: "px-4 py-2 rounded-lg text-sm font-bold bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",
|
|
10417
|
+
children: "\u{1F4B3} \u05D1\u05D5\u05E6\u05E2 \u05EA\u05E9\u05DC\u05D5\u05DD \u05DC\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5"
|
|
10418
|
+
}
|
|
10419
|
+
)
|
|
10420
|
+
] })
|
|
10421
|
+
] }),
|
|
10422
|
+
/* @__PURE__ */ jsx23("div", { className: "ag-theme-quartz w-full", style: { height: 520 }, children: /* @__PURE__ */ jsx23(
|
|
10423
|
+
AgGridReact2,
|
|
10424
|
+
{
|
|
10425
|
+
rowData: reports,
|
|
10426
|
+
columnDefs: finalColDefs,
|
|
10427
|
+
onColumnResized,
|
|
10428
|
+
defaultColDef: { sortable: true, resizable: true, filter: true, flex: 1 },
|
|
10429
|
+
getRowId: (p) => p.data.id,
|
|
10430
|
+
enableRtl: true,
|
|
10431
|
+
rowHeight: 46,
|
|
10432
|
+
headerHeight: 48,
|
|
10433
|
+
quickFilterText: search,
|
|
10434
|
+
singleClickEdit: true,
|
|
10435
|
+
stopEditingWhenCellsLoseFocus: true,
|
|
10436
|
+
getRowStyle: (p) => {
|
|
10437
|
+
var _a2;
|
|
10438
|
+
return ((_a2 = p.data) == null ? void 0 : _a2.paymentId) ? { background: "#fee2e2", color: "#b91c1c" } : void 0;
|
|
10439
|
+
},
|
|
10440
|
+
rowSelection: canEdit ? {
|
|
10441
|
+
mode: "multiRow",
|
|
10442
|
+
checkboxes: true,
|
|
10443
|
+
headerCheckbox: true,
|
|
10444
|
+
enableClickSelection: false,
|
|
10445
|
+
isRowSelectable: (node) => !!node.data && !node.data.paymentId
|
|
10446
|
+
} : void 0,
|
|
10447
|
+
onGridReady: (e) => {
|
|
10448
|
+
apiRef.current = e.api;
|
|
10449
|
+
},
|
|
10450
|
+
onSelectionChanged: (e) => setSelectedIds(e.api.getSelectedRows().map((r) => r.id))
|
|
10451
|
+
}
|
|
10452
|
+
) }),
|
|
10453
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-x-6 gap-y-1 text-sm font-medium text-slate-700 bg-slate-100 rounded-lg px-4 py-2", children: [
|
|
10454
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
10455
|
+
"\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05E9\u05D8\u05E8\u05DD \u05E9\u05D5\u05DC\u05DE\u05D5: ",
|
|
10456
|
+
totals.count
|
|
10457
|
+
] }),
|
|
10458
|
+
config.reportQuantityColumn && /* @__PURE__ */ jsxs19("span", { children: [
|
|
10459
|
+
'\u05E1\u05D4"\u05DB \u05DB\u05DE\u05D5\u05EA: ',
|
|
10460
|
+
totals.qty
|
|
10461
|
+
] }),
|
|
10462
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
10463
|
+
'\u05E1\u05D4"\u05DB \u05E1\u05DB\u05D5\u05DD: ',
|
|
10464
|
+
formatMoney(totals.amount, symbol)
|
|
10465
|
+
] }),
|
|
10466
|
+
config.reportQuantityColumn && totals.qty > 0 && /* @__PURE__ */ jsxs19("span", { children: [
|
|
10467
|
+
"\u05DE\u05DE\u05D5\u05E6\u05E2 \u05DC\u05D9\u05D7\u05D9\u05D3\u05D4: ",
|
|
10468
|
+
formatMoney(totals.avg, symbol)
|
|
10469
|
+
] })
|
|
10470
|
+
] }),
|
|
10471
|
+
confirmOpen && /* @__PURE__ */ jsx23(
|
|
10472
|
+
ConfirmModal,
|
|
10473
|
+
{
|
|
10474
|
+
title: "\u05D0\u05D9\u05E9\u05D5\u05E8 \u05EA\u05E9\u05DC\u05D5\u05DD",
|
|
10475
|
+
confirmLabel: "\u05D1\u05E6\u05E2 \u05EA\u05E9\u05DC\u05D5\u05DD",
|
|
10476
|
+
busy: paying,
|
|
10477
|
+
onConfirm: doPay,
|
|
10478
|
+
onClose: () => setConfirmOpen(false),
|
|
10479
|
+
message: /* @__PURE__ */ jsxs19("p", { children: [
|
|
10480
|
+
"\u05D9\u05D9\u05D5\u05D5\u05E6\u05E8 \u05EA\u05E9\u05DC\u05D5\u05DD \u05D0\u05D7\u05D3 \u05DC\u05DE\u05D3\u05D5\u05D5\u05D7 ",
|
|
10481
|
+
/* @__PURE__ */ jsx23("b", { children: reporterName }),
|
|
10482
|
+
" \u05E2\u05DC ",
|
|
10483
|
+
/* @__PURE__ */ jsx23("b", { children: selected.length }),
|
|
10484
|
+
" \u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD, \u05D1\u05E1\u05DA",
|
|
10485
|
+
" ",
|
|
10486
|
+
/* @__PURE__ */ jsx23("b", { children: formatMoney(selectedTotal, symbol) }),
|
|
10487
|
+
"."
|
|
10488
|
+
] })
|
|
10489
|
+
}
|
|
10490
|
+
)
|
|
10491
|
+
] });
|
|
10492
|
+
};
|
|
10493
|
+
|
|
10494
|
+
// src/components/PaymentReportsBlock/PaymentsGrid.tsx
|
|
10495
|
+
import { useMemo as useMemo11, useState as useState21 } from "react";
|
|
10496
|
+
import { AgGridReact as AgGridReact3 } from "ag-grid-react";
|
|
10497
|
+
import { ModuleRegistry as ModuleRegistry3, AllCommunityModule as AllCommunityModule3 } from "ag-grid-community";
|
|
10498
|
+
|
|
10499
|
+
// src/components/PaymentReportsBlock/ProofCell.tsx
|
|
10500
|
+
import { useRef as useRef16, useState as useState20 } from "react";
|
|
10501
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
10502
|
+
var ProofCell = ({ files, editable, onUpload, onRemove }) => {
|
|
10503
|
+
const inputRef = useRef16(null);
|
|
10504
|
+
const [busy, setBusy] = useState20(false);
|
|
10505
|
+
const file = files[0];
|
|
10506
|
+
const href = (file == null ? void 0 : file.fileUrl) || (file == null ? void 0 : file.url);
|
|
10507
|
+
const handleFile = async (e) => {
|
|
10508
|
+
var _a;
|
|
10509
|
+
const f = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
10510
|
+
e.target.value = "";
|
|
10511
|
+
if (!f) return;
|
|
10512
|
+
setBusy(true);
|
|
10513
|
+
try {
|
|
10514
|
+
await onUpload(f);
|
|
10515
|
+
} finally {
|
|
10516
|
+
setBusy(false);
|
|
10517
|
+
}
|
|
10518
|
+
};
|
|
10519
|
+
const handleRemove = async () => {
|
|
10520
|
+
setBusy(true);
|
|
10521
|
+
try {
|
|
10522
|
+
await onRemove();
|
|
10523
|
+
} finally {
|
|
10524
|
+
setBusy(false);
|
|
10525
|
+
}
|
|
10526
|
+
};
|
|
10527
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2 h-full", children: [
|
|
10528
|
+
file ? /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
10529
|
+
/* @__PURE__ */ jsx24("a", { href, target: "_blank", rel: "noreferrer", className: "text-blue-600 underline text-xs font-medium", children: "\u05E6\u05E4\u05D9\u05D9\u05D4" }),
|
|
10530
|
+
editable && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
10531
|
+
/* @__PURE__ */ jsx24("button", { type: "button", disabled: busy, onClick: () => {
|
|
10532
|
+
var _a;
|
|
10533
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
10534
|
+
}, className: "text-[11px] text-slate-500 hover:text-slate-800 cursor-pointer", children: "\u05D4\u05D7\u05DC\u05E3" }),
|
|
10535
|
+
/* @__PURE__ */ jsx24("button", { type: "button", disabled: busy, onClick: handleRemove, className: "text-[11px] text-rose-500 hover:text-rose-700 cursor-pointer", children: "\u05D4\u05E1\u05E8" })
|
|
10536
|
+
] })
|
|
10537
|
+
] }) : editable ? /* @__PURE__ */ jsx24(
|
|
10538
|
+
"button",
|
|
10539
|
+
{
|
|
10540
|
+
type: "button",
|
|
10541
|
+
disabled: busy,
|
|
10542
|
+
onClick: () => {
|
|
10543
|
+
var _a;
|
|
10544
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
10545
|
+
},
|
|
10546
|
+
className: "px-2 py-1 rounded-md text-xs font-medium bg-slate-100 hover:bg-slate-200 text-slate-700 disabled:opacity-50 cursor-pointer",
|
|
10547
|
+
children: busy ? "\u05DE\u05E2\u05DC\u05D4..." : "\u2B06 \u05D4\u05E2\u05DC\u05D4 \u05D0\u05E1\u05DE\u05DB\u05EA\u05D0"
|
|
10548
|
+
}
|
|
10549
|
+
) : /* @__PURE__ */ jsx24("span", { className: "text-xs text-slate-400 italic", children: "\u05DC\u05D0 \u05D4\u05D5\u05E2\u05DC\u05EA\u05D4" }),
|
|
10550
|
+
/* @__PURE__ */ jsx24("input", { ref: inputRef, type: "file", className: "hidden", onChange: handleFile })
|
|
10551
|
+
] });
|
|
10552
|
+
};
|
|
10553
|
+
|
|
10554
|
+
// src/components/PaymentReportsBlock/PaymentsGrid.tsx
|
|
10555
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10556
|
+
ModuleRegistry3.registerModules([AllCommunityModule3]);
|
|
10557
|
+
var ProofRenderer = (p) => p.data ? /* @__PURE__ */ jsx25(
|
|
10558
|
+
ProofCell,
|
|
10559
|
+
{
|
|
10560
|
+
files: p.data.proof,
|
|
10561
|
+
editable: !!p.editable,
|
|
10562
|
+
onUpload: (f) => p.handlers.current.onUploadProof(p.data.id, f),
|
|
10563
|
+
onRemove: () => p.handlers.current.onRemoveProof(p.data.id)
|
|
10564
|
+
}
|
|
10565
|
+
) : null;
|
|
10566
|
+
var ReceiptRenderer = (p) => {
|
|
10567
|
+
const [date, setDate] = useState21(todayIso());
|
|
10568
|
+
const [busy, setBusy] = useState21(false);
|
|
10569
|
+
if (!p.data) return null;
|
|
10570
|
+
const id = p.data.id;
|
|
10571
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 h-full", children: [
|
|
10572
|
+
/* @__PURE__ */ jsx25(
|
|
10573
|
+
"input",
|
|
10574
|
+
{
|
|
10575
|
+
type: "date",
|
|
10576
|
+
value: date,
|
|
10577
|
+
onChange: (e) => setDate(e.target.value),
|
|
10578
|
+
className: "border border-slate-300 rounded-md px-2 py-1 text-xs bg-white"
|
|
10579
|
+
}
|
|
10580
|
+
),
|
|
10581
|
+
/* @__PURE__ */ jsx25(
|
|
10582
|
+
"button",
|
|
10583
|
+
{
|
|
10584
|
+
type: "button",
|
|
10585
|
+
disabled: busy || !date,
|
|
10586
|
+
onClick: async () => {
|
|
10587
|
+
setBusy(true);
|
|
10588
|
+
try {
|
|
10589
|
+
await p.handlers.current.onConfirmReceipt(id, date);
|
|
10590
|
+
} finally {
|
|
10591
|
+
setBusy(false);
|
|
10592
|
+
}
|
|
10593
|
+
},
|
|
10594
|
+
className: "px-3 py-1 rounded-md text-xs font-bold bg-emerald-600 hover:bg-emerald-700 text-white disabled:opacity-50 cursor-pointer",
|
|
10595
|
+
children: busy ? "..." : "\u05D0\u05E9\u05E8 \u05E7\u05D1\u05DC\u05D4"
|
|
10596
|
+
}
|
|
10597
|
+
)
|
|
10598
|
+
] });
|
|
10599
|
+
};
|
|
10600
|
+
var ActionsRenderer = (p) => {
|
|
10601
|
+
if (!p.data) return null;
|
|
10602
|
+
const pay = p.data;
|
|
10603
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 h-full", children: [
|
|
10604
|
+
/* @__PURE__ */ jsx25(
|
|
10605
|
+
"button",
|
|
10606
|
+
{
|
|
10607
|
+
type: "button",
|
|
10608
|
+
onClick: () => p.handlers.current.onDetails(pay),
|
|
10609
|
+
className: "px-2 py-1 rounded-md text-xs font-medium bg-slate-100 hover:bg-slate-200 text-slate-700 cursor-pointer",
|
|
10610
|
+
children: "\u05E4\u05D9\u05E8\u05D5\u05D8"
|
|
10611
|
+
}
|
|
10612
|
+
),
|
|
10613
|
+
p.editable && (p.mode === "pending" ? /* @__PURE__ */ jsx25(
|
|
10614
|
+
"button",
|
|
10615
|
+
{
|
|
10616
|
+
type: "button",
|
|
10617
|
+
title: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05D4\u05EA\u05E9\u05DC\u05D5\u05DD - \u05D4\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05D9\u05D7\u05D6\u05E8\u05D5 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA \u05D4\u05E8\u05D0\u05E9\u05D5\u05E0\u05D4",
|
|
10618
|
+
onClick: () => p.handlers.current.onCancelPayment(pay),
|
|
10619
|
+
className: "px-2 py-1 rounded-md text-xs font-medium bg-rose-50 hover:bg-rose-100 text-rose-600 border border-rose-200 cursor-pointer",
|
|
10620
|
+
children: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05EA\u05E9\u05DC\u05D5\u05DD"
|
|
10621
|
+
}
|
|
10622
|
+
) : /* @__PURE__ */ jsx25(
|
|
10623
|
+
"button",
|
|
10624
|
+
{
|
|
10625
|
+
type: "button",
|
|
10626
|
+
title: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05D0\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E7\u05D1\u05DC\u05D4 - \u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05D9\u05D7\u05D6\u05D5\u05E8 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA '\u05E9\u05D5\u05DC\u05DD \u05DC\u05DE\u05D3\u05E8\u05D9\u05DB\u05D9\u05DD'",
|
|
10627
|
+
onClick: () => p.handlers.current.onUndoReceipt(pay),
|
|
10628
|
+
className: "px-2 py-1 rounded-md text-xs font-medium bg-amber-50 hover:bg-amber-100 text-amber-700 border border-amber-200 cursor-pointer",
|
|
10629
|
+
children: "\u05D1\u05D8\u05DC \u05D0\u05D9\u05E9\u05D5\u05E8"
|
|
10630
|
+
}
|
|
10631
|
+
))
|
|
10632
|
+
] });
|
|
10633
|
+
};
|
|
10634
|
+
var PaymentsGrid = ({ mode, config, symbol, canEdit, payments, search, handlers }) => {
|
|
10635
|
+
const { onColumnResized, applyWidths } = useGridColumnWidths(`payment-reports:${config.paymentsTableId}:${mode}`);
|
|
10636
|
+
const colDefs = useMemo11(() => {
|
|
10637
|
+
const defs = [
|
|
10638
|
+
{ headerName: "\u05DE\u05D3\u05D5\u05D5\u05D7", colId: "__reporter", minWidth: 140, valueGetter: (p) => {
|
|
10639
|
+
var _a;
|
|
10640
|
+
return ((_a = p.data) == null ? void 0 : _a.reporterLabel) || "";
|
|
10641
|
+
} },
|
|
10642
|
+
{
|
|
10643
|
+
headerName: mode === "pending" ? "\u05E1\u05DB\u05D5\u05DD \u05DB\u05D5\u05DC\u05DC" : "\u05E1\u05DB\u05D5\u05DD \u05E9\u05E9\u05D5\u05DC\u05DD",
|
|
10644
|
+
colId: "__total",
|
|
10645
|
+
minWidth: 120,
|
|
10646
|
+
valueGetter: (p) => {
|
|
10647
|
+
var _a, _b;
|
|
10648
|
+
return (_b = (_a = p.data) == null ? void 0 : _a.total) != null ? _b : 0;
|
|
10649
|
+
},
|
|
10650
|
+
valueFormatter: (p) => formatMoney(Number(p.value || 0), symbol)
|
|
10651
|
+
},
|
|
10652
|
+
{ headerName: "\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD", colId: "__count", width: 100, valueGetter: (p) => {
|
|
10653
|
+
var _a, _b;
|
|
10654
|
+
return (_b = (_a = p.data) == null ? void 0 : _a.reports.length) != null ? _b : 0;
|
|
10655
|
+
} }
|
|
10656
|
+
];
|
|
10657
|
+
if (config.paymentProofColumn) {
|
|
10658
|
+
defs.push({
|
|
10659
|
+
headerName: "\u05D0\u05E1\u05DE\u05DB\u05EA\u05D0",
|
|
10660
|
+
colId: "__proof",
|
|
10661
|
+
minWidth: 190,
|
|
10662
|
+
sortable: false,
|
|
10663
|
+
filter: false,
|
|
10664
|
+
valueGetter: (p) => {
|
|
10665
|
+
var _a;
|
|
10666
|
+
return (((_a = p.data) == null ? void 0 : _a.proof) || []).map((f) => f.fileId || f.fileUrl || f.url).join(",");
|
|
10667
|
+
},
|
|
10668
|
+
cellRenderer: ProofRenderer,
|
|
10669
|
+
cellRendererParams: { handlers, editable: canEdit && mode === "pending" }
|
|
10670
|
+
});
|
|
10671
|
+
}
|
|
10672
|
+
if (mode === "pending") {
|
|
10673
|
+
defs.push({
|
|
10674
|
+
headerName: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05E7\u05D1\u05DC\u05D4",
|
|
10675
|
+
colId: "__receipt",
|
|
10676
|
+
minWidth: 250,
|
|
10677
|
+
sortable: false,
|
|
10678
|
+
filter: false,
|
|
10679
|
+
cellRenderer: canEdit ? ReceiptRenderer : void 0,
|
|
10680
|
+
cellRendererParams: { handlers },
|
|
10681
|
+
valueGetter: () => ""
|
|
10682
|
+
});
|
|
10683
|
+
} else {
|
|
10684
|
+
defs.push({
|
|
10685
|
+
headerName: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05E7\u05D1\u05DC\u05D4",
|
|
10686
|
+
colId: "__receipt",
|
|
10687
|
+
minWidth: 130,
|
|
10688
|
+
valueGetter: (p) => {
|
|
10689
|
+
var _a;
|
|
10690
|
+
return formatDate((_a = p.data) == null ? void 0 : _a.receiptDate);
|
|
10691
|
+
}
|
|
10692
|
+
});
|
|
10693
|
+
}
|
|
10694
|
+
defs.push({
|
|
10695
|
+
headerName: "\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA",
|
|
10696
|
+
colId: "__actions",
|
|
10697
|
+
minWidth: 220,
|
|
10698
|
+
sortable: false,
|
|
10699
|
+
filter: false,
|
|
10700
|
+
cellRenderer: ActionsRenderer,
|
|
10701
|
+
cellRendererParams: { handlers, editable: canEdit, mode }
|
|
10702
|
+
});
|
|
10703
|
+
return defs;
|
|
10704
|
+
}, [mode, config.paymentProofColumn, symbol, canEdit, handlers]);
|
|
10705
|
+
const finalColDefs = useMemo11(() => applyWidths(colDefs), [applyWidths, colDefs]);
|
|
10706
|
+
const total = useMemo11(() => payments.reduce((s, p) => s + p.total, 0), [payments]);
|
|
10707
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-3", children: [
|
|
10708
|
+
/* @__PURE__ */ jsx25("div", { className: "ag-theme-quartz w-full", style: { height: 480 }, children: /* @__PURE__ */ jsx25(
|
|
10709
|
+
AgGridReact3,
|
|
10710
|
+
{
|
|
10711
|
+
rowData: payments,
|
|
10712
|
+
columnDefs: finalColDefs,
|
|
10713
|
+
onColumnResized,
|
|
10714
|
+
defaultColDef: { sortable: true, resizable: true, filter: true, flex: 1 },
|
|
10715
|
+
getRowId: (p) => p.data.id,
|
|
10716
|
+
enableRtl: true,
|
|
10717
|
+
rowHeight: 52,
|
|
10718
|
+
headerHeight: 48,
|
|
10719
|
+
quickFilterText: search
|
|
10720
|
+
}
|
|
10721
|
+
) }),
|
|
10722
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-x-6 gap-y-1 text-sm font-medium text-slate-700 bg-slate-100 rounded-lg px-4 py-2", children: [
|
|
10723
|
+
/* @__PURE__ */ jsxs21("span", { children: [
|
|
10724
|
+
"\u05E1\u05DA \u05D4\u05DB\u05DC \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA: ",
|
|
10725
|
+
payments.length
|
|
10726
|
+
] }),
|
|
10727
|
+
/* @__PURE__ */ jsxs21("span", { children: [
|
|
10728
|
+
'\u05E1\u05D4"\u05DB \u05E1\u05DB\u05D5\u05DD: ',
|
|
10729
|
+
formatMoney(total, symbol)
|
|
10730
|
+
] })
|
|
10731
|
+
] })
|
|
10732
|
+
] });
|
|
10733
|
+
};
|
|
10734
|
+
|
|
10735
|
+
// src/components/PaymentReportsBlock/PaidPaymentsTab.tsx
|
|
10736
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
10737
|
+
var PaidPaymentsTab = (props) => /* @__PURE__ */ jsx26(PaymentsGrid, __spreadValues({ mode: "pending" }, props));
|
|
10738
|
+
|
|
10739
|
+
// src/components/PaymentReportsBlock/ReceiptsTab.tsx
|
|
10740
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
10741
|
+
var ReceiptsTab = (props) => /* @__PURE__ */ jsx27(PaymentsGrid, __spreadValues({ mode: "received" }, props));
|
|
10742
|
+
|
|
10743
|
+
// src/components/PaymentReportsBlock/PaymentDetailsModal.tsx
|
|
10744
|
+
import { useMemo as useMemo12 } from "react";
|
|
10745
|
+
import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10746
|
+
var isUserColumn3 = (c) => !!(c == null ? void 0 : c.name) && c.name !== "_id" && c.name !== "id" && !c.isHidden;
|
|
10747
|
+
var PaymentDetailsModal = ({ payment, config, symbol, columns, relationOptions, onClose }) => {
|
|
10748
|
+
const cols = useMemo12(() => {
|
|
10749
|
+
var _a;
|
|
10750
|
+
const byName = new Map(columns.filter(isUserColumn3).map((c) => [c.name, c]));
|
|
10751
|
+
const wanted = ((_a = config.reportDisplayColumns) == null ? void 0 : _a.length) ? config.reportDisplayColumns : Array.from(byName.keys());
|
|
10752
|
+
return wanted.filter((n) => n !== config.reportPaymentColumn && n !== config.reportReporterColumn).map((n) => byName.get(n)).filter(Boolean);
|
|
10753
|
+
}, [columns, config]);
|
|
10754
|
+
const sum = payment.reports.reduce((s, r) => s + r.amount, 0);
|
|
10755
|
+
return /* @__PURE__ */ jsxs22(
|
|
10756
|
+
Modal,
|
|
10757
|
+
{
|
|
10758
|
+
wide: true,
|
|
10759
|
+
title: `\u05E4\u05D9\u05E8\u05D5\u05D8 \u05EA\u05E9\u05DC\u05D5\u05DD${payment.reporterLabel ? ` \xB7 ${payment.reporterLabel}` : ""}`,
|
|
10760
|
+
onClose,
|
|
10761
|
+
footer: /* @__PURE__ */ jsx28(
|
|
10762
|
+
"button",
|
|
10763
|
+
{
|
|
10764
|
+
type: "button",
|
|
10765
|
+
onClick: onClose,
|
|
10766
|
+
className: "px-4 py-2 rounded-lg text-sm font-medium bg-white border border-slate-300 text-slate-600 hover:bg-slate-50 cursor-pointer",
|
|
10767
|
+
children: "\u05E1\u05D2\u05D5\u05E8"
|
|
10768
|
+
}
|
|
10769
|
+
),
|
|
10770
|
+
children: [
|
|
10771
|
+
payment.reports.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "text-slate-500", children: "\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05DE\u05E7\u05D5\u05E9\u05E8\u05D9\u05DD \u05DC\u05EA\u05E9\u05DC\u05D5\u05DD \u05D6\u05D4." }) : /* @__PURE__ */ jsx28("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs22("table", { className: "w-full text-sm text-right border-collapse", children: [
|
|
10772
|
+
/* @__PURE__ */ jsx28("thead", { children: /* @__PURE__ */ jsx28("tr", { className: "bg-slate-100 text-slate-600", children: cols.map((c) => /* @__PURE__ */ jsx28("th", { className: "px-3 py-2 font-semibold border-b border-slate-200 whitespace-nowrap", children: c.name }, c.name)) }) }),
|
|
10773
|
+
/* @__PURE__ */ jsx28("tbody", { children: payment.reports.map((r) => /* @__PURE__ */ jsx28("tr", { className: "border-b border-slate-100", children: cols.map((c) => {
|
|
10774
|
+
var _a;
|
|
10775
|
+
return /* @__PURE__ */ jsx28("td", { className: "px-3 py-2 whitespace-nowrap", children: String((_a = displayCell(r, c, relationOptions, symbol)) != null ? _a : "") }, c.name);
|
|
10776
|
+
}) }, r.id)) })
|
|
10777
|
+
] }) }),
|
|
10778
|
+
/* @__PURE__ */ jsxs22("div", { className: "mt-4 flex flex-wrap gap-x-6 gap-y-1 font-bold text-slate-800", children: [
|
|
10779
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
10780
|
+
"\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD: ",
|
|
10781
|
+
payment.reports.length
|
|
10782
|
+
] }),
|
|
10783
|
+
/* @__PURE__ */ jsxs22("span", { children: [
|
|
10784
|
+
"\u05E1\u05DB\u05D5\u05DD \u05D4\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD: ",
|
|
10785
|
+
formatMoney(sum, symbol)
|
|
10786
|
+
] }),
|
|
10787
|
+
Math.abs(sum - payment.total) > 5e-3 && /* @__PURE__ */ jsxs22("span", { className: "text-amber-700", children: [
|
|
10788
|
+
"\u05E1\u05DB\u05D5\u05DD \u05D4\u05EA\u05E9\u05DC\u05D5\u05DD: ",
|
|
10789
|
+
formatMoney(payment.total, symbol)
|
|
10790
|
+
] })
|
|
10791
|
+
] })
|
|
10792
|
+
]
|
|
10793
|
+
}
|
|
10794
|
+
);
|
|
10795
|
+
};
|
|
10796
|
+
|
|
10797
|
+
// src/components/PaymentReportsBlock/driveUpload.ts
|
|
10798
|
+
async function uploadFileToDrive(file, opts) {
|
|
10799
|
+
if (file.size <= 0) throw new Error(`\u05D4\u05E7\u05D5\u05D1\u05E5 "${file.name}" \u05E8\u05D9\u05E7`);
|
|
10800
|
+
const { orgId = "", folderName, executeAction } = opts;
|
|
10801
|
+
let formError = null;
|
|
10802
|
+
try {
|
|
10803
|
+
const w = typeof window !== "undefined" ? window : {};
|
|
10804
|
+
const apiBase = w.NEXT_PUBLIC_UNIVERSE_SERVER_URL || w.NEXT_PUBLIC_UNIVERSE_API_URL || process.env.NEXT_PUBLIC_UNIVERSE_SERVER_URL || process.env.NEXT_PUBLIC_UNIVERSE_API_URL || (typeof window !== "undefined" ? window.location.origin : "");
|
|
10805
|
+
const url = apiBase ? `${apiBase.replace(/\/$/, "")}/api/drive/upload` : "/api/drive/upload";
|
|
10806
|
+
const fd = new FormData();
|
|
10807
|
+
fd.append("file", file);
|
|
10808
|
+
fd.append("tableName", folderName);
|
|
10809
|
+
if (orgId) fd.append("orgId", orgId);
|
|
10810
|
+
const res2 = await fetch(url, { method: "POST", body: fd, headers: orgId ? { "x-org-id": orgId } : {} });
|
|
10811
|
+
if (res2.ok) {
|
|
10812
|
+
const json = await res2.json().catch(() => null);
|
|
10813
|
+
const d2 = (json == null ? void 0 : json.data) || json;
|
|
10814
|
+
if (d2 && (d2.fileId || d2.id)) {
|
|
10815
|
+
return {
|
|
10816
|
+
fileId: d2.fileId || d2.id,
|
|
10817
|
+
fileName: d2.fileName || d2.name || file.name,
|
|
10818
|
+
fileUrl: d2.fileUrl || d2.url || d2.link || "",
|
|
10819
|
+
url: d2.url || d2.fileUrl || d2.link || ""
|
|
10820
|
+
};
|
|
10821
|
+
}
|
|
10822
|
+
} else {
|
|
10823
|
+
const err = await res2.json().catch(() => null);
|
|
10824
|
+
formError = (err == null ? void 0 : err.error) || `\u05E9\u05D2\u05D9\u05D0\u05EA \u05D4\u05E2\u05DC\u05D0\u05D4 (${res2.status})`;
|
|
10825
|
+
}
|
|
10826
|
+
} catch (e) {
|
|
10827
|
+
formError = (e == null ? void 0 : e.message) || "\u05E9\u05D2\u05D9\u05D0\u05EA \u05E8\u05E9\u05EA";
|
|
10828
|
+
}
|
|
10829
|
+
if (!executeAction) throw new Error(formError || "\u05D4\u05E2\u05DC\u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E0\u05DB\u05E9\u05DC\u05D4");
|
|
10830
|
+
const base64 = await new Promise((resolve, reject) => {
|
|
10831
|
+
const reader = new FileReader();
|
|
10832
|
+
reader.onload = () => {
|
|
10833
|
+
const r = String(reader.result || "");
|
|
10834
|
+
resolve(r.includes(",") ? r.split(",")[1] : r);
|
|
10835
|
+
};
|
|
10836
|
+
reader.onerror = reject;
|
|
10837
|
+
reader.readAsDataURL(file);
|
|
10838
|
+
});
|
|
10839
|
+
const res = await executeAction("UPLOAD_DRIVE_FILE", {
|
|
10840
|
+
fileName: file.name,
|
|
10841
|
+
name: file.name,
|
|
10842
|
+
mimeType: file.type || "application/octet-stream",
|
|
10843
|
+
size: file.size,
|
|
10844
|
+
content: base64,
|
|
10845
|
+
base64,
|
|
10846
|
+
isBase64: true,
|
|
10847
|
+
tableName: folderName,
|
|
10848
|
+
orgId
|
|
10849
|
+
});
|
|
10850
|
+
if (!res || res.success === false || res.error) throw new Error((res == null ? void 0 : res.error) || formError || "\u05D4\u05E2\u05DC\u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E0\u05DB\u05E9\u05DC\u05D4");
|
|
10851
|
+
const d = (res == null ? void 0 : res.data) || res;
|
|
10852
|
+
const fileId = (d == null ? void 0 : d.fileId) || (d == null ? void 0 : d.id);
|
|
10853
|
+
if (!fileId) throw new Error(formError || "\u05D4\u05E2\u05DC\u05D0\u05EA \u05D4\u05E7\u05D5\u05D1\u05E5 \u05E0\u05DB\u05E9\u05DC\u05D4");
|
|
10854
|
+
return {
|
|
10855
|
+
fileId,
|
|
10856
|
+
fileName: d.fileName || d.name || file.name,
|
|
10857
|
+
fileUrl: d.fileUrl || d.url || d.link || "",
|
|
10858
|
+
url: d.url || d.fileUrl || d.link || ""
|
|
10859
|
+
};
|
|
10860
|
+
}
|
|
10861
|
+
|
|
10862
|
+
// src/components/PaymentReportsBlock/PaymentReportsBlock.tsx
|
|
10863
|
+
import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
10864
|
+
var EMPTY = { rows: [], columns: [], relationOptions: {} };
|
|
10865
|
+
var PaymentReportsBlock = (props) => {
|
|
10866
|
+
const { executeAction, orgId, role, readOnly, permissions, className } = props;
|
|
10867
|
+
const { addToast } = useToast();
|
|
10868
|
+
const config = useMemo13(() => {
|
|
10869
|
+
var _a, _b;
|
|
10870
|
+
const raw = (_a = props.config) != null ? _a : props.settings;
|
|
10871
|
+
if (!raw) return void 0;
|
|
10872
|
+
return ((_b = raw.config) == null ? void 0 : _b.reportsTableId) ? raw.config : raw;
|
|
10873
|
+
}, [props.config, props.settings]);
|
|
10874
|
+
const missing = missingPaymentReportsFields(config);
|
|
10875
|
+
const symbol = (config == null ? void 0 : config.currencySymbol) || "\u20AA";
|
|
10876
|
+
const canEdit = !readOnly && ((permissions == null ? void 0 : permissions.canUpdate) !== void 0 ? !!permissions.canUpdate : role ? role === "OWNER" || role === "EDITOR" : true);
|
|
10877
|
+
const [tab, setTab] = useState22("unpaid");
|
|
10878
|
+
const [month, setMonth] = useState22("");
|
|
10879
|
+
const [search, setSearch] = useState22("");
|
|
10880
|
+
const [showPaid, setShowPaid] = useState22(false);
|
|
10881
|
+
const [reportsRes, setReportsRes] = useState22(EMPTY);
|
|
10882
|
+
const [paymentsRes, setPaymentsRes] = useState22(EMPTY);
|
|
10883
|
+
const [loading, setLoading] = useState22(true);
|
|
10884
|
+
const [error, setError] = useState22(null);
|
|
10885
|
+
const [details, setDetails] = useState22(null);
|
|
10886
|
+
const [confirm, setConfirm] = useState22(null);
|
|
10887
|
+
const [confirmBusy, setConfirmBusy] = useState22(false);
|
|
10888
|
+
const toastOk = useCallback16((message) => addToast({ type: "success", message }), [addToast]);
|
|
10889
|
+
const toastErr = useCallback16((e) => addToast({ type: "error", message: (e == null ? void 0 : e.message) || String(e) }), [addToast]);
|
|
10890
|
+
const load = useCallback16(
|
|
10891
|
+
async (silent = false) => {
|
|
10892
|
+
if (!config || missing.length) return;
|
|
10893
|
+
if (!silent) setLoading(true);
|
|
10894
|
+
setError(null);
|
|
10895
|
+
try {
|
|
10896
|
+
const [r, p] = await Promise.all([
|
|
10897
|
+
fetchAllTableData(executeAction, config.reportsTableId),
|
|
10898
|
+
fetchAllTableData(executeAction, config.paymentsTableId)
|
|
10899
|
+
]);
|
|
10900
|
+
setReportsRes(r);
|
|
10901
|
+
setPaymentsRes(p);
|
|
10902
|
+
} catch (e) {
|
|
10903
|
+
setError((e == null ? void 0 : e.message) || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
|
|
10904
|
+
} finally {
|
|
10905
|
+
setLoading(false);
|
|
10906
|
+
}
|
|
10907
|
+
},
|
|
10908
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10909
|
+
[config == null ? void 0 : config.reportsTableId, config == null ? void 0 : config.paymentsTableId, missing.length, executeAction]
|
|
10910
|
+
);
|
|
10911
|
+
useEffect15(() => {
|
|
10912
|
+
load();
|
|
10913
|
+
}, [load]);
|
|
10914
|
+
const model = useMemo13(
|
|
10915
|
+
() => config && !missing.length ? buildModel(config, reportsRes, paymentsRes) : { reports: [], payments: [] },
|
|
10916
|
+
[config, missing.length, reportsRes, paymentsRes]
|
|
10917
|
+
);
|
|
10918
|
+
const months = useMemo13(() => {
|
|
10919
|
+
const set = /* @__PURE__ */ new Set();
|
|
10920
|
+
model.reports.forEach((r) => r.month && set.add(r.month));
|
|
10921
|
+
return Array.from(set).sort().reverse();
|
|
10922
|
+
}, [model.reports]);
|
|
10923
|
+
const reportsInMonth = useMemo13(
|
|
10924
|
+
() => model.reports.filter((r) => (!month || r.month === month) && (showPaid || !r.paymentId)),
|
|
10925
|
+
[model.reports, month, showPaid]
|
|
10926
|
+
);
|
|
10927
|
+
const pendingPayments = useMemo13(
|
|
10928
|
+
() => model.payments.filter((p) => !p.receiptDate && (!month || p.months.includes(month))),
|
|
10929
|
+
[model.payments, month]
|
|
10930
|
+
);
|
|
10931
|
+
const receivedPayments = useMemo13(
|
|
10932
|
+
() => model.payments.filter((p) => !!p.receiptDate && (!month || p.months.includes(month))),
|
|
10933
|
+
[model.payments, month]
|
|
10934
|
+
);
|
|
10935
|
+
const unpaidCount = model.reports.filter((r) => !r.paymentId).length;
|
|
10936
|
+
const paymentLabels = useMemo13(() => {
|
|
10937
|
+
const m = {};
|
|
10938
|
+
model.payments.forEach((p) => {
|
|
10939
|
+
m[p.id] = `${p.receiptDate ? "\u05D4\u05EA\u05E7\u05D1\u05DC" : "\u05E9\u05D5\u05DC\u05DD"} \xB7 ${formatMoney(p.total, symbol)}`;
|
|
10940
|
+
});
|
|
10941
|
+
return m;
|
|
10942
|
+
}, [model.payments, symbol]);
|
|
10943
|
+
const base = { reportsTableId: config == null ? void 0 : config.reportsTableId, paymentsTableId: config == null ? void 0 : config.paymentsTableId };
|
|
10944
|
+
const handlers = useRef17(null);
|
|
10945
|
+
handlers.current = {
|
|
10946
|
+
onPay: async (reportIds) => {
|
|
10947
|
+
var _a;
|
|
10948
|
+
try {
|
|
10949
|
+
const res = await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.CREATE_PAYMENT, __spreadProps(__spreadValues({}, base), { reportIds }));
|
|
10950
|
+
toastOk(`\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05E0\u05D5\u05E6\u05E8 \u05D1\u05E1\u05DA ${formatMoney(Number((res == null ? void 0 : res.total) || 0), symbol)} (${(_a = res == null ? void 0 : res.count) != null ? _a : reportIds.length} \u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD)`);
|
|
10951
|
+
await load(true);
|
|
10952
|
+
} catch (e) {
|
|
10953
|
+
toastErr(e);
|
|
10954
|
+
throw e;
|
|
10955
|
+
}
|
|
10956
|
+
},
|
|
10957
|
+
onDeleteReports: (ids) => setConfirm({ kind: "deleteReports", ids }),
|
|
10958
|
+
onEditCell: (reportId, column, value) => {
|
|
10959
|
+
setReportsRes((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
10960
|
+
rows: prev.rows.map((r) => r.id === reportId ? __spreadProps(__spreadValues({}, r), { data: __spreadProps(__spreadValues({}, r.data), { [column]: value }) }) : r)
|
|
10961
|
+
}));
|
|
10962
|
+
runAction(executeAction, "UPDATE_RECORD", {
|
|
10963
|
+
tableId: config.reportsTableId,
|
|
10964
|
+
recordId: reportId,
|
|
10965
|
+
data: { [column]: value }
|
|
10966
|
+
}).catch((e) => {
|
|
10967
|
+
toastErr(e);
|
|
10968
|
+
load(true);
|
|
10969
|
+
});
|
|
10970
|
+
},
|
|
10971
|
+
onDetails: (p) => setDetails(p),
|
|
10972
|
+
onConfirmReceipt: async (paymentId, date) => {
|
|
10973
|
+
try {
|
|
10974
|
+
await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.CONFIRM_RECEIPT, __spreadProps(__spreadValues({}, base), { paymentId, receiptDate: date }));
|
|
10975
|
+
toastOk("\u05D4\u05E7\u05D1\u05DC\u05D4 \u05D0\u05D5\u05E9\u05E8\u05D4 \u05D5\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05E2\u05D1\u05E8 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA \u05D4\u05E7\u05D1\u05DC\u05D5\u05EA");
|
|
10976
|
+
await load(true);
|
|
10977
|
+
} catch (e) {
|
|
10978
|
+
toastErr(e);
|
|
10979
|
+
}
|
|
10980
|
+
},
|
|
10981
|
+
onCancelPayment: (payment) => setConfirm({ kind: "cancelPayment", payment }),
|
|
10982
|
+
onUndoReceipt: (payment) => setConfirm({ kind: "undoReceipt", payment }),
|
|
10983
|
+
onUploadProof: async (paymentId, file) => {
|
|
10984
|
+
try {
|
|
10985
|
+
const driveFile = await uploadFileToDrive(file, {
|
|
10986
|
+
orgId: orgId || (config == null ? void 0 : config.orgId),
|
|
10987
|
+
folderName: (config == null ? void 0 : config.proofFolderName) || "\u05D0\u05E1\u05DE\u05DB\u05EA\u05D0\u05D5\u05EA \u05EA\u05E9\u05DC\u05D5\u05DD",
|
|
10988
|
+
executeAction
|
|
10989
|
+
});
|
|
10990
|
+
await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.SET_PROOF, __spreadProps(__spreadValues({}, base), { paymentId, file: driveFile }));
|
|
10991
|
+
toastOk("\u05D4\u05D0\u05E1\u05DE\u05DB\u05EA\u05D0 \u05D4\u05D5\u05E2\u05DC\u05EA\u05D4");
|
|
10992
|
+
await load(true);
|
|
10993
|
+
} catch (e) {
|
|
10994
|
+
toastErr(e);
|
|
10995
|
+
}
|
|
10996
|
+
},
|
|
10997
|
+
onRemoveProof: async (paymentId) => {
|
|
10998
|
+
try {
|
|
10999
|
+
const res = await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.SET_PROOF, __spreadProps(__spreadValues({}, base), { paymentId, file: null }));
|
|
11000
|
+
if (res == null ? void 0 : res.fileWarning) addToast({ type: "warning", message: res.fileWarning });
|
|
11001
|
+
await load(true);
|
|
11002
|
+
} catch (e) {
|
|
11003
|
+
toastErr(e);
|
|
11004
|
+
}
|
|
11005
|
+
}
|
|
11006
|
+
};
|
|
11007
|
+
const runConfirmed = async () => {
|
|
11008
|
+
if (!confirm) return;
|
|
11009
|
+
setConfirmBusy(true);
|
|
11010
|
+
try {
|
|
11011
|
+
if (confirm.kind === "deleteReports") {
|
|
11012
|
+
await runAction(executeAction, "DELETE_RECORD", { tableId: config.reportsTableId, ids: confirm.ids });
|
|
11013
|
+
toastOk("\u05D4\u05D3\u05D9\u05D5\u05D5\u05D7 \u05E0\u05DE\u05D7\u05E7");
|
|
11014
|
+
} else if (confirm.kind === "cancelPayment") {
|
|
11015
|
+
const res = await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.CANCEL_PAYMENT, __spreadProps(__spreadValues({}, base), { paymentId: confirm.payment.id }));
|
|
11016
|
+
toastOk("\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05D1\u05D5\u05D8\u05DC \u05D5\u05D4\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05D7\u05D6\u05E8\u05D5 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA \u05D4\u05E8\u05D0\u05E9\u05D5\u05E0\u05D4");
|
|
11017
|
+
if (res == null ? void 0 : res.fileWarning) addToast({ type: "warning", message: res.fileWarning });
|
|
11018
|
+
} else {
|
|
11019
|
+
await runAction(executeAction, PAYMENT_REPORTS_ACTIONS.UNDO_RECEIPT, __spreadProps(__spreadValues({}, base), { paymentId: confirm.payment.id }));
|
|
11020
|
+
toastOk('\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E7\u05D1\u05DC\u05D4 \u05D1\u05D5\u05D8\u05DC \u05D5\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05D7\u05D6\u05E8 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA "\u05E9\u05D5\u05DC\u05DD \u05DC\u05DE\u05D3\u05E8\u05D9\u05DB\u05D9\u05DD"');
|
|
11021
|
+
}
|
|
11022
|
+
setConfirm(null);
|
|
11023
|
+
await load(true);
|
|
11024
|
+
} catch (e) {
|
|
11025
|
+
toastErr(e);
|
|
11026
|
+
} finally {
|
|
11027
|
+
setConfirmBusy(false);
|
|
11028
|
+
}
|
|
11029
|
+
};
|
|
11030
|
+
if (!config || missing.length) {
|
|
11031
|
+
return /* @__PURE__ */ jsx29("div", { dir: "rtl", className: "p-6 rounded-xl border border-dashed border-slate-300 text-slate-500 text-sm text-center", children: '\u05D4\u05E8\u05DB\u05D9\u05D1 "\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05DC\u05EA\u05E9\u05DC\u05D5\u05DD" \u05E2\u05D3\u05D9\u05D9\u05DF \u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8 \u05D1\u05DE\u05DC\u05D5\u05D0\u05D5. \u05D9\u05E9 \u05DC\u05D4\u05E9\u05DC\u05D9\u05DD \u05D0\u05EA \u05D4\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05D1\u05E2\u05D5\u05E8\u05DA \u05D4\u05E2\u05DE\u05D5\u05D3.' });
|
|
11032
|
+
}
|
|
11033
|
+
const tabs = [
|
|
11034
|
+
{ key: "unpaid", label: "\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD (\u05D8\u05E8\u05DD \u05E9\u05D5\u05DC\u05DE\u05D5)", count: unpaidCount },
|
|
11035
|
+
{ key: "paid", label: "\u05E9\u05D5\u05DC\u05DD (\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05E7\u05D1\u05DC\u05D4)", count: model.payments.filter((p) => !p.receiptDate).length },
|
|
11036
|
+
{ key: "receipts", label: '\u05E7\u05D1\u05DC\u05D5\u05EA \u05D5\u05D4\u05E0\u05D4"\u05D7', count: model.payments.filter((p) => !!p.receiptDate).length }
|
|
11037
|
+
];
|
|
11038
|
+
return /* @__PURE__ */ jsxs23("div", { dir: "rtl", className: `w-full flex flex-col gap-4 ${className || ""}`, children: [
|
|
11039
|
+
config.title && /* @__PURE__ */ jsx29("h2", { className: "text-2xl font-bold text-slate-800", children: config.title }),
|
|
11040
|
+
/* @__PURE__ */ jsx29("div", { className: "flex border-b border-slate-200 overflow-x-auto", children: tabs.map((t) => /* @__PURE__ */ jsxs23(
|
|
11041
|
+
"button",
|
|
11042
|
+
{
|
|
11043
|
+
type: "button",
|
|
11044
|
+
onClick: () => setTab(t.key),
|
|
11045
|
+
className: `px-5 py-3 text-sm font-semibold whitespace-nowrap border-b-2 -mb-px cursor-pointer ${tab === t.key ? "border-blue-600 text-blue-700" : "border-transparent text-slate-500 hover:text-slate-800"}`,
|
|
11046
|
+
children: [
|
|
11047
|
+
t.label,
|
|
11048
|
+
" ",
|
|
11049
|
+
/* @__PURE__ */ jsxs23("span", { className: "text-xs opacity-70", children: [
|
|
11050
|
+
"(",
|
|
11051
|
+
t.count,
|
|
11052
|
+
")"
|
|
11053
|
+
] })
|
|
11054
|
+
]
|
|
11055
|
+
},
|
|
11056
|
+
t.key
|
|
11057
|
+
)) }),
|
|
11058
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
11059
|
+
/* @__PURE__ */ jsx29(
|
|
11060
|
+
"input",
|
|
11061
|
+
{
|
|
11062
|
+
type: "text",
|
|
11063
|
+
value: search,
|
|
11064
|
+
onChange: (e) => setSearch(e.target.value),
|
|
11065
|
+
placeholder: "\u05D7\u05D9\u05E4\u05D5\u05E9 \u05D7\u05D5\u05E4\u05E9\u05D9...",
|
|
11066
|
+
className: "border border-slate-300 rounded-lg px-3 py-2 text-sm bg-white w-64"
|
|
11067
|
+
}
|
|
11068
|
+
),
|
|
11069
|
+
config.reportDateColumn && /* @__PURE__ */ jsxs23(
|
|
11070
|
+
"select",
|
|
11071
|
+
{
|
|
11072
|
+
value: month,
|
|
11073
|
+
onChange: (e) => setMonth(e.target.value),
|
|
11074
|
+
className: "border border-slate-300 rounded-lg px-3 py-2 text-sm bg-white",
|
|
11075
|
+
children: [
|
|
11076
|
+
/* @__PURE__ */ jsx29("option", { value: "", children: "\u05DB\u05DC \u05D4\u05D7\u05D5\u05D3\u05E9\u05D9\u05DD" }),
|
|
11077
|
+
months.map((m) => /* @__PURE__ */ jsx29("option", { value: m, children: monthLabel(m) }, m))
|
|
11078
|
+
]
|
|
11079
|
+
}
|
|
11080
|
+
)
|
|
11081
|
+
] }),
|
|
11082
|
+
error && /* @__PURE__ */ jsxs23("div", { className: "rounded-lg bg-rose-50 border border-rose-200 text-rose-700 text-sm px-4 py-3 flex items-center justify-between", children: [
|
|
11083
|
+
/* @__PURE__ */ jsx29("span", { children: error }),
|
|
11084
|
+
/* @__PURE__ */ jsx29("button", { type: "button", onClick: () => load(), className: "underline cursor-pointer", children: "\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1" })
|
|
11085
|
+
] }),
|
|
11086
|
+
loading ? /* @__PURE__ */ jsx29("div", { className: "py-16 text-center text-slate-400 text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD..." }) : tab === "unpaid" ? /* @__PURE__ */ jsx29(
|
|
11087
|
+
UnpaidReportsTab,
|
|
11088
|
+
{
|
|
11089
|
+
config,
|
|
11090
|
+
symbol,
|
|
11091
|
+
canEdit,
|
|
11092
|
+
reports: reportsInMonth,
|
|
11093
|
+
columns: reportsRes.columns,
|
|
11094
|
+
relationOptions: reportsRes.relationOptions,
|
|
11095
|
+
search,
|
|
11096
|
+
showPaid,
|
|
11097
|
+
onToggleShowPaid: setShowPaid,
|
|
11098
|
+
paymentLabels,
|
|
11099
|
+
handlers
|
|
11100
|
+
}
|
|
11101
|
+
) : tab === "paid" ? /* @__PURE__ */ jsx29(PaidPaymentsTab, { config, symbol, canEdit, payments: pendingPayments, search, handlers }) : /* @__PURE__ */ jsx29(ReceiptsTab, { config, symbol, canEdit, payments: receivedPayments, search, handlers }),
|
|
11102
|
+
details && /* @__PURE__ */ jsx29(
|
|
11103
|
+
PaymentDetailsModal,
|
|
11104
|
+
{
|
|
11105
|
+
payment: model.payments.find((p) => p.id === details.id) || details,
|
|
11106
|
+
config,
|
|
11107
|
+
symbol,
|
|
11108
|
+
columns: reportsRes.columns,
|
|
11109
|
+
relationOptions: reportsRes.relationOptions,
|
|
11110
|
+
onClose: () => setDetails(null)
|
|
11111
|
+
}
|
|
11112
|
+
),
|
|
11113
|
+
confirm && /* @__PURE__ */ jsx29(
|
|
11114
|
+
ConfirmModal,
|
|
11115
|
+
{
|
|
11116
|
+
danger: true,
|
|
11117
|
+
busy: confirmBusy,
|
|
11118
|
+
title: confirm.kind === "deleteReports" ? "\u05DE\u05D7\u05D9\u05E7\u05EA \u05D3\u05D9\u05D5\u05D5\u05D7" : confirm.kind === "cancelPayment" ? "\u05D1\u05D9\u05D8\u05D5\u05DC \u05EA\u05E9\u05DC\u05D5\u05DD" : "\u05D1\u05D9\u05D8\u05D5\u05DC \u05D0\u05D9\u05E9\u05D5\u05E8 \u05E7\u05D1\u05DC\u05D4",
|
|
11119
|
+
confirmLabel: confirm.kind === "deleteReports" ? "\u05DE\u05D7\u05E7" : "\u05D1\u05D8\u05DC",
|
|
11120
|
+
onConfirm: runConfirmed,
|
|
11121
|
+
onClose: () => setConfirm(null),
|
|
11122
|
+
message: confirm.kind === "deleteReports" ? /* @__PURE__ */ jsx29("p", { children: "\u05DC\u05DE\u05D7\u05D5\u05E7 \u05D0\u05EA \u05D4\u05D3\u05D9\u05D5\u05D5\u05D7? \u05D4\u05E4\u05E2\u05D5\u05DC\u05D4 \u05D0\u05D9\u05E0\u05D4 \u05D4\u05E4\u05D9\u05DB\u05D4." }) : confirm.kind === "cancelPayment" ? /* @__PURE__ */ jsxs23("p", { children: [
|
|
11123
|
+
'\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05D9\u05D9\u05DE\u05D7\u05E7, \u05D4\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD \u05D9\u05D7\u05D6\u05E8\u05D5 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA "\u05D3\u05D9\u05D5\u05D5\u05D7\u05D9\u05DD (\u05D8\u05E8\u05DD \u05E9\u05D5\u05DC\u05DE\u05D5)"',
|
|
11124
|
+
confirm.payment.proof.length > 0 ? ", \u05D5\u05D4\u05D0\u05E1\u05DE\u05DB\u05EA\u05D0 \u05EA\u05D9\u05DE\u05D7\u05E7 \u05D2\u05DD \u05DE-Google Drive" : "",
|
|
11125
|
+
". \u05DC\u05D4\u05DE\u05E9\u05D9\u05DA?"
|
|
11126
|
+
] }) : /* @__PURE__ */ jsx29("p", { children: '\u05D0\u05D9\u05E9\u05D5\u05E8 \u05D4\u05E7\u05D1\u05DC\u05D4 \u05D9\u05D1\u05D5\u05D8\u05DC \u05D5\u05D4\u05EA\u05E9\u05DC\u05D5\u05DD \u05D9\u05D7\u05D6\u05D5\u05E8 \u05DC\u05DC\u05E9\u05D5\u05E0\u05D9\u05EA "\u05E9\u05D5\u05DC\u05DD (\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05E7\u05D1\u05DC\u05D4)". \u05DC\u05D4\u05DE\u05E9\u05D9\u05DA?' })
|
|
11127
|
+
}
|
|
11128
|
+
)
|
|
11129
|
+
] });
|
|
11130
|
+
};
|
|
11131
|
+
|
|
9970
11132
|
// src/components/WhatsAppComponent/WhatsAppComponent.tsx
|
|
9971
|
-
import
|
|
11133
|
+
import React26 from "react";
|
|
9972
11134
|
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";
|
|
9973
11135
|
|
|
9974
11136
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
9975
|
-
import { useState as
|
|
11137
|
+
import { useState as useState23, useEffect as useEffect16, useRef as useRef18, useMemo as useMemo14 } from "react";
|
|
9976
11138
|
import {
|
|
9977
11139
|
X as X9,
|
|
9978
11140
|
Plus,
|
|
@@ -10115,7 +11277,7 @@ function readFileAsBase64(file) {
|
|
|
10115
11277
|
}
|
|
10116
11278
|
|
|
10117
11279
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
10118
|
-
import { Fragment as
|
|
11280
|
+
import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
10119
11281
|
function CreateTemplateModal({
|
|
10120
11282
|
isOpen,
|
|
10121
11283
|
onClose,
|
|
@@ -10125,26 +11287,26 @@ function CreateTemplateModal({
|
|
|
10125
11287
|
executeAction,
|
|
10126
11288
|
orgId
|
|
10127
11289
|
}) {
|
|
10128
|
-
const [templateName, setTemplateName] =
|
|
10129
|
-
const [language, setLanguage] =
|
|
10130
|
-
const [category, setCategory] =
|
|
10131
|
-
const [bodyText, setBodyText] =
|
|
10132
|
-
const [variableSamples, setVariableSamples] =
|
|
10133
|
-
const [hasFileHeader, setHasFileHeader] =
|
|
10134
|
-
const [selectedFile, setSelectedFile] =
|
|
10135
|
-
const [fileBase64, setFileBase64] =
|
|
10136
|
-
const [buttons, setButtons] =
|
|
10137
|
-
const [isAddButtonOpen, setIsAddButtonOpen] =
|
|
10138
|
-
const addButtonDropdownRef =
|
|
10139
|
-
const [isSubmitting, setIsSubmitting] =
|
|
10140
|
-
const [submittingStep, setSubmittingStep] =
|
|
10141
|
-
const [submitError, setSubmitError] =
|
|
10142
|
-
const [fileError, setFileError] =
|
|
10143
|
-
const textareaRef =
|
|
10144
|
-
const fileInputRef =
|
|
10145
|
-
const emojiPickerRef =
|
|
10146
|
-
const [isEmojiPickerOpen, setIsEmojiPickerOpen] =
|
|
10147
|
-
|
|
11290
|
+
const [templateName, setTemplateName] = useState23("");
|
|
11291
|
+
const [language, setLanguage] = useState23("he");
|
|
11292
|
+
const [category, setCategory] = useState23("MARKETING");
|
|
11293
|
+
const [bodyText, setBodyText] = useState23("");
|
|
11294
|
+
const [variableSamples, setVariableSamples] = useState23({});
|
|
11295
|
+
const [hasFileHeader, setHasFileHeader] = useState23(false);
|
|
11296
|
+
const [selectedFile, setSelectedFile] = useState23(null);
|
|
11297
|
+
const [fileBase64, setFileBase64] = useState23("");
|
|
11298
|
+
const [buttons, setButtons] = useState23([]);
|
|
11299
|
+
const [isAddButtonOpen, setIsAddButtonOpen] = useState23(false);
|
|
11300
|
+
const addButtonDropdownRef = useRef18(null);
|
|
11301
|
+
const [isSubmitting, setIsSubmitting] = useState23(false);
|
|
11302
|
+
const [submittingStep, setSubmittingStep] = useState23("");
|
|
11303
|
+
const [submitError, setSubmitError] = useState23(null);
|
|
11304
|
+
const [fileError, setFileError] = useState23(null);
|
|
11305
|
+
const textareaRef = useRef18(null);
|
|
11306
|
+
const fileInputRef = useRef18(null);
|
|
11307
|
+
const emojiPickerRef = useRef18(null);
|
|
11308
|
+
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = useState23(false);
|
|
11309
|
+
useEffect16(() => {
|
|
10148
11310
|
function handleClickOutside(event) {
|
|
10149
11311
|
if (emojiPickerRef.current && !emojiPickerRef.current.contains(event.target)) {
|
|
10150
11312
|
setIsEmojiPickerOpen(false);
|
|
@@ -10168,7 +11330,7 @@ function CreateTemplateModal({
|
|
|
10168
11330
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
10169
11331
|
};
|
|
10170
11332
|
}, [isEmojiPickerOpen, isAddButtonOpen]);
|
|
10171
|
-
|
|
11333
|
+
useEffect16(() => {
|
|
10172
11334
|
if (isOpen) {
|
|
10173
11335
|
setTemplateName("");
|
|
10174
11336
|
setLanguage("he");
|
|
@@ -10187,10 +11349,10 @@ function CreateTemplateModal({
|
|
|
10187
11349
|
setIsEmojiPickerOpen(false);
|
|
10188
11350
|
}
|
|
10189
11351
|
}, [isOpen]);
|
|
10190
|
-
const uniqueVariables =
|
|
11352
|
+
const uniqueVariables = useMemo14(() => {
|
|
10191
11353
|
return extractUniqueVariableIndices(bodyText);
|
|
10192
11354
|
}, [bodyText]);
|
|
10193
|
-
|
|
11355
|
+
useEffect16(() => {
|
|
10194
11356
|
setVariableSamples((prev) => {
|
|
10195
11357
|
const next = {};
|
|
10196
11358
|
uniqueVariables.forEach((idx) => {
|
|
@@ -10201,7 +11363,7 @@ function CreateTemplateModal({
|
|
|
10201
11363
|
}, [uniqueVariables]);
|
|
10202
11364
|
const isNameEmpty = templateName.trim().length === 0;
|
|
10203
11365
|
const isNamePatternValid = isValidTemplateName(templateName);
|
|
10204
|
-
const isNameDuplicate =
|
|
11366
|
+
const isNameDuplicate = useMemo14(() => {
|
|
10205
11367
|
const trimmedName = templateName.trim().toLowerCase();
|
|
10206
11368
|
if (!trimmedName) return false;
|
|
10207
11369
|
if (existingTemplates && existingTemplates.length > 0) {
|
|
@@ -10211,9 +11373,9 @@ function CreateTemplateModal({
|
|
|
10211
11373
|
}
|
|
10212
11374
|
return isDuplicateTemplateName(trimmedName, existingTemplateNames, language);
|
|
10213
11375
|
}, [templateName, language, existingTemplates, existingTemplateNames]);
|
|
10214
|
-
const ratioInfo =
|
|
10215
|
-
const seqInfo =
|
|
10216
|
-
const validationResult =
|
|
11376
|
+
const ratioInfo = useMemo14(() => validateWordToVariableRatio(bodyText), [bodyText]);
|
|
11377
|
+
const seqInfo = useMemo14(() => validateSequentialVariables(bodyText), [bodyText]);
|
|
11378
|
+
const validationResult = useMemo14(() => {
|
|
10217
11379
|
return validateWhatsAppTemplate({
|
|
10218
11380
|
name: templateName,
|
|
10219
11381
|
language,
|
|
@@ -10467,12 +11629,12 @@ function CreateTemplateModal({
|
|
|
10467
11629
|
}
|
|
10468
11630
|
};
|
|
10469
11631
|
if (!isOpen) return null;
|
|
10470
|
-
return /* @__PURE__ */
|
|
11632
|
+
return /* @__PURE__ */ jsx30(
|
|
10471
11633
|
"div",
|
|
10472
11634
|
{
|
|
10473
11635
|
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-200",
|
|
10474
11636
|
dir: "rtl",
|
|
10475
|
-
children: /* @__PURE__ */
|
|
11637
|
+
children: /* @__PURE__ */ jsxs24(
|
|
10476
11638
|
"div",
|
|
10477
11639
|
{
|
|
10478
11640
|
className: "bg-white rounded-2xl border border-slate-200 shadow-2xl w-full max-w-2xl max-h-[92vh] flex flex-col overflow-hidden animate-in zoom-in-95 duration-150",
|
|
@@ -10480,43 +11642,43 @@ function CreateTemplateModal({
|
|
|
10480
11642
|
"aria-modal": "true",
|
|
10481
11643
|
"aria-labelledby": "modal-title",
|
|
10482
11644
|
children: [
|
|
10483
|
-
/* @__PURE__ */
|
|
10484
|
-
/* @__PURE__ */
|
|
10485
|
-
/* @__PURE__ */
|
|
10486
|
-
/* @__PURE__ */
|
|
10487
|
-
/* @__PURE__ */
|
|
10488
|
-
/* @__PURE__ */
|
|
11645
|
+
/* @__PURE__ */ jsxs24("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
11646
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2.5", children: [
|
|
11647
|
+
/* @__PURE__ */ jsx30("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx30(Plus, { className: "w-4 h-4" }) }),
|
|
11648
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
11649
|
+
/* @__PURE__ */ jsx30("h3", { id: "modal-title", className: "text-sm font-bold text-slate-900", children: "\u05D9\u05E6\u05D9\u05E8\u05EA \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4" }),
|
|
11650
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-slate-500", children: "\u05D4\u05D2\u05D3\u05E8\u05EA \u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4 \u05D5\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta Cloud API" })
|
|
10489
11651
|
] })
|
|
10490
11652
|
] }),
|
|
10491
|
-
/* @__PURE__ */
|
|
11653
|
+
/* @__PURE__ */ jsx30(
|
|
10492
11654
|
"button",
|
|
10493
11655
|
{
|
|
10494
11656
|
type: "button",
|
|
10495
11657
|
onClick: onClose,
|
|
10496
11658
|
className: "p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer",
|
|
10497
11659
|
"aria-label": "\u05E1\u05D2\u05D5\u05E8",
|
|
10498
|
-
children: /* @__PURE__ */
|
|
11660
|
+
children: /* @__PURE__ */ jsx30(X9, { className: "w-5 h-5" })
|
|
10499
11661
|
}
|
|
10500
11662
|
)
|
|
10501
11663
|
] }),
|
|
10502
|
-
/* @__PURE__ */
|
|
10503
|
-
/* @__PURE__ */
|
|
10504
|
-
submitError && /* @__PURE__ */
|
|
10505
|
-
/* @__PURE__ */
|
|
10506
|
-
/* @__PURE__ */
|
|
11664
|
+
/* @__PURE__ */ jsxs24("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
|
|
11665
|
+
/* @__PURE__ */ jsxs24("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
|
|
11666
|
+
submitError && /* @__PURE__ */ jsxs24("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-800 flex items-center gap-2", children: [
|
|
11667
|
+
/* @__PURE__ */ jsx30(AlertCircle2, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
11668
|
+
/* @__PURE__ */ jsx30("span", { children: submitError })
|
|
10507
11669
|
] }),
|
|
10508
|
-
/* @__PURE__ */
|
|
10509
|
-
/* @__PURE__ */
|
|
10510
|
-
/* @__PURE__ */
|
|
11670
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1.5", children: [
|
|
11671
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
11672
|
+
/* @__PURE__ */ jsxs24("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
10511
11673
|
"\u05E9\u05DD \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4 ",
|
|
10512
|
-
/* @__PURE__ */
|
|
11674
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
10513
11675
|
] }),
|
|
10514
|
-
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */
|
|
10515
|
-
/* @__PURE__ */
|
|
11676
|
+
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ jsxs24("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
|
|
11677
|
+
/* @__PURE__ */ jsx30(CheckCircle22, { className: "w-3.5 h-3.5" }),
|
|
10516
11678
|
" \u05E9\u05DD \u05EA\u05E7\u05D9\u05DF"
|
|
10517
11679
|
] })
|
|
10518
11680
|
] }),
|
|
10519
|
-
/* @__PURE__ */
|
|
11681
|
+
/* @__PURE__ */ jsx30(
|
|
10520
11682
|
"input",
|
|
10521
11683
|
{
|
|
10522
11684
|
type: "text",
|
|
@@ -10528,47 +11690,47 @@ function CreateTemplateModal({
|
|
|
10528
11690
|
required: true
|
|
10529
11691
|
}
|
|
10530
11692
|
),
|
|
10531
|
-
/* @__PURE__ */
|
|
10532
|
-
!isNameEmpty && isNameDuplicate && /* @__PURE__ */
|
|
10533
|
-
/* @__PURE__ */
|
|
11693
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400 mt-1", children: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA \u05E7\u05D8\u05E0\u05D5\u05EA \u05D1\u05D0\u05E0\u05D2\u05DC\u05D9\u05EA, \u05DE\u05E1\u05E4\u05E8\u05D9\u05DD \u05D5\u05E7\u05D5\u05D5\u05D9\u05DD \u05EA\u05D7\u05EA\u05D5\u05E0\u05D9\u05DD \u05D1\u05DC\u05D1\u05D3." }),
|
|
11694
|
+
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ jsxs24("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
|
|
11695
|
+
/* @__PURE__ */ jsx30(AlertCircle2, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
10534
11696
|
"\u05E9\u05DD \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA \u05DB\u05D1\u05E8 \u05E7\u05D9\u05D9\u05DD \u05D1\u05D7\u05E9\u05D1\u05D5\u05DF \u05E2\u05D1\u05D5\u05E8 \u05E9\u05E4\u05D4 \u05D6\u05D5 (",
|
|
10535
11697
|
language,
|
|
10536
11698
|
"). \u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E9\u05DD \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05D0\u05D5 \u05E9\u05E4\u05D4 \u05D0\u05D7\u05E8\u05EA."
|
|
10537
11699
|
] })
|
|
10538
11700
|
] }),
|
|
10539
|
-
/* @__PURE__ */
|
|
10540
|
-
/* @__PURE__ */
|
|
10541
|
-
/* @__PURE__ */
|
|
10542
|
-
/* @__PURE__ */
|
|
11701
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11702
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1.5", children: [
|
|
11703
|
+
/* @__PURE__ */ jsx30("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
|
|
11704
|
+
/* @__PURE__ */ jsx30(
|
|
10543
11705
|
"select",
|
|
10544
11706
|
{
|
|
10545
11707
|
value: language,
|
|
10546
11708
|
onChange: (e) => setLanguage(e.target.value),
|
|
10547
11709
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
10548
|
-
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */
|
|
11710
|
+
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ jsx30("option", { value: opt.value, children: opt.label }, opt.value))
|
|
10549
11711
|
}
|
|
10550
11712
|
)
|
|
10551
11713
|
] }),
|
|
10552
|
-
/* @__PURE__ */
|
|
10553
|
-
/* @__PURE__ */
|
|
10554
|
-
/* @__PURE__ */
|
|
11714
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1.5", children: [
|
|
11715
|
+
/* @__PURE__ */ jsx30("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
|
|
11716
|
+
/* @__PURE__ */ jsx30(
|
|
10555
11717
|
"select",
|
|
10556
11718
|
{
|
|
10557
11719
|
value: category,
|
|
10558
11720
|
onChange: (e) => setCategory(e.target.value),
|
|
10559
11721
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
10560
|
-
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */
|
|
11722
|
+
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ jsx30("option", { value: opt.value, children: opt.label }, opt.value))
|
|
10561
11723
|
}
|
|
10562
11724
|
)
|
|
10563
11725
|
] })
|
|
10564
11726
|
] }),
|
|
10565
|
-
/* @__PURE__ */
|
|
10566
|
-
/* @__PURE__ */
|
|
11727
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
|
|
11728
|
+
/* @__PURE__ */ jsxs24("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
10567
11729
|
"\u05EA\u05D5\u05DB\u05DF \u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 ",
|
|
10568
|
-
/* @__PURE__ */
|
|
11730
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
10569
11731
|
] }),
|
|
10570
|
-
/* @__PURE__ */
|
|
10571
|
-
/* @__PURE__ */
|
|
11732
|
+
/* @__PURE__ */ jsxs24("div", { className: "border border-slate-200 focus-within:border-emerald-500 focus-within:ring-1 focus-within:ring-emerald-500 rounded-xl overflow-visible bg-white transition-all shadow-xs relative", children: [
|
|
11733
|
+
/* @__PURE__ */ jsx30(
|
|
10572
11734
|
"textarea",
|
|
10573
11735
|
{
|
|
10574
11736
|
ref: textareaRef,
|
|
@@ -10583,14 +11745,14 @@ function CreateTemplateModal({
|
|
|
10583
11745
|
required: true
|
|
10584
11746
|
}
|
|
10585
11747
|
),
|
|
10586
|
-
/* @__PURE__ */
|
|
11748
|
+
/* @__PURE__ */ jsxs24(
|
|
10587
11749
|
"div",
|
|
10588
11750
|
{
|
|
10589
11751
|
className: "bg-slate-50/90 border-t border-slate-100 px-3 py-1.5 flex items-center justify-between gap-2 select-none relative",
|
|
10590
11752
|
dir: language === "en_US" ? "ltr" : "rtl",
|
|
10591
11753
|
children: [
|
|
10592
|
-
/* @__PURE__ */
|
|
10593
|
-
/* @__PURE__ */
|
|
11754
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
|
|
11755
|
+
/* @__PURE__ */ jsx30(
|
|
10594
11756
|
"button",
|
|
10595
11757
|
{
|
|
10596
11758
|
type: "button",
|
|
@@ -10598,10 +11760,10 @@ function CreateTemplateModal({
|
|
|
10598
11760
|
onClick: () => handleApplyFormatting("*"),
|
|
10599
11761
|
title: "\u05DE\u05D5\u05D3\u05D2\u05E9 (Bold) *\u05D8\u05E7\u05E1\u05D8*",
|
|
10600
11762
|
className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center font-bold text-xs transition-colors cursor-pointer",
|
|
10601
|
-
children: /* @__PURE__ */
|
|
11763
|
+
children: /* @__PURE__ */ jsx30(Bold, { className: "w-3.5 h-3.5" })
|
|
10602
11764
|
}
|
|
10603
11765
|
),
|
|
10604
|
-
/* @__PURE__ */
|
|
11766
|
+
/* @__PURE__ */ jsx30(
|
|
10605
11767
|
"button",
|
|
10606
11768
|
{
|
|
10607
11769
|
type: "button",
|
|
@@ -10609,10 +11771,10 @@ function CreateTemplateModal({
|
|
|
10609
11771
|
onClick: () => handleApplyFormatting("_"),
|
|
10610
11772
|
title: "\u05E0\u05D8\u05D5\u05D9 (Italic) _\u05D8\u05E7\u05E1\u05D8_",
|
|
10611
11773
|
className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center italic text-xs transition-colors cursor-pointer",
|
|
10612
|
-
children: /* @__PURE__ */
|
|
11774
|
+
children: /* @__PURE__ */ jsx30(Italic, { className: "w-3.5 h-3.5" })
|
|
10613
11775
|
}
|
|
10614
11776
|
),
|
|
10615
|
-
/* @__PURE__ */
|
|
11777
|
+
/* @__PURE__ */ jsx30(
|
|
10616
11778
|
"button",
|
|
10617
11779
|
{
|
|
10618
11780
|
type: "button",
|
|
@@ -10620,12 +11782,12 @@ function CreateTemplateModal({
|
|
|
10620
11782
|
onClick: () => handleApplyFormatting("~"),
|
|
10621
11783
|
title: "\u05E7\u05D5 \u05D7\u05D5\u05E6\u05D4 (Strikethrough) ~\u05D8\u05E7\u05E1\u05D8~",
|
|
10622
11784
|
className: "w-7 h-7 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center justify-center text-xs transition-colors cursor-pointer",
|
|
10623
|
-
children: /* @__PURE__ */
|
|
11785
|
+
children: /* @__PURE__ */ jsx30(Strikethrough, { className: "w-3.5 h-3.5" })
|
|
10624
11786
|
}
|
|
10625
11787
|
),
|
|
10626
|
-
/* @__PURE__ */
|
|
10627
|
-
/* @__PURE__ */
|
|
10628
|
-
/* @__PURE__ */
|
|
11788
|
+
/* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
11789
|
+
/* @__PURE__ */ jsxs24("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
|
|
11790
|
+
/* @__PURE__ */ jsx30(
|
|
10629
11791
|
"button",
|
|
10630
11792
|
{
|
|
10631
11793
|
type: "button",
|
|
@@ -10633,16 +11795,16 @@ function CreateTemplateModal({
|
|
|
10633
11795
|
onClick: () => setIsEmojiPickerOpen(!isEmojiPickerOpen),
|
|
10634
11796
|
title: "\u05D4\u05D5\u05E1\u05E3 \u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9 (Emoji)",
|
|
10635
11797
|
className: `w-7 h-7 rounded-lg flex items-center justify-center transition-colors cursor-pointer ${isEmojiPickerOpen ? "bg-emerald-100 text-emerald-700" : "text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80"}`,
|
|
10636
|
-
children: /* @__PURE__ */
|
|
11798
|
+
children: /* @__PURE__ */ jsx30(Smile, { className: "w-4 h-4" })
|
|
10637
11799
|
}
|
|
10638
11800
|
),
|
|
10639
|
-
isEmojiPickerOpen && /* @__PURE__ */
|
|
11801
|
+
isEmojiPickerOpen && /* @__PURE__ */ jsx30(
|
|
10640
11802
|
"div",
|
|
10641
11803
|
{
|
|
10642
11804
|
className: `absolute bottom-full mb-2 ${language === "en_US" ? "left-0" : "right-0"} z-50 shadow-2xl rounded-2xl overflow-hidden border border-slate-200 animate-in fade-in zoom-in-95 duration-100`,
|
|
10643
11805
|
dir: "ltr",
|
|
10644
11806
|
onMouseDown: (e) => e.stopPropagation(),
|
|
10645
|
-
children: /* @__PURE__ */
|
|
11807
|
+
children: /* @__PURE__ */ jsx30(
|
|
10646
11808
|
EmojiPicker,
|
|
10647
11809
|
{
|
|
10648
11810
|
onEmojiClick: (emojiData) => {
|
|
@@ -10659,8 +11821,8 @@ function CreateTemplateModal({
|
|
|
10659
11821
|
}
|
|
10660
11822
|
)
|
|
10661
11823
|
] }),
|
|
10662
|
-
/* @__PURE__ */
|
|
10663
|
-
/* @__PURE__ */
|
|
11824
|
+
/* @__PURE__ */ jsx30("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
11825
|
+
/* @__PURE__ */ jsxs24(
|
|
10664
11826
|
"button",
|
|
10665
11827
|
{
|
|
10666
11828
|
type: "button",
|
|
@@ -10670,28 +11832,28 @@ function CreateTemplateModal({
|
|
|
10670
11832
|
"aria-label": language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4",
|
|
10671
11833
|
className: "h-7 px-2 rounded-lg text-slate-600 hover:text-slate-900 hover:bg-slate-200/70 active:bg-slate-300/80 flex items-center gap-1 text-xs font-medium transition-colors cursor-pointer",
|
|
10672
11834
|
children: [
|
|
10673
|
-
/* @__PURE__ */
|
|
10674
|
-
/* @__PURE__ */
|
|
11835
|
+
/* @__PURE__ */ jsx30(Plus, { className: "w-3.5 h-3.5" }),
|
|
11836
|
+
/* @__PURE__ */ jsx30("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
|
|
10675
11837
|
]
|
|
10676
11838
|
}
|
|
10677
11839
|
)
|
|
10678
11840
|
] }),
|
|
10679
|
-
/* @__PURE__ */
|
|
11841
|
+
/* @__PURE__ */ jsxs24(
|
|
10680
11842
|
"div",
|
|
10681
11843
|
{
|
|
10682
11844
|
className: "flex items-center gap-1 font-mono text-[11px]",
|
|
10683
11845
|
dir: "ltr",
|
|
10684
11846
|
title: "\u05DE\u05D2\u05D1\u05DC\u05EA \u05EA\u05D5\u05D5\u05D9\u05DD (1024 \u05EA\u05D5\u05D5\u05D9\u05DD \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8)",
|
|
10685
11847
|
children: [
|
|
10686
|
-
/* @__PURE__ */
|
|
11848
|
+
/* @__PURE__ */ jsx30(
|
|
10687
11849
|
"span",
|
|
10688
11850
|
{
|
|
10689
11851
|
className: `font-semibold transition-colors ${bodyText.length >= 1024 ? "text-rose-600" : bodyText.length >= 950 ? "text-amber-600" : "text-slate-500"}`,
|
|
10690
11852
|
children: bodyText.length
|
|
10691
11853
|
}
|
|
10692
11854
|
),
|
|
10693
|
-
/* @__PURE__ */
|
|
10694
|
-
/* @__PURE__ */
|
|
11855
|
+
/* @__PURE__ */ jsx30("span", { className: "text-slate-300", children: "/" }),
|
|
11856
|
+
/* @__PURE__ */ jsx30("span", { className: "text-slate-400", children: "1024" })
|
|
10695
11857
|
]
|
|
10696
11858
|
}
|
|
10697
11859
|
)
|
|
@@ -10699,30 +11861,30 @@ function CreateTemplateModal({
|
|
|
10699
11861
|
}
|
|
10700
11862
|
)
|
|
10701
11863
|
] }),
|
|
10702
|
-
/* @__PURE__ */
|
|
10703
|
-
/* @__PURE__ */
|
|
11864
|
+
/* @__PURE__ */ jsx30("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3", children: [
|
|
11865
|
+
/* @__PURE__ */ jsxs24("span", { children: [
|
|
10704
11866
|
ratioInfo.staticWordsCount,
|
|
10705
11867
|
" \u05DE\u05D9\u05DC\u05D9\u05DD"
|
|
10706
11868
|
] }),
|
|
10707
|
-
/* @__PURE__ */
|
|
11869
|
+
/* @__PURE__ */ jsxs24("span", { children: [
|
|
10708
11870
|
ratioInfo.variableCount,
|
|
10709
11871
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
10710
11872
|
] })
|
|
10711
11873
|
] }) }),
|
|
10712
|
-
uniqueVariables.length > 0 && /* @__PURE__ */
|
|
10713
|
-
/* @__PURE__ */
|
|
10714
|
-
/* @__PURE__ */
|
|
10715
|
-
/* @__PURE__ */
|
|
11874
|
+
uniqueVariables.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
11875
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
|
|
11876
|
+
/* @__PURE__ */ jsx30(Info2, { className: "w-4 h-4 text-emerald-600" }),
|
|
11877
|
+
/* @__PURE__ */ jsx30("span", { children: "\u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D3\u05D5\u05D2\u05DE\u05D4 \u05DC\u05DE\u05E9\u05EA\u05E0\u05D9\u05DD (\u05D7\u05D5\u05D1\u05D4 \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta)" })
|
|
10716
11878
|
] }),
|
|
10717
|
-
/* @__PURE__ */
|
|
10718
|
-
/* @__PURE__ */
|
|
10719
|
-
/* @__PURE__ */
|
|
11879
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[11px] text-slate-500 leading-relaxed", children: "Meta \u05D3\u05D5\u05E8\u05E9\u05EA \u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 \u05DB\u05DC \u05DE\u05E9\u05EA\u05E0\u05D4 \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05DB\u05D3\u05D9 \u05DC\u05D5\u05D5\u05D3\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA \u05EA\u05D5\u05DB\u05DF." }),
|
|
11880
|
+
/* @__PURE__ */ jsx30("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
11881
|
+
/* @__PURE__ */ jsxs24("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
|
|
10720
11882
|
"\u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 ",
|
|
10721
11883
|
`{{${idx}}}`,
|
|
10722
11884
|
" ",
|
|
10723
|
-
/* @__PURE__ */
|
|
11885
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
10724
11886
|
] }),
|
|
10725
|
-
/* @__PURE__ */
|
|
11887
|
+
/* @__PURE__ */ jsx30(
|
|
10726
11888
|
"input",
|
|
10727
11889
|
{
|
|
10728
11890
|
type: "text",
|
|
@@ -10737,21 +11899,21 @@ function CreateTemplateModal({
|
|
|
10737
11899
|
)
|
|
10738
11900
|
] }, idx)) })
|
|
10739
11901
|
] }),
|
|
10740
|
-
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */
|
|
10741
|
-
/* @__PURE__ */
|
|
10742
|
-
/* @__PURE__ */
|
|
10743
|
-
/* @__PURE__ */
|
|
11902
|
+
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "p-3.5 bg-amber-50 border border-amber-200 rounded-xl space-y-1.5 text-xs text-amber-900", children: [
|
|
11903
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5 font-bold", children: [
|
|
11904
|
+
/* @__PURE__ */ jsx30(AlertCircle2, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
11905
|
+
/* @__PURE__ */ jsx30("span", { children: "\u05D3\u05E8\u05D9\u05E9\u05D5\u05EA \u05EA\u05E7\u05D9\u05E0\u05D5\u05EA Meta \u05DC\u05D7\u05E1\u05D9\u05DE\u05EA \u05E9\u05D2\u05D9\u05D0\u05D5\u05EA:" })
|
|
10744
11906
|
] }),
|
|
10745
|
-
/* @__PURE__ */
|
|
11907
|
+
/* @__PURE__ */ jsx30("ul", { className: "list-disc list-inside space-y-1 text-[11px] pr-2 leading-relaxed", children: validationResult.errors.map((err, i) => /* @__PURE__ */ jsx30("li", { children: err }, i)) })
|
|
10746
11908
|
] })
|
|
10747
11909
|
] }),
|
|
10748
|
-
/* @__PURE__ */
|
|
10749
|
-
/* @__PURE__ */
|
|
10750
|
-
/* @__PURE__ */
|
|
10751
|
-
/* @__PURE__ */
|
|
10752
|
-
/* @__PURE__ */
|
|
11910
|
+
/* @__PURE__ */ jsxs24("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
11911
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
11912
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
11913
|
+
/* @__PURE__ */ jsx30(Paperclip, { className: "w-4 h-4 text-slate-600" }),
|
|
11914
|
+
/* @__PURE__ */ jsx30("label", { htmlFor: "modalHeaderFileCheckbox", className: "text-xs font-bold text-slate-800 cursor-pointer", children: "\u05E7\u05D5\u05D1\u05E5 \u05DB\u05D5\u05EA\u05E8\u05EA \u05DE\u05E6\u05D5\u05E8\u05E3 (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" })
|
|
10753
11915
|
] }),
|
|
10754
|
-
/* @__PURE__ */
|
|
11916
|
+
/* @__PURE__ */ jsx30(
|
|
10755
11917
|
"input",
|
|
10756
11918
|
{
|
|
10757
11919
|
type: "checkbox",
|
|
@@ -10767,12 +11929,12 @@ function CreateTemplateModal({
|
|
|
10767
11929
|
}
|
|
10768
11930
|
)
|
|
10769
11931
|
] }),
|
|
10770
|
-
hasFileHeader && /* @__PURE__ */
|
|
10771
|
-
fileError && /* @__PURE__ */
|
|
10772
|
-
/* @__PURE__ */
|
|
10773
|
-
/* @__PURE__ */
|
|
11932
|
+
hasFileHeader && /* @__PURE__ */ jsxs24("div", { className: "space-y-3 pt-1", children: [
|
|
11933
|
+
fileError && /* @__PURE__ */ jsxs24("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl flex items-center gap-2 text-xs text-rose-700 font-semibold animate-in fade-in duration-150", children: [
|
|
11934
|
+
/* @__PURE__ */ jsx30(AlertCircle2, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
11935
|
+
/* @__PURE__ */ jsx30("span", { children: fileError })
|
|
10774
11936
|
] }),
|
|
10775
|
-
/* @__PURE__ */
|
|
11937
|
+
/* @__PURE__ */ jsx30(
|
|
10776
11938
|
"input",
|
|
10777
11939
|
{
|
|
10778
11940
|
ref: fileInputRef,
|
|
@@ -10782,7 +11944,7 @@ function CreateTemplateModal({
|
|
|
10782
11944
|
className: "hidden"
|
|
10783
11945
|
}
|
|
10784
11946
|
),
|
|
10785
|
-
!selectedFile && /* @__PURE__ */
|
|
11947
|
+
!selectedFile && /* @__PURE__ */ jsxs24(
|
|
10786
11948
|
"button",
|
|
10787
11949
|
{
|
|
10788
11950
|
type: "button",
|
|
@@ -10792,49 +11954,49 @@ function CreateTemplateModal({
|
|
|
10792
11954
|
},
|
|
10793
11955
|
className: "w-full p-4 border-2 border-dashed border-slate-300 hover:border-emerald-500 rounded-xl flex flex-col items-center justify-center gap-2 bg-white hover:bg-emerald-50/30 transition-all cursor-pointer",
|
|
10794
11956
|
children: [
|
|
10795
|
-
/* @__PURE__ */
|
|
10796
|
-
/* @__PURE__ */
|
|
10797
|
-
/* @__PURE__ */
|
|
10798
|
-
/* @__PURE__ */
|
|
11957
|
+
/* @__PURE__ */ jsx30("div", { className: "w-9 h-9 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center", children: /* @__PURE__ */ jsx30(Upload2, { className: "w-4 h-4" }) }),
|
|
11958
|
+
/* @__PURE__ */ jsxs24("div", { className: "text-center", children: [
|
|
11959
|
+
/* @__PURE__ */ jsx30("span", { className: "text-xs font-bold text-emerald-700 block", children: "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D7\u05D9\u05E8\u05EA \u05E7\u05D5\u05D1\u05E5" }),
|
|
11960
|
+
/* @__PURE__ */ jsx30("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
|
|
10799
11961
|
] })
|
|
10800
11962
|
]
|
|
10801
11963
|
}
|
|
10802
11964
|
),
|
|
10803
|
-
selectedFile && /* @__PURE__ */
|
|
10804
|
-
/* @__PURE__ */
|
|
10805
|
-
/* @__PURE__ */
|
|
10806
|
-
/* @__PURE__ */
|
|
10807
|
-
/* @__PURE__ */
|
|
10808
|
-
/* @__PURE__ */
|
|
11965
|
+
selectedFile && /* @__PURE__ */ jsxs24("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
|
|
11966
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
|
|
11967
|
+
/* @__PURE__ */ jsx30("div", { className: "w-8 h-8 rounded-lg bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0", children: selectedFile.type.includes("pdf") || selectedFile.name.toLowerCase().endsWith(".pdf") ? /* @__PURE__ */ jsx30(FileText2, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ jsx30(Video, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx30(ImageIcon, { className: "w-4 h-4" }) }),
|
|
11968
|
+
/* @__PURE__ */ jsxs24("div", { className: "overflow-hidden", children: [
|
|
11969
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ jsx30("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
|
|
11970
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ jsxs24("span", { dir: "ltr", className: "inline-block", children: [
|
|
10809
11971
|
formatFileSize(selectedFile.size),
|
|
10810
11972
|
selectedFile.type ? ` \u2022 ${selectedFile.type}` : ""
|
|
10811
11973
|
] }) })
|
|
10812
11974
|
] })
|
|
10813
11975
|
] }),
|
|
10814
|
-
/* @__PURE__ */
|
|
11976
|
+
/* @__PURE__ */ jsx30(
|
|
10815
11977
|
"button",
|
|
10816
11978
|
{
|
|
10817
11979
|
type: "button",
|
|
10818
11980
|
onClick: handleRemoveFile,
|
|
10819
11981
|
className: "p-1 text-slate-400 hover:text-rose-600 rounded-md transition-colors cursor-pointer",
|
|
10820
11982
|
title: "\u05D4\u05E1\u05E8 \u05E7\u05D5\u05D1\u05E5",
|
|
10821
|
-
children: /* @__PURE__ */
|
|
11983
|
+
children: /* @__PURE__ */ jsx30(Trash22, { className: "w-4 h-4" })
|
|
10822
11984
|
}
|
|
10823
11985
|
)
|
|
10824
11986
|
] })
|
|
10825
11987
|
] })
|
|
10826
11988
|
] }),
|
|
10827
|
-
/* @__PURE__ */
|
|
10828
|
-
/* @__PURE__ */
|
|
10829
|
-
/* @__PURE__ */
|
|
10830
|
-
/* @__PURE__ */
|
|
10831
|
-
/* @__PURE__ */
|
|
10832
|
-
/* @__PURE__ */
|
|
10833
|
-
/* @__PURE__ */
|
|
11989
|
+
/* @__PURE__ */ jsxs24("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
|
|
11990
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
11991
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
11992
|
+
/* @__PURE__ */ jsx30(MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
|
|
11993
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
11994
|
+
/* @__PURE__ */ jsx30("span", { className: "text-xs font-bold text-slate-800 block", children: "\u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD \u05D0\u05D9\u05E0\u05D8\u05E8\u05D0\u05E7\u05D8\u05D9\u05D1\u05D9\u05D9\u05DD (\u05D0\u05D5\u05E4\u05E6\u05D9\u05D5\u05E0\u05DC\u05D9)" }),
|
|
11995
|
+
/* @__PURE__ */ jsx30("span", { className: "text-[10px] text-slate-400 block", children: "\u05D4\u05D5\u05E1\u05E4\u05EA \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9 \u05E7\u05E8\u05D9\u05D0\u05D4 \u05DC\u05E4\u05E2\u05D5\u05DC\u05D4 (CTA) \u05D5\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4 (\u05E2\u05D3 10 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD)" })
|
|
10834
11996
|
] })
|
|
10835
11997
|
] }),
|
|
10836
|
-
/* @__PURE__ */
|
|
10837
|
-
/* @__PURE__ */
|
|
11998
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
11999
|
+
/* @__PURE__ */ jsxs24(
|
|
10838
12000
|
"span",
|
|
10839
12001
|
{
|
|
10840
12002
|
className: `text-[10px] font-mono px-2 py-0.5 rounded-full border ${buttons.length >= 10 ? "bg-amber-50 text-amber-700 border-amber-200 font-bold" : "bg-white text-slate-500 border-slate-200"}`,
|
|
@@ -10844,8 +12006,8 @@ function CreateTemplateModal({
|
|
|
10844
12006
|
]
|
|
10845
12007
|
}
|
|
10846
12008
|
),
|
|
10847
|
-
/* @__PURE__ */
|
|
10848
|
-
/* @__PURE__ */
|
|
12009
|
+
/* @__PURE__ */ jsxs24("div", { className: "relative", ref: addButtonDropdownRef, children: [
|
|
12010
|
+
/* @__PURE__ */ jsxs24(
|
|
10849
12011
|
"button",
|
|
10850
12012
|
{
|
|
10851
12013
|
type: "button",
|
|
@@ -10854,9 +12016,9 @@ function CreateTemplateModal({
|
|
|
10854
12016
|
className: `inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-xl border transition-all ${buttons.length >= 10 ? "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed opacity-60" : "bg-white text-emerald-700 border-emerald-200 hover:bg-emerald-50/80 active:scale-[0.98] shadow-2xs cursor-pointer"}`,
|
|
10855
12017
|
title: buttons.length >= 10 ? "\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05D2\u05D1\u05DC\u05D4 \u05D4\u05DE\u05E8\u05D1\u05D9\u05EA \u05E9\u05DC 10 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD" : "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8 \u05D7\u05D3\u05E9",
|
|
10856
12018
|
children: [
|
|
10857
|
-
/* @__PURE__ */
|
|
10858
|
-
/* @__PURE__ */
|
|
10859
|
-
/* @__PURE__ */
|
|
12019
|
+
/* @__PURE__ */ jsx30(Plus, { className: "w-3.5 h-3.5" }),
|
|
12020
|
+
/* @__PURE__ */ jsx30("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
|
|
12021
|
+
/* @__PURE__ */ jsx30(
|
|
10860
12022
|
ChevronDown3,
|
|
10861
12023
|
{
|
|
10862
12024
|
className: `w-3.5 h-3.5 transition-transform ${isAddButtonOpen ? "rotate-180" : ""}`
|
|
@@ -10865,63 +12027,63 @@ function CreateTemplateModal({
|
|
|
10865
12027
|
]
|
|
10866
12028
|
}
|
|
10867
12029
|
),
|
|
10868
|
-
isAddButtonOpen && /* @__PURE__ */
|
|
10869
|
-
/* @__PURE__ */
|
|
12030
|
+
isAddButtonOpen && /* @__PURE__ */ jsxs24("div", { className: "absolute top-full left-0 mt-1.5 w-64 bg-white border border-slate-200 rounded-xl shadow-xl z-30 p-1.5 space-y-1 animate-in fade-in-50 zoom-in-95 duration-100 divide-y divide-slate-100", children: [
|
|
12031
|
+
/* @__PURE__ */ jsxs24(
|
|
10870
12032
|
"button",
|
|
10871
12033
|
{
|
|
10872
12034
|
type: "button",
|
|
10873
12035
|
onClick: () => handleAddButton("QUICK_REPLY"),
|
|
10874
12036
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group",
|
|
10875
12037
|
children: [
|
|
10876
|
-
/* @__PURE__ */
|
|
10877
|
-
/* @__PURE__ */
|
|
10878
|
-
/* @__PURE__ */
|
|
10879
|
-
/* @__PURE__ */
|
|
12038
|
+
/* @__PURE__ */ jsx30("div", { className: "w-7 h-7 rounded-md bg-emerald-50 text-emerald-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-emerald-100", children: /* @__PURE__ */ jsx30(MessageSquare, { className: "w-3.5 h-3.5" }) }),
|
|
12039
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
12040
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
|
|
12041
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05DE\u05E2\u05E0\u05D4 \u05DE\u05D4\u05D9\u05E8 \u05D1\u05DC\u05D7\u05D9\u05E6\u05D4 \u05D0\u05D7\u05EA" })
|
|
10880
12042
|
] })
|
|
10881
12043
|
]
|
|
10882
12044
|
}
|
|
10883
12045
|
),
|
|
10884
|
-
/* @__PURE__ */
|
|
12046
|
+
/* @__PURE__ */ jsxs24(
|
|
10885
12047
|
"button",
|
|
10886
12048
|
{
|
|
10887
12049
|
type: "button",
|
|
10888
12050
|
onClick: () => handleAddButton("URL"),
|
|
10889
12051
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
|
|
10890
12052
|
children: [
|
|
10891
|
-
/* @__PURE__ */
|
|
10892
|
-
/* @__PURE__ */
|
|
10893
|
-
/* @__PURE__ */
|
|
10894
|
-
/* @__PURE__ */
|
|
12053
|
+
/* @__PURE__ */ jsx30("div", { className: "w-7 h-7 rounded-md bg-sky-50 text-sky-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-sky-100", children: /* @__PURE__ */ jsx30(ExternalLink3, { className: "w-3.5 h-3.5" }) }),
|
|
12054
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
12055
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
|
|
12056
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05E7\u05D9\u05E9\u05D5\u05E8 \u05D0\u05D9\u05E0\u05D8\u05E8\u05E0\u05D8 \u05E1\u05D8\u05D8\u05D9" })
|
|
10895
12057
|
] })
|
|
10896
12058
|
]
|
|
10897
12059
|
}
|
|
10898
12060
|
),
|
|
10899
|
-
/* @__PURE__ */
|
|
12061
|
+
/* @__PURE__ */ jsxs24(
|
|
10900
12062
|
"button",
|
|
10901
12063
|
{
|
|
10902
12064
|
type: "button",
|
|
10903
12065
|
onClick: () => handleAddButton("PHONE_NUMBER"),
|
|
10904
12066
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
|
|
10905
12067
|
children: [
|
|
10906
|
-
/* @__PURE__ */
|
|
10907
|
-
/* @__PURE__ */
|
|
10908
|
-
/* @__PURE__ */
|
|
10909
|
-
/* @__PURE__ */
|
|
12068
|
+
/* @__PURE__ */ jsx30("div", { className: "w-7 h-7 rounded-md bg-violet-50 text-violet-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-violet-100", children: /* @__PURE__ */ jsx30(Phone, { className: "w-3.5 h-3.5" }) }),
|
|
12069
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
12070
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
|
|
12071
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D7\u05D9\u05D5\u05D2 \u05D9\u05E9\u05D9\u05E8 \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF" })
|
|
10910
12072
|
] })
|
|
10911
12073
|
]
|
|
10912
12074
|
}
|
|
10913
12075
|
),
|
|
10914
|
-
/* @__PURE__ */
|
|
12076
|
+
/* @__PURE__ */ jsxs24(
|
|
10915
12077
|
"button",
|
|
10916
12078
|
{
|
|
10917
12079
|
type: "button",
|
|
10918
12080
|
onClick: () => handleAddButton("COPY_CODE"),
|
|
10919
12081
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group pt-2",
|
|
10920
12082
|
children: [
|
|
10921
|
-
/* @__PURE__ */
|
|
10922
|
-
/* @__PURE__ */
|
|
10923
|
-
/* @__PURE__ */
|
|
10924
|
-
/* @__PURE__ */
|
|
12083
|
+
/* @__PURE__ */ jsx30("div", { className: "w-7 h-7 rounded-md bg-amber-50 text-amber-600 flex items-center justify-center shrink-0 mt-0.5 group-hover:bg-amber-100", children: /* @__PURE__ */ jsx30(Copy3, { className: "w-3.5 h-3.5" }) }),
|
|
12084
|
+
/* @__PURE__ */ jsxs24("div", { children: [
|
|
12085
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
|
|
12086
|
+
/* @__PURE__ */ jsx30("p", { className: "text-[10px] text-slate-400 leading-tight", children: "\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3 \u05E7\u05D5\u05E4\u05D5\u05DF \u05DC\u05DC\u05D5\u05D7" })
|
|
10925
12087
|
] })
|
|
10926
12088
|
]
|
|
10927
12089
|
}
|
|
@@ -10930,55 +12092,55 @@ function CreateTemplateModal({
|
|
|
10930
12092
|
] })
|
|
10931
12093
|
] })
|
|
10932
12094
|
] }),
|
|
10933
|
-
buttons.length === 0 && /* @__PURE__ */
|
|
10934
|
-
buttons.length > 0 && /* @__PURE__ */
|
|
12095
|
+
buttons.length === 0 && /* @__PURE__ */ jsx30("div", { className: "p-3 text-center border border-dashed border-slate-200 rounded-lg text-slate-400 text-xs bg-white/60", children: '\u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8\u05D5 \u05DB\u05E4\u05EA\u05D5\u05E8\u05D9\u05DD. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" \u05DB\u05D3\u05D9 \u05DC\u05D4\u05D5\u05E1\u05D9\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8 \u05E8\u05D0\u05E9\u05D5\u05DF \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA.' }),
|
|
12096
|
+
buttons.length > 0 && /* @__PURE__ */ jsx30("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
|
|
10935
12097
|
const btnNum = index + 1;
|
|
10936
|
-
return /* @__PURE__ */
|
|
12098
|
+
return /* @__PURE__ */ jsxs24(
|
|
10937
12099
|
"div",
|
|
10938
12100
|
{
|
|
10939
12101
|
className: "p-3 bg-white border border-slate-200 rounded-xl space-y-2.5 shadow-2xs transition-all hover:border-slate-300",
|
|
10940
12102
|
children: [
|
|
10941
|
-
/* @__PURE__ */
|
|
10942
|
-
/* @__PURE__ */
|
|
10943
|
-
/* @__PURE__ */
|
|
12103
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
|
|
12104
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
|
|
12105
|
+
/* @__PURE__ */ jsxs24("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
|
|
10944
12106
|
"#",
|
|
10945
12107
|
btnNum
|
|
10946
12108
|
] }),
|
|
10947
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */
|
|
10948
|
-
/* @__PURE__ */
|
|
10949
|
-
/* @__PURE__ */
|
|
12109
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ jsxs24("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-emerald-50 text-emerald-700 border border-emerald-200 text-[10px] font-semibold", children: [
|
|
12110
|
+
/* @__PURE__ */ jsx30(MessageSquare, { className: "w-3 h-3" }),
|
|
12111
|
+
/* @__PURE__ */ jsx30("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
|
|
10950
12112
|
] }),
|
|
10951
|
-
btn.type === "URL" && /* @__PURE__ */
|
|
10952
|
-
/* @__PURE__ */
|
|
10953
|
-
/* @__PURE__ */
|
|
12113
|
+
btn.type === "URL" && /* @__PURE__ */ jsxs24("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-sky-50 text-sky-700 border border-sky-200 text-[10px] font-semibold", children: [
|
|
12114
|
+
/* @__PURE__ */ jsx30(ExternalLink3, { className: "w-3 h-3" }),
|
|
12115
|
+
/* @__PURE__ */ jsx30("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
|
|
10954
12116
|
] }),
|
|
10955
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */
|
|
10956
|
-
/* @__PURE__ */
|
|
10957
|
-
/* @__PURE__ */
|
|
12117
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ jsxs24("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-violet-50 text-violet-700 border border-violet-200 text-[10px] font-semibold", children: [
|
|
12118
|
+
/* @__PURE__ */ jsx30(Phone, { className: "w-3 h-3" }),
|
|
12119
|
+
/* @__PURE__ */ jsx30("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
|
|
10958
12120
|
] }),
|
|
10959
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */
|
|
10960
|
-
/* @__PURE__ */
|
|
10961
|
-
/* @__PURE__ */
|
|
12121
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ jsxs24("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-amber-50 text-amber-700 border border-amber-200 text-[10px] font-semibold", children: [
|
|
12122
|
+
/* @__PURE__ */ jsx30(Copy3, { className: "w-3 h-3" }),
|
|
12123
|
+
/* @__PURE__ */ jsx30("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
|
|
10962
12124
|
] })
|
|
10963
12125
|
] }),
|
|
10964
|
-
/* @__PURE__ */
|
|
12126
|
+
/* @__PURE__ */ jsx30(
|
|
10965
12127
|
"button",
|
|
10966
12128
|
{
|
|
10967
12129
|
type: "button",
|
|
10968
12130
|
onClick: () => handleRemoveButton(index),
|
|
10969
12131
|
className: "p-1 text-slate-400 hover:text-rose-600 hover:bg-rose-50 rounded-lg transition-colors cursor-pointer",
|
|
10970
12132
|
title: "\u05D4\u05E1\u05E8 \u05DB\u05E4\u05EA\u05D5\u05E8",
|
|
10971
|
-
children: /* @__PURE__ */
|
|
12133
|
+
children: /* @__PURE__ */ jsx30(Trash22, { className: "w-3.5 h-3.5" })
|
|
10972
12134
|
}
|
|
10973
12135
|
)
|
|
10974
12136
|
] }),
|
|
10975
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */
|
|
10976
|
-
/* @__PURE__ */
|
|
10977
|
-
/* @__PURE__ */
|
|
12137
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12138
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12139
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
10978
12140
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10979
|
-
/* @__PURE__ */
|
|
12141
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
10980
12142
|
] }),
|
|
10981
|
-
/* @__PURE__ */
|
|
12143
|
+
/* @__PURE__ */ jsxs24(
|
|
10982
12144
|
"span",
|
|
10983
12145
|
{
|
|
10984
12146
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10989,7 +12151,7 @@ function CreateTemplateModal({
|
|
|
10989
12151
|
}
|
|
10990
12152
|
)
|
|
10991
12153
|
] }),
|
|
10992
|
-
/* @__PURE__ */
|
|
12154
|
+
/* @__PURE__ */ jsx30(
|
|
10993
12155
|
"input",
|
|
10994
12156
|
{
|
|
10995
12157
|
type: "text",
|
|
@@ -11001,14 +12163,14 @@ function CreateTemplateModal({
|
|
|
11001
12163
|
}
|
|
11002
12164
|
)
|
|
11003
12165
|
] }),
|
|
11004
|
-
btn.type === "URL" && /* @__PURE__ */
|
|
11005
|
-
/* @__PURE__ */
|
|
11006
|
-
/* @__PURE__ */
|
|
11007
|
-
/* @__PURE__ */
|
|
12166
|
+
btn.type === "URL" && /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
12167
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12168
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12169
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
11008
12170
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
11009
|
-
/* @__PURE__ */
|
|
12171
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
11010
12172
|
] }),
|
|
11011
|
-
/* @__PURE__ */
|
|
12173
|
+
/* @__PURE__ */ jsxs24(
|
|
11012
12174
|
"span",
|
|
11013
12175
|
{
|
|
11014
12176
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -11019,7 +12181,7 @@ function CreateTemplateModal({
|
|
|
11019
12181
|
}
|
|
11020
12182
|
)
|
|
11021
12183
|
] }),
|
|
11022
|
-
/* @__PURE__ */
|
|
12184
|
+
/* @__PURE__ */ jsx30(
|
|
11023
12185
|
"input",
|
|
11024
12186
|
{
|
|
11025
12187
|
type: "text",
|
|
@@ -11031,18 +12193,18 @@ function CreateTemplateModal({
|
|
|
11031
12193
|
}
|
|
11032
12194
|
)
|
|
11033
12195
|
] }),
|
|
11034
|
-
/* @__PURE__ */
|
|
11035
|
-
/* @__PURE__ */
|
|
11036
|
-
/* @__PURE__ */
|
|
12196
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12197
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12198
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
11037
12199
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL \u05E1\u05D8\u05D8\u05D9\u05EA ",
|
|
11038
|
-
/* @__PURE__ */
|
|
12200
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
11039
12201
|
] }),
|
|
11040
|
-
/* @__PURE__ */
|
|
12202
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
11041
12203
|
(btn.url || "").length,
|
|
11042
12204
|
"/2000"
|
|
11043
12205
|
] })
|
|
11044
12206
|
] }),
|
|
11045
|
-
/* @__PURE__ */
|
|
12207
|
+
/* @__PURE__ */ jsx30(
|
|
11046
12208
|
"input",
|
|
11047
12209
|
{
|
|
11048
12210
|
type: "url",
|
|
@@ -11056,14 +12218,14 @@ function CreateTemplateModal({
|
|
|
11056
12218
|
)
|
|
11057
12219
|
] })
|
|
11058
12220
|
] }),
|
|
11059
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */
|
|
11060
|
-
/* @__PURE__ */
|
|
11061
|
-
/* @__PURE__ */
|
|
11062
|
-
/* @__PURE__ */
|
|
12221
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
12222
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12223
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12224
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
11063
12225
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
11064
|
-
/* @__PURE__ */
|
|
12226
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
11065
12227
|
] }),
|
|
11066
|
-
/* @__PURE__ */
|
|
12228
|
+
/* @__PURE__ */ jsxs24(
|
|
11067
12229
|
"span",
|
|
11068
12230
|
{
|
|
11069
12231
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -11074,7 +12236,7 @@ function CreateTemplateModal({
|
|
|
11074
12236
|
}
|
|
11075
12237
|
)
|
|
11076
12238
|
] }),
|
|
11077
|
-
/* @__PURE__ */
|
|
12239
|
+
/* @__PURE__ */ jsx30(
|
|
11078
12240
|
"input",
|
|
11079
12241
|
{
|
|
11080
12242
|
type: "text",
|
|
@@ -11086,18 +12248,18 @@ function CreateTemplateModal({
|
|
|
11086
12248
|
}
|
|
11087
12249
|
)
|
|
11088
12250
|
] }),
|
|
11089
|
-
/* @__PURE__ */
|
|
11090
|
-
/* @__PURE__ */
|
|
11091
|
-
/* @__PURE__ */
|
|
12251
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12252
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12253
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
11092
12254
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF (\u05E4\u05D5\u05E8\u05DE\u05D8: +[\u05E7\u05D9\u05D3\u05D5\u05DE\u05EA][\u05DE\u05E1\u05E4\u05E8]) ",
|
|
11093
|
-
/* @__PURE__ */
|
|
12255
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
11094
12256
|
] }),
|
|
11095
|
-
/* @__PURE__ */
|
|
12257
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
11096
12258
|
(btn.phone_number || "").length,
|
|
11097
12259
|
"/20"
|
|
11098
12260
|
] })
|
|
11099
12261
|
] }),
|
|
11100
|
-
/* @__PURE__ */
|
|
12262
|
+
/* @__PURE__ */ jsx30(
|
|
11101
12263
|
"input",
|
|
11102
12264
|
{
|
|
11103
12265
|
type: "tel",
|
|
@@ -11111,14 +12273,14 @@ function CreateTemplateModal({
|
|
|
11111
12273
|
)
|
|
11112
12274
|
] })
|
|
11113
12275
|
] }),
|
|
11114
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */
|
|
11115
|
-
/* @__PURE__ */
|
|
11116
|
-
/* @__PURE__ */
|
|
11117
|
-
/* @__PURE__ */
|
|
12276
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
12277
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12278
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12279
|
+
/* @__PURE__ */ jsxs24("label", { className: "font-semibold text-slate-700", children: [
|
|
11118
12280
|
"\u05E7\u05D5\u05D3 \u05D4\u05E6\u05E2\u05D4 / \u05E7\u05D5\u05E4\u05D5\u05DF ",
|
|
11119
|
-
/* @__PURE__ */
|
|
12281
|
+
/* @__PURE__ */ jsx30("span", { className: "text-rose-500", children: "*" })
|
|
11120
12282
|
] }),
|
|
11121
|
-
/* @__PURE__ */
|
|
12283
|
+
/* @__PURE__ */ jsxs24(
|
|
11122
12284
|
"span",
|
|
11123
12285
|
{
|
|
11124
12286
|
className: `font-mono text-[10px] ${(btn.example || "").length >= 15 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -11129,7 +12291,7 @@ function CreateTemplateModal({
|
|
|
11129
12291
|
}
|
|
11130
12292
|
)
|
|
11131
12293
|
] }),
|
|
11132
|
-
/* @__PURE__ */
|
|
12294
|
+
/* @__PURE__ */ jsx30(
|
|
11133
12295
|
"input",
|
|
11134
12296
|
{
|
|
11135
12297
|
type: "text",
|
|
@@ -11142,15 +12304,15 @@ function CreateTemplateModal({
|
|
|
11142
12304
|
}
|
|
11143
12305
|
)
|
|
11144
12306
|
] }),
|
|
11145
|
-
/* @__PURE__ */
|
|
11146
|
-
/* @__PURE__ */
|
|
11147
|
-
/* @__PURE__ */
|
|
11148
|
-
/* @__PURE__ */
|
|
12307
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-1", children: [
|
|
12308
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
12309
|
+
/* @__PURE__ */ jsx30("label", { className: "font-semibold text-slate-700", children: "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 (\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC: \u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3)" }),
|
|
12310
|
+
/* @__PURE__ */ jsxs24("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
11149
12311
|
(btn.text || "").length,
|
|
11150
12312
|
"/25"
|
|
11151
12313
|
] })
|
|
11152
12314
|
] }),
|
|
11153
|
-
/* @__PURE__ */
|
|
12315
|
+
/* @__PURE__ */ jsx30(
|
|
11154
12316
|
"input",
|
|
11155
12317
|
{
|
|
11156
12318
|
type: "text",
|
|
@@ -11170,8 +12332,8 @@ function CreateTemplateModal({
|
|
|
11170
12332
|
}) })
|
|
11171
12333
|
] })
|
|
11172
12334
|
] }),
|
|
11173
|
-
/* @__PURE__ */
|
|
11174
|
-
/* @__PURE__ */
|
|
12335
|
+
/* @__PURE__ */ jsxs24("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
|
|
12336
|
+
/* @__PURE__ */ jsx30(
|
|
11175
12337
|
"button",
|
|
11176
12338
|
{
|
|
11177
12339
|
type: "button",
|
|
@@ -11181,19 +12343,19 @@ function CreateTemplateModal({
|
|
|
11181
12343
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
11182
12344
|
}
|
|
11183
12345
|
),
|
|
11184
|
-
/* @__PURE__ */
|
|
12346
|
+
/* @__PURE__ */ jsx30(
|
|
11185
12347
|
"button",
|
|
11186
12348
|
{
|
|
11187
12349
|
type: "submit",
|
|
11188
12350
|
disabled: !canSubmit,
|
|
11189
12351
|
className: `inline-flex items-center gap-2 px-5 py-2 text-xs font-semibold text-white rounded-xl shadow-xs transition-all cursor-pointer active:scale-[0.98] ${canSubmit ? "bg-emerald-600 hover:bg-emerald-700" : "bg-slate-300 text-slate-500 cursor-not-allowed opacity-60"}`,
|
|
11190
12352
|
title: !canSubmit ? fileError || validationResult.errors[0] || "\u05D9\u05E9 \u05DC\u05D4\u05E9\u05DC\u05D9\u05DD \u05D0\u05EA \u05DB\u05DC \u05E9\u05D3\u05D5\u05EA \u05D4\u05D7\u05D5\u05D1\u05D4 \u05D1\u05D0\u05D5\u05E4\u05DF \u05EA\u05E7\u05D9\u05DF" : "\u05E9\u05DC\u05D7 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8 Meta",
|
|
11191
|
-
children: isSubmitting ? /* @__PURE__ */
|
|
11192
|
-
/* @__PURE__ */
|
|
11193
|
-
/* @__PURE__ */
|
|
11194
|
-
] }) : /* @__PURE__ */
|
|
11195
|
-
/* @__PURE__ */
|
|
11196
|
-
/* @__PURE__ */
|
|
12353
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
12354
|
+
/* @__PURE__ */ jsx30(Loader24, { className: "w-4 h-4 animate-spin" }),
|
|
12355
|
+
/* @__PURE__ */ jsx30("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
|
|
12356
|
+
] }) : /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
12357
|
+
/* @__PURE__ */ jsx30(CheckCircle22, { className: "w-4 h-4" }),
|
|
12358
|
+
/* @__PURE__ */ jsx30("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
|
|
11197
12359
|
] })
|
|
11198
12360
|
}
|
|
11199
12361
|
)
|
|
@@ -11207,7 +12369,7 @@ function CreateTemplateModal({
|
|
|
11207
12369
|
}
|
|
11208
12370
|
|
|
11209
12371
|
// src/components/WhatsAppComponent/hooks/useWhatsAppState.ts
|
|
11210
|
-
import { useState as
|
|
12372
|
+
import { useState as useState24, useEffect as useEffect17, useRef as useRef19, useMemo as useMemo15, useCallback as useCallback17 } from "react";
|
|
11211
12373
|
|
|
11212
12374
|
// src/components/WhatsAppComponent/utils/recipientEngine.ts
|
|
11213
12375
|
var STORAGE_KEY_TEST_PHONE = "whatsapp_test_phone";
|
|
@@ -11722,7 +12884,7 @@ function formatVariableValue(value, columnType, templateLanguage, options) {
|
|
|
11722
12884
|
return formatBoolean(value, templateLanguage);
|
|
11723
12885
|
// ── Date: DD/MM/YYYY ────────────────────────────────────────────
|
|
11724
12886
|
case "DATE":
|
|
11725
|
-
return
|
|
12887
|
+
return formatDate2(value);
|
|
11726
12888
|
// ── Time: HH:mm ─────────────────────────────────────────────────
|
|
11727
12889
|
case "TIME":
|
|
11728
12890
|
return formatTime(value);
|
|
@@ -11749,7 +12911,7 @@ function formatBoolean(value, templateLanguage) {
|
|
|
11749
12911
|
}
|
|
11750
12912
|
return isTrue2 ? "Yes" : "No";
|
|
11751
12913
|
}
|
|
11752
|
-
function
|
|
12914
|
+
function formatDate2(value) {
|
|
11753
12915
|
if (!value) return "";
|
|
11754
12916
|
let dateObj;
|
|
11755
12917
|
if (value instanceof Date) {
|
|
@@ -12512,29 +13674,29 @@ function useWhatsAppState(props) {
|
|
|
12512
13674
|
data: injectedData
|
|
12513
13675
|
} = props;
|
|
12514
13676
|
const orgId = props.orgId || props.organizationId || (settings == null ? void 0 : settings.orgId) || (settings == null ? void 0 : settings.organizationId) || (injectedData == null ? void 0 : injectedData.orgId) || (injectedData == null ? void 0 : injectedData.organizationId);
|
|
12515
|
-
const [tableColumns2, setTableColumns] =
|
|
13677
|
+
const [tableColumns2, setTableColumns] = useState24(() => {
|
|
12516
13678
|
return Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
12517
13679
|
});
|
|
12518
|
-
const [rawRecords, setRawRecords] =
|
|
13680
|
+
const [rawRecords, setRawRecords] = useState24(() => {
|
|
12519
13681
|
if (Array.isArray(injectedData)) return injectedData;
|
|
12520
13682
|
if (Array.isArray(injectedData == null ? void 0 : injectedData.records)) return injectedData.records;
|
|
12521
13683
|
return [];
|
|
12522
13684
|
});
|
|
12523
|
-
const [relationOptions, setRelationOptions] =
|
|
13685
|
+
const [relationOptions, setRelationOptions] = useState24(() => {
|
|
12524
13686
|
return (injectedData == null ? void 0 : injectedData.relationOptions) || {};
|
|
12525
13687
|
});
|
|
12526
|
-
const [isLoadingTableData, setIsLoadingTableData] =
|
|
12527
|
-
const [activeSubtableScans, setActiveSubtableScans] =
|
|
12528
|
-
const [tableError, setTableError] =
|
|
12529
|
-
const [filters, setFilters] =
|
|
12530
|
-
const [selectedRowIds, setSelectedRowIds] =
|
|
12531
|
-
const [autoSelectCount, setAutoSelectCount] =
|
|
12532
|
-
const isAutoSelectingRef =
|
|
12533
|
-
const isManualOverrideRef =
|
|
12534
|
-
const prevAutoSelectCountRef =
|
|
12535
|
-
const fetchedTableIdsRef =
|
|
12536
|
-
const fullyFetchedRelationKeysRef =
|
|
12537
|
-
const loadTableData =
|
|
13688
|
+
const [isLoadingTableData, setIsLoadingTableData] = useState24(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
|
|
13689
|
+
const [activeSubtableScans, setActiveSubtableScans] = useState24(0);
|
|
13690
|
+
const [tableError, setTableError] = useState24(null);
|
|
13691
|
+
const [filters, setFilters] = useState24({});
|
|
13692
|
+
const [selectedRowIds, setSelectedRowIds] = useState24([]);
|
|
13693
|
+
const [autoSelectCount, setAutoSelectCount] = useState24(null);
|
|
13694
|
+
const isAutoSelectingRef = useRef19(false);
|
|
13695
|
+
const isManualOverrideRef = useRef19(false);
|
|
13696
|
+
const prevAutoSelectCountRef = useRef19(null);
|
|
13697
|
+
const fetchedTableIdsRef = useRef19(/* @__PURE__ */ new Set());
|
|
13698
|
+
const fullyFetchedRelationKeysRef = useRef19(/* @__PURE__ */ new Set());
|
|
13699
|
+
const loadTableData = useCallback17(async () => {
|
|
12538
13700
|
var _a2;
|
|
12539
13701
|
const tableId = (settings == null ? void 0 : settings.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableId);
|
|
12540
13702
|
if (!tableId || !executeAction) return;
|
|
@@ -12601,10 +13763,10 @@ function useWhatsAppState(props) {
|
|
|
12601
13763
|
executeAction,
|
|
12602
13764
|
orgId
|
|
12603
13765
|
]);
|
|
12604
|
-
|
|
13766
|
+
useEffect17(() => {
|
|
12605
13767
|
loadTableData();
|
|
12606
13768
|
}, [loadTableData]);
|
|
12607
|
-
const filterableColumns =
|
|
13769
|
+
const filterableColumns = useMemo15(() => {
|
|
12608
13770
|
return (tableColumns2 || []).filter((col) => {
|
|
12609
13771
|
var _a2;
|
|
12610
13772
|
if (!col || col.name === "_id" || col.id === "_id") return false;
|
|
@@ -12612,15 +13774,15 @@ function useWhatsAppState(props) {
|
|
|
12612
13774
|
return type === "RELATION" || type === "BOOLEAN";
|
|
12613
13775
|
});
|
|
12614
13776
|
}, [tableColumns2]);
|
|
12615
|
-
const [referencedTableSchemas, setReferencedTableSchemas] =
|
|
12616
|
-
const subtableCols =
|
|
13777
|
+
const [referencedTableSchemas, setReferencedTableSchemas] = useState24({});
|
|
13778
|
+
const subtableCols = useMemo15(() => {
|
|
12617
13779
|
return (tableColumns2 || []).filter((col) => {
|
|
12618
13780
|
var _a2;
|
|
12619
13781
|
const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
|
|
12620
13782
|
return type === "RELATION" || type === "SUB_TABLE" || type === "SUBTABLE";
|
|
12621
13783
|
});
|
|
12622
13784
|
}, [tableColumns2]);
|
|
12623
|
-
|
|
13785
|
+
useEffect17(() => {
|
|
12624
13786
|
if (!executeAction) return;
|
|
12625
13787
|
const unrequestedCols = subtableCols.filter((col) => {
|
|
12626
13788
|
var _a2;
|
|
@@ -12666,20 +13828,20 @@ function useWhatsAppState(props) {
|
|
|
12666
13828
|
const isScanningPhoneColumns = Boolean(
|
|
12667
13829
|
isLoadingTableData || activeSubtableScans > 0 || tableColumns2.length === 0 && Boolean(settings == null ? void 0 : settings.tableMetaId)
|
|
12668
13830
|
);
|
|
12669
|
-
const targetPhoneOptions =
|
|
13831
|
+
const targetPhoneOptions = useMemo15(() => {
|
|
12670
13832
|
const cols = tableColumns2 && tableColumns2.length > 0 ? tableColumns2 : Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
12671
13833
|
return scanTargetPhoneOptions(cols, referencedTableSchemas);
|
|
12672
13834
|
}, [tableColumns2, settings == null ? void 0 : settings.columns, referencedTableSchemas]);
|
|
12673
|
-
const phoneColumns =
|
|
13835
|
+
const phoneColumns = useMemo15(() => {
|
|
12674
13836
|
return targetPhoneOptions.map((opt) => ({ name: opt.label, id: opt.id, type: "PHONE" }));
|
|
12675
13837
|
}, [targetPhoneOptions]);
|
|
12676
|
-
const [phoneColumnId, setPhoneColumnId] =
|
|
12677
|
-
const [subtableFilterColumn, setSubtableFilterColumn] =
|
|
12678
|
-
const [subtableFilterValue, setSubtableFilterValue] =
|
|
12679
|
-
const [subtableSendLimit, setSubtableSendLimit] =
|
|
13838
|
+
const [phoneColumnId, setPhoneColumnId] = useState24("");
|
|
13839
|
+
const [subtableFilterColumn, setSubtableFilterColumn] = useState24("");
|
|
13840
|
+
const [subtableFilterValue, setSubtableFilterValue] = useState24("");
|
|
13841
|
+
const [subtableSendLimit, setSubtableSendLimit] = useState24(
|
|
12680
13842
|
(settings == null ? void 0 : settings.subtableSendLimit) || "PRIMARY"
|
|
12681
13843
|
);
|
|
12682
|
-
|
|
13844
|
+
useEffect17(() => {
|
|
12683
13845
|
if (targetPhoneOptions.length > 0) {
|
|
12684
13846
|
const isValid = targetPhoneOptions.some(
|
|
12685
13847
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
@@ -12691,13 +13853,13 @@ function useWhatsAppState(props) {
|
|
|
12691
13853
|
setPhoneColumnId("");
|
|
12692
13854
|
}
|
|
12693
13855
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
12694
|
-
const selectedPhoneOption =
|
|
13856
|
+
const selectedPhoneOption = useMemo15(() => {
|
|
12695
13857
|
if (!phoneColumnId) return targetPhoneOptions[0] || null;
|
|
12696
13858
|
return targetPhoneOptions.find(
|
|
12697
13859
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
12698
13860
|
) || targetPhoneOptions[0] || null;
|
|
12699
13861
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
12700
|
-
const subtableFilterableColumns =
|
|
13862
|
+
const subtableFilterableColumns = useMemo15(() => {
|
|
12701
13863
|
var _a2, _b2, _c;
|
|
12702
13864
|
if (!selectedPhoneOption || selectedPhoneOption.type !== "SUBTABLE") {
|
|
12703
13865
|
return [];
|
|
@@ -12716,14 +13878,14 @@ function useWhatsAppState(props) {
|
|
|
12716
13878
|
return type === "BOOLEAN" || type === "RELATION";
|
|
12717
13879
|
});
|
|
12718
13880
|
}, [selectedPhoneOption, referencedTableSchemas, tableColumns2]);
|
|
12719
|
-
const selectedSubtableFilterCol =
|
|
13881
|
+
const selectedSubtableFilterCol = useMemo15(() => {
|
|
12720
13882
|
return subtableFilterableColumns.find((c) => c.name === subtableFilterColumn);
|
|
12721
13883
|
}, [subtableFilterableColumns, subtableFilterColumn]);
|
|
12722
|
-
const [enablePostSendAction, setEnablePostSendAction] =
|
|
12723
|
-
const [postSendActionColumn, setPostSendActionColumn] =
|
|
12724
|
-
const [postSendActionValue, setPostSendActionValue] =
|
|
12725
|
-
const [postSendActionTargetType, setPostSendActionTargetType] =
|
|
12726
|
-
const postSendActionTargetOptions =
|
|
13884
|
+
const [enablePostSendAction, setEnablePostSendAction] = useState24(false);
|
|
13885
|
+
const [postSendActionColumn, setPostSendActionColumn] = useState24("");
|
|
13886
|
+
const [postSendActionValue, setPostSendActionValue] = useState24("");
|
|
13887
|
+
const [postSendActionTargetType, setPostSendActionTargetType] = useState24("MAIN");
|
|
13888
|
+
const postSendActionTargetOptions = useMemo15(() => {
|
|
12727
13889
|
var _a2, _b2, _c;
|
|
12728
13890
|
const options = [];
|
|
12729
13891
|
(tableColumns2 || []).forEach((col) => {
|
|
@@ -12768,14 +13930,14 @@ function useWhatsAppState(props) {
|
|
|
12768
13930
|
}
|
|
12769
13931
|
return options;
|
|
12770
13932
|
}, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
|
|
12771
|
-
const selectedPostSendOption =
|
|
13933
|
+
const selectedPostSendOption = useMemo15(() => {
|
|
12772
13934
|
return postSendActionTargetOptions.find(
|
|
12773
13935
|
(opt) => opt.id === postSendActionColumn || opt.columnName === postSendActionColumn
|
|
12774
13936
|
);
|
|
12775
13937
|
}, [postSendActionTargetOptions, postSendActionColumn]);
|
|
12776
13938
|
const selectedPostSendCol = selectedPostSendOption;
|
|
12777
|
-
const [isTestPromptOpen, setIsTestPromptOpen] =
|
|
12778
|
-
const [testPhoneNumber, setTestPhoneNumber] =
|
|
13939
|
+
const [isTestPromptOpen, setIsTestPromptOpen] = useState24(false);
|
|
13940
|
+
const [testPhoneNumber, setTestPhoneNumber] = useState24(() => {
|
|
12779
13941
|
if (typeof window !== "undefined") {
|
|
12780
13942
|
try {
|
|
12781
13943
|
return localStorage.getItem(STORAGE_KEY_TEST_PHONE) || "";
|
|
@@ -12785,10 +13947,10 @@ function useWhatsAppState(props) {
|
|
|
12785
13947
|
}
|
|
12786
13948
|
return "";
|
|
12787
13949
|
});
|
|
12788
|
-
const [testFeedback, setTestFeedback] =
|
|
12789
|
-
const [isSendingTest, setIsSendingTest] =
|
|
12790
|
-
const [isSendingBroadcast, setIsSendingBroadcast] =
|
|
12791
|
-
const [broadcastProgress, setBroadcastProgress] =
|
|
13950
|
+
const [testFeedback, setTestFeedback] = useState24(null);
|
|
13951
|
+
const [isSendingTest, setIsSendingTest] = useState24(false);
|
|
13952
|
+
const [isSendingBroadcast, setIsSendingBroadcast] = useState24(false);
|
|
13953
|
+
const [broadcastProgress, setBroadcastProgress] = useState24({
|
|
12792
13954
|
current: 0,
|
|
12793
13955
|
total: 0,
|
|
12794
13956
|
successful: 0,
|
|
@@ -12796,12 +13958,12 @@ function useWhatsAppState(props) {
|
|
|
12796
13958
|
skipped: 0,
|
|
12797
13959
|
percent: 0
|
|
12798
13960
|
});
|
|
12799
|
-
const [broadcastSummary, setBroadcastSummary] =
|
|
12800
|
-
const [rowStatusMap, setRowStatusMap] =
|
|
12801
|
-
const clearBroadcastSummary =
|
|
13961
|
+
const [broadcastSummary, setBroadcastSummary] = useState24(null);
|
|
13962
|
+
const [rowStatusMap, setRowStatusMap] = useState24({});
|
|
13963
|
+
const clearBroadcastSummary = useCallback17(() => {
|
|
12802
13964
|
setBroadcastSummary(null);
|
|
12803
13965
|
}, []);
|
|
12804
|
-
const handleTestPhoneChange =
|
|
13966
|
+
const handleTestPhoneChange = useCallback17((val) => {
|
|
12805
13967
|
setTestPhoneNumber(val);
|
|
12806
13968
|
if (typeof window !== "undefined") {
|
|
12807
13969
|
try {
|
|
@@ -12811,7 +13973,7 @@ function useWhatsAppState(props) {
|
|
|
12811
13973
|
}
|
|
12812
13974
|
}
|
|
12813
13975
|
}, []);
|
|
12814
|
-
const getRelationOptionsForCol =
|
|
13976
|
+
const getRelationOptionsForCol = useCallback17(
|
|
12815
13977
|
(colName, parentColName) => {
|
|
12816
13978
|
var _a2, _b2, _c, _d;
|
|
12817
13979
|
if (parentColName) {
|
|
@@ -12854,7 +14016,7 @@ function useWhatsAppState(props) {
|
|
|
12854
14016
|
},
|
|
12855
14017
|
[relationOptions, subtableFilterableColumns, postSendActionTargetOptions, tableColumns2, filterableColumns]
|
|
12856
14018
|
);
|
|
12857
|
-
|
|
14019
|
+
useEffect17(() => {
|
|
12858
14020
|
var _a2, _b2, _c, _d, _e;
|
|
12859
14021
|
if (!executeAction) return;
|
|
12860
14022
|
const targets = [];
|
|
@@ -12948,7 +14110,7 @@ function useWhatsAppState(props) {
|
|
|
12948
14110
|
}
|
|
12949
14111
|
});
|
|
12950
14112
|
}, [filterableColumns, selectedPhoneOption, referencedTableSchemas, tableColumns2, executeAction, selectedPostSendOption, orgId]);
|
|
12951
|
-
|
|
14113
|
+
useEffect17(() => {
|
|
12952
14114
|
var _a2, _b2, _c;
|
|
12953
14115
|
if (!executeAction || !selectedSubtableFilterCol) return;
|
|
12954
14116
|
if (((_a2 = selectedSubtableFilterCol.type) == null ? void 0 : _a2.toUpperCase()) !== "RELATION") return;
|
|
@@ -12999,7 +14161,7 @@ function useWhatsAppState(props) {
|
|
|
12999
14161
|
}
|
|
13000
14162
|
})();
|
|
13001
14163
|
}, [selectedSubtableFilterCol, selectedPhoneOption, executeAction, orgId]);
|
|
13002
|
-
|
|
14164
|
+
useEffect17(() => {
|
|
13003
14165
|
var _a2, _b2;
|
|
13004
14166
|
if (!executeAction || !selectedPostSendOption) return;
|
|
13005
14167
|
if (selectedPostSendOption.type !== "RELATION") return;
|
|
@@ -13052,7 +14214,7 @@ function useWhatsAppState(props) {
|
|
|
13052
14214
|
}
|
|
13053
14215
|
})();
|
|
13054
14216
|
}, [selectedPostSendOption, executeAction, orgId]);
|
|
13055
|
-
const filteredRecords =
|
|
14217
|
+
const filteredRecords = useMemo15(() => {
|
|
13056
14218
|
const activeEntries = Object.entries(filters).filter(
|
|
13057
14219
|
([_, val]) => val !== void 0 && val !== null && val !== ""
|
|
13058
14220
|
);
|
|
@@ -13084,7 +14246,7 @@ function useWhatsAppState(props) {
|
|
|
13084
14246
|
});
|
|
13085
14247
|
}, [rawRecords, filters, filterableColumns]);
|
|
13086
14248
|
const filteredData = filteredRecords;
|
|
13087
|
-
|
|
14249
|
+
useEffect17(() => {
|
|
13088
14250
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
13089
14251
|
isAutoSelectingRef.current = true;
|
|
13090
14252
|
const sliced = filteredData.slice(0, autoSelectCount);
|
|
@@ -13102,7 +14264,7 @@ function useWhatsAppState(props) {
|
|
|
13102
14264
|
isManualOverrideRef.current = false;
|
|
13103
14265
|
prevAutoSelectCountRef.current = autoSelectCount;
|
|
13104
14266
|
}, [autoSelectCount, filteredData]);
|
|
13105
|
-
const embeddedTableExecuteAction =
|
|
14267
|
+
const embeddedTableExecuteAction = useCallback17(async (actionType, payload) => {
|
|
13106
14268
|
if (actionType === "FETCH_TABLE_DATA") {
|
|
13107
14269
|
const colFilters = (payload == null ? void 0 : payload.columnFilters) || (payload == null ? void 0 : payload.filters);
|
|
13108
14270
|
const searchQuery = payload == null ? void 0 : payload.search;
|
|
@@ -13145,10 +14307,10 @@ function useWhatsAppState(props) {
|
|
|
13145
14307
|
const handleClearFilters = () => {
|
|
13146
14308
|
setFilters({});
|
|
13147
14309
|
};
|
|
13148
|
-
const activeFiltersCount =
|
|
14310
|
+
const activeFiltersCount = useMemo15(() => {
|
|
13149
14311
|
return Object.values(filters).filter((v) => v !== "").length;
|
|
13150
14312
|
}, [filters]);
|
|
13151
|
-
const handleSelectionChange =
|
|
14313
|
+
const handleSelectionChange = useCallback17((selectedIds) => {
|
|
13152
14314
|
setSelectedRowIds((prev) => {
|
|
13153
14315
|
if (prev.length === selectedIds.length && prev.every((id, idx) => id === selectedIds[idx])) {
|
|
13154
14316
|
return prev;
|
|
@@ -13162,13 +14324,13 @@ function useWhatsAppState(props) {
|
|
|
13162
14324
|
return selectedIds;
|
|
13163
14325
|
});
|
|
13164
14326
|
}, [autoSelectCount]);
|
|
13165
|
-
const handleRowToggle =
|
|
14327
|
+
const handleRowToggle = useCallback17((rowId, checked) => {
|
|
13166
14328
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
13167
14329
|
isManualOverrideRef.current = true;
|
|
13168
14330
|
setAutoSelectCount(null);
|
|
13169
14331
|
}
|
|
13170
14332
|
}, [autoSelectCount]);
|
|
13171
|
-
const toggleRowSelection =
|
|
14333
|
+
const toggleRowSelection = useCallback17((rowId, checked) => {
|
|
13172
14334
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
13173
14335
|
isManualOverrideRef.current = true;
|
|
13174
14336
|
setAutoSelectCount(null);
|
|
@@ -13184,15 +14346,15 @@ function useWhatsAppState(props) {
|
|
|
13184
14346
|
return prev;
|
|
13185
14347
|
});
|
|
13186
14348
|
}, [autoSelectCount]);
|
|
13187
|
-
const [templates, setTemplates] =
|
|
13188
|
-
const [selectedTemplateId, setSelectedTemplateId] =
|
|
13189
|
-
const [isLoading, setIsLoading] =
|
|
13190
|
-
const [fetchError, setFetchError] =
|
|
13191
|
-
const [isModalOpen, setIsModalOpen] =
|
|
13192
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
13193
|
-
const [isDeleting, setIsDeleting] =
|
|
13194
|
-
const [feedback, setFeedback] =
|
|
13195
|
-
const loadTemplates =
|
|
14349
|
+
const [templates, setTemplates] = useState24([]);
|
|
14350
|
+
const [selectedTemplateId, setSelectedTemplateId] = useState24(null);
|
|
14351
|
+
const [isLoading, setIsLoading] = useState24(true);
|
|
14352
|
+
const [fetchError, setFetchError] = useState24(null);
|
|
14353
|
+
const [isModalOpen, setIsModalOpen] = useState24(false);
|
|
14354
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState24(false);
|
|
14355
|
+
const [isDeleting, setIsDeleting] = useState24(false);
|
|
14356
|
+
const [feedback, setFeedback] = useState24(null);
|
|
14357
|
+
const loadTemplates = useCallback17(async () => {
|
|
13196
14358
|
var _a2, _b2;
|
|
13197
14359
|
if (!executeAction) {
|
|
13198
14360
|
setIsLoading(false);
|
|
@@ -13244,13 +14406,13 @@ function useWhatsAppState(props) {
|
|
|
13244
14406
|
setIsLoading(false);
|
|
13245
14407
|
}
|
|
13246
14408
|
}, [executeAction, orgId]);
|
|
13247
|
-
|
|
14409
|
+
useEffect17(() => {
|
|
13248
14410
|
loadTemplates();
|
|
13249
14411
|
}, [loadTemplates]);
|
|
13250
|
-
const selectedTemplate =
|
|
14412
|
+
const selectedTemplate = useMemo15(() => {
|
|
13251
14413
|
return templates.find((t) => t.id === selectedTemplateId) || null;
|
|
13252
14414
|
}, [templates, selectedTemplateId]);
|
|
13253
|
-
const templateBodyText =
|
|
14415
|
+
const templateBodyText = useMemo15(() => {
|
|
13254
14416
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return "";
|
|
13255
14417
|
const bodyComp = selectedTemplate.components.find(
|
|
13256
14418
|
(c) => {
|
|
@@ -13260,7 +14422,7 @@ function useWhatsAppState(props) {
|
|
|
13260
14422
|
);
|
|
13261
14423
|
return (bodyComp == null ? void 0 : bodyComp.text) || "";
|
|
13262
14424
|
}, [selectedTemplate]);
|
|
13263
|
-
const templateHeaderComp =
|
|
14425
|
+
const templateHeaderComp = useMemo15(() => {
|
|
13264
14426
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return null;
|
|
13265
14427
|
return selectedTemplate.components.find(
|
|
13266
14428
|
(c) => {
|
|
@@ -13269,8 +14431,8 @@ function useWhatsAppState(props) {
|
|
|
13269
14431
|
}
|
|
13270
14432
|
) || null;
|
|
13271
14433
|
}, [selectedTemplate]);
|
|
13272
|
-
const [headerMediaUrl, setHeaderMediaUrl] =
|
|
13273
|
-
|
|
14434
|
+
const [headerMediaUrl, setHeaderMediaUrl] = useState24("");
|
|
14435
|
+
useEffect17(() => {
|
|
13274
14436
|
if (!templateHeaderComp) {
|
|
13275
14437
|
setHeaderMediaUrl("");
|
|
13276
14438
|
return;
|
|
@@ -13287,7 +14449,7 @@ function useWhatsAppState(props) {
|
|
|
13287
14449
|
setHeaderMediaUrl("");
|
|
13288
14450
|
}
|
|
13289
14451
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
13290
|
-
const handleHeaderMediaUrlChange =
|
|
14452
|
+
const handleHeaderMediaUrlChange = useCallback17(
|
|
13291
14453
|
(newUrl) => {
|
|
13292
14454
|
setHeaderMediaUrl(newUrl);
|
|
13293
14455
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
@@ -13306,7 +14468,7 @@ function useWhatsAppState(props) {
|
|
|
13306
14468
|
},
|
|
13307
14469
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
13308
14470
|
);
|
|
13309
|
-
const handleResetHeaderMediaUrl =
|
|
14471
|
+
const handleResetHeaderMediaUrl = useCallback17(() => {
|
|
13310
14472
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
13311
14473
|
try {
|
|
13312
14474
|
localStorage.removeItem(`whatsapp_template_media_${selectedTemplate.name}`);
|
|
@@ -13320,8 +14482,8 @@ function useWhatsAppState(props) {
|
|
|
13320
14482
|
);
|
|
13321
14483
|
setHeaderMediaUrl(defaultUrl || "");
|
|
13322
14484
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
13323
|
-
const [isUploadingMedia, setIsUploadingMedia] =
|
|
13324
|
-
const handleFileUpload =
|
|
14485
|
+
const [isUploadingMedia, setIsUploadingMedia] = useState24(false);
|
|
14486
|
+
const handleFileUpload = useCallback17(
|
|
13325
14487
|
async (file, templateName) => {
|
|
13326
14488
|
const tplName = templateName || (selectedTemplate == null ? void 0 : selectedTemplate.name) || "";
|
|
13327
14489
|
if (!file) return;
|
|
@@ -13362,14 +14524,14 @@ function useWhatsAppState(props) {
|
|
|
13362
14524
|
},
|
|
13363
14525
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
13364
14526
|
);
|
|
13365
|
-
const templateVariables =
|
|
14527
|
+
const templateVariables = useMemo15(() => {
|
|
13366
14528
|
return extractTemplateVariables(selectedTemplate);
|
|
13367
14529
|
}, [selectedTemplate]);
|
|
13368
|
-
const [variableMapping, setVariableMapping] =
|
|
13369
|
-
|
|
14530
|
+
const [variableMapping, setVariableMapping] = useState24({});
|
|
14531
|
+
useEffect17(() => {
|
|
13370
14532
|
setVariableMapping({});
|
|
13371
14533
|
}, [selectedTemplateId]);
|
|
13372
|
-
const textableColumnOptions =
|
|
14534
|
+
const textableColumnOptions = useMemo15(() => {
|
|
13373
14535
|
return getTextableColumnOptions({
|
|
13374
14536
|
tableColumns: tableColumns2,
|
|
13375
14537
|
selectedPhoneOption,
|
|
@@ -13395,7 +14557,7 @@ function useWhatsAppState(props) {
|
|
|
13395
14557
|
});
|
|
13396
14558
|
});
|
|
13397
14559
|
};
|
|
13398
|
-
const existingTemplateNames =
|
|
14560
|
+
const existingTemplateNames = useMemo15(() => {
|
|
13399
14561
|
return templates.map((t) => t.name);
|
|
13400
14562
|
}, [templates]);
|
|
13401
14563
|
const handleDeleteTemplate = async () => {
|
|
@@ -13442,14 +14604,14 @@ function useWhatsAppState(props) {
|
|
|
13442
14604
|
postSendActionColumn,
|
|
13443
14605
|
postSendActionValue
|
|
13444
14606
|
);
|
|
13445
|
-
const isStaticVariableMissing =
|
|
14607
|
+
const isStaticVariableMissing = useMemo15(() => {
|
|
13446
14608
|
return isStaticVariableIncomplete(templateVariables, variableMapping);
|
|
13447
14609
|
}, [templateVariables, variableMapping]);
|
|
13448
|
-
const currentRecords =
|
|
14610
|
+
const currentRecords = useMemo15(() => {
|
|
13449
14611
|
var _a2;
|
|
13450
14612
|
return rawRecords && rawRecords.length > 0 ? rawRecords : Array.isArray(props.data) ? props.data : Array.isArray((_a2 = props.data) == null ? void 0 : _a2.records) ? props.data.records : [];
|
|
13451
14613
|
}, [rawRecords, props.data]);
|
|
13452
|
-
const preparedRecipients =
|
|
14614
|
+
const preparedRecipients = useMemo15(() => {
|
|
13453
14615
|
return prepareRecipients({
|
|
13454
14616
|
selectedIds: selectedRowIds,
|
|
13455
14617
|
records: currentRecords,
|
|
@@ -13469,7 +14631,7 @@ function useWhatsAppState(props) {
|
|
|
13469
14631
|
selectedSubtableFilterCol
|
|
13470
14632
|
]);
|
|
13471
14633
|
const finalRecipientCount = preparedRecipients.length;
|
|
13472
|
-
const validMainRowsCount =
|
|
14634
|
+
const validMainRowsCount = useMemo15(() => {
|
|
13473
14635
|
const rowIdSet = new Set(
|
|
13474
14636
|
preparedRecipients.map((r) => r.mainRowId).filter(Boolean)
|
|
13475
14637
|
);
|
|
@@ -13578,7 +14740,7 @@ function useWhatsAppState(props) {
|
|
|
13578
14740
|
setIsSendingTest(false);
|
|
13579
14741
|
}
|
|
13580
14742
|
};
|
|
13581
|
-
const handleSendMessages =
|
|
14743
|
+
const handleSendMessages = useCallback17(async () => {
|
|
13582
14744
|
var _a2, _b2;
|
|
13583
14745
|
if (isSendDisabled || isSendingBroadcast) return;
|
|
13584
14746
|
const recipients = preparedRecipients;
|
|
@@ -13884,7 +15046,7 @@ function useWhatsAppState(props) {
|
|
|
13884
15046
|
}
|
|
13885
15047
|
|
|
13886
15048
|
// src/components/WhatsAppComponent/ui/TemplateSelectionBlock.tsx
|
|
13887
|
-
import { useRef as
|
|
15049
|
+
import { useRef as useRef20 } from "react";
|
|
13888
15050
|
import {
|
|
13889
15051
|
FileText as FileText3,
|
|
13890
15052
|
Trash2 as Trash23,
|
|
@@ -13901,7 +15063,7 @@ import {
|
|
|
13901
15063
|
CheckCircle2 as CheckCircle23,
|
|
13902
15064
|
AlertCircle as AlertCircle3
|
|
13903
15065
|
} from "lucide-react";
|
|
13904
|
-
import { Fragment as
|
|
15066
|
+
import { Fragment as Fragment7, jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
13905
15067
|
function TemplateSelectionBlock({
|
|
13906
15068
|
selectedTemplate,
|
|
13907
15069
|
selectedTemplateId,
|
|
@@ -13927,16 +15089,16 @@ function TemplateSelectionBlock({
|
|
|
13927
15089
|
isUploadingMedia = false,
|
|
13928
15090
|
handleFileUpload
|
|
13929
15091
|
}) {
|
|
13930
|
-
const fileInputRef =
|
|
13931
|
-
return /* @__PURE__ */
|
|
13932
|
-
/* @__PURE__ */
|
|
13933
|
-
/* @__PURE__ */
|
|
13934
|
-
/* @__PURE__ */
|
|
13935
|
-
/* @__PURE__ */
|
|
13936
|
-
/* @__PURE__ */
|
|
15092
|
+
const fileInputRef = useRef20(null);
|
|
15093
|
+
return /* @__PURE__ */ jsxs25("div", { className: "col-span-12 lg:col-span-5 min-h-[26rem] h-full flex flex-col bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 relative", children: [
|
|
15094
|
+
/* @__PURE__ */ jsxs25("div", { className: "space-y-1.5 shrink-0", children: [
|
|
15095
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
|
|
15096
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
15097
|
+
/* @__PURE__ */ jsx31(FileText3, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
|
|
15098
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-bold text-slate-800 truncate", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05D5\u05EA\u05D5\u05DB\u05DF \u05D4\u05D5\u05D3\u05E2\u05D4" })
|
|
13937
15099
|
] }),
|
|
13938
|
-
/* @__PURE__ */
|
|
13939
|
-
/* @__PURE__ */
|
|
15100
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
15101
|
+
/* @__PURE__ */ jsxs25(
|
|
13940
15102
|
"button",
|
|
13941
15103
|
{
|
|
13942
15104
|
type: "button",
|
|
@@ -13945,12 +15107,12 @@ function TemplateSelectionBlock({
|
|
|
13945
15107
|
className: `h-7 px-2 text-[11px] font-semibold rounded-lg border transition-all flex items-center gap-1 ${selectedTemplate && !isDeleting ? "bg-white text-rose-600 hover:bg-rose-50 border-rose-200 active:scale-[0.98] shadow-2xs cursor-pointer" : "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed opacity-60"}`,
|
|
13946
15108
|
title: !selectedTemplate ? "\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DB\u05D3\u05D9 \u05DC\u05DE\u05D7\u05D5\u05E7 \u05D0\u05D5\u05EA\u05D4" : `\u05DE\u05D7\u05E7 \u05D0\u05EA \u05D4\u05EA\u05D1\u05E0\u05D9\u05EA "${selectedTemplate.name}"`,
|
|
13947
15109
|
children: [
|
|
13948
|
-
isDeleting ? /* @__PURE__ */
|
|
13949
|
-
/* @__PURE__ */
|
|
15110
|
+
isDeleting ? /* @__PURE__ */ jsx31(Loader25, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ jsx31(Trash23, { className: "w-3.5 h-3.5 text-rose-500" }),
|
|
15111
|
+
/* @__PURE__ */ jsx31("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
|
|
13950
15112
|
]
|
|
13951
15113
|
}
|
|
13952
15114
|
),
|
|
13953
|
-
/* @__PURE__ */
|
|
15115
|
+
/* @__PURE__ */ jsxs25(
|
|
13954
15116
|
"button",
|
|
13955
15117
|
{
|
|
13956
15118
|
type: "button",
|
|
@@ -13958,40 +15120,40 @@ function TemplateSelectionBlock({
|
|
|
13958
15120
|
className: "h-7 px-2.5 text-[11px] font-semibold text-white bg-emerald-600 hover:bg-emerald-700 active:scale-[0.98] rounded-lg shadow-2xs transition-all flex items-center gap-1 cursor-pointer",
|
|
13959
15121
|
title: "\u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4",
|
|
13960
15122
|
children: [
|
|
13961
|
-
/* @__PURE__ */
|
|
13962
|
-
/* @__PURE__ */
|
|
15123
|
+
/* @__PURE__ */ jsx31(Plus2, { className: "w-3.5 h-3.5" }),
|
|
15124
|
+
/* @__PURE__ */ jsx31("span", { children: "\u05D7\u05D3\u05E9" })
|
|
13963
15125
|
]
|
|
13964
15126
|
}
|
|
13965
15127
|
)
|
|
13966
15128
|
] })
|
|
13967
15129
|
] }),
|
|
13968
|
-
/* @__PURE__ */
|
|
13969
|
-
/* @__PURE__ */
|
|
15130
|
+
/* @__PURE__ */ jsxs25("div", { className: "relative", children: [
|
|
15131
|
+
/* @__PURE__ */ jsxs25(
|
|
13970
15132
|
"button",
|
|
13971
15133
|
{
|
|
13972
15134
|
type: "button",
|
|
13973
15135
|
onClick: () => setIsDropdownOpen((prev) => !prev),
|
|
13974
15136
|
className: "w-full h-8.5 px-3 bg-white hover:bg-slate-100/70 border border-slate-200 rounded-xl text-right flex items-center justify-between transition-colors cursor-pointer text-xs",
|
|
13975
15137
|
children: [
|
|
13976
|
-
selectedTemplate ? /* @__PURE__ */
|
|
13977
|
-
/* @__PURE__ */
|
|
15138
|
+
selectedTemplate ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
15139
|
+
/* @__PURE__ */ jsx31(
|
|
13978
15140
|
"span",
|
|
13979
15141
|
{
|
|
13980
15142
|
className: `w-2 h-2 rounded-full shrink-0 ${getStatusConfig(selectedTemplate.status).dotColor}`
|
|
13981
15143
|
}
|
|
13982
15144
|
),
|
|
13983
|
-
/* @__PURE__ */
|
|
13984
|
-
/* @__PURE__ */
|
|
15145
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
|
|
15146
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
|
|
13985
15147
|
"(",
|
|
13986
15148
|
selectedTemplate.category,
|
|
13987
15149
|
" \u2022 ",
|
|
13988
15150
|
selectedTemplate.language,
|
|
13989
15151
|
")"
|
|
13990
15152
|
] })
|
|
13991
|
-
] }) : /* @__PURE__ */
|
|
13992
|
-
/* @__PURE__ */
|
|
13993
|
-
isLoadingTemplates && /* @__PURE__ */
|
|
13994
|
-
/* @__PURE__ */
|
|
15153
|
+
] }) : /* @__PURE__ */ jsx31("span", { className: "text-xs text-slate-400", children: "\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05E7\u05D9\u05D9\u05DE\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4..." }),
|
|
15154
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
|
|
15155
|
+
isLoadingTemplates && /* @__PURE__ */ jsx31(Loader25, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
|
|
15156
|
+
/* @__PURE__ */ jsx31(
|
|
13995
15157
|
ChevronDown4,
|
|
13996
15158
|
{
|
|
13997
15159
|
className: `w-3.5 h-3.5 text-slate-400 transition-transform ${isDropdownOpen ? "rotate-180" : ""}`
|
|
@@ -14001,21 +15163,21 @@ function TemplateSelectionBlock({
|
|
|
14001
15163
|
]
|
|
14002
15164
|
}
|
|
14003
15165
|
),
|
|
14004
|
-
isDropdownOpen && /* @__PURE__ */
|
|
14005
|
-
/* @__PURE__ */
|
|
15166
|
+
isDropdownOpen && /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15167
|
+
/* @__PURE__ */ jsx31(
|
|
14006
15168
|
"div",
|
|
14007
15169
|
{
|
|
14008
15170
|
className: "fixed inset-0 z-40",
|
|
14009
15171
|
onClick: () => setIsDropdownOpen(false)
|
|
14010
15172
|
}
|
|
14011
15173
|
),
|
|
14012
|
-
/* @__PURE__ */
|
|
14013
|
-
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */
|
|
15174
|
+
/* @__PURE__ */ jsxs25("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white border border-slate-200 rounded-xl shadow-xl z-50 max-h-52 overflow-y-auto divide-y divide-slate-100 animate-in fade-in-50 zoom-in-95 duration-100", children: [
|
|
15175
|
+
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ jsx31("div", { className: "p-3 text-center text-xs text-slate-400", children: '\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA. \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4".' }),
|
|
14014
15176
|
templates.map((tpl) => {
|
|
14015
15177
|
const statusConfig = getStatusConfig(tpl.status);
|
|
14016
15178
|
const isSelected = tpl.id === selectedTemplateId;
|
|
14017
15179
|
const canSelect = statusConfig.isSelectable;
|
|
14018
|
-
return /* @__PURE__ */
|
|
15180
|
+
return /* @__PURE__ */ jsxs25(
|
|
14019
15181
|
"div",
|
|
14020
15182
|
{
|
|
14021
15183
|
onClick: () => {
|
|
@@ -14028,29 +15190,29 @@ function TemplateSelectionBlock({
|
|
|
14028
15190
|
className: `p-2.5 flex items-center justify-between gap-2.5 transition-colors ${canSelect ? "hover:bg-slate-50 cursor-pointer" : "opacity-60 bg-slate-50/60 cursor-not-allowed"} ${isSelected ? "bg-emerald-50/50" : ""}`,
|
|
14029
15191
|
title: !canSelect ? `\u05E1\u05D8\u05D8\u05D5\u05E1 \u05EA\u05D1\u05E0\u05D9\u05EA: ${tpl.status}. \u05E8\u05E7 \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05D1\u05DE\u05E6\u05D1 \u05DE\u05D0\u05D5\u05E9\u05E8 \u05D0\u05D5 \u05E4\u05E2\u05D9\u05DC \u05E0\u05D9\u05EA\u05E0\u05D5\u05EA \u05DC\u05D1\u05D7\u05D9\u05E8\u05D4.` : void 0,
|
|
14030
15192
|
children: [
|
|
14031
|
-
/* @__PURE__ */
|
|
14032
|
-
/* @__PURE__ */
|
|
15193
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
15194
|
+
/* @__PURE__ */ jsx31(
|
|
14033
15195
|
"span",
|
|
14034
15196
|
{
|
|
14035
15197
|
className: `w-2 h-2 rounded-full shrink-0 ${statusConfig.dotColor}`
|
|
14036
15198
|
}
|
|
14037
15199
|
),
|
|
14038
|
-
/* @__PURE__ */
|
|
14039
|
-
/* @__PURE__ */
|
|
15200
|
+
/* @__PURE__ */ jsxs25("div", { className: "overflow-hidden", children: [
|
|
15201
|
+
/* @__PURE__ */ jsx31(
|
|
14040
15202
|
"p",
|
|
14041
15203
|
{
|
|
14042
15204
|
className: `text-xs font-semibold truncate ${isSelected ? "text-emerald-700" : canSelect ? "text-slate-800" : "text-slate-500"}`,
|
|
14043
15205
|
children: tpl.name
|
|
14044
15206
|
}
|
|
14045
15207
|
),
|
|
14046
|
-
/* @__PURE__ */
|
|
15208
|
+
/* @__PURE__ */ jsxs25("p", { className: "text-[10px] text-slate-400", children: [
|
|
14047
15209
|
tpl.category,
|
|
14048
15210
|
" \u2022 ",
|
|
14049
15211
|
tpl.language
|
|
14050
15212
|
] })
|
|
14051
15213
|
] })
|
|
14052
15214
|
] }),
|
|
14053
|
-
/* @__PURE__ */
|
|
15215
|
+
/* @__PURE__ */ jsx31(
|
|
14054
15216
|
"span",
|
|
14055
15217
|
{
|
|
14056
15218
|
className: `text-[9px] font-semibold px-2 py-0.5 rounded-full border shrink-0 ${statusConfig.badgeBg} ${statusConfig.badgeText}`,
|
|
@@ -14066,18 +15228,18 @@ function TemplateSelectionBlock({
|
|
|
14066
15228
|
] })
|
|
14067
15229
|
] })
|
|
14068
15230
|
] }),
|
|
14069
|
-
/* @__PURE__ */
|
|
14070
|
-
/* @__PURE__ */
|
|
14071
|
-
/* @__PURE__ */
|
|
14072
|
-
selectedTemplate && /* @__PURE__ */
|
|
15231
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
|
|
15232
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
|
|
15233
|
+
/* @__PURE__ */ jsx31("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
|
|
15234
|
+
selectedTemplate && /* @__PURE__ */ jsxs25("span", { className: "text-[10px] text-slate-400", children: [
|
|
14073
15235
|
"(",
|
|
14074
15236
|
templateBodyText.length,
|
|
14075
15237
|
" \u05EA\u05D5\u05D5\u05D9\u05DD)"
|
|
14076
15238
|
] })
|
|
14077
15239
|
] }),
|
|
14078
|
-
selectedTemplate ? /* @__PURE__ */
|
|
14079
|
-
/* @__PURE__ */
|
|
14080
|
-
/* @__PURE__ */
|
|
15240
|
+
selectedTemplate ? /* @__PURE__ */ jsx31("div", { className: "flex-1 min-h-0 overflow-y-auto bg-white border border-slate-200 rounded-lg p-3 text-sm text-slate-700 leading-relaxed font-sans whitespace-pre-wrap select-all shadow-2xs", children: templateBodyText || "(\u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E8\u05D9\u05E7)" }) : /* @__PURE__ */ jsxs25("div", { className: "flex-1 min-h-0 py-3 bg-white border border-dashed border-slate-200 rounded-lg text-center text-sm text-slate-400 flex flex-col items-center justify-center gap-0.5", children: [
|
|
15241
|
+
/* @__PURE__ */ jsx31("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
|
|
15242
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs text-slate-400", children: '\u05D1\u05D7\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05DE\u05D4\u05E8\u05E9\u05D9\u05DE\u05D4 \u05D0\u05D5 \u05DC\u05D7\u05E5 \u05E2\u05DC "+ \u05D7\u05D3\u05E9"' })
|
|
14081
15243
|
] }),
|
|
14082
15244
|
selectedTemplate && (() => {
|
|
14083
15245
|
var _a;
|
|
@@ -14086,19 +15248,19 @@ function TemplateSelectionBlock({
|
|
|
14086
15248
|
);
|
|
14087
15249
|
const tplButtons = (buttonsComp == null ? void 0 : buttonsComp.buttons) || [];
|
|
14088
15250
|
if (!tplButtons || tplButtons.length === 0) return null;
|
|
14089
|
-
return /* @__PURE__ */
|
|
15251
|
+
return /* @__PURE__ */ jsx31("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
|
|
14090
15252
|
const btnType = (btn.type || "").toUpperCase();
|
|
14091
15253
|
const btnText = btn.text || (btnType === "COPY_CODE" ? `\u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3: ${btn.example}` : "\u05DB\u05E4\u05EA\u05D5\u05E8");
|
|
14092
|
-
return /* @__PURE__ */
|
|
15254
|
+
return /* @__PURE__ */ jsxs25(
|
|
14093
15255
|
"div",
|
|
14094
15256
|
{
|
|
14095
15257
|
className: "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg bg-white border border-slate-200/90 text-slate-700 text-xs font-semibold shadow-2xs select-none",
|
|
14096
15258
|
children: [
|
|
14097
|
-
btnType === "QUICK_REPLY" && /* @__PURE__ */
|
|
14098
|
-
btnType === "URL" && /* @__PURE__ */
|
|
14099
|
-
btnType === "PHONE_NUMBER" && /* @__PURE__ */
|
|
14100
|
-
btnType === "COPY_CODE" && /* @__PURE__ */
|
|
14101
|
-
/* @__PURE__ */
|
|
15259
|
+
btnType === "QUICK_REPLY" && /* @__PURE__ */ jsx31(MessageSquare2, { className: "w-3 h-3 text-emerald-600" }),
|
|
15260
|
+
btnType === "URL" && /* @__PURE__ */ jsx31(ExternalLink4, { className: "w-3 h-3 text-sky-600" }),
|
|
15261
|
+
btnType === "PHONE_NUMBER" && /* @__PURE__ */ jsx31(Phone2, { className: "w-3 h-3 text-violet-600" }),
|
|
15262
|
+
btnType === "COPY_CODE" && /* @__PURE__ */ jsx31(Copy4, { className: "w-3 h-3 text-amber-600" }),
|
|
15263
|
+
/* @__PURE__ */ jsx31("span", { className: "truncate max-w-[180px]", children: btnText })
|
|
14102
15264
|
]
|
|
14103
15265
|
},
|
|
14104
15266
|
idx
|
|
@@ -14113,9 +15275,9 @@ function TemplateSelectionBlock({
|
|
|
14113
15275
|
const docFilename = resolveDocumentFilename(templateHeaderComp, headerMediaUrl);
|
|
14114
15276
|
const hasValidMedia = Boolean(headerMediaUrl && headerMediaUrl.trim() && headerMediaUrl.startsWith("http"));
|
|
14115
15277
|
const uploadButtonLabel = headerFormat === "DOCUMENT" ? "\u05D4\u05E2\u05DC\u05D4 \u05DE\u05E1\u05DE\u05DA" : headerFormat === "IMAGE" ? "\u05D4\u05E2\u05DC\u05D4 \u05EA\u05DE\u05D5\u05E0\u05D4" : "\u05D4\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5";
|
|
14116
|
-
return /* @__PURE__ */
|
|
14117
|
-
/* @__PURE__ */
|
|
14118
|
-
/* @__PURE__ */
|
|
15278
|
+
return /* @__PURE__ */ jsxs25("div", { className: "p-2.5 bg-slate-50 border border-slate-200/90 rounded-xl flex items-center justify-between gap-3 shrink-0 shadow-2xs", children: [
|
|
15279
|
+
/* @__PURE__ */ jsx31("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15280
|
+
/* @__PURE__ */ jsx31("div", { className: "w-8 h-8 rounded-lg overflow-hidden border border-slate-200 shrink-0 bg-slate-100 flex items-center justify-center", children: hasValidMedia ? /* @__PURE__ */ jsx31(
|
|
14119
15281
|
"img",
|
|
14120
15282
|
{
|
|
14121
15283
|
src: headerMediaUrl,
|
|
@@ -14125,33 +15287,33 @@ function TemplateSelectionBlock({
|
|
|
14125
15287
|
e.currentTarget.style.display = "none";
|
|
14126
15288
|
}
|
|
14127
15289
|
}
|
|
14128
|
-
) : /* @__PURE__ */
|
|
14129
|
-
/* @__PURE__ */
|
|
14130
|
-
/* @__PURE__ */
|
|
14131
|
-
/* @__PURE__ */
|
|
15290
|
+
) : /* @__PURE__ */ jsx31(ImageIcon2, { className: "w-4 h-4 text-amber-600" }) }),
|
|
15291
|
+
/* @__PURE__ */ jsxs25("div", { className: "overflow-hidden", children: [
|
|
15292
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
15293
|
+
/* @__PURE__ */ jsx31("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05EA\u05DE\u05D5\u05E0\u05D4" })
|
|
14132
15294
|
] })
|
|
14133
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */
|
|
14134
|
-
/* @__PURE__ */
|
|
14135
|
-
/* @__PURE__ */
|
|
14136
|
-
/* @__PURE__ */
|
|
14137
|
-
/* @__PURE__ */
|
|
15295
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15296
|
+
/* @__PURE__ */ jsx31("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-rose-50 text-rose-600 border-rose-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ jsx31(FileText3, { className: "w-4 h-4" }) }),
|
|
15297
|
+
/* @__PURE__ */ jsxs25("div", { className: "overflow-hidden", children: [
|
|
15298
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
15299
|
+
/* @__PURE__ */ jsx31("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: hasValidMedia ? docFilename : void 0, children: hasValidMedia ? docFilename : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05E1\u05DE\u05DA" })
|
|
14138
15300
|
] })
|
|
14139
|
-
] }) : /* @__PURE__ */
|
|
14140
|
-
/* @__PURE__ */
|
|
14141
|
-
/* @__PURE__ */
|
|
14142
|
-
/* @__PURE__ */
|
|
14143
|
-
/* @__PURE__ */
|
|
15301
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15302
|
+
/* @__PURE__ */ jsx31("div", { className: `w-8 h-8 rounded-lg flex items-center justify-center shrink-0 border ${hasValidMedia ? "bg-indigo-50 text-indigo-600 border-indigo-100" : "bg-slate-100 text-slate-400 border-slate-200"}`, children: /* @__PURE__ */ jsx31(Video2, { className: "w-4 h-4" }) }),
|
|
15303
|
+
/* @__PURE__ */ jsxs25("div", { className: "overflow-hidden", children: [
|
|
15304
|
+
/* @__PURE__ */ jsx31("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
15305
|
+
/* @__PURE__ */ jsx31("span", { className: "text-[10px] text-slate-400 block truncate", children: hasValidMedia ? "\u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5 \u05DE\u05E7\u05D5\u05E9\u05E8 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA" : "\u05D8\u05E8\u05DD \u05D4\u05D5\u05E2\u05DC\u05D4 \u05E7\u05D5\u05D1\u05E5 \u05D5\u05D9\u05D3\u05D0\u05D5" })
|
|
14144
15306
|
] })
|
|
14145
15307
|
] }) }),
|
|
14146
|
-
/* @__PURE__ */
|
|
14147
|
-
hasValidMedia ? /* @__PURE__ */
|
|
14148
|
-
/* @__PURE__ */
|
|
15308
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
15309
|
+
hasValidMedia ? /* @__PURE__ */ jsxs25("span", { className: "inline-flex items-center gap-1 text-[10px] font-medium text-emerald-800 px-2 py-0.5 bg-emerald-50 border border-emerald-200 rounded-lg", children: [
|
|
15310
|
+
/* @__PURE__ */ jsx31(CheckCircle23, { className: "w-3 h-3 text-emerald-600" }),
|
|
14149
15311
|
"\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF"
|
|
14150
|
-
] }) : /* @__PURE__ */
|
|
14151
|
-
/* @__PURE__ */
|
|
15312
|
+
] }) : /* @__PURE__ */ jsxs25("span", { className: "inline-flex items-center gap-1 text-[10px] font-semibold text-amber-800 px-2 py-0.5 bg-amber-50 border border-amber-200 rounded-lg", children: [
|
|
15313
|
+
/* @__PURE__ */ jsx31(AlertCircle3, { className: "w-3 h-3 text-amber-600 shrink-0" }),
|
|
14152
15314
|
"\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5"
|
|
14153
15315
|
] }),
|
|
14154
|
-
hasValidMedia && /* @__PURE__ */
|
|
15316
|
+
hasValidMedia && /* @__PURE__ */ jsx31(
|
|
14155
15317
|
"a",
|
|
14156
15318
|
{
|
|
14157
15319
|
href: headerMediaUrl,
|
|
@@ -14159,10 +15321,10 @@ function TemplateSelectionBlock({
|
|
|
14159
15321
|
rel: "noopener noreferrer",
|
|
14160
15322
|
title: "\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E9\u05DC \u05D4\u05E7\u05D5\u05D1\u05E5",
|
|
14161
15323
|
className: "p-1 text-slate-400 hover:text-emerald-700 hover:bg-slate-200/60 rounded-md transition-colors",
|
|
14162
|
-
children: /* @__PURE__ */
|
|
15324
|
+
children: /* @__PURE__ */ jsx31(ExternalLink4, { className: "w-3.5 h-3.5" })
|
|
14163
15325
|
}
|
|
14164
15326
|
),
|
|
14165
|
-
/* @__PURE__ */
|
|
15327
|
+
/* @__PURE__ */ jsx31(
|
|
14166
15328
|
"input",
|
|
14167
15329
|
{
|
|
14168
15330
|
ref: fileInputRef,
|
|
@@ -14180,7 +15342,7 @@ function TemplateSelectionBlock({
|
|
|
14180
15342
|
disabled: isUploadingMedia
|
|
14181
15343
|
}
|
|
14182
15344
|
),
|
|
14183
|
-
/* @__PURE__ */
|
|
15345
|
+
/* @__PURE__ */ jsx31(
|
|
14184
15346
|
"button",
|
|
14185
15347
|
{
|
|
14186
15348
|
type: "button",
|
|
@@ -14191,39 +15353,39 @@ function TemplateSelectionBlock({
|
|
|
14191
15353
|
},
|
|
14192
15354
|
className: `inline-flex items-center gap-1.5 px-2.5 py-1 text-[11px] font-medium rounded-lg transition-colors border shadow-2xs ${isUploadingMedia ? "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed" : hasValidMedia ? "bg-white text-slate-700 hover:bg-slate-50 border-slate-200 hover:border-slate-300" : "bg-emerald-600 text-white hover:bg-emerald-700 border-emerald-600"}`,
|
|
14193
15355
|
title: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DE\u05D3\u05D9\u05D4 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5" : `${uploadButtonLabel} \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5`,
|
|
14194
|
-
children: isUploadingMedia ? /* @__PURE__ */
|
|
14195
|
-
/* @__PURE__ */
|
|
14196
|
-
/* @__PURE__ */
|
|
14197
|
-
] }) : /* @__PURE__ */
|
|
14198
|
-
/* @__PURE__ */
|
|
14199
|
-
/* @__PURE__ */
|
|
15356
|
+
children: isUploadingMedia ? /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15357
|
+
/* @__PURE__ */ jsx31(Loader25, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
15358
|
+
/* @__PURE__ */ jsx31("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
|
|
15359
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment7, { children: [
|
|
15360
|
+
/* @__PURE__ */ jsx31(Upload3, { className: "w-3.5 h-3.5" }),
|
|
15361
|
+
/* @__PURE__ */ jsx31("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
|
|
14200
15362
|
] })
|
|
14201
15363
|
}
|
|
14202
15364
|
)
|
|
14203
15365
|
] })
|
|
14204
15366
|
] });
|
|
14205
15367
|
})(),
|
|
14206
|
-
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */
|
|
14207
|
-
/* @__PURE__ */
|
|
14208
|
-
/* @__PURE__ */
|
|
14209
|
-
/* @__PURE__ */
|
|
15368
|
+
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ jsxs25("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
|
|
15369
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between shrink-0", children: [
|
|
15370
|
+
/* @__PURE__ */ jsx31("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
|
|
15371
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200", children: [
|
|
14210
15372
|
templateVariables.length,
|
|
14211
15373
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
14212
15374
|
] })
|
|
14213
15375
|
] }),
|
|
14214
|
-
/* @__PURE__ */
|
|
15376
|
+
/* @__PURE__ */ jsx31("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
|
|
14215
15377
|
var _a;
|
|
14216
15378
|
const mapping = variableMapping[varKey] || { type: "column", value: "" };
|
|
14217
15379
|
const isStatic = mapping.type === "static";
|
|
14218
15380
|
const selectedColVal = textableColumnOptions.some((o) => o.id === mapping.value) ? mapping.value : ((_a = textableColumnOptions.find((o) => o.columnName === mapping.value)) == null ? void 0 : _a.id) || mapping.value || "";
|
|
14219
|
-
return /* @__PURE__ */
|
|
15381
|
+
return /* @__PURE__ */ jsxs25(
|
|
14220
15382
|
"div",
|
|
14221
15383
|
{
|
|
14222
15384
|
className: "flex items-center gap-1.5 p-1 bg-white border border-slate-200 rounded-xl text-xs shrink-0",
|
|
14223
15385
|
children: [
|
|
14224
|
-
/* @__PURE__ */
|
|
14225
|
-
/* @__PURE__ */
|
|
14226
|
-
/* @__PURE__ */
|
|
15386
|
+
/* @__PURE__ */ jsx31("span", { className: "px-2 py-0.5 bg-emerald-50 text-emerald-800 font-mono font-bold text-[11px] rounded-lg border border-emerald-200/80 shrink-0", children: `{{${varKey}}}` }),
|
|
15387
|
+
/* @__PURE__ */ jsxs25("div", { className: "inline-flex items-center p-0.5 bg-slate-100 rounded-lg border border-slate-200/80 shrink-0 text-[10px] font-medium", children: [
|
|
15388
|
+
/* @__PURE__ */ jsx31(
|
|
14227
15389
|
"button",
|
|
14228
15390
|
{
|
|
14229
15391
|
type: "button",
|
|
@@ -14232,7 +15394,7 @@ function TemplateSelectionBlock({
|
|
|
14232
15394
|
children: "\u05E2\u05DE\u05D5\u05D3\u05D4"
|
|
14233
15395
|
}
|
|
14234
15396
|
),
|
|
14235
|
-
/* @__PURE__ */
|
|
15397
|
+
/* @__PURE__ */ jsx31(
|
|
14236
15398
|
"button",
|
|
14237
15399
|
{
|
|
14238
15400
|
type: "button",
|
|
@@ -14242,7 +15404,7 @@ function TemplateSelectionBlock({
|
|
|
14242
15404
|
}
|
|
14243
15405
|
)
|
|
14244
15406
|
] }),
|
|
14245
|
-
isStatic ? /* @__PURE__ */
|
|
15407
|
+
isStatic ? /* @__PURE__ */ jsx31(
|
|
14246
15408
|
"input",
|
|
14247
15409
|
{
|
|
14248
15410
|
type: "text",
|
|
@@ -14251,20 +15413,20 @@ function TemplateSelectionBlock({
|
|
|
14251
15413
|
placeholder: "\u05D4\u05D6\u05DF \u05E2\u05E8\u05DA \u05E7\u05D1\u05D5\u05E2 (\u05D7\u05D5\u05D1\u05D4)...",
|
|
14252
15414
|
className: `flex-1 min-w-0 h-7 px-2 text-[11px] rounded-lg border bg-white text-slate-800 placeholder:text-slate-400 focus:outline-none transition-colors ${!mapping.value || mapping.value.trim() === "" ? "border-amber-300 focus:border-amber-500 focus:ring-1 focus:ring-amber-500/20" : "border-slate-200 focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500/20"}`
|
|
14253
15415
|
}
|
|
14254
|
-
) : /* @__PURE__ */
|
|
14255
|
-
/* @__PURE__ */
|
|
15416
|
+
) : /* @__PURE__ */ jsxs25("div", { className: "relative flex-1 min-w-0", children: [
|
|
15417
|
+
/* @__PURE__ */ jsxs25(
|
|
14256
15418
|
"select",
|
|
14257
15419
|
{
|
|
14258
15420
|
value: selectedColVal,
|
|
14259
15421
|
onChange: (e) => handleVariableValueChange(varKey, e.target.value),
|
|
14260
15422
|
className: "w-full h-7 pr-2.5 pl-6 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 focus:border-emerald-500 focus:ring-1 focus:ring-emerald-500/20 cursor-pointer truncate appearance-none",
|
|
14261
15423
|
children: [
|
|
14262
|
-
/* @__PURE__ */
|
|
14263
|
-
textableColumnOptions.map((opt) => /* @__PURE__ */
|
|
15424
|
+
/* @__PURE__ */ jsx31("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
15425
|
+
textableColumnOptions.map((opt) => /* @__PURE__ */ jsx31("option", { value: opt.id, children: opt.label }, opt.id))
|
|
14264
15426
|
]
|
|
14265
15427
|
}
|
|
14266
15428
|
),
|
|
14267
|
-
/* @__PURE__ */
|
|
15429
|
+
/* @__PURE__ */ jsx31(ChevronDown4, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14268
15430
|
] })
|
|
14269
15431
|
]
|
|
14270
15432
|
},
|
|
@@ -14284,7 +15446,7 @@ import {
|
|
|
14284
15446
|
CheckSquare,
|
|
14285
15447
|
RefreshCw
|
|
14286
15448
|
} from "lucide-react";
|
|
14287
|
-
import { Fragment as
|
|
15449
|
+
import { Fragment as Fragment8, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
14288
15450
|
function DynamicFiltersBlock({
|
|
14289
15451
|
filterableColumns,
|
|
14290
15452
|
filters,
|
|
@@ -14299,31 +15461,31 @@ function DynamicFiltersBlock({
|
|
|
14299
15461
|
loadTableData,
|
|
14300
15462
|
isLoadingTableData
|
|
14301
15463
|
}) {
|
|
14302
|
-
return /* @__PURE__ */
|
|
14303
|
-
/* @__PURE__ */
|
|
14304
|
-
/* @__PURE__ */
|
|
14305
|
-
/* @__PURE__ */
|
|
14306
|
-
/* @__PURE__ */
|
|
14307
|
-
/* @__PURE__ */
|
|
14308
|
-
activeFiltersCount > 0 && /* @__PURE__ */
|
|
15464
|
+
return /* @__PURE__ */ jsxs26("div", { className: "col-span-12 lg:col-span-3 min-h-[26rem] h-full flex flex-col justify-between bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2", children: [
|
|
15465
|
+
/* @__PURE__ */ jsxs26("div", { className: "space-y-2", children: [
|
|
15466
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
15467
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
15468
|
+
/* @__PURE__ */ jsx32(Filter3, { className: "w-4 h-4 text-emerald-600" }),
|
|
15469
|
+
/* @__PURE__ */ jsx32("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
|
|
15470
|
+
activeFiltersCount > 0 && /* @__PURE__ */ jsx32("span", { className: "text-[10px] font-bold px-1.5 py-0.5 rounded-full bg-emerald-100 text-emerald-800 border border-emerald-200", children: activeFiltersCount })
|
|
14309
15471
|
] }),
|
|
14310
|
-
activeFiltersCount > 0 && /* @__PURE__ */
|
|
15472
|
+
activeFiltersCount > 0 && /* @__PURE__ */ jsxs26(
|
|
14311
15473
|
"button",
|
|
14312
15474
|
{
|
|
14313
15475
|
type: "button",
|
|
14314
15476
|
onClick: handleClearFilters,
|
|
14315
15477
|
className: "text-[11px] text-rose-600 hover:text-rose-700 font-semibold hover:underline flex items-center gap-1 cursor-pointer",
|
|
14316
15478
|
children: [
|
|
14317
|
-
/* @__PURE__ */
|
|
14318
|
-
/* @__PURE__ */
|
|
15479
|
+
/* @__PURE__ */ jsx32(X10, { className: "w-3 h-3" }),
|
|
15480
|
+
/* @__PURE__ */ jsx32("span", { children: "\u05E0\u05E7\u05D4" })
|
|
14319
15481
|
]
|
|
14320
15482
|
}
|
|
14321
15483
|
)
|
|
14322
15484
|
] }),
|
|
14323
|
-
/* @__PURE__ */
|
|
14324
|
-
/* @__PURE__ */
|
|
14325
|
-
/* @__PURE__ */
|
|
14326
|
-
] }) : /* @__PURE__ */
|
|
15485
|
+
/* @__PURE__ */ jsx32("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ jsxs26("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
|
|
15486
|
+
/* @__PURE__ */ jsx32("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
|
|
15487
|
+
/* @__PURE__ */ jsx32("span", { className: "text-[10px] text-slate-400", children: "\u05E9\u05D3\u05D5\u05EA \u05DE\u05E1\u05D5\u05D2 \u05E7\u05E9\u05E8 \u05D5\u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9 \u05D1\u05DC\u05D1\u05D3" })
|
|
15488
|
+
] }) : /* @__PURE__ */ jsx32("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
|
|
14327
15489
|
var _a, _b, _c;
|
|
14328
15490
|
const colType = (_a = col.type) == null ? void 0 : _a.toUpperCase();
|
|
14329
15491
|
const isBoolean = colType === "BOOLEAN";
|
|
@@ -14331,9 +15493,9 @@ function DynamicFiltersBlock({
|
|
|
14331
15493
|
const isActive = Boolean(currentValue);
|
|
14332
15494
|
const refTableId = ((_b = col == null ? void 0 : col.config) == null ? void 0 : _b.referencedTableId) || (col == null ? void 0 : col.referencedTableId);
|
|
14333
15495
|
const options = ((_c = getRelationOptionsForCol ? getRelationOptionsForCol(col.name) : []) == null ? void 0 : _c.length) > 0 ? getRelationOptionsForCol(col.name) : relationOptions[col.name] && relationOptions[col.name].length > 0 ? relationOptions[col.name] : refTableId && relationOptions[refTableId] && relationOptions[refTableId].length > 0 ? relationOptions[refTableId] : col.id && relationOptions[col.id] && relationOptions[col.id].length > 0 ? relationOptions[col.id] : [];
|
|
14334
|
-
return /* @__PURE__ */
|
|
14335
|
-
/* @__PURE__ */
|
|
14336
|
-
/* @__PURE__ */
|
|
15496
|
+
return /* @__PURE__ */ jsxs26("div", { className: "space-y-1", children: [
|
|
15497
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
|
|
15498
|
+
/* @__PURE__ */ jsx32(
|
|
14337
15499
|
"label",
|
|
14338
15500
|
{
|
|
14339
15501
|
className: "text-[11px] font-semibold text-slate-700 truncate max-w-[130px]",
|
|
@@ -14341,49 +15503,49 @@ function DynamicFiltersBlock({
|
|
|
14341
15503
|
children: col.name
|
|
14342
15504
|
}
|
|
14343
15505
|
),
|
|
14344
|
-
/* @__PURE__ */
|
|
15506
|
+
/* @__PURE__ */ jsx32("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
|
|
14345
15507
|
] }),
|
|
14346
|
-
/* @__PURE__ */
|
|
14347
|
-
/* @__PURE__ */
|
|
15508
|
+
/* @__PURE__ */ jsxs26("div", { className: "relative", children: [
|
|
15509
|
+
/* @__PURE__ */ jsxs26(
|
|
14348
15510
|
"select",
|
|
14349
15511
|
{
|
|
14350
15512
|
value: currentValue,
|
|
14351
15513
|
onChange: (e) => handleFilterChange(col.name, e.target.value),
|
|
14352
15514
|
className: `w-full h-8 px-2 pr-2.5 pl-6 text-[11px] rounded-lg border transition-all appearance-none bg-white cursor-pointer truncate ${isActive ? "border-emerald-500 bg-emerald-50/20 text-emerald-900 font-medium ring-1 ring-emerald-500/20" : "border-slate-200 text-slate-700 hover:border-slate-300 focus:border-emerald-500"}`,
|
|
14353
15515
|
children: [
|
|
14354
|
-
/* @__PURE__ */
|
|
14355
|
-
isBoolean ? /* @__PURE__ */
|
|
14356
|
-
/* @__PURE__ */
|
|
14357
|
-
/* @__PURE__ */
|
|
14358
|
-
] }) : options.map((opt) => /* @__PURE__ */
|
|
15516
|
+
/* @__PURE__ */ jsx32("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
15517
|
+
isBoolean ? /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
15518
|
+
/* @__PURE__ */ jsx32("option", { value: "true", children: "\u05DB\u05DF" }),
|
|
15519
|
+
/* @__PURE__ */ jsx32("option", { value: "false", children: "\u05DC\u05D0" })
|
|
15520
|
+
] }) : options.map((opt) => /* @__PURE__ */ jsx32("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
|
|
14359
15521
|
]
|
|
14360
15522
|
}
|
|
14361
15523
|
),
|
|
14362
|
-
/* @__PURE__ */
|
|
15524
|
+
/* @__PURE__ */ jsx32(ChevronDown5, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14363
15525
|
] })
|
|
14364
15526
|
] }, col.name);
|
|
14365
15527
|
}) }) })
|
|
14366
15528
|
] }),
|
|
14367
|
-
/* @__PURE__ */
|
|
14368
|
-
/* @__PURE__ */
|
|
15529
|
+
/* @__PURE__ */ jsxs26("div", { className: "pt-2.5 mt-2 border-t border-slate-200/80 flex items-center justify-between gap-1.5 shrink-0", children: [
|
|
15530
|
+
/* @__PURE__ */ jsxs26(
|
|
14369
15531
|
"div",
|
|
14370
15532
|
{
|
|
14371
15533
|
className: `inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[11px] font-semibold border transition-all ${selectedRowIds.length > 0 ? "bg-emerald-50 text-emerald-800 border-emerald-200 shadow-2xs" : "bg-white text-slate-600 border-slate-200"}`,
|
|
14372
15534
|
children: [
|
|
14373
|
-
/* @__PURE__ */
|
|
15535
|
+
/* @__PURE__ */ jsx32(
|
|
14374
15536
|
CheckSquare,
|
|
14375
15537
|
{
|
|
14376
15538
|
className: `w-3 h-3 ${selectedRowIds.length > 0 ? "text-emerald-600" : "text-slate-400"}`
|
|
14377
15539
|
}
|
|
14378
15540
|
),
|
|
14379
|
-
/* @__PURE__ */
|
|
15541
|
+
/* @__PURE__ */ jsxs26("span", { children: [
|
|
14380
15542
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
14381
15543
|
selectedRowIds.length
|
|
14382
15544
|
] })
|
|
14383
15545
|
]
|
|
14384
15546
|
}
|
|
14385
15547
|
),
|
|
14386
|
-
/* @__PURE__ */
|
|
15548
|
+
/* @__PURE__ */ jsx32(
|
|
14387
15549
|
"button",
|
|
14388
15550
|
{
|
|
14389
15551
|
type: "button",
|
|
@@ -14391,7 +15553,7 @@ function DynamicFiltersBlock({
|
|
|
14391
15553
|
disabled: isLoadingTableData,
|
|
14392
15554
|
className: "p-1.5 text-slate-500 hover:text-slate-800 bg-white hover:bg-slate-100 border border-slate-200 rounded-lg transition-colors cursor-pointer disabled:opacity-50 shrink-0",
|
|
14393
15555
|
title: "\u05E8\u05E2\u05E0\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9 \u05D8\u05D1\u05DC\u05D4",
|
|
14394
|
-
children: /* @__PURE__ */
|
|
15556
|
+
children: /* @__PURE__ */ jsx32(
|
|
14395
15557
|
RefreshCw,
|
|
14396
15558
|
{
|
|
14397
15559
|
className: `w-3.5 h-3.5 ${isLoadingTableData ? "animate-spin text-emerald-600" : ""}`
|
|
@@ -14414,7 +15576,7 @@ import {
|
|
|
14414
15576
|
X as X11,
|
|
14415
15577
|
CheckSquare as CheckSquare2
|
|
14416
15578
|
} from "lucide-react";
|
|
14417
|
-
import { Fragment as
|
|
15579
|
+
import { Fragment as Fragment9, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
14418
15580
|
function SettingsAndActionsBlock({
|
|
14419
15581
|
isScanningPhoneColumns,
|
|
14420
15582
|
targetPhoneOptions,
|
|
@@ -14457,29 +15619,29 @@ function SettingsAndActionsBlock({
|
|
|
14457
15619
|
clearBroadcastSummary
|
|
14458
15620
|
}) {
|
|
14459
15621
|
var _a;
|
|
14460
|
-
return /* @__PURE__ */
|
|
14461
|
-
/* @__PURE__ */
|
|
14462
|
-
/* @__PURE__ */
|
|
14463
|
-
/* @__PURE__ */
|
|
14464
|
-
/* @__PURE__ */
|
|
15622
|
+
return /* @__PURE__ */ jsxs27("div", { className: "col-span-12 lg:col-span-4 min-h-[26rem] flex flex-col justify-between bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2", children: [
|
|
15623
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-2", children: [
|
|
15624
|
+
/* @__PURE__ */ jsx33("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
|
|
15625
|
+
/* @__PURE__ */ jsx33("span", { className: "text-sm", children: "\u2699\uFE0F" }),
|
|
15626
|
+
/* @__PURE__ */ jsx33("span", { className: "text-xs font-bold text-slate-800", children: "\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05D5\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA" })
|
|
14465
15627
|
] }) }),
|
|
14466
|
-
/* @__PURE__ */
|
|
14467
|
-
isScanningPhoneColumns && targetPhoneOptions.length === 0 ? /* @__PURE__ */
|
|
14468
|
-
/* @__PURE__ */
|
|
14469
|
-
/* @__PURE__ */
|
|
14470
|
-
] }) : targetPhoneOptions.length === 0 ? /* @__PURE__ */
|
|
14471
|
-
/* @__PURE__ */
|
|
14472
|
-
/* @__PURE__ */
|
|
14473
|
-
] }) : targetPhoneOptions.length === 1 && targetPhoneOptions[0].type === "DIRECT" ? /* @__PURE__ */
|
|
14474
|
-
/* @__PURE__ */
|
|
14475
|
-
/* @__PURE__ */
|
|
14476
|
-
/* @__PURE__ */
|
|
14477
|
-
/* @__PURE__ */
|
|
15628
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-2.5 py-1", children: [
|
|
15629
|
+
isScanningPhoneColumns && targetPhoneOptions.length === 0 ? /* @__PURE__ */ jsxs27("div", { className: "p-2.5 bg-slate-100/80 border border-slate-200 rounded-xl text-slate-500 text-xs flex items-center gap-2 shadow-2xs animate-pulse", children: [
|
|
15630
|
+
/* @__PURE__ */ jsx33(Loader26, { className: "w-4 h-4 animate-spin text-emerald-600 shrink-0" }),
|
|
15631
|
+
/* @__PURE__ */ jsx33("span", { className: "font-medium text-[11px] text-slate-600", children: "\u05E1\u05D5\u05E8\u05E7 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D5\u05D1\u05D8\u05D1\u05DC\u05D0\u05D5\u05EA \u05DE\u05E7\u05D5\u05E9\u05E8\u05D5\u05EA..." })
|
|
15632
|
+
] }) : targetPhoneOptions.length === 0 ? /* @__PURE__ */ jsxs27("div", { className: "p-2.5 bg-amber-50 border border-amber-200 rounded-xl text-amber-900 text-xs flex items-center gap-2 shadow-2xs", children: [
|
|
15633
|
+
/* @__PURE__ */ jsx33(AlertCircle4, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
15634
|
+
/* @__PURE__ */ jsx33("span", { className: "font-semibold text-[11px]", children: "\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D4 \u05E2\u05DE\u05D5\u05D3\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4" })
|
|
15635
|
+
] }) : targetPhoneOptions.length === 1 && targetPhoneOptions[0].type === "DIRECT" ? /* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15636
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15637
|
+
/* @__PURE__ */ jsxs27("label", { className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1", children: [
|
|
15638
|
+
/* @__PURE__ */ jsx33(Phone3, { className: "w-3 h-3 text-slate-400" }),
|
|
15639
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D9\u05E2\u05D3" })
|
|
14478
15640
|
] }),
|
|
14479
|
-
/* @__PURE__ */
|
|
15641
|
+
/* @__PURE__ */ jsx33("span", { className: "text-[9px] font-medium text-slate-500 bg-slate-100 px-1.5 py-0.5 rounded border border-slate-200", children: "\u05D6\u05D5\u05D4\u05EA\u05D4 \u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9\u05EA" })
|
|
14480
15642
|
] }),
|
|
14481
|
-
/* @__PURE__ */
|
|
14482
|
-
/* @__PURE__ */
|
|
15643
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15644
|
+
/* @__PURE__ */ jsx33(
|
|
14483
15645
|
"input",
|
|
14484
15646
|
{
|
|
14485
15647
|
type: "text",
|
|
@@ -14489,52 +15651,52 @@ function SettingsAndActionsBlock({
|
|
|
14489
15651
|
className: "w-full h-8 px-2.5 pl-7 text-[11px] rounded-lg border border-slate-200 bg-slate-100 text-slate-600 cursor-not-allowed font-medium select-none"
|
|
14490
15652
|
}
|
|
14491
15653
|
),
|
|
14492
|
-
/* @__PURE__ */
|
|
15654
|
+
/* @__PURE__ */ jsx33(Phone3, { className: "w-3.5 h-3.5 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14493
15655
|
] })
|
|
14494
|
-
] }) : /* @__PURE__ */
|
|
14495
|
-
/* @__PURE__ */
|
|
14496
|
-
/* @__PURE__ */
|
|
14497
|
-
/* @__PURE__ */
|
|
14498
|
-
/* @__PURE__ */
|
|
15656
|
+
] }) : /* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15657
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15658
|
+
/* @__PURE__ */ jsxs27("label", { className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1", children: [
|
|
15659
|
+
/* @__PURE__ */ jsx33(Phone3, { className: "w-3 h-3 text-slate-400" }),
|
|
15660
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D9\u05E2\u05D3" })
|
|
14499
15661
|
] }),
|
|
14500
|
-
/* @__PURE__ */
|
|
15662
|
+
/* @__PURE__ */ jsx33("span", { className: "text-[9px] text-slate-400", children: "\u05D7\u05D5\u05D1\u05D4" })
|
|
14501
15663
|
] }),
|
|
14502
|
-
/* @__PURE__ */
|
|
14503
|
-
/* @__PURE__ */
|
|
15664
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15665
|
+
/* @__PURE__ */ jsx33(
|
|
14504
15666
|
"select",
|
|
14505
15667
|
{
|
|
14506
15668
|
value: phoneColumnId,
|
|
14507
15669
|
onChange: (e) => setPhoneColumnId(e.target.value),
|
|
14508
15670
|
className: "w-full h-8 px-2.5 pr-2.5 pl-6 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 appearance-none focus:border-emerald-500 cursor-pointer",
|
|
14509
|
-
children: targetPhoneOptions.map((opt) => /* @__PURE__ */
|
|
15671
|
+
children: targetPhoneOptions.map((opt) => /* @__PURE__ */ jsx33("option", { value: opt.id, children: opt.label }, opt.id))
|
|
14510
15672
|
}
|
|
14511
15673
|
),
|
|
14512
|
-
/* @__PURE__ */
|
|
15674
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14513
15675
|
] })
|
|
14514
15676
|
] }),
|
|
14515
|
-
/* @__PURE__ */
|
|
14516
|
-
/* @__PURE__ */
|
|
14517
|
-
/* @__PURE__ */
|
|
15677
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15678
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15679
|
+
/* @__PURE__ */ jsxs27(
|
|
14518
15680
|
"label",
|
|
14519
15681
|
{
|
|
14520
15682
|
htmlFor: "whatsapp-auto-select-records",
|
|
14521
15683
|
className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1 cursor-pointer",
|
|
14522
15684
|
children: [
|
|
14523
|
-
/* @__PURE__ */
|
|
14524
|
-
/* @__PURE__ */
|
|
15685
|
+
/* @__PURE__ */ jsx33(CheckSquare2, { className: "w-3 h-3 text-slate-400" }),
|
|
15686
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05D1\u05D7\u05E8 \u05E8\u05E9\u05D5\u05DE\u05D4 (\u05DB\u05DE\u05D5\u05EA \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05E8\u05D1\u05D9\u05EA)" })
|
|
14525
15687
|
]
|
|
14526
15688
|
}
|
|
14527
15689
|
),
|
|
14528
|
-
autoSelectCount !== null && autoSelectCount > 0 && /* @__PURE__ */
|
|
14529
|
-
/* @__PURE__ */
|
|
14530
|
-
/* @__PURE__ */
|
|
14531
|
-
/* @__PURE__ */
|
|
15690
|
+
autoSelectCount !== null && autoSelectCount > 0 && /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1.5 animate-in fade-in duration-150", children: [
|
|
15691
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200/80 px-1.5 py-0.5 rounded-full flex items-center gap-1", children: [
|
|
15692
|
+
/* @__PURE__ */ jsx33("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse" }),
|
|
15693
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
14532
15694
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
14533
15695
|
selectedRowIdsCount,
|
|
14534
15696
|
" \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA"
|
|
14535
15697
|
] })
|
|
14536
15698
|
] }),
|
|
14537
|
-
/* @__PURE__ */
|
|
15699
|
+
/* @__PURE__ */ jsxs27(
|
|
14538
15700
|
"button",
|
|
14539
15701
|
{
|
|
14540
15702
|
type: "button",
|
|
@@ -14543,14 +15705,14 @@ function SettingsAndActionsBlock({
|
|
|
14543
15705
|
title: "\u05E0\u05E7\u05D4 \u05D1\u05D7\u05D9\u05E8\u05D4 \u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9\u05EA",
|
|
14544
15706
|
"aria-label": "Clear auto select count",
|
|
14545
15707
|
children: [
|
|
14546
|
-
/* @__PURE__ */
|
|
14547
|
-
/* @__PURE__ */
|
|
15708
|
+
/* @__PURE__ */ jsx33(X11, { className: "w-3 h-3" }),
|
|
15709
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E0\u05E7\u05D4" })
|
|
14548
15710
|
]
|
|
14549
15711
|
}
|
|
14550
15712
|
)
|
|
14551
15713
|
] })
|
|
14552
15714
|
] }),
|
|
14553
|
-
/* @__PURE__ */
|
|
15715
|
+
/* @__PURE__ */ jsx33("div", { className: "relative", children: /* @__PURE__ */ jsx33(
|
|
14554
15716
|
"input",
|
|
14555
15717
|
{
|
|
14556
15718
|
id: "whatsapp-auto-select-records",
|
|
@@ -14578,19 +15740,19 @@ function SettingsAndActionsBlock({
|
|
|
14578
15740
|
}
|
|
14579
15741
|
) })
|
|
14580
15742
|
] }),
|
|
14581
|
-
(selectedPhoneOption == null ? void 0 : selectedPhoneOption.type) === "SUBTABLE" && /* @__PURE__ */
|
|
14582
|
-
/* @__PURE__ */
|
|
14583
|
-
/* @__PURE__ */
|
|
14584
|
-
/* @__PURE__ */
|
|
15743
|
+
(selectedPhoneOption == null ? void 0 : selectedPhoneOption.type) === "SUBTABLE" && /* @__PURE__ */ jsxs27("div", { className: "p-2.5 bg-emerald-50/60 border border-emerald-200/80 rounded-xl space-y-2 animate-in fade-in duration-150", children: [
|
|
15744
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1.5 pb-1 border-b border-emerald-200/60", children: [
|
|
15745
|
+
/* @__PURE__ */ jsx33(Users, { className: "w-3.5 h-3.5 text-emerald-700" }),
|
|
15746
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-[10.5px] font-bold text-emerald-900 truncate", children: [
|
|
14585
15747
|
"\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC\u05D9\u05D7\u05D4 \u05DC\u05EA\u05EA-\u05D8\u05D1\u05DC\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8\u05EA (",
|
|
14586
15748
|
selectedPhoneOption.parentColumnName,
|
|
14587
15749
|
")"
|
|
14588
15750
|
] })
|
|
14589
15751
|
] }),
|
|
14590
|
-
/* @__PURE__ */
|
|
14591
|
-
/* @__PURE__ */
|
|
14592
|
-
/* @__PURE__ */
|
|
14593
|
-
/* @__PURE__ */
|
|
15752
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15753
|
+
/* @__PURE__ */ jsx33("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx33("label", { className: "text-[10px] font-semibold text-slate-700 block", children: "\u05E1\u05E0\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD (\u05D1\u05EA\u05EA-\u05D4\u05D8\u05D1\u05DC\u05D4) \u05DC\u05E4\u05D9 \u05E2\u05DE\u05D5\u05D3\u05D4:" }) }),
|
|
15754
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15755
|
+
/* @__PURE__ */ jsxs27(
|
|
14594
15756
|
"select",
|
|
14595
15757
|
{
|
|
14596
15758
|
value: subtableFilterColumn,
|
|
@@ -14600,10 +15762,10 @@ function SettingsAndActionsBlock({
|
|
|
14600
15762
|
},
|
|
14601
15763
|
className: "w-full h-7 px-2 pr-2 pl-5 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 appearance-none focus:border-emerald-500 cursor-pointer truncate",
|
|
14602
15764
|
children: [
|
|
14603
|
-
/* @__PURE__ */
|
|
15765
|
+
/* @__PURE__ */ jsx33("option", { value: "", children: "\u05DB\u05DC \u05D4\u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5 (\u05DC\u05DC\u05D0 \u05E1\u05D9\u05E0\u05D5\u05DF \u05E0\u05D5\u05E1\u05E3)" }),
|
|
14604
15766
|
subtableFilterableColumns.map((col) => {
|
|
14605
15767
|
var _a2;
|
|
14606
|
-
return /* @__PURE__ */
|
|
15768
|
+
return /* @__PURE__ */ jsxs27("option", { value: col.name, children: [
|
|
14607
15769
|
col.name,
|
|
14608
15770
|
" (",
|
|
14609
15771
|
((_a2 = col.type) == null ? void 0 : _a2.toUpperCase()) === "BOOLEAN" ? "\u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9" : "\u05E7\u05E9\u05E8",
|
|
@@ -14613,30 +15775,30 @@ function SettingsAndActionsBlock({
|
|
|
14613
15775
|
]
|
|
14614
15776
|
}
|
|
14615
15777
|
),
|
|
14616
|
-
/* @__PURE__ */
|
|
15778
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14617
15779
|
] })
|
|
14618
15780
|
] }),
|
|
14619
|
-
selectedSubtableFilterCol && /* @__PURE__ */
|
|
14620
|
-
/* @__PURE__ */
|
|
14621
|
-
/* @__PURE__ */
|
|
14622
|
-
!subtableFilterValue && /* @__PURE__ */
|
|
15781
|
+
selectedSubtableFilterCol && /* @__PURE__ */ jsxs27("div", { className: "space-y-1 animate-in fade-in duration-150", children: [
|
|
15782
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15783
|
+
/* @__PURE__ */ jsx33("label", { className: "text-[10px] font-semibold text-slate-700 block", children: "\u05E9\u05D4\u05E2\u05E8\u05DA \u05E9\u05DC\u05D4\u05DD \u05E9\u05D5\u05D5\u05D4 \u05DC:" }),
|
|
15784
|
+
!subtableFilterValue && /* @__PURE__ */ jsx33("span", { className: "text-[9px] text-amber-600 font-medium", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA..." })
|
|
14623
15785
|
] }),
|
|
14624
|
-
/* @__PURE__ */
|
|
14625
|
-
/* @__PURE__ */
|
|
15786
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15787
|
+
/* @__PURE__ */ jsxs27(
|
|
14626
15788
|
"select",
|
|
14627
15789
|
{
|
|
14628
15790
|
value: subtableFilterValue,
|
|
14629
15791
|
onChange: (e) => setSubtableFilterValue(e.target.value),
|
|
14630
15792
|
className: `w-full h-7 px-2 pr-2 pl-5 text-[11px] rounded-lg border appearance-none cursor-pointer truncate transition-colors ${!subtableFilterValue ? "border-amber-400 bg-amber-50/30 text-slate-700 focus:border-amber-500 focus:ring-1 focus:ring-amber-500" : "border-slate-200 bg-white text-slate-700 focus:border-emerald-500"}`,
|
|
14631
15793
|
children: [
|
|
14632
|
-
/* @__PURE__ */
|
|
14633
|
-
((_a = selectedSubtableFilterCol.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN" ? /* @__PURE__ */
|
|
14634
|
-
/* @__PURE__ */
|
|
14635
|
-
/* @__PURE__ */
|
|
15794
|
+
/* @__PURE__ */ jsx33("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF..." }),
|
|
15795
|
+
((_a = selectedSubtableFilterCol.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN" ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
15796
|
+
/* @__PURE__ */ jsx33("option", { value: "true", children: "\u05DB\u05DF (true)" }),
|
|
15797
|
+
/* @__PURE__ */ jsx33("option", { value: "false", children: "\u05DC\u05D0 (false)" })
|
|
14636
15798
|
] }) : getRelationOptionsForCol(
|
|
14637
15799
|
selectedSubtableFilterCol.name,
|
|
14638
15800
|
selectedPhoneOption.parentColumnName
|
|
14639
|
-
).map((opt) => /* @__PURE__ */
|
|
15801
|
+
).map((opt) => /* @__PURE__ */ jsx33("option", { value: opt.id, children: getRelationOptionLabel(
|
|
14640
15802
|
opt,
|
|
14641
15803
|
selectedSubtableFilterCol,
|
|
14642
15804
|
relationOptions
|
|
@@ -14644,32 +15806,32 @@ function SettingsAndActionsBlock({
|
|
|
14644
15806
|
]
|
|
14645
15807
|
}
|
|
14646
15808
|
),
|
|
14647
|
-
/* @__PURE__ */
|
|
15809
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14648
15810
|
] })
|
|
14649
15811
|
] }),
|
|
14650
|
-
/* @__PURE__ */
|
|
14651
|
-
/* @__PURE__ */
|
|
14652
|
-
/* @__PURE__ */
|
|
14653
|
-
/* @__PURE__ */
|
|
15812
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15813
|
+
/* @__PURE__ */ jsx33("label", { className: "text-[10px] font-semibold text-slate-700 block", children: "\u05DE\u05D2\u05D1\u05DC\u05EA \u05E9\u05DC\u05D9\u05D7\u05D4 \u05DC\u05DB\u05DC \u05E9\u05D5\u05E8\u05D4 \u05E8\u05D0\u05E9\u05D9\u05EA:" }),
|
|
15814
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15815
|
+
/* @__PURE__ */ jsxs27(
|
|
14654
15816
|
"select",
|
|
14655
15817
|
{
|
|
14656
15818
|
value: subtableSendLimit,
|
|
14657
15819
|
onChange: (e) => setSubtableSendLimit(e.target.value),
|
|
14658
15820
|
className: "w-full h-7 px-2 pr-2 pl-5 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 appearance-none focus:border-emerald-500 cursor-pointer truncate",
|
|
14659
15821
|
children: [
|
|
14660
|
-
/* @__PURE__ */
|
|
14661
|
-
/* @__PURE__ */
|
|
14662
|
-
/* @__PURE__ */
|
|
15822
|
+
/* @__PURE__ */ jsx33("option", { value: "PRIMARY", children: "\u05DC\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9 \u05D1\u05DC\u05D1\u05D3" }),
|
|
15823
|
+
/* @__PURE__ */ jsx33("option", { value: "FIRST", children: "\u05E0\u05E6\u05D9\u05D2 \u05D0\u05D7\u05D3 \u05D1\u05DC\u05D1\u05D3" }),
|
|
15824
|
+
/* @__PURE__ */ jsx33("option", { value: "ALL", children: "\u05DB\u05DC \u05D4\u05E0\u05E6\u05D9\u05D2\u05D9\u05DD" })
|
|
14663
15825
|
]
|
|
14664
15826
|
}
|
|
14665
15827
|
),
|
|
14666
|
-
/* @__PURE__ */
|
|
15828
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14667
15829
|
] })
|
|
14668
15830
|
] })
|
|
14669
15831
|
] }),
|
|
14670
|
-
/* @__PURE__ */
|
|
14671
|
-
/* @__PURE__ */
|
|
14672
|
-
/* @__PURE__ */
|
|
15832
|
+
/* @__PURE__ */ jsxs27("div", { className: "pt-2 border-t border-slate-200/70 space-y-2", children: [
|
|
15833
|
+
/* @__PURE__ */ jsxs27("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
15834
|
+
/* @__PURE__ */ jsx33(
|
|
14673
15835
|
"input",
|
|
14674
15836
|
{
|
|
14675
15837
|
type: "checkbox",
|
|
@@ -14686,13 +15848,13 @@ function SettingsAndActionsBlock({
|
|
|
14686
15848
|
className: "w-3.5 h-3.5 rounded border-slate-300 text-emerald-600 focus:ring-emerald-500 cursor-pointer"
|
|
14687
15849
|
}
|
|
14688
15850
|
),
|
|
14689
|
-
/* @__PURE__ */
|
|
15851
|
+
/* @__PURE__ */ jsx33("span", { className: "text-[11px] font-semibold text-slate-800", children: "\u05E2\u05D3\u05DB\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05DC\u05D0\u05D7\u05E8 \u05E9\u05DC\u05D9\u05D7\u05D4 \u05DE\u05D5\u05E6\u05DC\u05D7\u05EA" })
|
|
14690
15852
|
] }),
|
|
14691
|
-
enablePostSendAction && /* @__PURE__ */
|
|
14692
|
-
/* @__PURE__ */
|
|
14693
|
-
/* @__PURE__ */
|
|
14694
|
-
/* @__PURE__ */
|
|
14695
|
-
selectedPostSendOption && /* @__PURE__ */
|
|
15853
|
+
enablePostSendAction && /* @__PURE__ */ jsx33("div", { className: "p-2 bg-slate-100/70 border border-slate-200/80 rounded-xl space-y-2 animate-in fade-in duration-150", children: postSendActionTargetOptions.length === 0 ? /* @__PURE__ */ jsx33("div", { className: "text-[10px] text-slate-400 text-center py-1", children: "\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E7\u05E9\u05E8 \u05D0\u05D5 \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9 \u05DC\u05E2\u05D3\u05DB\u05D5\u05DF" }) : /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
15854
|
+
/* @__PURE__ */ jsxs27("div", { className: "space-y-1", children: [
|
|
15855
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15856
|
+
/* @__PURE__ */ jsx33("label", { className: "text-[10px] font-semibold text-slate-600 block", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3 \u05DC\u05E2\u05D3\u05DB\u05D5\u05DF" }),
|
|
15857
|
+
selectedPostSendOption && /* @__PURE__ */ jsx33(
|
|
14696
15858
|
"span",
|
|
14697
15859
|
{
|
|
14698
15860
|
className: `text-[9px] font-medium px-1.5 py-0.5 rounded border ${selectedPostSendOption.targetType === "SUBTABLE" ? "bg-emerald-50 text-emerald-700 border-emerald-200" : "bg-slate-100 text-slate-600 border-slate-200"}`,
|
|
@@ -14700,8 +15862,8 @@ function SettingsAndActionsBlock({
|
|
|
14700
15862
|
}
|
|
14701
15863
|
)
|
|
14702
15864
|
] }),
|
|
14703
|
-
/* @__PURE__ */
|
|
14704
|
-
/* @__PURE__ */
|
|
15865
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15866
|
+
/* @__PURE__ */ jsxs27(
|
|
14705
15867
|
"select",
|
|
14706
15868
|
{
|
|
14707
15869
|
value: postSendActionColumn,
|
|
@@ -14714,35 +15876,35 @@ function SettingsAndActionsBlock({
|
|
|
14714
15876
|
},
|
|
14715
15877
|
className: "w-full h-7 px-2 pr-2 pl-5 text-[11px] rounded-lg border border-slate-200 bg-white text-slate-700 appearance-none focus:border-emerald-500 cursor-pointer truncate",
|
|
14716
15878
|
children: [
|
|
14717
|
-
/* @__PURE__ */
|
|
14718
|
-
postSendActionTargetOptions.map((opt) => /* @__PURE__ */
|
|
15879
|
+
/* @__PURE__ */ jsx33("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
15880
|
+
postSendActionTargetOptions.map((opt) => /* @__PURE__ */ jsx33("option", { value: opt.id, children: opt.label }, opt.id))
|
|
14719
15881
|
]
|
|
14720
15882
|
}
|
|
14721
15883
|
),
|
|
14722
|
-
/* @__PURE__ */
|
|
15884
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14723
15885
|
] })
|
|
14724
15886
|
] }),
|
|
14725
|
-
selectedPostSendOption && /* @__PURE__ */
|
|
14726
|
-
/* @__PURE__ */
|
|
14727
|
-
/* @__PURE__ */
|
|
14728
|
-
!postSendActionValue && /* @__PURE__ */
|
|
15887
|
+
selectedPostSendOption && /* @__PURE__ */ jsxs27("div", { className: "space-y-1 animate-in fade-in duration-150", children: [
|
|
15888
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
15889
|
+
/* @__PURE__ */ jsx33("label", { className: "text-[10px] font-semibold text-slate-600 block", children: "\u05E2\u05E8\u05DA \u05DC\u05E2\u05D3\u05DB\u05D5\u05DF" }),
|
|
15890
|
+
!postSendActionValue && /* @__PURE__ */ jsx33("span", { className: "text-[9px] text-amber-600 font-medium", children: "\u05D7\u05D5\u05D1\u05D4 \u05DC\u05D1\u05D7\u05D5\u05E8 \u05E2\u05E8\u05DA" })
|
|
14729
15891
|
] }),
|
|
14730
|
-
/* @__PURE__ */
|
|
14731
|
-
/* @__PURE__ */
|
|
15892
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative", children: [
|
|
15893
|
+
/* @__PURE__ */ jsxs27(
|
|
14732
15894
|
"select",
|
|
14733
15895
|
{
|
|
14734
15896
|
value: postSendActionValue,
|
|
14735
15897
|
onChange: (e) => setPostSendActionValue(e.target.value),
|
|
14736
15898
|
className: `w-full h-7 px-2 pr-2 pl-5 text-[11px] rounded-lg border appearance-none cursor-pointer truncate transition-colors ${!postSendActionValue ? "border-amber-400 bg-amber-50/30 text-slate-700 focus:border-amber-500 focus:ring-1 focus:ring-amber-500" : "border-slate-200 bg-white text-slate-700 focus:border-emerald-500"}`,
|
|
14737
15899
|
children: [
|
|
14738
|
-
/* @__PURE__ */
|
|
14739
|
-
selectedPostSendOption.type === "BOOLEAN" ? /* @__PURE__ */
|
|
14740
|
-
/* @__PURE__ */
|
|
14741
|
-
/* @__PURE__ */
|
|
15900
|
+
/* @__PURE__ */ jsx33("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA..." }),
|
|
15901
|
+
selectedPostSendOption.type === "BOOLEAN" ? /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
15902
|
+
/* @__PURE__ */ jsx33("option", { value: "true", children: "\u05DB\u05DF (Yes)" }),
|
|
15903
|
+
/* @__PURE__ */ jsx33("option", { value: "false", children: "\u05DC\u05D0 (No)" })
|
|
14742
15904
|
] }) : getRelationOptionsForCol(
|
|
14743
15905
|
selectedPostSendOption.columnName,
|
|
14744
15906
|
selectedPostSendOption.parentColumnName
|
|
14745
|
-
).map((opt) => /* @__PURE__ */
|
|
15907
|
+
).map((opt) => /* @__PURE__ */ jsx33("option", { value: opt.id, children: getRelationOptionLabel(
|
|
14746
15908
|
opt,
|
|
14747
15909
|
selectedPostSendOption,
|
|
14748
15910
|
relationOptions
|
|
@@ -14750,15 +15912,15 @@ function SettingsAndActionsBlock({
|
|
|
14750
15912
|
]
|
|
14751
15913
|
}
|
|
14752
15914
|
),
|
|
14753
|
-
/* @__PURE__ */
|
|
15915
|
+
/* @__PURE__ */ jsx33(ChevronDown6, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
14754
15916
|
] })
|
|
14755
15917
|
] })
|
|
14756
15918
|
] }) })
|
|
14757
15919
|
] })
|
|
14758
15920
|
] })
|
|
14759
15921
|
] }),
|
|
14760
|
-
/* @__PURE__ */
|
|
14761
|
-
/* @__PURE__ */
|
|
15922
|
+
/* @__PURE__ */ jsxs27("div", { className: "mt-auto pt-2.5 border-t border-slate-200/80 space-y-2 shrink-0", children: [
|
|
15923
|
+
/* @__PURE__ */ jsxs27(
|
|
14762
15924
|
"button",
|
|
14763
15925
|
{
|
|
14764
15926
|
type: "button",
|
|
@@ -14767,23 +15929,23 @@ function SettingsAndActionsBlock({
|
|
|
14767
15929
|
className: `w-full h-8 px-3 text-xs font-semibold rounded-xl border transition-all flex items-center justify-center gap-1.5 ${isTestDisabled || isSendingBroadcast ? "bg-slate-100 text-slate-400 border-slate-200 cursor-not-allowed opacity-60" : "bg-white hover:bg-slate-50 text-slate-700 border-slate-200 active:scale-[0.98] cursor-pointer shadow-2xs"}`,
|
|
14768
15930
|
title: testButtonTitle,
|
|
14769
15931
|
children: [
|
|
14770
|
-
/* @__PURE__ */
|
|
14771
|
-
/* @__PURE__ */
|
|
15932
|
+
/* @__PURE__ */ jsx33(Phone3, { className: "w-3 h-3" }),
|
|
15933
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E9\u05DC\u05D7 \u05D8\u05E1\u05D8" })
|
|
14772
15934
|
]
|
|
14773
15935
|
}
|
|
14774
15936
|
),
|
|
14775
|
-
isSendingBroadcast ? /* @__PURE__ */
|
|
15937
|
+
isSendingBroadcast ? /* @__PURE__ */ jsxs27(
|
|
14776
15938
|
"div",
|
|
14777
15939
|
{
|
|
14778
15940
|
className: "w-full bg-white border border-emerald-200 rounded-xl p-2.5 shadow-xs space-y-2 animate-in fade-in duration-200",
|
|
14779
15941
|
"data-testid": "live-broadcast-progress",
|
|
14780
15942
|
children: [
|
|
14781
|
-
/* @__PURE__ */
|
|
14782
|
-
/* @__PURE__ */
|
|
14783
|
-
/* @__PURE__ */
|
|
14784
|
-
/* @__PURE__ */
|
|
15943
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-700", children: [
|
|
15944
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1.5 text-emerald-800 font-bold", children: [
|
|
15945
|
+
/* @__PURE__ */ jsx33(Loader26, { className: "w-3.5 h-3.5 animate-spin text-emerald-600 shrink-0" }),
|
|
15946
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E9\u05D5\u05DC\u05D7 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05D1\u05EA\u05E4\u05D5\u05E6\u05D4..." })
|
|
14785
15947
|
] }),
|
|
14786
|
-
/* @__PURE__ */
|
|
15948
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-emerald-700 font-bold", children: [
|
|
14787
15949
|
(broadcastProgress == null ? void 0 : broadcastProgress.percent) || 0,
|
|
14788
15950
|
"% (",
|
|
14789
15951
|
(broadcastProgress == null ? void 0 : broadcastProgress.current) || 0,
|
|
@@ -14792,7 +15954,7 @@ function SettingsAndActionsBlock({
|
|
|
14792
15954
|
")"
|
|
14793
15955
|
] })
|
|
14794
15956
|
] }),
|
|
14795
|
-
/* @__PURE__ */
|
|
15957
|
+
/* @__PURE__ */ jsx33("div", { className: "w-full h-2.5 bg-slate-100 rounded-full overflow-hidden border border-slate-200", children: /* @__PURE__ */ jsx33(
|
|
14796
15958
|
"div",
|
|
14797
15959
|
{
|
|
14798
15960
|
className: "h-full bg-emerald-500 rounded-full transition-all duration-300 ease-out",
|
|
@@ -14801,18 +15963,18 @@ function SettingsAndActionsBlock({
|
|
|
14801
15963
|
}
|
|
14802
15964
|
}
|
|
14803
15965
|
) }),
|
|
14804
|
-
/* @__PURE__ */
|
|
14805
|
-
/* @__PURE__ */
|
|
14806
|
-
/* @__PURE__ */
|
|
14807
|
-
/* @__PURE__ */
|
|
15966
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-around pt-1 text-[11px] font-medium border-t border-slate-100", children: [
|
|
15967
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-emerald-700 flex items-center gap-1", title: "\u05E0\u05E9\u05DC\u05D7\u05D5 \u05D1\u05D4\u05E6\u05DC\u05D7\u05D4", children: [
|
|
15968
|
+
/* @__PURE__ */ jsx33("span", { children: "\u2705" }),
|
|
15969
|
+
/* @__PURE__ */ jsx33("span", { className: "font-bold", children: (broadcastProgress == null ? void 0 : broadcastProgress.successful) || 0 })
|
|
14808
15970
|
] }),
|
|
14809
|
-
/* @__PURE__ */
|
|
14810
|
-
/* @__PURE__ */
|
|
14811
|
-
/* @__PURE__ */
|
|
15971
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-rose-600 flex items-center gap-1", title: "\u05E9\u05DC\u05D9\u05D7\u05D4 \u05E0\u05DB\u05E9\u05DC\u05D4", children: [
|
|
15972
|
+
/* @__PURE__ */ jsx33("span", { children: "\u274C" }),
|
|
15973
|
+
/* @__PURE__ */ jsx33("span", { className: "font-bold", children: (broadcastProgress == null ? void 0 : broadcastProgress.failed) || 0 })
|
|
14812
15974
|
] }),
|
|
14813
|
-
/* @__PURE__ */
|
|
14814
|
-
/* @__PURE__ */
|
|
14815
|
-
/* @__PURE__ */
|
|
15975
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-amber-700 flex items-center gap-1", title: "\u05E9\u05D5\u05E8\u05D5\u05EA \u05E9\u05D3\u05D5\u05DC\u05D2\u05D5 \u05DC\u05DC\u05D0 \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF", children: [
|
|
15976
|
+
/* @__PURE__ */ jsx33("span", { children: "\u26A0\uFE0F" }),
|
|
15977
|
+
/* @__PURE__ */ jsxs27("span", { className: "font-bold", children: [
|
|
14816
15978
|
(broadcastProgress == null ? void 0 : broadcastProgress.skipped) || 0,
|
|
14817
15979
|
" \u05DC\u05DC\u05D0 \u05D8\u05DC\u05E4\u05D5\u05DF"
|
|
14818
15980
|
] })
|
|
@@ -14820,8 +15982,8 @@ function SettingsAndActionsBlock({
|
|
|
14820
15982
|
] })
|
|
14821
15983
|
]
|
|
14822
15984
|
}
|
|
14823
|
-
) : /* @__PURE__ */
|
|
14824
|
-
/* @__PURE__ */
|
|
15985
|
+
) : /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
15986
|
+
/* @__PURE__ */ jsxs27(
|
|
14825
15987
|
"button",
|
|
14826
15988
|
{
|
|
14827
15989
|
type: "button",
|
|
@@ -14830,56 +15992,56 @@ function SettingsAndActionsBlock({
|
|
|
14830
15992
|
className: `w-full h-9 px-3 text-xs font-bold rounded-xl shadow-xs transition-all flex items-center justify-center gap-2 ${isSendDisabled ? "bg-emerald-600/40 text-white/70 cursor-not-allowed" : "bg-emerald-600 hover:bg-emerald-700 active:scale-[0.98] text-white cursor-pointer"}`,
|
|
14831
15993
|
title: sendButtonTitle,
|
|
14832
15994
|
children: [
|
|
14833
|
-
/* @__PURE__ */
|
|
14834
|
-
/* @__PURE__ */
|
|
15995
|
+
/* @__PURE__ */ jsx33(Send, { className: "w-3.5 h-3.5" }),
|
|
15996
|
+
/* @__PURE__ */ jsx33("span", { children: finalRecipientCount > 0 ? `\u05E9\u05DC\u05D7 \u05DC-${finalRecipientCount} \u05E0\u05DE\u05E2\u05E0\u05D9\u05DD` : "\u05E9\u05DC\u05D7 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA" })
|
|
14835
15997
|
]
|
|
14836
15998
|
}
|
|
14837
15999
|
),
|
|
14838
|
-
validMainRowsCount > 0 && /* @__PURE__ */
|
|
16000
|
+
validMainRowsCount > 0 && /* @__PURE__ */ jsxs27("div", { className: "text-center text-[10.5px] text-slate-500 font-medium pt-0.5", children: [
|
|
14839
16001
|
"\u05DE\u05EA\u05D5\u05DA ",
|
|
14840
16002
|
validMainRowsCount,
|
|
14841
16003
|
" \u05E9\u05D5\u05E8\u05D5\u05EA \u05E8\u05D0\u05E9\u05D9\u05D5\u05EA"
|
|
14842
16004
|
] }),
|
|
14843
|
-
broadcastSummary && /* @__PURE__ */
|
|
16005
|
+
broadcastSummary && /* @__PURE__ */ jsxs27(
|
|
14844
16006
|
"div",
|
|
14845
16007
|
{
|
|
14846
16008
|
className: "w-full bg-slate-50/90 border border-slate-200/90 rounded-xl p-2.5 shadow-2xs space-y-2 animate-in fade-in duration-200",
|
|
14847
16009
|
"data-testid": "broadcast-summary-card",
|
|
14848
16010
|
children: [
|
|
14849
|
-
/* @__PURE__ */
|
|
14850
|
-
/* @__PURE__ */
|
|
14851
|
-
/* @__PURE__ */
|
|
14852
|
-
/* @__PURE__ */
|
|
16011
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
16012
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1.5 text-[11px] font-bold text-slate-700", children: [
|
|
16013
|
+
/* @__PURE__ */ jsx33("span", { className: "text-xs", children: "\u{1F4CA}" }),
|
|
16014
|
+
/* @__PURE__ */ jsx33("span", { children: "\u05E1\u05D9\u05DB\u05D5\u05DD \u05E9\u05D9\u05D3\u05D5\u05E8 \u05D0\u05D7\u05E8\u05D5\u05DF" })
|
|
14853
16015
|
] }),
|
|
14854
|
-
clearBroadcastSummary && /* @__PURE__ */
|
|
16016
|
+
clearBroadcastSummary && /* @__PURE__ */ jsx33(
|
|
14855
16017
|
"button",
|
|
14856
16018
|
{
|
|
14857
16019
|
type: "button",
|
|
14858
16020
|
onClick: clearBroadcastSummary,
|
|
14859
16021
|
className: "text-slate-400 hover:text-slate-600 p-0.5 rounded-md hover:bg-slate-200/60 transition-colors cursor-pointer",
|
|
14860
16022
|
title: "\u05E1\u05D2\u05D5\u05E8 \u05E1\u05D9\u05DB\u05D5\u05DD",
|
|
14861
|
-
children: /* @__PURE__ */
|
|
16023
|
+
children: /* @__PURE__ */ jsx33(X11, { className: "w-3.5 h-3.5" })
|
|
14862
16024
|
}
|
|
14863
16025
|
)
|
|
14864
16026
|
] }),
|
|
14865
|
-
/* @__PURE__ */
|
|
14866
|
-
/* @__PURE__ */
|
|
14867
|
-
/* @__PURE__ */
|
|
14868
|
-
/* @__PURE__ */
|
|
16027
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-1.5 pt-0.5", children: [
|
|
16028
|
+
/* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10.5px] font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200/80", children: [
|
|
16029
|
+
/* @__PURE__ */ jsx33("span", { children: "\u2705" }),
|
|
16030
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
14869
16031
|
broadcastSummary.successful,
|
|
14870
16032
|
" \u05E0\u05E9\u05DC\u05D7\u05D5"
|
|
14871
16033
|
] })
|
|
14872
16034
|
] }),
|
|
14873
|
-
broadcastSummary.failed > 0 && /* @__PURE__ */
|
|
14874
|
-
/* @__PURE__ */
|
|
14875
|
-
/* @__PURE__ */
|
|
16035
|
+
broadcastSummary.failed > 0 && /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10.5px] font-semibold bg-rose-50 text-rose-700 border border-rose-200/80", children: [
|
|
16036
|
+
/* @__PURE__ */ jsx33("span", { children: "\u274C" }),
|
|
16037
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
14876
16038
|
broadcastSummary.failed,
|
|
14877
16039
|
" \u05E0\u05DB\u05E9\u05DC\u05D5"
|
|
14878
16040
|
] })
|
|
14879
16041
|
] }),
|
|
14880
|
-
broadcastSummary.skipped > 0 && /* @__PURE__ */
|
|
14881
|
-
/* @__PURE__ */
|
|
14882
|
-
/* @__PURE__ */
|
|
16042
|
+
broadcastSummary.skipped > 0 && /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10.5px] font-semibold bg-amber-50 text-amber-700 border border-amber-200/80", children: [
|
|
16043
|
+
/* @__PURE__ */ jsx33("span", { children: "\u26A0\uFE0F" }),
|
|
16044
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
14883
16045
|
broadcastSummary.skipped,
|
|
14884
16046
|
" \u05DC\u05DC\u05D0 \u05D8\u05DC\u05E4\u05D5\u05DF"
|
|
14885
16047
|
] })
|
|
@@ -14894,19 +16056,19 @@ function SettingsAndActionsBlock({
|
|
|
14894
16056
|
}
|
|
14895
16057
|
|
|
14896
16058
|
// src/components/WhatsAppComponent/inbox/useInboxState.ts
|
|
14897
|
-
import { useState as
|
|
16059
|
+
import { useState as useState25, useEffect as useEffect18, useCallback as useCallback18, useRef as useRef21 } from "react";
|
|
14898
16060
|
function useInboxState(orgId, actions) {
|
|
14899
|
-
const [conversations, setConversations] =
|
|
14900
|
-
const [activeConversationId, setActiveConversationId] =
|
|
14901
|
-
const [messages, setMessages] =
|
|
14902
|
-
const [isLoading, setIsLoading] =
|
|
14903
|
-
const [isSending, setIsSending] =
|
|
14904
|
-
const [error, setError] =
|
|
14905
|
-
const actionsRef =
|
|
14906
|
-
|
|
16061
|
+
const [conversations, setConversations] = useState25([]);
|
|
16062
|
+
const [activeConversationId, setActiveConversationId] = useState25(null);
|
|
16063
|
+
const [messages, setMessages] = useState25([]);
|
|
16064
|
+
const [isLoading, setIsLoading] = useState25(false);
|
|
16065
|
+
const [isSending, setIsSending] = useState25(false);
|
|
16066
|
+
const [error, setError] = useState25(null);
|
|
16067
|
+
const actionsRef = useRef21(actions);
|
|
16068
|
+
useEffect18(() => {
|
|
14907
16069
|
actionsRef.current = actions;
|
|
14908
16070
|
});
|
|
14909
|
-
const fetchConversations =
|
|
16071
|
+
const fetchConversations = useCallback18(async () => {
|
|
14910
16072
|
if (!orgId) return;
|
|
14911
16073
|
const res = await actionsRef.current.getConversations(orgId);
|
|
14912
16074
|
if (res.success && res.data) {
|
|
@@ -14915,7 +16077,7 @@ function useInboxState(orgId, actions) {
|
|
|
14915
16077
|
setError(res.error);
|
|
14916
16078
|
}
|
|
14917
16079
|
}, [orgId]);
|
|
14918
|
-
const fetchMessages =
|
|
16080
|
+
const fetchMessages = useCallback18(async (conversationId, silent = false) => {
|
|
14919
16081
|
if (!silent) setIsLoading(true);
|
|
14920
16082
|
const res = await actionsRef.current.getMessages(conversationId);
|
|
14921
16083
|
if (res.success && res.data) {
|
|
@@ -14928,7 +16090,7 @@ function useInboxState(orgId, actions) {
|
|
|
14928
16090
|
}
|
|
14929
16091
|
if (!silent) setIsLoading(false);
|
|
14930
16092
|
}, []);
|
|
14931
|
-
|
|
16093
|
+
useEffect18(() => {
|
|
14932
16094
|
fetchConversations();
|
|
14933
16095
|
const interval = setInterval(() => {
|
|
14934
16096
|
fetchConversations();
|
|
@@ -14977,14 +16139,14 @@ function useInboxState(orgId, actions) {
|
|
|
14977
16139
|
|
|
14978
16140
|
// src/components/WhatsAppComponent/inbox/ConversationList.tsx
|
|
14979
16141
|
import { Search as Search4, User } from "lucide-react";
|
|
14980
|
-
import { jsx as
|
|
16142
|
+
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
14981
16143
|
function ConversationList({ conversations, activeId, onSelect }) {
|
|
14982
|
-
return /* @__PURE__ */
|
|
14983
|
-
/* @__PURE__ */
|
|
14984
|
-
/* @__PURE__ */
|
|
14985
|
-
/* @__PURE__ */
|
|
14986
|
-
/* @__PURE__ */
|
|
14987
|
-
/* @__PURE__ */
|
|
16144
|
+
return /* @__PURE__ */ jsxs28("div", { className: "w-80 border-l border-slate-200 bg-white flex flex-col h-full shrink-0", children: [
|
|
16145
|
+
/* @__PURE__ */ jsxs28("div", { className: "p-4 border-b border-slate-100 bg-slate-50", children: [
|
|
16146
|
+
/* @__PURE__ */ jsx34("h2", { className: "text-lg font-bold text-slate-800 mb-3", children: "\u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05DB\u05E0\u05E1\u05D5\u05EA" }),
|
|
16147
|
+
/* @__PURE__ */ jsxs28("div", { className: "relative", children: [
|
|
16148
|
+
/* @__PURE__ */ jsx34(Search4, { className: "w-4 h-4 absolute right-3 top-1/2 -translate-y-1/2 text-slate-400" }),
|
|
16149
|
+
/* @__PURE__ */ jsx34(
|
|
14988
16150
|
"input",
|
|
14989
16151
|
{
|
|
14990
16152
|
type: "text",
|
|
@@ -14994,27 +16156,27 @@ function ConversationList({ conversations, activeId, onSelect }) {
|
|
|
14994
16156
|
)
|
|
14995
16157
|
] })
|
|
14996
16158
|
] }),
|
|
14997
|
-
/* @__PURE__ */
|
|
16159
|
+
/* @__PURE__ */ jsx34("div", { className: "flex-1 overflow-y-auto", children: (() => {
|
|
14998
16160
|
const sortedConversations = [...conversations].sort(
|
|
14999
16161
|
(a, b) => new Date(b.lastMessageAt).getTime() - new Date(a.lastMessageAt).getTime()
|
|
15000
16162
|
);
|
|
15001
|
-
return sortedConversations.length === 0 ? /* @__PURE__ */
|
|
16163
|
+
return sortedConversations.length === 0 ? /* @__PURE__ */ jsx34("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) => {
|
|
15002
16164
|
var _a, _b;
|
|
15003
|
-
return /* @__PURE__ */
|
|
16165
|
+
return /* @__PURE__ */ jsxs28(
|
|
15004
16166
|
"button",
|
|
15005
16167
|
{
|
|
15006
16168
|
onClick: () => onSelect(conv.id),
|
|
15007
16169
|
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"}`,
|
|
15008
16170
|
children: [
|
|
15009
|
-
/* @__PURE__ */
|
|
15010
|
-
/* @__PURE__ */
|
|
15011
|
-
/* @__PURE__ */
|
|
15012
|
-
/* @__PURE__ */
|
|
15013
|
-
/* @__PURE__ */
|
|
16171
|
+
/* @__PURE__ */ jsx34("div", { className: "w-10 h-10 rounded-full bg-slate-200 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx34(User, { className: "w-5 h-5 text-slate-500" }) }),
|
|
16172
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex-1 overflow-hidden", children: [
|
|
16173
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between items-center mb-1", children: [
|
|
16174
|
+
/* @__PURE__ */ jsx34("span", { className: "font-semibold text-slate-800 text-sm truncate", children: conv.contactName || conv.contactPhone }),
|
|
16175
|
+
/* @__PURE__ */ jsx34("span", { className: "text-[10px] text-slate-400", children: new Date(conv.lastMessageAt).toLocaleTimeString("he-IL", { hour: "2-digit", minute: "2-digit" }) })
|
|
15014
16176
|
] }),
|
|
15015
|
-
/* @__PURE__ */
|
|
15016
|
-
/* @__PURE__ */
|
|
15017
|
-
conv.unreadCount > 0 && /* @__PURE__ */
|
|
16177
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex justify-between items-center", children: [
|
|
16178
|
+
/* @__PURE__ */ jsx34("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" }),
|
|
16179
|
+
conv.unreadCount > 0 && /* @__PURE__ */ jsx34("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 })
|
|
15018
16180
|
] })
|
|
15019
16181
|
] })
|
|
15020
16182
|
]
|
|
@@ -15027,17 +16189,17 @@ function ConversationList({ conversations, activeId, onSelect }) {
|
|
|
15027
16189
|
}
|
|
15028
16190
|
|
|
15029
16191
|
// src/components/WhatsAppComponent/inbox/ChatWindow.tsx
|
|
15030
|
-
import { useState as
|
|
16192
|
+
import { useState as useState26, useRef as useRef22, useEffect as useEffect19 } from "react";
|
|
15031
16193
|
import { Send as Send2, User as User2, Loader2 as Loader27 } from "lucide-react";
|
|
15032
|
-
import { jsx as
|
|
16194
|
+
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
15033
16195
|
function ChatWindow({ activeConversation, messages, isLoading, isSending, onSendMessage }) {
|
|
15034
|
-
const [inputText, setInputText] =
|
|
15035
|
-
const messagesTopRef =
|
|
16196
|
+
const [inputText, setInputText] = useState26("");
|
|
16197
|
+
const messagesTopRef = useRef22(null);
|
|
15036
16198
|
const scrollToTop = () => {
|
|
15037
16199
|
var _a;
|
|
15038
16200
|
(_a = messagesTopRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
15039
16201
|
};
|
|
15040
|
-
|
|
16202
|
+
useEffect19(() => {
|
|
15041
16203
|
scrollToTop();
|
|
15042
16204
|
}, [messages.length, activeConversation == null ? void 0 : activeConversation.id]);
|
|
15043
16205
|
const handleSend = (e) => {
|
|
@@ -15047,34 +16209,34 @@ function ChatWindow({ activeConversation, messages, isLoading, isSending, onSend
|
|
|
15047
16209
|
setInputText("");
|
|
15048
16210
|
};
|
|
15049
16211
|
if (!activeConversation) {
|
|
15050
|
-
return /* @__PURE__ */
|
|
15051
|
-
/* @__PURE__ */
|
|
15052
|
-
/* @__PURE__ */
|
|
16212
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex-1 bg-slate-50 flex items-center justify-center flex-col gap-4 text-slate-400", children: [
|
|
16213
|
+
/* @__PURE__ */ jsx35("div", { className: "w-16 h-16 rounded-full bg-slate-200 flex items-center justify-center", children: /* @__PURE__ */ jsx35("svg", { className: "w-8 h-8 text-slate-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx35("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" }) }) }),
|
|
16214
|
+
/* @__PURE__ */ jsx35("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" })
|
|
15053
16215
|
] });
|
|
15054
16216
|
}
|
|
15055
|
-
return /* @__PURE__ */
|
|
15056
|
-
/* @__PURE__ */
|
|
15057
|
-
/* @__PURE__ */
|
|
15058
|
-
/* @__PURE__ */
|
|
15059
|
-
/* @__PURE__ */
|
|
15060
|
-
/* @__PURE__ */
|
|
16217
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex-1 flex flex-col bg-[#efeae2] h-full relative", children: [
|
|
16218
|
+
/* @__PURE__ */ jsxs29("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: [
|
|
16219
|
+
/* @__PURE__ */ jsx35("div", { className: "w-10 h-10 rounded-full bg-slate-200 flex items-center justify-center", children: /* @__PURE__ */ jsx35(User2, { className: "w-5 h-5 text-slate-500" }) }),
|
|
16220
|
+
/* @__PURE__ */ jsxs29("div", { children: [
|
|
16221
|
+
/* @__PURE__ */ jsx35("h3", { className: "font-bold text-slate-800", children: activeConversation.contactName || activeConversation.contactPhone }),
|
|
16222
|
+
/* @__PURE__ */ jsx35("p", { className: "text-xs text-slate-500", dir: "ltr", children: activeConversation.contactPhone })
|
|
15061
16223
|
] })
|
|
15062
16224
|
] }),
|
|
15063
|
-
/* @__PURE__ */
|
|
15064
|
-
/* @__PURE__ */
|
|
15065
|
-
isLoading ? /* @__PURE__ */
|
|
16225
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex-1 overflow-y-auto p-6 space-y-4", children: [
|
|
16226
|
+
/* @__PURE__ */ jsx35("div", { ref: messagesTopRef }),
|
|
16227
|
+
isLoading ? /* @__PURE__ */ jsx35("div", { className: "flex justify-center py-10", children: /* @__PURE__ */ jsx35(Loader27, { className: "w-6 h-6 animate-spin text-emerald-600" }) }) : messages.map((msg, idx) => {
|
|
15066
16228
|
const isOutbound = msg.direction === "OUTBOUND";
|
|
15067
|
-
return /* @__PURE__ */
|
|
15068
|
-
/* @__PURE__ */
|
|
15069
|
-
/* @__PURE__ */
|
|
16229
|
+
return /* @__PURE__ */ jsx35("div", { className: `flex ${isOutbound ? "justify-start" : "justify-end"}`, children: /* @__PURE__ */ jsxs29("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: [
|
|
16230
|
+
/* @__PURE__ */ jsx35("p", { className: "text-sm whitespace-pre-wrap", children: msg.content }),
|
|
16231
|
+
/* @__PURE__ */ jsxs29("div", { className: "text-[11px] text-slate-600 mt-1 text-left flex items-center justify-end gap-1", children: [
|
|
15070
16232
|
new Date(msg.createdAt).toLocaleString("he-IL", { day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit" }),
|
|
15071
|
-
isOutbound && /* @__PURE__ */
|
|
16233
|
+
isOutbound && /* @__PURE__ */ jsx35("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" })
|
|
15072
16234
|
] })
|
|
15073
16235
|
] }) }, msg.id || idx);
|
|
15074
16236
|
})
|
|
15075
16237
|
] }),
|
|
15076
|
-
/* @__PURE__ */
|
|
15077
|
-
/* @__PURE__ */
|
|
16238
|
+
/* @__PURE__ */ jsx35("div", { className: "bg-slate-50 p-4 border-t border-slate-200 shrink-0", children: /* @__PURE__ */ jsxs29("form", { onSubmit: handleSend, className: "flex items-end gap-2 max-w-4xl mx-auto", children: [
|
|
16239
|
+
/* @__PURE__ */ jsx35("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__ */ jsx35(
|
|
15078
16240
|
"textarea",
|
|
15079
16241
|
{
|
|
15080
16242
|
rows: 1,
|
|
@@ -15090,13 +16252,13 @@ function ChatWindow({ activeConversation, messages, isLoading, isSending, onSend
|
|
|
15090
16252
|
className: "w-full max-h-32 min-h-[44px] p-3 text-sm bg-transparent outline-none resize-none"
|
|
15091
16253
|
}
|
|
15092
16254
|
) }),
|
|
15093
|
-
/* @__PURE__ */
|
|
16255
|
+
/* @__PURE__ */ jsx35(
|
|
15094
16256
|
"button",
|
|
15095
16257
|
{
|
|
15096
16258
|
type: "submit",
|
|
15097
16259
|
disabled: !inputText.trim() || isSending,
|
|
15098
16260
|
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"}`,
|
|
15099
|
-
children: isSending ? /* @__PURE__ */
|
|
16261
|
+
children: isSending ? /* @__PURE__ */ jsx35(Loader27, { className: "w-5 h-5 animate-spin" }) : /* @__PURE__ */ jsx35(Send2, { className: "w-5 h-5 -ml-1" })
|
|
15100
16262
|
}
|
|
15101
16263
|
)
|
|
15102
16264
|
] }) })
|
|
@@ -15104,7 +16266,7 @@ function ChatWindow({ activeConversation, messages, isLoading, isSending, onSend
|
|
|
15104
16266
|
}
|
|
15105
16267
|
|
|
15106
16268
|
// src/components/WhatsAppComponent/inbox/WhatsAppInbox.tsx
|
|
15107
|
-
import { jsx as
|
|
16269
|
+
import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
15108
16270
|
function WhatsAppInbox({
|
|
15109
16271
|
orgId,
|
|
15110
16272
|
getConversationsAction,
|
|
@@ -15125,8 +16287,8 @@ function WhatsAppInbox({
|
|
|
15125
16287
|
sendMessage: sendInboxMessageAction
|
|
15126
16288
|
});
|
|
15127
16289
|
const activeConversation = conversations.find((c) => c.id === activeConversationId);
|
|
15128
|
-
return /* @__PURE__ */
|
|
15129
|
-
/* @__PURE__ */
|
|
16290
|
+
return /* @__PURE__ */ jsxs30("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: [
|
|
16291
|
+
/* @__PURE__ */ jsx36(
|
|
15130
16292
|
ConversationList,
|
|
15131
16293
|
{
|
|
15132
16294
|
conversations,
|
|
@@ -15134,7 +16296,7 @@ function WhatsAppInbox({
|
|
|
15134
16296
|
onSelect: handleSelectConversation
|
|
15135
16297
|
}
|
|
15136
16298
|
),
|
|
15137
|
-
/* @__PURE__ */
|
|
16299
|
+
/* @__PURE__ */ jsx36(
|
|
15138
16300
|
ChatWindow,
|
|
15139
16301
|
{
|
|
15140
16302
|
activeConversation,
|
|
@@ -15148,21 +16310,21 @@ function WhatsAppInbox({
|
|
|
15148
16310
|
}
|
|
15149
16311
|
|
|
15150
16312
|
// src/components/WhatsAppComponent/WhatsAppComponent.tsx
|
|
15151
|
-
import { Fragment as
|
|
16313
|
+
import { Fragment as Fragment10, jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
15152
16314
|
function WhatsAppComponent(props) {
|
|
15153
16315
|
var _a;
|
|
15154
16316
|
const { className = "", settings, orgId, componentId, executeAction } = props;
|
|
15155
16317
|
const state = useWhatsAppState(props);
|
|
15156
|
-
const [activeTab, setActiveTab] =
|
|
15157
|
-
return /* @__PURE__ */
|
|
16318
|
+
const [activeTab, setActiveTab] = React26.useState("broadcast");
|
|
16319
|
+
return /* @__PURE__ */ jsxs31(
|
|
15158
16320
|
"div",
|
|
15159
16321
|
{
|
|
15160
16322
|
className: `w-full flex flex-col bg-white border border-slate-200 rounded-2xl shadow-xs overflow-hidden ${className}`,
|
|
15161
16323
|
"data-testid": "whatsapp-component",
|
|
15162
16324
|
dir: "rtl",
|
|
15163
16325
|
children: [
|
|
15164
|
-
/* @__PURE__ */
|
|
15165
|
-
/* @__PURE__ */
|
|
16326
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex border-b border-slate-200 bg-slate-50 px-6 pt-3 gap-4 shrink-0", children: [
|
|
16327
|
+
/* @__PURE__ */ jsx37(
|
|
15166
16328
|
"button",
|
|
15167
16329
|
{
|
|
15168
16330
|
type: "button",
|
|
@@ -15171,7 +16333,7 @@ function WhatsAppComponent(props) {
|
|
|
15171
16333
|
children: "\u{1F4E4} \u05E9\u05DC\u05D9\u05D7\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05D5\u05EA\u05E4\u05D5\u05E6\u05D4"
|
|
15172
16334
|
}
|
|
15173
16335
|
),
|
|
15174
|
-
/* @__PURE__ */
|
|
16336
|
+
/* @__PURE__ */ jsx37(
|
|
15175
16337
|
"button",
|
|
15176
16338
|
{
|
|
15177
16339
|
type: "button",
|
|
@@ -15181,7 +16343,7 @@ function WhatsAppComponent(props) {
|
|
|
15181
16343
|
}
|
|
15182
16344
|
)
|
|
15183
16345
|
] }),
|
|
15184
|
-
activeTab === "inbox" ? /* @__PURE__ */
|
|
16346
|
+
activeTab === "inbox" ? /* @__PURE__ */ jsx37("div", { className: "p-4 flex-1", children: /* @__PURE__ */ jsx37(
|
|
15185
16347
|
WhatsAppInbox,
|
|
15186
16348
|
{
|
|
15187
16349
|
orgId: orgId || props.organizationId || "",
|
|
@@ -15220,37 +16382,37 @@ function WhatsAppComponent(props) {
|
|
|
15220
16382
|
}
|
|
15221
16383
|
}
|
|
15222
16384
|
}
|
|
15223
|
-
) }) : /* @__PURE__ */
|
|
15224
|
-
state.feedback && /* @__PURE__ */
|
|
16385
|
+
) }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16386
|
+
state.feedback && /* @__PURE__ */ jsxs31(
|
|
15225
16387
|
"div",
|
|
15226
16388
|
{
|
|
15227
16389
|
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"}`,
|
|
15228
16390
|
children: [
|
|
15229
|
-
/* @__PURE__ */
|
|
15230
|
-
state.feedback.type === "success" ? /* @__PURE__ */
|
|
15231
|
-
/* @__PURE__ */
|
|
16391
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
16392
|
+
state.feedback.type === "success" ? /* @__PURE__ */ jsx37(CheckCircle24, { className: "w-4 h-4 text-emerald-600 shrink-0" }) : /* @__PURE__ */ jsx37(AlertCircle5, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
16393
|
+
/* @__PURE__ */ jsx37("span", { children: state.feedback.message })
|
|
15232
16394
|
] }),
|
|
15233
|
-
/* @__PURE__ */
|
|
16395
|
+
/* @__PURE__ */ jsx37(
|
|
15234
16396
|
"button",
|
|
15235
16397
|
{
|
|
15236
16398
|
type: "button",
|
|
15237
16399
|
onClick: () => state.setFeedback(null),
|
|
15238
16400
|
className: "text-slate-400 hover:text-slate-700 cursor-pointer",
|
|
15239
|
-
children: /* @__PURE__ */
|
|
16401
|
+
children: /* @__PURE__ */ jsx37(X12, { className: "w-4 h-4" })
|
|
15240
16402
|
}
|
|
15241
16403
|
)
|
|
15242
16404
|
]
|
|
15243
16405
|
}
|
|
15244
16406
|
),
|
|
15245
|
-
state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */
|
|
15246
|
-
/* @__PURE__ */
|
|
15247
|
-
/* @__PURE__ */
|
|
15248
|
-
/* @__PURE__ */
|
|
16407
|
+
state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */ jsxs31("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: [
|
|
16408
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
16409
|
+
/* @__PURE__ */ jsx37(AlertCircle5, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
16410
|
+
/* @__PURE__ */ jsxs31("span", { children: [
|
|
15249
16411
|
"\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05DE-Meta: ",
|
|
15250
16412
|
state.fetchError
|
|
15251
16413
|
] })
|
|
15252
16414
|
] }),
|
|
15253
|
-
/* @__PURE__ */
|
|
16415
|
+
/* @__PURE__ */ jsx37(
|
|
15254
16416
|
"button",
|
|
15255
16417
|
{
|
|
15256
16418
|
type: "button",
|
|
@@ -15260,9 +16422,9 @@ function WhatsAppComponent(props) {
|
|
|
15260
16422
|
}
|
|
15261
16423
|
)
|
|
15262
16424
|
] }),
|
|
15263
|
-
/* @__PURE__ */
|
|
15264
|
-
/* @__PURE__ */
|
|
15265
|
-
/* @__PURE__ */
|
|
16425
|
+
/* @__PURE__ */ jsxs31("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
16426
|
+
/* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
|
|
16427
|
+
/* @__PURE__ */ jsx37(
|
|
15266
16428
|
TemplateSelectionBlock,
|
|
15267
16429
|
{
|
|
15268
16430
|
selectedTemplate: state.selectedTemplate,
|
|
@@ -15290,7 +16452,7 @@ function WhatsAppComponent(props) {
|
|
|
15290
16452
|
handleFileUpload: state.handleFileUpload
|
|
15291
16453
|
}
|
|
15292
16454
|
),
|
|
15293
|
-
/* @__PURE__ */
|
|
16455
|
+
/* @__PURE__ */ jsx37(
|
|
15294
16456
|
DynamicFiltersBlock,
|
|
15295
16457
|
{
|
|
15296
16458
|
filterableColumns: state.filterableColumns,
|
|
@@ -15307,7 +16469,7 @@ function WhatsAppComponent(props) {
|
|
|
15307
16469
|
isLoadingTableData: state.isLoadingTableData
|
|
15308
16470
|
}
|
|
15309
16471
|
),
|
|
15310
|
-
/* @__PURE__ */
|
|
16472
|
+
/* @__PURE__ */ jsx37(
|
|
15311
16473
|
SettingsAndActionsBlock,
|
|
15312
16474
|
{
|
|
15313
16475
|
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
@@ -15353,13 +16515,13 @@ function WhatsAppComponent(props) {
|
|
|
15353
16515
|
}
|
|
15354
16516
|
)
|
|
15355
16517
|
] }),
|
|
15356
|
-
/* @__PURE__ */
|
|
15357
|
-
/* @__PURE__ */
|
|
15358
|
-
/* @__PURE__ */
|
|
15359
|
-
] }) : state.tableError ? /* @__PURE__ */
|
|
15360
|
-
/* @__PURE__ */
|
|
15361
|
-
/* @__PURE__ */
|
|
15362
|
-
] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */
|
|
16518
|
+
/* @__PURE__ */ jsx37("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__ */ jsxs31("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
|
|
16519
|
+
/* @__PURE__ */ jsx37(Loader28, { className: "w-6 h-6 animate-spin text-emerald-600" }),
|
|
16520
|
+
/* @__PURE__ */ jsx37("span", { children: "\u05D8\u05D5\u05E2\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4..." })
|
|
16521
|
+
] }) : state.tableError ? /* @__PURE__ */ jsxs31("div", { className: "flex-1 flex items-center justify-center p-6 text-center text-xs text-rose-600 bg-rose-50 gap-2", children: [
|
|
16522
|
+
/* @__PURE__ */ jsx37(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
16523
|
+
/* @__PURE__ */ jsx37("span", { children: state.tableError })
|
|
16524
|
+
] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */ jsx37("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__ */ jsx37(
|
|
15363
16525
|
TableBlockClient,
|
|
15364
16526
|
{
|
|
15365
16527
|
settings: {
|
|
@@ -15381,7 +16543,7 @@ function WhatsAppComponent(props) {
|
|
|
15381
16543
|
}
|
|
15382
16544
|
) })
|
|
15383
16545
|
] }),
|
|
15384
|
-
/* @__PURE__ */
|
|
16546
|
+
/* @__PURE__ */ jsx37(
|
|
15385
16547
|
CreateTemplateModal,
|
|
15386
16548
|
{
|
|
15387
16549
|
isOpen: state.isModalOpen,
|
|
@@ -15395,7 +16557,7 @@ function WhatsAppComponent(props) {
|
|
|
15395
16557
|
orgId: state.orgId || orgId
|
|
15396
16558
|
}
|
|
15397
16559
|
),
|
|
15398
|
-
state.isTestPromptOpen && /* @__PURE__ */
|
|
16560
|
+
state.isTestPromptOpen && /* @__PURE__ */ jsx37(
|
|
15399
16561
|
"div",
|
|
15400
16562
|
{
|
|
15401
16563
|
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",
|
|
@@ -15404,7 +16566,7 @@ function WhatsAppComponent(props) {
|
|
|
15404
16566
|
state.setIsTestPromptOpen(false);
|
|
15405
16567
|
state.setTestFeedback(null);
|
|
15406
16568
|
},
|
|
15407
|
-
children: /* @__PURE__ */
|
|
16569
|
+
children: /* @__PURE__ */ jsxs31(
|
|
15408
16570
|
"div",
|
|
15409
16571
|
{
|
|
15410
16572
|
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",
|
|
@@ -15413,15 +16575,15 @@ function WhatsAppComponent(props) {
|
|
|
15413
16575
|
"aria-labelledby": "test-modal-title",
|
|
15414
16576
|
onClick: (e) => e.stopPropagation(),
|
|
15415
16577
|
children: [
|
|
15416
|
-
/* @__PURE__ */
|
|
15417
|
-
/* @__PURE__ */
|
|
15418
|
-
/* @__PURE__ */
|
|
15419
|
-
/* @__PURE__ */
|
|
15420
|
-
/* @__PURE__ */
|
|
15421
|
-
/* @__PURE__ */
|
|
16578
|
+
/* @__PURE__ */ jsxs31("div", { className: "px-5 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
16579
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2.5", children: [
|
|
16580
|
+
/* @__PURE__ */ jsx37("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx37(Phone4, { className: "w-4 h-4" }) }),
|
|
16581
|
+
/* @__PURE__ */ jsxs31("div", { children: [
|
|
16582
|
+
/* @__PURE__ */ jsx37("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)" }),
|
|
16583
|
+
/* @__PURE__ */ jsx37("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" })
|
|
15422
16584
|
] })
|
|
15423
16585
|
] }),
|
|
15424
|
-
/* @__PURE__ */
|
|
16586
|
+
/* @__PURE__ */ jsx37(
|
|
15425
16587
|
"button",
|
|
15426
16588
|
{
|
|
15427
16589
|
type: "button",
|
|
@@ -15433,25 +16595,25 @@ function WhatsAppComponent(props) {
|
|
|
15433
16595
|
},
|
|
15434
16596
|
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"}`,
|
|
15435
16597
|
title: "\u05E1\u05D2\u05D5\u05E8",
|
|
15436
|
-
children: /* @__PURE__ */
|
|
16598
|
+
children: /* @__PURE__ */ jsx37(X12, { className: "w-4 h-4" })
|
|
15437
16599
|
}
|
|
15438
16600
|
)
|
|
15439
16601
|
] }),
|
|
15440
|
-
/* @__PURE__ */
|
|
15441
|
-
/* @__PURE__ */
|
|
15442
|
-
/* @__PURE__ */
|
|
15443
|
-
/* @__PURE__ */
|
|
16602
|
+
/* @__PURE__ */ jsxs31("div", { className: "p-5 space-y-4", children: [
|
|
16603
|
+
/* @__PURE__ */ jsxs31("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
|
|
16604
|
+
/* @__PURE__ */ jsx37("span", { className: "text-slate-500 font-medium", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05E0\u05D1\u05D7\u05E8\u05EA:" }),
|
|
16605
|
+
/* @__PURE__ */ jsx37("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" })
|
|
15444
16606
|
] }),
|
|
15445
|
-
state.selectedPhoneOption && /* @__PURE__ */
|
|
15446
|
-
/* @__PURE__ */
|
|
15447
|
-
/* @__PURE__ */
|
|
16607
|
+
state.selectedPhoneOption && /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-emerald-50/50 border border-emerald-200/60 rounded-xl flex items-center justify-between text-[11px]", children: [
|
|
16608
|
+
/* @__PURE__ */ jsx37("span", { className: "text-emerald-800 font-medium", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3:" }),
|
|
16609
|
+
/* @__PURE__ */ jsx37("span", { className: "font-bold text-emerald-950 font-mono", children: state.selectedPhoneOption.label })
|
|
15448
16610
|
] }),
|
|
15449
16611
|
state.templateHeaderComp && (() => {
|
|
15450
16612
|
const headerFormat = (state.templateHeaderComp.format || "").toUpperCase();
|
|
15451
16613
|
const docFilename = resolveDocumentFilename(state.templateHeaderComp, state.headerMediaUrl);
|
|
15452
|
-
return /* @__PURE__ */
|
|
15453
|
-
/* @__PURE__ */
|
|
15454
|
-
/* @__PURE__ */
|
|
16614
|
+
return /* @__PURE__ */ jsxs31("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
|
|
16615
|
+
/* @__PURE__ */ jsx37("div", { className: "flex items-center gap-2 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16616
|
+
/* @__PURE__ */ jsx37("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__ */ jsx37(
|
|
15455
16617
|
"img",
|
|
15456
16618
|
{
|
|
15457
16619
|
src: state.headerMediaUrl,
|
|
@@ -15461,28 +16623,28 @@ function WhatsAppComponent(props) {
|
|
|
15461
16623
|
e.currentTarget.style.display = "none";
|
|
15462
16624
|
}
|
|
15463
16625
|
}
|
|
15464
|
-
) : /* @__PURE__ */
|
|
15465
|
-
/* @__PURE__ */
|
|
15466
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */
|
|
15467
|
-
/* @__PURE__ */
|
|
15468
|
-
/* @__PURE__ */
|
|
15469
|
-
/* @__PURE__ */
|
|
15470
|
-
/* @__PURE__ */
|
|
16626
|
+
) : /* @__PURE__ */ jsx37(ImageIcon3, { className: "w-3.5 h-3.5 text-emerald-600" }) }),
|
|
16627
|
+
/* @__PURE__ */ jsx37("span", { className: "font-semibold text-slate-800 truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
16628
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16629
|
+
/* @__PURE__ */ jsx37("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__ */ jsx37(FileText4, { className: "w-3.5 h-3.5" }) }),
|
|
16630
|
+
/* @__PURE__ */ jsxs31("div", { className: "overflow-hidden", children: [
|
|
16631
|
+
/* @__PURE__ */ jsx37("span", { className: "font-semibold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
16632
|
+
/* @__PURE__ */ jsx37("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: docFilename, children: docFilename })
|
|
15471
16633
|
] })
|
|
15472
|
-
] }) : /* @__PURE__ */
|
|
15473
|
-
/* @__PURE__ */
|
|
15474
|
-
/* @__PURE__ */
|
|
16634
|
+
] }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16635
|
+
/* @__PURE__ */ jsx37("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__ */ jsx37(Video3, { className: "w-3.5 h-3.5" }) }),
|
|
16636
|
+
/* @__PURE__ */ jsx37("span", { className: "font-semibold text-slate-800 truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
15475
16637
|
] }) }),
|
|
15476
|
-
state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */
|
|
16638
|
+
state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ jsx37("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__ */ jsx37("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" })
|
|
15477
16639
|
] });
|
|
15478
16640
|
})(),
|
|
15479
|
-
/* @__PURE__ */
|
|
15480
|
-
/* @__PURE__ */
|
|
16641
|
+
/* @__PURE__ */ jsxs31("div", { className: "space-y-1.5", children: [
|
|
16642
|
+
/* @__PURE__ */ jsxs31("label", { className: "text-xs font-semibold text-slate-700 block", children: [
|
|
15481
16643
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05DC\u05D8\u05E1\u05D8 ",
|
|
15482
|
-
/* @__PURE__ */
|
|
16644
|
+
/* @__PURE__ */ jsx37("span", { className: "text-rose-500", children: "*" })
|
|
15483
16645
|
] }),
|
|
15484
|
-
/* @__PURE__ */
|
|
15485
|
-
/* @__PURE__ */
|
|
16646
|
+
/* @__PURE__ */ jsxs31("div", { className: "relative", children: [
|
|
16647
|
+
/* @__PURE__ */ jsx37(
|
|
15486
16648
|
"input",
|
|
15487
16649
|
{
|
|
15488
16650
|
type: "tel",
|
|
@@ -15504,17 +16666,17 @@ function WhatsAppComponent(props) {
|
|
|
15504
16666
|
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"
|
|
15505
16667
|
}
|
|
15506
16668
|
),
|
|
15507
|
-
/* @__PURE__ */
|
|
16669
|
+
/* @__PURE__ */ jsx37(Phone4, { className: "w-4 h-4 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
15508
16670
|
] }),
|
|
15509
|
-
/* @__PURE__ */
|
|
16671
|
+
/* @__PURE__ */ jsx37("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." })
|
|
15510
16672
|
] }),
|
|
15511
|
-
state.testFeedback && /* @__PURE__ */
|
|
15512
|
-
/* @__PURE__ */
|
|
15513
|
-
/* @__PURE__ */
|
|
16673
|
+
state.testFeedback && /* @__PURE__ */ jsxs31("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: [
|
|
16674
|
+
/* @__PURE__ */ jsx37(AlertCircle5, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
16675
|
+
/* @__PURE__ */ jsx37("span", { children: state.testFeedback })
|
|
15514
16676
|
] })
|
|
15515
16677
|
] }),
|
|
15516
|
-
/* @__PURE__ */
|
|
15517
|
-
/* @__PURE__ */
|
|
16678
|
+
/* @__PURE__ */ jsxs31("div", { className: "px-5 py-3.5 bg-slate-50/70 border-t border-slate-100 flex items-center justify-end gap-2", children: [
|
|
16679
|
+
/* @__PURE__ */ jsx37(
|
|
15518
16680
|
"button",
|
|
15519
16681
|
{
|
|
15520
16682
|
type: "button",
|
|
@@ -15528,7 +16690,7 @@ function WhatsAppComponent(props) {
|
|
|
15528
16690
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
15529
16691
|
}
|
|
15530
16692
|
),
|
|
15531
|
-
/* @__PURE__ */
|
|
16693
|
+
/* @__PURE__ */ jsx37(
|
|
15532
16694
|
"button",
|
|
15533
16695
|
{
|
|
15534
16696
|
type: "button",
|
|
@@ -15536,12 +16698,12 @@ function WhatsAppComponent(props) {
|
|
|
15536
16698
|
onClick: state.handleSendTest,
|
|
15537
16699
|
title: state.testButtonTitle,
|
|
15538
16700
|
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"}`,
|
|
15539
|
-
children: state.isSendingTest ? /* @__PURE__ */
|
|
15540
|
-
/* @__PURE__ */
|
|
15541
|
-
/* @__PURE__ */
|
|
15542
|
-
] }) : /* @__PURE__ */
|
|
15543
|
-
/* @__PURE__ */
|
|
15544
|
-
/* @__PURE__ */
|
|
16701
|
+
children: state.isSendingTest ? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16702
|
+
/* @__PURE__ */ jsx37(Loader28, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
16703
|
+
/* @__PURE__ */ jsx37("span", { children: "\u05E9\u05D5\u05DC\u05D7..." })
|
|
16704
|
+
] }) : /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
16705
|
+
/* @__PURE__ */ jsx37(Send3, { className: "w-3.5 h-3.5" }),
|
|
16706
|
+
/* @__PURE__ */ jsx37("span", { children: "\u05E9\u05DC\u05D7 \u05E2\u05DB\u05E9\u05D9\u05D5" })
|
|
15545
16707
|
] })
|
|
15546
16708
|
}
|
|
15547
16709
|
)
|
|
@@ -15558,12 +16720,12 @@ function WhatsAppComponent(props) {
|
|
|
15558
16720
|
}
|
|
15559
16721
|
|
|
15560
16722
|
// src/components/FormBlock/FormBlock.tsx
|
|
15561
|
-
import { useState as
|
|
16723
|
+
import { useState as useState27, useEffect as useEffect20 } from "react";
|
|
15562
16724
|
import { Loader2 as Loader29, CheckCircle2 as CheckCircle25 } from "lucide-react";
|
|
15563
|
-
import { jsx as
|
|
16725
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
15564
16726
|
|
|
15565
16727
|
// src/components/FormBlock/StyledFormBlock.tsx
|
|
15566
|
-
import { useState as
|
|
16728
|
+
import { useState as useState28, useEffect as useEffect21, useId, useRef as useRef23 } from "react";
|
|
15567
16729
|
import { Loader2 as Loader210, CheckCircle2 as CheckCircle26 } from "lucide-react";
|
|
15568
16730
|
|
|
15569
16731
|
// src/components/FormBlock/formDesign.ts
|
|
@@ -15805,7 +16967,7 @@ function applyFieldOrder(cols, design) {
|
|
|
15805
16967
|
}
|
|
15806
16968
|
|
|
15807
16969
|
// src/components/FormBlock/StyledFormBlock.tsx
|
|
15808
|
-
import { jsx as
|
|
16970
|
+
import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
15809
16971
|
var SYSTEM_FIELDS = ["_id", "id", "createdAt", "updatedAt", "orgId", "tableId"];
|
|
15810
16972
|
function StyledFormBlock({
|
|
15811
16973
|
settings: schema,
|
|
@@ -15825,24 +16987,24 @@ function StyledFormBlock({
|
|
|
15825
16987
|
const design = schema == null ? void 0 : schema.design;
|
|
15826
16988
|
const d = resolveFormDesign(design);
|
|
15827
16989
|
const t = d.tokens;
|
|
15828
|
-
const [formData, setFormData] =
|
|
15829
|
-
const [isSubmitting, setIsSubmitting] =
|
|
15830
|
-
const [isSubmitted, setIsSubmitted] =
|
|
15831
|
-
const [formError, setFormError] =
|
|
15832
|
-
const [missingNames, setMissingNames] =
|
|
15833
|
-
const errorRef =
|
|
15834
|
-
const [columns, setColumns] =
|
|
15835
|
-
const [isLoadingSchema, setIsLoadingSchema] =
|
|
15836
|
-
const [dragName, setDragName] =
|
|
15837
|
-
const [drop, setDrop] =
|
|
15838
|
-
const [resizing, setResizing] =
|
|
15839
|
-
const resizeRef =
|
|
15840
|
-
const gridRef =
|
|
15841
|
-
const relationDictRef =
|
|
15842
|
-
const relationRequestedRef =
|
|
15843
|
-
const [, bumpRelationLabels] =
|
|
16990
|
+
const [formData, setFormData] = useState28(initialValues || {});
|
|
16991
|
+
const [isSubmitting, setIsSubmitting] = useState28(false);
|
|
16992
|
+
const [isSubmitted, setIsSubmitted] = useState28(false);
|
|
16993
|
+
const [formError, setFormError] = useState28(null);
|
|
16994
|
+
const [missingNames, setMissingNames] = useState28([]);
|
|
16995
|
+
const errorRef = useRef23(null);
|
|
16996
|
+
const [columns, setColumns] = useState28((schema == null ? void 0 : schema.columns) || []);
|
|
16997
|
+
const [isLoadingSchema, setIsLoadingSchema] = useState28(false);
|
|
16998
|
+
const [dragName, setDragName] = useState28(null);
|
|
16999
|
+
const [drop, setDrop] = useState28(null);
|
|
17000
|
+
const [resizing, setResizing] = useState28(null);
|
|
17001
|
+
const resizeRef = useRef23(null);
|
|
17002
|
+
const gridRef = useRef23(null);
|
|
17003
|
+
const relationDictRef = useRef23({});
|
|
17004
|
+
const relationRequestedRef = useRef23(/* @__PURE__ */ new Set());
|
|
17005
|
+
const [, bumpRelationLabels] = useState28(0);
|
|
15844
17006
|
const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
15845
|
-
|
|
17007
|
+
useEffect21(() => {
|
|
15846
17008
|
let isMounted = true;
|
|
15847
17009
|
if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction && !previewMode) {
|
|
15848
17010
|
setIsLoadingSchema(true);
|
|
@@ -15861,13 +17023,13 @@ function StyledFormBlock({
|
|
|
15861
17023
|
isMounted = false;
|
|
15862
17024
|
};
|
|
15863
17025
|
}, [schema == null ? void 0 : schema.columns, targetTableId]);
|
|
15864
|
-
|
|
17026
|
+
useEffect21(() => {
|
|
15865
17027
|
if (submitMode === "update" || previewMode || !columns || columns.length === 0) return;
|
|
15866
17028
|
const defaults = buildDefaultValues(columns);
|
|
15867
17029
|
if (Object.keys(defaults).length === 0) return;
|
|
15868
17030
|
setFormData((prev) => __spreadValues(__spreadValues({}, defaults), prev));
|
|
15869
17031
|
}, [columns, submitMode, previewMode]);
|
|
15870
|
-
|
|
17032
|
+
useEffect21(() => {
|
|
15871
17033
|
if (previewMode || !executeAction || !columns) return;
|
|
15872
17034
|
for (const col of columns) {
|
|
15873
17035
|
if ((col.type || "").toUpperCase() !== "RELATION") continue;
|
|
@@ -16174,30 +17336,30 @@ function StyledFormBlock({
|
|
|
16174
17336
|
}
|
|
16175
17337
|
`;
|
|
16176
17338
|
if (isLoadingSchema) {
|
|
16177
|
-
return /* @__PURE__ */
|
|
16178
|
-
/* @__PURE__ */
|
|
16179
|
-
/* @__PURE__ */
|
|
17339
|
+
return /* @__PURE__ */ jsxs33("div", { className: "p-8 flex items-center justify-center gap-2 text-slate-500", dir: "rtl", children: [
|
|
17340
|
+
/* @__PURE__ */ jsx39(Loader210, { className: "w-5 h-5 animate-spin", style: { color: d.primary } }),
|
|
17341
|
+
/* @__PURE__ */ jsx39("span", { className: "text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E9\u05D3\u05D5\u05EA \u05D8\u05D5\u05E4\u05E1..." })
|
|
16180
17342
|
] });
|
|
16181
17343
|
}
|
|
16182
17344
|
if (!formColumns || formColumns.length === 0) {
|
|
16183
|
-
return /* @__PURE__ */
|
|
17345
|
+
return /* @__PURE__ */ jsx39("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." });
|
|
16184
17346
|
}
|
|
16185
17347
|
const logoJustify = d.logoAlign === "center" ? "center" : d.logoAlign === "end" ? "flex-end" : "flex-start";
|
|
16186
|
-
const headerBlock = (schema == null ? void 0 : schema.title) || d.subtitle || d.logoUrl ? /* @__PURE__ */
|
|
17348
|
+
const headerBlock = (schema == null ? void 0 : schema.title) || d.subtitle || d.logoUrl ? /* @__PURE__ */ jsxs33(
|
|
16187
17349
|
"div",
|
|
16188
17350
|
{
|
|
16189
17351
|
style: t.headerBand ? { background: d.primary, color: "#ffffff", padding: `${t.padding * 0.8}px ${t.padding}px` } : { marginBottom: t.gap + 4 },
|
|
16190
17352
|
children: [
|
|
16191
|
-
d.logoUrl && /* @__PURE__ */
|
|
16192
|
-
(schema == null ? void 0 : schema.title) && /* @__PURE__ */
|
|
16193
|
-
d.subtitle && /* @__PURE__ */
|
|
17353
|
+
d.logoUrl && /* @__PURE__ */ jsx39("div", { style: { display: "flex", justifyContent: logoJustify, marginBottom: (schema == null ? void 0 : schema.title) || d.subtitle ? 12 : 0 }, children: /* @__PURE__ */ jsx39("img", { src: d.logoUrl, alt: "", style: { height: d.logoHeight, maxWidth: "100%", objectFit: "contain", display: "block" } }) }),
|
|
17354
|
+
(schema == null ? void 0 : schema.title) && /* @__PURE__ */ jsx39("h2", { style: __spreadValues({ fontSize: t.titleSize, fontWeight: 800, margin: 0 }, d.titleColor ? { color: d.titleColor } : {}), children: schema.title }),
|
|
17355
|
+
d.subtitle && /* @__PURE__ */ jsx39("p", { style: { fontSize: 14, margin: "6px 0 0", color: t.headerBand ? "rgba(255,255,255,0.9)" : muted }, children: d.subtitle })
|
|
16194
17356
|
]
|
|
16195
17357
|
}
|
|
16196
17358
|
) : null;
|
|
16197
17359
|
if (isSubmitted) {
|
|
16198
17360
|
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.";
|
|
16199
|
-
return /* @__PURE__ */
|
|
16200
|
-
/* @__PURE__ */
|
|
17361
|
+
return /* @__PURE__ */ jsxs33("div", { id: componentId, dir: "rtl", className, style: __spreadProps(__spreadValues({}, cardStyle), { padding: t.padding || 24, textAlign: "center" }), children: [
|
|
17362
|
+
/* @__PURE__ */ jsx39(
|
|
16201
17363
|
"div",
|
|
16202
17364
|
{
|
|
16203
17365
|
style: {
|
|
@@ -16211,12 +17373,12 @@ function StyledFormBlock({
|
|
|
16211
17373
|
background: t.invertText ? "rgba(255,255,255,0.2)" : "#ecfdf5",
|
|
16212
17374
|
color: t.invertText ? "#ffffff" : "#059669"
|
|
16213
17375
|
},
|
|
16214
|
-
children: /* @__PURE__ */
|
|
17376
|
+
children: /* @__PURE__ */ jsx39(CheckCircle26, { className: "w-8 h-8" })
|
|
16215
17377
|
}
|
|
16216
17378
|
),
|
|
16217
|
-
/* @__PURE__ */
|
|
16218
|
-
/* @__PURE__ */
|
|
16219
|
-
submitMode !== "update" && /* @__PURE__ */
|
|
17379
|
+
/* @__PURE__ */ jsx39("h3", { style: { fontSize: 24, fontWeight: 800, margin: "0 0 8px" }, children: "\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4" }),
|
|
17380
|
+
/* @__PURE__ */ jsx39("p", { style: { fontSize: 16, color: muted, maxWidth: 420, margin: "0 auto", whiteSpace: "pre-wrap" }, children: customMessage }),
|
|
17381
|
+
submitMode !== "update" && /* @__PURE__ */ jsx39(
|
|
16220
17382
|
"button",
|
|
16221
17383
|
{
|
|
16222
17384
|
type: "button",
|
|
@@ -16228,11 +17390,11 @@ function StyledFormBlock({
|
|
|
16228
17390
|
] });
|
|
16229
17391
|
}
|
|
16230
17392
|
const justify = d.buttonAlign === "center" ? "center" : d.buttonAlign === "end" ? "flex-end" : d.buttonAlign === "full" ? "stretch" : "flex-start";
|
|
16231
|
-
return /* @__PURE__ */
|
|
16232
|
-
/* @__PURE__ */
|
|
17393
|
+
return /* @__PURE__ */ jsxs33("div", { id: componentId, dir: "rtl", className: `${uid} ${className}`, style: cardStyle, children: [
|
|
17394
|
+
/* @__PURE__ */ jsx39("style", { children: css }),
|
|
16233
17395
|
headerBlock,
|
|
16234
|
-
/* @__PURE__ */
|
|
16235
|
-
/* @__PURE__ */
|
|
17396
|
+
/* @__PURE__ */ jsx39("div", { style: t.headerBand ? { padding: t.padding } : void 0, children: /* @__PURE__ */ jsxs33("form", { onSubmit: handleSubmit, children: [
|
|
17397
|
+
/* @__PURE__ */ jsx39("div", { className: "fdz-grid", ref: gridRef, children: (() => {
|
|
16236
17398
|
const spanOf = (col) => {
|
|
16237
17399
|
var _a;
|
|
16238
17400
|
if (resizing && resizing.name === col.name) return resizing.span;
|
|
@@ -16250,7 +17412,7 @@ function StyledFormBlock({
|
|
|
16250
17412
|
const fieldHeight = resizing && resizing.name === col.name ? resizing.height : (_e = (_d = design == null ? void 0 : design.fields) == null ? void 0 : _d[col.name]) == null ? void 0 : _e.height;
|
|
16251
17413
|
const useTextarea = !!fieldHeight && fieldHeight > 56 && InputComponent === FORM_INPUTS.DEFAULT;
|
|
16252
17414
|
const boxStyle = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, isBoolean ? booleanBoxStyle : inputBoxStyle), fieldHeight && !isBoolean ? __spreadValues({ minHeight: fieldHeight }, useTextarea ? { height: fieldHeight } : {}) : {}), canReorder ? { pointerEvents: "none" } : {}), missingNames.includes(col.name) ? t.inputStyle === "underline" ? { borderBottom: "2px solid #f43f5e" } : { border: "1px solid #f43f5e", boxShadow: "0 0 0 3px rgba(244,63,94,0.15)" } : {}), locked ? { background: t.inputStyle === "underline" ? "transparent" : "#f1f5f9", opacity: 0.85, cursor: "not-allowed" } : {});
|
|
16253
|
-
return /* @__PURE__ */
|
|
17415
|
+
return /* @__PURE__ */ jsxs33(
|
|
16254
17416
|
"div",
|
|
16255
17417
|
{
|
|
16256
17418
|
"data-fdz-field": col.name,
|
|
@@ -16274,13 +17436,13 @@ function StyledFormBlock({
|
|
|
16274
17436
|
borderRadius: 6
|
|
16275
17437
|
} : {}),
|
|
16276
17438
|
children: [
|
|
16277
|
-
/* @__PURE__ */
|
|
17439
|
+
/* @__PURE__ */ jsxs33("label", { style: { fontSize: t.labelSize, fontWeight: 600, color: d.text }, children: [
|
|
16278
17440
|
col.name,
|
|
16279
17441
|
" ",
|
|
16280
|
-
isFieldRequired(col, design) && !locked && /* @__PURE__ */
|
|
16281
|
-
locked && /* @__PURE__ */
|
|
17442
|
+
isFieldRequired(col, design) && !locked && /* @__PURE__ */ jsx39("span", { style: { color: t.invertText ? "#fecdd3" : "#f43f5e" }, children: "*" }),
|
|
17443
|
+
locked && /* @__PURE__ */ jsx39("span", { style: { fontSize: 11, fontWeight: 400, opacity: 0.7 }, children: "(\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D9\u05DB\u05D4)" })
|
|
16282
17444
|
] }),
|
|
16283
|
-
/* @__PURE__ */
|
|
17445
|
+
/* @__PURE__ */ jsx39("div", { "data-fdz-box": true, style: boxStyle, children: useTextarea ? /* @__PURE__ */ jsx39(
|
|
16284
17446
|
"textarea",
|
|
16285
17447
|
{
|
|
16286
17448
|
value: shownValue,
|
|
@@ -16300,7 +17462,7 @@ function StyledFormBlock({
|
|
|
16300
17462
|
boxSizing: "border-box"
|
|
16301
17463
|
}
|
|
16302
17464
|
}
|
|
16303
|
-
) : /* @__PURE__ */
|
|
17465
|
+
) : /* @__PURE__ */ jsx39(
|
|
16304
17466
|
InputComponent,
|
|
16305
17467
|
{
|
|
16306
17468
|
column: col,
|
|
@@ -16311,7 +17473,7 @@ function StyledFormBlock({
|
|
|
16311
17473
|
context: { executeAction: previewMode ? void 0 : executeAction, tableId: targetTableId, relationDictionaryRef: relationDictRef, orgId: schema == null ? void 0 : schema.orgId }
|
|
16312
17474
|
}
|
|
16313
17475
|
) }),
|
|
16314
|
-
canReorder && dragName && drop && drop.name === col.name && /* @__PURE__ */
|
|
17476
|
+
canReorder && dragName && drop && drop.name === col.name && /* @__PURE__ */ jsx39(
|
|
16315
17477
|
"div",
|
|
16316
17478
|
{
|
|
16317
17479
|
style: __spreadValues({
|
|
@@ -16326,7 +17488,7 @@ function StyledFormBlock({
|
|
|
16326
17488
|
}, drop.side === "before" ? { insetInlineStart: -(t.gap / 2) - 2 } : { insetInlineEnd: -(t.gap / 2) - 2 })
|
|
16327
17489
|
}
|
|
16328
17490
|
),
|
|
16329
|
-
onFieldResize && !isBoolean && /* @__PURE__ */
|
|
17491
|
+
onFieldResize && !isBoolean && /* @__PURE__ */ jsx39(
|
|
16330
17492
|
"div",
|
|
16331
17493
|
{
|
|
16332
17494
|
onMouseDown: (e) => e.stopPropagation(),
|
|
@@ -16356,7 +17518,7 @@ function StyledFormBlock({
|
|
|
16356
17518
|
};
|
|
16357
17519
|
return formColumns.map((col) => renderField(col));
|
|
16358
17520
|
})() }),
|
|
16359
|
-
formError && /* @__PURE__ */
|
|
17521
|
+
formError && /* @__PURE__ */ jsx39(
|
|
16360
17522
|
"div",
|
|
16361
17523
|
{
|
|
16362
17524
|
ref: errorRef,
|
|
@@ -16375,7 +17537,7 @@ function StyledFormBlock({
|
|
|
16375
17537
|
children: formError
|
|
16376
17538
|
}
|
|
16377
17539
|
),
|
|
16378
|
-
/* @__PURE__ */
|
|
17540
|
+
/* @__PURE__ */ jsx39(
|
|
16379
17541
|
"div",
|
|
16380
17542
|
{
|
|
16381
17543
|
style: {
|
|
@@ -16385,7 +17547,7 @@ function StyledFormBlock({
|
|
|
16385
17547
|
display: "flex",
|
|
16386
17548
|
justifyContent: justify
|
|
16387
17549
|
},
|
|
16388
|
-
children: /* @__PURE__ */
|
|
17550
|
+
children: /* @__PURE__ */ jsxs33(
|
|
16389
17551
|
"button",
|
|
16390
17552
|
{
|
|
16391
17553
|
type: "submit",
|
|
@@ -16408,8 +17570,8 @@ function StyledFormBlock({
|
|
|
16408
17570
|
opacity: isSubmitting ? 0.5 : 1
|
|
16409
17571
|
},
|
|
16410
17572
|
children: [
|
|
16411
|
-
isSubmitting && /* @__PURE__ */
|
|
16412
|
-
/* @__PURE__ */
|
|
17573
|
+
isSubmitting && /* @__PURE__ */ jsx39(Loader210, { className: "w-4 h-4 animate-spin" }),
|
|
17574
|
+
/* @__PURE__ */ jsx39("span", { children: isSubmitting ? "\u05E9\u05D5\u05DE\u05E8..." : d.buttonText })
|
|
16413
17575
|
]
|
|
16414
17576
|
}
|
|
16415
17577
|
)
|
|
@@ -16420,8 +17582,8 @@ function StyledFormBlock({
|
|
|
16420
17582
|
}
|
|
16421
17583
|
|
|
16422
17584
|
// src/themes/ThemeScope.tsx
|
|
16423
|
-
import * as
|
|
16424
|
-
import { jsx as
|
|
17585
|
+
import * as React29 from "react";
|
|
17586
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
16425
17587
|
var UNIVERSE_THEME_IDS = ["classic", "clean", "ocean", "warm"];
|
|
16426
17588
|
function resolveUniverseTheme(value) {
|
|
16427
17589
|
return typeof value === "string" && UNIVERSE_THEME_IDS.includes(value) ? value : "classic";
|
|
@@ -16431,7 +17593,7 @@ function withThemeScope(Component) {
|
|
|
16431
17593
|
var _a, _b, _c;
|
|
16432
17594
|
const p = props;
|
|
16433
17595
|
const theme = resolveUniverseTheme((_c = (_a = p.settings) == null ? void 0 : _a.theme) != null ? _c : (_b = p.config) == null ? void 0 : _b.theme);
|
|
16434
|
-
return /* @__PURE__ */
|
|
17596
|
+
return /* @__PURE__ */ jsx40("div", { "data-theme": theme, style: { display: "contents" }, children: React29.createElement(Component, props) });
|
|
16435
17597
|
}
|
|
16436
17598
|
ThemeScoped.displayName = `ThemeScoped(${Component.displayName || Component.name || "Component"})`;
|
|
16437
17599
|
return ThemeScoped;
|
|
@@ -16442,7 +17604,8 @@ var UNIVERSE_COMPONENTS = {
|
|
|
16442
17604
|
TABLE: withThemeScope(TableBlock),
|
|
16443
17605
|
WHATSAPP: withThemeScope(WhatsAppComponent),
|
|
16444
17606
|
FORM: withThemeScope(StyledFormBlock),
|
|
16445
|
-
PLACEMENT: withThemeScope(PlacementBlock)
|
|
17607
|
+
PLACEMENT: withThemeScope(PlacementBlock),
|
|
17608
|
+
PAYMENT_REPORTS: withThemeScope(PaymentReportsBlock)
|
|
16446
17609
|
};
|
|
16447
17610
|
export {
|
|
16448
17611
|
COLUMN_CAPABILITIES,
|
|
@@ -16460,6 +17623,9 @@ export {
|
|
|
16460
17623
|
LinkPickerCell,
|
|
16461
17624
|
NON_TEXT_TYPES,
|
|
16462
17625
|
PASTEL_PALETTES,
|
|
17626
|
+
PAYMENT_REPORTS_ACTIONS,
|
|
17627
|
+
PAYMENT_REPORTS_REQUIRED,
|
|
17628
|
+
PaymentReportsBlock,
|
|
16463
17629
|
PlacementBlock,
|
|
16464
17630
|
PlacementSettings,
|
|
16465
17631
|
PlacementStatusEditor,
|
|
@@ -16530,6 +17696,7 @@ export {
|
|
|
16530
17696
|
isValidTemplateName,
|
|
16531
17697
|
isWordToken,
|
|
16532
17698
|
measureTextWidth,
|
|
17699
|
+
missingPaymentReportsFields,
|
|
16533
17700
|
normalizePhoneForWhatsApp,
|
|
16534
17701
|
normalizeRelationValue,
|
|
16535
17702
|
openWhatsAppChat,
|