@universe-platform/ui 0.1.0-beta.24 → 0.1.0-beta.26
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 +192 -0
- package/dist/index.d.mts +124 -1
- package/dist/index.d.ts +124 -1
- package/dist/index.js +1877 -725
- package/dist/index.mjs +1864 -725
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -66,10 +66,17 @@ __export(src_exports, {
|
|
|
66
66
|
COLUMN_TYPE_LABELS: () => COLUMN_TYPE_LABELS,
|
|
67
67
|
ColumnHeaderTitle: () => ColumnHeaderTitle,
|
|
68
68
|
CreateTemplateModal: () => CreateTemplateModal,
|
|
69
|
+
DEFAULT_PLACEMENT_STATUS_COLORS: () => DEFAULT_PLACEMENT_STATUS_COLORS,
|
|
69
70
|
DatePickerCell: () => DatePickerCell,
|
|
70
71
|
DynamicFiltersBlock: () => DynamicFiltersBlock,
|
|
71
72
|
LinkPickerCell: () => LinkPickerCell,
|
|
73
|
+
NON_TEXT_TYPES: () => NON_TEXT_TYPES,
|
|
72
74
|
PASTEL_PALETTES: () => PASTEL_PALETTES,
|
|
75
|
+
PlacementBlock: () => PlacementBlock,
|
|
76
|
+
PlacementSettings: () => PlacementSettings,
|
|
77
|
+
PlacementStatusEditor: () => PlacementStatusEditor,
|
|
78
|
+
RELATION_LABEL_KEY: () => RELATION_LABEL_KEY,
|
|
79
|
+
RELATION_SEP: () => RELATION_SEP,
|
|
73
80
|
RelationFilterPopover: () => RelationFilterPopover,
|
|
74
81
|
RelationPickerCell: () => RelationPickerCell,
|
|
75
82
|
SettingsAndActionsBlock: () => SettingsAndActionsBlock,
|
|
@@ -83,9 +90,13 @@ __export(src_exports, {
|
|
|
83
90
|
TruncatedTooltip: () => TruncatedTooltip,
|
|
84
91
|
UNIVERSE_COMPONENTS: () => UNIVERSE_COMPONENTS,
|
|
85
92
|
WhatsAppComponent: () => WhatsAppComponent,
|
|
93
|
+
buildColumnOptions: () => buildColumnOptions,
|
|
94
|
+
buildRelationRef: () => buildRelationRef,
|
|
86
95
|
calculateMinColumnWidth: () => calculateMinColumnWidth,
|
|
87
96
|
checkElementTruncation: () => checkElementTruncation,
|
|
88
97
|
cn: () => cn,
|
|
98
|
+
columnRefLabel: () => columnRefLabel,
|
|
99
|
+
enrichRowsWithRelations: () => enrichRowsWithRelations,
|
|
89
100
|
extractUniqueVariableIndices: () => extractUniqueVariableIndices,
|
|
90
101
|
extractVariableIndices: () => extractVariableIndices,
|
|
91
102
|
findVariableAtPosition: () => findVariableAtPosition,
|
|
@@ -106,6 +117,7 @@ __export(src_exports, {
|
|
|
106
117
|
isDuplicateTemplate: () => isDuplicateTemplate,
|
|
107
118
|
isDuplicateTemplateName: () => isDuplicateTemplateName,
|
|
108
119
|
isTextRepresentable: () => isTextRepresentable,
|
|
120
|
+
isUserColumn: () => isUserColumn,
|
|
109
121
|
isValidButtonPhoneNumber: () => isValidButtonPhoneNumber,
|
|
110
122
|
isValidButtonUrl: () => isValidButtonUrl,
|
|
111
123
|
isValidPhoneNumber: () => isValidPhoneNumber,
|
|
@@ -115,14 +127,18 @@ __export(src_exports, {
|
|
|
115
127
|
normalizePhoneForWhatsApp: () => normalizePhoneForWhatsApp,
|
|
116
128
|
normalizeRelationValue: () => normalizeRelationValue,
|
|
117
129
|
openWhatsAppChat: () => openWhatsAppChat,
|
|
130
|
+
parseColumnRef: () => parseColumnRef,
|
|
118
131
|
parseLinkValue: () => parseLinkValue,
|
|
119
132
|
parseTimeParts: () => parseTimeParts,
|
|
133
|
+
readColumnValue: () => readColumnValue,
|
|
120
134
|
reindexVariables: () => reindexVariables,
|
|
135
|
+
resolveDefaultStatusId: () => resolveDefaultStatusId,
|
|
121
136
|
resolveProtocol: () => resolveProtocol,
|
|
122
137
|
sanitizePhoneNumber: () => sanitizePhoneNumber,
|
|
123
138
|
sanitizeTemplateNameInput: () => sanitizeTemplateNameInput,
|
|
124
139
|
seamlessVariableEngine: () => seamlessVariableEngine,
|
|
125
140
|
splitHeaderTitle: () => splitHeaderTitle,
|
|
141
|
+
tableColumns: () => tableColumns,
|
|
126
142
|
useColumnReorder: () => useColumnReorder,
|
|
127
143
|
useColumnResize: () => useColumnResize,
|
|
128
144
|
useSmartTooltip: () => useSmartTooltip,
|
|
@@ -7823,11 +7839,966 @@ function TableBlock(props) {
|
|
|
7823
7839
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TableBlockClient, __spreadValues({}, props));
|
|
7824
7840
|
}
|
|
7825
7841
|
|
|
7842
|
+
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
7843
|
+
var import_react17 = require("react");
|
|
7844
|
+
var import_ag_grid_react = require("ag-grid-react");
|
|
7845
|
+
var import_ag_grid_community = require("ag-grid-community");
|
|
7846
|
+
|
|
7847
|
+
// src/components/PlacementBlock/PlacementSettings.tsx
|
|
7848
|
+
var import_react16 = __toESM(require("react"));
|
|
7849
|
+
|
|
7850
|
+
// src/components/PlacementBlock/placementColumns.ts
|
|
7851
|
+
var RELATION_SEP = "::";
|
|
7852
|
+
var RELATION_LABEL_KEY = "__label";
|
|
7853
|
+
var NON_TEXT_TYPES = ["RELATION", "SUB_TABLE", "GOOGLE_DRIVE_FILE", "GOOGLE_CONTACT", "LINK"];
|
|
7854
|
+
var tableColumns = (table) => (table == null ? void 0 : table.fields) || (table == null ? void 0 : table.columns) || [];
|
|
7855
|
+
var isUserColumn = (c) => !!(c == null ? void 0 : c.name) && c.name !== "_id" && c.name !== "id" && !c.isHidden;
|
|
7856
|
+
var buildRelationRef = (relationColumn, field) => `${relationColumn}${RELATION_SEP}${field}`;
|
|
7857
|
+
function parseColumnRef(ref) {
|
|
7858
|
+
const i = ref.indexOf(RELATION_SEP);
|
|
7859
|
+
if (i < 0) return { field: ref };
|
|
7860
|
+
return { relationColumn: ref.slice(0, i), field: ref.slice(i + RELATION_SEP.length) };
|
|
7861
|
+
}
|
|
7862
|
+
var columnRefLabel = (ref) => {
|
|
7863
|
+
if (!ref) return "";
|
|
7864
|
+
const { relationColumn, field } = parseColumnRef(ref);
|
|
7865
|
+
return relationColumn ? `${relationColumn} \u203A ${field}` : field;
|
|
7866
|
+
};
|
|
7867
|
+
function buildColumnOptions(table, allTables, opts = {}) {
|
|
7868
|
+
var _a, _b;
|
|
7869
|
+
const { textOnly = false, includeRelated = true } = opts;
|
|
7870
|
+
const result = [];
|
|
7871
|
+
for (const col of tableColumns(table).filter(isUserColumn)) {
|
|
7872
|
+
if (textOnly && NON_TEXT_TYPES.includes(col.type)) continue;
|
|
7873
|
+
result.push({
|
|
7874
|
+
id: col.name,
|
|
7875
|
+
name: col.name,
|
|
7876
|
+
type: col.type,
|
|
7877
|
+
description: col.type ? `\u05E1\u05D5\u05D2 \u05E9\u05D3\u05D4: ${col.type}` : void 0
|
|
7878
|
+
});
|
|
7879
|
+
}
|
|
7880
|
+
if (!includeRelated) return result;
|
|
7881
|
+
for (const rel of tableColumns(table).filter(isUserColumn)) {
|
|
7882
|
+
if (rel.type !== "RELATION") continue;
|
|
7883
|
+
const refId = (_a = rel.config) == null ? void 0 : _a.referencedTableId;
|
|
7884
|
+
const refTable = refId ? allTables == null ? void 0 : allTables.find((t) => t.id === refId) : void 0;
|
|
7885
|
+
if (!refTable) continue;
|
|
7886
|
+
const fromName = refTable.name || ((_b = rel.config) == null ? void 0 : _b.referencedTableName) || "";
|
|
7887
|
+
for (const col of tableColumns(refTable).filter(isUserColumn)) {
|
|
7888
|
+
if (NON_TEXT_TYPES.includes(col.type)) continue;
|
|
7889
|
+
result.push({
|
|
7890
|
+
id: buildRelationRef(rel.name, col.name),
|
|
7891
|
+
name: `${rel.name} \u203A ${col.name}`,
|
|
7892
|
+
type: col.type,
|
|
7893
|
+
description: `\u05DE\u05D8\u05D1\u05DC\u05EA ${refTable.isGlobal ? "\u05DE\u05E2\u05E8\u05DB\u05EA " : ""}"${fromName}"`,
|
|
7894
|
+
viaRelation: rel.name,
|
|
7895
|
+
fromTableName: fromName,
|
|
7896
|
+
fromGlobalTable: !!refTable.isGlobal
|
|
7897
|
+
});
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7900
|
+
return result;
|
|
7901
|
+
}
|
|
7902
|
+
function enrichRowsWithRelations(rows, columns, relationOptions) {
|
|
7903
|
+
const relCols = (columns || []).filter((c) => (c == null ? void 0 : c.type) === "RELATION" && (c == null ? void 0 : c.name));
|
|
7904
|
+
if (!relCols.length || !relationOptions) return rows;
|
|
7905
|
+
const idOf = (v) => {
|
|
7906
|
+
var _a, _b, _c;
|
|
7907
|
+
return String((_c = (_b = (_a = v == null ? void 0 : v.id) != null ? _a : v == null ? void 0 : v._id) != null ? _b : v) != null ? _c : "");
|
|
7908
|
+
};
|
|
7909
|
+
const join = (vals) => vals.filter((v) => v !== null && v !== void 0 && v !== "").map((v) => {
|
|
7910
|
+
var _a, _b;
|
|
7911
|
+
return typeof v === "object" ? String((_b = (_a = v.label) != null ? _a : v.name) != null ? _b : "") : String(v);
|
|
7912
|
+
}).filter(Boolean).join(", ");
|
|
7913
|
+
return rows.map((row) => {
|
|
7914
|
+
var _a;
|
|
7915
|
+
const extra = {};
|
|
7916
|
+
for (const rel of relCols) {
|
|
7917
|
+
const options = relationOptions[rel.name] || [];
|
|
7918
|
+
if (!options.length) continue;
|
|
7919
|
+
const byId = new Map(options.map((o) => [String(o.id), o]));
|
|
7920
|
+
const raw = (_a = row.data) == null ? void 0 : _a[rel.name];
|
|
7921
|
+
const values = Array.isArray(raw) ? raw : raw === null || raw === void 0 || raw === "" ? [] : [raw];
|
|
7922
|
+
const linked = values.map((v) => byId.get(idOf(v))).filter(Boolean);
|
|
7923
|
+
if (!linked.length) continue;
|
|
7924
|
+
extra[`${rel.name}${RELATION_SEP}${RELATION_LABEL_KEY}`] = join(linked.map((o) => o.label));
|
|
7925
|
+
const fieldNames = /* @__PURE__ */ new Set();
|
|
7926
|
+
linked.forEach((o) => Object.keys(o.data || {}).forEach((k) => fieldNames.add(k)));
|
|
7927
|
+
fieldNames.forEach((f) => {
|
|
7928
|
+
extra[`${rel.name}${RELATION_SEP}${f}`] = join(linked.map((o) => {
|
|
7929
|
+
var _a2;
|
|
7930
|
+
return (_a2 = o.data) == null ? void 0 : _a2[f];
|
|
7931
|
+
}));
|
|
7932
|
+
});
|
|
7933
|
+
}
|
|
7934
|
+
return Object.keys(extra).length ? __spreadProps(__spreadValues({}, row), { data: __spreadValues(__spreadValues({}, row.data), extra) }) : row;
|
|
7935
|
+
});
|
|
7936
|
+
}
|
|
7937
|
+
function readColumnValue(data, ref) {
|
|
7938
|
+
if (!data || !ref) return void 0;
|
|
7939
|
+
const label = data[`${ref}${RELATION_SEP}${RELATION_LABEL_KEY}`];
|
|
7940
|
+
if (label !== void 0) return label;
|
|
7941
|
+
return data[ref];
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7944
|
+
// src/components/PlacementBlock/PlacementSettings.tsx
|
|
7945
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
7946
|
+
var DEFAULT_PLACEMENT_STATUS_COLORS = [
|
|
7947
|
+
{ id: "1", hex: "#10b981", label: "\u05DE\u05EA\u05D0\u05D9\u05DD / \u05D0\u05D5\u05E9\u05E8" },
|
|
7948
|
+
{ id: "2", hex: "#f59e0b", label: "\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05E8\u05D0\u05D9\u05D5\u05DF" },
|
|
7949
|
+
{ id: "3", hex: "#ef4444", label: "\u05E4\u05E0\u05D5\u05D9 / \u05DC\u05D0 \u05E8\u05DC\u05D5\u05D5\u05E0\u05D8\u05D9" }
|
|
7950
|
+
];
|
|
7951
|
+
function resolveDefaultStatusId(list, wanted) {
|
|
7952
|
+
var _a, _b;
|
|
7953
|
+
if (wanted && list.some((s) => s.id === wanted)) return wanted;
|
|
7954
|
+
if (list.some((s) => s.id === "3")) return "3";
|
|
7955
|
+
return (_b = (_a = list[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
7956
|
+
}
|
|
7957
|
+
var SummaryRow = ({ label, value, hint }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-start gap-2 text-sm", children: [
|
|
7958
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: value ? "text-emerald-600" : "text-slate-300", children: value ? "\u2713" : "\u25CB" }),
|
|
7959
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-slate-500 shrink-0", children: [
|
|
7960
|
+
label,
|
|
7961
|
+
":"
|
|
7962
|
+
] }),
|
|
7963
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "font-semibold text-slate-800 break-words", children: [
|
|
7964
|
+
value,
|
|
7965
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mr-2 text-[11px] font-normal text-indigo-600", children: hint })
|
|
7966
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-slate-400", children: "\u05D8\u05E8\u05DD \u05E0\u05D1\u05D7\u05E8" })
|
|
7967
|
+
] });
|
|
7968
|
+
var PlacementStatusEditor = ({ config, onChange }) => {
|
|
7969
|
+
var _a;
|
|
7970
|
+
const radioName = `placement-default-status-${import_react16.default.useId()}`;
|
|
7971
|
+
const statuses = ((_a = config.statusColors) == null ? void 0 : _a.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
|
|
7972
|
+
const defaultStatusId = resolveDefaultStatusId(statuses, config.defaultReturnStatusId);
|
|
7973
|
+
const setStatuses = (next, defId = defaultStatusId) => {
|
|
7974
|
+
var _a2;
|
|
7975
|
+
return onChange(__spreadProps(__spreadValues({}, config), {
|
|
7976
|
+
statusColors: next,
|
|
7977
|
+
defaultReturnStatusId: next.some((st) => st.id === defId) ? defId : (_a2 = next[0]) == null ? void 0 : _a2.id
|
|
7978
|
+
}));
|
|
7979
|
+
};
|
|
7980
|
+
const updateStatus = (id, patch) => setStatuses(statuses.map((st) => st.id === id ? __spreadValues(__spreadValues({}, st), patch) : st));
|
|
7981
|
+
const addStatus = () => setStatuses([...statuses, { id: `s${Date.now().toString(36)}`, hex: "#3b82f6", label: "\u05E1\u05D8\u05D8\u05D5\u05E1 \u05D7\u05D3\u05E9" }]);
|
|
7982
|
+
const removeStatus = (id) => {
|
|
7983
|
+
if (statuses.length > 1) setStatuses(statuses.filter((st) => st.id !== id));
|
|
7984
|
+
};
|
|
7985
|
+
const moveStatus = (index, dir) => {
|
|
7986
|
+
const j = index + dir;
|
|
7987
|
+
if (j < 0 || j >= statuses.length) return;
|
|
7988
|
+
const next = [...statuses];
|
|
7989
|
+
[next[index], next[j]] = [next[j], next[index]];
|
|
7990
|
+
setStatuses(next);
|
|
7991
|
+
};
|
|
7992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-4 border border-emerald-200 bg-emerald-50/50 rounded space-y-3", children: [
|
|
7993
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "font-semibold text-emerald-900", children: "\u05E9\u05DC\u05D1 3: \u05E1\u05D8\u05D8\u05D5\u05E1\u05D9\u05DD (\u05D4\u05E2\u05D9\u05D2\u05D5\u05DC\u05D9\u05DD \u05D4\u05E6\u05D1\u05E2\u05D5\u05E0\u05D9\u05D9\u05DD)" }),
|
|
7994
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-slate-500", children: "\u05DC\u05D7\u05D9\u05E6\u05D4 \u05E2\u05DC \u05E2\u05D9\u05D2\u05D5\u05DC \u05D1\u05E8\u05DB\u05D9\u05D1 \u05DE\u05D7\u05DC\u05D9\u05E4\u05D4 \u05D1\u05D9\u05DF \u05D4\u05E1\u05D8\u05D8\u05D5\u05E1\u05D9\u05DD \u05DC\u05E4\u05D9 \u05D4\u05E1\u05D3\u05E8 \u05E9\u05DB\u05D0\u05DF. \u05D4\u05D8\u05E7\u05E1\u05D8 \u05DE\u05D5\u05E4\u05D9\u05E2 \u05D1\u05D1\u05D5\u05E2\u05D4 \u05DB\u05E9\u05D4\u05E2\u05DB\u05D1\u05E8 \u05E2\u05D5\u05DE\u05D3 \u05DE\u05E2\u05DC \u05D4\u05E2\u05D9\u05D2\u05D5\u05DC." }),
|
|
7995
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-2", children: statuses.map((st, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2 bg-white border rounded p-2", children: [
|
|
7996
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
7997
|
+
"input",
|
|
7998
|
+
{
|
|
7999
|
+
type: "color",
|
|
8000
|
+
value: st.hex,
|
|
8001
|
+
onChange: (e) => updateStatus(st.id, { hex: e.target.value }),
|
|
8002
|
+
className: "w-9 h-9 p-0 border rounded cursor-pointer shrink-0",
|
|
8003
|
+
"aria-label": "\u05E6\u05D1\u05E2"
|
|
8004
|
+
}
|
|
8005
|
+
),
|
|
8006
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8007
|
+
"input",
|
|
8008
|
+
{
|
|
8009
|
+
type: "text",
|
|
8010
|
+
value: st.label,
|
|
8011
|
+
onChange: (e) => updateStatus(st.id, { label: e.target.value }),
|
|
8012
|
+
placeholder: "\u05D8\u05E7\u05E1\u05D8 \u05D4\u05D1\u05D5\u05E2\u05D4 (\u05DC\u05DE\u05E9\u05DC: \u05D0\u05D5\u05DC\u05D9)",
|
|
8013
|
+
className: "flex-1 min-w-0 border p-2 rounded text-sm"
|
|
8014
|
+
}
|
|
8015
|
+
),
|
|
8016
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex items-center gap-1 text-xs text-slate-600 shrink-0 cursor-pointer", title: "\u05D4\u05E1\u05D8\u05D8\u05D5\u05E1 \u05D4\u05D4\u05EA\u05D7\u05DC\u05EA\u05D9, \u05D5\u05D2\u05DD \u05D6\u05D4 \u05E9\u05D0\u05DC\u05D9\u05D5 \u05D7\u05D5\u05D6\u05E8 \u05DE\u05D5\u05E2\u05DE\u05D3 \u05E9\u05DE\u05D5\u05D7\u05D6\u05E8 \u05DC\u05E8\u05E9\u05D9\u05DE\u05EA \u05D4\u05DE\u05E7\u05D5\u05E8", children: [
|
|
8017
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8018
|
+
"input",
|
|
8019
|
+
{
|
|
8020
|
+
type: "radio",
|
|
8021
|
+
name: radioName,
|
|
8022
|
+
checked: defaultStatusId === st.id,
|
|
8023
|
+
onChange: () => setStatuses(statuses, st.id)
|
|
8024
|
+
}
|
|
8025
|
+
),
|
|
8026
|
+
"\u05D1\u05E8\u05D9\u05E8\u05EA \u05DE\u05D7\u05D3\u05DC"
|
|
8027
|
+
] }),
|
|
8028
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => moveStatus(i, -1), disabled: i === 0, className: "px-2 py-1 border rounded text-xs disabled:opacity-30", "aria-label": "\u05D4\u05D6\u05D6 \u05DC\u05DE\u05E2\u05DC\u05D4", children: "\u25B2" }),
|
|
8029
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => moveStatus(i, 1), disabled: i === statuses.length - 1, className: "px-2 py-1 border rounded text-xs disabled:opacity-30", "aria-label": "\u05D4\u05D6\u05D6 \u05DC\u05DE\u05D8\u05D4", children: "\u25BC" }),
|
|
8030
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => removeStatus(st.id), disabled: statuses.length <= 1, className: "px-2 py-1 border border-rose-300 text-rose-600 rounded text-xs disabled:opacity-30", "aria-label": "\u05DE\u05D7\u05E7 \u05E1\u05D8\u05D8\u05D5\u05E1", children: "\u2715" })
|
|
8031
|
+
] }, st.id)) }),
|
|
8032
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
8033
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: addStatus, className: "px-3 py-1.5 rounded text-sm font-medium bg-emerald-600 text-white hover:bg-emerald-700", children: "+ \u05D4\u05D5\u05E1\u05E3 \u05E1\u05D8\u05D8\u05D5\u05E1" }),
|
|
8034
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => setStatuses(DEFAULT_PLACEMENT_STATUS_COLORS, "3"), className: "text-xs text-slate-500 underline", children: "\u05D0\u05E4\u05E1 \u05DC\u05D1\u05E8\u05D9\u05E8\u05EA \u05D4\u05DE\u05D7\u05D3\u05DC" })
|
|
8035
|
+
] })
|
|
8036
|
+
] });
|
|
8037
|
+
};
|
|
8038
|
+
var PlacementSettings = ({ config, onChange, tables }) => {
|
|
8039
|
+
const sourceTable = tables == null ? void 0 : tables.find((t) => t.id === config.sourceTableId);
|
|
8040
|
+
const targetTable = tables == null ? void 0 : tables.find((t) => t.id === config.targetTableId);
|
|
8041
|
+
const sourceColumns = buildColumnOptions(sourceTable, tables);
|
|
8042
|
+
const targetTextColumns = buildColumnOptions(targetTable, tables, { textOnly: true });
|
|
8043
|
+
const targetColumns = buildColumnOptions(targetTable, tables, { includeRelated: false });
|
|
8044
|
+
const relatedHint = (ref, cols) => {
|
|
8045
|
+
const o = cols.find((c) => c.id === ref);
|
|
8046
|
+
return (o == null ? void 0 : o.viaRelation) ? `\u05DE\u05D8\u05D1\u05DC\u05EA ${o.fromGlobalTable ? "\u05DE\u05E2\u05E8\u05DB\u05EA " : ""}${o.fromTableName}` : void 0;
|
|
8047
|
+
};
|
|
8048
|
+
const handleSourceTableChange = (value) => {
|
|
8049
|
+
onChange(__spreadProps(__spreadValues({}, config), { sourceTableId: value, sourceDisplayFieldId: "" }));
|
|
8050
|
+
};
|
|
8051
|
+
const handleTargetTableChange = (value) => {
|
|
8052
|
+
onChange(__spreadProps(__spreadValues({}, config), {
|
|
8053
|
+
targetTableId: value,
|
|
8054
|
+
targetFilterField1Id: "",
|
|
8055
|
+
targetFilterField2Id: "",
|
|
8056
|
+
targetSelectorFieldId: "",
|
|
8057
|
+
targetAssignmentFieldId: ""
|
|
8058
|
+
}));
|
|
8059
|
+
};
|
|
8060
|
+
const optionsFor = (cols, currentKey) => {
|
|
8061
|
+
const used = [
|
|
8062
|
+
config.targetFilterField1Id,
|
|
8063
|
+
config.targetFilterField2Id,
|
|
8064
|
+
config.targetSelectorFieldId,
|
|
8065
|
+
config.targetAssignmentFieldId
|
|
8066
|
+
];
|
|
8067
|
+
return cols.filter((c) => c.id === config[currentKey] || !used.includes(c.id));
|
|
8068
|
+
};
|
|
8069
|
+
const selectClass = "w-full border p-2 rounded bg-white text-sm";
|
|
8070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-4 border rounded shadow-sm bg-gray-50 space-y-6", dir: "rtl", children: [
|
|
8071
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-lg font-bold", children: "\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E8\u05DB\u05D9\u05D1 \u05E9\u05D9\u05D1\u05D5\u05E5" }),
|
|
8072
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-4 border border-indigo-200 bg-indigo-50/60 rounded space-y-2", "aria-live": "polite", children: [
|
|
8073
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "font-semibold text-indigo-900 text-sm", children: "\u05D4\u05D1\u05D7\u05D9\u05E8\u05D5\u05EA \u05E9\u05E0\u05E2\u05E9\u05D5 \u05E2\u05D3 \u05DB\u05D4" }),
|
|
8074
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-1.5", children: [
|
|
8075
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
|
|
8076
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-xs font-bold text-slate-500", children: "\u05DE\u05E7\u05D5\u05E8" }),
|
|
8077
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SummaryRow, { label: "\u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8", value: sourceTable == null ? void 0 : sourceTable.name }),
|
|
8078
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8079
|
+
SummaryRow,
|
|
8080
|
+
{
|
|
8081
|
+
label: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05DE\u05D9\u05D3\u05E2",
|
|
8082
|
+
value: columnRefLabel(config.sourceDisplayFieldId),
|
|
8083
|
+
hint: relatedHint(config.sourceDisplayFieldId, sourceColumns)
|
|
8084
|
+
}
|
|
8085
|
+
)
|
|
8086
|
+
] }),
|
|
8087
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-1.5", children: [
|
|
8088
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-xs font-bold text-slate-500", children: "\u05D9\u05E2\u05D3" }),
|
|
8089
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SummaryRow, { label: "\u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3", value: targetTable == null ? void 0 : targetTable.name }),
|
|
8090
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8091
|
+
SummaryRow,
|
|
8092
|
+
{
|
|
8093
|
+
label: "\u05E1\u05D9\u05E0\u05D5\u05DF 1",
|
|
8094
|
+
value: columnRefLabel(config.targetFilterField1Id),
|
|
8095
|
+
hint: relatedHint(config.targetFilterField1Id, targetTextColumns)
|
|
8096
|
+
}
|
|
8097
|
+
),
|
|
8098
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8099
|
+
SummaryRow,
|
|
8100
|
+
{
|
|
8101
|
+
label: "\u05E1\u05D9\u05E0\u05D5\u05DF 2",
|
|
8102
|
+
value: columnRefLabel(config.targetFilterField2Id),
|
|
8103
|
+
hint: relatedHint(config.targetFilterField2Id, targetTextColumns)
|
|
8104
|
+
}
|
|
8105
|
+
),
|
|
8106
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
8107
|
+
SummaryRow,
|
|
8108
|
+
{
|
|
8109
|
+
label: "\u05D1\u05D7\u05D9\u05E8\u05EA \u05E8\u05E9\u05D5\u05DE\u05D4",
|
|
8110
|
+
value: columnRefLabel(config.targetSelectorFieldId),
|
|
8111
|
+
hint: relatedHint(config.targetSelectorFieldId, targetTextColumns)
|
|
8112
|
+
}
|
|
8113
|
+
),
|
|
8114
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SummaryRow, { label: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05E9\u05D9\u05D1\u05D5\u05E5", value: config.targetAssignmentFieldId })
|
|
8115
|
+
] })
|
|
8116
|
+
] })
|
|
8117
|
+
] }),
|
|
8118
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-4 border border-slate-200 bg-white rounded space-y-3", children: [
|
|
8119
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "font-semibold text-slate-800", children: "\u05E9\u05DC\u05D1 1: \u05D8\u05D1\u05DC\u05EA \u05D4\u05DE\u05E7\u05D5\u05E8" }),
|
|
8120
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
8121
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8122
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 (\u05DC\u05DE\u05E9\u05DC: \u05DE\u05D3\u05E8\u05D9\u05DB\u05D9\u05DD):" }),
|
|
8123
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8124
|
+
"select",
|
|
8125
|
+
{
|
|
8126
|
+
className: selectClass,
|
|
8127
|
+
value: config.sourceTableId || "",
|
|
8128
|
+
onChange: (e) => handleSourceTableChange(e.target.value),
|
|
8129
|
+
children: [
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 --" }),
|
|
8131
|
+
tables == null ? void 0 : tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: t.id, children: t.name }, t.id))
|
|
8132
|
+
]
|
|
8133
|
+
}
|
|
8134
|
+
)
|
|
8135
|
+
] }),
|
|
8136
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8137
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05E2\u05DE\u05D5\u05D3\u05D4 \u05DC\u05E7\u05D7\u05EA \u05DE\u05DE\u05E0\u05D4 \u05DE\u05D9\u05D3\u05E2 (\u05DC\u05DE\u05E9\u05DC: \u05E9\u05DD \u05DE\u05D3\u05E8\u05D9\u05DA):" }),
|
|
8138
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8139
|
+
"select",
|
|
8140
|
+
{
|
|
8141
|
+
className: selectClass,
|
|
8142
|
+
disabled: !config.sourceTableId,
|
|
8143
|
+
value: config.sourceDisplayFieldId || "",
|
|
8144
|
+
onChange: (e) => onChange(__spreadProps(__spreadValues({}, config), { sourceDisplayFieldId: e.target.value })),
|
|
8145
|
+
children: [
|
|
8146
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05EA \u05DE\u05E7\u05D5\u05E8 --" }),
|
|
8147
|
+
sourceColumns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: f.id, children: f.name }, f.id))
|
|
8148
|
+
]
|
|
8149
|
+
}
|
|
8150
|
+
)
|
|
8151
|
+
] })
|
|
8152
|
+
] })
|
|
8153
|
+
] }),
|
|
8154
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "p-4 border border-blue-200 bg-blue-50 rounded space-y-3", children: [
|
|
8155
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "font-semibold text-blue-900", children: "\u05E9\u05DC\u05D1 2: \u05D8\u05D1\u05DC\u05EA \u05D4\u05D9\u05E2\u05D3" }),
|
|
8156
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8157
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3:" }),
|
|
8158
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8159
|
+
"select",
|
|
8160
|
+
{
|
|
8161
|
+
className: selectClass,
|
|
8162
|
+
value: config.targetTableId || "",
|
|
8163
|
+
onChange: (e) => handleTargetTableChange(e.target.value),
|
|
8164
|
+
children: [
|
|
8165
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3 --" }),
|
|
8166
|
+
tables == null ? void 0 : tables.map((t) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: t.id, children: t.name }, t.id))
|
|
8167
|
+
]
|
|
8168
|
+
}
|
|
8169
|
+
)
|
|
8170
|
+
] }),
|
|
8171
|
+
config.targetTableId && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
8172
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
8173
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8174
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05E1\u05D9\u05E0\u05D5\u05DF 1:" }),
|
|
8175
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8176
|
+
"select",
|
|
8177
|
+
{
|
|
8178
|
+
className: selectClass,
|
|
8179
|
+
value: config.targetFilterField1Id || "",
|
|
8180
|
+
onChange: (e) => onChange(__spreadProps(__spreadValues({}, config), { targetFilterField1Id: e.target.value })),
|
|
8181
|
+
children: [
|
|
8182
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4 --" }),
|
|
8183
|
+
optionsFor(targetTextColumns, "targetFilterField1Id").map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: f.id, children: f.name }, f.id))
|
|
8184
|
+
]
|
|
8185
|
+
}
|
|
8186
|
+
)
|
|
8187
|
+
] }),
|
|
8188
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8189
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05E1\u05D9\u05E0\u05D5\u05DF 2:" }),
|
|
8190
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8191
|
+
"select",
|
|
8192
|
+
{
|
|
8193
|
+
className: selectClass,
|
|
8194
|
+
value: config.targetFilterField2Id || "",
|
|
8195
|
+
onChange: (e) => onChange(__spreadProps(__spreadValues({}, config), { targetFilterField2Id: e.target.value })),
|
|
8196
|
+
children: [
|
|
8197
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4 --" }),
|
|
8198
|
+
optionsFor(targetTextColumns, "targetFilterField2Id").map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: f.id, children: f.name }, f.id))
|
|
8199
|
+
]
|
|
8200
|
+
}
|
|
8201
|
+
)
|
|
8202
|
+
] }),
|
|
8203
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8204
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D1\u05D7\u05D9\u05E8\u05EA \u05D4\u05E8\u05E9\u05D5\u05DE\u05D4:" }),
|
|
8205
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8206
|
+
"select",
|
|
8207
|
+
{
|
|
8208
|
+
className: selectClass,
|
|
8209
|
+
value: config.targetSelectorFieldId || "",
|
|
8210
|
+
onChange: (e) => onChange(__spreadProps(__spreadValues({}, config), { targetSelectorFieldId: e.target.value })),
|
|
8211
|
+
children: [
|
|
8212
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4 --" }),
|
|
8213
|
+
optionsFor(targetTextColumns, "targetSelectorFieldId").map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: f.id, children: f.name }, f.id))
|
|
8214
|
+
]
|
|
8215
|
+
}
|
|
8216
|
+
)
|
|
8217
|
+
] })
|
|
8218
|
+
] }),
|
|
8219
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
8220
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-sm font-medium mb-1", children: "\u05E2\u05DE\u05D5\u05D3\u05D4 \u05D1\u05D8\u05D1\u05DC\u05EA \u05D4\u05D9\u05E2\u05D3 \u05D0\u05DC\u05D9\u05D4 \u05D9\u05D9\u05DB\u05E0\u05E1 \u05D4\u05DE\u05D9\u05D3\u05E2 \u05DE\u05D4\u05DE\u05E7\u05D5\u05E8:" }),
|
|
8221
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
8222
|
+
"select",
|
|
8223
|
+
{
|
|
8224
|
+
className: selectClass,
|
|
8225
|
+
value: config.targetAssignmentFieldId || "",
|
|
8226
|
+
onChange: (e) => onChange(__spreadProps(__spreadValues({}, config), { targetAssignmentFieldId: e.target.value })),
|
|
8227
|
+
children: [
|
|
8228
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", disabled: true, children: "-- \u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3 --" }),
|
|
8229
|
+
optionsFor(targetColumns, "targetAssignmentFieldId").map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: f.id, children: f.name }, f.id))
|
|
8230
|
+
]
|
|
8231
|
+
}
|
|
8232
|
+
)
|
|
8233
|
+
] })
|
|
8234
|
+
] })
|
|
8235
|
+
] }),
|
|
8236
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PlacementStatusEditor, { config, onChange })
|
|
8237
|
+
] });
|
|
8238
|
+
};
|
|
8239
|
+
|
|
8240
|
+
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
8241
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
8242
|
+
import_ag_grid_community.ModuleRegistry.registerModules([import_ag_grid_community.AllCommunityModule]);
|
|
8243
|
+
var FETCH_LIMIT = 1e3;
|
|
8244
|
+
function normalizeRows(records) {
|
|
8245
|
+
return (records || []).filter(Boolean).map((r) => {
|
|
8246
|
+
var _c, _d, _e;
|
|
8247
|
+
const data = r.data && typeof r.data === "object" ? r.data : r.values && typeof r.values === "object" ? r.values : ((_a) => {
|
|
8248
|
+
var _b = _a, { id, _id, recordId } = _b, rest = __objRest(_b, ["id", "_id", "recordId"]);
|
|
8249
|
+
return rest;
|
|
8250
|
+
})(r);
|
|
8251
|
+
return { id: String((_e = (_d = (_c = r.id) != null ? _c : r._id) != null ? _d : r.recordId) != null ? _e : ""), data };
|
|
8252
|
+
}).filter((r) => r.id);
|
|
8253
|
+
}
|
|
8254
|
+
function unpackTableResponse(res) {
|
|
8255
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8256
|
+
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 : Array.isArray((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data) ? res.data.data : [];
|
|
8257
|
+
const columns = ((_c = res == null ? void 0 : res.schema) == null ? void 0 : _c.columns) || ((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.schema) == null ? void 0 : _e.columns) || [];
|
|
8258
|
+
const opts = (res == null ? void 0 : res.relationOptions) || ((_f = res == null ? void 0 : res.data) == null ? void 0 : _f.relationOptions) || {};
|
|
8259
|
+
return {
|
|
8260
|
+
rows: enrichRowsWithRelations(normalizeRows(rawRecords), columns, opts),
|
|
8261
|
+
columns,
|
|
8262
|
+
relationOptions: opts
|
|
8263
|
+
};
|
|
8264
|
+
}
|
|
8265
|
+
function cellText(value) {
|
|
8266
|
+
var _a, _b, _c, _d;
|
|
8267
|
+
if (value === null || value === void 0) return "";
|
|
8268
|
+
if (Array.isArray(value)) return value.map(cellText).join(", ");
|
|
8269
|
+
if (typeof value === "object") return String((_d = (_c = (_b = (_a = value.title) != null ? _a : value.label) != null ? _b : value.name) != null ? _c : value.id) != null ? _d : "[\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8]");
|
|
8270
|
+
return String(value);
|
|
8271
|
+
}
|
|
8272
|
+
var ColorDotRenderer = (props) => {
|
|
8273
|
+
const item = props.data;
|
|
8274
|
+
if (!item) return null;
|
|
8275
|
+
const { statuses, defaultStatusId } = props;
|
|
8276
|
+
const status = statuses.find((c) => c.id === item.statusId) || statuses.find((c) => c.id === defaultStatusId) || statuses[0];
|
|
8277
|
+
if (!status) return null;
|
|
8278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8279
|
+
"button",
|
|
8280
|
+
{
|
|
8281
|
+
type: "button",
|
|
8282
|
+
onClick: () => props.onCycle(item.id),
|
|
8283
|
+
title: status.label,
|
|
8284
|
+
"aria-label": status.label,
|
|
8285
|
+
className: "w-5 h-5 rounded-full border shadow-sm transition-transform hover:scale-110 cursor-pointer",
|
|
8286
|
+
style: { backgroundColor: status.hex, borderColor: "rgba(0,0,0,0.15)" }
|
|
8287
|
+
}
|
|
8288
|
+
) });
|
|
8289
|
+
};
|
|
8290
|
+
var CheckCellRenderer = (props) => {
|
|
8291
|
+
if (!props.data) return null;
|
|
8292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8293
|
+
"input",
|
|
8294
|
+
{
|
|
8295
|
+
type: "checkbox",
|
|
8296
|
+
className: "w-4 h-4 cursor-pointer accent-blue-600",
|
|
8297
|
+
checked: !!props.data.__checked,
|
|
8298
|
+
onChange: () => props.onToggle(props.data.id),
|
|
8299
|
+
"aria-label": "\u05D1\u05D7\u05D9\u05E8\u05EA \u05DE\u05D5\u05E2\u05DE\u05D3"
|
|
8300
|
+
}
|
|
8301
|
+
) });
|
|
8302
|
+
};
|
|
8303
|
+
var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8304
|
+
"input",
|
|
8305
|
+
{
|
|
8306
|
+
type: "checkbox",
|
|
8307
|
+
className: "w-4 h-4 cursor-pointer accent-blue-600",
|
|
8308
|
+
ref: (el) => {
|
|
8309
|
+
if (el) el.indeterminate = props.someChecked && !props.allChecked;
|
|
8310
|
+
},
|
|
8311
|
+
checked: props.allChecked,
|
|
8312
|
+
onChange: props.onToggleAll,
|
|
8313
|
+
"aria-label": "\u05D1\u05D7\u05D9\u05E8\u05EA \u05DB\u05DC \u05D4\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD"
|
|
8314
|
+
}
|
|
8315
|
+
) });
|
|
8316
|
+
var PlacementBlock = (props) => {
|
|
8317
|
+
var _a, _b;
|
|
8318
|
+
const { executeAction, fetchSourceData, fetchTargetData, updateAssignment, className = "" } = props;
|
|
8319
|
+
const config = (0, import_react17.useMemo)(() => {
|
|
8320
|
+
var _a2, _b2, _c;
|
|
8321
|
+
const raw = (_a2 = props.config) != null ? _a2 : props.settings;
|
|
8322
|
+
if (!raw) return void 0;
|
|
8323
|
+
return ((_b2 = raw.config) == null ? void 0 : _b2.sourceTableId) || ((_c = raw.config) == null ? void 0 : _c.targetTableId) ? raw.config : raw;
|
|
8324
|
+
}, [props.config, props.settings]);
|
|
8325
|
+
const statuses = (0, import_react17.useMemo)(
|
|
8326
|
+
() => {
|
|
8327
|
+
var _a2;
|
|
8328
|
+
return ((_a2 = config == null ? void 0 : config.statusColors) == null ? void 0 : _a2.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
|
|
8329
|
+
},
|
|
8330
|
+
[config == null ? void 0 : config.statusColors]
|
|
8331
|
+
);
|
|
8332
|
+
const defaultStatusId = (0, import_react17.useMemo)(
|
|
8333
|
+
() => resolveDefaultStatusId(statuses, config == null ? void 0 : config.defaultReturnStatusId),
|
|
8334
|
+
[statuses, config == null ? void 0 : config.defaultReturnStatusId]
|
|
8335
|
+
);
|
|
8336
|
+
const sourceTableId = config == null ? void 0 : config.sourceTableId;
|
|
8337
|
+
const targetTableId = config == null ? void 0 : config.targetTableId;
|
|
8338
|
+
const displayField = (config == null ? void 0 : config.sourceDisplayFieldId) || "name";
|
|
8339
|
+
const assignmentField = config == null ? void 0 : config.targetAssignmentFieldId;
|
|
8340
|
+
const executeActionRef = (0, import_react17.useRef)(executeAction);
|
|
8341
|
+
executeActionRef.current = executeAction;
|
|
8342
|
+
const legacyRef = (0, import_react17.useRef)({ fetchSourceData, fetchTargetData, updateAssignment });
|
|
8343
|
+
legacyRef.current = { fetchSourceData, fetchTargetData, updateAssignment };
|
|
8344
|
+
const [sourceRows, setSourceRows] = (0, import_react17.useState)([]);
|
|
8345
|
+
const [sourceColumns, setSourceColumns] = (0, import_react17.useState)([]);
|
|
8346
|
+
const [targetRows, setTargetRows] = (0, import_react17.useState)([]);
|
|
8347
|
+
const [targetColumns, setTargetColumns] = (0, import_react17.useState)([]);
|
|
8348
|
+
const [targetRelOptions, setTargetRelOptions] = (0, import_react17.useState)({});
|
|
8349
|
+
const [selectedTargetId, setSelectedTargetId] = (0, import_react17.useState)("");
|
|
8350
|
+
const [candidateIds, setCandidateIds] = (0, import_react17.useState)([]);
|
|
8351
|
+
const [checkedIds, setCheckedIds] = (0, import_react17.useState)([]);
|
|
8352
|
+
const [isSaving, setIsSaving] = (0, import_react17.useState)(false);
|
|
8353
|
+
const [sourceSearch, setSourceSearch] = (0, import_react17.useState)("");
|
|
8354
|
+
const [candidateSearch, setCandidateSearch] = (0, import_react17.useState)("");
|
|
8355
|
+
const [statusMap, setStatusMap] = (0, import_react17.useState)({});
|
|
8356
|
+
const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
|
|
8357
|
+
const [loadError, setLoadError] = (0, import_react17.useState)(null);
|
|
8358
|
+
const [saveError, setSaveError] = (0, import_react17.useState)(null);
|
|
8359
|
+
const [targetFilters, setTargetFilters] = (0, import_react17.useState)({});
|
|
8360
|
+
const loadTable = (0, import_react17.useCallback)(async (tableId, kind) => {
|
|
8361
|
+
const exec = executeActionRef.current;
|
|
8362
|
+
if (exec) {
|
|
8363
|
+
const res = await exec("FETCH_TABLE_DATA", { tableId, tableMetaId: tableId, limit: FETCH_LIMIT, skip: 0 });
|
|
8364
|
+
return unpackTableResponse(res);
|
|
8365
|
+
}
|
|
8366
|
+
const legacy = kind === "source" ? legacyRef.current.fetchSourceData : legacyRef.current.fetchTargetData;
|
|
8367
|
+
if (legacy) {
|
|
8368
|
+
const raw = await legacy(tableId);
|
|
8369
|
+
return { rows: normalizeRows(raw), columns: [], relationOptions: {} };
|
|
8370
|
+
}
|
|
8371
|
+
throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
|
|
8372
|
+
}, []);
|
|
8373
|
+
(0, import_react17.useEffect)(() => {
|
|
8374
|
+
if (!sourceTableId || !targetTableId) return;
|
|
8375
|
+
let cancelled = false;
|
|
8376
|
+
(async () => {
|
|
8377
|
+
setIsLoading(true);
|
|
8378
|
+
setLoadError(null);
|
|
8379
|
+
try {
|
|
8380
|
+
const [src, tgt] = await Promise.all([
|
|
8381
|
+
loadTable(sourceTableId, "source"),
|
|
8382
|
+
loadTable(targetTableId, "target")
|
|
8383
|
+
]);
|
|
8384
|
+
if (cancelled) return;
|
|
8385
|
+
setSourceRows(src.rows);
|
|
8386
|
+
setSourceColumns(src.columns);
|
|
8387
|
+
setTargetRows(tgt.rows);
|
|
8388
|
+
setTargetColumns(tgt.columns);
|
|
8389
|
+
setTargetRelOptions(tgt.relationOptions || {});
|
|
8390
|
+
} catch (err) {
|
|
8391
|
+
if (!cancelled) setLoadError((err == null ? void 0 : err.message) || "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
|
|
8392
|
+
} finally {
|
|
8393
|
+
if (!cancelled) setIsLoading(false);
|
|
8394
|
+
}
|
|
8395
|
+
})();
|
|
8396
|
+
return () => {
|
|
8397
|
+
cancelled = true;
|
|
8398
|
+
};
|
|
8399
|
+
}, [sourceTableId, targetTableId, loadTable]);
|
|
8400
|
+
const displayValue = (0, import_react17.useCallback)((col, val) => {
|
|
8401
|
+
var _a2, _b2, _c, _d, _e;
|
|
8402
|
+
let text = cellText(val);
|
|
8403
|
+
if (text && /^[a-fA-F0-9]{24}$/.test(text)) {
|
|
8404
|
+
let opts = targetRelOptions[col == null ? void 0 : col.name] || targetRelOptions[col == null ? void 0 : col.id] || [];
|
|
8405
|
+
if (opts.length === 0 && ((_a2 = col == null ? void 0 : col.name) == null ? void 0 : _a2.includes(RELATION_SEP))) {
|
|
8406
|
+
const baseName = col.name.split(RELATION_SEP)[0];
|
|
8407
|
+
opts = targetRelOptions[baseName] || [];
|
|
8408
|
+
}
|
|
8409
|
+
if (opts.length === 0) {
|
|
8410
|
+
opts = Object.values(targetRelOptions).flat();
|
|
8411
|
+
}
|
|
8412
|
+
if (opts.length === 0) {
|
|
8413
|
+
opts = [...targetRows.map((r) => r.data), ...sourceRows.map((r) => r.data)];
|
|
8414
|
+
}
|
|
8415
|
+
const found = opts.find((o) => String(o.id) === text || String(o._id) === text || String(o.value) === text);
|
|
8416
|
+
if (found) return cellText((_e = (_d = (_c = (_b2 = found.label) != null ? _b2 : found.title) != null ? _c : found.name) != null ? _d : found.value) != null ? _e : found);
|
|
8417
|
+
}
|
|
8418
|
+
return text;
|
|
8419
|
+
}, [targetRelOptions, targetRows, sourceRows]);
|
|
8420
|
+
const filterColumns = (0, import_react17.useMemo)(() => {
|
|
8421
|
+
const definedFilters = (config == null ? void 0 : config.filterFields) || [];
|
|
8422
|
+
const legacyFilters = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
|
|
8423
|
+
const fieldsToUse = definedFilters.length > 0 ? definedFilters : legacyFilters;
|
|
8424
|
+
if (fieldsToUse.length > 0) {
|
|
8425
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8426
|
+
const resolved = [];
|
|
8427
|
+
fieldsToUse.forEach((idOrName) => {
|
|
8428
|
+
let col = targetColumns.find((c) => c.id === idOrName || c.name === idOrName);
|
|
8429
|
+
if (!col) {
|
|
8430
|
+
const { relationColumn } = parseColumnRef(idOrName);
|
|
8431
|
+
if (relationColumn) col = targetColumns.find((c) => {
|
|
8432
|
+
var _a2;
|
|
8433
|
+
return c.name === relationColumn && ((_a2 = c.type) == null ? void 0 : _a2.toUpperCase()) === "RELATION";
|
|
8434
|
+
});
|
|
8435
|
+
}
|
|
8436
|
+
const final = col || { name: idOrName, label: columnRefLabel(idOrName) };
|
|
8437
|
+
if (seen.has(final.name)) return;
|
|
8438
|
+
seen.add(final.name);
|
|
8439
|
+
resolved.push(final);
|
|
8440
|
+
});
|
|
8441
|
+
return resolved;
|
|
8442
|
+
}
|
|
8443
|
+
return targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)).slice(0, 3);
|
|
8444
|
+
}, [targetColumns, assignmentField, config]);
|
|
8445
|
+
const rawSelectorField = (config == null ? void 0 : config.targetSelectorFieldId) || (config == null ? void 0 : config.targetDisplayFieldId) || ((_a = filterColumns[0]) == null ? void 0 : _a.name) || "";
|
|
8446
|
+
const selectorField = (0, import_react17.useMemo)(() => {
|
|
8447
|
+
const { relationColumn } = parseColumnRef(rawSelectorField);
|
|
8448
|
+
if (relationColumn && !targetColumns.some((c) => c.name === rawSelectorField) && targetColumns.some((c) => {
|
|
8449
|
+
var _a2;
|
|
8450
|
+
return c.name === relationColumn && ((_a2 = c.type) == null ? void 0 : _a2.toUpperCase()) === "RELATION";
|
|
8451
|
+
})) {
|
|
8452
|
+
return relationColumn;
|
|
8453
|
+
}
|
|
8454
|
+
return rawSelectorField;
|
|
8455
|
+
}, [rawSelectorField, targetColumns]);
|
|
8456
|
+
const filteredTargetRows = (0, import_react17.useMemo)(() => {
|
|
8457
|
+
return targetRows.filter((r) => {
|
|
8458
|
+
return filterColumns.every((col) => {
|
|
8459
|
+
const filterVal = targetFilters[col.name];
|
|
8460
|
+
if (!filterVal) return true;
|
|
8461
|
+
return displayValue(col, readColumnValue(r.data, col.name)) === filterVal;
|
|
8462
|
+
});
|
|
8463
|
+
});
|
|
8464
|
+
}, [targetRows, targetFilters, filterColumns, displayValue]);
|
|
8465
|
+
(0, import_react17.useEffect)(() => {
|
|
8466
|
+
if (filteredTargetRows.length > 0) {
|
|
8467
|
+
if (!selectedTargetId || !filteredTargetRows.some((r) => r.id === selectedTargetId)) {
|
|
8468
|
+
setSelectedTargetId(filteredTargetRows[0].id);
|
|
8469
|
+
}
|
|
8470
|
+
} else {
|
|
8471
|
+
setSelectedTargetId("");
|
|
8472
|
+
}
|
|
8473
|
+
}, [filteredTargetRows, selectedTargetId]);
|
|
8474
|
+
const assignmentColumn = (0, import_react17.useMemo)(() => targetColumns.find((c) => c.name === assignmentField), [targetColumns, assignmentField]);
|
|
8475
|
+
const isRelationField = ((_b = assignmentColumn == null ? void 0 : assignmentColumn.type) == null ? void 0 : _b.toUpperCase()) === "RELATION";
|
|
8476
|
+
const assignmentLabel = (assignmentColumn == null ? void 0 : assignmentColumn.label) || (assignmentColumn == null ? void 0 : assignmentColumn.name) || assignmentField || "";
|
|
8477
|
+
const nameOf = (0, import_react17.useCallback)((row) => cellText(readColumnValue(row.data, displayField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD", [displayField]);
|
|
8478
|
+
const assignedIds = (0, import_react17.useMemo)(() => {
|
|
8479
|
+
var _a2;
|
|
8480
|
+
const target = targetRows.find((r) => r.id === selectedTargetId);
|
|
8481
|
+
if (!target || !assignmentField) return [];
|
|
8482
|
+
const raw = (_a2 = target.data) == null ? void 0 : _a2[assignmentField];
|
|
8483
|
+
if (raw === null || raw === void 0 || raw === "") return [];
|
|
8484
|
+
const values = Array.isArray(raw) ? raw : typeof raw === "string" && !isRelationField ? raw.split(",").map((s) => s.trim()).filter(Boolean) : [raw];
|
|
8485
|
+
const ids = values.map((v) => {
|
|
8486
|
+
var _a3, _b2, _c;
|
|
8487
|
+
if (isRelationField || typeof v === "object" && v !== null) return String((_b2 = (_a3 = v == null ? void 0 : v.id) != null ? _a3 : v == null ? void 0 : v._id) != null ? _b2 : v);
|
|
8488
|
+
return (_c = sourceRows.find((s) => nameOf(s) === String(v))) == null ? void 0 : _c.id;
|
|
8489
|
+
}).filter((id) => !!id && sourceRows.some((s) => s.id === id));
|
|
8490
|
+
return Array.from(new Set(ids));
|
|
8491
|
+
}, [selectedTargetId, targetRows, sourceRows, assignmentField, isRelationField, nameOf]);
|
|
8492
|
+
const assignedIdsRef = (0, import_react17.useRef)(assignedIds);
|
|
8493
|
+
assignedIdsRef.current = assignedIds;
|
|
8494
|
+
(0, import_react17.useEffect)(() => {
|
|
8495
|
+
setCandidateIds(assignedIdsRef.current);
|
|
8496
|
+
setCheckedIds(assignedIdsRef.current);
|
|
8497
|
+
}, [selectedTargetId, sourceRows]);
|
|
8498
|
+
const toGridRow = (0, import_react17.useCallback)((r, checked = false) => __spreadProps(__spreadValues({}, r.data), { id: r.id, __label: nameOf(r), __checked: checked, statusId: statusMap[r.id] || defaultStatusId }), [nameOf, statusMap, defaultStatusId]);
|
|
8499
|
+
const candidateGridData = (0, import_react17.useMemo)(() => {
|
|
8500
|
+
const checked = new Set(checkedIds);
|
|
8501
|
+
return candidateIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map((r) => toGridRow(r, checked.has(r.id)));
|
|
8502
|
+
}, [candidateIds, checkedIds, sourceRows, toGridRow]);
|
|
8503
|
+
const availableGridData = (0, import_react17.useMemo)(() => {
|
|
8504
|
+
const set = new Set(candidateIds);
|
|
8505
|
+
return sourceRows.filter((r) => !set.has(r.id)).map((r) => toGridRow(r));
|
|
8506
|
+
}, [candidateIds, sourceRows, toGridRow]);
|
|
8507
|
+
const persistAssignment = (0, import_react17.useCallback)(async (nextIds) => {
|
|
8508
|
+
const exec = executeActionRef.current;
|
|
8509
|
+
if (exec && targetTableId && assignmentField && selectedTargetId) {
|
|
8510
|
+
const value = isRelationField ? nextIds : nextIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", ");
|
|
8511
|
+
await exec("UPDATE_RECORD", { tableId: targetTableId, tableMetaId: targetTableId, modifications: { [selectedTargetId]: { [assignmentField]: value } } });
|
|
8512
|
+
setTargetRows((prev) => prev.map((r) => r.id === selectedTargetId ? __spreadProps(__spreadValues({}, r), { data: __spreadProps(__spreadValues({}, r.data), { [assignmentField]: value }) }) : r));
|
|
8513
|
+
return;
|
|
8514
|
+
}
|
|
8515
|
+
if (legacyRef.current.updateAssignment) {
|
|
8516
|
+
for (const id of nextIds.filter((i) => !assignedIds.includes(i))) await legacyRef.current.updateAssignment(selectedTargetId, id);
|
|
8517
|
+
}
|
|
8518
|
+
}, [targetTableId, assignmentField, selectedTargetId, isRelationField, sourceRows, nameOf, assignedIds]);
|
|
8519
|
+
const moveToCandidates = (0, import_react17.useCallback)((id) => {
|
|
8520
|
+
setCandidateIds((prev) => prev.includes(id) ? prev : [...prev, id]);
|
|
8521
|
+
}, []);
|
|
8522
|
+
const moveToSource = (0, import_react17.useCallback)((id) => {
|
|
8523
|
+
setCandidateIds((prev) => prev.filter((x) => x !== id));
|
|
8524
|
+
setCheckedIds((prev) => prev.filter((x) => x !== id));
|
|
8525
|
+
setStatusMap((prev) => __spreadProps(__spreadValues({}, prev), { [id]: defaultStatusId }));
|
|
8526
|
+
}, [defaultStatusId]);
|
|
8527
|
+
const moveToCandidatesRef = (0, import_react17.useRef)(moveToCandidates);
|
|
8528
|
+
moveToCandidatesRef.current = moveToCandidates;
|
|
8529
|
+
const moveToSourceRef = (0, import_react17.useRef)(moveToSource);
|
|
8530
|
+
moveToSourceRef.current = moveToSource;
|
|
8531
|
+
const toggleChecked = (0, import_react17.useCallback)((id) => {
|
|
8532
|
+
setCheckedIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]);
|
|
8533
|
+
}, []);
|
|
8534
|
+
const allChecked = candidateIds.length > 0 && candidateIds.every((id) => checkedIds.includes(id));
|
|
8535
|
+
const someChecked = candidateIds.some((id) => checkedIds.includes(id));
|
|
8536
|
+
const toggleAll = (0, import_react17.useCallback)(() => {
|
|
8537
|
+
setCheckedIds(allChecked ? [] : [...candidateIds]);
|
|
8538
|
+
}, [allChecked, candidateIds]);
|
|
8539
|
+
const returnAll = (0, import_react17.useCallback)(() => {
|
|
8540
|
+
setCandidateIds([]);
|
|
8541
|
+
setCheckedIds([]);
|
|
8542
|
+
}, []);
|
|
8543
|
+
const checkedCandidates = (0, import_react17.useMemo)(() => candidateIds.filter((id) => checkedIds.includes(id)), [candidateIds, checkedIds]);
|
|
8544
|
+
const isDirty = checkedCandidates.length !== assignedIds.length || checkedCandidates.some((id) => !assignedIds.includes(id));
|
|
8545
|
+
const submitAssignment = (0, import_react17.useCallback)(async () => {
|
|
8546
|
+
if (!selectedTargetId) {
|
|
8547
|
+
alert("\u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E7\u05D5\u05D3\u05DD \u05E8\u05E9\u05D5\u05DE\u05EA \u05D9\u05E2\u05D3 \u05DC\u05E4\u05E0\u05D9 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
|
|
8548
|
+
return;
|
|
8549
|
+
}
|
|
8550
|
+
setSaveError(null);
|
|
8551
|
+
setIsSaving(true);
|
|
8552
|
+
try {
|
|
8553
|
+
await persistAssignment(checkedCandidates);
|
|
8554
|
+
} catch (err) {
|
|
8555
|
+
console.error("[PlacementBlock] save failed:", err);
|
|
8556
|
+
setSaveError((err == null ? void 0 : err.message) || "\u05D4\u05E9\u05DE\u05D9\u05E8\u05D4 \u05E0\u05DB\u05E9\u05DC\u05D4");
|
|
8557
|
+
} finally {
|
|
8558
|
+
setIsSaving(false);
|
|
8559
|
+
}
|
|
8560
|
+
}, [selectedTargetId, persistAssignment, checkedCandidates]);
|
|
8561
|
+
const cycleStatus = (0, import_react17.useCallback)((recordId) => {
|
|
8562
|
+
setStatusMap((prev) => {
|
|
8563
|
+
const current = prev[recordId] || defaultStatusId;
|
|
8564
|
+
const idx = statuses.findIndex((c) => c.id === current);
|
|
8565
|
+
return __spreadProps(__spreadValues({}, prev), { [recordId]: statuses[(idx + 1) % statuses.length].id });
|
|
8566
|
+
});
|
|
8567
|
+
}, [statuses, defaultStatusId]);
|
|
8568
|
+
const cancelAssignment = (0, import_react17.useCallback)(async () => {
|
|
8569
|
+
if (!selectedTargetId || assignedIds.length === 0) return;
|
|
8570
|
+
if (!window.confirm(`\u05DC\u05D1\u05D8\u05DC \u05D0\u05EA \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05D5\u05DC\u05DE\u05D7\u05D5\u05E7 \u05D0\u05EA \u05D4\u05E0\u05EA\u05D5\u05DF \u05DE\u05E9\u05D3\u05D4 "${assignmentLabel}"?`)) return;
|
|
8571
|
+
const removed = new Set(assignedIds);
|
|
8572
|
+
setSaveError(null);
|
|
8573
|
+
setIsSaving(true);
|
|
8574
|
+
try {
|
|
8575
|
+
await persistAssignment([]);
|
|
8576
|
+
setCheckedIds((prev) => prev.filter((id) => !removed.has(id)));
|
|
8577
|
+
} catch (err) {
|
|
8578
|
+
console.error("[PlacementBlock] cancel failed:", err);
|
|
8579
|
+
setSaveError((err == null ? void 0 : err.message) || "\u05D1\u05D9\u05D8\u05D5\u05DC \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05E0\u05DB\u05E9\u05DC");
|
|
8580
|
+
} finally {
|
|
8581
|
+
setIsSaving(false);
|
|
8582
|
+
}
|
|
8583
|
+
}, [selectedTargetId, assignedIds, assignmentLabel, persistAssignment]);
|
|
8584
|
+
const makeColDefs = (0, import_react17.useCallback)((columns, fallbackName, withCheckbox = false) => {
|
|
8585
|
+
const defs = [];
|
|
8586
|
+
if (withCheckbox) {
|
|
8587
|
+
defs.push({
|
|
8588
|
+
colId: "select",
|
|
8589
|
+
headerName: "",
|
|
8590
|
+
width: 56,
|
|
8591
|
+
pinned: "right",
|
|
8592
|
+
suppressSizeToFit: true,
|
|
8593
|
+
sortable: false,
|
|
8594
|
+
filter: false,
|
|
8595
|
+
suppressMovable: true,
|
|
8596
|
+
cellRenderer: CheckCellRenderer,
|
|
8597
|
+
cellRendererParams: { onToggle: toggleChecked },
|
|
8598
|
+
headerComponent: CheckHeader,
|
|
8599
|
+
headerComponentParams: { allChecked, someChecked, onToggleAll: toggleAll }
|
|
8600
|
+
});
|
|
8601
|
+
}
|
|
8602
|
+
defs.push({ colId: "color", headerName: "\u05E1\u05D8\u05D8\u05D5\u05E1", width: 70, valueGetter: (p) => {
|
|
8603
|
+
var _a2;
|
|
8604
|
+
return (_a2 = p.data) == null ? void 0 : _a2.statusId;
|
|
8605
|
+
}, cellRenderer: ColorDotRenderer, cellRendererParams: { onCycle: cycleStatus, statuses, defaultStatusId }, pinned: "right", suppressSizeToFit: true });
|
|
8606
|
+
const userCols = (columns || []).filter((c) => isUserColumn(c) && !["id", "_id", "id_", "statusId"].includes(c.name));
|
|
8607
|
+
if (userCols.length > 0) {
|
|
8608
|
+
const displayIsRelated = displayField.includes(RELATION_SEP);
|
|
8609
|
+
const ordered = [...userCols.filter((c) => c.name === displayField), ...userCols.filter((c) => c.name !== displayField)];
|
|
8610
|
+
if (displayIsRelated) defs.push({ colId: displayField, headerName: columnRefLabel(displayField), valueGetter: (p) => {
|
|
8611
|
+
var _a2;
|
|
8612
|
+
return (_a2 = p.data) == null ? void 0 : _a2[displayField];
|
|
8613
|
+
}, valueFormatter: (p) => cellText(p.value), getQuickFilterText: (p) => cellText(p.value), rowDrag: true, flex: 1, minWidth: 120 });
|
|
8614
|
+
ordered.forEach((c, i) => defs.push({ colId: c.name, field: c.name, headerName: c.label || c.name, valueGetter: (p) => readColumnValue(p.data, c.name), valueFormatter: (p) => displayValue(c, p.value), getQuickFilterText: (p) => cellText(displayValue(c, p.value)), rowDrag: !displayIsRelated && i === 0, flex: 1, minWidth: 120 }));
|
|
8615
|
+
} else {
|
|
8616
|
+
defs.push({ field: "__label", headerName: fallbackName, rowDrag: true, flex: 1 });
|
|
8617
|
+
}
|
|
8618
|
+
return defs;
|
|
8619
|
+
}, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked]);
|
|
8620
|
+
const sourceHeader = displayField === "name" ? "\u05E9\u05DD" : columnRefLabel(displayField);
|
|
8621
|
+
const sourceColDefs = (0, import_react17.useMemo)(() => makeColDefs(sourceColumns, sourceHeader), [makeColDefs, sourceColumns, sourceHeader]);
|
|
8622
|
+
const candidateColDefs = (0, import_react17.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, true), [makeColDefs, sourceColumns, sourceHeader]);
|
|
8623
|
+
const getRowId = (0, import_react17.useCallback)((p) => p.data.id, []);
|
|
8624
|
+
const sourceContainerRef = (0, import_react17.useRef)(null);
|
|
8625
|
+
const assignedContainerRef = (0, import_react17.useRef)(null);
|
|
8626
|
+
const [sourceApi, setSourceApi] = (0, import_react17.useState)(null);
|
|
8627
|
+
const [assignedApi, setAssignedApi] = (0, import_react17.useState)(null);
|
|
8628
|
+
(0, import_react17.useEffect)(() => {
|
|
8629
|
+
if (!sourceApi || !assignedApi) return;
|
|
8630
|
+
const toAssigned = { getContainer: () => assignedContainerRef.current, onDragStop: (p) => {
|
|
8631
|
+
var _a2, _b2;
|
|
8632
|
+
if ((_b2 = (_a2 = p.node) == null ? void 0 : _a2.data) == null ? void 0 : _b2.id) moveToCandidatesRef.current(p.node.data.id);
|
|
8633
|
+
} };
|
|
8634
|
+
const toSource = { getContainer: () => sourceContainerRef.current, onDragStop: (p) => {
|
|
8635
|
+
var _a2, _b2;
|
|
8636
|
+
if ((_b2 = (_a2 = p.node) == null ? void 0 : _a2.data) == null ? void 0 : _b2.id) moveToSourceRef.current(p.node.data.id);
|
|
8637
|
+
} };
|
|
8638
|
+
sourceApi.addRowDropZone(toAssigned);
|
|
8639
|
+
assignedApi.addRowDropZone(toSource);
|
|
8640
|
+
return () => {
|
|
8641
|
+
try {
|
|
8642
|
+
sourceApi.removeRowDropZone(toAssigned);
|
|
8643
|
+
} catch (e) {
|
|
8644
|
+
}
|
|
8645
|
+
try {
|
|
8646
|
+
assignedApi.removeRowDropZone(toSource);
|
|
8647
|
+
} catch (e) {
|
|
8648
|
+
}
|
|
8649
|
+
};
|
|
8650
|
+
}, [sourceApi, assignedApi]);
|
|
8651
|
+
const selectorLabel = (0, import_react17.useMemo)(() => {
|
|
8652
|
+
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
8653
|
+
return (col == null ? void 0 : col.label) || columnRefLabel(selectorField) || "\u05D1\u05D7\u05D9\u05E8\u05EA \u05E8\u05E9\u05D5\u05DE\u05D4 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5";
|
|
8654
|
+
}, [targetColumns, selectorField]);
|
|
8655
|
+
const assignedText = (0, import_react17.useMemo)(
|
|
8656
|
+
() => assignedIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", "),
|
|
8657
|
+
[assignedIds, sourceRows, nameOf]
|
|
8658
|
+
);
|
|
8659
|
+
const activeTarget = targetRows.find((r) => r.id === selectedTargetId);
|
|
8660
|
+
const targetLabel = (0, import_react17.useCallback)((r) => {
|
|
8661
|
+
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
8662
|
+
return displayValue(col || { name: selectorField }, readColumnValue(r.data, selectorField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD";
|
|
8663
|
+
}, [selectorField, targetColumns, displayValue]);
|
|
8664
|
+
const previewColumns = (0, import_react17.useMemo)(() => targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)), [targetColumns, assignmentField]);
|
|
8665
|
+
if (!config || !sourceTableId || !targetTableId) {
|
|
8666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "p-4 text-xs text-slate-500 border border-dashed border-slate-300 rounded-xl", dir: "rtl", children: "\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5 \u05DC\u05D0 \u05D4\u05D5\u05D2\u05D3\u05E8 (\u05D7\u05E1\u05E8\u05D5\u05EA \u05D8\u05D1\u05DC\u05EA \u05DE\u05E7\u05D5\u05E8 / \u05D8\u05D1\u05DC\u05EA \u05D9\u05E2\u05D3)." });
|
|
8667
|
+
}
|
|
8668
|
+
const selectClass = "w-full p-2 border border-slate-300 rounded-lg text-xs font-medium text-slate-700 bg-slate-50 outline-none focus:border-brand";
|
|
8669
|
+
const labelClass = "block text-[11px] font-semibold text-slate-500 mb-1";
|
|
8670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `w-full flex flex-col gap-4 p-4 bg-slate-50 min-h-[850px] rounded-xl border border-slate-200 ${className}`, dir: "rtl", children: [
|
|
8671
|
+
(loadError || saveError) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "p-3 text-xs rounded-lg bg-rose-50 border border-rose-200 text-rose-700", children: loadError || saveError }),
|
|
8672
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
|
|
8673
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w-full lg:w-1/3 bg-teal-50/40 p-4 rounded-xl border border-teal-100 shadow-xs flex flex-col", children: [
|
|
8674
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("h4", { className: "font-bold text-teal-900 border-b border-teal-200 pb-2 mb-3 text-sm flex items-center gap-2", children: [
|
|
8675
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "\u{1F4CC}" }),
|
|
8676
|
+
" \u05E4\u05E8\u05D8\u05D9 \u05D4\u05D9\u05E2\u05D3 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5"
|
|
8677
|
+
] }),
|
|
8678
|
+
activeTarget ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-2 text-xs text-slate-700 overflow-y-auto pr-1 max-h-32", children: [
|
|
8679
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "font-bold text-slate-900 text-sm mb-1", children: targetLabel(activeTarget) }),
|
|
8680
|
+
previewColumns.map((col) => ({ col, text: displayValue(col, readColumnValue(activeTarget.data, col.name)) })).filter(({ col, text }) => {
|
|
8681
|
+
var _a2;
|
|
8682
|
+
return text && (col.type === "RELATION" || typeof ((_a2 = activeTarget.data) == null ? void 0 : _a2[col.name]) !== "object");
|
|
8683
|
+
}).map(({ col, text }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-2 items-start", children: [
|
|
8684
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "font-semibold shrink-0", children: [
|
|
8685
|
+
col.label || col.name,
|
|
8686
|
+
":"
|
|
8687
|
+
] }),
|
|
8688
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "break-words line-clamp-2", children: text })
|
|
8689
|
+
] }, col.name)),
|
|
8690
|
+
assignmentField && assignedText && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex gap-2 items-start", children: [
|
|
8691
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "font-semibold shrink-0", children: [
|
|
8692
|
+
assignmentLabel,
|
|
8693
|
+
":"
|
|
8694
|
+
] }),
|
|
8695
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "break-words line-clamp-2", title: assignedText, children: assignedText })
|
|
8696
|
+
] }),
|
|
8697
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-3 pt-3 border-t border-teal-200/60 text-teal-800 font-bold", children: [
|
|
8698
|
+
"\u05DE\u05E9\u05D5\u05D1\u05E6\u05D9\u05DD \u05DB\u05E8\u05D2\u05E2: ",
|
|
8699
|
+
assignedIds.length
|
|
8700
|
+
] })
|
|
8701
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-slate-500 text-xs text-center py-6", children: isLoading ? "\u05D8\u05D5\u05E2\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9\u05DD..." : "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05E8\u05E9\u05D5\u05DE\u05EA \u05D9\u05E2\u05D3." })
|
|
8702
|
+
] }),
|
|
8703
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "w-full lg:w-2/3 bg-white p-4 rounded-xl border border-slate-200 shadow-xs flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
8704
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "font-bold text-slate-800 mb-3 text-sm", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05D4\u05D9\u05E2\u05D3" }),
|
|
8705
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
8706
|
+
filterColumns.map((col, index) => {
|
|
8707
|
+
const previousColumns = filterColumns.slice(0, index);
|
|
8708
|
+
const validRowsForThisFilter = targetRows.filter((r) => {
|
|
8709
|
+
return previousColumns.every((prevCol) => {
|
|
8710
|
+
const filterVal = targetFilters[prevCol.name];
|
|
8711
|
+
if (!filterVal) return true;
|
|
8712
|
+
return displayValue(prevCol, readColumnValue(r.data, prevCol.name)) === filterVal;
|
|
8713
|
+
});
|
|
8714
|
+
});
|
|
8715
|
+
const uniqueValues = Array.from(new Set(
|
|
8716
|
+
validRowsForThisFilter.map((r) => displayValue(col, readColumnValue(r.data, col.name)))
|
|
8717
|
+
)).filter(Boolean).sort((a, b) => a.localeCompare(b, "he"));
|
|
8718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
8719
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: labelClass, children: col.label || columnRefLabel(col.name) }),
|
|
8720
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
8721
|
+
"select",
|
|
8722
|
+
{
|
|
8723
|
+
className: selectClass,
|
|
8724
|
+
value: targetFilters[col.name] || "",
|
|
8725
|
+
onChange: (e) => {
|
|
8726
|
+
const val = e.target.value;
|
|
8727
|
+
setTargetFilters((prev) => {
|
|
8728
|
+
const newFilters = __spreadProps(__spreadValues({}, prev), { [col.name]: val });
|
|
8729
|
+
filterColumns.slice(index + 1).forEach((subCol) => {
|
|
8730
|
+
newFilters[subCol.name] = "";
|
|
8731
|
+
});
|
|
8732
|
+
return newFilters;
|
|
8733
|
+
});
|
|
8734
|
+
},
|
|
8735
|
+
children: [
|
|
8736
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
8737
|
+
uniqueValues.map((v) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: v, children: v }, v))
|
|
8738
|
+
]
|
|
8739
|
+
}
|
|
8740
|
+
)
|
|
8741
|
+
] }, col.name);
|
|
8742
|
+
}),
|
|
8743
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
8744
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: labelClass, children: selectorLabel }),
|
|
8745
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("select", { className: selectClass, value: selectedTargetId, onChange: (e) => setSelectedTargetId(e.target.value), children: [
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("option", { value: "", children: [
|
|
8747
|
+
"-- \u05D1\u05D7\u05E8 \u05DE\u05EA\u05D5\u05DA ",
|
|
8748
|
+
filteredTargetRows.length,
|
|
8749
|
+
" \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA --"
|
|
8750
|
+
] }),
|
|
8751
|
+
filteredTargetRows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("option", { value: r.id, children: targetLabel(r) }, r.id))
|
|
8752
|
+
] })
|
|
8753
|
+
] })
|
|
8754
|
+
] })
|
|
8755
|
+
] }) })
|
|
8756
|
+
] }),
|
|
8757
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col lg:flex-row w-full gap-4 h-[550px]", children: [
|
|
8758
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w-full lg:w-1/2 flex flex-col border border-slate-200 rounded-xl shadow-xs bg-white overflow-hidden", children: [
|
|
8759
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "bg-slate-100 p-3 border-b border-slate-200 flex flex-col gap-2", children: [
|
|
8760
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex justify-between items-center font-bold text-slate-800 text-sm", children: [
|
|
8761
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
8762
|
+
"\u05E8\u05E9\u05D9\u05DE\u05EA \u05DE\u05E7\u05D5\u05E8 (",
|
|
8763
|
+
availableGridData.length,
|
|
8764
|
+
")"
|
|
8765
|
+
] }),
|
|
8766
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[11px] font-normal text-slate-500 bg-white px-2 py-0.5 rounded-full shadow-sm border border-slate-200", children: "\u05D2\u05E8\u05D5\u05E8 \u05E9\u05DE\u05D0\u05DC\u05D4 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 \u2190" })
|
|
8767
|
+
] }),
|
|
8768
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "search", value: sourceSearch, onChange: (e) => setSourceSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
|
|
8769
|
+
] }),
|
|
8770
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: sourceContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ag_grid_react.AgGridReact, { rowData: availableGridData, columnDefs: sourceColDefs, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: sourceSearch, onGridReady: (e) => setSourceApi(e.api), loading: isLoading }) })
|
|
8771
|
+
] }),
|
|
8772
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w-full lg:w-1/2 flex flex-col border border-blue-200 rounded-xl shadow-xs bg-white overflow-hidden ring-1 ring-blue-100", children: [
|
|
8773
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "bg-blue-50/80 p-3 border-b border-blue-100 flex flex-col gap-2", children: [
|
|
8774
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [
|
|
8775
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2 font-bold text-blue-900 text-sm", children: [
|
|
8776
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
8777
|
+
"\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 (",
|
|
8778
|
+
candidateGridData.length,
|
|
8779
|
+
")"
|
|
8780
|
+
] }),
|
|
8781
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-[11px] font-normal text-blue-700 bg-white px-2 py-0.5 rounded-full shadow-sm border border-blue-100", children: "\u2192 \u05D2\u05E8\u05D5\u05E8 \u05D9\u05DE\u05D9\u05E0\u05D4 \u05DC\u05D4\u05D7\u05D6\u05E8\u05D4" })
|
|
8782
|
+
] }),
|
|
8783
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8784
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", onClick: returnAll, disabled: candidateIds.length === 0, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-amber-400 hover:bg-amber-500 text-slate-900 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u21BA \u05D4\u05D7\u05D6\u05E8 \u05D4\u05DB\u05DC" }),
|
|
8785
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", onClick: submitAssignment, disabled: !selectedTargetId || !isDirty || isSaving, className: "px-4 py-1.5 rounded-lg text-xs font-bold bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: isSaving ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05D1\u05E5" }),
|
|
8786
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", onClick: cancelAssignment, disabled: !selectedTargetId || assignedIds.length === 0 || isSaving, className: "px-3 py-1.5 rounded-lg text-xs font-bold bg-white hover:bg-rose-50 text-rose-600 border border-rose-300 disabled:opacity-40 disabled:cursor-not-allowed transition-colors", children: "\u05D1\u05D9\u05D8\u05D5\u05DC \u05E9\u05D9\u05D1\u05D5\u05E5" })
|
|
8787
|
+
] })
|
|
8788
|
+
] }),
|
|
8789
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("input", { type: "search", value: candidateSearch, onChange: (e) => setCandidateSearch(e.target.value), placeholder: "\u05E1\u05D9\u05E0\u05D5\u05DF...", className: "w-full p-2 border border-slate-300 rounded-lg text-xs bg-white outline-none focus:border-brand" })
|
|
8790
|
+
] }),
|
|
8791
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: assignedContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ag_grid_react.AgGridReact, { rowData: candidateGridData, columnDefs: candidateColDefs, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: candidateSearch, onGridReady: (e) => setAssignedApi(e.api), loading: isLoading }) })
|
|
8792
|
+
] })
|
|
8793
|
+
] })
|
|
8794
|
+
] });
|
|
8795
|
+
};
|
|
8796
|
+
|
|
7826
8797
|
// src/components/WhatsAppComponent/WhatsAppComponent.tsx
|
|
7827
8798
|
var import_lucide_react14 = require("lucide-react");
|
|
7828
8799
|
|
|
7829
8800
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
7830
|
-
var
|
|
8801
|
+
var import_react18 = require("react");
|
|
7831
8802
|
var import_lucide_react10 = require("lucide-react");
|
|
7832
8803
|
var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
|
|
7833
8804
|
|
|
@@ -7947,7 +8918,7 @@ function readFileAsBase64(file) {
|
|
|
7947
8918
|
}
|
|
7948
8919
|
|
|
7949
8920
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
7950
|
-
var
|
|
8921
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
7951
8922
|
function CreateTemplateModal({
|
|
7952
8923
|
isOpen,
|
|
7953
8924
|
onClose,
|
|
@@ -7957,26 +8928,26 @@ function CreateTemplateModal({
|
|
|
7957
8928
|
executeAction,
|
|
7958
8929
|
orgId
|
|
7959
8930
|
}) {
|
|
7960
|
-
const [templateName, setTemplateName] = (0,
|
|
7961
|
-
const [language, setLanguage] = (0,
|
|
7962
|
-
const [category, setCategory] = (0,
|
|
7963
|
-
const [bodyText, setBodyText] = (0,
|
|
7964
|
-
const [variableSamples, setVariableSamples] = (0,
|
|
7965
|
-
const [hasFileHeader, setHasFileHeader] = (0,
|
|
7966
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
7967
|
-
const [fileBase64, setFileBase64] = (0,
|
|
7968
|
-
const [buttons, setButtons] = (0,
|
|
7969
|
-
const [isAddButtonOpen, setIsAddButtonOpen] = (0,
|
|
7970
|
-
const addButtonDropdownRef = (0,
|
|
7971
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
7972
|
-
const [submittingStep, setSubmittingStep] = (0,
|
|
7973
|
-
const [submitError, setSubmitError] = (0,
|
|
7974
|
-
const [fileError, setFileError] = (0,
|
|
7975
|
-
const textareaRef = (0,
|
|
7976
|
-
const fileInputRef = (0,
|
|
7977
|
-
const emojiPickerRef = (0,
|
|
7978
|
-
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0,
|
|
7979
|
-
(0,
|
|
8931
|
+
const [templateName, setTemplateName] = (0, import_react18.useState)("");
|
|
8932
|
+
const [language, setLanguage] = (0, import_react18.useState)("he");
|
|
8933
|
+
const [category, setCategory] = (0, import_react18.useState)("MARKETING");
|
|
8934
|
+
const [bodyText, setBodyText] = (0, import_react18.useState)("");
|
|
8935
|
+
const [variableSamples, setVariableSamples] = (0, import_react18.useState)({});
|
|
8936
|
+
const [hasFileHeader, setHasFileHeader] = (0, import_react18.useState)(false);
|
|
8937
|
+
const [selectedFile, setSelectedFile] = (0, import_react18.useState)(null);
|
|
8938
|
+
const [fileBase64, setFileBase64] = (0, import_react18.useState)("");
|
|
8939
|
+
const [buttons, setButtons] = (0, import_react18.useState)([]);
|
|
8940
|
+
const [isAddButtonOpen, setIsAddButtonOpen] = (0, import_react18.useState)(false);
|
|
8941
|
+
const addButtonDropdownRef = (0, import_react18.useRef)(null);
|
|
8942
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react18.useState)(false);
|
|
8943
|
+
const [submittingStep, setSubmittingStep] = (0, import_react18.useState)("");
|
|
8944
|
+
const [submitError, setSubmitError] = (0, import_react18.useState)(null);
|
|
8945
|
+
const [fileError, setFileError] = (0, import_react18.useState)(null);
|
|
8946
|
+
const textareaRef = (0, import_react18.useRef)(null);
|
|
8947
|
+
const fileInputRef = (0, import_react18.useRef)(null);
|
|
8948
|
+
const emojiPickerRef = (0, import_react18.useRef)(null);
|
|
8949
|
+
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0, import_react18.useState)(false);
|
|
8950
|
+
(0, import_react18.useEffect)(() => {
|
|
7980
8951
|
function handleClickOutside(event) {
|
|
7981
8952
|
if (emojiPickerRef.current && !emojiPickerRef.current.contains(event.target)) {
|
|
7982
8953
|
setIsEmojiPickerOpen(false);
|
|
@@ -8000,7 +8971,7 @@ function CreateTemplateModal({
|
|
|
8000
8971
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
8001
8972
|
};
|
|
8002
8973
|
}, [isEmojiPickerOpen, isAddButtonOpen]);
|
|
8003
|
-
(0,
|
|
8974
|
+
(0, import_react18.useEffect)(() => {
|
|
8004
8975
|
if (isOpen) {
|
|
8005
8976
|
setTemplateName("");
|
|
8006
8977
|
setLanguage("he");
|
|
@@ -8019,10 +8990,10 @@ function CreateTemplateModal({
|
|
|
8019
8990
|
setIsEmojiPickerOpen(false);
|
|
8020
8991
|
}
|
|
8021
8992
|
}, [isOpen]);
|
|
8022
|
-
const uniqueVariables = (0,
|
|
8993
|
+
const uniqueVariables = (0, import_react18.useMemo)(() => {
|
|
8023
8994
|
return extractUniqueVariableIndices(bodyText);
|
|
8024
8995
|
}, [bodyText]);
|
|
8025
|
-
(0,
|
|
8996
|
+
(0, import_react18.useEffect)(() => {
|
|
8026
8997
|
setVariableSamples((prev) => {
|
|
8027
8998
|
const next = {};
|
|
8028
8999
|
uniqueVariables.forEach((idx) => {
|
|
@@ -8033,7 +9004,7 @@ function CreateTemplateModal({
|
|
|
8033
9004
|
}, [uniqueVariables]);
|
|
8034
9005
|
const isNameEmpty = templateName.trim().length === 0;
|
|
8035
9006
|
const isNamePatternValid = isValidTemplateName(templateName);
|
|
8036
|
-
const isNameDuplicate = (0,
|
|
9007
|
+
const isNameDuplicate = (0, import_react18.useMemo)(() => {
|
|
8037
9008
|
const trimmedName = templateName.trim().toLowerCase();
|
|
8038
9009
|
if (!trimmedName) return false;
|
|
8039
9010
|
if (existingTemplates && existingTemplates.length > 0) {
|
|
@@ -8043,9 +9014,9 @@ function CreateTemplateModal({
|
|
|
8043
9014
|
}
|
|
8044
9015
|
return isDuplicateTemplateName(trimmedName, existingTemplateNames, language);
|
|
8045
9016
|
}, [templateName, language, existingTemplates, existingTemplateNames]);
|
|
8046
|
-
const ratioInfo = (0,
|
|
8047
|
-
const seqInfo = (0,
|
|
8048
|
-
const validationResult = (0,
|
|
9017
|
+
const ratioInfo = (0, import_react18.useMemo)(() => validateWordToVariableRatio(bodyText), [bodyText]);
|
|
9018
|
+
const seqInfo = (0, import_react18.useMemo)(() => validateSequentialVariables(bodyText), [bodyText]);
|
|
9019
|
+
const validationResult = (0, import_react18.useMemo)(() => {
|
|
8049
9020
|
return validateWhatsAppTemplate({
|
|
8050
9021
|
name: templateName,
|
|
8051
9022
|
language,
|
|
@@ -8299,12 +9270,12 @@ function CreateTemplateModal({
|
|
|
8299
9270
|
}
|
|
8300
9271
|
};
|
|
8301
9272
|
if (!isOpen) return null;
|
|
8302
|
-
return /* @__PURE__ */ (0,
|
|
9273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8303
9274
|
"div",
|
|
8304
9275
|
{
|
|
8305
9276
|
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",
|
|
8306
9277
|
dir: "rtl",
|
|
8307
|
-
children: /* @__PURE__ */ (0,
|
|
9278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8308
9279
|
"div",
|
|
8309
9280
|
{
|
|
8310
9281
|
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",
|
|
@@ -8312,43 +9283,43 @@ function CreateTemplateModal({
|
|
|
8312
9283
|
"aria-modal": "true",
|
|
8313
9284
|
"aria-labelledby": "modal-title",
|
|
8314
9285
|
children: [
|
|
8315
|
-
/* @__PURE__ */ (0,
|
|
8316
|
-
/* @__PURE__ */ (0,
|
|
8317
|
-
/* @__PURE__ */ (0,
|
|
8318
|
-
/* @__PURE__ */ (0,
|
|
8319
|
-
/* @__PURE__ */ (0,
|
|
8320
|
-
/* @__PURE__ */ (0,
|
|
9286
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
9287
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
9288
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Plus, { className: "w-4 h-4" }) }),
|
|
9289
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9290
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }),
|
|
9291
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
8321
9292
|
] })
|
|
8322
9293
|
] }),
|
|
8323
|
-
/* @__PURE__ */ (0,
|
|
9294
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8324
9295
|
"button",
|
|
8325
9296
|
{
|
|
8326
9297
|
type: "button",
|
|
8327
9298
|
onClick: onClose,
|
|
8328
9299
|
className: "p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer",
|
|
8329
9300
|
"aria-label": "\u05E1\u05D2\u05D5\u05E8",
|
|
8330
|
-
children: /* @__PURE__ */ (0,
|
|
9301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.X, { className: "w-5 h-5" })
|
|
8331
9302
|
}
|
|
8332
9303
|
)
|
|
8333
9304
|
] }),
|
|
8334
|
-
/* @__PURE__ */ (0,
|
|
8335
|
-
/* @__PURE__ */ (0,
|
|
8336
|
-
submitError && /* @__PURE__ */ (0,
|
|
8337
|
-
/* @__PURE__ */ (0,
|
|
8338
|
-
/* @__PURE__ */ (0,
|
|
9305
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
|
|
9306
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
|
|
9307
|
+
submitError && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-800 flex items-center gap-2", children: [
|
|
9308
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
9309
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: submitError })
|
|
8339
9310
|
] }),
|
|
8340
|
-
/* @__PURE__ */ (0,
|
|
8341
|
-
/* @__PURE__ */ (0,
|
|
8342
|
-
/* @__PURE__ */ (0,
|
|
9311
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
|
|
9312
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9313
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
8343
9314
|
"\u05E9\u05DD \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4 ",
|
|
8344
|
-
/* @__PURE__ */ (0,
|
|
9315
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8345
9316
|
] }),
|
|
8346
|
-
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0,
|
|
8347
|
-
/* @__PURE__ */ (0,
|
|
9317
|
+
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
|
|
9318
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.CheckCircle2, { className: "w-3.5 h-3.5" }),
|
|
8348
9319
|
" \u05E9\u05DD \u05EA\u05E7\u05D9\u05DF"
|
|
8349
9320
|
] })
|
|
8350
9321
|
] }),
|
|
8351
|
-
/* @__PURE__ */ (0,
|
|
9322
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8352
9323
|
"input",
|
|
8353
9324
|
{
|
|
8354
9325
|
type: "text",
|
|
@@ -8360,47 +9331,47 @@ function CreateTemplateModal({
|
|
|
8360
9331
|
required: true
|
|
8361
9332
|
}
|
|
8362
9333
|
),
|
|
8363
|
-
/* @__PURE__ */ (0,
|
|
8364
|
-
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0,
|
|
8365
|
-
/* @__PURE__ */ (0,
|
|
9334
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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." }),
|
|
9335
|
+
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
|
|
9336
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
8366
9337
|
"\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 (",
|
|
8367
9338
|
language,
|
|
8368
9339
|
"). \u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E9\u05DD \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05D0\u05D5 \u05E9\u05E4\u05D4 \u05D0\u05D7\u05E8\u05EA."
|
|
8369
9340
|
] })
|
|
8370
9341
|
] }),
|
|
8371
|
-
/* @__PURE__ */ (0,
|
|
8372
|
-
/* @__PURE__ */ (0,
|
|
8373
|
-
/* @__PURE__ */ (0,
|
|
8374
|
-
/* @__PURE__ */ (0,
|
|
9342
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9343
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
|
|
9344
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
|
|
9345
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8375
9346
|
"select",
|
|
8376
9347
|
{
|
|
8377
9348
|
value: language,
|
|
8378
9349
|
onChange: (e) => setLanguage(e.target.value),
|
|
8379
9350
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
8380
|
-
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0,
|
|
9351
|
+
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
8381
9352
|
}
|
|
8382
9353
|
)
|
|
8383
9354
|
] }),
|
|
8384
|
-
/* @__PURE__ */ (0,
|
|
8385
|
-
/* @__PURE__ */ (0,
|
|
8386
|
-
/* @__PURE__ */ (0,
|
|
9355
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
|
|
9356
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
|
|
9357
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8387
9358
|
"select",
|
|
8388
9359
|
{
|
|
8389
9360
|
value: category,
|
|
8390
9361
|
onChange: (e) => setCategory(e.target.value),
|
|
8391
9362
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
8392
|
-
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0,
|
|
9363
|
+
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
8393
9364
|
}
|
|
8394
9365
|
)
|
|
8395
9366
|
] })
|
|
8396
9367
|
] }),
|
|
8397
|
-
/* @__PURE__ */ (0,
|
|
8398
|
-
/* @__PURE__ */ (0,
|
|
9368
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-2", children: [
|
|
9369
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
8399
9370
|
"\u05EA\u05D5\u05DB\u05DF \u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 ",
|
|
8400
|
-
/* @__PURE__ */ (0,
|
|
9371
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8401
9372
|
] }),
|
|
8402
|
-
/* @__PURE__ */ (0,
|
|
8403
|
-
/* @__PURE__ */ (0,
|
|
9373
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9374
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8404
9375
|
"textarea",
|
|
8405
9376
|
{
|
|
8406
9377
|
ref: textareaRef,
|
|
@@ -8415,14 +9386,14 @@ function CreateTemplateModal({
|
|
|
8415
9386
|
required: true
|
|
8416
9387
|
}
|
|
8417
9388
|
),
|
|
8418
|
-
/* @__PURE__ */ (0,
|
|
9389
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8419
9390
|
"div",
|
|
8420
9391
|
{
|
|
8421
9392
|
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",
|
|
8422
9393
|
dir: language === "en_US" ? "ltr" : "rtl",
|
|
8423
9394
|
children: [
|
|
8424
|
-
/* @__PURE__ */ (0,
|
|
8425
|
-
/* @__PURE__ */ (0,
|
|
9395
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
9396
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8426
9397
|
"button",
|
|
8427
9398
|
{
|
|
8428
9399
|
type: "button",
|
|
@@ -8430,10 +9401,10 @@ function CreateTemplateModal({
|
|
|
8430
9401
|
onClick: () => handleApplyFormatting("*"),
|
|
8431
9402
|
title: "\u05DE\u05D5\u05D3\u05D2\u05E9 (Bold) *\u05D8\u05E7\u05E1\u05D8*",
|
|
8432
9403
|
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",
|
|
8433
|
-
children: /* @__PURE__ */ (0,
|
|
9404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Bold, { className: "w-3.5 h-3.5" })
|
|
8434
9405
|
}
|
|
8435
9406
|
),
|
|
8436
|
-
/* @__PURE__ */ (0,
|
|
9407
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8437
9408
|
"button",
|
|
8438
9409
|
{
|
|
8439
9410
|
type: "button",
|
|
@@ -8441,10 +9412,10 @@ function CreateTemplateModal({
|
|
|
8441
9412
|
onClick: () => handleApplyFormatting("_"),
|
|
8442
9413
|
title: "\u05E0\u05D8\u05D5\u05D9 (Italic) _\u05D8\u05E7\u05E1\u05D8_",
|
|
8443
9414
|
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",
|
|
8444
|
-
children: /* @__PURE__ */ (0,
|
|
9415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Italic, { className: "w-3.5 h-3.5" })
|
|
8445
9416
|
}
|
|
8446
9417
|
),
|
|
8447
|
-
/* @__PURE__ */ (0,
|
|
9418
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8448
9419
|
"button",
|
|
8449
9420
|
{
|
|
8450
9421
|
type: "button",
|
|
@@ -8452,12 +9423,12 @@ function CreateTemplateModal({
|
|
|
8452
9423
|
onClick: () => handleApplyFormatting("~"),
|
|
8453
9424
|
title: "\u05E7\u05D5 \u05D7\u05D5\u05E6\u05D4 (Strikethrough) ~\u05D8\u05E7\u05E1\u05D8~",
|
|
8454
9425
|
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",
|
|
8455
|
-
children: /* @__PURE__ */ (0,
|
|
9426
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Strikethrough, { className: "w-3.5 h-3.5" })
|
|
8456
9427
|
}
|
|
8457
9428
|
),
|
|
8458
|
-
/* @__PURE__ */ (0,
|
|
8459
|
-
/* @__PURE__ */ (0,
|
|
8460
|
-
/* @__PURE__ */ (0,
|
|
9429
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
9430
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
|
|
9431
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8461
9432
|
"button",
|
|
8462
9433
|
{
|
|
8463
9434
|
type: "button",
|
|
@@ -8465,16 +9436,16 @@ function CreateTemplateModal({
|
|
|
8465
9436
|
onClick: () => setIsEmojiPickerOpen(!isEmojiPickerOpen),
|
|
8466
9437
|
title: "\u05D4\u05D5\u05E1\u05E3 \u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9 (Emoji)",
|
|
8467
9438
|
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"}`,
|
|
8468
|
-
children: /* @__PURE__ */ (0,
|
|
9439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Smile, { className: "w-4 h-4" })
|
|
8469
9440
|
}
|
|
8470
9441
|
),
|
|
8471
|
-
isEmojiPickerOpen && /* @__PURE__ */ (0,
|
|
9442
|
+
isEmojiPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8472
9443
|
"div",
|
|
8473
9444
|
{
|
|
8474
9445
|
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`,
|
|
8475
9446
|
dir: "ltr",
|
|
8476
9447
|
onMouseDown: (e) => e.stopPropagation(),
|
|
8477
|
-
children: /* @__PURE__ */ (0,
|
|
9448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8478
9449
|
import_emoji_picker_react.default,
|
|
8479
9450
|
{
|
|
8480
9451
|
onEmojiClick: (emojiData) => {
|
|
@@ -8491,8 +9462,8 @@ function CreateTemplateModal({
|
|
|
8491
9462
|
}
|
|
8492
9463
|
)
|
|
8493
9464
|
] }),
|
|
8494
|
-
/* @__PURE__ */ (0,
|
|
8495
|
-
/* @__PURE__ */ (0,
|
|
9465
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
9466
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8496
9467
|
"button",
|
|
8497
9468
|
{
|
|
8498
9469
|
type: "button",
|
|
@@ -8502,28 +9473,28 @@ function CreateTemplateModal({
|
|
|
8502
9473
|
"aria-label": language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4",
|
|
8503
9474
|
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",
|
|
8504
9475
|
children: [
|
|
8505
|
-
/* @__PURE__ */ (0,
|
|
8506
|
-
/* @__PURE__ */ (0,
|
|
9476
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Plus, { className: "w-3.5 h-3.5" }),
|
|
9477
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
|
|
8507
9478
|
]
|
|
8508
9479
|
}
|
|
8509
9480
|
)
|
|
8510
9481
|
] }),
|
|
8511
|
-
/* @__PURE__ */ (0,
|
|
9482
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8512
9483
|
"div",
|
|
8513
9484
|
{
|
|
8514
9485
|
className: "flex items-center gap-1 font-mono text-[11px]",
|
|
8515
9486
|
dir: "ltr",
|
|
8516
9487
|
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)",
|
|
8517
9488
|
children: [
|
|
8518
|
-
/* @__PURE__ */ (0,
|
|
9489
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8519
9490
|
"span",
|
|
8520
9491
|
{
|
|
8521
9492
|
className: `font-semibold transition-colors ${bodyText.length >= 1024 ? "text-rose-600" : bodyText.length >= 950 ? "text-amber-600" : "text-slate-500"}`,
|
|
8522
9493
|
children: bodyText.length
|
|
8523
9494
|
}
|
|
8524
9495
|
),
|
|
8525
|
-
/* @__PURE__ */ (0,
|
|
8526
|
-
/* @__PURE__ */ (0,
|
|
9496
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-300", children: "/" }),
|
|
9497
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-slate-400", children: "1024" })
|
|
8527
9498
|
]
|
|
8528
9499
|
}
|
|
8529
9500
|
)
|
|
@@ -8531,30 +9502,30 @@ function CreateTemplateModal({
|
|
|
8531
9502
|
}
|
|
8532
9503
|
)
|
|
8533
9504
|
] }),
|
|
8534
|
-
/* @__PURE__ */ (0,
|
|
8535
|
-
/* @__PURE__ */ (0,
|
|
9505
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
9506
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
|
|
8536
9507
|
ratioInfo.staticWordsCount,
|
|
8537
9508
|
" \u05DE\u05D9\u05DC\u05D9\u05DD"
|
|
8538
9509
|
] }),
|
|
8539
|
-
/* @__PURE__ */ (0,
|
|
9510
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
|
|
8540
9511
|
ratioInfo.variableCount,
|
|
8541
9512
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
8542
9513
|
] })
|
|
8543
9514
|
] }) }),
|
|
8544
|
-
uniqueVariables.length > 0 && /* @__PURE__ */ (0,
|
|
8545
|
-
/* @__PURE__ */ (0,
|
|
8546
|
-
/* @__PURE__ */ (0,
|
|
8547
|
-
/* @__PURE__ */ (0,
|
|
9515
|
+
uniqueVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
9516
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
|
|
9517
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Info, { className: "w-4 h-4 text-emerald-600" }),
|
|
9518
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)" })
|
|
8548
9519
|
] }),
|
|
8549
|
-
/* @__PURE__ */ (0,
|
|
8550
|
-
/* @__PURE__ */ (0,
|
|
8551
|
-
/* @__PURE__ */ (0,
|
|
9520
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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." }),
|
|
9521
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9522
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
|
|
8552
9523
|
"\u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 ",
|
|
8553
9524
|
`{{${idx}}}`,
|
|
8554
9525
|
" ",
|
|
8555
|
-
/* @__PURE__ */ (0,
|
|
9526
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8556
9527
|
] }),
|
|
8557
|
-
/* @__PURE__ */ (0,
|
|
9528
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8558
9529
|
"input",
|
|
8559
9530
|
{
|
|
8560
9531
|
type: "text",
|
|
@@ -8569,21 +9540,21 @@ function CreateTemplateModal({
|
|
|
8569
9540
|
)
|
|
8570
9541
|
] }, idx)) })
|
|
8571
9542
|
] }),
|
|
8572
|
-
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0,
|
|
8573
|
-
/* @__PURE__ */ (0,
|
|
8574
|
-
/* @__PURE__ */ (0,
|
|
8575
|
-
/* @__PURE__ */ (0,
|
|
9543
|
+
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-3.5 bg-amber-50 border border-amber-200 rounded-xl space-y-1.5 text-xs text-amber-900", children: [
|
|
9544
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-1.5 font-bold", children: [
|
|
9545
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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:" })
|
|
8576
9547
|
] }),
|
|
8577
|
-
/* @__PURE__ */ (0,
|
|
9548
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "list-disc list-inside space-y-1 text-[11px] pr-2 leading-relaxed", children: validationResult.errors.map((err, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { children: err }, i)) })
|
|
8578
9549
|
] })
|
|
8579
9550
|
] }),
|
|
8580
|
-
/* @__PURE__ */ (0,
|
|
8581
|
-
/* @__PURE__ */ (0,
|
|
8582
|
-
/* @__PURE__ */ (0,
|
|
8583
|
-
/* @__PURE__ */ (0,
|
|
8584
|
-
/* @__PURE__ */ (0,
|
|
9551
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
9552
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9553
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9554
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Paperclip, { className: "w-4 h-4 text-slate-600" }),
|
|
9555
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)" })
|
|
8585
9556
|
] }),
|
|
8586
|
-
/* @__PURE__ */ (0,
|
|
9557
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8587
9558
|
"input",
|
|
8588
9559
|
{
|
|
8589
9560
|
type: "checkbox",
|
|
@@ -8599,12 +9570,12 @@ function CreateTemplateModal({
|
|
|
8599
9570
|
}
|
|
8600
9571
|
)
|
|
8601
9572
|
] }),
|
|
8602
|
-
hasFileHeader && /* @__PURE__ */ (0,
|
|
8603
|
-
fileError && /* @__PURE__ */ (0,
|
|
8604
|
-
/* @__PURE__ */ (0,
|
|
8605
|
-
/* @__PURE__ */ (0,
|
|
9573
|
+
hasFileHeader && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-3 pt-1", children: [
|
|
9574
|
+
fileError && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9575
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
9576
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: fileError })
|
|
8606
9577
|
] }),
|
|
8607
|
-
/* @__PURE__ */ (0,
|
|
9578
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8608
9579
|
"input",
|
|
8609
9580
|
{
|
|
8610
9581
|
ref: fileInputRef,
|
|
@@ -8614,7 +9585,7 @@ function CreateTemplateModal({
|
|
|
8614
9585
|
className: "hidden"
|
|
8615
9586
|
}
|
|
8616
9587
|
),
|
|
8617
|
-
!selectedFile && /* @__PURE__ */ (0,
|
|
9588
|
+
!selectedFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8618
9589
|
"button",
|
|
8619
9590
|
{
|
|
8620
9591
|
type: "button",
|
|
@@ -8624,49 +9595,49 @@ function CreateTemplateModal({
|
|
|
8624
9595
|
},
|
|
8625
9596
|
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",
|
|
8626
9597
|
children: [
|
|
8627
|
-
/* @__PURE__ */ (0,
|
|
8628
|
-
/* @__PURE__ */ (0,
|
|
8629
|
-
/* @__PURE__ */ (0,
|
|
8630
|
-
/* @__PURE__ */ (0,
|
|
9598
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-9 h-9 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Upload, { className: "w-4 h-4" }) }),
|
|
9599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "text-center", children: [
|
|
9600
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-xs font-bold text-emerald-700 block", children: "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D7\u05D9\u05E8\u05EA \u05E7\u05D5\u05D1\u05E5" }),
|
|
9601
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
|
|
8631
9602
|
] })
|
|
8632
9603
|
]
|
|
8633
9604
|
}
|
|
8634
9605
|
),
|
|
8635
|
-
selectedFile && /* @__PURE__ */ (0,
|
|
8636
|
-
/* @__PURE__ */ (0,
|
|
8637
|
-
/* @__PURE__ */ (0,
|
|
8638
|
-
/* @__PURE__ */ (0,
|
|
8639
|
-
/* @__PURE__ */ (0,
|
|
8640
|
-
/* @__PURE__ */ (0,
|
|
9606
|
+
selectedFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
|
|
9607
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
|
|
9608
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.FileText, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Video, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Image, { className: "w-4 h-4" }) }),
|
|
9609
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "overflow-hidden", children: [
|
|
9610
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
|
|
9611
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { dir: "ltr", className: "inline-block", children: [
|
|
8641
9612
|
formatFileSize(selectedFile.size),
|
|
8642
9613
|
selectedFile.type ? ` \u2022 ${selectedFile.type}` : ""
|
|
8643
9614
|
] }) })
|
|
8644
9615
|
] })
|
|
8645
9616
|
] }),
|
|
8646
|
-
/* @__PURE__ */ (0,
|
|
9617
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8647
9618
|
"button",
|
|
8648
9619
|
{
|
|
8649
9620
|
type: "button",
|
|
8650
9621
|
onClick: handleRemoveFile,
|
|
8651
9622
|
className: "p-1 text-slate-400 hover:text-rose-600 rounded-md transition-colors cursor-pointer",
|
|
8652
9623
|
title: "\u05D4\u05E1\u05E8 \u05E7\u05D5\u05D1\u05E5",
|
|
8653
|
-
children: /* @__PURE__ */ (0,
|
|
9624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Trash2, { className: "w-4 h-4" })
|
|
8654
9625
|
}
|
|
8655
9626
|
)
|
|
8656
9627
|
] })
|
|
8657
9628
|
] })
|
|
8658
9629
|
] }),
|
|
8659
|
-
/* @__PURE__ */ (0,
|
|
8660
|
-
/* @__PURE__ */ (0,
|
|
8661
|
-
/* @__PURE__ */ (0,
|
|
8662
|
-
/* @__PURE__ */ (0,
|
|
8663
|
-
/* @__PURE__ */ (0,
|
|
8664
|
-
/* @__PURE__ */ (0,
|
|
8665
|
-
/* @__PURE__ */ (0,
|
|
9630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
|
|
9631
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9632
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9633
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
|
|
9634
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9635
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)" }),
|
|
9636
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)" })
|
|
8666
9637
|
] })
|
|
8667
9638
|
] }),
|
|
8668
|
-
/* @__PURE__ */ (0,
|
|
8669
|
-
/* @__PURE__ */ (0,
|
|
9639
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9640
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8670
9641
|
"span",
|
|
8671
9642
|
{
|
|
8672
9643
|
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"}`,
|
|
@@ -8676,8 +9647,8 @@ function CreateTemplateModal({
|
|
|
8676
9647
|
]
|
|
8677
9648
|
}
|
|
8678
9649
|
),
|
|
8679
|
-
/* @__PURE__ */ (0,
|
|
8680
|
-
/* @__PURE__ */ (0,
|
|
9650
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative", ref: addButtonDropdownRef, children: [
|
|
9651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8681
9652
|
"button",
|
|
8682
9653
|
{
|
|
8683
9654
|
type: "button",
|
|
@@ -8686,9 +9657,9 @@ function CreateTemplateModal({
|
|
|
8686
9657
|
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"}`,
|
|
8687
9658
|
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",
|
|
8688
9659
|
children: [
|
|
8689
|
-
/* @__PURE__ */ (0,
|
|
8690
|
-
/* @__PURE__ */ (0,
|
|
8691
|
-
/* @__PURE__ */ (0,
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Plus, { className: "w-3.5 h-3.5" }),
|
|
9661
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
|
|
9662
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8692
9663
|
import_lucide_react10.ChevronDown,
|
|
8693
9664
|
{
|
|
8694
9665
|
className: `w-3.5 h-3.5 transition-transform ${isAddButtonOpen ? "rotate-180" : ""}`
|
|
@@ -8697,63 +9668,63 @@ function CreateTemplateModal({
|
|
|
8697
9668
|
]
|
|
8698
9669
|
}
|
|
8699
9670
|
),
|
|
8700
|
-
isAddButtonOpen && /* @__PURE__ */ (0,
|
|
8701
|
-
/* @__PURE__ */ (0,
|
|
9671
|
+
isAddButtonOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8702
9673
|
"button",
|
|
8703
9674
|
{
|
|
8704
9675
|
type: "button",
|
|
8705
9676
|
onClick: () => handleAddButton("QUICK_REPLY"),
|
|
8706
9677
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group",
|
|
8707
9678
|
children: [
|
|
8708
|
-
/* @__PURE__ */ (0,
|
|
8709
|
-
/* @__PURE__ */ (0,
|
|
8710
|
-
/* @__PURE__ */ (0,
|
|
8711
|
-
/* @__PURE__ */ (0,
|
|
9679
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.MessageSquare, { className: "w-3.5 h-3.5" }) }),
|
|
9680
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9681
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
|
|
9682
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
8712
9683
|
] })
|
|
8713
9684
|
]
|
|
8714
9685
|
}
|
|
8715
9686
|
),
|
|
8716
|
-
/* @__PURE__ */ (0,
|
|
9687
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8717
9688
|
"button",
|
|
8718
9689
|
{
|
|
8719
9690
|
type: "button",
|
|
8720
9691
|
onClick: () => handleAddButton("URL"),
|
|
8721
9692
|
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",
|
|
8722
9693
|
children: [
|
|
8723
|
-
/* @__PURE__ */ (0,
|
|
8724
|
-
/* @__PURE__ */ (0,
|
|
8725
|
-
/* @__PURE__ */ (0,
|
|
8726
|
-
/* @__PURE__ */ (0,
|
|
9694
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.ExternalLink, { className: "w-3.5 h-3.5" }) }),
|
|
9695
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9696
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
|
|
9697
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
8727
9698
|
] })
|
|
8728
9699
|
]
|
|
8729
9700
|
}
|
|
8730
9701
|
),
|
|
8731
|
-
/* @__PURE__ */ (0,
|
|
9702
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8732
9703
|
"button",
|
|
8733
9704
|
{
|
|
8734
9705
|
type: "button",
|
|
8735
9706
|
onClick: () => handleAddButton("PHONE_NUMBER"),
|
|
8736
9707
|
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",
|
|
8737
9708
|
children: [
|
|
8738
|
-
/* @__PURE__ */ (0,
|
|
8739
|
-
/* @__PURE__ */ (0,
|
|
8740
|
-
/* @__PURE__ */ (0,
|
|
8741
|
-
/* @__PURE__ */ (0,
|
|
9709
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Phone, { className: "w-3.5 h-3.5" }) }),
|
|
9710
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9711
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
|
|
9712
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
8742
9713
|
] })
|
|
8743
9714
|
]
|
|
8744
9715
|
}
|
|
8745
9716
|
),
|
|
8746
|
-
/* @__PURE__ */ (0,
|
|
9717
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8747
9718
|
"button",
|
|
8748
9719
|
{
|
|
8749
9720
|
type: "button",
|
|
8750
9721
|
onClick: () => handleAddButton("COPY_CODE"),
|
|
8751
9722
|
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",
|
|
8752
9723
|
children: [
|
|
8753
|
-
/* @__PURE__ */ (0,
|
|
8754
|
-
/* @__PURE__ */ (0,
|
|
8755
|
-
/* @__PURE__ */ (0,
|
|
8756
|
-
/* @__PURE__ */ (0,
|
|
9724
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Copy, { className: "w-3.5 h-3.5" }) }),
|
|
9725
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
9726
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
|
|
9727
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
8757
9728
|
] })
|
|
8758
9729
|
]
|
|
8759
9730
|
}
|
|
@@ -8762,55 +9733,55 @@ function CreateTemplateModal({
|
|
|
8762
9733
|
] })
|
|
8763
9734
|
] })
|
|
8764
9735
|
] }),
|
|
8765
|
-
buttons.length === 0 && /* @__PURE__ */ (0,
|
|
8766
|
-
buttons.length > 0 && /* @__PURE__ */ (0,
|
|
9736
|
+
buttons.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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.' }),
|
|
9737
|
+
buttons.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
|
|
8767
9738
|
const btnNum = index + 1;
|
|
8768
|
-
return /* @__PURE__ */ (0,
|
|
9739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8769
9740
|
"div",
|
|
8770
9741
|
{
|
|
8771
9742
|
className: "p-3 bg-white border border-slate-200 rounded-xl space-y-2.5 shadow-2xs transition-all hover:border-slate-300",
|
|
8772
9743
|
children: [
|
|
8773
|
-
/* @__PURE__ */ (0,
|
|
8774
|
-
/* @__PURE__ */ (0,
|
|
8775
|
-
/* @__PURE__ */ (0,
|
|
9744
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9745
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9746
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
|
|
8776
9747
|
"#",
|
|
8777
9748
|
btnNum
|
|
8778
9749
|
] }),
|
|
8779
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
8780
|
-
/* @__PURE__ */ (0,
|
|
8781
|
-
/* @__PURE__ */ (0,
|
|
9750
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9751
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.MessageSquare, { className: "w-3 h-3" }),
|
|
9752
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
|
|
8782
9753
|
] }),
|
|
8783
|
-
btn.type === "URL" && /* @__PURE__ */ (0,
|
|
8784
|
-
/* @__PURE__ */ (0,
|
|
8785
|
-
/* @__PURE__ */ (0,
|
|
9754
|
+
btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9755
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.ExternalLink, { className: "w-3 h-3" }),
|
|
9756
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
|
|
8786
9757
|
] }),
|
|
8787
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
8788
|
-
/* @__PURE__ */ (0,
|
|
8789
|
-
/* @__PURE__ */ (0,
|
|
9758
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9759
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Phone, { className: "w-3 h-3" }),
|
|
9760
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
|
|
8790
9761
|
] }),
|
|
8791
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
8792
|
-
/* @__PURE__ */ (0,
|
|
8793
|
-
/* @__PURE__ */ (0,
|
|
9762
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("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: [
|
|
9763
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Copy, { className: "w-3 h-3" }),
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
|
|
8794
9765
|
] })
|
|
8795
9766
|
] }),
|
|
8796
|
-
/* @__PURE__ */ (0,
|
|
9767
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8797
9768
|
"button",
|
|
8798
9769
|
{
|
|
8799
9770
|
type: "button",
|
|
8800
9771
|
onClick: () => handleRemoveButton(index),
|
|
8801
9772
|
className: "p-1 text-slate-400 hover:text-rose-600 hover:bg-rose-50 rounded-lg transition-colors cursor-pointer",
|
|
8802
9773
|
title: "\u05D4\u05E1\u05E8 \u05DB\u05E4\u05EA\u05D5\u05E8",
|
|
8803
|
-
children: /* @__PURE__ */ (0,
|
|
9774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Trash2, { className: "w-3.5 h-3.5" })
|
|
8804
9775
|
}
|
|
8805
9776
|
)
|
|
8806
9777
|
] }),
|
|
8807
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
8808
|
-
/* @__PURE__ */ (0,
|
|
8809
|
-
/* @__PURE__ */ (0,
|
|
9778
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9779
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9780
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8810
9781
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
8811
|
-
/* @__PURE__ */ (0,
|
|
9782
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8812
9783
|
] }),
|
|
8813
|
-
/* @__PURE__ */ (0,
|
|
9784
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8814
9785
|
"span",
|
|
8815
9786
|
{
|
|
8816
9787
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -8821,7 +9792,7 @@ function CreateTemplateModal({
|
|
|
8821
9792
|
}
|
|
8822
9793
|
)
|
|
8823
9794
|
] }),
|
|
8824
|
-
/* @__PURE__ */ (0,
|
|
9795
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8825
9796
|
"input",
|
|
8826
9797
|
{
|
|
8827
9798
|
type: "text",
|
|
@@ -8833,14 +9804,14 @@ function CreateTemplateModal({
|
|
|
8833
9804
|
}
|
|
8834
9805
|
)
|
|
8835
9806
|
] }),
|
|
8836
|
-
btn.type === "URL" && /* @__PURE__ */ (0,
|
|
8837
|
-
/* @__PURE__ */ (0,
|
|
8838
|
-
/* @__PURE__ */ (0,
|
|
8839
|
-
/* @__PURE__ */ (0,
|
|
9807
|
+
btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
9808
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9809
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9810
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8840
9811
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
8841
|
-
/* @__PURE__ */ (0,
|
|
9812
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8842
9813
|
] }),
|
|
8843
|
-
/* @__PURE__ */ (0,
|
|
9814
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8844
9815
|
"span",
|
|
8845
9816
|
{
|
|
8846
9817
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -8851,7 +9822,7 @@ function CreateTemplateModal({
|
|
|
8851
9822
|
}
|
|
8852
9823
|
)
|
|
8853
9824
|
] }),
|
|
8854
|
-
/* @__PURE__ */ (0,
|
|
9825
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8855
9826
|
"input",
|
|
8856
9827
|
{
|
|
8857
9828
|
type: "text",
|
|
@@ -8863,18 +9834,18 @@ function CreateTemplateModal({
|
|
|
8863
9834
|
}
|
|
8864
9835
|
)
|
|
8865
9836
|
] }),
|
|
8866
|
-
/* @__PURE__ */ (0,
|
|
8867
|
-
/* @__PURE__ */ (0,
|
|
8868
|
-
/* @__PURE__ */ (0,
|
|
9837
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9838
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9839
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8869
9840
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL \u05E1\u05D8\u05D8\u05D9\u05EA ",
|
|
8870
|
-
/* @__PURE__ */ (0,
|
|
9841
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8871
9842
|
] }),
|
|
8872
|
-
/* @__PURE__ */ (0,
|
|
9843
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
8873
9844
|
(btn.url || "").length,
|
|
8874
9845
|
"/2000"
|
|
8875
9846
|
] })
|
|
8876
9847
|
] }),
|
|
8877
|
-
/* @__PURE__ */ (0,
|
|
9848
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8878
9849
|
"input",
|
|
8879
9850
|
{
|
|
8880
9851
|
type: "url",
|
|
@@ -8888,14 +9859,14 @@ function CreateTemplateModal({
|
|
|
8888
9859
|
)
|
|
8889
9860
|
] })
|
|
8890
9861
|
] }),
|
|
8891
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
8892
|
-
/* @__PURE__ */ (0,
|
|
8893
|
-
/* @__PURE__ */ (0,
|
|
8894
|
-
/* @__PURE__ */ (0,
|
|
9862
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
9863
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9864
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9865
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8895
9866
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
8896
|
-
/* @__PURE__ */ (0,
|
|
9867
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8897
9868
|
] }),
|
|
8898
|
-
/* @__PURE__ */ (0,
|
|
9869
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8899
9870
|
"span",
|
|
8900
9871
|
{
|
|
8901
9872
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -8906,7 +9877,7 @@ function CreateTemplateModal({
|
|
|
8906
9877
|
}
|
|
8907
9878
|
)
|
|
8908
9879
|
] }),
|
|
8909
|
-
/* @__PURE__ */ (0,
|
|
9880
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8910
9881
|
"input",
|
|
8911
9882
|
{
|
|
8912
9883
|
type: "text",
|
|
@@ -8918,18 +9889,18 @@ function CreateTemplateModal({
|
|
|
8918
9889
|
}
|
|
8919
9890
|
)
|
|
8920
9891
|
] }),
|
|
8921
|
-
/* @__PURE__ */ (0,
|
|
8922
|
-
/* @__PURE__ */ (0,
|
|
8923
|
-
/* @__PURE__ */ (0,
|
|
9892
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9893
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9894
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8924
9895
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF (\u05E4\u05D5\u05E8\u05DE\u05D8: +[\u05E7\u05D9\u05D3\u05D5\u05DE\u05EA][\u05DE\u05E1\u05E4\u05E8]) ",
|
|
8925
|
-
/* @__PURE__ */ (0,
|
|
9896
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8926
9897
|
] }),
|
|
8927
|
-
/* @__PURE__ */ (0,
|
|
9898
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
8928
9899
|
(btn.phone_number || "").length,
|
|
8929
9900
|
"/20"
|
|
8930
9901
|
] })
|
|
8931
9902
|
] }),
|
|
8932
|
-
/* @__PURE__ */ (0,
|
|
9903
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8933
9904
|
"input",
|
|
8934
9905
|
{
|
|
8935
9906
|
type: "tel",
|
|
@@ -8943,14 +9914,14 @@ function CreateTemplateModal({
|
|
|
8943
9914
|
)
|
|
8944
9915
|
] })
|
|
8945
9916
|
] }),
|
|
8946
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
8947
|
-
/* @__PURE__ */ (0,
|
|
8948
|
-
/* @__PURE__ */ (0,
|
|
8949
|
-
/* @__PURE__ */ (0,
|
|
9917
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
9918
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9919
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9920
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
8950
9921
|
"\u05E7\u05D5\u05D3 \u05D4\u05E6\u05E2\u05D4 / \u05E7\u05D5\u05E4\u05D5\u05DF ",
|
|
8951
|
-
/* @__PURE__ */ (0,
|
|
9922
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
8952
9923
|
] }),
|
|
8953
|
-
/* @__PURE__ */ (0,
|
|
9924
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
8954
9925
|
"span",
|
|
8955
9926
|
{
|
|
8956
9927
|
className: `font-mono text-[10px] ${(btn.example || "").length >= 15 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -8961,7 +9932,7 @@ function CreateTemplateModal({
|
|
|
8961
9932
|
}
|
|
8962
9933
|
)
|
|
8963
9934
|
] }),
|
|
8964
|
-
/* @__PURE__ */ (0,
|
|
9935
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8965
9936
|
"input",
|
|
8966
9937
|
{
|
|
8967
9938
|
type: "text",
|
|
@@ -8974,15 +9945,15 @@ function CreateTemplateModal({
|
|
|
8974
9945
|
}
|
|
8975
9946
|
)
|
|
8976
9947
|
] }),
|
|
8977
|
-
/* @__PURE__ */ (0,
|
|
8978
|
-
/* @__PURE__ */ (0,
|
|
8979
|
-
/* @__PURE__ */ (0,
|
|
8980
|
-
/* @__PURE__ */ (0,
|
|
9948
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1", children: [
|
|
9949
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
9950
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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)" }),
|
|
9951
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
8981
9952
|
(btn.text || "").length,
|
|
8982
9953
|
"/25"
|
|
8983
9954
|
] })
|
|
8984
9955
|
] }),
|
|
8985
|
-
/* @__PURE__ */ (0,
|
|
9956
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
8986
9957
|
"input",
|
|
8987
9958
|
{
|
|
8988
9959
|
type: "text",
|
|
@@ -9002,8 +9973,8 @@ function CreateTemplateModal({
|
|
|
9002
9973
|
}) })
|
|
9003
9974
|
] })
|
|
9004
9975
|
] }),
|
|
9005
|
-
/* @__PURE__ */ (0,
|
|
9006
|
-
/* @__PURE__ */ (0,
|
|
9976
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
|
|
9977
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9007
9978
|
"button",
|
|
9008
9979
|
{
|
|
9009
9980
|
type: "button",
|
|
@@ -9013,19 +9984,19 @@ function CreateTemplateModal({
|
|
|
9013
9984
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
9014
9985
|
}
|
|
9015
9986
|
),
|
|
9016
|
-
/* @__PURE__ */ (0,
|
|
9987
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
9017
9988
|
"button",
|
|
9018
9989
|
{
|
|
9019
9990
|
type: "submit",
|
|
9020
9991
|
disabled: !canSubmit,
|
|
9021
9992
|
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"}`,
|
|
9022
9993
|
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",
|
|
9023
|
-
children: isSubmitting ? /* @__PURE__ */ (0,
|
|
9024
|
-
/* @__PURE__ */ (0,
|
|
9025
|
-
/* @__PURE__ */ (0,
|
|
9026
|
-
] }) : /* @__PURE__ */ (0,
|
|
9027
|
-
/* @__PURE__ */ (0,
|
|
9028
|
-
/* @__PURE__ */ (0,
|
|
9994
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
9995
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
9996
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
|
|
9997
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
9998
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react10.CheckCircle2, { className: "w-4 h-4" }),
|
|
9999
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
|
|
9029
10000
|
] })
|
|
9030
10001
|
}
|
|
9031
10002
|
)
|
|
@@ -9039,7 +10010,7 @@ function CreateTemplateModal({
|
|
|
9039
10010
|
}
|
|
9040
10011
|
|
|
9041
10012
|
// src/components/WhatsAppComponent/hooks/useWhatsAppState.ts
|
|
9042
|
-
var
|
|
10013
|
+
var import_react19 = require("react");
|
|
9043
10014
|
|
|
9044
10015
|
// src/components/WhatsAppComponent/utils/recipientEngine.ts
|
|
9045
10016
|
var STORAGE_KEY_TEST_PHONE = "whatsapp_test_phone";
|
|
@@ -9364,7 +10335,7 @@ function matchesColumnFilter(cellValue, filterVal, colName, relationOptions, col
|
|
|
9364
10335
|
}
|
|
9365
10336
|
return true;
|
|
9366
10337
|
}
|
|
9367
|
-
function filterRecordsByColumnAndSearch(records, columnFilters, searchQuery,
|
|
10338
|
+
function filterRecordsByColumnAndSearch(records, columnFilters, searchQuery, tableColumns2, relationOptions) {
|
|
9368
10339
|
let result = records || [];
|
|
9369
10340
|
if (columnFilters && typeof columnFilters === "object") {
|
|
9370
10341
|
const activeEntries = Object.entries(columnFilters).filter(([_, val]) => {
|
|
@@ -9380,7 +10351,7 @@ function filterRecordsByColumnAndSearch(records, columnFilters, searchQuery, tab
|
|
|
9380
10351
|
const rowData = record.data || {};
|
|
9381
10352
|
for (const [colName, filterVal] of activeEntries) {
|
|
9382
10353
|
const cellValue = rowData[colName];
|
|
9383
|
-
const colDef =
|
|
10354
|
+
const colDef = tableColumns2 == null ? void 0 : tableColumns2.find((c) => c.name === colName);
|
|
9384
10355
|
if (!matchesColumnFilter(cellValue, filterVal, colName, relationOptions, colDef)) {
|
|
9385
10356
|
return false;
|
|
9386
10357
|
}
|
|
@@ -9441,9 +10412,9 @@ function isTextableColumn(col) {
|
|
|
9441
10412
|
}
|
|
9442
10413
|
function getTextableColumnOptions(params) {
|
|
9443
10414
|
var _a, _b, _c, _d;
|
|
9444
|
-
const { tableColumns = [], selectedPhoneOption, referencedTableSchemas = {} } = params;
|
|
10415
|
+
const { tableColumns: tableColumns2 = [], selectedPhoneOption, referencedTableSchemas = {} } = params;
|
|
9445
10416
|
const options = [];
|
|
9446
|
-
for (const col of
|
|
10417
|
+
for (const col of tableColumns2) {
|
|
9447
10418
|
if (col.name === "_id" || col.id === "_id") continue;
|
|
9448
10419
|
const colType = String(col.type || "").toUpperCase();
|
|
9449
10420
|
if (colType === "SUB_TABLE" || colType === "SUBTABLE") continue;
|
|
@@ -9461,7 +10432,7 @@ function getTextableColumnOptions(params) {
|
|
|
9461
10432
|
const parentColName = selectedPhoneOption.parentColumnName || "";
|
|
9462
10433
|
const refTableId = selectedPhoneOption.referencedTableId;
|
|
9463
10434
|
const subSchema = refTableId ? referencedTableSchemas[refTableId] : null;
|
|
9464
|
-
const parentCol =
|
|
10435
|
+
const parentCol = tableColumns2.find((c) => c.name === parentColName);
|
|
9465
10436
|
const subtableName = ((_a = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _a.referencedTableName) || (subSchema == null ? void 0 : subSchema.title) || (parentCol == null ? void 0 : parentCol.name) || parentColName || "\u05D8\u05D1\u05DC\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8\u05EA";
|
|
9466
10437
|
const embeddedCols = ((_b = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _b.columns) || ((_d = (_c = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _c.schema) == null ? void 0 : _d.columns);
|
|
9467
10438
|
const cols = (subSchema == null ? void 0 : subSchema.columns) || embeddedCols || [];
|
|
@@ -9719,7 +10690,7 @@ function buildTemplateComponents(params) {
|
|
|
9719
10690
|
variableMapping,
|
|
9720
10691
|
textableColumnOptions,
|
|
9721
10692
|
recordData,
|
|
9722
|
-
tableColumns,
|
|
10693
|
+
tableColumns: tableColumns2,
|
|
9723
10694
|
relationOptions,
|
|
9724
10695
|
templateHeaderComp,
|
|
9725
10696
|
mediaUrl
|
|
@@ -9796,7 +10767,7 @@ function buildTemplateComponents(params) {
|
|
|
9796
10767
|
mapping.value,
|
|
9797
10768
|
textableColumnOptions,
|
|
9798
10769
|
recordData,
|
|
9799
|
-
|
|
10770
|
+
tableColumns2,
|
|
9800
10771
|
relationOptions,
|
|
9801
10772
|
templateLanguage
|
|
9802
10773
|
);
|
|
@@ -9816,7 +10787,7 @@ function buildTemplateComponents(params) {
|
|
|
9816
10787
|
variableMapping,
|
|
9817
10788
|
textableColumnOptions,
|
|
9818
10789
|
recordData,
|
|
9819
|
-
tableColumns,
|
|
10790
|
+
tableColumns: tableColumns2,
|
|
9820
10791
|
relationOptions
|
|
9821
10792
|
});
|
|
9822
10793
|
if (bodyParameters.length > 0) {
|
|
@@ -9834,7 +10805,7 @@ function buildBodyParameters(params) {
|
|
|
9834
10805
|
variableMapping,
|
|
9835
10806
|
textableColumnOptions,
|
|
9836
10807
|
recordData,
|
|
9837
|
-
tableColumns,
|
|
10808
|
+
tableColumns: tableColumns2,
|
|
9838
10809
|
relationOptions
|
|
9839
10810
|
} = params;
|
|
9840
10811
|
const bodyComp = (_a = selectedTemplate.components) == null ? void 0 : _a.find(
|
|
@@ -9867,7 +10838,7 @@ function buildBodyParameters(params) {
|
|
|
9867
10838
|
mapping.value,
|
|
9868
10839
|
textableColumnOptions,
|
|
9869
10840
|
recordData,
|
|
9870
|
-
|
|
10841
|
+
tableColumns2,
|
|
9871
10842
|
relationOptions,
|
|
9872
10843
|
templateLanguage
|
|
9873
10844
|
);
|
|
@@ -9877,7 +10848,7 @@ function buildBodyParameters(params) {
|
|
|
9877
10848
|
};
|
|
9878
10849
|
});
|
|
9879
10850
|
}
|
|
9880
|
-
function resolveColumnValue(columnOptionId, textableColumnOptions, recordData,
|
|
10851
|
+
function resolveColumnValue(columnOptionId, textableColumnOptions, recordData, tableColumns2, relationOptions, templateLanguage) {
|
|
9881
10852
|
const colOption = textableColumnOptions.find((opt) => opt.id === columnOptionId);
|
|
9882
10853
|
if (!colOption) {
|
|
9883
10854
|
const rawValue2 = recordData[columnOptionId];
|
|
@@ -9885,7 +10856,7 @@ function resolveColumnValue(columnOptionId, textableColumnOptions, recordData, t
|
|
|
9885
10856
|
}
|
|
9886
10857
|
const colName = colOption.columnName;
|
|
9887
10858
|
const rawValue = recordData[colName];
|
|
9888
|
-
const colDef = findColumnDef(colOption,
|
|
10859
|
+
const colDef = findColumnDef(colOption, tableColumns2);
|
|
9889
10860
|
const colType = colOption.type || (colDef == null ? void 0 : colDef.type) || "STRING";
|
|
9890
10861
|
const formatOptions = {
|
|
9891
10862
|
columnDef: colDef,
|
|
@@ -9893,13 +10864,13 @@ function resolveColumnValue(columnOptionId, textableColumnOptions, recordData, t
|
|
|
9893
10864
|
};
|
|
9894
10865
|
return formatVariableValue(rawValue, colType, templateLanguage, formatOptions);
|
|
9895
10866
|
}
|
|
9896
|
-
function findColumnDef(colOption,
|
|
10867
|
+
function findColumnDef(colOption, tableColumns2) {
|
|
9897
10868
|
var _a, _b, _c;
|
|
9898
10869
|
if (colOption.source === "MAIN") {
|
|
9899
|
-
return
|
|
10870
|
+
return tableColumns2.find((c) => c.name === colOption.columnName) || null;
|
|
9900
10871
|
}
|
|
9901
10872
|
if (colOption.source === "SUBTABLE" && colOption.parentColumnName) {
|
|
9902
|
-
const parentCol =
|
|
10873
|
+
const parentCol = tableColumns2.find((c) => c.name === colOption.parentColumnName);
|
|
9903
10874
|
if (parentCol) {
|
|
9904
10875
|
const embeddedCols = ((_a = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _a.columns) || ((_c = (_b = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _b.schema) == null ? void 0 : _c.columns) || [];
|
|
9905
10876
|
return embeddedCols.find((c) => c.name === colOption.columnName) || null;
|
|
@@ -10063,7 +11034,7 @@ async function sendTestMessage(params) {
|
|
|
10063
11034
|
variableMapping,
|
|
10064
11035
|
textableColumnOptions,
|
|
10065
11036
|
recordData,
|
|
10066
|
-
tableColumns,
|
|
11037
|
+
tableColumns: tableColumns2,
|
|
10067
11038
|
relationOptions,
|
|
10068
11039
|
templateHeaderComp,
|
|
10069
11040
|
mediaUrl,
|
|
@@ -10076,7 +11047,7 @@ async function sendTestMessage(params) {
|
|
|
10076
11047
|
variableMapping,
|
|
10077
11048
|
textableColumnOptions,
|
|
10078
11049
|
recordData,
|
|
10079
|
-
tableColumns,
|
|
11050
|
+
tableColumns: tableColumns2,
|
|
10080
11051
|
relationOptions,
|
|
10081
11052
|
templateHeaderComp,
|
|
10082
11053
|
mediaUrl
|
|
@@ -10097,7 +11068,7 @@ async function sendBulkWhatsAppMessages(params) {
|
|
|
10097
11068
|
selectedTemplate,
|
|
10098
11069
|
variableMapping,
|
|
10099
11070
|
textableColumnOptions,
|
|
10100
|
-
tableColumns,
|
|
11071
|
+
tableColumns: tableColumns2,
|
|
10101
11072
|
relationOptions,
|
|
10102
11073
|
templateHeaderComp,
|
|
10103
11074
|
mediaUrl,
|
|
@@ -10137,7 +11108,7 @@ async function sendBulkWhatsAppMessages(params) {
|
|
|
10137
11108
|
variableMapping,
|
|
10138
11109
|
textableColumnOptions,
|
|
10139
11110
|
recordData: recipient.recordData,
|
|
10140
|
-
tableColumns,
|
|
11111
|
+
tableColumns: tableColumns2,
|
|
10141
11112
|
relationOptions,
|
|
10142
11113
|
templateHeaderComp: templateHeaderComp || null,
|
|
10143
11114
|
mediaUrl
|
|
@@ -10344,29 +11315,29 @@ function useWhatsAppState(props) {
|
|
|
10344
11315
|
data: injectedData
|
|
10345
11316
|
} = props;
|
|
10346
11317
|
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);
|
|
10347
|
-
const [
|
|
11318
|
+
const [tableColumns2, setTableColumns] = (0, import_react19.useState)(() => {
|
|
10348
11319
|
return Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
10349
11320
|
});
|
|
10350
|
-
const [rawRecords, setRawRecords] = (0,
|
|
11321
|
+
const [rawRecords, setRawRecords] = (0, import_react19.useState)(() => {
|
|
10351
11322
|
if (Array.isArray(injectedData)) return injectedData;
|
|
10352
11323
|
if (Array.isArray(injectedData == null ? void 0 : injectedData.records)) return injectedData.records;
|
|
10353
11324
|
return [];
|
|
10354
11325
|
});
|
|
10355
|
-
const [relationOptions, setRelationOptions] = (0,
|
|
11326
|
+
const [relationOptions, setRelationOptions] = (0, import_react19.useState)(() => {
|
|
10356
11327
|
return (injectedData == null ? void 0 : injectedData.relationOptions) || {};
|
|
10357
11328
|
});
|
|
10358
|
-
const [isLoadingTableData, setIsLoadingTableData] = (0,
|
|
10359
|
-
const [activeSubtableScans, setActiveSubtableScans] = (0,
|
|
10360
|
-
const [tableError, setTableError] = (0,
|
|
10361
|
-
const [filters, setFilters] = (0,
|
|
10362
|
-
const [selectedRowIds, setSelectedRowIds] = (0,
|
|
10363
|
-
const [autoSelectCount, setAutoSelectCount] = (0,
|
|
10364
|
-
const isAutoSelectingRef = (0,
|
|
10365
|
-
const isManualOverrideRef = (0,
|
|
10366
|
-
const prevAutoSelectCountRef = (0,
|
|
10367
|
-
const fetchedTableIdsRef = (0,
|
|
10368
|
-
const fullyFetchedRelationKeysRef = (0,
|
|
10369
|
-
const loadTableData = (0,
|
|
11329
|
+
const [isLoadingTableData, setIsLoadingTableData] = (0, import_react19.useState)(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
|
|
11330
|
+
const [activeSubtableScans, setActiveSubtableScans] = (0, import_react19.useState)(0);
|
|
11331
|
+
const [tableError, setTableError] = (0, import_react19.useState)(null);
|
|
11332
|
+
const [filters, setFilters] = (0, import_react19.useState)({});
|
|
11333
|
+
const [selectedRowIds, setSelectedRowIds] = (0, import_react19.useState)([]);
|
|
11334
|
+
const [autoSelectCount, setAutoSelectCount] = (0, import_react19.useState)(null);
|
|
11335
|
+
const isAutoSelectingRef = (0, import_react19.useRef)(false);
|
|
11336
|
+
const isManualOverrideRef = (0, import_react19.useRef)(false);
|
|
11337
|
+
const prevAutoSelectCountRef = (0, import_react19.useRef)(null);
|
|
11338
|
+
const fetchedTableIdsRef = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
11339
|
+
const fullyFetchedRelationKeysRef = (0, import_react19.useRef)(/* @__PURE__ */ new Set());
|
|
11340
|
+
const loadTableData = (0, import_react19.useCallback)(async () => {
|
|
10370
11341
|
var _a2;
|
|
10371
11342
|
const tableId = (settings == null ? void 0 : settings.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableId);
|
|
10372
11343
|
if (!tableId || !executeAction) return;
|
|
@@ -10433,26 +11404,26 @@ function useWhatsAppState(props) {
|
|
|
10433
11404
|
executeAction,
|
|
10434
11405
|
orgId
|
|
10435
11406
|
]);
|
|
10436
|
-
(0,
|
|
11407
|
+
(0, import_react19.useEffect)(() => {
|
|
10437
11408
|
loadTableData();
|
|
10438
11409
|
}, [loadTableData]);
|
|
10439
|
-
const filterableColumns = (0,
|
|
10440
|
-
return (
|
|
11410
|
+
const filterableColumns = (0, import_react19.useMemo)(() => {
|
|
11411
|
+
return (tableColumns2 || []).filter((col) => {
|
|
10441
11412
|
var _a2;
|
|
10442
11413
|
if (!col || col.name === "_id" || col.id === "_id") return false;
|
|
10443
11414
|
const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
|
|
10444
11415
|
return type === "RELATION" || type === "BOOLEAN";
|
|
10445
11416
|
});
|
|
10446
|
-
}, [
|
|
10447
|
-
const [referencedTableSchemas, setReferencedTableSchemas] = (0,
|
|
10448
|
-
const subtableCols = (0,
|
|
10449
|
-
return (
|
|
11417
|
+
}, [tableColumns2]);
|
|
11418
|
+
const [referencedTableSchemas, setReferencedTableSchemas] = (0, import_react19.useState)({});
|
|
11419
|
+
const subtableCols = (0, import_react19.useMemo)(() => {
|
|
11420
|
+
return (tableColumns2 || []).filter((col) => {
|
|
10450
11421
|
var _a2;
|
|
10451
11422
|
const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
|
|
10452
11423
|
return type === "RELATION" || type === "SUB_TABLE" || type === "SUBTABLE";
|
|
10453
11424
|
});
|
|
10454
|
-
}, [
|
|
10455
|
-
(0,
|
|
11425
|
+
}, [tableColumns2]);
|
|
11426
|
+
(0, import_react19.useEffect)(() => {
|
|
10456
11427
|
if (!executeAction) return;
|
|
10457
11428
|
const unrequestedCols = subtableCols.filter((col) => {
|
|
10458
11429
|
var _a2;
|
|
@@ -10496,22 +11467,22 @@ function useWhatsAppState(props) {
|
|
|
10496
11467
|
});
|
|
10497
11468
|
}, [subtableCols, executeAction, orgId]);
|
|
10498
11469
|
const isScanningPhoneColumns = Boolean(
|
|
10499
|
-
isLoadingTableData || activeSubtableScans > 0 ||
|
|
11470
|
+
isLoadingTableData || activeSubtableScans > 0 || tableColumns2.length === 0 && Boolean(settings == null ? void 0 : settings.tableMetaId)
|
|
10500
11471
|
);
|
|
10501
|
-
const targetPhoneOptions = (0,
|
|
10502
|
-
const cols =
|
|
11472
|
+
const targetPhoneOptions = (0, import_react19.useMemo)(() => {
|
|
11473
|
+
const cols = tableColumns2 && tableColumns2.length > 0 ? tableColumns2 : Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
10503
11474
|
return scanTargetPhoneOptions(cols, referencedTableSchemas);
|
|
10504
|
-
}, [
|
|
10505
|
-
const phoneColumns = (0,
|
|
11475
|
+
}, [tableColumns2, settings == null ? void 0 : settings.columns, referencedTableSchemas]);
|
|
11476
|
+
const phoneColumns = (0, import_react19.useMemo)(() => {
|
|
10506
11477
|
return targetPhoneOptions.map((opt) => ({ name: opt.label, id: opt.id, type: "PHONE" }));
|
|
10507
11478
|
}, [targetPhoneOptions]);
|
|
10508
|
-
const [phoneColumnId, setPhoneColumnId] = (0,
|
|
10509
|
-
const [subtableFilterColumn, setSubtableFilterColumn] = (0,
|
|
10510
|
-
const [subtableFilterValue, setSubtableFilterValue] = (0,
|
|
10511
|
-
const [subtableSendLimit, setSubtableSendLimit] = (0,
|
|
11479
|
+
const [phoneColumnId, setPhoneColumnId] = (0, import_react19.useState)("");
|
|
11480
|
+
const [subtableFilterColumn, setSubtableFilterColumn] = (0, import_react19.useState)("");
|
|
11481
|
+
const [subtableFilterValue, setSubtableFilterValue] = (0, import_react19.useState)("");
|
|
11482
|
+
const [subtableSendLimit, setSubtableSendLimit] = (0, import_react19.useState)(
|
|
10512
11483
|
(settings == null ? void 0 : settings.subtableSendLimit) || "PRIMARY"
|
|
10513
11484
|
);
|
|
10514
|
-
(0,
|
|
11485
|
+
(0, import_react19.useEffect)(() => {
|
|
10515
11486
|
if (targetPhoneOptions.length > 0) {
|
|
10516
11487
|
const isValid = targetPhoneOptions.some(
|
|
10517
11488
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
@@ -10523,20 +11494,20 @@ function useWhatsAppState(props) {
|
|
|
10523
11494
|
setPhoneColumnId("");
|
|
10524
11495
|
}
|
|
10525
11496
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
10526
|
-
const selectedPhoneOption = (0,
|
|
11497
|
+
const selectedPhoneOption = (0, import_react19.useMemo)(() => {
|
|
10527
11498
|
if (!phoneColumnId) return targetPhoneOptions[0] || null;
|
|
10528
11499
|
return targetPhoneOptions.find(
|
|
10529
11500
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
10530
11501
|
) || targetPhoneOptions[0] || null;
|
|
10531
11502
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
10532
|
-
const subtableFilterableColumns = (0,
|
|
11503
|
+
const subtableFilterableColumns = (0, import_react19.useMemo)(() => {
|
|
10533
11504
|
var _a2, _b2, _c;
|
|
10534
11505
|
if (!selectedPhoneOption || selectedPhoneOption.type !== "SUBTABLE") {
|
|
10535
11506
|
return [];
|
|
10536
11507
|
}
|
|
10537
11508
|
const refTableId = selectedPhoneOption.referencedTableId;
|
|
10538
11509
|
const subSchema = refTableId ? referencedTableSchemas[refTableId] : null;
|
|
10539
|
-
const parentCol = (
|
|
11510
|
+
const parentCol = (tableColumns2 || []).find(
|
|
10540
11511
|
(c) => c.name === selectedPhoneOption.parentColumnName
|
|
10541
11512
|
);
|
|
10542
11513
|
const embeddedCols = ((_a2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _a2.columns) || ((_c = (_b2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _b2.schema) == null ? void 0 : _c.columns);
|
|
@@ -10547,18 +11518,18 @@ function useWhatsAppState(props) {
|
|
|
10547
11518
|
const type = (_a3 = c.type) == null ? void 0 : _a3.toUpperCase();
|
|
10548
11519
|
return type === "BOOLEAN" || type === "RELATION";
|
|
10549
11520
|
});
|
|
10550
|
-
}, [selectedPhoneOption, referencedTableSchemas,
|
|
10551
|
-
const selectedSubtableFilterCol = (0,
|
|
11521
|
+
}, [selectedPhoneOption, referencedTableSchemas, tableColumns2]);
|
|
11522
|
+
const selectedSubtableFilterCol = (0, import_react19.useMemo)(() => {
|
|
10552
11523
|
return subtableFilterableColumns.find((c) => c.name === subtableFilterColumn);
|
|
10553
11524
|
}, [subtableFilterableColumns, subtableFilterColumn]);
|
|
10554
|
-
const [enablePostSendAction, setEnablePostSendAction] = (0,
|
|
10555
|
-
const [postSendActionColumn, setPostSendActionColumn] = (0,
|
|
10556
|
-
const [postSendActionValue, setPostSendActionValue] = (0,
|
|
10557
|
-
const [postSendActionTargetType, setPostSendActionTargetType] = (0,
|
|
10558
|
-
const postSendActionTargetOptions = (0,
|
|
11525
|
+
const [enablePostSendAction, setEnablePostSendAction] = (0, import_react19.useState)(false);
|
|
11526
|
+
const [postSendActionColumn, setPostSendActionColumn] = (0, import_react19.useState)("");
|
|
11527
|
+
const [postSendActionValue, setPostSendActionValue] = (0, import_react19.useState)("");
|
|
11528
|
+
const [postSendActionTargetType, setPostSendActionTargetType] = (0, import_react19.useState)("MAIN");
|
|
11529
|
+
const postSendActionTargetOptions = (0, import_react19.useMemo)(() => {
|
|
10559
11530
|
var _a2, _b2, _c;
|
|
10560
11531
|
const options = [];
|
|
10561
|
-
(
|
|
11532
|
+
(tableColumns2 || []).forEach((col) => {
|
|
10562
11533
|
var _a3;
|
|
10563
11534
|
if (!col || col.name === "_id" || col.id === "_id") return;
|
|
10564
11535
|
const type = (_a3 = col.type) == null ? void 0 : _a3.toUpperCase();
|
|
@@ -10577,7 +11548,7 @@ function useWhatsAppState(props) {
|
|
|
10577
11548
|
const parentColName = selectedPhoneOption.parentColumnName || "";
|
|
10578
11549
|
const refTableId = selectedPhoneOption.referencedTableId;
|
|
10579
11550
|
const subSchema = refTableId ? referencedTableSchemas[refTableId] : null;
|
|
10580
|
-
const parentCol = (
|
|
11551
|
+
const parentCol = (tableColumns2 || []).find((c) => c.name === parentColName);
|
|
10581
11552
|
const embeddedCols = ((_a2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _a2.columns) || ((_c = (_b2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _b2.schema) == null ? void 0 : _c.columns);
|
|
10582
11553
|
const cols = (subSchema == null ? void 0 : subSchema.columns) || embeddedCols || [];
|
|
10583
11554
|
cols.forEach((subCol) => {
|
|
@@ -10599,15 +11570,15 @@ function useWhatsAppState(props) {
|
|
|
10599
11570
|
});
|
|
10600
11571
|
}
|
|
10601
11572
|
return options;
|
|
10602
|
-
}, [
|
|
10603
|
-
const selectedPostSendOption = (0,
|
|
11573
|
+
}, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
|
|
11574
|
+
const selectedPostSendOption = (0, import_react19.useMemo)(() => {
|
|
10604
11575
|
return postSendActionTargetOptions.find(
|
|
10605
11576
|
(opt) => opt.id === postSendActionColumn || opt.columnName === postSendActionColumn
|
|
10606
11577
|
);
|
|
10607
11578
|
}, [postSendActionTargetOptions, postSendActionColumn]);
|
|
10608
11579
|
const selectedPostSendCol = selectedPostSendOption;
|
|
10609
|
-
const [isTestPromptOpen, setIsTestPromptOpen] = (0,
|
|
10610
|
-
const [testPhoneNumber, setTestPhoneNumber] = (0,
|
|
11580
|
+
const [isTestPromptOpen, setIsTestPromptOpen] = (0, import_react19.useState)(false);
|
|
11581
|
+
const [testPhoneNumber, setTestPhoneNumber] = (0, import_react19.useState)(() => {
|
|
10611
11582
|
if (typeof window !== "undefined") {
|
|
10612
11583
|
try {
|
|
10613
11584
|
return localStorage.getItem(STORAGE_KEY_TEST_PHONE) || "";
|
|
@@ -10617,10 +11588,10 @@ function useWhatsAppState(props) {
|
|
|
10617
11588
|
}
|
|
10618
11589
|
return "";
|
|
10619
11590
|
});
|
|
10620
|
-
const [testFeedback, setTestFeedback] = (0,
|
|
10621
|
-
const [isSendingTest, setIsSendingTest] = (0,
|
|
10622
|
-
const [isSendingBroadcast, setIsSendingBroadcast] = (0,
|
|
10623
|
-
const [broadcastProgress, setBroadcastProgress] = (0,
|
|
11591
|
+
const [testFeedback, setTestFeedback] = (0, import_react19.useState)(null);
|
|
11592
|
+
const [isSendingTest, setIsSendingTest] = (0, import_react19.useState)(false);
|
|
11593
|
+
const [isSendingBroadcast, setIsSendingBroadcast] = (0, import_react19.useState)(false);
|
|
11594
|
+
const [broadcastProgress, setBroadcastProgress] = (0, import_react19.useState)({
|
|
10624
11595
|
current: 0,
|
|
10625
11596
|
total: 0,
|
|
10626
11597
|
successful: 0,
|
|
@@ -10628,12 +11599,12 @@ function useWhatsAppState(props) {
|
|
|
10628
11599
|
skipped: 0,
|
|
10629
11600
|
percent: 0
|
|
10630
11601
|
});
|
|
10631
|
-
const [broadcastSummary, setBroadcastSummary] = (0,
|
|
10632
|
-
const [rowStatusMap, setRowStatusMap] = (0,
|
|
10633
|
-
const clearBroadcastSummary = (0,
|
|
11602
|
+
const [broadcastSummary, setBroadcastSummary] = (0, import_react19.useState)(null);
|
|
11603
|
+
const [rowStatusMap, setRowStatusMap] = (0, import_react19.useState)({});
|
|
11604
|
+
const clearBroadcastSummary = (0, import_react19.useCallback)(() => {
|
|
10634
11605
|
setBroadcastSummary(null);
|
|
10635
11606
|
}, []);
|
|
10636
|
-
const handleTestPhoneChange = (0,
|
|
11607
|
+
const handleTestPhoneChange = (0, import_react19.useCallback)((val) => {
|
|
10637
11608
|
setTestPhoneNumber(val);
|
|
10638
11609
|
if (typeof window !== "undefined") {
|
|
10639
11610
|
try {
|
|
@@ -10643,7 +11614,7 @@ function useWhatsAppState(props) {
|
|
|
10643
11614
|
}
|
|
10644
11615
|
}
|
|
10645
11616
|
}, []);
|
|
10646
|
-
const getRelationOptionsForCol = (0,
|
|
11617
|
+
const getRelationOptionsForCol = (0, import_react19.useCallback)(
|
|
10647
11618
|
(colName, parentColName) => {
|
|
10648
11619
|
var _a2, _b2, _c, _d;
|
|
10649
11620
|
if (parentColName) {
|
|
@@ -10672,7 +11643,7 @@ function useWhatsAppState(props) {
|
|
|
10672
11643
|
return relationOptions[postSendRefId];
|
|
10673
11644
|
}
|
|
10674
11645
|
}
|
|
10675
|
-
const mainCol = (
|
|
11646
|
+
const mainCol = (tableColumns2 || []).find((c) => c.name === colName);
|
|
10676
11647
|
const mainRefId = ((_c = mainCol == null ? void 0 : mainCol.config) == null ? void 0 : _c.referencedTableId) || (mainCol == null ? void 0 : mainCol.referencedTableId);
|
|
10677
11648
|
if (mainRefId && relationOptions[mainRefId] && relationOptions[mainRefId].length > 0) {
|
|
10678
11649
|
return relationOptions[mainRefId];
|
|
@@ -10684,13 +11655,13 @@ function useWhatsAppState(props) {
|
|
|
10684
11655
|
}
|
|
10685
11656
|
return [];
|
|
10686
11657
|
},
|
|
10687
|
-
[relationOptions, subtableFilterableColumns, postSendActionTargetOptions,
|
|
11658
|
+
[relationOptions, subtableFilterableColumns, postSendActionTargetOptions, tableColumns2, filterableColumns]
|
|
10688
11659
|
);
|
|
10689
|
-
(0,
|
|
11660
|
+
(0, import_react19.useEffect)(() => {
|
|
10690
11661
|
var _a2, _b2, _c, _d, _e;
|
|
10691
11662
|
if (!executeAction) return;
|
|
10692
11663
|
const targets = [];
|
|
10693
|
-
(
|
|
11664
|
+
(tableColumns2 || []).forEach((col) => {
|
|
10694
11665
|
var _a3, _b3, _c2;
|
|
10695
11666
|
if (((_a3 = col.type) == null ? void 0 : _a3.toUpperCase()) === "RELATION") {
|
|
10696
11667
|
const refId = ((_b3 = col.config) == null ? void 0 : _b3.referencedTableId) || col.referencedTableId;
|
|
@@ -10715,7 +11686,7 @@ function useWhatsAppState(props) {
|
|
|
10715
11686
|
const parentColName = selectedPhoneOption.parentColumnName || "";
|
|
10716
11687
|
const refTableId = selectedPhoneOption.referencedTableId;
|
|
10717
11688
|
const subSchema = refTableId ? referencedTableSchemas[refTableId] : null;
|
|
10718
|
-
const parentCol = (
|
|
11689
|
+
const parentCol = (tableColumns2 || []).find((c) => c.name === parentColName);
|
|
10719
11690
|
const embeddedCols = ((_a2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _a2.columns) || ((_c = (_b2 = parentCol == null ? void 0 : parentCol.config) == null ? void 0 : _b2.schema) == null ? void 0 : _c.columns);
|
|
10720
11691
|
const cols = (subSchema == null ? void 0 : subSchema.columns) || embeddedCols || [];
|
|
10721
11692
|
cols.forEach((subCol) => {
|
|
@@ -10779,8 +11750,8 @@ function useWhatsAppState(props) {
|
|
|
10779
11750
|
console.warn(`[useWhatsAppState] Failed to fetch relation options for ${target.key}:`, err);
|
|
10780
11751
|
}
|
|
10781
11752
|
});
|
|
10782
|
-
}, [filterableColumns, selectedPhoneOption, referencedTableSchemas,
|
|
10783
|
-
(0,
|
|
11753
|
+
}, [filterableColumns, selectedPhoneOption, referencedTableSchemas, tableColumns2, executeAction, selectedPostSendOption, orgId]);
|
|
11754
|
+
(0, import_react19.useEffect)(() => {
|
|
10784
11755
|
var _a2, _b2, _c;
|
|
10785
11756
|
if (!executeAction || !selectedSubtableFilterCol) return;
|
|
10786
11757
|
if (((_a2 = selectedSubtableFilterCol.type) == null ? void 0 : _a2.toUpperCase()) !== "RELATION") return;
|
|
@@ -10831,7 +11802,7 @@ function useWhatsAppState(props) {
|
|
|
10831
11802
|
}
|
|
10832
11803
|
})();
|
|
10833
11804
|
}, [selectedSubtableFilterCol, selectedPhoneOption, executeAction, orgId]);
|
|
10834
|
-
(0,
|
|
11805
|
+
(0, import_react19.useEffect)(() => {
|
|
10835
11806
|
var _a2, _b2;
|
|
10836
11807
|
if (!executeAction || !selectedPostSendOption) return;
|
|
10837
11808
|
if (selectedPostSendOption.type !== "RELATION") return;
|
|
@@ -10884,7 +11855,7 @@ function useWhatsAppState(props) {
|
|
|
10884
11855
|
}
|
|
10885
11856
|
})();
|
|
10886
11857
|
}, [selectedPostSendOption, executeAction, orgId]);
|
|
10887
|
-
const filteredRecords = (0,
|
|
11858
|
+
const filteredRecords = (0, import_react19.useMemo)(() => {
|
|
10888
11859
|
const activeEntries = Object.entries(filters).filter(
|
|
10889
11860
|
([_, val]) => val !== void 0 && val !== null && val !== ""
|
|
10890
11861
|
);
|
|
@@ -10916,7 +11887,7 @@ function useWhatsAppState(props) {
|
|
|
10916
11887
|
});
|
|
10917
11888
|
}, [rawRecords, filters, filterableColumns]);
|
|
10918
11889
|
const filteredData = filteredRecords;
|
|
10919
|
-
(0,
|
|
11890
|
+
(0, import_react19.useEffect)(() => {
|
|
10920
11891
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
10921
11892
|
isAutoSelectingRef.current = true;
|
|
10922
11893
|
const sliced = filteredData.slice(0, autoSelectCount);
|
|
@@ -10934,7 +11905,7 @@ function useWhatsAppState(props) {
|
|
|
10934
11905
|
isManualOverrideRef.current = false;
|
|
10935
11906
|
prevAutoSelectCountRef.current = autoSelectCount;
|
|
10936
11907
|
}, [autoSelectCount, filteredData]);
|
|
10937
|
-
const embeddedTableExecuteAction = (0,
|
|
11908
|
+
const embeddedTableExecuteAction = (0, import_react19.useCallback)(async (actionType, payload) => {
|
|
10938
11909
|
if (actionType === "FETCH_TABLE_DATA") {
|
|
10939
11910
|
const colFilters = (payload == null ? void 0 : payload.columnFilters) || (payload == null ? void 0 : payload.filters);
|
|
10940
11911
|
const searchQuery = payload == null ? void 0 : payload.search;
|
|
@@ -10942,11 +11913,11 @@ function useWhatsAppState(props) {
|
|
|
10942
11913
|
filteredRecords,
|
|
10943
11914
|
colFilters,
|
|
10944
11915
|
searchQuery,
|
|
10945
|
-
|
|
11916
|
+
tableColumns2,
|
|
10946
11917
|
relationOptions
|
|
10947
11918
|
);
|
|
10948
11919
|
return {
|
|
10949
|
-
schema: { columns:
|
|
11920
|
+
schema: { columns: tableColumns2 },
|
|
10950
11921
|
records: recordsToReturn,
|
|
10951
11922
|
meta: {
|
|
10952
11923
|
totalRecords: recordsToReturn.length,
|
|
@@ -10968,7 +11939,7 @@ function useWhatsAppState(props) {
|
|
|
10968
11939
|
return executeAction(actionType, payload);
|
|
10969
11940
|
}
|
|
10970
11941
|
return null;
|
|
10971
|
-
}, [
|
|
11942
|
+
}, [tableColumns2, filteredRecords, relationOptions, executeAction]);
|
|
10972
11943
|
const handleFilterChange = (colName, val) => {
|
|
10973
11944
|
setFilters((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
10974
11945
|
[colName]: val
|
|
@@ -10977,10 +11948,10 @@ function useWhatsAppState(props) {
|
|
|
10977
11948
|
const handleClearFilters = () => {
|
|
10978
11949
|
setFilters({});
|
|
10979
11950
|
};
|
|
10980
|
-
const activeFiltersCount = (0,
|
|
11951
|
+
const activeFiltersCount = (0, import_react19.useMemo)(() => {
|
|
10981
11952
|
return Object.values(filters).filter((v) => v !== "").length;
|
|
10982
11953
|
}, [filters]);
|
|
10983
|
-
const handleSelectionChange = (0,
|
|
11954
|
+
const handleSelectionChange = (0, import_react19.useCallback)((selectedIds) => {
|
|
10984
11955
|
setSelectedRowIds((prev) => {
|
|
10985
11956
|
if (prev.length === selectedIds.length && prev.every((id, idx) => id === selectedIds[idx])) {
|
|
10986
11957
|
return prev;
|
|
@@ -10994,13 +11965,13 @@ function useWhatsAppState(props) {
|
|
|
10994
11965
|
return selectedIds;
|
|
10995
11966
|
});
|
|
10996
11967
|
}, [autoSelectCount]);
|
|
10997
|
-
const handleRowToggle = (0,
|
|
11968
|
+
const handleRowToggle = (0, import_react19.useCallback)((rowId, checked) => {
|
|
10998
11969
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
10999
11970
|
isManualOverrideRef.current = true;
|
|
11000
11971
|
setAutoSelectCount(null);
|
|
11001
11972
|
}
|
|
11002
11973
|
}, [autoSelectCount]);
|
|
11003
|
-
const toggleRowSelection = (0,
|
|
11974
|
+
const toggleRowSelection = (0, import_react19.useCallback)((rowId, checked) => {
|
|
11004
11975
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
11005
11976
|
isManualOverrideRef.current = true;
|
|
11006
11977
|
setAutoSelectCount(null);
|
|
@@ -11016,15 +11987,15 @@ function useWhatsAppState(props) {
|
|
|
11016
11987
|
return prev;
|
|
11017
11988
|
});
|
|
11018
11989
|
}, [autoSelectCount]);
|
|
11019
|
-
const [templates, setTemplates] = (0,
|
|
11020
|
-
const [selectedTemplateId, setSelectedTemplateId] = (0,
|
|
11021
|
-
const [isLoading, setIsLoading] = (0,
|
|
11022
|
-
const [fetchError, setFetchError] = (0,
|
|
11023
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
11024
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0,
|
|
11025
|
-
const [isDeleting, setIsDeleting] = (0,
|
|
11026
|
-
const [feedback, setFeedback] = (0,
|
|
11027
|
-
const loadTemplates = (0,
|
|
11990
|
+
const [templates, setTemplates] = (0, import_react19.useState)([]);
|
|
11991
|
+
const [selectedTemplateId, setSelectedTemplateId] = (0, import_react19.useState)(null);
|
|
11992
|
+
const [isLoading, setIsLoading] = (0, import_react19.useState)(true);
|
|
11993
|
+
const [fetchError, setFetchError] = (0, import_react19.useState)(null);
|
|
11994
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react19.useState)(false);
|
|
11995
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react19.useState)(false);
|
|
11996
|
+
const [isDeleting, setIsDeleting] = (0, import_react19.useState)(false);
|
|
11997
|
+
const [feedback, setFeedback] = (0, import_react19.useState)(null);
|
|
11998
|
+
const loadTemplates = (0, import_react19.useCallback)(async () => {
|
|
11028
11999
|
var _a2, _b2;
|
|
11029
12000
|
if (!executeAction) {
|
|
11030
12001
|
setIsLoading(false);
|
|
@@ -11076,13 +12047,13 @@ function useWhatsAppState(props) {
|
|
|
11076
12047
|
setIsLoading(false);
|
|
11077
12048
|
}
|
|
11078
12049
|
}, [executeAction, orgId]);
|
|
11079
|
-
(0,
|
|
12050
|
+
(0, import_react19.useEffect)(() => {
|
|
11080
12051
|
loadTemplates();
|
|
11081
12052
|
}, [loadTemplates]);
|
|
11082
|
-
const selectedTemplate = (0,
|
|
12053
|
+
const selectedTemplate = (0, import_react19.useMemo)(() => {
|
|
11083
12054
|
return templates.find((t) => t.id === selectedTemplateId) || null;
|
|
11084
12055
|
}, [templates, selectedTemplateId]);
|
|
11085
|
-
const templateBodyText = (0,
|
|
12056
|
+
const templateBodyText = (0, import_react19.useMemo)(() => {
|
|
11086
12057
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return "";
|
|
11087
12058
|
const bodyComp = selectedTemplate.components.find(
|
|
11088
12059
|
(c) => {
|
|
@@ -11092,7 +12063,7 @@ function useWhatsAppState(props) {
|
|
|
11092
12063
|
);
|
|
11093
12064
|
return (bodyComp == null ? void 0 : bodyComp.text) || "";
|
|
11094
12065
|
}, [selectedTemplate]);
|
|
11095
|
-
const templateHeaderComp = (0,
|
|
12066
|
+
const templateHeaderComp = (0, import_react19.useMemo)(() => {
|
|
11096
12067
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return null;
|
|
11097
12068
|
return selectedTemplate.components.find(
|
|
11098
12069
|
(c) => {
|
|
@@ -11101,8 +12072,8 @@ function useWhatsAppState(props) {
|
|
|
11101
12072
|
}
|
|
11102
12073
|
) || null;
|
|
11103
12074
|
}, [selectedTemplate]);
|
|
11104
|
-
const [headerMediaUrl, setHeaderMediaUrl] = (0,
|
|
11105
|
-
(0,
|
|
12075
|
+
const [headerMediaUrl, setHeaderMediaUrl] = (0, import_react19.useState)("");
|
|
12076
|
+
(0, import_react19.useEffect)(() => {
|
|
11106
12077
|
if (!templateHeaderComp) {
|
|
11107
12078
|
setHeaderMediaUrl("");
|
|
11108
12079
|
return;
|
|
@@ -11119,7 +12090,7 @@ function useWhatsAppState(props) {
|
|
|
11119
12090
|
setHeaderMediaUrl("");
|
|
11120
12091
|
}
|
|
11121
12092
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
11122
|
-
const handleHeaderMediaUrlChange = (0,
|
|
12093
|
+
const handleHeaderMediaUrlChange = (0, import_react19.useCallback)(
|
|
11123
12094
|
(newUrl) => {
|
|
11124
12095
|
setHeaderMediaUrl(newUrl);
|
|
11125
12096
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
@@ -11138,7 +12109,7 @@ function useWhatsAppState(props) {
|
|
|
11138
12109
|
},
|
|
11139
12110
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
11140
12111
|
);
|
|
11141
|
-
const handleResetHeaderMediaUrl = (0,
|
|
12112
|
+
const handleResetHeaderMediaUrl = (0, import_react19.useCallback)(() => {
|
|
11142
12113
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
11143
12114
|
try {
|
|
11144
12115
|
localStorage.removeItem(`whatsapp_template_media_${selectedTemplate.name}`);
|
|
@@ -11152,8 +12123,8 @@ function useWhatsAppState(props) {
|
|
|
11152
12123
|
);
|
|
11153
12124
|
setHeaderMediaUrl(defaultUrl || "");
|
|
11154
12125
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
11155
|
-
const [isUploadingMedia, setIsUploadingMedia] = (0,
|
|
11156
|
-
const handleFileUpload = (0,
|
|
12126
|
+
const [isUploadingMedia, setIsUploadingMedia] = (0, import_react19.useState)(false);
|
|
12127
|
+
const handleFileUpload = (0, import_react19.useCallback)(
|
|
11157
12128
|
async (file, templateName) => {
|
|
11158
12129
|
const tplName = templateName || (selectedTemplate == null ? void 0 : selectedTemplate.name) || "";
|
|
11159
12130
|
if (!file) return;
|
|
@@ -11194,20 +12165,20 @@ function useWhatsAppState(props) {
|
|
|
11194
12165
|
},
|
|
11195
12166
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
11196
12167
|
);
|
|
11197
|
-
const templateVariables = (0,
|
|
12168
|
+
const templateVariables = (0, import_react19.useMemo)(() => {
|
|
11198
12169
|
return extractTemplateVariables(selectedTemplate);
|
|
11199
12170
|
}, [selectedTemplate]);
|
|
11200
|
-
const [variableMapping, setVariableMapping] = (0,
|
|
11201
|
-
(0,
|
|
12171
|
+
const [variableMapping, setVariableMapping] = (0, import_react19.useState)({});
|
|
12172
|
+
(0, import_react19.useEffect)(() => {
|
|
11202
12173
|
setVariableMapping({});
|
|
11203
12174
|
}, [selectedTemplateId]);
|
|
11204
|
-
const textableColumnOptions = (0,
|
|
12175
|
+
const textableColumnOptions = (0, import_react19.useMemo)(() => {
|
|
11205
12176
|
return getTextableColumnOptions({
|
|
11206
|
-
tableColumns,
|
|
12177
|
+
tableColumns: tableColumns2,
|
|
11207
12178
|
selectedPhoneOption,
|
|
11208
12179
|
referencedTableSchemas
|
|
11209
12180
|
});
|
|
11210
|
-
}, [
|
|
12181
|
+
}, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
|
|
11211
12182
|
const handleVariableTypeChange = (varKey, newType) => {
|
|
11212
12183
|
setVariableMapping((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
11213
12184
|
[varKey]: {
|
|
@@ -11227,7 +12198,7 @@ function useWhatsAppState(props) {
|
|
|
11227
12198
|
});
|
|
11228
12199
|
});
|
|
11229
12200
|
};
|
|
11230
|
-
const existingTemplateNames = (0,
|
|
12201
|
+
const existingTemplateNames = (0, import_react19.useMemo)(() => {
|
|
11231
12202
|
return templates.map((t) => t.name);
|
|
11232
12203
|
}, [templates]);
|
|
11233
12204
|
const handleDeleteTemplate = async () => {
|
|
@@ -11274,14 +12245,14 @@ function useWhatsAppState(props) {
|
|
|
11274
12245
|
postSendActionColumn,
|
|
11275
12246
|
postSendActionValue
|
|
11276
12247
|
);
|
|
11277
|
-
const isStaticVariableMissing = (0,
|
|
12248
|
+
const isStaticVariableMissing = (0, import_react19.useMemo)(() => {
|
|
11278
12249
|
return isStaticVariableIncomplete(templateVariables, variableMapping);
|
|
11279
12250
|
}, [templateVariables, variableMapping]);
|
|
11280
|
-
const currentRecords = (0,
|
|
12251
|
+
const currentRecords = (0, import_react19.useMemo)(() => {
|
|
11281
12252
|
var _a2;
|
|
11282
12253
|
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 : [];
|
|
11283
12254
|
}, [rawRecords, props.data]);
|
|
11284
|
-
const preparedRecipients = (0,
|
|
12255
|
+
const preparedRecipients = (0, import_react19.useMemo)(() => {
|
|
11285
12256
|
return prepareRecipients({
|
|
11286
12257
|
selectedIds: selectedRowIds,
|
|
11287
12258
|
records: currentRecords,
|
|
@@ -11301,7 +12272,7 @@ function useWhatsAppState(props) {
|
|
|
11301
12272
|
selectedSubtableFilterCol
|
|
11302
12273
|
]);
|
|
11303
12274
|
const finalRecipientCount = preparedRecipients.length;
|
|
11304
|
-
const validMainRowsCount = (0,
|
|
12275
|
+
const validMainRowsCount = (0, import_react19.useMemo)(() => {
|
|
11305
12276
|
const rowIdSet = new Set(
|
|
11306
12277
|
preparedRecipients.map((r) => r.mainRowId).filter(Boolean)
|
|
11307
12278
|
);
|
|
@@ -11387,7 +12358,7 @@ function useWhatsAppState(props) {
|
|
|
11387
12358
|
variableMapping,
|
|
11388
12359
|
textableColumnOptions,
|
|
11389
12360
|
recordData: testRecordData,
|
|
11390
|
-
tableColumns,
|
|
12361
|
+
tableColumns: tableColumns2,
|
|
11391
12362
|
relationOptions,
|
|
11392
12363
|
templateHeaderComp,
|
|
11393
12364
|
mediaUrl: headerMediaUrl || void 0,
|
|
@@ -11410,7 +12381,7 @@ function useWhatsAppState(props) {
|
|
|
11410
12381
|
setIsSendingTest(false);
|
|
11411
12382
|
}
|
|
11412
12383
|
};
|
|
11413
|
-
const handleSendMessages = (0,
|
|
12384
|
+
const handleSendMessages = (0, import_react19.useCallback)(async () => {
|
|
11414
12385
|
var _a2, _b2;
|
|
11415
12386
|
if (isSendDisabled || isSendingBroadcast) return;
|
|
11416
12387
|
const recipients = preparedRecipients;
|
|
@@ -11468,7 +12439,7 @@ function useWhatsAppState(props) {
|
|
|
11468
12439
|
selectedTemplate,
|
|
11469
12440
|
variableMapping,
|
|
11470
12441
|
textableColumnOptions,
|
|
11471
|
-
tableColumns,
|
|
12442
|
+
tableColumns: tableColumns2,
|
|
11472
12443
|
relationOptions,
|
|
11473
12444
|
templateHeaderComp,
|
|
11474
12445
|
mediaUrl: headerMediaUrl || void 0,
|
|
@@ -11589,7 +12560,7 @@ function useWhatsAppState(props) {
|
|
|
11589
12560
|
selectedTemplate,
|
|
11590
12561
|
variableMapping,
|
|
11591
12562
|
textableColumnOptions,
|
|
11592
|
-
|
|
12563
|
+
tableColumns2,
|
|
11593
12564
|
relationOptions,
|
|
11594
12565
|
templateHeaderComp,
|
|
11595
12566
|
headerMediaUrl,
|
|
@@ -11605,7 +12576,7 @@ function useWhatsAppState(props) {
|
|
|
11605
12576
|
return {
|
|
11606
12577
|
orgId,
|
|
11607
12578
|
// Table & data
|
|
11608
|
-
tableColumns,
|
|
12579
|
+
tableColumns: tableColumns2,
|
|
11609
12580
|
rawRecords,
|
|
11610
12581
|
relationOptions,
|
|
11611
12582
|
isLoadingTableData,
|
|
@@ -11716,9 +12687,9 @@ function useWhatsAppState(props) {
|
|
|
11716
12687
|
}
|
|
11717
12688
|
|
|
11718
12689
|
// src/components/WhatsAppComponent/ui/TemplateSelectionBlock.tsx
|
|
11719
|
-
var
|
|
12690
|
+
var import_react20 = require("react");
|
|
11720
12691
|
var import_lucide_react11 = require("lucide-react");
|
|
11721
|
-
var
|
|
12692
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
11722
12693
|
function TemplateSelectionBlock({
|
|
11723
12694
|
selectedTemplate,
|
|
11724
12695
|
selectedTemplateId,
|
|
@@ -11744,16 +12715,16 @@ function TemplateSelectionBlock({
|
|
|
11744
12715
|
isUploadingMedia = false,
|
|
11745
12716
|
handleFileUpload
|
|
11746
12717
|
}) {
|
|
11747
|
-
const fileInputRef = (0,
|
|
11748
|
-
return /* @__PURE__ */ (0,
|
|
11749
|
-
/* @__PURE__ */ (0,
|
|
11750
|
-
/* @__PURE__ */ (0,
|
|
11751
|
-
/* @__PURE__ */ (0,
|
|
11752
|
-
/* @__PURE__ */ (0,
|
|
11753
|
-
/* @__PURE__ */ (0,
|
|
12718
|
+
const fileInputRef = (0, import_react20.useRef)(null);
|
|
12719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12720
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1.5 shrink-0", children: [
|
|
12721
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
|
|
12722
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
12723
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
|
|
12724
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" })
|
|
11754
12725
|
] }),
|
|
11755
|
-
/* @__PURE__ */ (0,
|
|
11756
|
-
/* @__PURE__ */ (0,
|
|
12726
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
12727
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
11757
12728
|
"button",
|
|
11758
12729
|
{
|
|
11759
12730
|
type: "button",
|
|
@@ -11762,12 +12733,12 @@ function TemplateSelectionBlock({
|
|
|
11762
12733
|
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"}`,
|
|
11763
12734
|
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}"`,
|
|
11764
12735
|
children: [
|
|
11765
|
-
isDeleting ? /* @__PURE__ */ (0,
|
|
11766
|
-
/* @__PURE__ */ (0,
|
|
12736
|
+
isDeleting ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Trash2, { className: "w-3.5 h-3.5 text-rose-500" }),
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
|
|
11767
12738
|
]
|
|
11768
12739
|
}
|
|
11769
12740
|
),
|
|
11770
|
-
/* @__PURE__ */ (0,
|
|
12741
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
11771
12742
|
"button",
|
|
11772
12743
|
{
|
|
11773
12744
|
type: "button",
|
|
@@ -11775,40 +12746,40 @@ function TemplateSelectionBlock({
|
|
|
11775
12746
|
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",
|
|
11776
12747
|
title: "\u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4",
|
|
11777
12748
|
children: [
|
|
11778
|
-
/* @__PURE__ */ (0,
|
|
11779
|
-
/* @__PURE__ */ (0,
|
|
12749
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
|
|
12750
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u05D7\u05D3\u05E9" })
|
|
11780
12751
|
]
|
|
11781
12752
|
}
|
|
11782
12753
|
)
|
|
11783
12754
|
] })
|
|
11784
12755
|
] }),
|
|
11785
|
-
/* @__PURE__ */ (0,
|
|
11786
|
-
/* @__PURE__ */ (0,
|
|
12756
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative", children: [
|
|
12757
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
11787
12758
|
"button",
|
|
11788
12759
|
{
|
|
11789
12760
|
type: "button",
|
|
11790
12761
|
onClick: () => setIsDropdownOpen((prev) => !prev),
|
|
11791
12762
|
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",
|
|
11792
12763
|
children: [
|
|
11793
|
-
selectedTemplate ? /* @__PURE__ */ (0,
|
|
11794
|
-
/* @__PURE__ */ (0,
|
|
12764
|
+
selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
12765
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11795
12766
|
"span",
|
|
11796
12767
|
{
|
|
11797
12768
|
className: `w-2 h-2 rounded-full shrink-0 ${getStatusConfig(selectedTemplate.status).dotColor}`
|
|
11798
12769
|
}
|
|
11799
12770
|
),
|
|
11800
|
-
/* @__PURE__ */ (0,
|
|
11801
|
-
/* @__PURE__ */ (0,
|
|
12771
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
|
|
12772
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
|
|
11802
12773
|
"(",
|
|
11803
12774
|
selectedTemplate.category,
|
|
11804
12775
|
" \u2022 ",
|
|
11805
12776
|
selectedTemplate.language,
|
|
11806
12777
|
")"
|
|
11807
12778
|
] })
|
|
11808
|
-
] }) : /* @__PURE__ */ (0,
|
|
11809
|
-
/* @__PURE__ */ (0,
|
|
11810
|
-
isLoadingTemplates && /* @__PURE__ */ (0,
|
|
11811
|
-
/* @__PURE__ */ (0,
|
|
12779
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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..." }),
|
|
12780
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
|
|
12781
|
+
isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
|
|
12782
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11812
12783
|
import_lucide_react11.ChevronDown,
|
|
11813
12784
|
{
|
|
11814
12785
|
className: `w-3.5 h-3.5 text-slate-400 transition-transform ${isDropdownOpen ? "rotate-180" : ""}`
|
|
@@ -11818,21 +12789,21 @@ function TemplateSelectionBlock({
|
|
|
11818
12789
|
]
|
|
11819
12790
|
}
|
|
11820
12791
|
),
|
|
11821
|
-
isDropdownOpen && /* @__PURE__ */ (0,
|
|
11822
|
-
/* @__PURE__ */ (0,
|
|
12792
|
+
isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12793
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11823
12794
|
"div",
|
|
11824
12795
|
{
|
|
11825
12796
|
className: "fixed inset-0 z-40",
|
|
11826
12797
|
onClick: () => setIsDropdownOpen(false)
|
|
11827
12798
|
}
|
|
11828
12799
|
),
|
|
11829
|
-
/* @__PURE__ */ (0,
|
|
11830
|
-
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0,
|
|
12800
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12801
|
+
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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".' }),
|
|
11831
12802
|
templates.map((tpl) => {
|
|
11832
12803
|
const statusConfig = getStatusConfig(tpl.status);
|
|
11833
12804
|
const isSelected = tpl.id === selectedTemplateId;
|
|
11834
12805
|
const canSelect = statusConfig.isSelectable;
|
|
11835
|
-
return /* @__PURE__ */ (0,
|
|
12806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
11836
12807
|
"div",
|
|
11837
12808
|
{
|
|
11838
12809
|
onClick: () => {
|
|
@@ -11845,29 +12816,29 @@ function TemplateSelectionBlock({
|
|
|
11845
12816
|
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" : ""}`,
|
|
11846
12817
|
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,
|
|
11847
12818
|
children: [
|
|
11848
|
-
/* @__PURE__ */ (0,
|
|
11849
|
-
/* @__PURE__ */ (0,
|
|
12819
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
12820
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11850
12821
|
"span",
|
|
11851
12822
|
{
|
|
11852
12823
|
className: `w-2 h-2 rounded-full shrink-0 ${statusConfig.dotColor}`
|
|
11853
12824
|
}
|
|
11854
12825
|
),
|
|
11855
|
-
/* @__PURE__ */ (0,
|
|
11856
|
-
/* @__PURE__ */ (0,
|
|
12826
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "overflow-hidden", children: [
|
|
12827
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11857
12828
|
"p",
|
|
11858
12829
|
{
|
|
11859
12830
|
className: `text-xs font-semibold truncate ${isSelected ? "text-emerald-700" : canSelect ? "text-slate-800" : "text-slate-500"}`,
|
|
11860
12831
|
children: tpl.name
|
|
11861
12832
|
}
|
|
11862
12833
|
),
|
|
11863
|
-
/* @__PURE__ */ (0,
|
|
12834
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "text-[10px] text-slate-400", children: [
|
|
11864
12835
|
tpl.category,
|
|
11865
12836
|
" \u2022 ",
|
|
11866
12837
|
tpl.language
|
|
11867
12838
|
] })
|
|
11868
12839
|
] })
|
|
11869
12840
|
] }),
|
|
11870
|
-
/* @__PURE__ */ (0,
|
|
12841
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11871
12842
|
"span",
|
|
11872
12843
|
{
|
|
11873
12844
|
className: `text-[9px] font-semibold px-2 py-0.5 rounded-full border shrink-0 ${statusConfig.badgeBg} ${statusConfig.badgeText}`,
|
|
@@ -11883,18 +12854,18 @@ function TemplateSelectionBlock({
|
|
|
11883
12854
|
] })
|
|
11884
12855
|
] })
|
|
11885
12856
|
] }),
|
|
11886
|
-
/* @__PURE__ */ (0,
|
|
11887
|
-
/* @__PURE__ */ (0,
|
|
11888
|
-
/* @__PURE__ */ (0,
|
|
11889
|
-
selectedTemplate && /* @__PURE__ */ (0,
|
|
12857
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
|
|
12858
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
|
|
12859
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
|
|
12860
|
+
selectedTemplate && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-[10px] text-slate-400", children: [
|
|
11890
12861
|
"(",
|
|
11891
12862
|
templateBodyText.length,
|
|
11892
12863
|
" \u05EA\u05D5\u05D5\u05D9\u05DD)"
|
|
11893
12864
|
] })
|
|
11894
12865
|
] }),
|
|
11895
|
-
selectedTemplate ? /* @__PURE__ */ (0,
|
|
11896
|
-
/* @__PURE__ */ (0,
|
|
11897
|
-
/* @__PURE__ */ (0,
|
|
12866
|
+
selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12867
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
|
|
12868
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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"' })
|
|
11898
12869
|
] }),
|
|
11899
12870
|
selectedTemplate && (() => {
|
|
11900
12871
|
var _a;
|
|
@@ -11903,19 +12874,19 @@ function TemplateSelectionBlock({
|
|
|
11903
12874
|
);
|
|
11904
12875
|
const tplButtons = (buttonsComp == null ? void 0 : buttonsComp.buttons) || [];
|
|
11905
12876
|
if (!tplButtons || tplButtons.length === 0) return null;
|
|
11906
|
-
return /* @__PURE__ */ (0,
|
|
12877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
|
|
11907
12878
|
const btnType = (btn.type || "").toUpperCase();
|
|
11908
12879
|
const btnText = btn.text || (btnType === "COPY_CODE" ? `\u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3: ${btn.example}` : "\u05DB\u05E4\u05EA\u05D5\u05E8");
|
|
11909
|
-
return /* @__PURE__ */ (0,
|
|
12880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
11910
12881
|
"div",
|
|
11911
12882
|
{
|
|
11912
12883
|
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",
|
|
11913
12884
|
children: [
|
|
11914
|
-
btnType === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
11915
|
-
btnType === "URL" && /* @__PURE__ */ (0,
|
|
11916
|
-
btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
11917
|
-
btnType === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
11918
|
-
/* @__PURE__ */ (0,
|
|
12885
|
+
btnType === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.MessageSquare, { className: "w-3 h-3 text-emerald-600" }),
|
|
12886
|
+
btnType === "URL" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.ExternalLink, { className: "w-3 h-3 text-sky-600" }),
|
|
12887
|
+
btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Phone, { className: "w-3 h-3 text-violet-600" }),
|
|
12888
|
+
btnType === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Copy, { className: "w-3 h-3 text-amber-600" }),
|
|
12889
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate max-w-[180px]", children: btnText })
|
|
11919
12890
|
]
|
|
11920
12891
|
},
|
|
11921
12892
|
idx
|
|
@@ -11930,9 +12901,9 @@ function TemplateSelectionBlock({
|
|
|
11930
12901
|
const docFilename = resolveDocumentFilename(templateHeaderComp, headerMediaUrl);
|
|
11931
12902
|
const hasValidMedia = Boolean(headerMediaUrl && headerMediaUrl.trim() && headerMediaUrl.startsWith("http"));
|
|
11932
12903
|
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";
|
|
11933
|
-
return /* @__PURE__ */ (0,
|
|
11934
|
-
/* @__PURE__ */ (0,
|
|
11935
|
-
/* @__PURE__ */ (0,
|
|
12904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12905
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12906
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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__ */ (0, import_jsx_runtime17.jsx)(
|
|
11936
12907
|
"img",
|
|
11937
12908
|
{
|
|
11938
12909
|
src: headerMediaUrl,
|
|
@@ -11942,33 +12913,33 @@ function TemplateSelectionBlock({
|
|
|
11942
12913
|
e.currentTarget.style.display = "none";
|
|
11943
12914
|
}
|
|
11944
12915
|
}
|
|
11945
|
-
) : /* @__PURE__ */ (0,
|
|
11946
|
-
/* @__PURE__ */ (0,
|
|
11947
|
-
/* @__PURE__ */ (0,
|
|
11948
|
-
/* @__PURE__ */ (0,
|
|
12916
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Image, { className: "w-4 h-4 text-amber-600" }) }),
|
|
12917
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "overflow-hidden", children: [
|
|
12918
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
12919
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" })
|
|
11949
12920
|
] })
|
|
11950
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0,
|
|
11951
|
-
/* @__PURE__ */ (0,
|
|
11952
|
-
/* @__PURE__ */ (0,
|
|
11953
|
-
/* @__PURE__ */ (0,
|
|
11954
|
-
/* @__PURE__ */ (0,
|
|
12921
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12922
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4" }) }),
|
|
12923
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "overflow-hidden", children: [
|
|
12924
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
12925
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" })
|
|
11955
12926
|
] })
|
|
11956
|
-
] }) : /* @__PURE__ */ (0,
|
|
11957
|
-
/* @__PURE__ */ (0,
|
|
11958
|
-
/* @__PURE__ */ (0,
|
|
11959
|
-
/* @__PURE__ */ (0,
|
|
11960
|
-
/* @__PURE__ */ (0,
|
|
12927
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12928
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Video, { className: "w-4 h-4" }) }),
|
|
12929
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "overflow-hidden", children: [
|
|
12930
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
12931
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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" })
|
|
11961
12932
|
] })
|
|
11962
12933
|
] }) }),
|
|
11963
|
-
/* @__PURE__ */ (0,
|
|
11964
|
-
hasValidMedia ? /* @__PURE__ */ (0,
|
|
11965
|
-
/* @__PURE__ */ (0,
|
|
12934
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
12935
|
+
hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12936
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.CheckCircle2, { className: "w-3 h-3 text-emerald-600" }),
|
|
11966
12937
|
"\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF"
|
|
11967
|
-
] }) : /* @__PURE__ */ (0,
|
|
11968
|
-
/* @__PURE__ */ (0,
|
|
12938
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
12939
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.AlertCircle, { className: "w-3 h-3 text-amber-600 shrink-0" }),
|
|
11969
12940
|
"\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5"
|
|
11970
12941
|
] }),
|
|
11971
|
-
hasValidMedia && /* @__PURE__ */ (0,
|
|
12942
|
+
hasValidMedia && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11972
12943
|
"a",
|
|
11973
12944
|
{
|
|
11974
12945
|
href: headerMediaUrl,
|
|
@@ -11976,10 +12947,10 @@ function TemplateSelectionBlock({
|
|
|
11976
12947
|
rel: "noopener noreferrer",
|
|
11977
12948
|
title: "\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E9\u05DC \u05D4\u05E7\u05D5\u05D1\u05E5",
|
|
11978
12949
|
className: "p-1 text-slate-400 hover:text-emerald-700 hover:bg-slate-200/60 rounded-md transition-colors",
|
|
11979
|
-
children: /* @__PURE__ */ (0,
|
|
12950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.ExternalLink, { className: "w-3.5 h-3.5" })
|
|
11980
12951
|
}
|
|
11981
12952
|
),
|
|
11982
|
-
/* @__PURE__ */ (0,
|
|
12953
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
11983
12954
|
"input",
|
|
11984
12955
|
{
|
|
11985
12956
|
ref: fileInputRef,
|
|
@@ -11997,7 +12968,7 @@ function TemplateSelectionBlock({
|
|
|
11997
12968
|
disabled: isUploadingMedia
|
|
11998
12969
|
}
|
|
11999
12970
|
),
|
|
12000
|
-
/* @__PURE__ */ (0,
|
|
12971
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
12001
12972
|
"button",
|
|
12002
12973
|
{
|
|
12003
12974
|
type: "button",
|
|
@@ -12008,39 +12979,39 @@ function TemplateSelectionBlock({
|
|
|
12008
12979
|
},
|
|
12009
12980
|
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"}`,
|
|
12010
12981
|
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`,
|
|
12011
|
-
children: isUploadingMedia ? /* @__PURE__ */ (0,
|
|
12012
|
-
/* @__PURE__ */ (0,
|
|
12013
|
-
/* @__PURE__ */ (0,
|
|
12014
|
-
] }) : /* @__PURE__ */ (0,
|
|
12015
|
-
/* @__PURE__ */ (0,
|
|
12016
|
-
/* @__PURE__ */ (0,
|
|
12982
|
+
children: isUploadingMedia ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12983
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
12984
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
|
|
12985
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
12986
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.Upload, { className: "w-3.5 h-3.5" }),
|
|
12987
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
|
|
12017
12988
|
] })
|
|
12018
12989
|
}
|
|
12019
12990
|
)
|
|
12020
12991
|
] })
|
|
12021
12992
|
] });
|
|
12022
12993
|
})(),
|
|
12023
|
-
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0,
|
|
12024
|
-
/* @__PURE__ */ (0,
|
|
12025
|
-
/* @__PURE__ */ (0,
|
|
12026
|
-
/* @__PURE__ */ (0,
|
|
12994
|
+
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
|
|
12995
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between shrink-0", children: [
|
|
12996
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
|
|
12997
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200", children: [
|
|
12027
12998
|
templateVariables.length,
|
|
12028
12999
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
12029
13000
|
] })
|
|
12030
13001
|
] }),
|
|
12031
|
-
/* @__PURE__ */ (0,
|
|
13002
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
|
|
12032
13003
|
var _a;
|
|
12033
13004
|
const mapping = variableMapping[varKey] || { type: "column", value: "" };
|
|
12034
13005
|
const isStatic = mapping.type === "static";
|
|
12035
13006
|
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 || "";
|
|
12036
|
-
return /* @__PURE__ */ (0,
|
|
13007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
12037
13008
|
"div",
|
|
12038
13009
|
{
|
|
12039
13010
|
className: "flex items-center gap-1.5 p-1 bg-white border border-slate-200 rounded-xl text-xs shrink-0",
|
|
12040
13011
|
children: [
|
|
12041
|
-
/* @__PURE__ */ (0,
|
|
12042
|
-
/* @__PURE__ */ (0,
|
|
12043
|
-
/* @__PURE__ */ (0,
|
|
13012
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("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}}}` }),
|
|
13013
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
|
|
13014
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
12044
13015
|
"button",
|
|
12045
13016
|
{
|
|
12046
13017
|
type: "button",
|
|
@@ -12049,7 +13020,7 @@ function TemplateSelectionBlock({
|
|
|
12049
13020
|
children: "\u05E2\u05DE\u05D5\u05D3\u05D4"
|
|
12050
13021
|
}
|
|
12051
13022
|
),
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
13023
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
12053
13024
|
"button",
|
|
12054
13025
|
{
|
|
12055
13026
|
type: "button",
|
|
@@ -12059,7 +13030,7 @@ function TemplateSelectionBlock({
|
|
|
12059
13030
|
}
|
|
12060
13031
|
)
|
|
12061
13032
|
] }),
|
|
12062
|
-
isStatic ? /* @__PURE__ */ (0,
|
|
13033
|
+
isStatic ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
12063
13034
|
"input",
|
|
12064
13035
|
{
|
|
12065
13036
|
type: "text",
|
|
@@ -12068,20 +13039,20 @@ function TemplateSelectionBlock({
|
|
|
12068
13039
|
placeholder: "\u05D4\u05D6\u05DF \u05E2\u05E8\u05DA \u05E7\u05D1\u05D5\u05E2 (\u05D7\u05D5\u05D1\u05D4)...",
|
|
12069
13040
|
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"}`
|
|
12070
13041
|
}
|
|
12071
|
-
) : /* @__PURE__ */ (0,
|
|
12072
|
-
/* @__PURE__ */ (0,
|
|
13042
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative flex-1 min-w-0", children: [
|
|
13043
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
12073
13044
|
"select",
|
|
12074
13045
|
{
|
|
12075
13046
|
value: selectedColVal,
|
|
12076
13047
|
onChange: (e) => handleVariableValueChange(varKey, e.target.value),
|
|
12077
13048
|
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",
|
|
12078
13049
|
children: [
|
|
12079
|
-
/* @__PURE__ */ (0,
|
|
12080
|
-
textableColumnOptions.map((opt) => /* @__PURE__ */ (0,
|
|
13050
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
13051
|
+
textableColumnOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
|
|
12081
13052
|
]
|
|
12082
13053
|
}
|
|
12083
13054
|
),
|
|
12084
|
-
/* @__PURE__ */ (0,
|
|
13055
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react11.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12085
13056
|
] })
|
|
12086
13057
|
]
|
|
12087
13058
|
},
|
|
@@ -12095,7 +13066,7 @@ function TemplateSelectionBlock({
|
|
|
12095
13066
|
|
|
12096
13067
|
// src/components/WhatsAppComponent/ui/DynamicFiltersBlock.tsx
|
|
12097
13068
|
var import_lucide_react12 = require("lucide-react");
|
|
12098
|
-
var
|
|
13069
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
12099
13070
|
function DynamicFiltersBlock({
|
|
12100
13071
|
filterableColumns,
|
|
12101
13072
|
filters,
|
|
@@ -12110,31 +13081,31 @@ function DynamicFiltersBlock({
|
|
|
12110
13081
|
loadTableData,
|
|
12111
13082
|
isLoadingTableData
|
|
12112
13083
|
}) {
|
|
12113
|
-
return /* @__PURE__ */ (0,
|
|
12114
|
-
/* @__PURE__ */ (0,
|
|
12115
|
-
/* @__PURE__ */ (0,
|
|
12116
|
-
/* @__PURE__ */ (0,
|
|
12117
|
-
/* @__PURE__ */ (0,
|
|
12118
|
-
/* @__PURE__ */ (0,
|
|
12119
|
-
activeFiltersCount > 0 && /* @__PURE__ */ (0,
|
|
13084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("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: [
|
|
13085
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", children: [
|
|
13086
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
13087
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13088
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react12.Filter, { className: "w-4 h-4 text-emerald-600" }),
|
|
13089
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
|
|
13090
|
+
activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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 })
|
|
12120
13091
|
] }),
|
|
12121
|
-
activeFiltersCount > 0 && /* @__PURE__ */ (0,
|
|
13092
|
+
activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
12122
13093
|
"button",
|
|
12123
13094
|
{
|
|
12124
13095
|
type: "button",
|
|
12125
13096
|
onClick: handleClearFilters,
|
|
12126
13097
|
className: "text-[11px] text-rose-600 hover:text-rose-700 font-semibold hover:underline flex items-center gap-1 cursor-pointer",
|
|
12127
13098
|
children: [
|
|
12128
|
-
/* @__PURE__ */ (0,
|
|
12129
|
-
/* @__PURE__ */ (0,
|
|
13099
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react12.X, { className: "w-3 h-3" }),
|
|
13100
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u05E0\u05E7\u05D4" })
|
|
12130
13101
|
]
|
|
12131
13102
|
}
|
|
12132
13103
|
)
|
|
12133
13104
|
] }),
|
|
12134
|
-
/* @__PURE__ */ (0,
|
|
12135
|
-
/* @__PURE__ */ (0,
|
|
12136
|
-
/* @__PURE__ */ (0,
|
|
12137
|
-
] }) : /* @__PURE__ */ (0,
|
|
13105
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
|
|
13106
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
|
|
13107
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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" })
|
|
13108
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
|
|
12138
13109
|
var _a, _b, _c;
|
|
12139
13110
|
const colType = (_a = col.type) == null ? void 0 : _a.toUpperCase();
|
|
12140
13111
|
const isBoolean = colType === "BOOLEAN";
|
|
@@ -12142,9 +13113,9 @@ function DynamicFiltersBlock({
|
|
|
12142
13113
|
const isActive = Boolean(currentValue);
|
|
12143
13114
|
const refTableId = ((_b = col == null ? void 0 : col.config) == null ? void 0 : _b.referencedTableId) || (col == null ? void 0 : col.referencedTableId);
|
|
12144
13115
|
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] : [];
|
|
12145
|
-
return /* @__PURE__ */ (0,
|
|
12146
|
-
/* @__PURE__ */ (0,
|
|
12147
|
-
/* @__PURE__ */ (0,
|
|
13116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-1", children: [
|
|
13117
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13118
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
12148
13119
|
"label",
|
|
12149
13120
|
{
|
|
12150
13121
|
className: "text-[11px] font-semibold text-slate-700 truncate max-w-[130px]",
|
|
@@ -12152,49 +13123,49 @@ function DynamicFiltersBlock({
|
|
|
12152
13123
|
children: col.name
|
|
12153
13124
|
}
|
|
12154
13125
|
),
|
|
12155
|
-
/* @__PURE__ */ (0,
|
|
13126
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
|
|
12156
13127
|
] }),
|
|
12157
|
-
/* @__PURE__ */ (0,
|
|
12158
|
-
/* @__PURE__ */ (0,
|
|
13128
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative", children: [
|
|
13129
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
12159
13130
|
"select",
|
|
12160
13131
|
{
|
|
12161
13132
|
value: currentValue,
|
|
12162
13133
|
onChange: (e) => handleFilterChange(col.name, e.target.value),
|
|
12163
13134
|
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"}`,
|
|
12164
13135
|
children: [
|
|
12165
|
-
/* @__PURE__ */ (0,
|
|
12166
|
-
isBoolean ? /* @__PURE__ */ (0,
|
|
12167
|
-
/* @__PURE__ */ (0,
|
|
12168
|
-
/* @__PURE__ */ (0,
|
|
12169
|
-
] }) : options.map((opt) => /* @__PURE__ */ (0,
|
|
13136
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
13137
|
+
isBoolean ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
13138
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "true", children: "\u05DB\u05DF" }),
|
|
13139
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "false", children: "\u05DC\u05D0" })
|
|
13140
|
+
] }) : options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
|
|
12170
13141
|
]
|
|
12171
13142
|
}
|
|
12172
13143
|
),
|
|
12173
|
-
/* @__PURE__ */ (0,
|
|
13144
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react12.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12174
13145
|
] })
|
|
12175
13146
|
] }, col.name);
|
|
12176
13147
|
}) }) })
|
|
12177
13148
|
] }),
|
|
12178
|
-
/* @__PURE__ */ (0,
|
|
12179
|
-
/* @__PURE__ */ (0,
|
|
13149
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "pt-2.5 mt-2 border-t border-slate-200/80 flex items-center justify-between gap-1.5 shrink-0", children: [
|
|
13150
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
12180
13151
|
"div",
|
|
12181
13152
|
{
|
|
12182
13153
|
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"}`,
|
|
12183
13154
|
children: [
|
|
12184
|
-
/* @__PURE__ */ (0,
|
|
13155
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
12185
13156
|
import_lucide_react12.CheckSquare,
|
|
12186
13157
|
{
|
|
12187
13158
|
className: `w-3 h-3 ${selectedRowIds.length > 0 ? "text-emerald-600" : "text-slate-400"}`
|
|
12188
13159
|
}
|
|
12189
13160
|
),
|
|
12190
|
-
/* @__PURE__ */ (0,
|
|
13161
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
12191
13162
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
12192
13163
|
selectedRowIds.length
|
|
12193
13164
|
] })
|
|
12194
13165
|
]
|
|
12195
13166
|
}
|
|
12196
13167
|
),
|
|
12197
|
-
/* @__PURE__ */ (0,
|
|
13168
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
12198
13169
|
"button",
|
|
12199
13170
|
{
|
|
12200
13171
|
type: "button",
|
|
@@ -12202,7 +13173,7 @@ function DynamicFiltersBlock({
|
|
|
12202
13173
|
disabled: isLoadingTableData,
|
|
12203
13174
|
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",
|
|
12204
13175
|
title: "\u05E8\u05E2\u05E0\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9 \u05D8\u05D1\u05DC\u05D4",
|
|
12205
|
-
children: /* @__PURE__ */ (0,
|
|
13176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
12206
13177
|
import_lucide_react12.RefreshCw,
|
|
12207
13178
|
{
|
|
12208
13179
|
className: `w-3.5 h-3.5 ${isLoadingTableData ? "animate-spin text-emerald-600" : ""}`
|
|
@@ -12216,7 +13187,7 @@ function DynamicFiltersBlock({
|
|
|
12216
13187
|
|
|
12217
13188
|
// src/components/WhatsAppComponent/ui/SettingsAndActionsBlock.tsx
|
|
12218
13189
|
var import_lucide_react13 = require("lucide-react");
|
|
12219
|
-
var
|
|
13190
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
12220
13191
|
function SettingsAndActionsBlock({
|
|
12221
13192
|
isScanningPhoneColumns,
|
|
12222
13193
|
targetPhoneOptions,
|
|
@@ -12259,29 +13230,29 @@ function SettingsAndActionsBlock({
|
|
|
12259
13230
|
clearBroadcastSummary
|
|
12260
13231
|
}) {
|
|
12261
13232
|
var _a;
|
|
12262
|
-
return /* @__PURE__ */ (0,
|
|
12263
|
-
/* @__PURE__ */ (0,
|
|
12264
|
-
/* @__PURE__ */ (0,
|
|
12265
|
-
/* @__PURE__ */ (0,
|
|
12266
|
-
/* @__PURE__ */ (0,
|
|
13233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13234
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2", children: [
|
|
13235
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13236
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm", children: "\u2699\uFE0F" }),
|
|
13237
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05D5\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA" })
|
|
12267
13238
|
] }) }),
|
|
12268
|
-
/* @__PURE__ */ (0,
|
|
12269
|
-
isScanningPhoneColumns && targetPhoneOptions.length === 0 ? /* @__PURE__ */ (0,
|
|
12270
|
-
/* @__PURE__ */ (0,
|
|
12271
|
-
/* @__PURE__ */ (0,
|
|
12272
|
-
] }) : targetPhoneOptions.length === 0 ? /* @__PURE__ */ (0,
|
|
12273
|
-
/* @__PURE__ */ (0,
|
|
12274
|
-
/* @__PURE__ */ (0,
|
|
12275
|
-
] }) : targetPhoneOptions.length === 1 && targetPhoneOptions[0].type === "DIRECT" ? /* @__PURE__ */ (0,
|
|
12276
|
-
/* @__PURE__ */ (0,
|
|
12277
|
-
/* @__PURE__ */ (0,
|
|
12278
|
-
/* @__PURE__ */ (0,
|
|
12279
|
-
/* @__PURE__ */ (0,
|
|
13239
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-2.5 py-1", children: [
|
|
13240
|
+
isScanningPhoneColumns && targetPhoneOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13241
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Loader2, { className: "w-4 h-4 animate-spin text-emerald-600 shrink-0" }),
|
|
13242
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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..." })
|
|
13243
|
+
] }) : targetPhoneOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13244
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
13245
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" })
|
|
13246
|
+
] }) : targetPhoneOptions.length === 1 && targetPhoneOptions[0].type === "DIRECT" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13247
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13248
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1", children: [
|
|
13249
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Phone, { className: "w-3 h-3 text-slate-400" }),
|
|
13250
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D9\u05E2\u05D3" })
|
|
12280
13251
|
] }),
|
|
12281
|
-
/* @__PURE__ */ (0,
|
|
13252
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" })
|
|
12282
13253
|
] }),
|
|
12283
|
-
/* @__PURE__ */ (0,
|
|
12284
|
-
/* @__PURE__ */ (0,
|
|
13254
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13255
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12285
13256
|
"input",
|
|
12286
13257
|
{
|
|
12287
13258
|
type: "text",
|
|
@@ -12291,52 +13262,52 @@ function SettingsAndActionsBlock({
|
|
|
12291
13262
|
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"
|
|
12292
13263
|
}
|
|
12293
13264
|
),
|
|
12294
|
-
/* @__PURE__ */ (0,
|
|
13265
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Phone, { className: "w-3.5 h-3.5 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12295
13266
|
] })
|
|
12296
|
-
] }) : /* @__PURE__ */ (0,
|
|
12297
|
-
/* @__PURE__ */ (0,
|
|
12298
|
-
/* @__PURE__ */ (0,
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
12300
|
-
/* @__PURE__ */ (0,
|
|
13267
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13268
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13269
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1", children: [
|
|
13270
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Phone, { className: "w-3 h-3 text-slate-400" }),
|
|
13271
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D8\u05DC\u05E4\u05D5\u05DF \u05D9\u05E2\u05D3" })
|
|
12301
13272
|
] }),
|
|
12302
|
-
/* @__PURE__ */ (0,
|
|
13273
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[9px] text-slate-400", children: "\u05D7\u05D5\u05D1\u05D4" })
|
|
12303
13274
|
] }),
|
|
12304
|
-
/* @__PURE__ */ (0,
|
|
12305
|
-
/* @__PURE__ */ (0,
|
|
13275
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13276
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12306
13277
|
"select",
|
|
12307
13278
|
{
|
|
12308
13279
|
value: phoneColumnId,
|
|
12309
13280
|
onChange: (e) => setPhoneColumnId(e.target.value),
|
|
12310
13281
|
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",
|
|
12311
|
-
children: targetPhoneOptions.map((opt) => /* @__PURE__ */ (0,
|
|
13282
|
+
children: targetPhoneOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
|
|
12312
13283
|
}
|
|
12313
13284
|
),
|
|
12314
|
-
/* @__PURE__ */ (0,
|
|
13285
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12315
13286
|
] })
|
|
12316
13287
|
] }),
|
|
12317
|
-
/* @__PURE__ */ (0,
|
|
12318
|
-
/* @__PURE__ */ (0,
|
|
12319
|
-
/* @__PURE__ */ (0,
|
|
13288
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13289
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13290
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12320
13291
|
"label",
|
|
12321
13292
|
{
|
|
12322
13293
|
htmlFor: "whatsapp-auto-select-records",
|
|
12323
13294
|
className: "text-[11px] font-semibold text-slate-700 flex items-center gap-1 cursor-pointer",
|
|
12324
13295
|
children: [
|
|
12325
|
-
/* @__PURE__ */ (0,
|
|
12326
|
-
/* @__PURE__ */ (0,
|
|
13296
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.CheckSquare, { className: "w-3 h-3 text-slate-400" }),
|
|
13297
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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)" })
|
|
12327
13298
|
]
|
|
12328
13299
|
}
|
|
12329
13300
|
),
|
|
12330
|
-
autoSelectCount !== null && autoSelectCount > 0 && /* @__PURE__ */ (0,
|
|
12331
|
-
/* @__PURE__ */ (0,
|
|
12332
|
-
/* @__PURE__ */ (0,
|
|
12333
|
-
/* @__PURE__ */ (0,
|
|
13301
|
+
autoSelectCount !== null && autoSelectCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 animate-in fade-in duration-150", children: [
|
|
13302
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13303
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse" }),
|
|
13304
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
12334
13305
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
12335
13306
|
selectedRowIdsCount,
|
|
12336
13307
|
" \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA"
|
|
12337
13308
|
] })
|
|
12338
13309
|
] }),
|
|
12339
|
-
/* @__PURE__ */ (0,
|
|
13310
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12340
13311
|
"button",
|
|
12341
13312
|
{
|
|
12342
13313
|
type: "button",
|
|
@@ -12345,14 +13316,14 @@ function SettingsAndActionsBlock({
|
|
|
12345
13316
|
title: "\u05E0\u05E7\u05D4 \u05D1\u05D7\u05D9\u05E8\u05D4 \u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9\u05EA",
|
|
12346
13317
|
"aria-label": "Clear auto select count",
|
|
12347
13318
|
children: [
|
|
12348
|
-
/* @__PURE__ */ (0,
|
|
12349
|
-
/* @__PURE__ */ (0,
|
|
13319
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.X, { className: "w-3 h-3" }),
|
|
13320
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E0\u05E7\u05D4" })
|
|
12350
13321
|
]
|
|
12351
13322
|
}
|
|
12352
13323
|
)
|
|
12353
13324
|
] })
|
|
12354
13325
|
] }),
|
|
12355
|
-
/* @__PURE__ */ (0,
|
|
13326
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12356
13327
|
"input",
|
|
12357
13328
|
{
|
|
12358
13329
|
id: "whatsapp-auto-select-records",
|
|
@@ -12380,19 +13351,19 @@ function SettingsAndActionsBlock({
|
|
|
12380
13351
|
}
|
|
12381
13352
|
) })
|
|
12382
13353
|
] }),
|
|
12383
|
-
(selectedPhoneOption == null ? void 0 : selectedPhoneOption.type) === "SUBTABLE" && /* @__PURE__ */ (0,
|
|
12384
|
-
/* @__PURE__ */ (0,
|
|
12385
|
-
/* @__PURE__ */ (0,
|
|
12386
|
-
/* @__PURE__ */ (0,
|
|
13354
|
+
(selectedPhoneOption == null ? void 0 : selectedPhoneOption.type) === "SUBTABLE" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13355
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 pb-1 border-b border-emerald-200/60", children: [
|
|
13356
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Users, { className: "w-3.5 h-3.5 text-emerald-700" }),
|
|
13357
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-[10.5px] font-bold text-emerald-900 truncate", children: [
|
|
12387
13358
|
"\u05D4\u05D2\u05D3\u05E8\u05D5\u05EA \u05E9\u05DC\u05D9\u05D7\u05D4 \u05DC\u05EA\u05EA-\u05D8\u05D1\u05DC\u05D4 \u05DE\u05E7\u05D5\u05E9\u05E8\u05EA (",
|
|
12388
13359
|
selectedPhoneOption.parentColumnName,
|
|
12389
13360
|
")"
|
|
12390
13361
|
] })
|
|
12391
13362
|
] }),
|
|
12392
|
-
/* @__PURE__ */ (0,
|
|
12393
|
-
/* @__PURE__ */ (0,
|
|
12394
|
-
/* @__PURE__ */ (0,
|
|
12395
|
-
/* @__PURE__ */ (0,
|
|
13363
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13364
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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:" }) }),
|
|
13365
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13366
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12396
13367
|
"select",
|
|
12397
13368
|
{
|
|
12398
13369
|
value: subtableFilterColumn,
|
|
@@ -12402,10 +13373,10 @@ function SettingsAndActionsBlock({
|
|
|
12402
13373
|
},
|
|
12403
13374
|
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",
|
|
12404
13375
|
children: [
|
|
12405
|
-
/* @__PURE__ */ (0,
|
|
13376
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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)" }),
|
|
12406
13377
|
subtableFilterableColumns.map((col) => {
|
|
12407
13378
|
var _a2;
|
|
12408
|
-
return /* @__PURE__ */ (0,
|
|
13379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: col.name, children: [
|
|
12409
13380
|
col.name,
|
|
12410
13381
|
" (",
|
|
12411
13382
|
((_a2 = col.type) == null ? void 0 : _a2.toUpperCase()) === "BOOLEAN" ? "\u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9" : "\u05E7\u05E9\u05E8",
|
|
@@ -12415,30 +13386,30 @@ function SettingsAndActionsBlock({
|
|
|
12415
13386
|
]
|
|
12416
13387
|
}
|
|
12417
13388
|
),
|
|
12418
|
-
/* @__PURE__ */ (0,
|
|
13389
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12419
13390
|
] })
|
|
12420
13391
|
] }),
|
|
12421
|
-
selectedSubtableFilterCol && /* @__PURE__ */ (0,
|
|
12422
|
-
/* @__PURE__ */ (0,
|
|
12423
|
-
/* @__PURE__ */ (0,
|
|
12424
|
-
!subtableFilterValue && /* @__PURE__ */ (0,
|
|
13392
|
+
selectedSubtableFilterCol && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1 animate-in fade-in duration-150", children: [
|
|
13393
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13394
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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:" }),
|
|
13395
|
+
!subtableFilterValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[9px] text-amber-600 font-medium", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA..." })
|
|
12425
13396
|
] }),
|
|
12426
|
-
/* @__PURE__ */ (0,
|
|
12427
|
-
/* @__PURE__ */ (0,
|
|
13397
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13398
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12428
13399
|
"select",
|
|
12429
13400
|
{
|
|
12430
13401
|
value: subtableFilterValue,
|
|
12431
13402
|
onChange: (e) => setSubtableFilterValue(e.target.value),
|
|
12432
13403
|
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"}`,
|
|
12433
13404
|
children: [
|
|
12434
|
-
/* @__PURE__ */ (0,
|
|
12435
|
-
((_a = selectedSubtableFilterCol.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN" ? /* @__PURE__ */ (0,
|
|
12436
|
-
/* @__PURE__ */ (0,
|
|
12437
|
-
/* @__PURE__ */ (0,
|
|
13405
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF..." }),
|
|
13406
|
+
((_a = selectedSubtableFilterCol.type) == null ? void 0 : _a.toUpperCase()) === "BOOLEAN" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13407
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "true", children: "\u05DB\u05DF (true)" }),
|
|
13408
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "false", children: "\u05DC\u05D0 (false)" })
|
|
12438
13409
|
] }) : getRelationOptionsForCol(
|
|
12439
13410
|
selectedSubtableFilterCol.name,
|
|
12440
13411
|
selectedPhoneOption.parentColumnName
|
|
12441
|
-
).map((opt) => /* @__PURE__ */ (0,
|
|
13412
|
+
).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.id, children: getRelationOptionLabel(
|
|
12442
13413
|
opt,
|
|
12443
13414
|
selectedSubtableFilterCol,
|
|
12444
13415
|
relationOptions
|
|
@@ -12446,32 +13417,32 @@ function SettingsAndActionsBlock({
|
|
|
12446
13417
|
]
|
|
12447
13418
|
}
|
|
12448
13419
|
),
|
|
12449
|
-
/* @__PURE__ */ (0,
|
|
13420
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12450
13421
|
] })
|
|
12451
13422
|
] }),
|
|
12452
|
-
/* @__PURE__ */ (0,
|
|
12453
|
-
/* @__PURE__ */ (0,
|
|
12454
|
-
/* @__PURE__ */ (0,
|
|
12455
|
-
/* @__PURE__ */ (0,
|
|
13423
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13424
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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:" }),
|
|
13425
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13426
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12456
13427
|
"select",
|
|
12457
13428
|
{
|
|
12458
13429
|
value: subtableSendLimit,
|
|
12459
13430
|
onChange: (e) => setSubtableSendLimit(e.target.value),
|
|
12460
13431
|
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",
|
|
12461
13432
|
children: [
|
|
12462
|
-
/* @__PURE__ */ (0,
|
|
12463
|
-
/* @__PURE__ */ (0,
|
|
12464
|
-
/* @__PURE__ */ (0,
|
|
13433
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "PRIMARY", children: "\u05DC\u05E0\u05E6\u05D9\u05D2 \u05E8\u05D0\u05E9\u05D9 \u05D1\u05DC\u05D1\u05D3" }),
|
|
13434
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "FIRST", children: "\u05E0\u05E6\u05D9\u05D2 \u05D0\u05D7\u05D3 \u05D1\u05DC\u05D1\u05D3" }),
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "ALL", children: "\u05DB\u05DC \u05D4\u05E0\u05E6\u05D9\u05D2\u05D9\u05DD" })
|
|
12465
13436
|
]
|
|
12466
13437
|
}
|
|
12467
13438
|
),
|
|
12468
|
-
/* @__PURE__ */ (0,
|
|
13439
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12469
13440
|
] })
|
|
12470
13441
|
] })
|
|
12471
13442
|
] }),
|
|
12472
|
-
/* @__PURE__ */ (0,
|
|
12473
|
-
/* @__PURE__ */ (0,
|
|
12474
|
-
/* @__PURE__ */ (0,
|
|
13443
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pt-2 border-t border-slate-200/70 space-y-2", children: [
|
|
13444
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
13445
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12475
13446
|
"input",
|
|
12476
13447
|
{
|
|
12477
13448
|
type: "checkbox",
|
|
@@ -12488,13 +13459,13 @@ function SettingsAndActionsBlock({
|
|
|
12488
13459
|
className: "w-3.5 h-3.5 rounded border-slate-300 text-emerald-600 focus:ring-emerald-500 cursor-pointer"
|
|
12489
13460
|
}
|
|
12490
13461
|
),
|
|
12491
|
-
/* @__PURE__ */ (0,
|
|
13462
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" })
|
|
12492
13463
|
] }),
|
|
12493
|
-
enablePostSendAction && /* @__PURE__ */ (0,
|
|
12494
|
-
/* @__PURE__ */ (0,
|
|
12495
|
-
/* @__PURE__ */ (0,
|
|
12496
|
-
/* @__PURE__ */ (0,
|
|
12497
|
-
selectedPostSendOption && /* @__PURE__ */ (0,
|
|
13464
|
+
enablePostSendAction && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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__ */ (0, import_jsx_runtime19.jsx)("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__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13465
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1", children: [
|
|
13466
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13467
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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" }),
|
|
13468
|
+
selectedPostSendOption && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12498
13469
|
"span",
|
|
12499
13470
|
{
|
|
12500
13471
|
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"}`,
|
|
@@ -12502,8 +13473,8 @@ function SettingsAndActionsBlock({
|
|
|
12502
13473
|
}
|
|
12503
13474
|
)
|
|
12504
13475
|
] }),
|
|
12505
|
-
/* @__PURE__ */ (0,
|
|
12506
|
-
/* @__PURE__ */ (0,
|
|
13476
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13477
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12507
13478
|
"select",
|
|
12508
13479
|
{
|
|
12509
13480
|
value: postSendActionColumn,
|
|
@@ -12516,35 +13487,35 @@ function SettingsAndActionsBlock({
|
|
|
12516
13487
|
},
|
|
12517
13488
|
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",
|
|
12518
13489
|
children: [
|
|
12519
|
-
/* @__PURE__ */ (0,
|
|
12520
|
-
postSendActionTargetOptions.map((opt) => /* @__PURE__ */ (0,
|
|
13490
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
13491
|
+
postSendActionTargetOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
|
|
12521
13492
|
]
|
|
12522
13493
|
}
|
|
12523
13494
|
),
|
|
12524
|
-
/* @__PURE__ */ (0,
|
|
13495
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12525
13496
|
] })
|
|
12526
13497
|
] }),
|
|
12527
|
-
selectedPostSendOption && /* @__PURE__ */ (0,
|
|
12528
|
-
/* @__PURE__ */ (0,
|
|
12529
|
-
/* @__PURE__ */ (0,
|
|
12530
|
-
!postSendActionValue && /* @__PURE__ */ (0,
|
|
13498
|
+
selectedPostSendOption && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-1 animate-in fade-in duration-150", children: [
|
|
13499
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13500
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "text-[10px] font-semibold text-slate-600 block", children: "\u05E2\u05E8\u05DA \u05DC\u05E2\u05D3\u05DB\u05D5\u05DF" }),
|
|
13501
|
+
!postSendActionValue && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-[9px] text-amber-600 font-medium", children: "\u05D7\u05D5\u05D1\u05D4 \u05DC\u05D1\u05D7\u05D5\u05E8 \u05E2\u05E8\u05DA" })
|
|
12531
13502
|
] }),
|
|
12532
|
-
/* @__PURE__ */ (0,
|
|
12533
|
-
/* @__PURE__ */ (0,
|
|
13503
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
13504
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12534
13505
|
"select",
|
|
12535
13506
|
{
|
|
12536
13507
|
value: postSendActionValue,
|
|
12537
13508
|
onChange: (e) => setPostSendActionValue(e.target.value),
|
|
12538
13509
|
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"}`,
|
|
12539
13510
|
children: [
|
|
12540
|
-
/* @__PURE__ */ (0,
|
|
12541
|
-
selectedPostSendOption.type === "BOOLEAN" ? /* @__PURE__ */ (0,
|
|
12542
|
-
/* @__PURE__ */ (0,
|
|
12543
|
-
/* @__PURE__ */ (0,
|
|
13511
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05E8\u05DA..." }),
|
|
13512
|
+
selectedPostSendOption.type === "BOOLEAN" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13513
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "true", children: "\u05DB\u05DF (Yes)" }),
|
|
13514
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "false", children: "\u05DC\u05D0 (No)" })
|
|
12544
13515
|
] }) : getRelationOptionsForCol(
|
|
12545
13516
|
selectedPostSendOption.columnName,
|
|
12546
13517
|
selectedPostSendOption.parentColumnName
|
|
12547
|
-
).map((opt) => /* @__PURE__ */ (0,
|
|
13518
|
+
).map((opt) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: opt.id, children: getRelationOptionLabel(
|
|
12548
13519
|
opt,
|
|
12549
13520
|
selectedPostSendOption,
|
|
12550
13521
|
relationOptions
|
|
@@ -12552,15 +13523,15 @@ function SettingsAndActionsBlock({
|
|
|
12552
13523
|
]
|
|
12553
13524
|
}
|
|
12554
13525
|
),
|
|
12555
|
-
/* @__PURE__ */ (0,
|
|
13526
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.ChevronDown, { className: "w-3 h-3 text-slate-400 absolute left-1.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12556
13527
|
] })
|
|
12557
13528
|
] })
|
|
12558
13529
|
] }) })
|
|
12559
13530
|
] })
|
|
12560
13531
|
] })
|
|
12561
13532
|
] }),
|
|
12562
|
-
/* @__PURE__ */ (0,
|
|
12563
|
-
/* @__PURE__ */ (0,
|
|
13533
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mt-auto pt-2.5 border-t border-slate-200/80 space-y-2 shrink-0", children: [
|
|
13534
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12564
13535
|
"button",
|
|
12565
13536
|
{
|
|
12566
13537
|
type: "button",
|
|
@@ -12569,23 +13540,23 @@ function SettingsAndActionsBlock({
|
|
|
12569
13540
|
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"}`,
|
|
12570
13541
|
title: testButtonTitle,
|
|
12571
13542
|
children: [
|
|
12572
|
-
/* @__PURE__ */ (0,
|
|
12573
|
-
/* @__PURE__ */ (0,
|
|
13543
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Phone, { className: "w-3 h-3" }),
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05D8\u05E1\u05D8" })
|
|
12574
13545
|
]
|
|
12575
13546
|
}
|
|
12576
13547
|
),
|
|
12577
|
-
isSendingBroadcast ? /* @__PURE__ */ (0,
|
|
13548
|
+
isSendingBroadcast ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12578
13549
|
"div",
|
|
12579
13550
|
{
|
|
12580
13551
|
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",
|
|
12581
13552
|
"data-testid": "live-broadcast-progress",
|
|
12582
13553
|
children: [
|
|
12583
|
-
/* @__PURE__ */ (0,
|
|
12584
|
-
/* @__PURE__ */ (0,
|
|
12585
|
-
/* @__PURE__ */ (0,
|
|
12586
|
-
/* @__PURE__ */ (0,
|
|
13554
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-700", children: [
|
|
13555
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 text-emerald-800 font-bold", children: [
|
|
13556
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Loader2, { className: "w-3.5 h-3.5 animate-spin text-emerald-600 shrink-0" }),
|
|
13557
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E9\u05D5\u05DC\u05D7 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05D1\u05EA\u05E4\u05D5\u05E6\u05D4..." })
|
|
12587
13558
|
] }),
|
|
12588
|
-
/* @__PURE__ */ (0,
|
|
13559
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-emerald-700 font-bold", children: [
|
|
12589
13560
|
(broadcastProgress == null ? void 0 : broadcastProgress.percent) || 0,
|
|
12590
13561
|
"% (",
|
|
12591
13562
|
(broadcastProgress == null ? void 0 : broadcastProgress.current) || 0,
|
|
@@ -12594,7 +13565,7 @@ function SettingsAndActionsBlock({
|
|
|
12594
13565
|
")"
|
|
12595
13566
|
] })
|
|
12596
13567
|
] }),
|
|
12597
|
-
/* @__PURE__ */ (0,
|
|
13568
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full h-2.5 bg-slate-100 rounded-full overflow-hidden border border-slate-200", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12598
13569
|
"div",
|
|
12599
13570
|
{
|
|
12600
13571
|
className: "h-full bg-emerald-500 rounded-full transition-all duration-300 ease-out",
|
|
@@ -12603,18 +13574,18 @@ function SettingsAndActionsBlock({
|
|
|
12603
13574
|
}
|
|
12604
13575
|
}
|
|
12605
13576
|
) }),
|
|
12606
|
-
/* @__PURE__ */ (0,
|
|
12607
|
-
/* @__PURE__ */ (0,
|
|
12608
|
-
/* @__PURE__ */ (0,
|
|
12609
|
-
/* @__PURE__ */ (0,
|
|
13577
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-around pt-1 text-[11px] font-medium border-t border-slate-100", children: [
|
|
13578
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-emerald-700 flex items-center gap-1", title: "\u05E0\u05E9\u05DC\u05D7\u05D5 \u05D1\u05D4\u05E6\u05DC\u05D7\u05D4", children: [
|
|
13579
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u2705" }),
|
|
13580
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-bold", children: (broadcastProgress == null ? void 0 : broadcastProgress.successful) || 0 })
|
|
12610
13581
|
] }),
|
|
12611
|
-
/* @__PURE__ */ (0,
|
|
12612
|
-
/* @__PURE__ */ (0,
|
|
12613
|
-
/* @__PURE__ */ (0,
|
|
13582
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-rose-600 flex items-center gap-1", title: "\u05E9\u05DC\u05D9\u05D7\u05D4 \u05E0\u05DB\u05E9\u05DC\u05D4", children: [
|
|
13583
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u274C" }),
|
|
13584
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-bold", children: (broadcastProgress == null ? void 0 : broadcastProgress.failed) || 0 })
|
|
12614
13585
|
] }),
|
|
12615
|
-
/* @__PURE__ */ (0,
|
|
12616
|
-
/* @__PURE__ */ (0,
|
|
12617
|
-
/* @__PURE__ */ (0,
|
|
13586
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13587
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u26A0\uFE0F" }),
|
|
13588
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-bold", children: [
|
|
12618
13589
|
(broadcastProgress == null ? void 0 : broadcastProgress.skipped) || 0,
|
|
12619
13590
|
" \u05DC\u05DC\u05D0 \u05D8\u05DC\u05E4\u05D5\u05DF"
|
|
12620
13591
|
] })
|
|
@@ -12622,8 +13593,8 @@ function SettingsAndActionsBlock({
|
|
|
12622
13593
|
] })
|
|
12623
13594
|
]
|
|
12624
13595
|
}
|
|
12625
|
-
) : /* @__PURE__ */ (0,
|
|
12626
|
-
/* @__PURE__ */ (0,
|
|
13596
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
13597
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12627
13598
|
"button",
|
|
12628
13599
|
{
|
|
12629
13600
|
type: "button",
|
|
@@ -12632,56 +13603,56 @@ function SettingsAndActionsBlock({
|
|
|
12632
13603
|
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"}`,
|
|
12633
13604
|
title: sendButtonTitle,
|
|
12634
13605
|
children: [
|
|
12635
|
-
/* @__PURE__ */ (0,
|
|
12636
|
-
/* @__PURE__ */ (0,
|
|
13606
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.Send, { className: "w-3.5 h-3.5" }),
|
|
13607
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: finalRecipientCount > 0 ? `\u05E9\u05DC\u05D7 \u05DC-${finalRecipientCount} \u05E0\u05DE\u05E2\u05E0\u05D9\u05DD` : "\u05E9\u05DC\u05D7 \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA" })
|
|
12637
13608
|
]
|
|
12638
13609
|
}
|
|
12639
13610
|
),
|
|
12640
|
-
validMainRowsCount > 0 && /* @__PURE__ */ (0,
|
|
13611
|
+
validMainRowsCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "text-center text-[10.5px] text-slate-500 font-medium pt-0.5", children: [
|
|
12641
13612
|
"\u05DE\u05EA\u05D5\u05DA ",
|
|
12642
13613
|
validMainRowsCount,
|
|
12643
13614
|
" \u05E9\u05D5\u05E8\u05D5\u05EA \u05E8\u05D0\u05E9\u05D9\u05D5\u05EA"
|
|
12644
13615
|
] }),
|
|
12645
|
-
broadcastSummary && /* @__PURE__ */ (0,
|
|
13616
|
+
broadcastSummary && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
12646
13617
|
"div",
|
|
12647
13618
|
{
|
|
12648
13619
|
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",
|
|
12649
13620
|
"data-testid": "broadcast-summary-card",
|
|
12650
13621
|
children: [
|
|
12651
|
-
/* @__PURE__ */ (0,
|
|
12652
|
-
/* @__PURE__ */ (0,
|
|
12653
|
-
/* @__PURE__ */ (0,
|
|
12654
|
-
/* @__PURE__ */ (0,
|
|
13622
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13623
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1.5 text-[11px] font-bold text-slate-700", children: [
|
|
13624
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-xs", children: "\u{1F4CA}" }),
|
|
13625
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u05E1\u05D9\u05DB\u05D5\u05DD \u05E9\u05D9\u05D3\u05D5\u05E8 \u05D0\u05D7\u05E8\u05D5\u05DF" })
|
|
12655
13626
|
] }),
|
|
12656
|
-
clearBroadcastSummary && /* @__PURE__ */ (0,
|
|
13627
|
+
clearBroadcastSummary && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
12657
13628
|
"button",
|
|
12658
13629
|
{
|
|
12659
13630
|
type: "button",
|
|
12660
13631
|
onClick: clearBroadcastSummary,
|
|
12661
13632
|
className: "text-slate-400 hover:text-slate-600 p-0.5 rounded-md hover:bg-slate-200/60 transition-colors cursor-pointer",
|
|
12662
13633
|
title: "\u05E1\u05D2\u05D5\u05E8 \u05E1\u05D9\u05DB\u05D5\u05DD",
|
|
12663
|
-
children: /* @__PURE__ */ (0,
|
|
13634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react13.X, { className: "w-3.5 h-3.5" })
|
|
12664
13635
|
}
|
|
12665
13636
|
)
|
|
12666
13637
|
] }),
|
|
12667
|
-
/* @__PURE__ */ (0,
|
|
12668
|
-
/* @__PURE__ */ (0,
|
|
12669
|
-
/* @__PURE__ */ (0,
|
|
12670
|
-
/* @__PURE__ */ (0,
|
|
13638
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5 pt-0.5", children: [
|
|
13639
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13640
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u2705" }),
|
|
13641
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
12671
13642
|
broadcastSummary.successful,
|
|
12672
13643
|
" \u05E0\u05E9\u05DC\u05D7\u05D5"
|
|
12673
13644
|
] })
|
|
12674
13645
|
] }),
|
|
12675
|
-
broadcastSummary.failed > 0 && /* @__PURE__ */ (0,
|
|
12676
|
-
/* @__PURE__ */ (0,
|
|
12677
|
-
/* @__PURE__ */ (0,
|
|
13646
|
+
broadcastSummary.failed > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13647
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u274C" }),
|
|
13648
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
12678
13649
|
broadcastSummary.failed,
|
|
12679
13650
|
" \u05E0\u05DB\u05E9\u05DC\u05D5"
|
|
12680
13651
|
] })
|
|
12681
13652
|
] }),
|
|
12682
|
-
broadcastSummary.skipped > 0 && /* @__PURE__ */ (0,
|
|
12683
|
-
/* @__PURE__ */ (0,
|
|
12684
|
-
/* @__PURE__ */ (0,
|
|
13653
|
+
broadcastSummary.skipped > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
|
|
13654
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u26A0\uFE0F" }),
|
|
13655
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
12685
13656
|
broadcastSummary.skipped,
|
|
12686
13657
|
" \u05DC\u05DC\u05D0 \u05D8\u05DC\u05E4\u05D5\u05DF"
|
|
12687
13658
|
] })
|
|
@@ -12696,48 +13667,48 @@ function SettingsAndActionsBlock({
|
|
|
12696
13667
|
}
|
|
12697
13668
|
|
|
12698
13669
|
// src/components/WhatsAppComponent/WhatsAppComponent.tsx
|
|
12699
|
-
var
|
|
13670
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
12700
13671
|
function WhatsAppComponent(props) {
|
|
12701
13672
|
var _a;
|
|
12702
13673
|
const { className = "", settings, orgId, componentId, executeAction } = props;
|
|
12703
13674
|
const state = useWhatsAppState(props);
|
|
12704
|
-
return /* @__PURE__ */ (0,
|
|
13675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
12705
13676
|
"div",
|
|
12706
13677
|
{
|
|
12707
13678
|
className: `w-full flex flex-col bg-white border border-slate-200 rounded-2xl shadow-xs overflow-hidden ${className}`,
|
|
12708
13679
|
"data-testid": "whatsapp-component",
|
|
12709
13680
|
dir: "rtl",
|
|
12710
13681
|
children: [
|
|
12711
|
-
state.feedback && /* @__PURE__ */ (0,
|
|
13682
|
+
state.feedback && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
12712
13683
|
"div",
|
|
12713
13684
|
{
|
|
12714
13685
|
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"}`,
|
|
12715
13686
|
children: [
|
|
12716
|
-
/* @__PURE__ */ (0,
|
|
12717
|
-
state.feedback.type === "success" ? /* @__PURE__ */ (0,
|
|
12718
|
-
/* @__PURE__ */ (0,
|
|
13687
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13688
|
+
state.feedback.type === "success" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.CheckCircle2, { className: "w-4 h-4 text-emerald-600 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
13689
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: state.feedback.message })
|
|
12719
13690
|
] }),
|
|
12720
|
-
/* @__PURE__ */ (0,
|
|
13691
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12721
13692
|
"button",
|
|
12722
13693
|
{
|
|
12723
13694
|
type: "button",
|
|
12724
13695
|
onClick: () => state.setFeedback(null),
|
|
12725
13696
|
className: "text-slate-400 hover:text-slate-700 cursor-pointer",
|
|
12726
|
-
children: /* @__PURE__ */ (0,
|
|
13697
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.X, { className: "w-4 h-4" })
|
|
12727
13698
|
}
|
|
12728
13699
|
)
|
|
12729
13700
|
]
|
|
12730
13701
|
}
|
|
12731
13702
|
),
|
|
12732
|
-
state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */ (0,
|
|
12733
|
-
/* @__PURE__ */ (0,
|
|
12734
|
-
/* @__PURE__ */ (0,
|
|
12735
|
-
/* @__PURE__ */ (0,
|
|
13703
|
+
state.fetchError && !state.isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("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: [
|
|
13704
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13705
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
13706
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
|
|
12736
13707
|
"\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05EA\u05D1\u05E0\u05D9\u05D5\u05EA \u05DE-Meta: ",
|
|
12737
13708
|
state.fetchError
|
|
12738
13709
|
] })
|
|
12739
13710
|
] }),
|
|
12740
|
-
/* @__PURE__ */ (0,
|
|
13711
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12741
13712
|
"button",
|
|
12742
13713
|
{
|
|
12743
13714
|
type: "button",
|
|
@@ -12747,9 +13718,9 @@ function WhatsAppComponent(props) {
|
|
|
12747
13718
|
}
|
|
12748
13719
|
)
|
|
12749
13720
|
] }),
|
|
12750
|
-
/* @__PURE__ */ (0,
|
|
12751
|
-
/* @__PURE__ */ (0,
|
|
12752
|
-
/* @__PURE__ */ (0,
|
|
13721
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
13722
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
|
|
13723
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12753
13724
|
TemplateSelectionBlock,
|
|
12754
13725
|
{
|
|
12755
13726
|
selectedTemplate: state.selectedTemplate,
|
|
@@ -12777,7 +13748,7 @@ function WhatsAppComponent(props) {
|
|
|
12777
13748
|
handleFileUpload: state.handleFileUpload
|
|
12778
13749
|
}
|
|
12779
13750
|
),
|
|
12780
|
-
/* @__PURE__ */ (0,
|
|
13751
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12781
13752
|
DynamicFiltersBlock,
|
|
12782
13753
|
{
|
|
12783
13754
|
filterableColumns: state.filterableColumns,
|
|
@@ -12794,7 +13765,7 @@ function WhatsAppComponent(props) {
|
|
|
12794
13765
|
isLoadingTableData: state.isLoadingTableData
|
|
12795
13766
|
}
|
|
12796
13767
|
),
|
|
12797
|
-
/* @__PURE__ */ (0,
|
|
13768
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12798
13769
|
SettingsAndActionsBlock,
|
|
12799
13770
|
{
|
|
12800
13771
|
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
@@ -12840,13 +13811,13 @@ function WhatsAppComponent(props) {
|
|
|
12840
13811
|
}
|
|
12841
13812
|
)
|
|
12842
13813
|
] }),
|
|
12843
|
-
/* @__PURE__ */ (0,
|
|
12844
|
-
/* @__PURE__ */ (0,
|
|
12845
|
-
/* @__PURE__ */ (0,
|
|
12846
|
-
] }) : state.tableError ? /* @__PURE__ */ (0,
|
|
12847
|
-
/* @__PURE__ */ (0,
|
|
12848
|
-
/* @__PURE__ */ (0,
|
|
12849
|
-
] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */ (0,
|
|
13814
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
|
|
13815
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Loader2, { className: "w-6 h-6 animate-spin text-emerald-600" }),
|
|
13816
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05D8\u05D5\u05E2\u05DF \u05E8\u05E9\u05D5\u05DE\u05D5\u05EA \u05DE\u05D4\u05D8\u05D1\u05DC\u05D4..." })
|
|
13817
|
+
] }) : state.tableError ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 flex items-center justify-center p-6 text-center text-xs text-rose-600 bg-rose-50 gap-2", children: [
|
|
13818
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.AlertCircle, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
13819
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: state.tableError })
|
|
13820
|
+
] }) : !(settings == null ? void 0 : settings.tableMetaId) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsx)(
|
|
12850
13821
|
TableBlockClient,
|
|
12851
13822
|
{
|
|
12852
13823
|
settings: {
|
|
@@ -12868,7 +13839,7 @@ function WhatsAppComponent(props) {
|
|
|
12868
13839
|
}
|
|
12869
13840
|
) })
|
|
12870
13841
|
] }),
|
|
12871
|
-
/* @__PURE__ */ (0,
|
|
13842
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12872
13843
|
CreateTemplateModal,
|
|
12873
13844
|
{
|
|
12874
13845
|
isOpen: state.isModalOpen,
|
|
@@ -12882,7 +13853,7 @@ function WhatsAppComponent(props) {
|
|
|
12882
13853
|
orgId: state.orgId || orgId
|
|
12883
13854
|
}
|
|
12884
13855
|
),
|
|
12885
|
-
state.isTestPromptOpen && /* @__PURE__ */ (0,
|
|
13856
|
+
state.isTestPromptOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12886
13857
|
"div",
|
|
12887
13858
|
{
|
|
12888
13859
|
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",
|
|
@@ -12891,7 +13862,7 @@ function WhatsAppComponent(props) {
|
|
|
12891
13862
|
state.setIsTestPromptOpen(false);
|
|
12892
13863
|
state.setTestFeedback(null);
|
|
12893
13864
|
},
|
|
12894
|
-
children: /* @__PURE__ */ (0,
|
|
13865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
12895
13866
|
"div",
|
|
12896
13867
|
{
|
|
12897
13868
|
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",
|
|
@@ -12900,15 +13871,15 @@ function WhatsAppComponent(props) {
|
|
|
12900
13871
|
"aria-labelledby": "test-modal-title",
|
|
12901
13872
|
onClick: (e) => e.stopPropagation(),
|
|
12902
13873
|
children: [
|
|
12903
|
-
/* @__PURE__ */ (0,
|
|
12904
|
-
/* @__PURE__ */ (0,
|
|
12905
|
-
/* @__PURE__ */ (0,
|
|
12906
|
-
/* @__PURE__ */ (0,
|
|
12907
|
-
/* @__PURE__ */ (0,
|
|
12908
|
-
/* @__PURE__ */ (0,
|
|
13874
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-5 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
13875
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
13876
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Phone, { className: "w-4 h-4" }) }),
|
|
13877
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
13878
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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)" }),
|
|
13879
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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" })
|
|
12909
13880
|
] })
|
|
12910
13881
|
] }),
|
|
12911
|
-
/* @__PURE__ */ (0,
|
|
13882
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12912
13883
|
"button",
|
|
12913
13884
|
{
|
|
12914
13885
|
type: "button",
|
|
@@ -12920,25 +13891,25 @@ function WhatsAppComponent(props) {
|
|
|
12920
13891
|
},
|
|
12921
13892
|
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"}`,
|
|
12922
13893
|
title: "\u05E1\u05D2\u05D5\u05E8",
|
|
12923
|
-
children: /* @__PURE__ */ (0,
|
|
13894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.X, { className: "w-4 h-4" })
|
|
12924
13895
|
}
|
|
12925
13896
|
)
|
|
12926
13897
|
] }),
|
|
12927
|
-
/* @__PURE__ */ (0,
|
|
12928
|
-
/* @__PURE__ */ (0,
|
|
12929
|
-
/* @__PURE__ */ (0,
|
|
12930
|
-
/* @__PURE__ */ (0,
|
|
13898
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-5 space-y-4", children: [
|
|
13899
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
|
|
13900
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-500 font-medium", children: "\u05EA\u05D1\u05E0\u05D9\u05EA \u05E0\u05D1\u05D7\u05E8\u05EA:" }),
|
|
13901
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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" })
|
|
12931
13902
|
] }),
|
|
12932
|
-
state.selectedPhoneOption && /* @__PURE__ */ (0,
|
|
12933
|
-
/* @__PURE__ */ (0,
|
|
12934
|
-
/* @__PURE__ */ (0,
|
|
13903
|
+
state.selectedPhoneOption && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-2 bg-emerald-50/50 border border-emerald-200/60 rounded-xl flex items-center justify-between text-[11px]", children: [
|
|
13904
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-emerald-800 font-medium", children: "\u05E2\u05DE\u05D5\u05D3\u05EA \u05D9\u05E2\u05D3:" }),
|
|
13905
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-bold text-emerald-950 font-mono", children: state.selectedPhoneOption.label })
|
|
12935
13906
|
] }),
|
|
12936
13907
|
state.templateHeaderComp && (() => {
|
|
12937
13908
|
const headerFormat = (state.templateHeaderComp.format || "").toUpperCase();
|
|
12938
13909
|
const docFilename = resolveDocumentFilename(state.templateHeaderComp, state.headerMediaUrl);
|
|
12939
|
-
return /* @__PURE__ */ (0,
|
|
12940
|
-
/* @__PURE__ */ (0,
|
|
12941
|
-
/* @__PURE__ */ (0,
|
|
13910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-2.5 bg-slate-50 border border-slate-200/80 rounded-xl flex items-center justify-between text-xs", children: [
|
|
13911
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-2 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
13912
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsx)(
|
|
12942
13913
|
"img",
|
|
12943
13914
|
{
|
|
12944
13915
|
src: state.headerMediaUrl,
|
|
@@ -12948,28 +13919,28 @@ function WhatsAppComponent(props) {
|
|
|
12948
13919
|
e.currentTarget.style.display = "none";
|
|
12949
13920
|
}
|
|
12950
13921
|
}
|
|
12951
|
-
) : /* @__PURE__ */ (0,
|
|
12952
|
-
/* @__PURE__ */ (0,
|
|
12953
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0,
|
|
12954
|
-
/* @__PURE__ */ (0,
|
|
12955
|
-
/* @__PURE__ */ (0,
|
|
12956
|
-
/* @__PURE__ */ (0,
|
|
12957
|
-
/* @__PURE__ */ (0,
|
|
13922
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Image, { className: "w-3.5 h-3.5 text-emerald-600" }) }),
|
|
13923
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-semibold text-slate-800 truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
13924
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
13925
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.FileText, { className: "w-3.5 h-3.5" }) }),
|
|
13926
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
|
|
13927
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-semibold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
13928
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-500 font-mono block truncate", title: docFilename, children: docFilename })
|
|
12958
13929
|
] })
|
|
12959
|
-
] }) : /* @__PURE__ */ (0,
|
|
12960
|
-
/* @__PURE__ */ (0,
|
|
12961
|
-
/* @__PURE__ */ (0,
|
|
13930
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
13931
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Video, { className: "w-3.5 h-3.5" }) }),
|
|
13932
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-semibold text-slate-800 truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" })
|
|
12962
13933
|
] }) }),
|
|
12963
|
-
state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ (0,
|
|
13934
|
+
state.headerMediaUrl && state.headerMediaUrl.startsWith("http") ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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__ */ (0, import_jsx_runtime20.jsx)("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" })
|
|
12964
13935
|
] });
|
|
12965
13936
|
})(),
|
|
12966
|
-
/* @__PURE__ */ (0,
|
|
12967
|
-
/* @__PURE__ */ (0,
|
|
13937
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
|
|
13938
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "text-xs font-semibold text-slate-700 block", children: [
|
|
12968
13939
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05DC\u05D8\u05E1\u05D8 ",
|
|
12969
|
-
/* @__PURE__ */ (0,
|
|
13940
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
12970
13941
|
] }),
|
|
12971
|
-
/* @__PURE__ */ (0,
|
|
12972
|
-
/* @__PURE__ */ (0,
|
|
13942
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", children: [
|
|
13943
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
12973
13944
|
"input",
|
|
12974
13945
|
{
|
|
12975
13946
|
type: "tel",
|
|
@@ -12991,17 +13962,17 @@ function WhatsAppComponent(props) {
|
|
|
12991
13962
|
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"
|
|
12992
13963
|
}
|
|
12993
13964
|
),
|
|
12994
|
-
/* @__PURE__ */ (0,
|
|
13965
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Phone, { className: "w-4 h-4 text-slate-400 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
12995
13966
|
] }),
|
|
12996
|
-
/* @__PURE__ */ (0,
|
|
13967
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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." })
|
|
12997
13968
|
] }),
|
|
12998
|
-
state.testFeedback && /* @__PURE__ */ (0,
|
|
12999
|
-
/* @__PURE__ */ (0,
|
|
13000
|
-
/* @__PURE__ */ (0,
|
|
13969
|
+
state.testFeedback && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("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: [
|
|
13970
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.AlertCircle, { className: "w-4 h-4 text-rose-500 shrink-0" }),
|
|
13971
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: state.testFeedback })
|
|
13001
13972
|
] })
|
|
13002
13973
|
] }),
|
|
13003
|
-
/* @__PURE__ */ (0,
|
|
13004
|
-
/* @__PURE__ */ (0,
|
|
13974
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-5 py-3.5 bg-slate-50/70 border-t border-slate-100 flex items-center justify-end gap-2", children: [
|
|
13975
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
13005
13976
|
"button",
|
|
13006
13977
|
{
|
|
13007
13978
|
type: "button",
|
|
@@ -13015,7 +13986,7 @@ function WhatsAppComponent(props) {
|
|
|
13015
13986
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
13016
13987
|
}
|
|
13017
13988
|
),
|
|
13018
|
-
/* @__PURE__ */ (0,
|
|
13989
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
13019
13990
|
"button",
|
|
13020
13991
|
{
|
|
13021
13992
|
type: "button",
|
|
@@ -13023,12 +13994,12 @@ function WhatsAppComponent(props) {
|
|
|
13023
13994
|
onClick: state.handleSendTest,
|
|
13024
13995
|
title: state.testButtonTitle,
|
|
13025
13996
|
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"}`,
|
|
13026
|
-
children: state.isSendingTest ? /* @__PURE__ */ (0,
|
|
13027
|
-
/* @__PURE__ */ (0,
|
|
13028
|
-
/* @__PURE__ */ (0,
|
|
13029
|
-
] }) : /* @__PURE__ */ (0,
|
|
13030
|
-
/* @__PURE__ */ (0,
|
|
13031
|
-
/* @__PURE__ */ (0,
|
|
13997
|
+
children: state.isSendingTest ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
13998
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
13999
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05E9\u05D5\u05DC\u05D7..." })
|
|
14000
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
14001
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.Send, { className: "w-3.5 h-3.5" }),
|
|
14002
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05E2\u05DB\u05E9\u05D9\u05D5" })
|
|
13032
14003
|
] })
|
|
13033
14004
|
}
|
|
13034
14005
|
)
|
|
@@ -13043,10 +14014,175 @@ function WhatsAppComponent(props) {
|
|
|
13043
14014
|
);
|
|
13044
14015
|
}
|
|
13045
14016
|
|
|
14017
|
+
// src/components/FormBlock/FormBlock.tsx
|
|
14018
|
+
var import_react21 = require("react");
|
|
14019
|
+
var import_lucide_react15 = require("lucide-react");
|
|
14020
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
14021
|
+
function FormBlock({ settings: schema, executeAction, componentId, className = "", onSuccess }) {
|
|
14022
|
+
const { showError, addToast } = useToast();
|
|
14023
|
+
const [formData, setFormData] = (0, import_react21.useState)({});
|
|
14024
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react21.useState)(false);
|
|
14025
|
+
const [isSubmitted, setIsSubmitted] = (0, import_react21.useState)(false);
|
|
14026
|
+
const [columns, setColumns] = (0, import_react21.useState)((schema == null ? void 0 : schema.columns) || []);
|
|
14027
|
+
const [isLoadingSchema, setIsLoadingSchema] = (0, import_react21.useState)(false);
|
|
14028
|
+
const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
14029
|
+
(0, import_react21.useEffect)(() => {
|
|
14030
|
+
let isMounted = true;
|
|
14031
|
+
if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction) {
|
|
14032
|
+
setIsLoadingSchema(true);
|
|
14033
|
+
executeAction("FETCH_TABLE_DATA", { tableId: targetTableId, limit: 1 }).then((res) => {
|
|
14034
|
+
var _a;
|
|
14035
|
+
if (!isMounted) return;
|
|
14036
|
+
const fetchedCols = ((_a = res == null ? void 0 : res.schema) == null ? void 0 : _a.columns) || (res == null ? void 0 : res.columns);
|
|
14037
|
+
if (fetchedCols && Array.isArray(fetchedCols)) {
|
|
14038
|
+
setColumns(fetchedCols);
|
|
14039
|
+
}
|
|
14040
|
+
}).catch((err) => {
|
|
14041
|
+
console.error("[FormBlock] Failed to fetch table schema:", err);
|
|
14042
|
+
}).finally(() => {
|
|
14043
|
+
if (isMounted) setIsLoadingSchema(false);
|
|
14044
|
+
});
|
|
14045
|
+
} else if (schema == null ? void 0 : schema.columns) {
|
|
14046
|
+
setColumns(schema.columns);
|
|
14047
|
+
}
|
|
14048
|
+
return () => {
|
|
14049
|
+
isMounted = false;
|
|
14050
|
+
};
|
|
14051
|
+
}, [schema == null ? void 0 : schema.columns, targetTableId]);
|
|
14052
|
+
const systemFields = ["_id", "id", "createdAt", "updatedAt", "orgId", "tableId"];
|
|
14053
|
+
const formColumns = (columns || []).filter(
|
|
14054
|
+
(col) => !systemFields.includes(col.name) && !col.isHidden
|
|
14055
|
+
).sort((a, b) => {
|
|
14056
|
+
var _a, _b;
|
|
14057
|
+
return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
|
|
14058
|
+
});
|
|
14059
|
+
const handleFieldChange = (colName, value) => {
|
|
14060
|
+
setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: value }));
|
|
14061
|
+
};
|
|
14062
|
+
const handleSubmit = async (e) => {
|
|
14063
|
+
e.preventDefault();
|
|
14064
|
+
if (!executeAction) {
|
|
14065
|
+
showError("\u05E8\u05DB\u05D9\u05D1 \u05D4\u05EA\u05E7\u05E9\u05D5\u05E8\u05EA \u05DC\u05D0 \u05D0\u05D5\u05EA\u05D7\u05DC", "\u05E9\u05D2\u05D9\u05D0\u05EA \u05DE\u05E2\u05E8\u05DB\u05EA");
|
|
14066
|
+
return;
|
|
14067
|
+
}
|
|
14068
|
+
if (!targetTableId) {
|
|
14069
|
+
showError("\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05DC\u05E9\u05DE\u05D5\u05E8: \u05DE\u05D6\u05D4\u05D4 \u05D4\u05D8\u05D1\u05DC\u05D4 \u05D7\u05E1\u05E8", "\u05E9\u05D2\u05D9\u05D0\u05EA \u05E9\u05DE\u05D9\u05E8\u05D4");
|
|
14070
|
+
return;
|
|
14071
|
+
}
|
|
14072
|
+
const missingFields = formColumns.filter(
|
|
14073
|
+
(col) => col.isRequired && (formData[col.name] === void 0 || formData[col.name] === null || formData[col.name] === "")
|
|
14074
|
+
);
|
|
14075
|
+
if (missingFields.length > 0) {
|
|
14076
|
+
showError(`\u05D9\u05E9 \u05DC\u05DE\u05DC\u05D0 \u05D0\u05EA \u05D4\u05E9\u05D3\u05D5\u05EA \u05D4\u05D1\u05D0\u05D9\u05DD: ${missingFields.map((c) => c.name).join(", ")}`, "\u05E9\u05D2\u05D9\u05D0\u05EA \u05D5\u05DC\u05D9\u05D3\u05E6\u05D9\u05D4");
|
|
14077
|
+
return;
|
|
14078
|
+
}
|
|
14079
|
+
setIsSubmitting(true);
|
|
14080
|
+
try {
|
|
14081
|
+
const formattedPayload = {};
|
|
14082
|
+
formColumns.forEach((col) => {
|
|
14083
|
+
var _a;
|
|
14084
|
+
let val = formData[col.name];
|
|
14085
|
+
if (val !== void 0 && val !== null) {
|
|
14086
|
+
if (((_a = col.type) == null ? void 0 : _a.toUpperCase()) === "NUMBER") {
|
|
14087
|
+
val = val === "" ? 0 : Number(val);
|
|
14088
|
+
}
|
|
14089
|
+
formattedPayload[col.name] = val;
|
|
14090
|
+
} else if (col.defaultValue !== void 0) {
|
|
14091
|
+
formattedPayload[col.name] = col.defaultValue;
|
|
14092
|
+
}
|
|
14093
|
+
});
|
|
14094
|
+
await executeAction("CREATE_RECORD", {
|
|
14095
|
+
tableId: targetTableId,
|
|
14096
|
+
tableMetaId: targetTableId,
|
|
14097
|
+
records: [formattedPayload]
|
|
14098
|
+
});
|
|
14099
|
+
addToast({ message: "\u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD \u05E0\u05E9\u05DE\u05E8\u05D5 \u05D1\u05D4\u05E6\u05DC\u05D7\u05D4", type: "success" });
|
|
14100
|
+
setFormData({});
|
|
14101
|
+
setIsSubmitted(true);
|
|
14102
|
+
if (onSuccess) onSuccess();
|
|
14103
|
+
} catch (err) {
|
|
14104
|
+
console.error("[FormBlock] Submit error:", err);
|
|
14105
|
+
showError((err == null ? void 0 : err.message) || String(err), "\u05E9\u05D2\u05D9\u05D0\u05D4 \u05D1\u05E9\u05DE\u05D9\u05E8\u05EA \u05D4\u05E0\u05EA\u05D5\u05E0\u05D9\u05DD");
|
|
14106
|
+
} finally {
|
|
14107
|
+
setIsSubmitting(false);
|
|
14108
|
+
}
|
|
14109
|
+
};
|
|
14110
|
+
if (isLoadingSchema) {
|
|
14111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "p-8 flex items-center justify-center gap-2 text-slate-500", children: [
|
|
14112
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react15.Loader2, { className: "w-5 h-5 animate-spin text-brand" }),
|
|
14113
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-sm", children: "\u05D8\u05D5\u05E2\u05DF \u05E9\u05D3\u05D5\u05EA \u05D8\u05D5\u05E4\u05E1..." })
|
|
14114
|
+
] });
|
|
14115
|
+
}
|
|
14116
|
+
if (!formColumns || formColumns.length === 0) {
|
|
14117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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." });
|
|
14118
|
+
}
|
|
14119
|
+
if (isSubmitted) {
|
|
14120
|
+
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.";
|
|
14121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { id: componentId, className: `bg-white p-8 rounded-xl shadow-xs border border-slate-200 text-center dir-rtl ${className}`, children: [
|
|
14122
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-16 h-16 bg-emerald-50 text-emerald-600 rounded-full flex items-center justify-center mx-auto mb-4 animate-in zoom-in duration-200", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react15.CheckCircle2, { className: "w-8 h-8" }) }),
|
|
14123
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "text-2xl font-bold text-slate-800 mb-2", children: "\u05D4\u05D5\u05D3\u05E2\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4" }),
|
|
14124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-slate-600 text-base max-w-md mx-auto whitespace-pre-wrap", children: customMessage }),
|
|
14125
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14126
|
+
"button",
|
|
14127
|
+
{
|
|
14128
|
+
type: "button",
|
|
14129
|
+
onClick: () => setIsSubmitted(false),
|
|
14130
|
+
className: "mt-6 px-4 py-2 text-xs font-semibold text-brand hover:underline cursor-pointer",
|
|
14131
|
+
children: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05DE\u05E2\u05E0\u05D4 \u05E0\u05D5\u05E1\u05E3"
|
|
14132
|
+
}
|
|
14133
|
+
)
|
|
14134
|
+
] });
|
|
14135
|
+
}
|
|
14136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { id: componentId, className: `bg-white p-6 rounded-xl shadow-xs border border-slate-200 dir-rtl ${className}`, children: [
|
|
14137
|
+
(schema == null ? void 0 : schema.title) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-xl font-bold text-slate-800 mb-6", children: schema.title }),
|
|
14138
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { onSubmit: handleSubmit, className: "space-y-4", children: [
|
|
14139
|
+
formColumns.map((col) => {
|
|
14140
|
+
var _a, _b;
|
|
14141
|
+
const colType = ((_a = col.type) == null ? void 0 : _a.toUpperCase()) || "DEFAULT";
|
|
14142
|
+
const InputComponent = FORM_INPUTS[colType] || FORM_INPUTS.DEFAULT;
|
|
14143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "text-sm font-semibold text-slate-700", children: [
|
|
14145
|
+
col.name,
|
|
14146
|
+
" ",
|
|
14147
|
+
col.isRequired && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
14148
|
+
] }),
|
|
14149
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border border-slate-200 rounded-lg min-h-[40px] relative", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
14150
|
+
InputComponent,
|
|
14151
|
+
{
|
|
14152
|
+
column: col,
|
|
14153
|
+
rowId: "new_form_record",
|
|
14154
|
+
value: (_b = formData[col.name]) != null ? _b : "",
|
|
14155
|
+
onChange: (val) => handleFieldChange(col.name, val),
|
|
14156
|
+
context: {
|
|
14157
|
+
executeAction,
|
|
14158
|
+
tableId: targetTableId
|
|
14159
|
+
}
|
|
14160
|
+
}
|
|
14161
|
+
) })
|
|
14162
|
+
] }, col.name);
|
|
14163
|
+
}),
|
|
14164
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "pt-4 border-t border-slate-100 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
14165
|
+
"button",
|
|
14166
|
+
{
|
|
14167
|
+
type: "submit",
|
|
14168
|
+
disabled: isSubmitting,
|
|
14169
|
+
className: "flex items-center gap-2 px-6 py.2.5 bg-brand hover:bg-brand-hover text-white font-bold rounded-lg shadow-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
|
|
14170
|
+
children: [
|
|
14171
|
+
isSubmitting && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react15.Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
14172
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: isSubmitting ? "\u05E9\u05D5\u05DE\u05E8..." : "\u05E9\u05DC\u05D9\u05D7\u05D4" })
|
|
14173
|
+
]
|
|
14174
|
+
}
|
|
14175
|
+
) })
|
|
14176
|
+
] })
|
|
14177
|
+
] });
|
|
14178
|
+
}
|
|
14179
|
+
|
|
13046
14180
|
// src/registry.ts
|
|
13047
14181
|
var UNIVERSE_COMPONENTS = {
|
|
13048
14182
|
TABLE: TableBlock,
|
|
13049
|
-
WHATSAPP: WhatsAppComponent
|
|
14183
|
+
WHATSAPP: WhatsAppComponent,
|
|
14184
|
+
FORM: FormBlock,
|
|
14185
|
+
PLACEMENT: PlacementBlock
|
|
13050
14186
|
};
|
|
13051
14187
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13052
14188
|
0 && (module.exports = {
|
|
@@ -13056,10 +14192,17 @@ var UNIVERSE_COMPONENTS = {
|
|
|
13056
14192
|
COLUMN_TYPE_LABELS,
|
|
13057
14193
|
ColumnHeaderTitle,
|
|
13058
14194
|
CreateTemplateModal,
|
|
14195
|
+
DEFAULT_PLACEMENT_STATUS_COLORS,
|
|
13059
14196
|
DatePickerCell,
|
|
13060
14197
|
DynamicFiltersBlock,
|
|
13061
14198
|
LinkPickerCell,
|
|
14199
|
+
NON_TEXT_TYPES,
|
|
13062
14200
|
PASTEL_PALETTES,
|
|
14201
|
+
PlacementBlock,
|
|
14202
|
+
PlacementSettings,
|
|
14203
|
+
PlacementStatusEditor,
|
|
14204
|
+
RELATION_LABEL_KEY,
|
|
14205
|
+
RELATION_SEP,
|
|
13063
14206
|
RelationFilterPopover,
|
|
13064
14207
|
RelationPickerCell,
|
|
13065
14208
|
SettingsAndActionsBlock,
|
|
@@ -13073,9 +14216,13 @@ var UNIVERSE_COMPONENTS = {
|
|
|
13073
14216
|
TruncatedTooltip,
|
|
13074
14217
|
UNIVERSE_COMPONENTS,
|
|
13075
14218
|
WhatsAppComponent,
|
|
14219
|
+
buildColumnOptions,
|
|
14220
|
+
buildRelationRef,
|
|
13076
14221
|
calculateMinColumnWidth,
|
|
13077
14222
|
checkElementTruncation,
|
|
13078
14223
|
cn,
|
|
14224
|
+
columnRefLabel,
|
|
14225
|
+
enrichRowsWithRelations,
|
|
13079
14226
|
extractUniqueVariableIndices,
|
|
13080
14227
|
extractVariableIndices,
|
|
13081
14228
|
findVariableAtPosition,
|
|
@@ -13096,6 +14243,7 @@ var UNIVERSE_COMPONENTS = {
|
|
|
13096
14243
|
isDuplicateTemplate,
|
|
13097
14244
|
isDuplicateTemplateName,
|
|
13098
14245
|
isTextRepresentable,
|
|
14246
|
+
isUserColumn,
|
|
13099
14247
|
isValidButtonPhoneNumber,
|
|
13100
14248
|
isValidButtonUrl,
|
|
13101
14249
|
isValidPhoneNumber,
|
|
@@ -13105,14 +14253,18 @@ var UNIVERSE_COMPONENTS = {
|
|
|
13105
14253
|
normalizePhoneForWhatsApp,
|
|
13106
14254
|
normalizeRelationValue,
|
|
13107
14255
|
openWhatsAppChat,
|
|
14256
|
+
parseColumnRef,
|
|
13108
14257
|
parseLinkValue,
|
|
13109
14258
|
parseTimeParts,
|
|
14259
|
+
readColumnValue,
|
|
13110
14260
|
reindexVariables,
|
|
14261
|
+
resolveDefaultStatusId,
|
|
13111
14262
|
resolveProtocol,
|
|
13112
14263
|
sanitizePhoneNumber,
|
|
13113
14264
|
sanitizeTemplateNameInput,
|
|
13114
14265
|
seamlessVariableEngine,
|
|
13115
14266
|
splitHeaderTitle,
|
|
14267
|
+
tableColumns,
|
|
13116
14268
|
useColumnReorder,
|
|
13117
14269
|
useColumnResize,
|
|
13118
14270
|
useSmartTooltip,
|