@universe-platform/ui 0.1.0-beta.33 → 0.1.0-beta.35
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 +62 -46
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1214 -899
- package/dist/index.mjs +1139 -833
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,6 +66,7 @@ __export(src_exports, {
|
|
|
66
66
|
COLUMN_TYPE_LABELS: () => COLUMN_TYPE_LABELS,
|
|
67
67
|
ColumnHeaderTitle: () => ColumnHeaderTitle,
|
|
68
68
|
CreateTemplateModal: () => CreateTemplateModal,
|
|
69
|
+
DEFAULT_FILTER_COLUMN_TYPES: () => DEFAULT_FILTER_COLUMN_TYPES,
|
|
69
70
|
DEFAULT_PLACEMENT_STATUS_COLORS: () => DEFAULT_PLACEMENT_STATUS_COLORS,
|
|
70
71
|
DatePickerCell: () => DatePickerCell,
|
|
71
72
|
DynamicFiltersBlock: () => DynamicFiltersBlock,
|
|
@@ -80,6 +81,7 @@ __export(src_exports, {
|
|
|
80
81
|
RELATION_BUTTON_COUNTS_ACTION: () => RELATION_BUTTON_COUNTS_ACTION,
|
|
81
82
|
RELATION_LABEL_KEY: () => RELATION_LABEL_KEY,
|
|
82
83
|
RELATION_SEP: () => RELATION_SEP,
|
|
84
|
+
RESOLVE_DEFAULT_FILTERS_ACTION: () => RESOLVE_DEFAULT_FILTERS_ACTION,
|
|
83
85
|
RelationFilterPopover: () => RelationFilterPopover,
|
|
84
86
|
RelationPickerCell: () => RelationPickerCell,
|
|
85
87
|
SettingsAndActionsBlock: () => SettingsAndActionsBlock,
|
|
@@ -100,6 +102,7 @@ __export(src_exports, {
|
|
|
100
102
|
buildRelationRef: () => buildRelationRef,
|
|
101
103
|
calculateMinColumnWidth: () => calculateMinColumnWidth,
|
|
102
104
|
checkElementTruncation: () => checkElementTruncation,
|
|
105
|
+
cleanPlacementFilterDefaults: () => cleanPlacementFilterDefaults,
|
|
103
106
|
cn: () => cn,
|
|
104
107
|
columnRefLabel: () => columnRefLabel,
|
|
105
108
|
computeFormulaValue: () => computeFormulaValue,
|
|
@@ -115,6 +118,8 @@ __export(src_exports, {
|
|
|
115
118
|
formatTimeInput: () => formatTimeInput,
|
|
116
119
|
formatTimeIso: () => formatTimeIso,
|
|
117
120
|
generateWhatsAppLink: () => generateWhatsAppLink,
|
|
121
|
+
getColumnDefaultFilter: () => getColumnDefaultFilter,
|
|
122
|
+
getDefaultFilterColumns: () => getDefaultFilterColumns,
|
|
118
123
|
getDeterministicPastelBadge: () => getDeterministicPastelBadge,
|
|
119
124
|
getEligibleCopyTargets: () => getEligibleCopyTargets,
|
|
120
125
|
getNextVariableIndex: () => getNextVariableIndex,
|
|
@@ -150,11 +155,14 @@ __export(src_exports, {
|
|
|
150
155
|
renameCopyTarget: () => renameCopyTarget,
|
|
151
156
|
resolveDefaultStatusId: () => resolveDefaultStatusId,
|
|
152
157
|
resolveProtocol: () => resolveProtocol,
|
|
158
|
+
sanitizeDefaultFilter: () => sanitizeDefaultFilter,
|
|
153
159
|
sanitizePhoneNumber: () => sanitizePhoneNumber,
|
|
154
160
|
sanitizeTemplateNameInput: () => sanitizeTemplateNameInput,
|
|
155
161
|
seamlessVariableEngine: () => seamlessVariableEngine,
|
|
156
162
|
splitHeaderTitle: () => splitHeaderTitle,
|
|
163
|
+
supportsDefaultFilter: () => supportsDefaultFilter,
|
|
157
164
|
tableColumns: () => tableColumns,
|
|
165
|
+
toColumnFilterValue: () => toColumnFilterValue,
|
|
158
166
|
useColumnReorder: () => useColumnReorder,
|
|
159
167
|
useColumnResize: () => useColumnResize,
|
|
160
168
|
useSmartTooltip: () => useSmartTooltip,
|
|
@@ -166,7 +174,8 @@ __export(src_exports, {
|
|
|
166
174
|
validateTemplateBody: () => validateTemplateBody,
|
|
167
175
|
validateTemplateButtons: () => validateTemplateButtons,
|
|
168
176
|
validateWhatsAppTemplate: () => validateWhatsAppTemplate,
|
|
169
|
-
validateWordToVariableRatio: () => validateWordToVariableRatio
|
|
177
|
+
validateWordToVariableRatio: () => validateWordToVariableRatio,
|
|
178
|
+
withDefaultFilter: () => withDefaultFilter
|
|
170
179
|
});
|
|
171
180
|
module.exports = __toCommonJS(src_exports);
|
|
172
181
|
|
|
@@ -1203,8 +1212,57 @@ function getRelationButtonColumns(columns) {
|
|
|
1203
1212
|
return (columns || []).filter((c) => isRelationButtonsColumn(c) && c.name !== "_id");
|
|
1204
1213
|
}
|
|
1205
1214
|
|
|
1215
|
+
// ../shared/src/defaultFilters.ts
|
|
1216
|
+
var DEFAULT_FILTER_COLUMN_TYPES = ["STRING", "RELATION"];
|
|
1217
|
+
var RESOLVE_DEFAULT_FILTERS_ACTION = "RESOLVE_DEFAULT_FILTERS";
|
|
1218
|
+
var isString = (v) => typeof v === "string";
|
|
1219
|
+
function supportsDefaultFilter(type) {
|
|
1220
|
+
if (!type) return false;
|
|
1221
|
+
return DEFAULT_FILTER_COLUMN_TYPES.includes(String(type).toUpperCase());
|
|
1222
|
+
}
|
|
1223
|
+
function sanitizeDefaultFilter(raw) {
|
|
1224
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1225
|
+
const value = raw.value;
|
|
1226
|
+
if (!isString(value) || value.trim() === "") return null;
|
|
1227
|
+
const label = raw.label;
|
|
1228
|
+
return __spreadValues({ value: value.trim() }, isString(label) && label.trim() ? { label: label.trim() } : {});
|
|
1229
|
+
}
|
|
1230
|
+
function getColumnDefaultFilter(col) {
|
|
1231
|
+
var _a;
|
|
1232
|
+
if (!col || !supportsDefaultFilter(col.type)) return null;
|
|
1233
|
+
return sanitizeDefaultFilter((_a = col.config) == null ? void 0 : _a.defaultFilter);
|
|
1234
|
+
}
|
|
1235
|
+
function getDefaultFilterColumns(columns) {
|
|
1236
|
+
const out = [];
|
|
1237
|
+
for (const c of columns || []) {
|
|
1238
|
+
if (!(c == null ? void 0 : c.name) || c.name === "_id") continue;
|
|
1239
|
+
const setting = getColumnDefaultFilter(c);
|
|
1240
|
+
if (setting) out.push({ name: c.name, type: String(c.type).toUpperCase(), setting });
|
|
1241
|
+
}
|
|
1242
|
+
return out;
|
|
1243
|
+
}
|
|
1244
|
+
function toColumnFilterValue(type, value) {
|
|
1245
|
+
return String(type).toUpperCase() === "RELATION" ? [value] : value;
|
|
1246
|
+
}
|
|
1247
|
+
function withDefaultFilter(config, type, setting) {
|
|
1248
|
+
const next = __spreadValues({}, config || {});
|
|
1249
|
+
const clean = supportsDefaultFilter(type) ? sanitizeDefaultFilter(setting) : null;
|
|
1250
|
+
if (clean) next.defaultFilter = clean;
|
|
1251
|
+
else delete next.defaultFilter;
|
|
1252
|
+
return next;
|
|
1253
|
+
}
|
|
1254
|
+
function cleanPlacementFilterDefaults(defaults, allowedKeys) {
|
|
1255
|
+
if (!defaults || typeof defaults !== "object") return void 0;
|
|
1256
|
+
const out = {};
|
|
1257
|
+
for (const key of allowedKeys) {
|
|
1258
|
+
const v = defaults[key];
|
|
1259
|
+
if (key && isString(v) && v.trim() !== "") out[key] = v;
|
|
1260
|
+
}
|
|
1261
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1206
1264
|
// src/components/TableBlock/TableBlockClient.tsx
|
|
1207
|
-
var
|
|
1265
|
+
var import_react18 = __toESM(require("react"));
|
|
1208
1266
|
|
|
1209
1267
|
// src/hooks/useToast.ts
|
|
1210
1268
|
var import_react2 = require("react");
|
|
@@ -6245,6 +6303,49 @@ function RelationButtonsBar({
|
|
|
6245
6303
|
);
|
|
6246
6304
|
}
|
|
6247
6305
|
|
|
6306
|
+
// src/components/TableBlock/useDefaultColumnFilters.ts
|
|
6307
|
+
var import_react17 = require("react");
|
|
6308
|
+
var RESOLVE_TIMEOUT_MS = 8e3;
|
|
6309
|
+
function unwrap2(res) {
|
|
6310
|
+
const body = (res == null ? void 0 : res.data) && typeof res.data === "object" && !Array.isArray(res.data) ? res.data : res;
|
|
6311
|
+
const filters = body == null ? void 0 : body.filters;
|
|
6312
|
+
return filters && typeof filters === "object" ? filters : {};
|
|
6313
|
+
}
|
|
6314
|
+
function useDefaultColumnFilters({ columns, tableId, executeAction, onResolved }) {
|
|
6315
|
+
const hasDefaults = getDefaultFilterColumns(columns).length > 0;
|
|
6316
|
+
const [ready, setReady] = (0, import_react17.useState)(() => !hasDefaults);
|
|
6317
|
+
const doneRef = (0, import_react17.useRef)(false);
|
|
6318
|
+
const onResolvedRef = (0, import_react17.useRef)(onResolved);
|
|
6319
|
+
onResolvedRef.current = onResolved;
|
|
6320
|
+
const actionRef = (0, import_react17.useRef)(executeAction);
|
|
6321
|
+
actionRef.current = executeAction;
|
|
6322
|
+
(0, import_react17.useEffect)(() => {
|
|
6323
|
+
if (doneRef.current || !hasDefaults) return;
|
|
6324
|
+
doneRef.current = true;
|
|
6325
|
+
const exec = actionRef.current;
|
|
6326
|
+
if (!tableId || !exec) {
|
|
6327
|
+
setReady(true);
|
|
6328
|
+
return;
|
|
6329
|
+
}
|
|
6330
|
+
let settled = false;
|
|
6331
|
+
const finish = (filters) => {
|
|
6332
|
+
if (settled) return;
|
|
6333
|
+
settled = true;
|
|
6334
|
+
if (filters && Object.keys(filters).length > 0) onResolvedRef.current(filters);
|
|
6335
|
+
setReady(true);
|
|
6336
|
+
};
|
|
6337
|
+
const timer = setTimeout(() => finish(), RESOLVE_TIMEOUT_MS);
|
|
6338
|
+
Promise.resolve(exec(RESOLVE_DEFAULT_FILTERS_ACTION, { tableId })).then(
|
|
6339
|
+
(res) => finish(unwrap2(res)),
|
|
6340
|
+
(err) => {
|
|
6341
|
+
console.warn("[TableBlock] Failed to resolve default filters:", err);
|
|
6342
|
+
finish();
|
|
6343
|
+
}
|
|
6344
|
+
).finally(() => clearTimeout(timer));
|
|
6345
|
+
}, [hasDefaults, tableId]);
|
|
6346
|
+
return ready;
|
|
6347
|
+
}
|
|
6348
|
+
|
|
6248
6349
|
// src/components/TableBlock/TableBlockClient.tsx
|
|
6249
6350
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
6250
6351
|
function TableBlockClient({
|
|
@@ -6273,7 +6374,7 @@ function TableBlockClient({
|
|
|
6273
6374
|
hideRelationButtons
|
|
6274
6375
|
}) {
|
|
6275
6376
|
const { showError, addToast } = useToast();
|
|
6276
|
-
const [isExporting, setIsExporting] = (0,
|
|
6377
|
+
const [isExporting, setIsExporting] = (0, import_react18.useState)(false);
|
|
6277
6378
|
const resolvedRole = role ? getRolePermissions(role) : void 0;
|
|
6278
6379
|
const effectivePermissions = permissions || (resolvedRole == null ? void 0 : resolvedRole.permissions) || {
|
|
6279
6380
|
canCreate: !readOnly,
|
|
@@ -6292,18 +6393,18 @@ function TableBlockClient({
|
|
|
6292
6393
|
return calculateMinColumnWidth(colName, false, col == null ? void 0 : col.type);
|
|
6293
6394
|
}
|
|
6294
6395
|
});
|
|
6295
|
-
const executeActionRef = (0,
|
|
6296
|
-
(0,
|
|
6396
|
+
const executeActionRef = (0, import_react18.useRef)(executeAction);
|
|
6397
|
+
(0, import_react18.useEffect)(() => {
|
|
6297
6398
|
executeActionRef.current = executeAction;
|
|
6298
6399
|
}, [executeAction]);
|
|
6299
|
-
const [isMounted, setIsMounted] = (0,
|
|
6300
|
-
const [isInitialLoading, setIsInitialLoading] = (0,
|
|
6301
|
-
const [page, setPage] = (0,
|
|
6302
|
-
const [limit, setLimit] = (0,
|
|
6303
|
-
const [totalRecords, setTotalRecords] = (0,
|
|
6304
|
-
const [totalPages, setTotalPages] = (0,
|
|
6305
|
-
const [showSummary, setShowSummary] = (0,
|
|
6306
|
-
(0,
|
|
6400
|
+
const [isMounted, setIsMounted] = (0, import_react18.useState)(false);
|
|
6401
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react18.useState)(true);
|
|
6402
|
+
const [page, setPage] = (0, import_react18.useState)(1);
|
|
6403
|
+
const [limit, setLimit] = (0, import_react18.useState)(50);
|
|
6404
|
+
const [totalRecords, setTotalRecords] = (0, import_react18.useState)(0);
|
|
6405
|
+
const [totalPages, setTotalPages] = (0, import_react18.useState)(1);
|
|
6406
|
+
const [showSummary, setShowSummary] = (0, import_react18.useState)(false);
|
|
6407
|
+
(0, import_react18.useEffect)(() => {
|
|
6307
6408
|
if (typeof window !== "undefined") {
|
|
6308
6409
|
const savedSummary = localStorage.getItem(`table_summary_${tableKey}`);
|
|
6309
6410
|
if (savedSummary !== null) {
|
|
@@ -6352,7 +6453,7 @@ function TableBlockClient({
|
|
|
6352
6453
|
return __spreadProps(__spreadValues({}, row), { id: String(row.id || ""), data: rowData });
|
|
6353
6454
|
});
|
|
6354
6455
|
};
|
|
6355
|
-
const mergeColumnDefs = (0,
|
|
6456
|
+
const mergeColumnDefs = (0, import_react18.useCallback)((existingCols, incomingCols) => {
|
|
6356
6457
|
if (!incomingCols || incomingCols.length === 0) return existingCols || [];
|
|
6357
6458
|
if (!existingCols || existingCols.length === 0) return incomingCols;
|
|
6358
6459
|
const existingMap = new Map(existingCols.map((c) => [c.name, c]));
|
|
@@ -6372,18 +6473,18 @@ function TableBlockClient({
|
|
|
6372
6473
|
return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
|
|
6373
6474
|
});
|
|
6374
6475
|
}, []);
|
|
6375
|
-
const [localColumns, setLocalColumns] = (0,
|
|
6376
|
-
(0,
|
|
6476
|
+
const [localColumns, setLocalColumns] = (0, import_react18.useState)(() => (schema == null ? void 0 : schema.columns) || []);
|
|
6477
|
+
(0, import_react18.useEffect)(() => {
|
|
6377
6478
|
if ((schema == null ? void 0 : schema.columns) && schema.columns.length > 0) {
|
|
6378
6479
|
setLocalColumns((prev) => mergeColumnDefs(prev, schema.columns));
|
|
6379
6480
|
}
|
|
6380
6481
|
}, [schema == null ? void 0 : schema.columns, mergeColumnDefs]);
|
|
6381
|
-
const [dirty, setDirty] = (0,
|
|
6382
|
-
const dirtyRef = (0,
|
|
6383
|
-
(0,
|
|
6482
|
+
const [dirty, setDirty] = (0, import_react18.useState)({ added: [], modified: {}, deleted: [] });
|
|
6483
|
+
const dirtyRef = (0, import_react18.useRef)(dirty);
|
|
6484
|
+
(0, import_react18.useEffect)(() => {
|
|
6384
6485
|
dirtyRef.current = dirty;
|
|
6385
6486
|
}, [dirty]);
|
|
6386
|
-
const mergeWithDirty = (0,
|
|
6487
|
+
const mergeWithDirty = (0, import_react18.useCallback)((baseRecords) => {
|
|
6387
6488
|
const { added, modified, deleted } = dirtyRef.current;
|
|
6388
6489
|
const nonDeleted = (baseRecords || []).filter((r) => !deleted.includes(r.id));
|
|
6389
6490
|
const modifiedRecords = nonDeleted.map((r) => {
|
|
@@ -6396,8 +6497,8 @@ function TableBlockClient({
|
|
|
6396
6497
|
const uniqueAdded = added.filter((r) => !baseIds.has(r.id));
|
|
6397
6498
|
return [...uniqueAdded, ...modifiedRecords];
|
|
6398
6499
|
}, []);
|
|
6399
|
-
const [data, setData] = (0,
|
|
6400
|
-
const [serverRecords, setServerRecords] = (0,
|
|
6500
|
+
const [data, setData] = (0, import_react18.useState)(() => normalizeRecords(initialRecords));
|
|
6501
|
+
const [serverRecords, setServerRecords] = (0, import_react18.useState)(() => normalizeRecords(initialRecords));
|
|
6401
6502
|
const filteredData = data;
|
|
6402
6503
|
const isEqualValues = (a, b) => {
|
|
6403
6504
|
if (a === b) return true;
|
|
@@ -6409,30 +6510,30 @@ function TableBlockClient({
|
|
|
6409
6510
|
}
|
|
6410
6511
|
return false;
|
|
6411
6512
|
};
|
|
6412
|
-
const [baseRecordsMap, setBaseRecordsMap] = (0,
|
|
6513
|
+
const [baseRecordsMap, setBaseRecordsMap] = (0, import_react18.useState)(() => {
|
|
6413
6514
|
const map = /* @__PURE__ */ new Map();
|
|
6414
6515
|
(normalizeRecords(initialRecords) || []).forEach((r) => map.set(r.id, __spreadValues({}, r.data)));
|
|
6415
6516
|
return map;
|
|
6416
6517
|
});
|
|
6417
|
-
(0,
|
|
6518
|
+
(0, import_react18.useEffect)(() => {
|
|
6418
6519
|
if (initialRecords && initialRecords.length > 0) {
|
|
6419
6520
|
const map = /* @__PURE__ */ new Map();
|
|
6420
6521
|
(normalizeRecords(initialRecords) || []).forEach((r) => map.set(r.id, __spreadValues({}, r.data)));
|
|
6421
6522
|
setBaseRecordsMap(map);
|
|
6422
6523
|
}
|
|
6423
6524
|
}, [initialRecords]);
|
|
6424
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
6425
|
-
const [columnFilters, setColumnFilters] = (0,
|
|
6426
|
-
const [activeSearchCol, setActiveSearchCol] = (0,
|
|
6427
|
-
const activeSearchRef = (0,
|
|
6428
|
-
const [activeRelationCol, setActiveRelationCol] = (0,
|
|
6429
|
-
const [relationTriggerRect, setRelationTriggerRect] = (0,
|
|
6430
|
-
const filterButtonRefs = (0,
|
|
6431
|
-
const [relationOptions, setRelationOptions] = (0,
|
|
6432
|
-
const [relationFilterOptions, setRelationFilterOptions] = (0,
|
|
6433
|
-
const [loadingFilterCol, setLoadingFilterCol] = (0,
|
|
6434
|
-
const relationDictionaryRef = (0,
|
|
6435
|
-
const mergeRelationOptions = (0,
|
|
6525
|
+
const [searchQuery, setSearchQuery] = (0, import_react18.useState)("");
|
|
6526
|
+
const [columnFilters, setColumnFilters] = (0, import_react18.useState)({});
|
|
6527
|
+
const [activeSearchCol, setActiveSearchCol] = (0, import_react18.useState)(null);
|
|
6528
|
+
const activeSearchRef = (0, import_react18.useRef)(null);
|
|
6529
|
+
const [activeRelationCol, setActiveRelationCol] = (0, import_react18.useState)(null);
|
|
6530
|
+
const [relationTriggerRect, setRelationTriggerRect] = (0, import_react18.useState)(null);
|
|
6531
|
+
const filterButtonRefs = (0, import_react18.useRef)({});
|
|
6532
|
+
const [relationOptions, setRelationOptions] = (0, import_react18.useState)({});
|
|
6533
|
+
const [relationFilterOptions, setRelationFilterOptions] = (0, import_react18.useState)({});
|
|
6534
|
+
const [loadingFilterCol, setLoadingFilterCol] = (0, import_react18.useState)(null);
|
|
6535
|
+
const relationDictionaryRef = (0, import_react18.useRef)({});
|
|
6536
|
+
const mergeRelationOptions = (0, import_react18.useCallback)((colName, newOptions) => {
|
|
6436
6537
|
if (!Array.isArray(newOptions) || newOptions.length === 0) return;
|
|
6437
6538
|
if (!relationDictionaryRef.current[colName]) {
|
|
6438
6539
|
relationDictionaryRef.current[colName] = /* @__PURE__ */ new Map();
|
|
@@ -6455,7 +6556,7 @@ function TableBlockClient({
|
|
|
6455
6556
|
}));
|
|
6456
6557
|
}
|
|
6457
6558
|
}, []);
|
|
6458
|
-
(0,
|
|
6559
|
+
(0, import_react18.useEffect)(() => {
|
|
6459
6560
|
if (!activeSearchCol) return;
|
|
6460
6561
|
const handleMouseDown = (e) => {
|
|
6461
6562
|
if (activeSearchRef.current && !activeSearchRef.current.contains(e.target)) {
|
|
@@ -6467,7 +6568,7 @@ function TableBlockClient({
|
|
|
6467
6568
|
document.removeEventListener("mousedown", handleMouseDown);
|
|
6468
6569
|
};
|
|
6469
6570
|
}, [activeSearchCol]);
|
|
6470
|
-
const filtersKey = (0,
|
|
6571
|
+
const filtersKey = (0, import_react18.useMemo)(() => {
|
|
6471
6572
|
const active = {};
|
|
6472
6573
|
Object.entries(columnFilters).forEach(([k, v]) => {
|
|
6473
6574
|
if (Array.isArray(v) && v.length > 0) active[k] = v;
|
|
@@ -6476,24 +6577,30 @@ function TableBlockClient({
|
|
|
6476
6577
|
});
|
|
6477
6578
|
return JSON.stringify(active);
|
|
6478
6579
|
}, [columnFilters]);
|
|
6479
|
-
const
|
|
6480
|
-
|
|
6580
|
+
const defaultFiltersReady = useDefaultColumnFilters({
|
|
6581
|
+
columns: localColumns,
|
|
6582
|
+
tableId: (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id),
|
|
6583
|
+
executeAction,
|
|
6584
|
+
onResolved: (resolved) => setColumnFilters((prev) => __spreadValues(__spreadValues({}, resolved), prev))
|
|
6585
|
+
});
|
|
6586
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react18.useState)(searchQuery);
|
|
6587
|
+
(0, import_react18.useEffect)(() => {
|
|
6481
6588
|
const timer = setTimeout(() => {
|
|
6482
6589
|
setDebouncedSearch(searchQuery.trim());
|
|
6483
6590
|
}, 300);
|
|
6484
6591
|
return () => clearTimeout(timer);
|
|
6485
6592
|
}, [searchQuery]);
|
|
6486
|
-
const isSearchMountedRef = (0,
|
|
6487
|
-
(0,
|
|
6593
|
+
const isSearchMountedRef = (0, import_react18.useRef)(false);
|
|
6594
|
+
(0, import_react18.useEffect)(() => {
|
|
6488
6595
|
if (!isSearchMountedRef.current) {
|
|
6489
6596
|
isSearchMountedRef.current = true;
|
|
6490
6597
|
return;
|
|
6491
6598
|
}
|
|
6492
6599
|
setPage(1);
|
|
6493
6600
|
}, [debouncedSearch]);
|
|
6494
|
-
const [isFetching, setIsFetching] = (0,
|
|
6495
|
-
const fetchRequestIdRef = (0,
|
|
6496
|
-
const fetchTableData = (0,
|
|
6601
|
+
const [isFetching, setIsFetching] = (0, import_react18.useState)(false);
|
|
6602
|
+
const fetchRequestIdRef = (0, import_react18.useRef)(0);
|
|
6603
|
+
const fetchTableData = (0, import_react18.useCallback)((targetPage, targetLimit, targetSearch, targetFiltersKey) => {
|
|
6497
6604
|
const tableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
6498
6605
|
const action = executeActionRef.current;
|
|
6499
6606
|
if (!tableId || !action) {
|
|
@@ -6617,11 +6724,12 @@ function TableBlockClient({
|
|
|
6617
6724
|
}
|
|
6618
6725
|
});
|
|
6619
6726
|
}, [schema == null ? void 0 : schema.tableMetaId, schema == null ? void 0 : schema.tableId, schema == null ? void 0 : schema.id, mergeColumnDefs, mergeWithDirty, mergeRelationOptions]);
|
|
6620
|
-
(0,
|
|
6727
|
+
(0, import_react18.useEffect)(() => {
|
|
6728
|
+
if (!defaultFiltersReady) return;
|
|
6621
6729
|
fetchTableData(page, limit, debouncedSearch, filtersKey);
|
|
6622
|
-
}, [page, limit, debouncedSearch, filtersKey, fetchTableData]);
|
|
6623
|
-
(0,
|
|
6624
|
-
if (initialRecords) {
|
|
6730
|
+
}, [page, limit, debouncedSearch, filtersKey, fetchTableData, defaultFiltersReady]);
|
|
6731
|
+
(0, import_react18.useEffect)(() => {
|
|
6732
|
+
if (initialRecords && defaultFiltersReady) {
|
|
6625
6733
|
const norm = normalizeRecords(initialRecords);
|
|
6626
6734
|
setServerRecords(norm);
|
|
6627
6735
|
const hasActiveFilters = Boolean(debouncedSearch) || Object.keys(columnFilters).length > 0;
|
|
@@ -6682,11 +6790,11 @@ function TableBlockClient({
|
|
|
6682
6790
|
setData(mergeWithDirty(norm));
|
|
6683
6791
|
}
|
|
6684
6792
|
}
|
|
6685
|
-
}, [initialRecords, mergeWithDirty, debouncedSearch, columnFilters, fetchTableData, page, limit, filtersKey]);
|
|
6686
|
-
const refetchTableData = (0,
|
|
6793
|
+
}, [initialRecords, mergeWithDirty, debouncedSearch, columnFilters, fetchTableData, page, limit, filtersKey, defaultFiltersReady]);
|
|
6794
|
+
const refetchTableData = (0, import_react18.useCallback)(() => {
|
|
6687
6795
|
return fetchTableData(page, limit, debouncedSearch, filtersKey);
|
|
6688
6796
|
}, [page, limit, debouncedSearch, filtersKey, fetchTableData]);
|
|
6689
|
-
const handleApplyColumnFilter = (0,
|
|
6797
|
+
const handleApplyColumnFilter = (0, import_react18.useCallback)((colName, nextVal) => {
|
|
6690
6798
|
setColumnFilters((prev) => {
|
|
6691
6799
|
const next = __spreadValues({}, prev);
|
|
6692
6800
|
if (nextVal === void 0 || Array.isArray(nextVal) && nextVal.length === 0 || typeof nextVal === "string" && !nextVal.trim() || typeof nextVal === "object" && "values" in nextVal && Array.isArray(nextVal.values) && nextVal.values.length === 0) {
|
|
@@ -6711,9 +6819,9 @@ function TableBlockClient({
|
|
|
6711
6819
|
const handleNextPage = () => {
|
|
6712
6820
|
setPage((prev) => Math.min(totalPages, prev + 1));
|
|
6713
6821
|
};
|
|
6714
|
-
const [selectedIds, setSelectedIds] = (0,
|
|
6715
|
-
const isExternalSyncRef = (0,
|
|
6716
|
-
(0,
|
|
6822
|
+
const [selectedIds, setSelectedIds] = (0, import_react18.useState)(/* @__PURE__ */ new Set());
|
|
6823
|
+
const isExternalSyncRef = (0, import_react18.useRef)(false);
|
|
6824
|
+
(0, import_react18.useEffect)(() => {
|
|
6717
6825
|
if (selectedRowIds !== void 0) {
|
|
6718
6826
|
const nextSet = new Set(selectedRowIds);
|
|
6719
6827
|
setSelectedIds((prev) => {
|
|
@@ -6725,8 +6833,8 @@ function TableBlockClient({
|
|
|
6725
6833
|
});
|
|
6726
6834
|
}
|
|
6727
6835
|
}, [selectedRowIds]);
|
|
6728
|
-
const isFirstSelectionChangeRef = (0,
|
|
6729
|
-
(0,
|
|
6836
|
+
const isFirstSelectionChangeRef = (0, import_react18.useRef)(true);
|
|
6837
|
+
(0, import_react18.useEffect)(() => {
|
|
6730
6838
|
if (isFirstSelectionChangeRef.current) {
|
|
6731
6839
|
isFirstSelectionChangeRef.current = false;
|
|
6732
6840
|
if (selectedIds.size === 0) return;
|
|
@@ -6737,13 +6845,13 @@ function TableBlockClient({
|
|
|
6737
6845
|
}
|
|
6738
6846
|
onSelectionChange == null ? void 0 : onSelectionChange(Array.from(selectedIds));
|
|
6739
6847
|
}, [selectedIds, onSelectionChange]);
|
|
6740
|
-
const [pendingDeletions, setPendingDeletions] = (0,
|
|
6741
|
-
const [isSaving, setIsSaving] = (0,
|
|
6848
|
+
const [pendingDeletions, setPendingDeletions] = (0, import_react18.useState)([]);
|
|
6849
|
+
const [isSaving, setIsSaving] = (0, import_react18.useState)(false);
|
|
6742
6850
|
const isUpdatingActive = Boolean(isUpdating || isSaving);
|
|
6743
|
-
const [isSaveSuccess, setIsSaveSuccess] = (0,
|
|
6744
|
-
const [expandedRowIds, setExpandedRowIds] = (0,
|
|
6745
|
-
const schemaColsString = (0,
|
|
6746
|
-
const refetchRelation = (0,
|
|
6851
|
+
const [isSaveSuccess, setIsSaveSuccess] = (0, import_react18.useState)(false);
|
|
6852
|
+
const [expandedRowIds, setExpandedRowIds] = (0, import_react18.useState)(/* @__PURE__ */ new Set());
|
|
6853
|
+
const schemaColsString = (0, import_react18.useMemo)(() => JSON.stringify(localColumns || []), [localColumns]);
|
|
6854
|
+
const refetchRelation = (0, import_react18.useCallback)(async (colName, params) => {
|
|
6747
6855
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
6748
6856
|
let parsedCols = [];
|
|
6749
6857
|
try {
|
|
@@ -6782,7 +6890,7 @@ function TableBlockClient({
|
|
|
6782
6890
|
}
|
|
6783
6891
|
return [];
|
|
6784
6892
|
}, [schemaColsString, executeAction, mergeRelationOptions]);
|
|
6785
|
-
const fetchRelationFilterOptions = (0,
|
|
6893
|
+
const fetchRelationFilterOptions = (0, import_react18.useCallback)(async (colName) => {
|
|
6786
6894
|
var _a;
|
|
6787
6895
|
let parsedCols = [];
|
|
6788
6896
|
try {
|
|
@@ -6818,8 +6926,8 @@ function TableBlockClient({
|
|
|
6818
6926
|
setLoadingFilterCol(null);
|
|
6819
6927
|
}
|
|
6820
6928
|
}, [schemaColsString, schema == null ? void 0 : schema.tableMetaId, schema == null ? void 0 : schema.tableId, schema == null ? void 0 : schema.id, executeAction, mergeRelationOptions]);
|
|
6821
|
-
const requestedRelationIdsRef = (0,
|
|
6822
|
-
(0,
|
|
6929
|
+
const requestedRelationIdsRef = (0, import_react18.useRef)({});
|
|
6930
|
+
(0, import_react18.useEffect)(() => {
|
|
6823
6931
|
if (!executeAction || !data || data.length === 0) return;
|
|
6824
6932
|
let parsedCols = [];
|
|
6825
6933
|
try {
|
|
@@ -6872,7 +6980,7 @@ function TableBlockClient({
|
|
|
6872
6980
|
}
|
|
6873
6981
|
});
|
|
6874
6982
|
}, [data, schemaColsString, executeAction, relationOptions, mergeRelationOptions]);
|
|
6875
|
-
(0,
|
|
6983
|
+
(0, import_react18.useEffect)(() => {
|
|
6876
6984
|
let parsedCols = [];
|
|
6877
6985
|
try {
|
|
6878
6986
|
parsedCols = JSON.parse(schemaColsString);
|
|
@@ -6886,7 +6994,7 @@ function TableBlockClient({
|
|
|
6886
6994
|
refetchRelation(col.name);
|
|
6887
6995
|
});
|
|
6888
6996
|
}, [schemaColsString, refetchRelation]);
|
|
6889
|
-
const normalizedColumns = (0,
|
|
6997
|
+
const normalizedColumns = (0, import_react18.useMemo)(() => {
|
|
6890
6998
|
return (localColumns || []).map((col, idx) => {
|
|
6891
6999
|
const isRequired = col.isRequired === true || String(col.isRequired) === "true";
|
|
6892
7000
|
const isUnique = col.isUnique === true || String(col.isUnique) === "true";
|
|
@@ -6900,17 +7008,17 @@ function TableBlockClient({
|
|
|
6900
7008
|
return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
|
|
6901
7009
|
});
|
|
6902
7010
|
}, [localColumns]);
|
|
6903
|
-
const filteredColumns = (0,
|
|
7011
|
+
const filteredColumns = (0, import_react18.useMemo)(() => {
|
|
6904
7012
|
const systemFields = ["_id", "createdAt", "updatedAt", "orgId", "tableId"];
|
|
6905
7013
|
return normalizedColumns.filter((col) => !systemFields.includes(col.name) && !col.isHidden);
|
|
6906
7014
|
}, [normalizedColumns]);
|
|
6907
|
-
const customizableColumns = (0,
|
|
7015
|
+
const customizableColumns = (0, import_react18.useMemo)(() => {
|
|
6908
7016
|
const systemFields = ["_id", "createdAt", "updatedAt", "orgId", "tableId"];
|
|
6909
7017
|
return normalizedColumns.filter((col) => !systemFields.includes(col.name));
|
|
6910
7018
|
}, [normalizedColumns]);
|
|
6911
|
-
const [isColumnsDropdownOpen, setIsColumnsDropdownOpen] = (0,
|
|
6912
|
-
const dropdownRef = (0,
|
|
6913
|
-
(0,
|
|
7019
|
+
const [isColumnsDropdownOpen, setIsColumnsDropdownOpen] = (0, import_react18.useState)(false);
|
|
7020
|
+
const dropdownRef = (0, import_react18.useRef)(null);
|
|
7021
|
+
(0, import_react18.useEffect)(() => {
|
|
6914
7022
|
const handleClickOutside = (e) => {
|
|
6915
7023
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
6916
7024
|
setIsColumnsDropdownOpen(false);
|
|
@@ -7120,7 +7228,7 @@ function TableBlockClient({
|
|
|
7120
7228
|
setData((prev) => [newRow, ...prev]);
|
|
7121
7229
|
setDirty((prev) => __spreadProps(__spreadValues({}, prev), { added: [newRow, ...prev.added] }));
|
|
7122
7230
|
};
|
|
7123
|
-
const handleCellChange = (0,
|
|
7231
|
+
const handleCellChange = (0, import_react18.useCallback)((rowId, colName, value) => {
|
|
7124
7232
|
setData((prev) => prev.map(
|
|
7125
7233
|
(row) => row.id === rowId ? __spreadProps(__spreadValues({}, row), { data: __spreadProps(__spreadValues({}, row.data), { [colName]: value }) }) : row
|
|
7126
7234
|
));
|
|
@@ -7153,13 +7261,13 @@ function TableBlockClient({
|
|
|
7153
7261
|
});
|
|
7154
7262
|
}, [baseRecordsMap]);
|
|
7155
7263
|
const handleCellChangeWithCopy = useRelationCopyHandler({ columns: localColumns, handleCellChange });
|
|
7156
|
-
const triggerSaveSuccess = (0,
|
|
7264
|
+
const triggerSaveSuccess = (0, import_react18.useCallback)(() => {
|
|
7157
7265
|
setIsSaveSuccess(true);
|
|
7158
7266
|
setTimeout(() => {
|
|
7159
7267
|
setIsSaveSuccess(false);
|
|
7160
7268
|
}, 2500);
|
|
7161
7269
|
}, []);
|
|
7162
|
-
const handleQuietCellChange = (0,
|
|
7270
|
+
const handleQuietCellChange = (0, import_react18.useCallback)((rowId, colName, value) => {
|
|
7163
7271
|
setData((prev) => prev.map(
|
|
7164
7272
|
(row) => row.id === rowId ? __spreadProps(__spreadValues({}, row), { data: __spreadProps(__spreadValues({}, row.data), { [colName]: value }) }) : row
|
|
7165
7273
|
));
|
|
@@ -7183,12 +7291,12 @@ function TableBlockClient({
|
|
|
7183
7291
|
});
|
|
7184
7292
|
}
|
|
7185
7293
|
}, []);
|
|
7186
|
-
const toggleSelectAll = (0,
|
|
7294
|
+
const toggleSelectAll = (0, import_react18.useCallback)((checked) => {
|
|
7187
7295
|
onRowToggle == null ? void 0 : onRowToggle("ALL", checked);
|
|
7188
7296
|
const next = checked ? new Set(filteredData.map((r) => r.id)) : /* @__PURE__ */ new Set();
|
|
7189
7297
|
setSelectedIds(next);
|
|
7190
7298
|
}, [filteredData, onRowToggle]);
|
|
7191
|
-
const toggleSelectRow = (0,
|
|
7299
|
+
const toggleSelectRow = (0, import_react18.useCallback)((rowId, checked) => {
|
|
7192
7300
|
onRowToggle == null ? void 0 : onRowToggle(rowId, checked);
|
|
7193
7301
|
setSelectedIds((prev) => {
|
|
7194
7302
|
const next = new Set(prev);
|
|
@@ -7197,7 +7305,7 @@ function TableBlockClient({
|
|
|
7197
7305
|
return next;
|
|
7198
7306
|
});
|
|
7199
7307
|
}, [onRowToggle]);
|
|
7200
|
-
const handleToggleExpand = (0,
|
|
7308
|
+
const handleToggleExpand = (0, import_react18.useCallback)((rowId) => {
|
|
7201
7309
|
setExpandedRowIds((prev) => {
|
|
7202
7310
|
const next = new Set(prev);
|
|
7203
7311
|
if (next.has(rowId)) next.delete(rowId);
|
|
@@ -7205,7 +7313,7 @@ function TableBlockClient({
|
|
|
7205
7313
|
return next;
|
|
7206
7314
|
});
|
|
7207
7315
|
}, []);
|
|
7208
|
-
const handleMarkForDeletion = (0,
|
|
7316
|
+
const handleMarkForDeletion = (0, import_react18.useCallback)((fileId) => {
|
|
7209
7317
|
setPendingDeletions((prev) => [...prev, fileId]);
|
|
7210
7318
|
}, []);
|
|
7211
7319
|
const handleDeleteSelected = () => {
|
|
@@ -7433,7 +7541,7 @@ function TableBlockClient({
|
|
|
7433
7541
|
setIsSaving(false);
|
|
7434
7542
|
}
|
|
7435
7543
|
};
|
|
7436
|
-
const getRowRelationLabels = (0,
|
|
7544
|
+
const getRowRelationLabels = (0, import_react18.useCallback)((rowVal, col) => {
|
|
7437
7545
|
const ids = normalizeRelationValue(rowVal);
|
|
7438
7546
|
if (ids.length === 0) return [];
|
|
7439
7547
|
const options = relationOptions[col.name] || [];
|
|
@@ -7452,7 +7560,7 @@ function TableBlockClient({
|
|
|
7452
7560
|
return "";
|
|
7453
7561
|
}).filter(Boolean);
|
|
7454
7562
|
}, [relationOptions]);
|
|
7455
|
-
const getUniqueRelationOptions = (0,
|
|
7563
|
+
const getUniqueRelationOptions = (0, import_react18.useCallback)((col) => {
|
|
7456
7564
|
if (relationFilterOptions[col.name]) {
|
|
7457
7565
|
return relationFilterOptions[col.name];
|
|
7458
7566
|
}
|
|
@@ -7484,7 +7592,7 @@ function TableBlockClient({
|
|
|
7484
7592
|
return results.sort((a, b) => a.label.localeCompare(b.label));
|
|
7485
7593
|
}, [data, relationOptions, relationFilterOptions]);
|
|
7486
7594
|
const errorMessage = error ? typeof error === "string" ? error : error.message || String(error) : null;
|
|
7487
|
-
const columnTotals = (0,
|
|
7595
|
+
const columnTotals = (0, import_react18.useMemo)(() => {
|
|
7488
7596
|
const totals = {};
|
|
7489
7597
|
if (!showSummary) return totals;
|
|
7490
7598
|
filteredColumns.forEach((col) => {
|
|
@@ -8173,7 +8281,7 @@ function ExpandedSubTables({
|
|
|
8173
8281
|
context
|
|
8174
8282
|
}) {
|
|
8175
8283
|
var _a;
|
|
8176
|
-
const [activeTab, setActiveTab] = (0,
|
|
8284
|
+
const [activeTab, setActiveTab] = (0, import_react18.useState)((_a = subTableColumns[0]) == null ? void 0 : _a.name);
|
|
8177
8285
|
if (subTableColumns.length === 0) return null;
|
|
8178
8286
|
if (subTableColumns.length === 1) {
|
|
8179
8287
|
const stCol = subTableColumns[0];
|
|
@@ -8214,7 +8322,7 @@ function ExpandedSubTables({
|
|
|
8214
8322
|
) })
|
|
8215
8323
|
] }) });
|
|
8216
8324
|
}
|
|
8217
|
-
var TableRow =
|
|
8325
|
+
var TableRow = import_react18.default.memo(function TableRow2({
|
|
8218
8326
|
row,
|
|
8219
8327
|
isSelected,
|
|
8220
8328
|
rowStatus,
|
|
@@ -8246,7 +8354,7 @@ var TableRow = import_react17.default.memo(function TableRow2({
|
|
|
8246
8354
|
permissions
|
|
8247
8355
|
}) {
|
|
8248
8356
|
const lockedCopyTargets = getRelationCopyLockedTargets(schema == null ? void 0 : schema.columns);
|
|
8249
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
8357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react18.default.Fragment, { children: [
|
|
8250
8358
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tr", { className: `transition-colors group hover:bg-blue-50 ${isSelected ? "bg-blue-50" : ""}`, children: [
|
|
8251
8359
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: "border-b border-l border-slate-200 p-1.5 text-center bg-white group-hover:bg-transparent", style: { width: 80, minWidth: 80, maxWidth: 80 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-center gap-1.5", children: [
|
|
8252
8360
|
rowStatus && (() => {
|
|
@@ -8402,12 +8510,13 @@ function TableBlock(props) {
|
|
|
8402
8510
|
}
|
|
8403
8511
|
|
|
8404
8512
|
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
8405
|
-
var
|
|
8513
|
+
var import_react21 = require("react");
|
|
8406
8514
|
var import_ag_grid_react = require("ag-grid-react");
|
|
8407
8515
|
var import_ag_grid_community = require("ag-grid-community");
|
|
8516
|
+
var import_lucide_react10 = require("lucide-react");
|
|
8408
8517
|
|
|
8409
8518
|
// src/components/PlacementBlock/PlacementSettings.tsx
|
|
8410
|
-
var
|
|
8519
|
+
var import_react19 = __toESM(require("react"));
|
|
8411
8520
|
|
|
8412
8521
|
// src/components/PlacementBlock/placementColumns.ts
|
|
8413
8522
|
var RELATION_SEP = "::";
|
|
@@ -8529,7 +8638,7 @@ var SummaryRow = ({ label, value, hint }) => /* @__PURE__ */ (0, import_jsx_runt
|
|
|
8529
8638
|
] });
|
|
8530
8639
|
var PlacementStatusEditor = ({ config, onChange }) => {
|
|
8531
8640
|
var _a;
|
|
8532
|
-
const radioName = `placement-default-status-${
|
|
8641
|
+
const radioName = `placement-default-status-${import_react19.default.useId()}`;
|
|
8533
8642
|
const statuses = ((_a = config.statusColors) == null ? void 0 : _a.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
|
|
8534
8643
|
const defaultStatusId = resolveDefaultStatusId(statuses, config.defaultReturnStatusId);
|
|
8535
8644
|
const setStatuses = (next, defId = defaultStatusId) => {
|
|
@@ -8799,8 +8908,144 @@ var PlacementSettings = ({ config, onChange, tables }) => {
|
|
|
8799
8908
|
] });
|
|
8800
8909
|
};
|
|
8801
8910
|
|
|
8802
|
-
// src/components/PlacementBlock/
|
|
8911
|
+
// src/components/PlacementBlock/PlacementRelationButtons.tsx
|
|
8912
|
+
var import_react20 = require("react");
|
|
8803
8913
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
8914
|
+
var GROUP_COLORS = [
|
|
8915
|
+
{ title: "bg-blue-600 text-white", active: "bg-blue-600 border-blue-600 text-white hover:bg-blue-700", count: "text-blue-700" },
|
|
8916
|
+
{ title: "bg-violet-600 text-white", active: "bg-violet-600 border-violet-600 text-white hover:bg-violet-700", count: "text-violet-700" },
|
|
8917
|
+
{ title: "bg-emerald-600 text-white", active: "bg-emerald-600 border-emerald-600 text-white hover:bg-emerald-700", count: "text-emerald-700" },
|
|
8918
|
+
{ title: "bg-amber-500 text-white", active: "bg-amber-500 border-amber-500 text-white hover:bg-amber-600", count: "text-amber-700" },
|
|
8919
|
+
{ title: "bg-rose-600 text-white", active: "bg-rose-600 border-rose-600 text-white hover:bg-rose-700", count: "text-rose-700" }
|
|
8920
|
+
];
|
|
8921
|
+
var isRawObjectId2 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
|
|
8922
|
+
function rowMatchesRelationFilter(row, colName, id) {
|
|
8923
|
+
var _a;
|
|
8924
|
+
return normalizeRelationValue((_a = row.data) == null ? void 0 : _a[colName]).includes(id);
|
|
8925
|
+
}
|
|
8926
|
+
var PlacementRelationButtons = ({
|
|
8927
|
+
columnNames,
|
|
8928
|
+
rows,
|
|
8929
|
+
filters,
|
|
8930
|
+
onFilterChange,
|
|
8931
|
+
relationOptions,
|
|
8932
|
+
className = ""
|
|
8933
|
+
}) => {
|
|
8934
|
+
const groups = (0, import_react20.useMemo)(() => {
|
|
8935
|
+
const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
8936
|
+
return (columnNames || []).map((colName) => {
|
|
8937
|
+
var _a, _b, _c, _d;
|
|
8938
|
+
const otherEntries = activeEntries.filter(([name]) => name !== colName);
|
|
8939
|
+
const base = otherEntries.length === 0 ? rows : rows.filter((r) => otherEntries.every(([name, val]) => rowMatchesRelationFilter(r, name, val)));
|
|
8940
|
+
const counts = /* @__PURE__ */ new Map();
|
|
8941
|
+
for (const r of base) {
|
|
8942
|
+
new Set(normalizeRelationValue((_a = r.data) == null ? void 0 : _a[colName])).forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
|
|
8943
|
+
}
|
|
8944
|
+
const activeId = filters[colName] ? String(filters[colName]) : null;
|
|
8945
|
+
const labelById = /* @__PURE__ */ new Map();
|
|
8946
|
+
for (const opt of relationOptions[colName] || []) {
|
|
8947
|
+
const id = String((_c = (_b = opt == null ? void 0 : opt.id) != null ? _b : opt == null ? void 0 : opt._id) != null ? _c : "");
|
|
8948
|
+
const label = String((_d = opt == null ? void 0 : opt.label) != null ? _d : "").trim();
|
|
8949
|
+
if (id && label && !isRawObjectId2(label)) labelById.set(id, label);
|
|
8950
|
+
}
|
|
8951
|
+
const options = [];
|
|
8952
|
+
const ids = /* @__PURE__ */ new Set([...counts.keys(), ...activeId ? [activeId] : []]);
|
|
8953
|
+
ids.forEach((id) => {
|
|
8954
|
+
const label = labelById.get(id);
|
|
8955
|
+
if (!label) return;
|
|
8956
|
+
options.push({ id, label, count: counts.get(id) || 0 });
|
|
8957
|
+
});
|
|
8958
|
+
options.sort((a, b) => a.label.localeCompare(b.label, "he"));
|
|
8959
|
+
return { key: colName, title: colName, options, activeId };
|
|
8960
|
+
});
|
|
8961
|
+
}, [columnNames, rows, filters, relationOptions]);
|
|
8962
|
+
if (!columnNames || columnNames.length === 0) return null;
|
|
8963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8964
|
+
"div",
|
|
8965
|
+
{
|
|
8966
|
+
className: `border-t border-slate-100 pt-3 ${className}`,
|
|
8967
|
+
"data-testid": "placement-relation-buttons",
|
|
8968
|
+
children: groups.every((g) => g.options.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "py-2 text-xs text-slate-400", children: "\u05D0\u05D9\u05DF \u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D4\u05E6\u05D2\u05D4 \u05D1\u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5" }) : (
|
|
8969
|
+
// כל עמודה במתחם נפרד: בשורה הראשונה הכותרת (תגית צבעונית), ומהשורה שמתחת הכפתורים
|
|
8970
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2.5", children: groups.map((group, gi) => {
|
|
8971
|
+
if (group.options.length === 0) return null;
|
|
8972
|
+
const color = GROUP_COLORS[gi % GROUP_COLORS.length];
|
|
8973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "bg-white border border-slate-200 rounded-xl p-3 flex flex-col gap-2.5 shadow-2xs", children: [
|
|
8974
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2 pb-2 border-b border-slate-100", children: [
|
|
8975
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `px-2.5 py-0.5 rounded-md text-xs font-bold truncate ${color.title}`, title: group.title, children: group.title }),
|
|
8976
|
+
group.activeId && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8977
|
+
"button",
|
|
8978
|
+
{
|
|
8979
|
+
type: "button",
|
|
8980
|
+
onClick: () => onFilterChange(group.key, ""),
|
|
8981
|
+
className: "text-[11px] font-semibold text-rose-600 hover:text-rose-700 hover:underline cursor-pointer shrink-0",
|
|
8982
|
+
children: "\u05E0\u05E7\u05D4 \u05E1\u05D9\u05E0\u05D5\u05DF"
|
|
8983
|
+
}
|
|
8984
|
+
)
|
|
8985
|
+
] }),
|
|
8986
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-wrap items-end gap-x-2 gap-y-2.5", children: group.options.map((opt) => {
|
|
8987
|
+
const active = group.activeId === opt.id;
|
|
8988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col items-center gap-0.5", children: [
|
|
8989
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: `text-[11px] font-bold leading-none ${active ? color.count : "text-slate-500"}`, children: opt.count }),
|
|
8990
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8991
|
+
"button",
|
|
8992
|
+
{
|
|
8993
|
+
type: "button",
|
|
8994
|
+
onClick: () => onFilterChange(group.key, active ? "" : opt.id),
|
|
8995
|
+
title: active ? "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D9\u05D8\u05D5\u05DC \u05D4\u05E1\u05D9\u05E0\u05D5\u05DF" : `\u05E1\u05E0\u05DF \u05DC\u05E4\u05D9: ${opt.label}`,
|
|
8996
|
+
"aria-pressed": active,
|
|
8997
|
+
className: `px-3 h-8 rounded-md border text-xs font-semibold whitespace-nowrap shadow-2xs transition-colors cursor-pointer ${active ? color.active : "bg-white border-slate-300 text-slate-700 hover:bg-slate-50 hover:border-slate-400"}`,
|
|
8998
|
+
children: opt.label
|
|
8999
|
+
}
|
|
9000
|
+
)
|
|
9001
|
+
] }, opt.id);
|
|
9002
|
+
}) })
|
|
9003
|
+
] }, group.key);
|
|
9004
|
+
}) })
|
|
9005
|
+
)
|
|
9006
|
+
}
|
|
9007
|
+
);
|
|
9008
|
+
};
|
|
9009
|
+
|
|
9010
|
+
// src/components/PlacementBlock/placementDefaultFilters.ts
|
|
9011
|
+
function getPlacementFilterRefs(config) {
|
|
9012
|
+
const defined = Array.isArray(config == null ? void 0 : config.filterFields) ? config.filterFields : [];
|
|
9013
|
+
const legacy = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
|
|
9014
|
+
return (defined.length > 0 ? defined : legacy).filter((r) => typeof r === "string" && r);
|
|
9015
|
+
}
|
|
9016
|
+
function resolveFilterColName(ref, targetColumns) {
|
|
9017
|
+
const direct = (targetColumns || []).find((c) => (c == null ? void 0 : c.id) === ref || (c == null ? void 0 : c.name) === ref);
|
|
9018
|
+
if (direct) return direct.name;
|
|
9019
|
+
const { relationColumn } = parseColumnRef(ref);
|
|
9020
|
+
if (relationColumn) {
|
|
9021
|
+
const rel = (targetColumns || []).find(
|
|
9022
|
+
(c) => (c == null ? void 0 : c.name) === relationColumn && String(c == null ? void 0 : c.type).toUpperCase() === "RELATION"
|
|
9023
|
+
);
|
|
9024
|
+
if (rel) return rel.name;
|
|
9025
|
+
}
|
|
9026
|
+
return ref;
|
|
9027
|
+
}
|
|
9028
|
+
function computePlacementDefaultFilters(args) {
|
|
9029
|
+
const { refs, defaults, targetColumns, rows, getText } = args;
|
|
9030
|
+
const applied = {};
|
|
9031
|
+
if (!defaults) return applied;
|
|
9032
|
+
for (const ref of refs) {
|
|
9033
|
+
const want = defaults[ref];
|
|
9034
|
+
if (typeof want !== "string" || want === "") continue;
|
|
9035
|
+
const colName = resolveFilterColName(ref, targetColumns);
|
|
9036
|
+
if (colName in applied) continue;
|
|
9037
|
+
const validRows = rows.filter(
|
|
9038
|
+
(r) => Object.entries(applied).every(([name, value]) => getText(name, r.data) === value)
|
|
9039
|
+
);
|
|
9040
|
+
if (validRows.some((r) => getText(colName, r.data) === want)) {
|
|
9041
|
+
applied[colName] = want;
|
|
9042
|
+
}
|
|
9043
|
+
}
|
|
9044
|
+
return applied;
|
|
9045
|
+
}
|
|
9046
|
+
|
|
9047
|
+
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
9048
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
8804
9049
|
import_ag_grid_community.ModuleRegistry.registerModules([import_ag_grid_community.AllCommunityModule]);
|
|
8805
9050
|
var FETCH_LIMIT = 1e3;
|
|
8806
9051
|
function normalizeRows(records) {
|
|
@@ -8837,7 +9082,7 @@ var ColorDotRenderer = (props) => {
|
|
|
8837
9082
|
const { statuses, defaultStatusId } = props;
|
|
8838
9083
|
const status = statuses.find((c) => c.id === item.statusId) || statuses.find((c) => c.id === defaultStatusId) || statuses[0];
|
|
8839
9084
|
if (!status) return null;
|
|
8840
|
-
return /* @__PURE__ */ (0,
|
|
9085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8841
9086
|
"button",
|
|
8842
9087
|
{
|
|
8843
9088
|
type: "button",
|
|
@@ -8851,7 +9096,7 @@ var ColorDotRenderer = (props) => {
|
|
|
8851
9096
|
};
|
|
8852
9097
|
var CheckCellRenderer = (props) => {
|
|
8853
9098
|
if (!props.data) return null;
|
|
8854
|
-
return /* @__PURE__ */ (0,
|
|
9099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8855
9100
|
"input",
|
|
8856
9101
|
{
|
|
8857
9102
|
type: "checkbox",
|
|
@@ -8862,7 +9107,7 @@ var CheckCellRenderer = (props) => {
|
|
|
8862
9107
|
}
|
|
8863
9108
|
) });
|
|
8864
9109
|
};
|
|
8865
|
-
var CheckHeader = (props) => /* @__PURE__ */ (0,
|
|
9110
|
+
var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
8866
9111
|
"input",
|
|
8867
9112
|
{
|
|
8868
9113
|
type: "checkbox",
|
|
@@ -8875,23 +9120,48 @@ var CheckHeader = (props) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div"
|
|
|
8875
9120
|
"aria-label": "\u05D1\u05D7\u05D9\u05E8\u05EA \u05DB\u05DC \u05D4\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD"
|
|
8876
9121
|
}
|
|
8877
9122
|
) });
|
|
9123
|
+
var RelationFilterHeader = (props) => {
|
|
9124
|
+
const btnRef = (0, import_react21.useRef)(null);
|
|
9125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col items-center justify-center w-full min-w-0 leading-tight select-none", title: props.displayName, children: [
|
|
9126
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
9127
|
+
"button",
|
|
9128
|
+
{
|
|
9129
|
+
ref: btnRef,
|
|
9130
|
+
type: "button",
|
|
9131
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
9132
|
+
onClick: (e) => {
|
|
9133
|
+
var _a;
|
|
9134
|
+
e.stopPropagation();
|
|
9135
|
+
e.preventDefault();
|
|
9136
|
+
const rect = (_a = btnRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
9137
|
+
if (rect) props.onOpen(props.colName, rect);
|
|
9138
|
+
},
|
|
9139
|
+
className: `p-0.5 rounded transition-colors cursor-pointer mb-0.5 shrink-0 ${props.active ? "text-blue-600 bg-blue-100 hover:bg-blue-200" : "text-slate-400 hover:text-slate-600 hover:bg-slate-200/60"}`,
|
|
9140
|
+
title: props.active ? "\u05E1\u05D9\u05E0\u05D5\u05DF \u05E4\u05E2\u05D9\u05DC - \u05DC\u05D7\u05E5 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9" : "\u05E1\u05D9\u05E0\u05D5\u05DF \u05DC\u05E4\u05D9 \u05E2\u05DE\u05D5\u05D3\u05D4",
|
|
9141
|
+
"aria-label": `\u05E1\u05D9\u05E0\u05D5\u05DF \u05DC\u05E4\u05D9 ${props.displayName}`,
|
|
9142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Filter, { className: "w-3 h-3" })
|
|
9143
|
+
}
|
|
9144
|
+
),
|
|
9145
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "truncate w-full text-center", children: props.displayName })
|
|
9146
|
+
] });
|
|
9147
|
+
};
|
|
8878
9148
|
var PlacementBlock = (props) => {
|
|
8879
9149
|
var _a, _b;
|
|
8880
9150
|
const { executeAction, fetchSourceData, fetchTargetData, updateAssignment, className = "" } = props;
|
|
8881
|
-
const config = (0,
|
|
9151
|
+
const config = (0, import_react21.useMemo)(() => {
|
|
8882
9152
|
var _a2, _b2, _c;
|
|
8883
9153
|
const raw = (_a2 = props.config) != null ? _a2 : props.settings;
|
|
8884
9154
|
if (!raw) return void 0;
|
|
8885
9155
|
return ((_b2 = raw.config) == null ? void 0 : _b2.sourceTableId) || ((_c = raw.config) == null ? void 0 : _c.targetTableId) ? raw.config : raw;
|
|
8886
9156
|
}, [props.config, props.settings]);
|
|
8887
|
-
const statuses = (0,
|
|
9157
|
+
const statuses = (0, import_react21.useMemo)(
|
|
8888
9158
|
() => {
|
|
8889
9159
|
var _a2;
|
|
8890
9160
|
return ((_a2 = config == null ? void 0 : config.statusColors) == null ? void 0 : _a2.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
|
|
8891
9161
|
},
|
|
8892
9162
|
[config == null ? void 0 : config.statusColors]
|
|
8893
9163
|
);
|
|
8894
|
-
const defaultStatusId = (0,
|
|
9164
|
+
const defaultStatusId = (0, import_react21.useMemo)(
|
|
8895
9165
|
() => resolveDefaultStatusId(statuses, config == null ? void 0 : config.defaultReturnStatusId),
|
|
8896
9166
|
[statuses, config == null ? void 0 : config.defaultReturnStatusId]
|
|
8897
9167
|
);
|
|
@@ -8899,27 +9169,31 @@ var PlacementBlock = (props) => {
|
|
|
8899
9169
|
const targetTableId = config == null ? void 0 : config.targetTableId;
|
|
8900
9170
|
const displayField = (config == null ? void 0 : config.sourceDisplayFieldId) || "name";
|
|
8901
9171
|
const assignmentField = config == null ? void 0 : config.targetAssignmentFieldId;
|
|
8902
|
-
const executeActionRef = (0,
|
|
9172
|
+
const executeActionRef = (0, import_react21.useRef)(executeAction);
|
|
8903
9173
|
executeActionRef.current = executeAction;
|
|
8904
|
-
const legacyRef = (0,
|
|
9174
|
+
const legacyRef = (0, import_react21.useRef)({ fetchSourceData, fetchTargetData, updateAssignment });
|
|
8905
9175
|
legacyRef.current = { fetchSourceData, fetchTargetData, updateAssignment };
|
|
8906
|
-
const [sourceRows, setSourceRows] = (0,
|
|
8907
|
-
const [sourceColumns, setSourceColumns] = (0,
|
|
8908
|
-
const [
|
|
8909
|
-
const [
|
|
8910
|
-
const [
|
|
8911
|
-
const [
|
|
8912
|
-
const [
|
|
8913
|
-
const [
|
|
8914
|
-
const [
|
|
8915
|
-
const [
|
|
8916
|
-
const [
|
|
8917
|
-
const [
|
|
8918
|
-
const [
|
|
8919
|
-
const [
|
|
8920
|
-
const [
|
|
8921
|
-
const [
|
|
8922
|
-
const
|
|
9176
|
+
const [sourceRows, setSourceRows] = (0, import_react21.useState)([]);
|
|
9177
|
+
const [sourceColumns, setSourceColumns] = (0, import_react21.useState)([]);
|
|
9178
|
+
const [sourceRelOptions, setSourceRelOptions] = (0, import_react21.useState)({});
|
|
9179
|
+
const [sourceRelFilters, setSourceRelFilters] = (0, import_react21.useState)({});
|
|
9180
|
+
const [targetRows, setTargetRows] = (0, import_react21.useState)([]);
|
|
9181
|
+
const [targetColumns, setTargetColumns] = (0, import_react21.useState)([]);
|
|
9182
|
+
const [targetRelOptions, setTargetRelOptions] = (0, import_react21.useState)({});
|
|
9183
|
+
const [selectedTargetId, setSelectedTargetId] = (0, import_react21.useState)("");
|
|
9184
|
+
const [candidateIds, setCandidateIds] = (0, import_react21.useState)([]);
|
|
9185
|
+
const [checkedIds, setCheckedIds] = (0, import_react21.useState)([]);
|
|
9186
|
+
const [isSaving, setIsSaving] = (0, import_react21.useState)(false);
|
|
9187
|
+
const [sourceSearch, setSourceSearch] = (0, import_react21.useState)("");
|
|
9188
|
+
const [candidateSearch, setCandidateSearch] = (0, import_react21.useState)("");
|
|
9189
|
+
const [statusMap, setStatusMap] = (0, import_react21.useState)({});
|
|
9190
|
+
const [isLoading, setIsLoading] = (0, import_react21.useState)(false);
|
|
9191
|
+
const [loadError, setLoadError] = (0, import_react21.useState)(null);
|
|
9192
|
+
const [saveError, setSaveError] = (0, import_react21.useState)(null);
|
|
9193
|
+
const [colFilters, setColFilters] = (0, import_react21.useState)({ source: {}, cand: {} });
|
|
9194
|
+
const [filterPopover, setFilterPopover] = (0, import_react21.useState)(null);
|
|
9195
|
+
const [targetFilters, setTargetFilters] = (0, import_react21.useState)({});
|
|
9196
|
+
const loadTable = (0, import_react21.useCallback)(async (tableId, kind) => {
|
|
8923
9197
|
const exec = executeActionRef.current;
|
|
8924
9198
|
if (exec) {
|
|
8925
9199
|
const res = await exec("FETCH_TABLE_DATA", { tableId, tableMetaId: tableId, limit: FETCH_LIMIT, skip: 0 });
|
|
@@ -8932,7 +9206,7 @@ var PlacementBlock = (props) => {
|
|
|
8932
9206
|
}
|
|
8933
9207
|
throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
|
|
8934
9208
|
}, []);
|
|
8935
|
-
(0,
|
|
9209
|
+
(0, import_react21.useEffect)(() => {
|
|
8936
9210
|
if (!sourceTableId || !targetTableId) return;
|
|
8937
9211
|
let cancelled = false;
|
|
8938
9212
|
(async () => {
|
|
@@ -8946,6 +9220,7 @@ var PlacementBlock = (props) => {
|
|
|
8946
9220
|
if (cancelled) return;
|
|
8947
9221
|
setSourceRows(src.rows);
|
|
8948
9222
|
setSourceColumns(src.columns);
|
|
9223
|
+
setSourceRelOptions(src.relationOptions || {});
|
|
8949
9224
|
setTargetRows(tgt.rows);
|
|
8950
9225
|
setTargetColumns(tgt.columns);
|
|
8951
9226
|
setTargetRelOptions(tgt.relationOptions || {});
|
|
@@ -8959,7 +9234,7 @@ var PlacementBlock = (props) => {
|
|
|
8959
9234
|
cancelled = true;
|
|
8960
9235
|
};
|
|
8961
9236
|
}, [sourceTableId, targetTableId, loadTable]);
|
|
8962
|
-
const displayValue = (0,
|
|
9237
|
+
const displayValue = (0, import_react21.useCallback)((col, val) => {
|
|
8963
9238
|
var _a2, _b2, _c, _d, _e;
|
|
8964
9239
|
let text2 = cellText(val);
|
|
8965
9240
|
if (text2 && /^[a-fA-F0-9]{24}$/.test(text2)) {
|
|
@@ -8979,7 +9254,50 @@ var PlacementBlock = (props) => {
|
|
|
8979
9254
|
}
|
|
8980
9255
|
return text2;
|
|
8981
9256
|
}, [targetRelOptions, targetRows, sourceRows]);
|
|
8982
|
-
const
|
|
9257
|
+
const relationLabelMaps = (0, import_react21.useMemo)(() => {
|
|
9258
|
+
const maps = {};
|
|
9259
|
+
Object.entries(sourceRelOptions || {}).forEach(([colName, opts]) => {
|
|
9260
|
+
const m = /* @__PURE__ */ new Map();
|
|
9261
|
+
(opts || []).forEach((o) => {
|
|
9262
|
+
var _a2, _b2, _c;
|
|
9263
|
+
const label = cellText((_b2 = (_a2 = o == null ? void 0 : o.label) != null ? _a2 : o == null ? void 0 : o.title) != null ? _b2 : o == null ? void 0 : o.name);
|
|
9264
|
+
if (label) m.set(String((_c = o.id) != null ? _c : o._id), label);
|
|
9265
|
+
});
|
|
9266
|
+
maps[colName] = m;
|
|
9267
|
+
});
|
|
9268
|
+
return maps;
|
|
9269
|
+
}, [sourceRelOptions]);
|
|
9270
|
+
const relationLabelsOf = (0, import_react21.useCallback)((row, colName) => {
|
|
9271
|
+
var _a2;
|
|
9272
|
+
const map = relationLabelMaps[colName];
|
|
9273
|
+
const ids = normalizeRelationValue((_a2 = row.data) == null ? void 0 : _a2[colName]);
|
|
9274
|
+
const labels = map ? ids.map((id) => map.get(String(id))).filter((l) => !!l) : [];
|
|
9275
|
+
if (labels.length) return labels;
|
|
9276
|
+
const txt = cellText(readColumnValue(row.data, colName));
|
|
9277
|
+
return txt && !/^[a-fA-F0-9]{24}$/.test(txt) ? txt.split(", ").filter(Boolean) : [];
|
|
9278
|
+
}, [relationLabelMaps]);
|
|
9279
|
+
const rowPassesColFilters = (0, import_react21.useCallback)((row, filters) => {
|
|
9280
|
+
return Object.entries(filters).every(([colName, f]) => {
|
|
9281
|
+
if (!f) return true;
|
|
9282
|
+
const labels = relationLabelsOf(row, colName);
|
|
9283
|
+
if (Array.isArray(f)) return f.length === 0 || labels.some((l) => f.includes(l));
|
|
9284
|
+
if (f.operator === "notIn") return !labels.some((l) => f.values.includes(l));
|
|
9285
|
+
return true;
|
|
9286
|
+
});
|
|
9287
|
+
}, [relationLabelsOf]);
|
|
9288
|
+
const setColFilter = (0, import_react21.useCallback)((grid, colName, payload) => {
|
|
9289
|
+
setColFilters((prev) => {
|
|
9290
|
+
const next = __spreadValues({}, prev[grid]);
|
|
9291
|
+
if (payload === void 0) delete next[colName];
|
|
9292
|
+
else next[colName] = payload;
|
|
9293
|
+
return __spreadProps(__spreadValues({}, prev), { [grid]: next });
|
|
9294
|
+
});
|
|
9295
|
+
}, []);
|
|
9296
|
+
const openColFilter = (0, import_react21.useCallback)((grid, colName, rect) => {
|
|
9297
|
+
setFilterPopover((cur) => cur && cur.grid === grid && cur.colName === colName ? null : { grid, colName, rect });
|
|
9298
|
+
}, []);
|
|
9299
|
+
const closeColFilter = (0, import_react21.useCallback)(() => setFilterPopover(null), []);
|
|
9300
|
+
const filterColumns = (0, import_react21.useMemo)(() => {
|
|
8983
9301
|
const definedFilters = (config == null ? void 0 : config.filterFields) || [];
|
|
8984
9302
|
const legacyFilters = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
|
|
8985
9303
|
const fieldsToUse = definedFilters.length > 0 ? definedFilters : legacyFilters;
|
|
@@ -9005,7 +9323,7 @@ var PlacementBlock = (props) => {
|
|
|
9005
9323
|
return targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)).slice(0, 3);
|
|
9006
9324
|
}, [targetColumns, assignmentField, config]);
|
|
9007
9325
|
const rawSelectorField = (config == null ? void 0 : config.targetSelectorFieldId) || (config == null ? void 0 : config.targetDisplayFieldId) || ((_a = filterColumns[0]) == null ? void 0 : _a.name) || "";
|
|
9008
|
-
const selectorField = (0,
|
|
9326
|
+
const selectorField = (0, import_react21.useMemo)(() => {
|
|
9009
9327
|
const { relationColumn } = parseColumnRef(rawSelectorField);
|
|
9010
9328
|
if (relationColumn && !targetColumns.some((c) => c.name === rawSelectorField) && targetColumns.some((c) => {
|
|
9011
9329
|
var _a2;
|
|
@@ -9015,7 +9333,7 @@ var PlacementBlock = (props) => {
|
|
|
9015
9333
|
}
|
|
9016
9334
|
return rawSelectorField;
|
|
9017
9335
|
}, [rawSelectorField, targetColumns]);
|
|
9018
|
-
const filteredTargetRows = (0,
|
|
9336
|
+
const filteredTargetRows = (0, import_react21.useMemo)(() => {
|
|
9019
9337
|
return targetRows.filter((r) => {
|
|
9020
9338
|
return filterColumns.every((col) => {
|
|
9021
9339
|
const filterVal = targetFilters[col.name];
|
|
@@ -9024,7 +9342,7 @@ var PlacementBlock = (props) => {
|
|
|
9024
9342
|
});
|
|
9025
9343
|
});
|
|
9026
9344
|
}, [targetRows, targetFilters, filterColumns, displayValue]);
|
|
9027
|
-
(0,
|
|
9345
|
+
(0, import_react21.useEffect)(() => {
|
|
9028
9346
|
if (filteredTargetRows.length > 0) {
|
|
9029
9347
|
if (!selectedTargetId || !filteredTargetRows.some((r) => r.id === selectedTargetId)) {
|
|
9030
9348
|
setSelectedTargetId(filteredTargetRows[0].id);
|
|
@@ -9033,11 +9351,27 @@ var PlacementBlock = (props) => {
|
|
|
9033
9351
|
setSelectedTargetId("");
|
|
9034
9352
|
}
|
|
9035
9353
|
}, [filteredTargetRows, selectedTargetId]);
|
|
9036
|
-
const
|
|
9354
|
+
const appliedDefaultsKeyRef = (0, import_react21.useRef)("");
|
|
9355
|
+
(0, import_react21.useEffect)(() => {
|
|
9356
|
+
const defaults = config == null ? void 0 : config.targetFilterDefaults;
|
|
9357
|
+
if (isLoading || !defaults || targetRows.length === 0 || targetColumns.length === 0) return;
|
|
9358
|
+
const key = `${targetTableId}|${JSON.stringify(defaults)}`;
|
|
9359
|
+
if (appliedDefaultsKeyRef.current === key) return;
|
|
9360
|
+
appliedDefaultsKeyRef.current = key;
|
|
9361
|
+
const resolved = computePlacementDefaultFilters({
|
|
9362
|
+
refs: getPlacementFilterRefs(config),
|
|
9363
|
+
defaults,
|
|
9364
|
+
targetColumns,
|
|
9365
|
+
rows: targetRows,
|
|
9366
|
+
getText: (colName, data) => displayValue(targetColumns.find((c) => c.name === colName) || { name: colName }, readColumnValue(data, colName))
|
|
9367
|
+
});
|
|
9368
|
+
if (Object.keys(resolved).length > 0) setTargetFilters((prev) => __spreadValues(__spreadValues({}, resolved), prev));
|
|
9369
|
+
}, [config, isLoading, targetRows, targetColumns, targetTableId, displayValue]);
|
|
9370
|
+
const assignmentColumn = (0, import_react21.useMemo)(() => targetColumns.find((c) => c.name === assignmentField), [targetColumns, assignmentField]);
|
|
9037
9371
|
const isRelationField = ((_b = assignmentColumn == null ? void 0 : assignmentColumn.type) == null ? void 0 : _b.toUpperCase()) === "RELATION";
|
|
9038
9372
|
const assignmentLabel = (assignmentColumn == null ? void 0 : assignmentColumn.label) || (assignmentColumn == null ? void 0 : assignmentColumn.name) || assignmentField || "";
|
|
9039
|
-
const nameOf = (0,
|
|
9040
|
-
const assignedIds = (0,
|
|
9373
|
+
const nameOf = (0, import_react21.useCallback)((row) => cellText(readColumnValue(row.data, displayField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD", [displayField]);
|
|
9374
|
+
const assignedIds = (0, import_react21.useMemo)(() => {
|
|
9041
9375
|
var _a2;
|
|
9042
9376
|
const target = targetRows.find((r) => r.id === selectedTargetId);
|
|
9043
9377
|
if (!target || !assignmentField) return [];
|
|
@@ -9051,22 +9385,36 @@ var PlacementBlock = (props) => {
|
|
|
9051
9385
|
}).filter((id) => !!id && sourceRows.some((s) => s.id === id));
|
|
9052
9386
|
return Array.from(new Set(ids));
|
|
9053
9387
|
}, [selectedTargetId, targetRows, sourceRows, assignmentField, isRelationField, nameOf]);
|
|
9054
|
-
const assignedIdsRef = (0,
|
|
9388
|
+
const assignedIdsRef = (0, import_react21.useRef)(assignedIds);
|
|
9055
9389
|
assignedIdsRef.current = assignedIds;
|
|
9056
|
-
(0,
|
|
9390
|
+
(0, import_react21.useEffect)(() => {
|
|
9057
9391
|
setCandidateIds(assignedIdsRef.current);
|
|
9058
9392
|
setCheckedIds(assignedIdsRef.current);
|
|
9059
9393
|
}, [selectedTargetId, sourceRows]);
|
|
9060
|
-
const toGridRow = (0,
|
|
9061
|
-
const
|
|
9394
|
+
const toGridRow = (0, import_react21.useCallback)((r, checked = false) => __spreadProps(__spreadValues({}, r.data), { id: r.id, __label: nameOf(r), __checked: checked, statusId: statusMap[r.id] || defaultStatusId }), [nameOf, statusMap, defaultStatusId]);
|
|
9395
|
+
const candidateRows = (0, import_react21.useMemo)(() => candidateIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r), [candidateIds, sourceRows]);
|
|
9396
|
+
const candidateGridData = (0, import_react21.useMemo)(() => {
|
|
9062
9397
|
const checked = new Set(checkedIds);
|
|
9063
|
-
return
|
|
9064
|
-
}, [
|
|
9065
|
-
const
|
|
9398
|
+
return candidateRows.filter((r) => rowPassesColFilters(r, colFilters.cand)).map((r) => toGridRow(r, checked.has(r.id)));
|
|
9399
|
+
}, [candidateRows, checkedIds, toGridRow, rowPassesColFilters, colFilters.cand]);
|
|
9400
|
+
const availableRows = (0, import_react21.useMemo)(() => {
|
|
9066
9401
|
const set = new Set(candidateIds);
|
|
9067
|
-
return sourceRows.filter((r) => !set.has(r.id))
|
|
9068
|
-
}, [candidateIds, sourceRows
|
|
9069
|
-
const
|
|
9402
|
+
return sourceRows.filter((r) => !set.has(r.id));
|
|
9403
|
+
}, [candidateIds, sourceRows]);
|
|
9404
|
+
const relationButtonColumns = (0, import_react21.useMemo)(() => {
|
|
9405
|
+
const wanted = Array.isArray(config == null ? void 0 : config.relationButtonColumns) ? config.relationButtonColumns : [];
|
|
9406
|
+
return wanted.filter((name) => sourceColumns.some((c) => (c == null ? void 0 : c.name) === name && String(c == null ? void 0 : c.type).toUpperCase() === "RELATION"));
|
|
9407
|
+
}, [config, sourceColumns]);
|
|
9408
|
+
const hasRelationButtons = relationButtonColumns.length > 0;
|
|
9409
|
+
const handleRelationFilterChange = (0, import_react21.useCallback)((colName, id) => {
|
|
9410
|
+
setSourceRelFilters((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: id }));
|
|
9411
|
+
}, []);
|
|
9412
|
+
const availableGridData = (0, import_react21.useMemo)(() => {
|
|
9413
|
+
const active = Object.entries(sourceRelFilters).filter(([name, v]) => !!v && relationButtonColumns.includes(name));
|
|
9414
|
+
const byButtons = active.length === 0 ? availableRows : availableRows.filter((r) => active.every(([name, v]) => rowMatchesRelationFilter(r, name, v)));
|
|
9415
|
+
return byButtons.filter((r) => rowPassesColFilters(r, colFilters.source)).map((r) => toGridRow(r));
|
|
9416
|
+
}, [availableRows, sourceRelFilters, relationButtonColumns, toGridRow, rowPassesColFilters, colFilters.source]);
|
|
9417
|
+
const persistAssignment = (0, import_react21.useCallback)(async (nextIds) => {
|
|
9070
9418
|
const exec = executeActionRef.current;
|
|
9071
9419
|
if (exec && targetTableId && assignmentField && selectedTargetId) {
|
|
9072
9420
|
const value = isRelationField ? nextIds : nextIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", ");
|
|
@@ -9078,33 +9426,33 @@ var PlacementBlock = (props) => {
|
|
|
9078
9426
|
for (const id of nextIds.filter((i) => !assignedIds.includes(i))) await legacyRef.current.updateAssignment(selectedTargetId, id);
|
|
9079
9427
|
}
|
|
9080
9428
|
}, [targetTableId, assignmentField, selectedTargetId, isRelationField, sourceRows, nameOf, assignedIds]);
|
|
9081
|
-
const moveToCandidates = (0,
|
|
9429
|
+
const moveToCandidates = (0, import_react21.useCallback)((id) => {
|
|
9082
9430
|
setCandidateIds((prev) => prev.includes(id) ? prev : [...prev, id]);
|
|
9083
9431
|
}, []);
|
|
9084
|
-
const moveToSource = (0,
|
|
9432
|
+
const moveToSource = (0, import_react21.useCallback)((id) => {
|
|
9085
9433
|
setCandidateIds((prev) => prev.filter((x) => x !== id));
|
|
9086
9434
|
setCheckedIds((prev) => prev.filter((x) => x !== id));
|
|
9087
9435
|
setStatusMap((prev) => __spreadProps(__spreadValues({}, prev), { [id]: defaultStatusId }));
|
|
9088
9436
|
}, [defaultStatusId]);
|
|
9089
|
-
const moveToCandidatesRef = (0,
|
|
9437
|
+
const moveToCandidatesRef = (0, import_react21.useRef)(moveToCandidates);
|
|
9090
9438
|
moveToCandidatesRef.current = moveToCandidates;
|
|
9091
|
-
const moveToSourceRef = (0,
|
|
9439
|
+
const moveToSourceRef = (0, import_react21.useRef)(moveToSource);
|
|
9092
9440
|
moveToSourceRef.current = moveToSource;
|
|
9093
|
-
const toggleChecked = (0,
|
|
9441
|
+
const toggleChecked = (0, import_react21.useCallback)((id) => {
|
|
9094
9442
|
setCheckedIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]);
|
|
9095
9443
|
}, []);
|
|
9096
9444
|
const allChecked = candidateIds.length > 0 && candidateIds.every((id) => checkedIds.includes(id));
|
|
9097
9445
|
const someChecked = candidateIds.some((id) => checkedIds.includes(id));
|
|
9098
|
-
const toggleAll = (0,
|
|
9446
|
+
const toggleAll = (0, import_react21.useCallback)(() => {
|
|
9099
9447
|
setCheckedIds(allChecked ? [] : [...candidateIds]);
|
|
9100
9448
|
}, [allChecked, candidateIds]);
|
|
9101
|
-
const returnAll = (0,
|
|
9449
|
+
const returnAll = (0, import_react21.useCallback)(() => {
|
|
9102
9450
|
setCandidateIds([]);
|
|
9103
9451
|
setCheckedIds([]);
|
|
9104
9452
|
}, []);
|
|
9105
|
-
const checkedCandidates = (0,
|
|
9453
|
+
const checkedCandidates = (0, import_react21.useMemo)(() => candidateIds.filter((id) => checkedIds.includes(id)), [candidateIds, checkedIds]);
|
|
9106
9454
|
const isDirty = checkedCandidates.length !== assignedIds.length || checkedCandidates.some((id) => !assignedIds.includes(id));
|
|
9107
|
-
const submitAssignment = (0,
|
|
9455
|
+
const submitAssignment = (0, import_react21.useCallback)(async () => {
|
|
9108
9456
|
if (!selectedTargetId) {
|
|
9109
9457
|
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");
|
|
9110
9458
|
return;
|
|
@@ -9120,14 +9468,14 @@ var PlacementBlock = (props) => {
|
|
|
9120
9468
|
setIsSaving(false);
|
|
9121
9469
|
}
|
|
9122
9470
|
}, [selectedTargetId, persistAssignment, checkedCandidates]);
|
|
9123
|
-
const cycleStatus = (0,
|
|
9471
|
+
const cycleStatus = (0, import_react21.useCallback)((recordId) => {
|
|
9124
9472
|
setStatusMap((prev) => {
|
|
9125
9473
|
const current = prev[recordId] || defaultStatusId;
|
|
9126
9474
|
const idx = statuses.findIndex((c) => c.id === current);
|
|
9127
9475
|
return __spreadProps(__spreadValues({}, prev), { [recordId]: statuses[(idx + 1) % statuses.length].id });
|
|
9128
9476
|
});
|
|
9129
9477
|
}, [statuses, defaultStatusId]);
|
|
9130
|
-
const cancelAssignment = (0,
|
|
9478
|
+
const cancelAssignment = (0, import_react21.useCallback)(async () => {
|
|
9131
9479
|
if (!selectedTargetId || assignedIds.length === 0) return;
|
|
9132
9480
|
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;
|
|
9133
9481
|
const removed = new Set(assignedIds);
|
|
@@ -9143,7 +9491,8 @@ var PlacementBlock = (props) => {
|
|
|
9143
9491
|
setIsSaving(false);
|
|
9144
9492
|
}
|
|
9145
9493
|
}, [selectedTargetId, assignedIds, assignmentLabel, persistAssignment]);
|
|
9146
|
-
const makeColDefs = (0,
|
|
9494
|
+
const makeColDefs = (0, import_react21.useCallback)((columns, fallbackName, grid, withCheckbox = false) => {
|
|
9495
|
+
const gridFilters = colFilters[grid];
|
|
9147
9496
|
const defs = [];
|
|
9148
9497
|
if (withCheckbox) {
|
|
9149
9498
|
defs.push({
|
|
@@ -9173,21 +9522,50 @@ var PlacementBlock = (props) => {
|
|
|
9173
9522
|
var _a2;
|
|
9174
9523
|
return (_a2 = p.data) == null ? void 0 : _a2[displayField];
|
|
9175
9524
|
}, valueFormatter: (p) => cellText(p.value), getQuickFilterText: (p) => cellText(p.value), rowDrag: true, flex: 1, minWidth: 120 });
|
|
9176
|
-
ordered.forEach((c, i) =>
|
|
9525
|
+
ordered.forEach((c, i) => {
|
|
9526
|
+
const def = { 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 };
|
|
9527
|
+
if (String(c.type).toUpperCase() === "RELATION") {
|
|
9528
|
+
def.headerComponent = RelationFilterHeader;
|
|
9529
|
+
def.headerComponentParams = { colName: c.name, active: !!gridFilters[c.name], onOpen: (name, rect) => openColFilter(grid, name, rect) };
|
|
9530
|
+
}
|
|
9531
|
+
defs.push(def);
|
|
9532
|
+
});
|
|
9177
9533
|
} else {
|
|
9178
9534
|
defs.push({ field: "__label", headerName: fallbackName, rowDrag: true, flex: 1 });
|
|
9179
9535
|
}
|
|
9180
9536
|
return defs;
|
|
9181
|
-
}, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked]);
|
|
9537
|
+
}, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked, colFilters, openColFilter]);
|
|
9182
9538
|
const sourceHeader = displayField === "name" ? "\u05E9\u05DD" : columnRefLabel(displayField);
|
|
9183
|
-
const sourceColDefs = (0,
|
|
9184
|
-
const candidateColDefs = (0,
|
|
9185
|
-
const
|
|
9186
|
-
const
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
(0,
|
|
9539
|
+
const sourceColDefs = (0, import_react21.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, "source"), [makeColDefs, sourceColumns, sourceHeader]);
|
|
9540
|
+
const candidateColDefs = (0, import_react21.useMemo)(() => makeColDefs(sourceColumns, sourceHeader, "cand", true), [makeColDefs, sourceColumns, sourceHeader]);
|
|
9541
|
+
const defaultColDef = (0, import_react21.useMemo)(() => ({ resizable: true }), []);
|
|
9542
|
+
const scrollableColIds = (defs) => defs.filter((d) => !d.pinned).map((d) => {
|
|
9543
|
+
var _a2;
|
|
9544
|
+
return (_a2 = d.colId) != null ? _a2 : d.field;
|
|
9545
|
+
}).filter(Boolean);
|
|
9546
|
+
const expandColumns = (0, import_react21.useCallback)((api) => {
|
|
9547
|
+
api == null ? void 0 : api.sizeColumnsToFit();
|
|
9548
|
+
}, []);
|
|
9549
|
+
const shrinkColumns = (0, import_react21.useCallback)((api, defs) => {
|
|
9550
|
+
api == null ? void 0 : api.autoSizeColumns(scrollableColIds(defs));
|
|
9551
|
+
}, []);
|
|
9552
|
+
const popoverOptions = (0, import_react21.useMemo)(() => {
|
|
9553
|
+
if (!filterPopover) return [];
|
|
9554
|
+
const rows = filterPopover.grid === "source" ? availableRows : candidateRows;
|
|
9555
|
+
const set = /* @__PURE__ */ new Set();
|
|
9556
|
+
rows.forEach((r) => relationLabelsOf(r, filterPopover.colName).forEach((l) => set.add(l)));
|
|
9557
|
+
return Array.from(set).sort((a, b) => a.localeCompare(b, "he")).map((label) => ({ id: label, label }));
|
|
9558
|
+
}, [filterPopover, availableRows, candidateRows, relationLabelsOf]);
|
|
9559
|
+
const popoverColumn = (0, import_react21.useMemo)(
|
|
9560
|
+
() => filterPopover ? sourceColumns.find((c) => c.name === filterPopover.colName) : void 0,
|
|
9561
|
+
[filterPopover, sourceColumns]
|
|
9562
|
+
);
|
|
9563
|
+
const getRowId = (0, import_react21.useCallback)((p) => p.data.id, []);
|
|
9564
|
+
const sourceContainerRef = (0, import_react21.useRef)(null);
|
|
9565
|
+
const assignedContainerRef = (0, import_react21.useRef)(null);
|
|
9566
|
+
const [sourceApi, setSourceApi] = (0, import_react21.useState)(null);
|
|
9567
|
+
const [assignedApi, setAssignedApi] = (0, import_react21.useState)(null);
|
|
9568
|
+
(0, import_react21.useEffect)(() => {
|
|
9191
9569
|
if (!sourceApi || !assignedApi) return;
|
|
9192
9570
|
const toAssigned = { getContainer: () => assignedContainerRef.current, onDragStop: (p) => {
|
|
9193
9571
|
var _a2, _b2;
|
|
@@ -9210,61 +9588,61 @@ var PlacementBlock = (props) => {
|
|
|
9210
9588
|
}
|
|
9211
9589
|
};
|
|
9212
9590
|
}, [sourceApi, assignedApi]);
|
|
9213
|
-
const selectorLabel = (0,
|
|
9591
|
+
const selectorLabel = (0, import_react21.useMemo)(() => {
|
|
9214
9592
|
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
9215
9593
|
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";
|
|
9216
9594
|
}, [targetColumns, selectorField]);
|
|
9217
|
-
const assignedText = (0,
|
|
9595
|
+
const assignedText = (0, import_react21.useMemo)(
|
|
9218
9596
|
() => assignedIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", "),
|
|
9219
9597
|
[assignedIds, sourceRows, nameOf]
|
|
9220
9598
|
);
|
|
9221
9599
|
const activeTarget = targetRows.find((r) => r.id === selectedTargetId);
|
|
9222
|
-
const targetLabel = (0,
|
|
9600
|
+
const targetLabel = (0, import_react21.useCallback)((r) => {
|
|
9223
9601
|
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
9224
9602
|
return displayValue(col || { name: selectorField }, readColumnValue(r.data, selectorField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD";
|
|
9225
9603
|
}, [selectorField, targetColumns, displayValue]);
|
|
9226
|
-
const previewColumns = (0,
|
|
9604
|
+
const previewColumns = (0, import_react21.useMemo)(() => targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)), [targetColumns, assignmentField]);
|
|
9227
9605
|
if (!config || !sourceTableId || !targetTableId) {
|
|
9228
|
-
return /* @__PURE__ */ (0,
|
|
9606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.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)." });
|
|
9229
9607
|
}
|
|
9230
9608
|
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";
|
|
9231
9609
|
const labelClass = "block text-[11px] font-semibold text-slate-500 mb-1";
|
|
9232
|
-
return /* @__PURE__ */ (0,
|
|
9233
|
-
(loadError || saveError) && /* @__PURE__ */ (0,
|
|
9234
|
-
/* @__PURE__ */ (0,
|
|
9235
|
-
/* @__PURE__ */ (0,
|
|
9236
|
-
/* @__PURE__ */ (0,
|
|
9237
|
-
/* @__PURE__ */ (0,
|
|
9610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.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: [
|
|
9611
|
+
(loadError || saveError) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-3 text-xs rounded-lg bg-rose-50 border border-rose-200 text-rose-700", children: loadError || saveError }),
|
|
9612
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col lg:flex-row gap-4", children: [
|
|
9613
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "w-full lg:w-1/2 bg-teal-50/40 p-4 rounded-xl border border-teal-100 shadow-xs flex flex-col", children: [
|
|
9614
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("h4", { className: "font-bold text-teal-900 border-b border-teal-200 pb-2 mb-3 text-base flex items-center gap-2", children: [
|
|
9615
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "\u{1F4CC}" }),
|
|
9238
9616
|
" \u05E4\u05E8\u05D8\u05D9 \u05D4\u05D9\u05E2\u05D3 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5"
|
|
9239
9617
|
] }),
|
|
9240
|
-
activeTarget ? /* @__PURE__ */ (0,
|
|
9241
|
-
/* @__PURE__ */ (0,
|
|
9618
|
+
activeTarget ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 content-start text-base text-slate-700 flex-1", children: [
|
|
9619
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "col-span-full font-bold text-slate-900 text-lg mb-1", children: targetLabel(activeTarget) }),
|
|
9242
9620
|
previewColumns.map((col) => ({ col, text: displayValue(col, readColumnValue(activeTarget.data, col.name)) })).filter(({ col, text: text2 }) => {
|
|
9243
9621
|
var _a2;
|
|
9244
9622
|
return text2 && (col.type === "RELATION" || typeof ((_a2 = activeTarget.data) == null ? void 0 : _a2[col.name]) !== "object");
|
|
9245
|
-
}).map(({ col, text: text2 }) => /* @__PURE__ */ (0,
|
|
9246
|
-
/* @__PURE__ */ (0,
|
|
9623
|
+
}).map(({ col, text: text2 }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `flex gap-2 items-start ${(col.label || col.name) === "\u05E4\u05E8\u05D8\u05D9\u05DD \u05E0\u05D5\u05E1\u05E4\u05D9\u05DD" ? "sm:col-span-2" : ""}`, children: [
|
|
9624
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-semibold shrink-0", children: [
|
|
9247
9625
|
col.label || col.name,
|
|
9248
9626
|
":"
|
|
9249
9627
|
] }),
|
|
9250
|
-
/* @__PURE__ */ (0,
|
|
9628
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "break-words", children: text2 })
|
|
9251
9629
|
] }, col.name)),
|
|
9252
|
-
assignmentField && assignedText && /* @__PURE__ */ (0,
|
|
9253
|
-
/* @__PURE__ */ (0,
|
|
9630
|
+
assignmentField && assignedText && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex gap-2 items-start", children: [
|
|
9631
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "font-semibold shrink-0", children: [
|
|
9254
9632
|
assignmentLabel,
|
|
9255
9633
|
":"
|
|
9256
9634
|
] }),
|
|
9257
|
-
/* @__PURE__ */ (0,
|
|
9635
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "break-words", title: assignedText, children: assignedText })
|
|
9258
9636
|
] }),
|
|
9259
|
-
/* @__PURE__ */ (0,
|
|
9637
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "col-span-full self-end mt-1 pt-1.5 border-t border-teal-200/60 text-teal-800 font-bold text-xs leading-none whitespace-nowrap overflow-hidden text-ellipsis", children: [
|
|
9260
9638
|
"\u05DE\u05E9\u05D5\u05D1\u05E6\u05D9\u05DD \u05DB\u05E8\u05D2\u05E2: ",
|
|
9261
9639
|
assignedIds.length
|
|
9262
9640
|
] })
|
|
9263
|
-
] }) : /* @__PURE__ */ (0,
|
|
9641
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.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." })
|
|
9264
9642
|
] }),
|
|
9265
|
-
/* @__PURE__ */ (0,
|
|
9266
|
-
/* @__PURE__ */ (0,
|
|
9267
|
-
/* @__PURE__ */ (0,
|
|
9643
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "w-full lg:w-1/2 bg-white p-4 rounded-xl border border-slate-200 shadow-xs flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
9644
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" }),
|
|
9645
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
9268
9646
|
filterColumns.map((col, index) => {
|
|
9269
9647
|
const previousColumns = filterColumns.slice(0, index);
|
|
9270
9648
|
const validRowsForThisFilter = targetRows.filter((r) => {
|
|
@@ -9277,9 +9655,9 @@ var PlacementBlock = (props) => {
|
|
|
9277
9655
|
const uniqueValues = Array.from(new Set(
|
|
9278
9656
|
validRowsForThisFilter.map((r) => displayValue(col, readColumnValue(r.data, col.name)))
|
|
9279
9657
|
)).filter(Boolean).sort((a, b) => a.localeCompare(b, "he"));
|
|
9280
|
-
return /* @__PURE__ */ (0,
|
|
9281
|
-
/* @__PURE__ */ (0,
|
|
9282
|
-
/* @__PURE__ */ (0,
|
|
9658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
9659
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: labelClass, children: col.label || columnRefLabel(col.name) }),
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
9283
9661
|
"select",
|
|
9284
9662
|
{
|
|
9285
9663
|
className: selectClass,
|
|
@@ -9295,74 +9673,103 @@ var PlacementBlock = (props) => {
|
|
|
9295
9673
|
});
|
|
9296
9674
|
},
|
|
9297
9675
|
children: [
|
|
9298
|
-
/* @__PURE__ */ (0,
|
|
9299
|
-
uniqueValues.map((v) => /* @__PURE__ */ (0,
|
|
9676
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
9677
|
+
uniqueValues.map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: v, children: v }, v))
|
|
9300
9678
|
]
|
|
9301
9679
|
}
|
|
9302
9680
|
)
|
|
9303
9681
|
] }, col.name);
|
|
9304
9682
|
}),
|
|
9305
|
-
/* @__PURE__ */ (0,
|
|
9306
|
-
/* @__PURE__ */ (0,
|
|
9307
|
-
/* @__PURE__ */ (0,
|
|
9308
|
-
/* @__PURE__ */ (0,
|
|
9683
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
9684
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: labelClass, children: selectorLabel }),
|
|
9685
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("select", { className: selectClass, value: selectedTargetId, onChange: (e) => setSelectedTargetId(e.target.value), children: [
|
|
9686
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: "", children: [
|
|
9309
9687
|
"-- \u05D1\u05D7\u05E8 \u05DE\u05EA\u05D5\u05DA ",
|
|
9310
9688
|
filteredTargetRows.length,
|
|
9311
9689
|
" \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA --"
|
|
9312
9690
|
] }),
|
|
9313
|
-
filteredTargetRows.map((r) => /* @__PURE__ */ (0,
|
|
9691
|
+
filteredTargetRows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("option", { value: r.id, children: targetLabel(r) }, r.id))
|
|
9314
9692
|
] })
|
|
9315
9693
|
] })
|
|
9316
|
-
] })
|
|
9694
|
+
] }),
|
|
9695
|
+
hasRelationButtons && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
9696
|
+
PlacementRelationButtons,
|
|
9697
|
+
{
|
|
9698
|
+
className: "mt-4 pb-24",
|
|
9699
|
+
columnNames: relationButtonColumns,
|
|
9700
|
+
rows: availableRows,
|
|
9701
|
+
filters: sourceRelFilters,
|
|
9702
|
+
onFilterChange: handleRelationFilterChange,
|
|
9703
|
+
relationOptions: sourceRelOptions
|
|
9704
|
+
}
|
|
9705
|
+
)
|
|
9317
9706
|
] }) })
|
|
9318
9707
|
] }),
|
|
9319
|
-
/* @__PURE__ */ (0,
|
|
9320
|
-
/* @__PURE__ */ (0,
|
|
9321
|
-
/* @__PURE__ */ (0,
|
|
9322
|
-
/* @__PURE__ */ (0,
|
|
9323
|
-
/* @__PURE__ */ (0,
|
|
9708
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col lg:flex-row w-full gap-4 h-[550px]", children: [
|
|
9709
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `w-full ${hasRelationButtons ? "lg:flex-1 lg:min-w-0" : "lg:w-1/2"} flex flex-col border border-slate-200 rounded-xl shadow-xs bg-white overflow-hidden`, children: [
|
|
9710
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-slate-100 p-3 border-b border-slate-200 flex flex-col gap-2", children: [
|
|
9711
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex justify-between items-center font-bold text-slate-800 text-sm", children: [
|
|
9712
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
9324
9713
|
"\u05E8\u05E9\u05D9\u05DE\u05EA \u05DE\u05E7\u05D5\u05E8 (",
|
|
9325
9714
|
availableGridData.length,
|
|
9326
9715
|
")"
|
|
9327
9716
|
] }),
|
|
9328
|
-
/* @__PURE__ */ (0,
|
|
9717
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9718
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => shrinkColumns(sourceApi, sourceColDefs), title: "\u05E6\u05DE\u05E6\u05DD \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E4\u05D9 \u05D4\u05EA\u05D5\u05DB\u05DF", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 cursor-pointer", children: "\u2192\u2190 \u05E6\u05DE\u05E6\u05DD" }),
|
|
9719
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => expandColumns(sourceApi), title: "\u05D4\u05E8\u05D7\u05D1 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E8\u05D5\u05D7\u05D1 \u05D4\u05D8\u05D1\u05DC\u05D4", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-slate-200 text-slate-600 hover:bg-slate-50 cursor-pointer", children: "\u2190\u2192 \u05D4\u05E8\u05D7\u05D1" }),
|
|
9720
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" })
|
|
9721
|
+
] })
|
|
9329
9722
|
] }),
|
|
9330
|
-
/* @__PURE__ */ (0,
|
|
9723
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" })
|
|
9331
9724
|
] }),
|
|
9332
|
-
/* @__PURE__ */ (0,
|
|
9725
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: sourceContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ag_grid_react.AgGridReact, { rowData: availableGridData, columnDefs: sourceColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: sourceSearch, onGridReady: (e) => setSourceApi(e.api), loading: isLoading }) })
|
|
9333
9726
|
] }),
|
|
9334
|
-
/* @__PURE__ */ (0,
|
|
9335
|
-
/* @__PURE__ */ (0,
|
|
9336
|
-
/* @__PURE__ */ (0,
|
|
9337
|
-
/* @__PURE__ */ (0,
|
|
9338
|
-
/* @__PURE__ */ (0,
|
|
9727
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: `w-full ${hasRelationButtons ? "lg:flex-1 lg:min-w-0" : "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: [
|
|
9728
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "bg-blue-50/80 p-3 border-b border-blue-100 flex flex-col gap-2", children: [
|
|
9729
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [
|
|
9730
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2 font-bold text-blue-900 text-sm", children: [
|
|
9731
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
|
|
9339
9732
|
"\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 (",
|
|
9340
9733
|
candidateGridData.length,
|
|
9341
9734
|
")"
|
|
9342
9735
|
] }),
|
|
9343
|
-
/* @__PURE__ */ (0,
|
|
9736
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" }),
|
|
9737
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => shrinkColumns(assignedApi, candidateColDefs), title: "\u05E6\u05DE\u05E6\u05DD \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E4\u05D9 \u05D4\u05EA\u05D5\u05DB\u05DF", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-blue-100 text-slate-600 hover:bg-blue-50 cursor-pointer", children: "\u2192\u2190 \u05E6\u05DE\u05E6\u05DD" }),
|
|
9738
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: () => expandColumns(assignedApi), title: "\u05D4\u05E8\u05D7\u05D1 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05DC\u05E8\u05D5\u05D7\u05D1 \u05D4\u05D8\u05D1\u05DC\u05D4", className: "px-2 py-0.5 rounded-md text-[11px] font-medium bg-white border border-blue-100 text-slate-600 hover:bg-blue-50 cursor-pointer", children: "\u2190\u2192 \u05D4\u05E8\u05D7\u05D1" })
|
|
9344
9739
|
] }),
|
|
9345
|
-
/* @__PURE__ */ (0,
|
|
9346
|
-
/* @__PURE__ */ (0,
|
|
9347
|
-
/* @__PURE__ */ (0,
|
|
9348
|
-
/* @__PURE__ */ (0,
|
|
9740
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9741
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" }),
|
|
9742
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" }),
|
|
9743
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" })
|
|
9349
9744
|
] })
|
|
9350
9745
|
] }),
|
|
9351
|
-
/* @__PURE__ */ (0,
|
|
9746
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.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" })
|
|
9352
9747
|
] }),
|
|
9353
|
-
/* @__PURE__ */ (0,
|
|
9748
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: assignedContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ag_grid_react.AgGridReact, { rowData: candidateGridData, columnDefs: candidateColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: candidateSearch, onGridReady: (e) => setAssignedApi(e.api), loading: isLoading }) })
|
|
9354
9749
|
] })
|
|
9355
|
-
] })
|
|
9750
|
+
] }),
|
|
9751
|
+
filterPopover && popoverColumn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
9752
|
+
RelationFilterPopover,
|
|
9753
|
+
{
|
|
9754
|
+
isOpen: true,
|
|
9755
|
+
onClose: closeColFilter,
|
|
9756
|
+
column: popoverColumn,
|
|
9757
|
+
triggerRect: filterPopover.rect,
|
|
9758
|
+
options: popoverOptions,
|
|
9759
|
+
filterValue: colFilters[filterPopover.grid][filterPopover.colName],
|
|
9760
|
+
onSelectionChange: (payload) => setColFilter(filterPopover.grid, filterPopover.colName, payload)
|
|
9761
|
+
}
|
|
9762
|
+
)
|
|
9356
9763
|
] });
|
|
9357
9764
|
};
|
|
9358
9765
|
|
|
9359
9766
|
// src/components/WhatsAppComponent/WhatsAppComponent.tsx
|
|
9360
|
-
var
|
|
9767
|
+
var import_react27 = __toESM(require("react"));
|
|
9361
9768
|
var import_lucide_react17 = require("lucide-react");
|
|
9362
9769
|
|
|
9363
9770
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
9364
|
-
var
|
|
9365
|
-
var
|
|
9771
|
+
var import_react22 = require("react");
|
|
9772
|
+
var import_lucide_react11 = require("lucide-react");
|
|
9366
9773
|
var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
|
|
9367
9774
|
|
|
9368
9775
|
// src/components/WhatsAppComponent/utils/templateModalHelpers.ts
|
|
@@ -9481,7 +9888,7 @@ function readFileAsBase64(file) {
|
|
|
9481
9888
|
}
|
|
9482
9889
|
|
|
9483
9890
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
9484
|
-
var
|
|
9891
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
9485
9892
|
function CreateTemplateModal({
|
|
9486
9893
|
isOpen,
|
|
9487
9894
|
onClose,
|
|
@@ -9491,26 +9898,26 @@ function CreateTemplateModal({
|
|
|
9491
9898
|
executeAction,
|
|
9492
9899
|
orgId
|
|
9493
9900
|
}) {
|
|
9494
|
-
const [templateName, setTemplateName] = (0,
|
|
9495
|
-
const [language, setLanguage] = (0,
|
|
9496
|
-
const [category, setCategory] = (0,
|
|
9497
|
-
const [bodyText, setBodyText] = (0,
|
|
9498
|
-
const [variableSamples, setVariableSamples] = (0,
|
|
9499
|
-
const [hasFileHeader, setHasFileHeader] = (0,
|
|
9500
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
9501
|
-
const [fileBase64, setFileBase64] = (0,
|
|
9502
|
-
const [buttons, setButtons] = (0,
|
|
9503
|
-
const [isAddButtonOpen, setIsAddButtonOpen] = (0,
|
|
9504
|
-
const addButtonDropdownRef = (0,
|
|
9505
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
9506
|
-
const [submittingStep, setSubmittingStep] = (0,
|
|
9507
|
-
const [submitError, setSubmitError] = (0,
|
|
9508
|
-
const [fileError, setFileError] = (0,
|
|
9509
|
-
const textareaRef = (0,
|
|
9510
|
-
const fileInputRef = (0,
|
|
9511
|
-
const emojiPickerRef = (0,
|
|
9512
|
-
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0,
|
|
9513
|
-
(0,
|
|
9901
|
+
const [templateName, setTemplateName] = (0, import_react22.useState)("");
|
|
9902
|
+
const [language, setLanguage] = (0, import_react22.useState)("he");
|
|
9903
|
+
const [category, setCategory] = (0, import_react22.useState)("MARKETING");
|
|
9904
|
+
const [bodyText, setBodyText] = (0, import_react22.useState)("");
|
|
9905
|
+
const [variableSamples, setVariableSamples] = (0, import_react22.useState)({});
|
|
9906
|
+
const [hasFileHeader, setHasFileHeader] = (0, import_react22.useState)(false);
|
|
9907
|
+
const [selectedFile, setSelectedFile] = (0, import_react22.useState)(null);
|
|
9908
|
+
const [fileBase64, setFileBase64] = (0, import_react22.useState)("");
|
|
9909
|
+
const [buttons, setButtons] = (0, import_react22.useState)([]);
|
|
9910
|
+
const [isAddButtonOpen, setIsAddButtonOpen] = (0, import_react22.useState)(false);
|
|
9911
|
+
const addButtonDropdownRef = (0, import_react22.useRef)(null);
|
|
9912
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react22.useState)(false);
|
|
9913
|
+
const [submittingStep, setSubmittingStep] = (0, import_react22.useState)("");
|
|
9914
|
+
const [submitError, setSubmitError] = (0, import_react22.useState)(null);
|
|
9915
|
+
const [fileError, setFileError] = (0, import_react22.useState)(null);
|
|
9916
|
+
const textareaRef = (0, import_react22.useRef)(null);
|
|
9917
|
+
const fileInputRef = (0, import_react22.useRef)(null);
|
|
9918
|
+
const emojiPickerRef = (0, import_react22.useRef)(null);
|
|
9919
|
+
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = (0, import_react22.useState)(false);
|
|
9920
|
+
(0, import_react22.useEffect)(() => {
|
|
9514
9921
|
function handleClickOutside(event) {
|
|
9515
9922
|
if (emojiPickerRef.current && !emojiPickerRef.current.contains(event.target)) {
|
|
9516
9923
|
setIsEmojiPickerOpen(false);
|
|
@@ -9534,7 +9941,7 @@ function CreateTemplateModal({
|
|
|
9534
9941
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
9535
9942
|
};
|
|
9536
9943
|
}, [isEmojiPickerOpen, isAddButtonOpen]);
|
|
9537
|
-
(0,
|
|
9944
|
+
(0, import_react22.useEffect)(() => {
|
|
9538
9945
|
if (isOpen) {
|
|
9539
9946
|
setTemplateName("");
|
|
9540
9947
|
setLanguage("he");
|
|
@@ -9553,10 +9960,10 @@ function CreateTemplateModal({
|
|
|
9553
9960
|
setIsEmojiPickerOpen(false);
|
|
9554
9961
|
}
|
|
9555
9962
|
}, [isOpen]);
|
|
9556
|
-
const uniqueVariables = (0,
|
|
9963
|
+
const uniqueVariables = (0, import_react22.useMemo)(() => {
|
|
9557
9964
|
return extractUniqueVariableIndices(bodyText);
|
|
9558
9965
|
}, [bodyText]);
|
|
9559
|
-
(0,
|
|
9966
|
+
(0, import_react22.useEffect)(() => {
|
|
9560
9967
|
setVariableSamples((prev) => {
|
|
9561
9968
|
const next = {};
|
|
9562
9969
|
uniqueVariables.forEach((idx) => {
|
|
@@ -9567,7 +9974,7 @@ function CreateTemplateModal({
|
|
|
9567
9974
|
}, [uniqueVariables]);
|
|
9568
9975
|
const isNameEmpty = templateName.trim().length === 0;
|
|
9569
9976
|
const isNamePatternValid = isValidTemplateName(templateName);
|
|
9570
|
-
const isNameDuplicate = (0,
|
|
9977
|
+
const isNameDuplicate = (0, import_react22.useMemo)(() => {
|
|
9571
9978
|
const trimmedName = templateName.trim().toLowerCase();
|
|
9572
9979
|
if (!trimmedName) return false;
|
|
9573
9980
|
if (existingTemplates && existingTemplates.length > 0) {
|
|
@@ -9577,9 +9984,9 @@ function CreateTemplateModal({
|
|
|
9577
9984
|
}
|
|
9578
9985
|
return isDuplicateTemplateName(trimmedName, existingTemplateNames, language);
|
|
9579
9986
|
}, [templateName, language, existingTemplates, existingTemplateNames]);
|
|
9580
|
-
const ratioInfo = (0,
|
|
9581
|
-
const seqInfo = (0,
|
|
9582
|
-
const validationResult = (0,
|
|
9987
|
+
const ratioInfo = (0, import_react22.useMemo)(() => validateWordToVariableRatio(bodyText), [bodyText]);
|
|
9988
|
+
const seqInfo = (0, import_react22.useMemo)(() => validateSequentialVariables(bodyText), [bodyText]);
|
|
9989
|
+
const validationResult = (0, import_react22.useMemo)(() => {
|
|
9583
9990
|
return validateWhatsAppTemplate({
|
|
9584
9991
|
name: templateName,
|
|
9585
9992
|
language,
|
|
@@ -9833,12 +10240,12 @@ function CreateTemplateModal({
|
|
|
9833
10240
|
}
|
|
9834
10241
|
};
|
|
9835
10242
|
if (!isOpen) return null;
|
|
9836
|
-
return /* @__PURE__ */ (0,
|
|
10243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9837
10244
|
"div",
|
|
9838
10245
|
{
|
|
9839
10246
|
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",
|
|
9840
10247
|
dir: "rtl",
|
|
9841
|
-
children: /* @__PURE__ */ (0,
|
|
10248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
9842
10249
|
"div",
|
|
9843
10250
|
{
|
|
9844
10251
|
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",
|
|
@@ -9846,43 +10253,43 @@ function CreateTemplateModal({
|
|
|
9846
10253
|
"aria-modal": "true",
|
|
9847
10254
|
"aria-labelledby": "modal-title",
|
|
9848
10255
|
children: [
|
|
9849
|
-
/* @__PURE__ */ (0,
|
|
9850
|
-
/* @__PURE__ */ (0,
|
|
9851
|
-
/* @__PURE__ */ (0,
|
|
9852
|
-
/* @__PURE__ */ (0,
|
|
9853
|
-
/* @__PURE__ */ (0,
|
|
9854
|
-
/* @__PURE__ */ (0,
|
|
10256
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
10257
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
10258
|
+
/* @__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_react11.Plus, { className: "w-4 h-4" }) }),
|
|
10259
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10260
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" }),
|
|
10261
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
9855
10262
|
] })
|
|
9856
10263
|
] }),
|
|
9857
|
-
/* @__PURE__ */ (0,
|
|
10264
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9858
10265
|
"button",
|
|
9859
10266
|
{
|
|
9860
10267
|
type: "button",
|
|
9861
10268
|
onClick: onClose,
|
|
9862
10269
|
className: "p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer",
|
|
9863
10270
|
"aria-label": "\u05E1\u05D2\u05D5\u05E8",
|
|
9864
|
-
children: /* @__PURE__ */ (0,
|
|
10271
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.X, { className: "w-5 h-5" })
|
|
9865
10272
|
}
|
|
9866
10273
|
)
|
|
9867
10274
|
] }),
|
|
9868
|
-
/* @__PURE__ */ (0,
|
|
9869
|
-
/* @__PURE__ */ (0,
|
|
9870
|
-
submitError && /* @__PURE__ */ (0,
|
|
9871
|
-
/* @__PURE__ */ (0,
|
|
9872
|
-
/* @__PURE__ */ (0,
|
|
10275
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
|
|
10276
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
|
|
10277
|
+
submitError && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10278
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
10279
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: submitError })
|
|
9873
10280
|
] }),
|
|
9874
|
-
/* @__PURE__ */ (0,
|
|
9875
|
-
/* @__PURE__ */ (0,
|
|
9876
|
-
/* @__PURE__ */ (0,
|
|
10281
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
|
|
10282
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10283
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
9877
10284
|
"\u05E9\u05DD \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4 ",
|
|
9878
|
-
/* @__PURE__ */ (0,
|
|
10285
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
9879
10286
|
] }),
|
|
9880
|
-
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0,
|
|
9881
|
-
/* @__PURE__ */ (0,
|
|
10287
|
+
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
|
|
10288
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.CheckCircle2, { className: "w-3.5 h-3.5" }),
|
|
9882
10289
|
" \u05E9\u05DD \u05EA\u05E7\u05D9\u05DF"
|
|
9883
10290
|
] })
|
|
9884
10291
|
] }),
|
|
9885
|
-
/* @__PURE__ */ (0,
|
|
10292
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9886
10293
|
"input",
|
|
9887
10294
|
{
|
|
9888
10295
|
type: "text",
|
|
@@ -9894,47 +10301,47 @@ function CreateTemplateModal({
|
|
|
9894
10301
|
required: true
|
|
9895
10302
|
}
|
|
9896
10303
|
),
|
|
9897
|
-
/* @__PURE__ */ (0,
|
|
9898
|
-
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0,
|
|
9899
|
-
/* @__PURE__ */ (0,
|
|
10304
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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." }),
|
|
10305
|
+
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
|
|
10306
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
9900
10307
|
"\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 (",
|
|
9901
10308
|
language,
|
|
9902
10309
|
"). \u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E9\u05DD \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05D0\u05D5 \u05E9\u05E4\u05D4 \u05D0\u05D7\u05E8\u05EA."
|
|
9903
10310
|
] })
|
|
9904
10311
|
] }),
|
|
9905
|
-
/* @__PURE__ */ (0,
|
|
9906
|
-
/* @__PURE__ */ (0,
|
|
9907
|
-
/* @__PURE__ */ (0,
|
|
9908
|
-
/* @__PURE__ */ (0,
|
|
10312
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10313
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
|
|
10314
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
|
|
10315
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9909
10316
|
"select",
|
|
9910
10317
|
{
|
|
9911
10318
|
value: language,
|
|
9912
10319
|
onChange: (e) => setLanguage(e.target.value),
|
|
9913
10320
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
9914
|
-
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0,
|
|
10321
|
+
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
9915
10322
|
}
|
|
9916
10323
|
)
|
|
9917
10324
|
] }),
|
|
9918
|
-
/* @__PURE__ */ (0,
|
|
9919
|
-
/* @__PURE__ */ (0,
|
|
9920
|
-
/* @__PURE__ */ (0,
|
|
10325
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1.5", children: [
|
|
10326
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
|
|
10327
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9921
10328
|
"select",
|
|
9922
10329
|
{
|
|
9923
10330
|
value: category,
|
|
9924
10331
|
onChange: (e) => setCategory(e.target.value),
|
|
9925
10332
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
9926
|
-
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0,
|
|
10333
|
+
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
9927
10334
|
}
|
|
9928
10335
|
)
|
|
9929
10336
|
] })
|
|
9930
10337
|
] }),
|
|
9931
|
-
/* @__PURE__ */ (0,
|
|
9932
|
-
/* @__PURE__ */ (0,
|
|
10338
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-2", children: [
|
|
10339
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
9933
10340
|
"\u05EA\u05D5\u05DB\u05DF \u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 ",
|
|
9934
|
-
/* @__PURE__ */ (0,
|
|
10341
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
9935
10342
|
] }),
|
|
9936
|
-
/* @__PURE__ */ (0,
|
|
9937
|
-
/* @__PURE__ */ (0,
|
|
10343
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10344
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9938
10345
|
"textarea",
|
|
9939
10346
|
{
|
|
9940
10347
|
ref: textareaRef,
|
|
@@ -9949,14 +10356,14 @@ function CreateTemplateModal({
|
|
|
9949
10356
|
required: true
|
|
9950
10357
|
}
|
|
9951
10358
|
),
|
|
9952
|
-
/* @__PURE__ */ (0,
|
|
10359
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
9953
10360
|
"div",
|
|
9954
10361
|
{
|
|
9955
10362
|
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",
|
|
9956
10363
|
dir: language === "en_US" ? "ltr" : "rtl",
|
|
9957
10364
|
children: [
|
|
9958
|
-
/* @__PURE__ */ (0,
|
|
9959
|
-
/* @__PURE__ */ (0,
|
|
10365
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9960
10367
|
"button",
|
|
9961
10368
|
{
|
|
9962
10369
|
type: "button",
|
|
@@ -9964,10 +10371,10 @@ function CreateTemplateModal({
|
|
|
9964
10371
|
onClick: () => handleApplyFormatting("*"),
|
|
9965
10372
|
title: "\u05DE\u05D5\u05D3\u05D2\u05E9 (Bold) *\u05D8\u05E7\u05E1\u05D8*",
|
|
9966
10373
|
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",
|
|
9967
|
-
children: /* @__PURE__ */ (0,
|
|
10374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Bold, { className: "w-3.5 h-3.5" })
|
|
9968
10375
|
}
|
|
9969
10376
|
),
|
|
9970
|
-
/* @__PURE__ */ (0,
|
|
10377
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9971
10378
|
"button",
|
|
9972
10379
|
{
|
|
9973
10380
|
type: "button",
|
|
@@ -9975,10 +10382,10 @@ function CreateTemplateModal({
|
|
|
9975
10382
|
onClick: () => handleApplyFormatting("_"),
|
|
9976
10383
|
title: "\u05E0\u05D8\u05D5\u05D9 (Italic) _\u05D8\u05E7\u05E1\u05D8_",
|
|
9977
10384
|
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",
|
|
9978
|
-
children: /* @__PURE__ */ (0,
|
|
10385
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Italic, { className: "w-3.5 h-3.5" })
|
|
9979
10386
|
}
|
|
9980
10387
|
),
|
|
9981
|
-
/* @__PURE__ */ (0,
|
|
10388
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9982
10389
|
"button",
|
|
9983
10390
|
{
|
|
9984
10391
|
type: "button",
|
|
@@ -9986,12 +10393,12 @@ function CreateTemplateModal({
|
|
|
9986
10393
|
onClick: () => handleApplyFormatting("~"),
|
|
9987
10394
|
title: "\u05E7\u05D5 \u05D7\u05D5\u05E6\u05D4 (Strikethrough) ~\u05D8\u05E7\u05E1\u05D8~",
|
|
9988
10395
|
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",
|
|
9989
|
-
children: /* @__PURE__ */ (0,
|
|
10396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Strikethrough, { className: "w-3.5 h-3.5" })
|
|
9990
10397
|
}
|
|
9991
10398
|
),
|
|
9992
|
-
/* @__PURE__ */ (0,
|
|
9993
|
-
/* @__PURE__ */ (0,
|
|
9994
|
-
/* @__PURE__ */ (0,
|
|
10399
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
10400
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
|
|
10401
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
9995
10402
|
"button",
|
|
9996
10403
|
{
|
|
9997
10404
|
type: "button",
|
|
@@ -9999,16 +10406,16 @@ function CreateTemplateModal({
|
|
|
9999
10406
|
onClick: () => setIsEmojiPickerOpen(!isEmojiPickerOpen),
|
|
10000
10407
|
title: "\u05D4\u05D5\u05E1\u05E3 \u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9 (Emoji)",
|
|
10001
10408
|
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"}`,
|
|
10002
|
-
children: /* @__PURE__ */ (0,
|
|
10409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Smile, { className: "w-4 h-4" })
|
|
10003
10410
|
}
|
|
10004
10411
|
),
|
|
10005
|
-
isEmojiPickerOpen && /* @__PURE__ */ (0,
|
|
10412
|
+
isEmojiPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10006
10413
|
"div",
|
|
10007
10414
|
{
|
|
10008
10415
|
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`,
|
|
10009
10416
|
dir: "ltr",
|
|
10010
10417
|
onMouseDown: (e) => e.stopPropagation(),
|
|
10011
|
-
children: /* @__PURE__ */ (0,
|
|
10418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10012
10419
|
import_emoji_picker_react.default,
|
|
10013
10420
|
{
|
|
10014
10421
|
onEmojiClick: (emojiData) => {
|
|
@@ -10025,8 +10432,8 @@ function CreateTemplateModal({
|
|
|
10025
10432
|
}
|
|
10026
10433
|
)
|
|
10027
10434
|
] }),
|
|
10028
|
-
/* @__PURE__ */ (0,
|
|
10029
|
-
/* @__PURE__ */ (0,
|
|
10435
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
10436
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10030
10437
|
"button",
|
|
10031
10438
|
{
|
|
10032
10439
|
type: "button",
|
|
@@ -10036,28 +10443,28 @@ function CreateTemplateModal({
|
|
|
10036
10443
|
"aria-label": language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4",
|
|
10037
10444
|
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",
|
|
10038
10445
|
children: [
|
|
10039
|
-
/* @__PURE__ */ (0,
|
|
10040
|
-
/* @__PURE__ */ (0,
|
|
10446
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
|
|
10447
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
|
|
10041
10448
|
]
|
|
10042
10449
|
}
|
|
10043
10450
|
)
|
|
10044
10451
|
] }),
|
|
10045
|
-
/* @__PURE__ */ (0,
|
|
10452
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10046
10453
|
"div",
|
|
10047
10454
|
{
|
|
10048
10455
|
className: "flex items-center gap-1 font-mono text-[11px]",
|
|
10049
10456
|
dir: "ltr",
|
|
10050
10457
|
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)",
|
|
10051
10458
|
children: [
|
|
10052
|
-
/* @__PURE__ */ (0,
|
|
10459
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10053
10460
|
"span",
|
|
10054
10461
|
{
|
|
10055
10462
|
className: `font-semibold transition-colors ${bodyText.length >= 1024 ? "text-rose-600" : bodyText.length >= 950 ? "text-amber-600" : "text-slate-500"}`,
|
|
10056
10463
|
children: bodyText.length
|
|
10057
10464
|
}
|
|
10058
10465
|
),
|
|
10059
|
-
/* @__PURE__ */ (0,
|
|
10060
|
-
/* @__PURE__ */ (0,
|
|
10466
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-300", children: "/" }),
|
|
10467
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-slate-400", children: "1024" })
|
|
10061
10468
|
]
|
|
10062
10469
|
}
|
|
10063
10470
|
)
|
|
@@ -10065,30 +10472,30 @@ function CreateTemplateModal({
|
|
|
10065
10472
|
}
|
|
10066
10473
|
)
|
|
10067
10474
|
] }),
|
|
10068
|
-
/* @__PURE__ */ (0,
|
|
10069
|
-
/* @__PURE__ */ (0,
|
|
10475
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
10476
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
|
|
10070
10477
|
ratioInfo.staticWordsCount,
|
|
10071
10478
|
" \u05DE\u05D9\u05DC\u05D9\u05DD"
|
|
10072
10479
|
] }),
|
|
10073
|
-
/* @__PURE__ */ (0,
|
|
10480
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { children: [
|
|
10074
10481
|
ratioInfo.variableCount,
|
|
10075
10482
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
10076
10483
|
] })
|
|
10077
10484
|
] }) }),
|
|
10078
|
-
uniqueVariables.length > 0 && /* @__PURE__ */ (0,
|
|
10079
|
-
/* @__PURE__ */ (0,
|
|
10080
|
-
/* @__PURE__ */ (0,
|
|
10081
|
-
/* @__PURE__ */ (0,
|
|
10485
|
+
uniqueVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
10486
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
|
|
10487
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Info, { className: "w-4 h-4 text-emerald-600" }),
|
|
10488
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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)" })
|
|
10082
10489
|
] }),
|
|
10083
|
-
/* @__PURE__ */ (0,
|
|
10084
|
-
/* @__PURE__ */ (0,
|
|
10085
|
-
/* @__PURE__ */ (0,
|
|
10490
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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." }),
|
|
10491
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10492
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
|
|
10086
10493
|
"\u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 ",
|
|
10087
10494
|
`{{${idx}}}`,
|
|
10088
10495
|
" ",
|
|
10089
|
-
/* @__PURE__ */ (0,
|
|
10496
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10090
10497
|
] }),
|
|
10091
|
-
/* @__PURE__ */ (0,
|
|
10498
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10092
10499
|
"input",
|
|
10093
10500
|
{
|
|
10094
10501
|
type: "text",
|
|
@@ -10103,21 +10510,21 @@ function CreateTemplateModal({
|
|
|
10103
10510
|
)
|
|
10104
10511
|
] }, idx)) })
|
|
10105
10512
|
] }),
|
|
10106
|
-
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0,
|
|
10107
|
-
/* @__PURE__ */ (0,
|
|
10108
|
-
/* @__PURE__ */ (0,
|
|
10109
|
-
/* @__PURE__ */ (0,
|
|
10513
|
+
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10514
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1.5 font-bold", children: [
|
|
10515
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
10516
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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:" })
|
|
10110
10517
|
] }),
|
|
10111
|
-
/* @__PURE__ */ (0,
|
|
10518
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)("li", { children: err }, i)) })
|
|
10112
10519
|
] })
|
|
10113
10520
|
] }),
|
|
10114
|
-
/* @__PURE__ */ (0,
|
|
10115
|
-
/* @__PURE__ */ (0,
|
|
10116
|
-
/* @__PURE__ */ (0,
|
|
10117
|
-
/* @__PURE__ */ (0,
|
|
10118
|
-
/* @__PURE__ */ (0,
|
|
10521
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
10522
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10523
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10524
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Paperclip, { className: "w-4 h-4 text-slate-600" }),
|
|
10525
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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)" })
|
|
10119
10526
|
] }),
|
|
10120
|
-
/* @__PURE__ */ (0,
|
|
10527
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10121
10528
|
"input",
|
|
10122
10529
|
{
|
|
10123
10530
|
type: "checkbox",
|
|
@@ -10133,12 +10540,12 @@ function CreateTemplateModal({
|
|
|
10133
10540
|
}
|
|
10134
10541
|
)
|
|
10135
10542
|
] }),
|
|
10136
|
-
hasFileHeader && /* @__PURE__ */ (0,
|
|
10137
|
-
fileError && /* @__PURE__ */ (0,
|
|
10138
|
-
/* @__PURE__ */ (0,
|
|
10139
|
-
/* @__PURE__ */ (0,
|
|
10543
|
+
hasFileHeader && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-3 pt-1", children: [
|
|
10544
|
+
fileError && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10545
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.AlertCircle, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
10546
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: fileError })
|
|
10140
10547
|
] }),
|
|
10141
|
-
/* @__PURE__ */ (0,
|
|
10548
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10142
10549
|
"input",
|
|
10143
10550
|
{
|
|
10144
10551
|
ref: fileInputRef,
|
|
@@ -10148,7 +10555,7 @@ function CreateTemplateModal({
|
|
|
10148
10555
|
className: "hidden"
|
|
10149
10556
|
}
|
|
10150
10557
|
),
|
|
10151
|
-
!selectedFile && /* @__PURE__ */ (0,
|
|
10558
|
+
!selectedFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10152
10559
|
"button",
|
|
10153
10560
|
{
|
|
10154
10561
|
type: "button",
|
|
@@ -10158,49 +10565,49 @@ function CreateTemplateModal({
|
|
|
10158
10565
|
},
|
|
10159
10566
|
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",
|
|
10160
10567
|
children: [
|
|
10161
|
-
/* @__PURE__ */ (0,
|
|
10162
|
-
/* @__PURE__ */ (0,
|
|
10163
|
-
/* @__PURE__ */ (0,
|
|
10164
|
-
/* @__PURE__ */ (0,
|
|
10568
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.Upload, { className: "w-4 h-4" }) }),
|
|
10569
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "text-center", children: [
|
|
10570
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" }),
|
|
10571
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
|
|
10165
10572
|
] })
|
|
10166
10573
|
]
|
|
10167
10574
|
}
|
|
10168
10575
|
),
|
|
10169
|
-
selectedFile && /* @__PURE__ */ (0,
|
|
10170
|
-
/* @__PURE__ */ (0,
|
|
10171
|
-
/* @__PURE__ */ (0,
|
|
10172
|
-
/* @__PURE__ */ (0,
|
|
10173
|
-
/* @__PURE__ */ (0,
|
|
10174
|
-
/* @__PURE__ */ (0,
|
|
10576
|
+
selectedFile && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
|
|
10577
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
|
|
10578
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.FileText, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Video, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Image, { className: "w-4 h-4" }) }),
|
|
10579
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "overflow-hidden", children: [
|
|
10580
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
|
|
10581
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { dir: "ltr", className: "inline-block", children: [
|
|
10175
10582
|
formatFileSize(selectedFile.size),
|
|
10176
10583
|
selectedFile.type ? ` \u2022 ${selectedFile.type}` : ""
|
|
10177
10584
|
] }) })
|
|
10178
10585
|
] })
|
|
10179
10586
|
] }),
|
|
10180
|
-
/* @__PURE__ */ (0,
|
|
10587
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10181
10588
|
"button",
|
|
10182
10589
|
{
|
|
10183
10590
|
type: "button",
|
|
10184
10591
|
onClick: handleRemoveFile,
|
|
10185
10592
|
className: "p-1 text-slate-400 hover:text-rose-600 rounded-md transition-colors cursor-pointer",
|
|
10186
10593
|
title: "\u05D4\u05E1\u05E8 \u05E7\u05D5\u05D1\u05E5",
|
|
10187
|
-
children: /* @__PURE__ */ (0,
|
|
10594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Trash2, { className: "w-4 h-4" })
|
|
10188
10595
|
}
|
|
10189
10596
|
)
|
|
10190
10597
|
] })
|
|
10191
10598
|
] })
|
|
10192
10599
|
] }),
|
|
10193
|
-
/* @__PURE__ */ (0,
|
|
10194
|
-
/* @__PURE__ */ (0,
|
|
10195
|
-
/* @__PURE__ */ (0,
|
|
10196
|
-
/* @__PURE__ */ (0,
|
|
10197
|
-
/* @__PURE__ */ (0,
|
|
10198
|
-
/* @__PURE__ */ (0,
|
|
10199
|
-
/* @__PURE__ */ (0,
|
|
10600
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
|
|
10601
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10602
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10603
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
|
|
10604
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10605
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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)" }),
|
|
10606
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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)" })
|
|
10200
10607
|
] })
|
|
10201
10608
|
] }),
|
|
10202
|
-
/* @__PURE__ */ (0,
|
|
10203
|
-
/* @__PURE__ */ (0,
|
|
10609
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10610
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10204
10611
|
"span",
|
|
10205
10612
|
{
|
|
10206
10613
|
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"}`,
|
|
@@ -10210,8 +10617,8 @@ function CreateTemplateModal({
|
|
|
10210
10617
|
]
|
|
10211
10618
|
}
|
|
10212
10619
|
),
|
|
10213
|
-
/* @__PURE__ */ (0,
|
|
10214
|
-
/* @__PURE__ */ (0,
|
|
10620
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", ref: addButtonDropdownRef, children: [
|
|
10621
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10215
10622
|
"button",
|
|
10216
10623
|
{
|
|
10217
10624
|
type: "button",
|
|
@@ -10220,10 +10627,10 @@ function CreateTemplateModal({
|
|
|
10220
10627
|
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"}`,
|
|
10221
10628
|
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",
|
|
10222
10629
|
children: [
|
|
10223
|
-
/* @__PURE__ */ (0,
|
|
10224
|
-
/* @__PURE__ */ (0,
|
|
10225
|
-
/* @__PURE__ */ (0,
|
|
10226
|
-
|
|
10630
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Plus, { className: "w-3.5 h-3.5" }),
|
|
10631
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
|
|
10632
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10633
|
+
import_lucide_react11.ChevronDown,
|
|
10227
10634
|
{
|
|
10228
10635
|
className: `w-3.5 h-3.5 transition-transform ${isAddButtonOpen ? "rotate-180" : ""}`
|
|
10229
10636
|
}
|
|
@@ -10231,63 +10638,63 @@ function CreateTemplateModal({
|
|
|
10231
10638
|
]
|
|
10232
10639
|
}
|
|
10233
10640
|
),
|
|
10234
|
-
isAddButtonOpen && /* @__PURE__ */ (0,
|
|
10235
|
-
/* @__PURE__ */ (0,
|
|
10641
|
+
isAddButtonOpen && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10642
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10236
10643
|
"button",
|
|
10237
10644
|
{
|
|
10238
10645
|
type: "button",
|
|
10239
10646
|
onClick: () => handleAddButton("QUICK_REPLY"),
|
|
10240
10647
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group",
|
|
10241
10648
|
children: [
|
|
10242
|
-
/* @__PURE__ */ (0,
|
|
10243
|
-
/* @__PURE__ */ (0,
|
|
10244
|
-
/* @__PURE__ */ (0,
|
|
10245
|
-
/* @__PURE__ */ (0,
|
|
10649
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.MessageSquare, { className: "w-3.5 h-3.5" }) }),
|
|
10650
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10651
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
|
|
10652
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
10246
10653
|
] })
|
|
10247
10654
|
]
|
|
10248
10655
|
}
|
|
10249
10656
|
),
|
|
10250
|
-
/* @__PURE__ */ (0,
|
|
10657
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10251
10658
|
"button",
|
|
10252
10659
|
{
|
|
10253
10660
|
type: "button",
|
|
10254
10661
|
onClick: () => handleAddButton("URL"),
|
|
10255
10662
|
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",
|
|
10256
10663
|
children: [
|
|
10257
|
-
/* @__PURE__ */ (0,
|
|
10258
|
-
/* @__PURE__ */ (0,
|
|
10259
|
-
/* @__PURE__ */ (0,
|
|
10260
|
-
/* @__PURE__ */ (0,
|
|
10664
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3.5 h-3.5" }) }),
|
|
10665
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10666
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
|
|
10667
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
10261
10668
|
] })
|
|
10262
10669
|
]
|
|
10263
10670
|
}
|
|
10264
10671
|
),
|
|
10265
|
-
/* @__PURE__ */ (0,
|
|
10672
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10266
10673
|
"button",
|
|
10267
10674
|
{
|
|
10268
10675
|
type: "button",
|
|
10269
10676
|
onClick: () => handleAddButton("PHONE_NUMBER"),
|
|
10270
10677
|
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",
|
|
10271
10678
|
children: [
|
|
10272
|
-
/* @__PURE__ */ (0,
|
|
10273
|
-
/* @__PURE__ */ (0,
|
|
10274
|
-
/* @__PURE__ */ (0,
|
|
10275
|
-
/* @__PURE__ */ (0,
|
|
10679
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.Phone, { className: "w-3.5 h-3.5" }) }),
|
|
10680
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10681
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
|
|
10682
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
10276
10683
|
] })
|
|
10277
10684
|
]
|
|
10278
10685
|
}
|
|
10279
10686
|
),
|
|
10280
|
-
/* @__PURE__ */ (0,
|
|
10687
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10281
10688
|
"button",
|
|
10282
10689
|
{
|
|
10283
10690
|
type: "button",
|
|
10284
10691
|
onClick: () => handleAddButton("COPY_CODE"),
|
|
10285
10692
|
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",
|
|
10286
10693
|
children: [
|
|
10287
|
-
/* @__PURE__ */ (0,
|
|
10288
|
-
/* @__PURE__ */ (0,
|
|
10289
|
-
/* @__PURE__ */ (0,
|
|
10290
|
-
/* @__PURE__ */ (0,
|
|
10694
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.jsx)(import_lucide_react11.Copy, { className: "w-3.5 h-3.5" }) }),
|
|
10695
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
10696
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
|
|
10697
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
10291
10698
|
] })
|
|
10292
10699
|
]
|
|
10293
10700
|
}
|
|
@@ -10296,55 +10703,55 @@ function CreateTemplateModal({
|
|
|
10296
10703
|
] })
|
|
10297
10704
|
] })
|
|
10298
10705
|
] }),
|
|
10299
|
-
buttons.length === 0 && /* @__PURE__ */ (0,
|
|
10300
|
-
buttons.length > 0 && /* @__PURE__ */ (0,
|
|
10706
|
+
buttons.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.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.' }),
|
|
10707
|
+
buttons.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
|
|
10301
10708
|
const btnNum = index + 1;
|
|
10302
|
-
return /* @__PURE__ */ (0,
|
|
10709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10303
10710
|
"div",
|
|
10304
10711
|
{
|
|
10305
10712
|
className: "p-3 bg-white border border-slate-200 rounded-xl space-y-2.5 shadow-2xs transition-all hover:border-slate-300",
|
|
10306
10713
|
children: [
|
|
10307
|
-
/* @__PURE__ */ (0,
|
|
10308
|
-
/* @__PURE__ */ (0,
|
|
10309
|
-
/* @__PURE__ */ (0,
|
|
10714
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10715
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10716
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
|
|
10310
10717
|
"#",
|
|
10311
10718
|
btnNum
|
|
10312
10719
|
] }),
|
|
10313
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
10314
|
-
/* @__PURE__ */ (0,
|
|
10315
|
-
/* @__PURE__ */ (0,
|
|
10720
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10721
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.MessageSquare, { className: "w-3 h-3" }),
|
|
10722
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
|
|
10316
10723
|
] }),
|
|
10317
|
-
btn.type === "URL" && /* @__PURE__ */ (0,
|
|
10318
|
-
/* @__PURE__ */ (0,
|
|
10319
|
-
/* @__PURE__ */ (0,
|
|
10724
|
+
btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10725
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.ExternalLink, { className: "w-3 h-3" }),
|
|
10726
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
|
|
10320
10727
|
] }),
|
|
10321
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
10322
|
-
/* @__PURE__ */ (0,
|
|
10323
|
-
/* @__PURE__ */ (0,
|
|
10728
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10729
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Phone, { className: "w-3 h-3" }),
|
|
10730
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
|
|
10324
10731
|
] }),
|
|
10325
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
10326
|
-
/* @__PURE__ */ (0,
|
|
10327
|
-
/* @__PURE__ */ (0,
|
|
10732
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime20.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: [
|
|
10733
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Copy, { className: "w-3 h-3" }),
|
|
10734
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
|
|
10328
10735
|
] })
|
|
10329
10736
|
] }),
|
|
10330
|
-
/* @__PURE__ */ (0,
|
|
10737
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10331
10738
|
"button",
|
|
10332
10739
|
{
|
|
10333
10740
|
type: "button",
|
|
10334
10741
|
onClick: () => handleRemoveButton(index),
|
|
10335
10742
|
className: "p-1 text-slate-400 hover:text-rose-600 hover:bg-rose-50 rounded-lg transition-colors cursor-pointer",
|
|
10336
10743
|
title: "\u05D4\u05E1\u05E8 \u05DB\u05E4\u05EA\u05D5\u05E8",
|
|
10337
|
-
children: /* @__PURE__ */ (0,
|
|
10744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Trash2, { className: "w-3.5 h-3.5" })
|
|
10338
10745
|
}
|
|
10339
10746
|
)
|
|
10340
10747
|
] }),
|
|
10341
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
10342
|
-
/* @__PURE__ */ (0,
|
|
10343
|
-
/* @__PURE__ */ (0,
|
|
10748
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10749
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10750
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10344
10751
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10345
|
-
/* @__PURE__ */ (0,
|
|
10752
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10346
10753
|
] }),
|
|
10347
|
-
/* @__PURE__ */ (0,
|
|
10754
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10348
10755
|
"span",
|
|
10349
10756
|
{
|
|
10350
10757
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10355,7 +10762,7 @@ function CreateTemplateModal({
|
|
|
10355
10762
|
}
|
|
10356
10763
|
)
|
|
10357
10764
|
] }),
|
|
10358
|
-
/* @__PURE__ */ (0,
|
|
10765
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10359
10766
|
"input",
|
|
10360
10767
|
{
|
|
10361
10768
|
type: "text",
|
|
@@ -10367,14 +10774,14 @@ function CreateTemplateModal({
|
|
|
10367
10774
|
}
|
|
10368
10775
|
)
|
|
10369
10776
|
] }),
|
|
10370
|
-
btn.type === "URL" && /* @__PURE__ */ (0,
|
|
10371
|
-
/* @__PURE__ */ (0,
|
|
10372
|
-
/* @__PURE__ */ (0,
|
|
10373
|
-
/* @__PURE__ */ (0,
|
|
10777
|
+
btn.type === "URL" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10778
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10779
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10780
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10374
10781
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10375
|
-
/* @__PURE__ */ (0,
|
|
10782
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10376
10783
|
] }),
|
|
10377
|
-
/* @__PURE__ */ (0,
|
|
10784
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10378
10785
|
"span",
|
|
10379
10786
|
{
|
|
10380
10787
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10385,7 +10792,7 @@ function CreateTemplateModal({
|
|
|
10385
10792
|
}
|
|
10386
10793
|
)
|
|
10387
10794
|
] }),
|
|
10388
|
-
/* @__PURE__ */ (0,
|
|
10795
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10389
10796
|
"input",
|
|
10390
10797
|
{
|
|
10391
10798
|
type: "text",
|
|
@@ -10397,18 +10804,18 @@ function CreateTemplateModal({
|
|
|
10397
10804
|
}
|
|
10398
10805
|
)
|
|
10399
10806
|
] }),
|
|
10400
|
-
/* @__PURE__ */ (0,
|
|
10401
|
-
/* @__PURE__ */ (0,
|
|
10402
|
-
/* @__PURE__ */ (0,
|
|
10807
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10808
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10809
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10403
10810
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL \u05E1\u05D8\u05D8\u05D9\u05EA ",
|
|
10404
|
-
/* @__PURE__ */ (0,
|
|
10811
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10405
10812
|
] }),
|
|
10406
|
-
/* @__PURE__ */ (0,
|
|
10813
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10407
10814
|
(btn.url || "").length,
|
|
10408
10815
|
"/2000"
|
|
10409
10816
|
] })
|
|
10410
10817
|
] }),
|
|
10411
|
-
/* @__PURE__ */ (0,
|
|
10818
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10412
10819
|
"input",
|
|
10413
10820
|
{
|
|
10414
10821
|
type: "url",
|
|
@@ -10422,14 +10829,14 @@ function CreateTemplateModal({
|
|
|
10422
10829
|
)
|
|
10423
10830
|
] })
|
|
10424
10831
|
] }),
|
|
10425
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
10426
|
-
/* @__PURE__ */ (0,
|
|
10427
|
-
/* @__PURE__ */ (0,
|
|
10428
|
-
/* @__PURE__ */ (0,
|
|
10832
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10833
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10834
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10835
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10429
10836
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10430
|
-
/* @__PURE__ */ (0,
|
|
10837
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10431
10838
|
] }),
|
|
10432
|
-
/* @__PURE__ */ (0,
|
|
10839
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10433
10840
|
"span",
|
|
10434
10841
|
{
|
|
10435
10842
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10440,7 +10847,7 @@ function CreateTemplateModal({
|
|
|
10440
10847
|
}
|
|
10441
10848
|
)
|
|
10442
10849
|
] }),
|
|
10443
|
-
/* @__PURE__ */ (0,
|
|
10850
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10444
10851
|
"input",
|
|
10445
10852
|
{
|
|
10446
10853
|
type: "text",
|
|
@@ -10452,18 +10859,18 @@ function CreateTemplateModal({
|
|
|
10452
10859
|
}
|
|
10453
10860
|
)
|
|
10454
10861
|
] }),
|
|
10455
|
-
/* @__PURE__ */ (0,
|
|
10456
|
-
/* @__PURE__ */ (0,
|
|
10457
|
-
/* @__PURE__ */ (0,
|
|
10862
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10863
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10864
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10458
10865
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF (\u05E4\u05D5\u05E8\u05DE\u05D8: +[\u05E7\u05D9\u05D3\u05D5\u05DE\u05EA][\u05DE\u05E1\u05E4\u05E8]) ",
|
|
10459
|
-
/* @__PURE__ */ (0,
|
|
10866
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10460
10867
|
] }),
|
|
10461
|
-
/* @__PURE__ */ (0,
|
|
10868
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10462
10869
|
(btn.phone_number || "").length,
|
|
10463
10870
|
"/20"
|
|
10464
10871
|
] })
|
|
10465
10872
|
] }),
|
|
10466
|
-
/* @__PURE__ */ (0,
|
|
10873
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10467
10874
|
"input",
|
|
10468
10875
|
{
|
|
10469
10876
|
type: "tel",
|
|
@@ -10477,14 +10884,14 @@ function CreateTemplateModal({
|
|
|
10477
10884
|
)
|
|
10478
10885
|
] })
|
|
10479
10886
|
] }),
|
|
10480
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
10481
|
-
/* @__PURE__ */ (0,
|
|
10482
|
-
/* @__PURE__ */ (0,
|
|
10483
|
-
/* @__PURE__ */ (0,
|
|
10887
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10888
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10889
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10890
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "font-semibold text-slate-700", children: [
|
|
10484
10891
|
"\u05E7\u05D5\u05D3 \u05D4\u05E6\u05E2\u05D4 / \u05E7\u05D5\u05E4\u05D5\u05DF ",
|
|
10485
|
-
/* @__PURE__ */ (0,
|
|
10892
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-rose-500", children: "*" })
|
|
10486
10893
|
] }),
|
|
10487
|
-
/* @__PURE__ */ (0,
|
|
10894
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
10488
10895
|
"span",
|
|
10489
10896
|
{
|
|
10490
10897
|
className: `font-mono text-[10px] ${(btn.example || "").length >= 15 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10495,7 +10902,7 @@ function CreateTemplateModal({
|
|
|
10495
10902
|
}
|
|
10496
10903
|
)
|
|
10497
10904
|
] }),
|
|
10498
|
-
/* @__PURE__ */ (0,
|
|
10905
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10499
10906
|
"input",
|
|
10500
10907
|
{
|
|
10501
10908
|
type: "text",
|
|
@@ -10508,15 +10915,15 @@ function CreateTemplateModal({
|
|
|
10508
10915
|
}
|
|
10509
10916
|
)
|
|
10510
10917
|
] }),
|
|
10511
|
-
/* @__PURE__ */ (0,
|
|
10512
|
-
/* @__PURE__ */ (0,
|
|
10513
|
-
/* @__PURE__ */ (0,
|
|
10514
|
-
/* @__PURE__ */ (0,
|
|
10918
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", children: [
|
|
10919
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10920
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.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)" }),
|
|
10921
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10515
10922
|
(btn.text || "").length,
|
|
10516
10923
|
"/25"
|
|
10517
10924
|
] })
|
|
10518
10925
|
] }),
|
|
10519
|
-
/* @__PURE__ */ (0,
|
|
10926
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10520
10927
|
"input",
|
|
10521
10928
|
{
|
|
10522
10929
|
type: "text",
|
|
@@ -10536,8 +10943,8 @@ function CreateTemplateModal({
|
|
|
10536
10943
|
}) })
|
|
10537
10944
|
] })
|
|
10538
10945
|
] }),
|
|
10539
|
-
/* @__PURE__ */ (0,
|
|
10540
|
-
/* @__PURE__ */ (0,
|
|
10946
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
|
|
10947
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10541
10948
|
"button",
|
|
10542
10949
|
{
|
|
10543
10950
|
type: "button",
|
|
@@ -10547,19 +10954,19 @@ function CreateTemplateModal({
|
|
|
10547
10954
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
10548
10955
|
}
|
|
10549
10956
|
),
|
|
10550
|
-
/* @__PURE__ */ (0,
|
|
10957
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
10551
10958
|
"button",
|
|
10552
10959
|
{
|
|
10553
10960
|
type: "submit",
|
|
10554
10961
|
disabled: !canSubmit,
|
|
10555
10962
|
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"}`,
|
|
10556
10963
|
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",
|
|
10557
|
-
children: isSubmitting ? /* @__PURE__ */ (0,
|
|
10558
|
-
/* @__PURE__ */ (0,
|
|
10559
|
-
/* @__PURE__ */ (0,
|
|
10560
|
-
] }) : /* @__PURE__ */ (0,
|
|
10561
|
-
/* @__PURE__ */ (0,
|
|
10562
|
-
/* @__PURE__ */ (0,
|
|
10964
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
10965
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.Loader2, { className: "w-4 h-4 animate-spin" }),
|
|
10966
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
|
|
10967
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
10968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react11.CheckCircle2, { className: "w-4 h-4" }),
|
|
10969
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
|
|
10563
10970
|
] })
|
|
10564
10971
|
}
|
|
10565
10972
|
)
|
|
@@ -10573,11 +10980,11 @@ function CreateTemplateModal({
|
|
|
10573
10980
|
}
|
|
10574
10981
|
|
|
10575
10982
|
// src/components/WhatsAppComponent/hooks/useWhatsAppState.ts
|
|
10576
|
-
var
|
|
10983
|
+
var import_react23 = require("react");
|
|
10577
10984
|
|
|
10578
10985
|
// src/components/WhatsAppComponent/utils/recipientEngine.ts
|
|
10579
10986
|
var STORAGE_KEY_TEST_PHONE = "whatsapp_test_phone";
|
|
10580
|
-
function
|
|
10987
|
+
function isRawObjectId3(str) {
|
|
10581
10988
|
if (typeof str !== "string") return false;
|
|
10582
10989
|
const trimmed = str.trim();
|
|
10583
10990
|
return /^[0-9a-fA-F]{24}$/.test(trimmed) || trimmed.startsWith("temp_");
|
|
@@ -10587,14 +10994,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10587
10994
|
if (!opt) return "";
|
|
10588
10995
|
if (typeof opt === "string") {
|
|
10589
10996
|
const trimmed = opt.trim();
|
|
10590
|
-
if (!
|
|
10997
|
+
if (!isRawObjectId3(trimmed)) return trimmed;
|
|
10591
10998
|
if (allRelationOptions) {
|
|
10592
10999
|
for (const list of Object.values(allRelationOptions)) {
|
|
10593
11000
|
if (Array.isArray(list)) {
|
|
10594
11001
|
const match = list.find((item) => ((item == null ? void 0 : item.id) || (item == null ? void 0 : item._id)) === trimmed);
|
|
10595
11002
|
if (match) {
|
|
10596
11003
|
const resolved = getRelationOptionLabel(match, colDef);
|
|
10597
|
-
if (resolved && !
|
|
11004
|
+
if (resolved && !isRawObjectId3(resolved)) {
|
|
10598
11005
|
return resolved;
|
|
10599
11006
|
}
|
|
10600
11007
|
}
|
|
@@ -10607,11 +11014,11 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10607
11014
|
const displayField = (_a = colDef == null ? void 0 : colDef.config) == null ? void 0 : _a.displayField;
|
|
10608
11015
|
if (displayField && opt.data && opt.data[displayField] !== void 0 && opt.data[displayField] !== null) {
|
|
10609
11016
|
const val = String(opt.data[displayField]).trim();
|
|
10610
|
-
if (val && !
|
|
11017
|
+
if (val && !isRawObjectId3(val) && val !== rawId) return val;
|
|
10611
11018
|
}
|
|
10612
11019
|
if (opt.label && typeof opt.label === "string") {
|
|
10613
11020
|
const trimmed = opt.label.trim();
|
|
10614
|
-
if (trimmed && !
|
|
11021
|
+
if (trimmed && !isRawObjectId3(trimmed) && trimmed !== rawId) {
|
|
10615
11022
|
return trimmed;
|
|
10616
11023
|
}
|
|
10617
11024
|
}
|
|
@@ -10634,14 +11041,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10634
11041
|
const val = opt.data[key];
|
|
10635
11042
|
if (val !== void 0 && val !== null) {
|
|
10636
11043
|
const str = String(val).trim();
|
|
10637
|
-
if (str && !
|
|
11044
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10638
11045
|
}
|
|
10639
11046
|
}
|
|
10640
11047
|
for (const [k, v] of Object.entries(opt.data)) {
|
|
10641
11048
|
if (k.startsWith("_") || k.toLowerCase().endsWith("id") || k.toLowerCase() === "id") continue;
|
|
10642
11049
|
if (v !== void 0 && v !== null) {
|
|
10643
11050
|
const str = String(v).trim();
|
|
10644
|
-
if (str && !
|
|
11051
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10645
11052
|
}
|
|
10646
11053
|
}
|
|
10647
11054
|
}
|
|
@@ -10650,7 +11057,7 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10650
11057
|
const val = opt[key];
|
|
10651
11058
|
if (val !== void 0 && val !== null) {
|
|
10652
11059
|
const str = String(val).trim();
|
|
10653
|
-
if (str && !
|
|
11060
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10654
11061
|
}
|
|
10655
11062
|
}
|
|
10656
11063
|
if (opt.label && typeof opt.label === "string" && opt.label.trim()) {
|
|
@@ -11878,29 +12285,29 @@ function useWhatsAppState(props) {
|
|
|
11878
12285
|
data: injectedData
|
|
11879
12286
|
} = props;
|
|
11880
12287
|
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);
|
|
11881
|
-
const [tableColumns2, setTableColumns] = (0,
|
|
12288
|
+
const [tableColumns2, setTableColumns] = (0, import_react23.useState)(() => {
|
|
11882
12289
|
return Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
11883
12290
|
});
|
|
11884
|
-
const [rawRecords, setRawRecords] = (0,
|
|
12291
|
+
const [rawRecords, setRawRecords] = (0, import_react23.useState)(() => {
|
|
11885
12292
|
if (Array.isArray(injectedData)) return injectedData;
|
|
11886
12293
|
if (Array.isArray(injectedData == null ? void 0 : injectedData.records)) return injectedData.records;
|
|
11887
12294
|
return [];
|
|
11888
12295
|
});
|
|
11889
|
-
const [relationOptions, setRelationOptions] = (0,
|
|
12296
|
+
const [relationOptions, setRelationOptions] = (0, import_react23.useState)(() => {
|
|
11890
12297
|
return (injectedData == null ? void 0 : injectedData.relationOptions) || {};
|
|
11891
12298
|
});
|
|
11892
|
-
const [isLoadingTableData, setIsLoadingTableData] = (0,
|
|
11893
|
-
const [activeSubtableScans, setActiveSubtableScans] = (0,
|
|
11894
|
-
const [tableError, setTableError] = (0,
|
|
11895
|
-
const [filters, setFilters] = (0,
|
|
11896
|
-
const [selectedRowIds, setSelectedRowIds] = (0,
|
|
11897
|
-
const [autoSelectCount, setAutoSelectCount] = (0,
|
|
11898
|
-
const isAutoSelectingRef = (0,
|
|
11899
|
-
const isManualOverrideRef = (0,
|
|
11900
|
-
const prevAutoSelectCountRef = (0,
|
|
11901
|
-
const fetchedTableIdsRef = (0,
|
|
11902
|
-
const fullyFetchedRelationKeysRef = (0,
|
|
11903
|
-
const loadTableData = (0,
|
|
12299
|
+
const [isLoadingTableData, setIsLoadingTableData] = (0, import_react23.useState)(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
|
|
12300
|
+
const [activeSubtableScans, setActiveSubtableScans] = (0, import_react23.useState)(0);
|
|
12301
|
+
const [tableError, setTableError] = (0, import_react23.useState)(null);
|
|
12302
|
+
const [filters, setFilters] = (0, import_react23.useState)({});
|
|
12303
|
+
const [selectedRowIds, setSelectedRowIds] = (0, import_react23.useState)([]);
|
|
12304
|
+
const [autoSelectCount, setAutoSelectCount] = (0, import_react23.useState)(null);
|
|
12305
|
+
const isAutoSelectingRef = (0, import_react23.useRef)(false);
|
|
12306
|
+
const isManualOverrideRef = (0, import_react23.useRef)(false);
|
|
12307
|
+
const prevAutoSelectCountRef = (0, import_react23.useRef)(null);
|
|
12308
|
+
const fetchedTableIdsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
|
|
12309
|
+
const fullyFetchedRelationKeysRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
|
|
12310
|
+
const loadTableData = (0, import_react23.useCallback)(async () => {
|
|
11904
12311
|
var _a2;
|
|
11905
12312
|
const tableId = (settings == null ? void 0 : settings.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableId);
|
|
11906
12313
|
if (!tableId || !executeAction) return;
|
|
@@ -11967,10 +12374,10 @@ function useWhatsAppState(props) {
|
|
|
11967
12374
|
executeAction,
|
|
11968
12375
|
orgId
|
|
11969
12376
|
]);
|
|
11970
|
-
(0,
|
|
12377
|
+
(0, import_react23.useEffect)(() => {
|
|
11971
12378
|
loadTableData();
|
|
11972
12379
|
}, [loadTableData]);
|
|
11973
|
-
const filterableColumns = (0,
|
|
12380
|
+
const filterableColumns = (0, import_react23.useMemo)(() => {
|
|
11974
12381
|
return (tableColumns2 || []).filter((col) => {
|
|
11975
12382
|
var _a2;
|
|
11976
12383
|
if (!col || col.name === "_id" || col.id === "_id") return false;
|
|
@@ -11978,15 +12385,15 @@ function useWhatsAppState(props) {
|
|
|
11978
12385
|
return type === "RELATION" || type === "BOOLEAN";
|
|
11979
12386
|
});
|
|
11980
12387
|
}, [tableColumns2]);
|
|
11981
|
-
const [referencedTableSchemas, setReferencedTableSchemas] = (0,
|
|
11982
|
-
const subtableCols = (0,
|
|
12388
|
+
const [referencedTableSchemas, setReferencedTableSchemas] = (0, import_react23.useState)({});
|
|
12389
|
+
const subtableCols = (0, import_react23.useMemo)(() => {
|
|
11983
12390
|
return (tableColumns2 || []).filter((col) => {
|
|
11984
12391
|
var _a2;
|
|
11985
12392
|
const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
|
|
11986
12393
|
return type === "RELATION" || type === "SUB_TABLE" || type === "SUBTABLE";
|
|
11987
12394
|
});
|
|
11988
12395
|
}, [tableColumns2]);
|
|
11989
|
-
(0,
|
|
12396
|
+
(0, import_react23.useEffect)(() => {
|
|
11990
12397
|
if (!executeAction) return;
|
|
11991
12398
|
const unrequestedCols = subtableCols.filter((col) => {
|
|
11992
12399
|
var _a2;
|
|
@@ -12032,20 +12439,20 @@ function useWhatsAppState(props) {
|
|
|
12032
12439
|
const isScanningPhoneColumns = Boolean(
|
|
12033
12440
|
isLoadingTableData || activeSubtableScans > 0 || tableColumns2.length === 0 && Boolean(settings == null ? void 0 : settings.tableMetaId)
|
|
12034
12441
|
);
|
|
12035
|
-
const targetPhoneOptions = (0,
|
|
12442
|
+
const targetPhoneOptions = (0, import_react23.useMemo)(() => {
|
|
12036
12443
|
const cols = tableColumns2 && tableColumns2.length > 0 ? tableColumns2 : Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
12037
12444
|
return scanTargetPhoneOptions(cols, referencedTableSchemas);
|
|
12038
12445
|
}, [tableColumns2, settings == null ? void 0 : settings.columns, referencedTableSchemas]);
|
|
12039
|
-
const phoneColumns = (0,
|
|
12446
|
+
const phoneColumns = (0, import_react23.useMemo)(() => {
|
|
12040
12447
|
return targetPhoneOptions.map((opt) => ({ name: opt.label, id: opt.id, type: "PHONE" }));
|
|
12041
12448
|
}, [targetPhoneOptions]);
|
|
12042
|
-
const [phoneColumnId, setPhoneColumnId] = (0,
|
|
12043
|
-
const [subtableFilterColumn, setSubtableFilterColumn] = (0,
|
|
12044
|
-
const [subtableFilterValue, setSubtableFilterValue] = (0,
|
|
12045
|
-
const [subtableSendLimit, setSubtableSendLimit] = (0,
|
|
12449
|
+
const [phoneColumnId, setPhoneColumnId] = (0, import_react23.useState)("");
|
|
12450
|
+
const [subtableFilterColumn, setSubtableFilterColumn] = (0, import_react23.useState)("");
|
|
12451
|
+
const [subtableFilterValue, setSubtableFilterValue] = (0, import_react23.useState)("");
|
|
12452
|
+
const [subtableSendLimit, setSubtableSendLimit] = (0, import_react23.useState)(
|
|
12046
12453
|
(settings == null ? void 0 : settings.subtableSendLimit) || "PRIMARY"
|
|
12047
12454
|
);
|
|
12048
|
-
(0,
|
|
12455
|
+
(0, import_react23.useEffect)(() => {
|
|
12049
12456
|
if (targetPhoneOptions.length > 0) {
|
|
12050
12457
|
const isValid = targetPhoneOptions.some(
|
|
12051
12458
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
@@ -12057,13 +12464,13 @@ function useWhatsAppState(props) {
|
|
|
12057
12464
|
setPhoneColumnId("");
|
|
12058
12465
|
}
|
|
12059
12466
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
12060
|
-
const selectedPhoneOption = (0,
|
|
12467
|
+
const selectedPhoneOption = (0, import_react23.useMemo)(() => {
|
|
12061
12468
|
if (!phoneColumnId) return targetPhoneOptions[0] || null;
|
|
12062
12469
|
return targetPhoneOptions.find(
|
|
12063
12470
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
12064
12471
|
) || targetPhoneOptions[0] || null;
|
|
12065
12472
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
12066
|
-
const subtableFilterableColumns = (0,
|
|
12473
|
+
const subtableFilterableColumns = (0, import_react23.useMemo)(() => {
|
|
12067
12474
|
var _a2, _b2, _c;
|
|
12068
12475
|
if (!selectedPhoneOption || selectedPhoneOption.type !== "SUBTABLE") {
|
|
12069
12476
|
return [];
|
|
@@ -12082,14 +12489,14 @@ function useWhatsAppState(props) {
|
|
|
12082
12489
|
return type === "BOOLEAN" || type === "RELATION";
|
|
12083
12490
|
});
|
|
12084
12491
|
}, [selectedPhoneOption, referencedTableSchemas, tableColumns2]);
|
|
12085
|
-
const selectedSubtableFilterCol = (0,
|
|
12492
|
+
const selectedSubtableFilterCol = (0, import_react23.useMemo)(() => {
|
|
12086
12493
|
return subtableFilterableColumns.find((c) => c.name === subtableFilterColumn);
|
|
12087
12494
|
}, [subtableFilterableColumns, subtableFilterColumn]);
|
|
12088
|
-
const [enablePostSendAction, setEnablePostSendAction] = (0,
|
|
12089
|
-
const [postSendActionColumn, setPostSendActionColumn] = (0,
|
|
12090
|
-
const [postSendActionValue, setPostSendActionValue] = (0,
|
|
12091
|
-
const [postSendActionTargetType, setPostSendActionTargetType] = (0,
|
|
12092
|
-
const postSendActionTargetOptions = (0,
|
|
12495
|
+
const [enablePostSendAction, setEnablePostSendAction] = (0, import_react23.useState)(false);
|
|
12496
|
+
const [postSendActionColumn, setPostSendActionColumn] = (0, import_react23.useState)("");
|
|
12497
|
+
const [postSendActionValue, setPostSendActionValue] = (0, import_react23.useState)("");
|
|
12498
|
+
const [postSendActionTargetType, setPostSendActionTargetType] = (0, import_react23.useState)("MAIN");
|
|
12499
|
+
const postSendActionTargetOptions = (0, import_react23.useMemo)(() => {
|
|
12093
12500
|
var _a2, _b2, _c;
|
|
12094
12501
|
const options = [];
|
|
12095
12502
|
(tableColumns2 || []).forEach((col) => {
|
|
@@ -12134,14 +12541,14 @@ function useWhatsAppState(props) {
|
|
|
12134
12541
|
}
|
|
12135
12542
|
return options;
|
|
12136
12543
|
}, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
|
|
12137
|
-
const selectedPostSendOption = (0,
|
|
12544
|
+
const selectedPostSendOption = (0, import_react23.useMemo)(() => {
|
|
12138
12545
|
return postSendActionTargetOptions.find(
|
|
12139
12546
|
(opt) => opt.id === postSendActionColumn || opt.columnName === postSendActionColumn
|
|
12140
12547
|
);
|
|
12141
12548
|
}, [postSendActionTargetOptions, postSendActionColumn]);
|
|
12142
12549
|
const selectedPostSendCol = selectedPostSendOption;
|
|
12143
|
-
const [isTestPromptOpen, setIsTestPromptOpen] = (0,
|
|
12144
|
-
const [testPhoneNumber, setTestPhoneNumber] = (0,
|
|
12550
|
+
const [isTestPromptOpen, setIsTestPromptOpen] = (0, import_react23.useState)(false);
|
|
12551
|
+
const [testPhoneNumber, setTestPhoneNumber] = (0, import_react23.useState)(() => {
|
|
12145
12552
|
if (typeof window !== "undefined") {
|
|
12146
12553
|
try {
|
|
12147
12554
|
return localStorage.getItem(STORAGE_KEY_TEST_PHONE) || "";
|
|
@@ -12151,10 +12558,10 @@ function useWhatsAppState(props) {
|
|
|
12151
12558
|
}
|
|
12152
12559
|
return "";
|
|
12153
12560
|
});
|
|
12154
|
-
const [testFeedback, setTestFeedback] = (0,
|
|
12155
|
-
const [isSendingTest, setIsSendingTest] = (0,
|
|
12156
|
-
const [isSendingBroadcast, setIsSendingBroadcast] = (0,
|
|
12157
|
-
const [broadcastProgress, setBroadcastProgress] = (0,
|
|
12561
|
+
const [testFeedback, setTestFeedback] = (0, import_react23.useState)(null);
|
|
12562
|
+
const [isSendingTest, setIsSendingTest] = (0, import_react23.useState)(false);
|
|
12563
|
+
const [isSendingBroadcast, setIsSendingBroadcast] = (0, import_react23.useState)(false);
|
|
12564
|
+
const [broadcastProgress, setBroadcastProgress] = (0, import_react23.useState)({
|
|
12158
12565
|
current: 0,
|
|
12159
12566
|
total: 0,
|
|
12160
12567
|
successful: 0,
|
|
@@ -12162,12 +12569,12 @@ function useWhatsAppState(props) {
|
|
|
12162
12569
|
skipped: 0,
|
|
12163
12570
|
percent: 0
|
|
12164
12571
|
});
|
|
12165
|
-
const [broadcastSummary, setBroadcastSummary] = (0,
|
|
12166
|
-
const [rowStatusMap, setRowStatusMap] = (0,
|
|
12167
|
-
const clearBroadcastSummary = (0,
|
|
12572
|
+
const [broadcastSummary, setBroadcastSummary] = (0, import_react23.useState)(null);
|
|
12573
|
+
const [rowStatusMap, setRowStatusMap] = (0, import_react23.useState)({});
|
|
12574
|
+
const clearBroadcastSummary = (0, import_react23.useCallback)(() => {
|
|
12168
12575
|
setBroadcastSummary(null);
|
|
12169
12576
|
}, []);
|
|
12170
|
-
const handleTestPhoneChange = (0,
|
|
12577
|
+
const handleTestPhoneChange = (0, import_react23.useCallback)((val) => {
|
|
12171
12578
|
setTestPhoneNumber(val);
|
|
12172
12579
|
if (typeof window !== "undefined") {
|
|
12173
12580
|
try {
|
|
@@ -12177,7 +12584,7 @@ function useWhatsAppState(props) {
|
|
|
12177
12584
|
}
|
|
12178
12585
|
}
|
|
12179
12586
|
}, []);
|
|
12180
|
-
const getRelationOptionsForCol = (0,
|
|
12587
|
+
const getRelationOptionsForCol = (0, import_react23.useCallback)(
|
|
12181
12588
|
(colName, parentColName) => {
|
|
12182
12589
|
var _a2, _b2, _c, _d;
|
|
12183
12590
|
if (parentColName) {
|
|
@@ -12220,7 +12627,7 @@ function useWhatsAppState(props) {
|
|
|
12220
12627
|
},
|
|
12221
12628
|
[relationOptions, subtableFilterableColumns, postSendActionTargetOptions, tableColumns2, filterableColumns]
|
|
12222
12629
|
);
|
|
12223
|
-
(0,
|
|
12630
|
+
(0, import_react23.useEffect)(() => {
|
|
12224
12631
|
var _a2, _b2, _c, _d, _e;
|
|
12225
12632
|
if (!executeAction) return;
|
|
12226
12633
|
const targets = [];
|
|
@@ -12314,7 +12721,7 @@ function useWhatsAppState(props) {
|
|
|
12314
12721
|
}
|
|
12315
12722
|
});
|
|
12316
12723
|
}, [filterableColumns, selectedPhoneOption, referencedTableSchemas, tableColumns2, executeAction, selectedPostSendOption, orgId]);
|
|
12317
|
-
(0,
|
|
12724
|
+
(0, import_react23.useEffect)(() => {
|
|
12318
12725
|
var _a2, _b2, _c;
|
|
12319
12726
|
if (!executeAction || !selectedSubtableFilterCol) return;
|
|
12320
12727
|
if (((_a2 = selectedSubtableFilterCol.type) == null ? void 0 : _a2.toUpperCase()) !== "RELATION") return;
|
|
@@ -12365,7 +12772,7 @@ function useWhatsAppState(props) {
|
|
|
12365
12772
|
}
|
|
12366
12773
|
})();
|
|
12367
12774
|
}, [selectedSubtableFilterCol, selectedPhoneOption, executeAction, orgId]);
|
|
12368
|
-
(0,
|
|
12775
|
+
(0, import_react23.useEffect)(() => {
|
|
12369
12776
|
var _a2, _b2;
|
|
12370
12777
|
if (!executeAction || !selectedPostSendOption) return;
|
|
12371
12778
|
if (selectedPostSendOption.type !== "RELATION") return;
|
|
@@ -12418,7 +12825,7 @@ function useWhatsAppState(props) {
|
|
|
12418
12825
|
}
|
|
12419
12826
|
})();
|
|
12420
12827
|
}, [selectedPostSendOption, executeAction, orgId]);
|
|
12421
|
-
const filteredRecords = (0,
|
|
12828
|
+
const filteredRecords = (0, import_react23.useMemo)(() => {
|
|
12422
12829
|
const activeEntries = Object.entries(filters).filter(
|
|
12423
12830
|
([_, val]) => val !== void 0 && val !== null && val !== ""
|
|
12424
12831
|
);
|
|
@@ -12450,7 +12857,7 @@ function useWhatsAppState(props) {
|
|
|
12450
12857
|
});
|
|
12451
12858
|
}, [rawRecords, filters, filterableColumns]);
|
|
12452
12859
|
const filteredData = filteredRecords;
|
|
12453
|
-
(0,
|
|
12860
|
+
(0, import_react23.useEffect)(() => {
|
|
12454
12861
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
12455
12862
|
isAutoSelectingRef.current = true;
|
|
12456
12863
|
const sliced = filteredData.slice(0, autoSelectCount);
|
|
@@ -12468,7 +12875,7 @@ function useWhatsAppState(props) {
|
|
|
12468
12875
|
isManualOverrideRef.current = false;
|
|
12469
12876
|
prevAutoSelectCountRef.current = autoSelectCount;
|
|
12470
12877
|
}, [autoSelectCount, filteredData]);
|
|
12471
|
-
const embeddedTableExecuteAction = (0,
|
|
12878
|
+
const embeddedTableExecuteAction = (0, import_react23.useCallback)(async (actionType, payload) => {
|
|
12472
12879
|
if (actionType === "FETCH_TABLE_DATA") {
|
|
12473
12880
|
const colFilters = (payload == null ? void 0 : payload.columnFilters) || (payload == null ? void 0 : payload.filters);
|
|
12474
12881
|
const searchQuery = payload == null ? void 0 : payload.search;
|
|
@@ -12511,10 +12918,10 @@ function useWhatsAppState(props) {
|
|
|
12511
12918
|
const handleClearFilters = () => {
|
|
12512
12919
|
setFilters({});
|
|
12513
12920
|
};
|
|
12514
|
-
const activeFiltersCount = (0,
|
|
12921
|
+
const activeFiltersCount = (0, import_react23.useMemo)(() => {
|
|
12515
12922
|
return Object.values(filters).filter((v) => v !== "").length;
|
|
12516
12923
|
}, [filters]);
|
|
12517
|
-
const handleSelectionChange = (0,
|
|
12924
|
+
const handleSelectionChange = (0, import_react23.useCallback)((selectedIds) => {
|
|
12518
12925
|
setSelectedRowIds((prev) => {
|
|
12519
12926
|
if (prev.length === selectedIds.length && prev.every((id, idx) => id === selectedIds[idx])) {
|
|
12520
12927
|
return prev;
|
|
@@ -12528,13 +12935,13 @@ function useWhatsAppState(props) {
|
|
|
12528
12935
|
return selectedIds;
|
|
12529
12936
|
});
|
|
12530
12937
|
}, [autoSelectCount]);
|
|
12531
|
-
const handleRowToggle = (0,
|
|
12938
|
+
const handleRowToggle = (0, import_react23.useCallback)((rowId, checked) => {
|
|
12532
12939
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
12533
12940
|
isManualOverrideRef.current = true;
|
|
12534
12941
|
setAutoSelectCount(null);
|
|
12535
12942
|
}
|
|
12536
12943
|
}, [autoSelectCount]);
|
|
12537
|
-
const toggleRowSelection = (0,
|
|
12944
|
+
const toggleRowSelection = (0, import_react23.useCallback)((rowId, checked) => {
|
|
12538
12945
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
12539
12946
|
isManualOverrideRef.current = true;
|
|
12540
12947
|
setAutoSelectCount(null);
|
|
@@ -12550,15 +12957,15 @@ function useWhatsAppState(props) {
|
|
|
12550
12957
|
return prev;
|
|
12551
12958
|
});
|
|
12552
12959
|
}, [autoSelectCount]);
|
|
12553
|
-
const [templates, setTemplates] = (0,
|
|
12554
|
-
const [selectedTemplateId, setSelectedTemplateId] = (0,
|
|
12555
|
-
const [isLoading, setIsLoading] = (0,
|
|
12556
|
-
const [fetchError, setFetchError] = (0,
|
|
12557
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
12558
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0,
|
|
12559
|
-
const [isDeleting, setIsDeleting] = (0,
|
|
12560
|
-
const [feedback, setFeedback] = (0,
|
|
12561
|
-
const loadTemplates = (0,
|
|
12960
|
+
const [templates, setTemplates] = (0, import_react23.useState)([]);
|
|
12961
|
+
const [selectedTemplateId, setSelectedTemplateId] = (0, import_react23.useState)(null);
|
|
12962
|
+
const [isLoading, setIsLoading] = (0, import_react23.useState)(true);
|
|
12963
|
+
const [fetchError, setFetchError] = (0, import_react23.useState)(null);
|
|
12964
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react23.useState)(false);
|
|
12965
|
+
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react23.useState)(false);
|
|
12966
|
+
const [isDeleting, setIsDeleting] = (0, import_react23.useState)(false);
|
|
12967
|
+
const [feedback, setFeedback] = (0, import_react23.useState)(null);
|
|
12968
|
+
const loadTemplates = (0, import_react23.useCallback)(async () => {
|
|
12562
12969
|
var _a2, _b2;
|
|
12563
12970
|
if (!executeAction) {
|
|
12564
12971
|
setIsLoading(false);
|
|
@@ -12610,13 +13017,13 @@ function useWhatsAppState(props) {
|
|
|
12610
13017
|
setIsLoading(false);
|
|
12611
13018
|
}
|
|
12612
13019
|
}, [executeAction, orgId]);
|
|
12613
|
-
(0,
|
|
13020
|
+
(0, import_react23.useEffect)(() => {
|
|
12614
13021
|
loadTemplates();
|
|
12615
13022
|
}, [loadTemplates]);
|
|
12616
|
-
const selectedTemplate = (0,
|
|
13023
|
+
const selectedTemplate = (0, import_react23.useMemo)(() => {
|
|
12617
13024
|
return templates.find((t) => t.id === selectedTemplateId) || null;
|
|
12618
13025
|
}, [templates, selectedTemplateId]);
|
|
12619
|
-
const templateBodyText = (0,
|
|
13026
|
+
const templateBodyText = (0, import_react23.useMemo)(() => {
|
|
12620
13027
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return "";
|
|
12621
13028
|
const bodyComp = selectedTemplate.components.find(
|
|
12622
13029
|
(c) => {
|
|
@@ -12626,7 +13033,7 @@ function useWhatsAppState(props) {
|
|
|
12626
13033
|
);
|
|
12627
13034
|
return (bodyComp == null ? void 0 : bodyComp.text) || "";
|
|
12628
13035
|
}, [selectedTemplate]);
|
|
12629
|
-
const templateHeaderComp = (0,
|
|
13036
|
+
const templateHeaderComp = (0, import_react23.useMemo)(() => {
|
|
12630
13037
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return null;
|
|
12631
13038
|
return selectedTemplate.components.find(
|
|
12632
13039
|
(c) => {
|
|
@@ -12635,8 +13042,8 @@ function useWhatsAppState(props) {
|
|
|
12635
13042
|
}
|
|
12636
13043
|
) || null;
|
|
12637
13044
|
}, [selectedTemplate]);
|
|
12638
|
-
const [headerMediaUrl, setHeaderMediaUrl] = (0,
|
|
12639
|
-
(0,
|
|
13045
|
+
const [headerMediaUrl, setHeaderMediaUrl] = (0, import_react23.useState)("");
|
|
13046
|
+
(0, import_react23.useEffect)(() => {
|
|
12640
13047
|
if (!templateHeaderComp) {
|
|
12641
13048
|
setHeaderMediaUrl("");
|
|
12642
13049
|
return;
|
|
@@ -12653,7 +13060,7 @@ function useWhatsAppState(props) {
|
|
|
12653
13060
|
setHeaderMediaUrl("");
|
|
12654
13061
|
}
|
|
12655
13062
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
12656
|
-
const handleHeaderMediaUrlChange = (0,
|
|
13063
|
+
const handleHeaderMediaUrlChange = (0, import_react23.useCallback)(
|
|
12657
13064
|
(newUrl) => {
|
|
12658
13065
|
setHeaderMediaUrl(newUrl);
|
|
12659
13066
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
@@ -12672,7 +13079,7 @@ function useWhatsAppState(props) {
|
|
|
12672
13079
|
},
|
|
12673
13080
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
12674
13081
|
);
|
|
12675
|
-
const handleResetHeaderMediaUrl = (0,
|
|
13082
|
+
const handleResetHeaderMediaUrl = (0, import_react23.useCallback)(() => {
|
|
12676
13083
|
if ((selectedTemplate == null ? void 0 : selectedTemplate.name) && typeof window !== "undefined") {
|
|
12677
13084
|
try {
|
|
12678
13085
|
localStorage.removeItem(`whatsapp_template_media_${selectedTemplate.name}`);
|
|
@@ -12686,8 +13093,8 @@ function useWhatsAppState(props) {
|
|
|
12686
13093
|
);
|
|
12687
13094
|
setHeaderMediaUrl(defaultUrl || "");
|
|
12688
13095
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
12689
|
-
const [isUploadingMedia, setIsUploadingMedia] = (0,
|
|
12690
|
-
const handleFileUpload = (0,
|
|
13096
|
+
const [isUploadingMedia, setIsUploadingMedia] = (0, import_react23.useState)(false);
|
|
13097
|
+
const handleFileUpload = (0, import_react23.useCallback)(
|
|
12691
13098
|
async (file, templateName) => {
|
|
12692
13099
|
const tplName = templateName || (selectedTemplate == null ? void 0 : selectedTemplate.name) || "";
|
|
12693
13100
|
if (!file) return;
|
|
@@ -12728,14 +13135,14 @@ function useWhatsAppState(props) {
|
|
|
12728
13135
|
},
|
|
12729
13136
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
12730
13137
|
);
|
|
12731
|
-
const templateVariables = (0,
|
|
13138
|
+
const templateVariables = (0, import_react23.useMemo)(() => {
|
|
12732
13139
|
return extractTemplateVariables(selectedTemplate);
|
|
12733
13140
|
}, [selectedTemplate]);
|
|
12734
|
-
const [variableMapping, setVariableMapping] = (0,
|
|
12735
|
-
(0,
|
|
13141
|
+
const [variableMapping, setVariableMapping] = (0, import_react23.useState)({});
|
|
13142
|
+
(0, import_react23.useEffect)(() => {
|
|
12736
13143
|
setVariableMapping({});
|
|
12737
13144
|
}, [selectedTemplateId]);
|
|
12738
|
-
const textableColumnOptions = (0,
|
|
13145
|
+
const textableColumnOptions = (0, import_react23.useMemo)(() => {
|
|
12739
13146
|
return getTextableColumnOptions({
|
|
12740
13147
|
tableColumns: tableColumns2,
|
|
12741
13148
|
selectedPhoneOption,
|
|
@@ -12761,7 +13168,7 @@ function useWhatsAppState(props) {
|
|
|
12761
13168
|
});
|
|
12762
13169
|
});
|
|
12763
13170
|
};
|
|
12764
|
-
const existingTemplateNames = (0,
|
|
13171
|
+
const existingTemplateNames = (0, import_react23.useMemo)(() => {
|
|
12765
13172
|
return templates.map((t) => t.name);
|
|
12766
13173
|
}, [templates]);
|
|
12767
13174
|
const handleDeleteTemplate = async () => {
|
|
@@ -12808,14 +13215,14 @@ function useWhatsAppState(props) {
|
|
|
12808
13215
|
postSendActionColumn,
|
|
12809
13216
|
postSendActionValue
|
|
12810
13217
|
);
|
|
12811
|
-
const isStaticVariableMissing = (0,
|
|
13218
|
+
const isStaticVariableMissing = (0, import_react23.useMemo)(() => {
|
|
12812
13219
|
return isStaticVariableIncomplete(templateVariables, variableMapping);
|
|
12813
13220
|
}, [templateVariables, variableMapping]);
|
|
12814
|
-
const currentRecords = (0,
|
|
13221
|
+
const currentRecords = (0, import_react23.useMemo)(() => {
|
|
12815
13222
|
var _a2;
|
|
12816
13223
|
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 : [];
|
|
12817
13224
|
}, [rawRecords, props.data]);
|
|
12818
|
-
const preparedRecipients = (0,
|
|
13225
|
+
const preparedRecipients = (0, import_react23.useMemo)(() => {
|
|
12819
13226
|
return prepareRecipients({
|
|
12820
13227
|
selectedIds: selectedRowIds,
|
|
12821
13228
|
records: currentRecords,
|
|
@@ -12835,7 +13242,7 @@ function useWhatsAppState(props) {
|
|
|
12835
13242
|
selectedSubtableFilterCol
|
|
12836
13243
|
]);
|
|
12837
13244
|
const finalRecipientCount = preparedRecipients.length;
|
|
12838
|
-
const validMainRowsCount = (0,
|
|
13245
|
+
const validMainRowsCount = (0, import_react23.useMemo)(() => {
|
|
12839
13246
|
const rowIdSet = new Set(
|
|
12840
13247
|
preparedRecipients.map((r) => r.mainRowId).filter(Boolean)
|
|
12841
13248
|
);
|
|
@@ -12944,7 +13351,7 @@ function useWhatsAppState(props) {
|
|
|
12944
13351
|
setIsSendingTest(false);
|
|
12945
13352
|
}
|
|
12946
13353
|
};
|
|
12947
|
-
const handleSendMessages = (0,
|
|
13354
|
+
const handleSendMessages = (0, import_react23.useCallback)(async () => {
|
|
12948
13355
|
var _a2, _b2;
|
|
12949
13356
|
if (isSendDisabled || isSendingBroadcast) return;
|
|
12950
13357
|
const recipients = preparedRecipients;
|
|
@@ -13250,9 +13657,9 @@ function useWhatsAppState(props) {
|
|
|
13250
13657
|
}
|
|
13251
13658
|
|
|
13252
13659
|
// src/components/WhatsAppComponent/ui/TemplateSelectionBlock.tsx
|
|
13253
|
-
var
|
|
13254
|
-
var
|
|
13255
|
-
var
|
|
13660
|
+
var import_react24 = require("react");
|
|
13661
|
+
var import_lucide_react12 = require("lucide-react");
|
|
13662
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
13256
13663
|
function TemplateSelectionBlock({
|
|
13257
13664
|
selectedTemplate,
|
|
13258
13665
|
selectedTemplateId,
|
|
@@ -13278,16 +13685,16 @@ function TemplateSelectionBlock({
|
|
|
13278
13685
|
isUploadingMedia = false,
|
|
13279
13686
|
handleFileUpload
|
|
13280
13687
|
}) {
|
|
13281
|
-
const fileInputRef = (0,
|
|
13282
|
-
return /* @__PURE__ */ (0,
|
|
13283
|
-
/* @__PURE__ */ (0,
|
|
13284
|
-
/* @__PURE__ */ (0,
|
|
13285
|
-
/* @__PURE__ */ (0,
|
|
13286
|
-
/* @__PURE__ */ (0,
|
|
13287
|
-
/* @__PURE__ */ (0,
|
|
13688
|
+
const fileInputRef = (0, import_react24.useRef)(null);
|
|
13689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13690
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-1.5 shrink-0", children: [
|
|
13691
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
|
|
13692
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
13693
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.FileText, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
|
|
13694
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
13288
13695
|
] }),
|
|
13289
|
-
/* @__PURE__ */ (0,
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
13696
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
13697
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13291
13698
|
"button",
|
|
13292
13699
|
{
|
|
13293
13700
|
type: "button",
|
|
@@ -13296,12 +13703,12 @@ function TemplateSelectionBlock({
|
|
|
13296
13703
|
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"}`,
|
|
13297
13704
|
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}"`,
|
|
13298
13705
|
children: [
|
|
13299
|
-
isDeleting ? /* @__PURE__ */ (0,
|
|
13300
|
-
/* @__PURE__ */ (0,
|
|
13706
|
+
isDeleting ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Trash2, { className: "w-3.5 h-3.5 text-rose-500" }),
|
|
13707
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
|
|
13301
13708
|
]
|
|
13302
13709
|
}
|
|
13303
13710
|
),
|
|
13304
|
-
/* @__PURE__ */ (0,
|
|
13711
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13305
13712
|
"button",
|
|
13306
13713
|
{
|
|
13307
13714
|
type: "button",
|
|
@@ -13309,41 +13716,41 @@ function TemplateSelectionBlock({
|
|
|
13309
13716
|
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",
|
|
13310
13717
|
title: "\u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4",
|
|
13311
13718
|
children: [
|
|
13312
|
-
/* @__PURE__ */ (0,
|
|
13313
|
-
/* @__PURE__ */ (0,
|
|
13719
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Plus, { className: "w-3.5 h-3.5" }),
|
|
13720
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05D7\u05D3\u05E9" })
|
|
13314
13721
|
]
|
|
13315
13722
|
}
|
|
13316
13723
|
)
|
|
13317
13724
|
] })
|
|
13318
13725
|
] }),
|
|
13319
|
-
/* @__PURE__ */ (0,
|
|
13320
|
-
/* @__PURE__ */ (0,
|
|
13726
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
13727
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13321
13728
|
"button",
|
|
13322
13729
|
{
|
|
13323
13730
|
type: "button",
|
|
13324
13731
|
onClick: () => setIsDropdownOpen((prev) => !prev),
|
|
13325
13732
|
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",
|
|
13326
13733
|
children: [
|
|
13327
|
-
selectedTemplate ? /* @__PURE__ */ (0,
|
|
13328
|
-
/* @__PURE__ */ (0,
|
|
13734
|
+
selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
13735
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13329
13736
|
"span",
|
|
13330
13737
|
{
|
|
13331
13738
|
className: `w-2 h-2 rounded-full shrink-0 ${getStatusConfig(selectedTemplate.status).dotColor}`
|
|
13332
13739
|
}
|
|
13333
13740
|
),
|
|
13334
|
-
/* @__PURE__ */ (0,
|
|
13335
|
-
/* @__PURE__ */ (0,
|
|
13741
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
|
|
13742
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
|
|
13336
13743
|
"(",
|
|
13337
13744
|
selectedTemplate.category,
|
|
13338
13745
|
" \u2022 ",
|
|
13339
13746
|
selectedTemplate.language,
|
|
13340
13747
|
")"
|
|
13341
13748
|
] })
|
|
13342
|
-
] }) : /* @__PURE__ */ (0,
|
|
13343
|
-
/* @__PURE__ */ (0,
|
|
13344
|
-
isLoadingTemplates && /* @__PURE__ */ (0,
|
|
13345
|
-
/* @__PURE__ */ (0,
|
|
13346
|
-
|
|
13749
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.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..." }),
|
|
13750
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
|
|
13751
|
+
isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
|
|
13752
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13753
|
+
import_lucide_react12.ChevronDown,
|
|
13347
13754
|
{
|
|
13348
13755
|
className: `w-3.5 h-3.5 text-slate-400 transition-transform ${isDropdownOpen ? "rotate-180" : ""}`
|
|
13349
13756
|
}
|
|
@@ -13352,21 +13759,21 @@ function TemplateSelectionBlock({
|
|
|
13352
13759
|
]
|
|
13353
13760
|
}
|
|
13354
13761
|
),
|
|
13355
|
-
isDropdownOpen && /* @__PURE__ */ (0,
|
|
13356
|
-
/* @__PURE__ */ (0,
|
|
13762
|
+
isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13763
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13357
13764
|
"div",
|
|
13358
13765
|
{
|
|
13359
13766
|
className: "fixed inset-0 z-40",
|
|
13360
13767
|
onClick: () => setIsDropdownOpen(false)
|
|
13361
13768
|
}
|
|
13362
13769
|
),
|
|
13363
|
-
/* @__PURE__ */ (0,
|
|
13364
|
-
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0,
|
|
13770
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13771
|
+
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ (0, import_jsx_runtime21.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".' }),
|
|
13365
13772
|
templates.map((tpl) => {
|
|
13366
13773
|
const statusConfig = getStatusConfig(tpl.status);
|
|
13367
13774
|
const isSelected = tpl.id === selectedTemplateId;
|
|
13368
13775
|
const canSelect = statusConfig.isSelectable;
|
|
13369
|
-
return /* @__PURE__ */ (0,
|
|
13776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13370
13777
|
"div",
|
|
13371
13778
|
{
|
|
13372
13779
|
onClick: () => {
|
|
@@ -13379,29 +13786,29 @@ function TemplateSelectionBlock({
|
|
|
13379
13786
|
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" : ""}`,
|
|
13380
13787
|
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,
|
|
13381
13788
|
children: [
|
|
13382
|
-
/* @__PURE__ */ (0,
|
|
13383
|
-
/* @__PURE__ */ (0,
|
|
13789
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
13790
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13384
13791
|
"span",
|
|
13385
13792
|
{
|
|
13386
13793
|
className: `w-2 h-2 rounded-full shrink-0 ${statusConfig.dotColor}`
|
|
13387
13794
|
}
|
|
13388
13795
|
),
|
|
13389
|
-
/* @__PURE__ */ (0,
|
|
13390
|
-
/* @__PURE__ */ (0,
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
|
|
13797
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13391
13798
|
"p",
|
|
13392
13799
|
{
|
|
13393
13800
|
className: `text-xs font-semibold truncate ${isSelected ? "text-emerald-700" : canSelect ? "text-slate-800" : "text-slate-500"}`,
|
|
13394
13801
|
children: tpl.name
|
|
13395
13802
|
}
|
|
13396
13803
|
),
|
|
13397
|
-
/* @__PURE__ */ (0,
|
|
13804
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "text-[10px] text-slate-400", children: [
|
|
13398
13805
|
tpl.category,
|
|
13399
13806
|
" \u2022 ",
|
|
13400
13807
|
tpl.language
|
|
13401
13808
|
] })
|
|
13402
13809
|
] })
|
|
13403
13810
|
] }),
|
|
13404
|
-
/* @__PURE__ */ (0,
|
|
13811
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13405
13812
|
"span",
|
|
13406
13813
|
{
|
|
13407
13814
|
className: `text-[9px] font-semibold px-2 py-0.5 rounded-full border shrink-0 ${statusConfig.badgeBg} ${statusConfig.badgeText}`,
|
|
@@ -13417,18 +13824,18 @@ function TemplateSelectionBlock({
|
|
|
13417
13824
|
] })
|
|
13418
13825
|
] })
|
|
13419
13826
|
] }),
|
|
13420
|
-
/* @__PURE__ */ (0,
|
|
13421
|
-
/* @__PURE__ */ (0,
|
|
13422
|
-
/* @__PURE__ */ (0,
|
|
13423
|
-
selectedTemplate && /* @__PURE__ */ (0,
|
|
13827
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
|
|
13828
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
|
|
13829
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
|
|
13830
|
+
selectedTemplate && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "text-[10px] text-slate-400", children: [
|
|
13424
13831
|
"(",
|
|
13425
13832
|
templateBodyText.length,
|
|
13426
13833
|
" \u05EA\u05D5\u05D5\u05D9\u05DD)"
|
|
13427
13834
|
] })
|
|
13428
13835
|
] }),
|
|
13429
|
-
selectedTemplate ? /* @__PURE__ */ (0,
|
|
13430
|
-
/* @__PURE__ */ (0,
|
|
13431
|
-
/* @__PURE__ */ (0,
|
|
13836
|
+
selectedTemplate ? /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.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: [
|
|
13837
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
|
|
13838
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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"' })
|
|
13432
13839
|
] }),
|
|
13433
13840
|
selectedTemplate && (() => {
|
|
13434
13841
|
var _a;
|
|
@@ -13437,19 +13844,19 @@ function TemplateSelectionBlock({
|
|
|
13437
13844
|
);
|
|
13438
13845
|
const tplButtons = (buttonsComp == null ? void 0 : buttonsComp.buttons) || [];
|
|
13439
13846
|
if (!tplButtons || tplButtons.length === 0) return null;
|
|
13440
|
-
return /* @__PURE__ */ (0,
|
|
13847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
|
|
13441
13848
|
const btnType = (btn.type || "").toUpperCase();
|
|
13442
13849
|
const btnText = btn.text || (btnType === "COPY_CODE" ? `\u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3: ${btn.example}` : "\u05DB\u05E4\u05EA\u05D5\u05E8");
|
|
13443
|
-
return /* @__PURE__ */ (0,
|
|
13850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13444
13851
|
"div",
|
|
13445
13852
|
{
|
|
13446
13853
|
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",
|
|
13447
13854
|
children: [
|
|
13448
|
-
btnType === "QUICK_REPLY" && /* @__PURE__ */ (0,
|
|
13449
|
-
btnType === "URL" && /* @__PURE__ */ (0,
|
|
13450
|
-
btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0,
|
|
13451
|
-
btnType === "COPY_CODE" && /* @__PURE__ */ (0,
|
|
13452
|
-
/* @__PURE__ */ (0,
|
|
13855
|
+
btnType === "QUICK_REPLY" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.MessageSquare, { className: "w-3 h-3 text-emerald-600" }),
|
|
13856
|
+
btnType === "URL" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ExternalLink, { className: "w-3 h-3 text-sky-600" }),
|
|
13857
|
+
btnType === "PHONE_NUMBER" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Phone, { className: "w-3 h-3 text-violet-600" }),
|
|
13858
|
+
btnType === "COPY_CODE" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Copy, { className: "w-3 h-3 text-amber-600" }),
|
|
13859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate max-w-[180px]", children: btnText })
|
|
13453
13860
|
]
|
|
13454
13861
|
},
|
|
13455
13862
|
idx
|
|
@@ -13464,9 +13871,9 @@ function TemplateSelectionBlock({
|
|
|
13464
13871
|
const docFilename = resolveDocumentFilename(templateHeaderComp, headerMediaUrl);
|
|
13465
13872
|
const hasValidMedia = Boolean(headerMediaUrl && headerMediaUrl.trim() && headerMediaUrl.startsWith("http"));
|
|
13466
13873
|
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";
|
|
13467
|
-
return /* @__PURE__ */ (0,
|
|
13468
|
-
/* @__PURE__ */ (0,
|
|
13469
|
-
/* @__PURE__ */ (0,
|
|
13874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13875
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13876
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(
|
|
13470
13877
|
"img",
|
|
13471
13878
|
{
|
|
13472
13879
|
src: headerMediaUrl,
|
|
@@ -13476,33 +13883,33 @@ function TemplateSelectionBlock({
|
|
|
13476
13883
|
e.currentTarget.style.display = "none";
|
|
13477
13884
|
}
|
|
13478
13885
|
}
|
|
13479
|
-
) : /* @__PURE__ */ (0,
|
|
13480
|
-
/* @__PURE__ */ (0,
|
|
13481
|
-
/* @__PURE__ */ (0,
|
|
13482
|
-
/* @__PURE__ */ (0,
|
|
13886
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Image, { className: "w-4 h-4 text-amber-600" }) }),
|
|
13887
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
|
|
13888
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
13889
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
13483
13890
|
] })
|
|
13484
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0,
|
|
13485
|
-
/* @__PURE__ */ (0,
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13487
|
-
/* @__PURE__ */ (0,
|
|
13488
|
-
/* @__PURE__ */ (0,
|
|
13891
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13892
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(import_lucide_react12.FileText, { className: "w-4 h-4" }) }),
|
|
13893
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
|
|
13894
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
13895
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
13489
13896
|
] })
|
|
13490
|
-
] }) : /* @__PURE__ */ (0,
|
|
13491
|
-
/* @__PURE__ */ (0,
|
|
13492
|
-
/* @__PURE__ */ (0,
|
|
13493
|
-
/* @__PURE__ */ (0,
|
|
13494
|
-
/* @__PURE__ */ (0,
|
|
13897
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13898
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(import_lucide_react12.Video, { className: "w-4 h-4" }) }),
|
|
13899
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "overflow-hidden", children: [
|
|
13900
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
13901
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
13495
13902
|
] })
|
|
13496
13903
|
] }) }),
|
|
13497
|
-
/* @__PURE__ */ (0,
|
|
13498
|
-
hasValidMedia ? /* @__PURE__ */ (0,
|
|
13499
|
-
/* @__PURE__ */ (0,
|
|
13904
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
13905
|
+
hasValidMedia ? /* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13906
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.CheckCircle2, { className: "w-3 h-3 text-emerald-600" }),
|
|
13500
13907
|
"\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF"
|
|
13501
|
-
] }) : /* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13908
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13909
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.AlertCircle, { className: "w-3 h-3 text-amber-600 shrink-0" }),
|
|
13503
13910
|
"\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5"
|
|
13504
13911
|
] }),
|
|
13505
|
-
hasValidMedia && /* @__PURE__ */ (0,
|
|
13912
|
+
hasValidMedia && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13506
13913
|
"a",
|
|
13507
13914
|
{
|
|
13508
13915
|
href: headerMediaUrl,
|
|
@@ -13510,10 +13917,10 @@ function TemplateSelectionBlock({
|
|
|
13510
13917
|
rel: "noopener noreferrer",
|
|
13511
13918
|
title: "\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E9\u05DC \u05D4\u05E7\u05D5\u05D1\u05E5",
|
|
13512
13919
|
className: "p-1 text-slate-400 hover:text-emerald-700 hover:bg-slate-200/60 rounded-md transition-colors",
|
|
13513
|
-
children: /* @__PURE__ */ (0,
|
|
13920
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.ExternalLink, { className: "w-3.5 h-3.5" })
|
|
13514
13921
|
}
|
|
13515
13922
|
),
|
|
13516
|
-
/* @__PURE__ */ (0,
|
|
13923
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13517
13924
|
"input",
|
|
13518
13925
|
{
|
|
13519
13926
|
ref: fileInputRef,
|
|
@@ -13531,7 +13938,7 @@ function TemplateSelectionBlock({
|
|
|
13531
13938
|
disabled: isUploadingMedia
|
|
13532
13939
|
}
|
|
13533
13940
|
),
|
|
13534
|
-
/* @__PURE__ */ (0,
|
|
13941
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13535
13942
|
"button",
|
|
13536
13943
|
{
|
|
13537
13944
|
type: "button",
|
|
@@ -13542,39 +13949,39 @@ function TemplateSelectionBlock({
|
|
|
13542
13949
|
},
|
|
13543
13950
|
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"}`,
|
|
13544
13951
|
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`,
|
|
13545
|
-
children: isUploadingMedia ? /* @__PURE__ */ (0,
|
|
13546
|
-
/* @__PURE__ */ (0,
|
|
13547
|
-
/* @__PURE__ */ (0,
|
|
13548
|
-
] }) : /* @__PURE__ */ (0,
|
|
13549
|
-
/* @__PURE__ */ (0,
|
|
13550
|
-
/* @__PURE__ */ (0,
|
|
13952
|
+
children: isUploadingMedia ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13953
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Loader2, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
13954
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
|
|
13955
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
13956
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react12.Upload, { className: "w-3.5 h-3.5" }),
|
|
13957
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
|
|
13551
13958
|
] })
|
|
13552
13959
|
}
|
|
13553
13960
|
)
|
|
13554
13961
|
] })
|
|
13555
13962
|
] });
|
|
13556
13963
|
})(),
|
|
13557
|
-
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0,
|
|
13558
|
-
/* @__PURE__ */ (0,
|
|
13559
|
-
/* @__PURE__ */ (0,
|
|
13560
|
-
/* @__PURE__ */ (0,
|
|
13964
|
+
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
|
|
13965
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between shrink-0", children: [
|
|
13966
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
|
|
13967
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13561
13968
|
templateVariables.length,
|
|
13562
13969
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
13563
13970
|
] })
|
|
13564
13971
|
] }),
|
|
13565
|
-
/* @__PURE__ */ (0,
|
|
13972
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
|
|
13566
13973
|
var _a;
|
|
13567
13974
|
const mapping = variableMapping[varKey] || { type: "column", value: "" };
|
|
13568
13975
|
const isStatic = mapping.type === "static";
|
|
13569
13976
|
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 || "";
|
|
13570
|
-
return /* @__PURE__ */ (0,
|
|
13977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13571
13978
|
"div",
|
|
13572
13979
|
{
|
|
13573
13980
|
className: "flex items-center gap-1.5 p-1 bg-white border border-slate-200 rounded-xl text-xs shrink-0",
|
|
13574
13981
|
children: [
|
|
13575
|
-
/* @__PURE__ */ (0,
|
|
13576
|
-
/* @__PURE__ */ (0,
|
|
13577
|
-
/* @__PURE__ */ (0,
|
|
13982
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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}}}` }),
|
|
13983
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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: [
|
|
13984
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13578
13985
|
"button",
|
|
13579
13986
|
{
|
|
13580
13987
|
type: "button",
|
|
@@ -13583,7 +13990,7 @@ function TemplateSelectionBlock({
|
|
|
13583
13990
|
children: "\u05E2\u05DE\u05D5\u05D3\u05D4"
|
|
13584
13991
|
}
|
|
13585
13992
|
),
|
|
13586
|
-
/* @__PURE__ */ (0,
|
|
13993
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13587
13994
|
"button",
|
|
13588
13995
|
{
|
|
13589
13996
|
type: "button",
|
|
@@ -13593,7 +14000,7 @@ function TemplateSelectionBlock({
|
|
|
13593
14000
|
}
|
|
13594
14001
|
)
|
|
13595
14002
|
] }),
|
|
13596
|
-
isStatic ? /* @__PURE__ */ (0,
|
|
14003
|
+
isStatic ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13597
14004
|
"input",
|
|
13598
14005
|
{
|
|
13599
14006
|
type: "text",
|
|
@@ -13602,20 +14009,20 @@ function TemplateSelectionBlock({
|
|
|
13602
14009
|
placeholder: "\u05D4\u05D6\u05DF \u05E2\u05E8\u05DA \u05E7\u05D1\u05D5\u05E2 (\u05D7\u05D5\u05D1\u05D4)...",
|
|
13603
14010
|
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"}`
|
|
13604
14011
|
}
|
|
13605
|
-
) : /* @__PURE__ */ (0,
|
|
13606
|
-
/* @__PURE__ */ (0,
|
|
14012
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative flex-1 min-w-0", children: [
|
|
14013
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
13607
14014
|
"select",
|
|
13608
14015
|
{
|
|
13609
14016
|
value: selectedColVal,
|
|
13610
14017
|
onChange: (e) => handleVariableValueChange(varKey, e.target.value),
|
|
13611
14018
|
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",
|
|
13612
14019
|
children: [
|
|
13613
|
-
/* @__PURE__ */ (0,
|
|
13614
|
-
textableColumnOptions.map((opt) => /* @__PURE__ */ (0,
|
|
14020
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
14021
|
+
textableColumnOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: opt.id, children: opt.label }, opt.id))
|
|
13615
14022
|
]
|
|
13616
14023
|
}
|
|
13617
14024
|
),
|
|
13618
|
-
/* @__PURE__ */ (0,
|
|
14025
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
13619
14026
|
] })
|
|
13620
14027
|
]
|
|
13621
14028
|
},
|
|
@@ -13628,8 +14035,8 @@ function TemplateSelectionBlock({
|
|
|
13628
14035
|
}
|
|
13629
14036
|
|
|
13630
14037
|
// src/components/WhatsAppComponent/ui/DynamicFiltersBlock.tsx
|
|
13631
|
-
var
|
|
13632
|
-
var
|
|
14038
|
+
var import_lucide_react13 = require("lucide-react");
|
|
14039
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
13633
14040
|
function DynamicFiltersBlock({
|
|
13634
14041
|
filterableColumns,
|
|
13635
14042
|
filters,
|
|
@@ -13644,31 +14051,31 @@ function DynamicFiltersBlock({
|
|
|
13644
14051
|
loadTableData,
|
|
13645
14052
|
isLoadingTableData
|
|
13646
14053
|
}) {
|
|
13647
|
-
return /* @__PURE__ */ (0,
|
|
13648
|
-
/* @__PURE__ */ (0,
|
|
13649
|
-
/* @__PURE__ */ (0,
|
|
13650
|
-
/* @__PURE__ */ (0,
|
|
13651
|
-
/* @__PURE__ */ (0,
|
|
13652
|
-
/* @__PURE__ */ (0,
|
|
13653
|
-
activeFiltersCount > 0 && /* @__PURE__ */ (0,
|
|
14054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.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: [
|
|
14055
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-2", children: [
|
|
14056
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
14057
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
14058
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Filter, { className: "w-4 h-4 text-emerald-600" }),
|
|
14059
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
|
|
14060
|
+
activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.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 })
|
|
13654
14061
|
] }),
|
|
13655
|
-
activeFiltersCount > 0 && /* @__PURE__ */ (0,
|
|
14062
|
+
activeFiltersCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
13656
14063
|
"button",
|
|
13657
14064
|
{
|
|
13658
14065
|
type: "button",
|
|
13659
14066
|
onClick: handleClearFilters,
|
|
13660
14067
|
className: "text-[11px] text-rose-600 hover:text-rose-700 font-semibold hover:underline flex items-center gap-1 cursor-pointer",
|
|
13661
14068
|
children: [
|
|
13662
|
-
/* @__PURE__ */ (0,
|
|
13663
|
-
/* @__PURE__ */ (0,
|
|
14069
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.X, { className: "w-3 h-3" }),
|
|
14070
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "\u05E0\u05E7\u05D4" })
|
|
13664
14071
|
]
|
|
13665
14072
|
}
|
|
13666
14073
|
)
|
|
13667
14074
|
] }),
|
|
13668
|
-
/* @__PURE__ */ (0,
|
|
13669
|
-
/* @__PURE__ */ (0,
|
|
13670
|
-
/* @__PURE__ */ (0,
|
|
13671
|
-
] }) : /* @__PURE__ */ (0,
|
|
14075
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
|
|
14076
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
|
|
14077
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
14078
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
|
|
13672
14079
|
var _a, _b, _c;
|
|
13673
14080
|
const colType = (_a = col.type) == null ? void 0 : _a.toUpperCase();
|
|
13674
14081
|
const isBoolean = colType === "BOOLEAN";
|
|
@@ -13676,9 +14083,9 @@ function DynamicFiltersBlock({
|
|
|
13676
14083
|
const isActive = Boolean(currentValue);
|
|
13677
14084
|
const refTableId = ((_b = col == null ? void 0 : col.config) == null ? void 0 : _b.referencedTableId) || (col == null ? void 0 : col.referencedTableId);
|
|
13678
14085
|
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] : [];
|
|
13679
|
-
return /* @__PURE__ */ (0,
|
|
13680
|
-
/* @__PURE__ */ (0,
|
|
13681
|
-
/* @__PURE__ */ (0,
|
|
14086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", children: [
|
|
14087
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
14088
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
13682
14089
|
"label",
|
|
13683
14090
|
{
|
|
13684
14091
|
className: "text-[11px] font-semibold text-slate-700 truncate max-w-[130px]",
|
|
@@ -13686,49 +14093,49 @@ function DynamicFiltersBlock({
|
|
|
13686
14093
|
children: col.name
|
|
13687
14094
|
}
|
|
13688
14095
|
),
|
|
13689
|
-
/* @__PURE__ */ (0,
|
|
14096
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
|
|
13690
14097
|
] }),
|
|
13691
|
-
/* @__PURE__ */ (0,
|
|
13692
|
-
/* @__PURE__ */ (0,
|
|
14098
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
14099
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
13693
14100
|
"select",
|
|
13694
14101
|
{
|
|
13695
14102
|
value: currentValue,
|
|
13696
14103
|
onChange: (e) => handleFilterChange(col.name, e.target.value),
|
|
13697
14104
|
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"}`,
|
|
13698
14105
|
children: [
|
|
13699
|
-
/* @__PURE__ */ (0,
|
|
13700
|
-
isBoolean ? /* @__PURE__ */ (0,
|
|
13701
|
-
/* @__PURE__ */ (0,
|
|
13702
|
-
/* @__PURE__ */ (0,
|
|
13703
|
-
] }) : options.map((opt) => /* @__PURE__ */ (0,
|
|
14106
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
14107
|
+
isBoolean ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
14108
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "true", children: "\u05DB\u05DF" }),
|
|
14109
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: "false", children: "\u05DC\u05D0" })
|
|
14110
|
+
] }) : options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
|
|
13704
14111
|
]
|
|
13705
14112
|
}
|
|
13706
14113
|
),
|
|
13707
|
-
/* @__PURE__ */ (0,
|
|
14114
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
13708
14115
|
] })
|
|
13709
14116
|
] }, col.name);
|
|
13710
14117
|
}) }) })
|
|
13711
14118
|
] }),
|
|
13712
|
-
/* @__PURE__ */ (0,
|
|
13713
|
-
/* @__PURE__ */ (0,
|
|
14119
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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: [
|
|
14120
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
13714
14121
|
"div",
|
|
13715
14122
|
{
|
|
13716
14123
|
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"}`,
|
|
13717
14124
|
children: [
|
|
13718
|
-
/* @__PURE__ */ (0,
|
|
13719
|
-
|
|
14125
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
14126
|
+
import_lucide_react13.CheckSquare,
|
|
13720
14127
|
{
|
|
13721
14128
|
className: `w-3 h-3 ${selectedRowIds.length > 0 ? "text-emerald-600" : "text-slate-400"}`
|
|
13722
14129
|
}
|
|
13723
14130
|
),
|
|
13724
|
-
/* @__PURE__ */ (0,
|
|
14131
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { children: [
|
|
13725
14132
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
13726
14133
|
selectedRowIds.length
|
|
13727
14134
|
] })
|
|
13728
14135
|
]
|
|
13729
14136
|
}
|
|
13730
14137
|
),
|
|
13731
|
-
/* @__PURE__ */ (0,
|
|
14138
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
13732
14139
|
"button",
|
|
13733
14140
|
{
|
|
13734
14141
|
type: "button",
|
|
@@ -13736,8 +14143,8 @@ function DynamicFiltersBlock({
|
|
|
13736
14143
|
disabled: isLoadingTableData,
|
|
13737
14144
|
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",
|
|
13738
14145
|
title: "\u05E8\u05E2\u05E0\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9 \u05D8\u05D1\u05DC\u05D4",
|
|
13739
|
-
children: /* @__PURE__ */ (0,
|
|
13740
|
-
|
|
14146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
14147
|
+
import_lucide_react13.RefreshCw,
|
|
13741
14148
|
{
|
|
13742
14149
|
className: `w-3.5 h-3.5 ${isLoadingTableData ? "animate-spin text-emerald-600" : ""}`
|
|
13743
14150
|
}
|
|
@@ -13748,85 +14155,6 @@ function DynamicFiltersBlock({
|
|
|
13748
14155
|
] });
|
|
13749
14156
|
}
|
|
13750
14157
|
|
|
13751
|
-
// src/components/WhatsAppComponent/ui/WhatsAppRelationButtons.tsx
|
|
13752
|
-
var import_react23 = require("react");
|
|
13753
|
-
var import_lucide_react13 = require("lucide-react");
|
|
13754
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
13755
|
-
var isRawObjectId3 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
|
|
13756
|
-
function recordMatches(record, colDef, filterVal) {
|
|
13757
|
-
var _a;
|
|
13758
|
-
if (!colDef) return true;
|
|
13759
|
-
const cell = ((record == null ? void 0 : record.data) || {})[colDef.name];
|
|
13760
|
-
const type = (_a = colDef.type) == null ? void 0 : _a.toUpperCase();
|
|
13761
|
-
if (type === "BOOLEAN") {
|
|
13762
|
-
const isTrue = cell === true || cell === "true" || cell === 1;
|
|
13763
|
-
return isTrue === (filterVal === "true");
|
|
13764
|
-
}
|
|
13765
|
-
if (type === "RELATION") {
|
|
13766
|
-
return normalizeRelationValue(cell).includes(filterVal);
|
|
13767
|
-
}
|
|
13768
|
-
return true;
|
|
13769
|
-
}
|
|
13770
|
-
function WhatsAppRelationButtons({
|
|
13771
|
-
columnNames,
|
|
13772
|
-
tableColumns: tableColumns2,
|
|
13773
|
-
records,
|
|
13774
|
-
filters,
|
|
13775
|
-
onFilterChange,
|
|
13776
|
-
relationOptions,
|
|
13777
|
-
getRelationOptionsForCol
|
|
13778
|
-
}) {
|
|
13779
|
-
const groups = (0, import_react23.useMemo)(() => {
|
|
13780
|
-
var _a, _b;
|
|
13781
|
-
const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
13782
|
-
const result = [];
|
|
13783
|
-
for (const colName of columnNames || []) {
|
|
13784
|
-
const colDef = (tableColumns2 || []).find((c) => c.name === colName);
|
|
13785
|
-
if (!colDef || ((_a = colDef.type) == null ? void 0 : _a.toUpperCase()) !== "RELATION") continue;
|
|
13786
|
-
const otherEntries = activeEntries.filter(([name]) => name !== colName);
|
|
13787
|
-
const base = otherEntries.length === 0 ? records : records.filter(
|
|
13788
|
-
(rec) => otherEntries.every(
|
|
13789
|
-
([name, val]) => recordMatches(rec, (tableColumns2 || []).find((c) => c.name === name), val)
|
|
13790
|
-
)
|
|
13791
|
-
);
|
|
13792
|
-
const counts = /* @__PURE__ */ new Map();
|
|
13793
|
-
for (const rec of base) {
|
|
13794
|
-
const ids = new Set(normalizeRelationValue(((rec == null ? void 0 : rec.data) || {})[colName]));
|
|
13795
|
-
ids.forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
|
|
13796
|
-
}
|
|
13797
|
-
const optionList = ((_b = getRelationOptionsForCol ? getRelationOptionsForCol(colName) : []) == null ? void 0 : _b.length) > 0 ? getRelationOptionsForCol(colName) : relationOptions[colName] || [];
|
|
13798
|
-
const activeId = filters[colName] ? String(filters[colName]) : null;
|
|
13799
|
-
const seen = /* @__PURE__ */ new Set();
|
|
13800
|
-
const options = [];
|
|
13801
|
-
for (const opt of optionList) {
|
|
13802
|
-
const id = String((opt == null ? void 0 : opt.id) || (opt == null ? void 0 : opt._id) || "");
|
|
13803
|
-
if (!id || seen.has(id)) continue;
|
|
13804
|
-
const count = counts.get(id) || 0;
|
|
13805
|
-
if (count === 0 && id !== activeId) continue;
|
|
13806
|
-
seen.add(id);
|
|
13807
|
-
options.push({ id, label: getRelationOptionLabel(opt, colDef, relationOptions), count });
|
|
13808
|
-
}
|
|
13809
|
-
counts.forEach((count, id) => {
|
|
13810
|
-
if (seen.has(id)) return;
|
|
13811
|
-
const label = getRelationOptionLabel(id, colDef, relationOptions);
|
|
13812
|
-
if (!label || isRawObjectId3(label)) return;
|
|
13813
|
-
seen.add(id);
|
|
13814
|
-
options.push({ id, label, count });
|
|
13815
|
-
});
|
|
13816
|
-
result.push({ key: colName, title: colName, options, activeId });
|
|
13817
|
-
}
|
|
13818
|
-
return result;
|
|
13819
|
-
}, [columnNames, tableColumns2, records, filters, relationOptions, getRelationOptionsForCol]);
|
|
13820
|
-
if (!columnNames || columnNames.length === 0) return null;
|
|
13821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "relative min-h-[12rem] 2xl:min-h-0", "data-testid": "whatsapp-relation-buttons", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "2xl:absolute 2xl:inset-0 flex flex-col bg-slate-50/70 border border-slate-200 rounded-2xl p-3.5 gap-2 overflow-hidden", children: [
|
|
13822
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
13823
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react13.Zap, { className: "w-4 h-4 text-emerald-600" }),
|
|
13824
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05DE\u05D4\u05D9\u05E8" })
|
|
13825
|
-
] }),
|
|
13826
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto max-h-[22rem] 2xl:max-h-none pr-0.5", children: groups.every((g) => g.options.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "p-4 text-center text-xs text-slate-400", children: "\u05D0\u05D9\u05DF \u05E2\u05E8\u05DB\u05D9\u05DD \u05DC\u05D4\u05E6\u05D2\u05D4 \u05D1\u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RelationButtonsView, { groups, stacked: true, onSelect: (col, id) => onFilterChange(col, id || "") }) })
|
|
13827
|
-
] }) });
|
|
13828
|
-
}
|
|
13829
|
-
|
|
13830
14158
|
// src/components/WhatsAppComponent/ui/SettingsAndActionsBlock.tsx
|
|
13831
14159
|
var import_lucide_react14 = require("lucide-react");
|
|
13832
14160
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -14309,19 +14637,19 @@ function SettingsAndActionsBlock({
|
|
|
14309
14637
|
}
|
|
14310
14638
|
|
|
14311
14639
|
// src/components/WhatsAppComponent/inbox/useInboxState.ts
|
|
14312
|
-
var
|
|
14640
|
+
var import_react25 = require("react");
|
|
14313
14641
|
function useInboxState(orgId, actions) {
|
|
14314
|
-
const [conversations, setConversations] = (0,
|
|
14315
|
-
const [activeConversationId, setActiveConversationId] = (0,
|
|
14316
|
-
const [messages, setMessages] = (0,
|
|
14317
|
-
const [isLoading, setIsLoading] = (0,
|
|
14318
|
-
const [isSending, setIsSending] = (0,
|
|
14319
|
-
const [error, setError] = (0,
|
|
14320
|
-
const actionsRef = (0,
|
|
14321
|
-
(0,
|
|
14642
|
+
const [conversations, setConversations] = (0, import_react25.useState)([]);
|
|
14643
|
+
const [activeConversationId, setActiveConversationId] = (0, import_react25.useState)(null);
|
|
14644
|
+
const [messages, setMessages] = (0, import_react25.useState)([]);
|
|
14645
|
+
const [isLoading, setIsLoading] = (0, import_react25.useState)(false);
|
|
14646
|
+
const [isSending, setIsSending] = (0, import_react25.useState)(false);
|
|
14647
|
+
const [error, setError] = (0, import_react25.useState)(null);
|
|
14648
|
+
const actionsRef = (0, import_react25.useRef)(actions);
|
|
14649
|
+
(0, import_react25.useEffect)(() => {
|
|
14322
14650
|
actionsRef.current = actions;
|
|
14323
14651
|
});
|
|
14324
|
-
const fetchConversations = (0,
|
|
14652
|
+
const fetchConversations = (0, import_react25.useCallback)(async () => {
|
|
14325
14653
|
if (!orgId) return;
|
|
14326
14654
|
const res = await actionsRef.current.getConversations(orgId);
|
|
14327
14655
|
if (res.success && res.data) {
|
|
@@ -14330,7 +14658,7 @@ function useInboxState(orgId, actions) {
|
|
|
14330
14658
|
setError(res.error);
|
|
14331
14659
|
}
|
|
14332
14660
|
}, [orgId]);
|
|
14333
|
-
const fetchMessages = (0,
|
|
14661
|
+
const fetchMessages = (0, import_react25.useCallback)(async (conversationId, silent = false) => {
|
|
14334
14662
|
if (!silent) setIsLoading(true);
|
|
14335
14663
|
const res = await actionsRef.current.getMessages(conversationId);
|
|
14336
14664
|
if (res.success && res.data) {
|
|
@@ -14343,7 +14671,7 @@ function useInboxState(orgId, actions) {
|
|
|
14343
14671
|
}
|
|
14344
14672
|
if (!silent) setIsLoading(false);
|
|
14345
14673
|
}, []);
|
|
14346
|
-
(0,
|
|
14674
|
+
(0, import_react25.useEffect)(() => {
|
|
14347
14675
|
fetchConversations();
|
|
14348
14676
|
const interval = setInterval(() => {
|
|
14349
14677
|
fetchConversations();
|
|
@@ -14442,17 +14770,17 @@ function ConversationList({ conversations, activeId, onSelect }) {
|
|
|
14442
14770
|
}
|
|
14443
14771
|
|
|
14444
14772
|
// src/components/WhatsAppComponent/inbox/ChatWindow.tsx
|
|
14445
|
-
var
|
|
14773
|
+
var import_react26 = require("react");
|
|
14446
14774
|
var import_lucide_react16 = require("lucide-react");
|
|
14447
14775
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
14448
14776
|
function ChatWindow({ activeConversation, messages, isLoading, isSending, onSendMessage }) {
|
|
14449
|
-
const [inputText, setInputText] = (0,
|
|
14450
|
-
const messagesTopRef = (0,
|
|
14777
|
+
const [inputText, setInputText] = (0, import_react26.useState)("");
|
|
14778
|
+
const messagesTopRef = (0, import_react26.useRef)(null);
|
|
14451
14779
|
const scrollToTop = () => {
|
|
14452
14780
|
var _a;
|
|
14453
14781
|
(_a = messagesTopRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
14454
14782
|
};
|
|
14455
|
-
(0,
|
|
14783
|
+
(0, import_react26.useEffect)(() => {
|
|
14456
14784
|
scrollToTop();
|
|
14457
14785
|
}, [messages.length, activeConversation == null ? void 0 : activeConversation.id]);
|
|
14458
14786
|
const handleSend = (e) => {
|
|
@@ -14568,14 +14896,7 @@ function WhatsAppComponent(props) {
|
|
|
14568
14896
|
var _a;
|
|
14569
14897
|
const { className = "", settings, orgId, componentId, executeAction } = props;
|
|
14570
14898
|
const state = useWhatsAppState(props);
|
|
14571
|
-
const [activeTab, setActiveTab] =
|
|
14572
|
-
const relationButtonColumns = (Array.isArray(settings == null ? void 0 : settings.relationButtonColumns) ? settings.relationButtonColumns : []).filter(
|
|
14573
|
-
(name) => (state.tableColumns || []).some((c) => {
|
|
14574
|
-
var _a2;
|
|
14575
|
-
return c.name === name && ((_a2 = c.type) == null ? void 0 : _a2.toUpperCase()) === "RELATION";
|
|
14576
|
-
})
|
|
14577
|
-
);
|
|
14578
|
-
const hasRelationButtons = relationButtonColumns.length > 0;
|
|
14899
|
+
const [activeTab, setActiveTab] = import_react27.default.useState("broadcast");
|
|
14579
14900
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
14580
14901
|
"div",
|
|
14581
14902
|
{
|
|
@@ -14683,111 +15004,97 @@ function WhatsAppComponent(props) {
|
|
|
14683
15004
|
)
|
|
14684
15005
|
] }),
|
|
14685
15006
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
14686
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className:
|
|
14687
|
-
|
|
14688
|
-
|
|
15007
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
|
|
15008
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
15009
|
+
TemplateSelectionBlock,
|
|
14689
15010
|
{
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
15011
|
+
selectedTemplate: state.selectedTemplate,
|
|
15012
|
+
selectedTemplateId: state.selectedTemplateId,
|
|
15013
|
+
setSelectedTemplateId: state.setSelectedTemplateId,
|
|
15014
|
+
templates: state.templates,
|
|
15015
|
+
isLoadingTemplates: state.isLoadingTemplates,
|
|
15016
|
+
isDropdownOpen: state.isDropdownOpen,
|
|
15017
|
+
setIsDropdownOpen: state.setIsDropdownOpen,
|
|
15018
|
+
templateBodyText: state.templateBodyText,
|
|
15019
|
+
templateHeaderComp: state.templateHeaderComp,
|
|
15020
|
+
headerMediaUrl: state.headerMediaUrl,
|
|
15021
|
+
handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
|
|
15022
|
+
handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
|
|
15023
|
+
templateVariables: state.templateVariables,
|
|
15024
|
+
variableMapping: state.variableMapping,
|
|
15025
|
+
handleVariableTypeChange: state.handleVariableTypeChange,
|
|
15026
|
+
handleVariableValueChange: state.handleVariableValueChange,
|
|
15027
|
+
textableColumnOptions: state.textableColumnOptions,
|
|
15028
|
+
handleDeleteTemplate: state.handleDeleteTemplate,
|
|
15029
|
+
isDeleting: state.isDeleting,
|
|
15030
|
+
setIsModalOpen: state.setIsModalOpen,
|
|
15031
|
+
setFeedback: state.setFeedback,
|
|
15032
|
+
isUploadingMedia: state.isUploadingMedia,
|
|
15033
|
+
handleFileUpload: state.handleFileUpload
|
|
15034
|
+
}
|
|
15035
|
+
),
|
|
15036
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
15037
|
+
DynamicFiltersBlock,
|
|
15038
|
+
{
|
|
15039
|
+
filterableColumns: state.filterableColumns,
|
|
14693
15040
|
filters: state.filters,
|
|
14694
|
-
|
|
15041
|
+
handleFilterChange: state.handleFilterChange,
|
|
15042
|
+
handleClearFilters: state.handleClearFilters,
|
|
15043
|
+
activeFiltersCount: state.activeFiltersCount,
|
|
14695
15044
|
relationOptions: state.relationOptions,
|
|
14696
|
-
getRelationOptionsForCol: state.getRelationOptionsForCol
|
|
15045
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
15046
|
+
selectedRowIds: state.selectedRowIds,
|
|
15047
|
+
filteredRecordsCount: state.filteredRecords.length,
|
|
15048
|
+
rawRecordsCount: state.rawRecords.length,
|
|
15049
|
+
loadTableData: state.loadTableData,
|
|
15050
|
+
isLoadingTableData: state.isLoadingTableData
|
|
14697
15051
|
}
|
|
14698
15052
|
),
|
|
14699
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14721
|
-
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
),
|
|
14745
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
14746
|
-
SettingsAndActionsBlock,
|
|
14747
|
-
{
|
|
14748
|
-
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
14749
|
-
targetPhoneOptions: state.targetPhoneOptions,
|
|
14750
|
-
phoneColumnId: state.phoneColumnId,
|
|
14751
|
-
setPhoneColumnId: state.setPhoneColumnId,
|
|
14752
|
-
selectedPhoneOption: state.selectedPhoneOption,
|
|
14753
|
-
autoSelectCount: state.autoSelectCount,
|
|
14754
|
-
setAutoSelectCount: state.setAutoSelectCount,
|
|
14755
|
-
subtableFilterColumn: state.subtableFilterColumn,
|
|
14756
|
-
setSubtableFilterColumn: state.setSubtableFilterColumn,
|
|
14757
|
-
subtableFilterValue: state.subtableFilterValue,
|
|
14758
|
-
setSubtableFilterValue: state.setSubtableFilterValue,
|
|
14759
|
-
subtableSendLimit: state.subtableSendLimit,
|
|
14760
|
-
setSubtableSendLimit: state.setSubtableSendLimit,
|
|
14761
|
-
subtableFilterableColumns: state.subtableFilterableColumns,
|
|
14762
|
-
selectedSubtableFilterCol: state.selectedSubtableFilterCol,
|
|
14763
|
-
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14764
|
-
relationOptions: state.relationOptions,
|
|
14765
|
-
enablePostSendAction: state.enablePostSendAction,
|
|
14766
|
-
setEnablePostSendAction: state.setEnablePostSendAction,
|
|
14767
|
-
postSendActionColumn: state.postSendActionColumn,
|
|
14768
|
-
setPostSendActionColumn: state.setPostSendActionColumn,
|
|
14769
|
-
postSendActionValue: state.postSendActionValue,
|
|
14770
|
-
setPostSendActionValue: state.setPostSendActionValue,
|
|
14771
|
-
postSendActionTargetType: state.postSendActionTargetType,
|
|
14772
|
-
setPostSendActionTargetType: state.setPostSendActionTargetType,
|
|
14773
|
-
postSendActionTargetOptions: state.postSendActionTargetOptions,
|
|
14774
|
-
selectedPostSendOption: state.selectedPostSendCol,
|
|
14775
|
-
isTestDisabled: state.isTestDisabled,
|
|
14776
|
-
testButtonTitle: state.testButtonTitle,
|
|
14777
|
-
setIsTestPromptOpen: state.setIsTestPromptOpen,
|
|
14778
|
-
isSendDisabled: state.isSendDisabled,
|
|
14779
|
-
sendButtonTitle: state.sendButtonTitle,
|
|
14780
|
-
handleSendMessages: state.handleSendMessages,
|
|
14781
|
-
selectedRowIdsCount: state.selectedRowIds.length,
|
|
14782
|
-
finalRecipientCount: state.finalRecipientCount,
|
|
14783
|
-
validMainRowsCount: state.validMainRowsCount,
|
|
14784
|
-
isSendingBroadcast: state.isSendingBroadcast,
|
|
14785
|
-
broadcastProgress: state.broadcastProgress,
|
|
14786
|
-
broadcastSummary: state.broadcastSummary,
|
|
14787
|
-
clearBroadcastSummary: state.clearBroadcastSummary
|
|
14788
|
-
}
|
|
14789
|
-
)
|
|
14790
|
-
] })
|
|
15053
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
15054
|
+
SettingsAndActionsBlock,
|
|
15055
|
+
{
|
|
15056
|
+
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
15057
|
+
targetPhoneOptions: state.targetPhoneOptions,
|
|
15058
|
+
phoneColumnId: state.phoneColumnId,
|
|
15059
|
+
setPhoneColumnId: state.setPhoneColumnId,
|
|
15060
|
+
selectedPhoneOption: state.selectedPhoneOption,
|
|
15061
|
+
autoSelectCount: state.autoSelectCount,
|
|
15062
|
+
setAutoSelectCount: state.setAutoSelectCount,
|
|
15063
|
+
subtableFilterColumn: state.subtableFilterColumn,
|
|
15064
|
+
setSubtableFilterColumn: state.setSubtableFilterColumn,
|
|
15065
|
+
subtableFilterValue: state.subtableFilterValue,
|
|
15066
|
+
setSubtableFilterValue: state.setSubtableFilterValue,
|
|
15067
|
+
subtableSendLimit: state.subtableSendLimit,
|
|
15068
|
+
setSubtableSendLimit: state.setSubtableSendLimit,
|
|
15069
|
+
subtableFilterableColumns: state.subtableFilterableColumns,
|
|
15070
|
+
selectedSubtableFilterCol: state.selectedSubtableFilterCol,
|
|
15071
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
15072
|
+
relationOptions: state.relationOptions,
|
|
15073
|
+
enablePostSendAction: state.enablePostSendAction,
|
|
15074
|
+
setEnablePostSendAction: state.setEnablePostSendAction,
|
|
15075
|
+
postSendActionColumn: state.postSendActionColumn,
|
|
15076
|
+
setPostSendActionColumn: state.setPostSendActionColumn,
|
|
15077
|
+
postSendActionValue: state.postSendActionValue,
|
|
15078
|
+
setPostSendActionValue: state.setPostSendActionValue,
|
|
15079
|
+
postSendActionTargetType: state.postSendActionTargetType,
|
|
15080
|
+
setPostSendActionTargetType: state.setPostSendActionTargetType,
|
|
15081
|
+
postSendActionTargetOptions: state.postSendActionTargetOptions,
|
|
15082
|
+
selectedPostSendOption: state.selectedPostSendCol,
|
|
15083
|
+
isTestDisabled: state.isTestDisabled,
|
|
15084
|
+
testButtonTitle: state.testButtonTitle,
|
|
15085
|
+
setIsTestPromptOpen: state.setIsTestPromptOpen,
|
|
15086
|
+
isSendDisabled: state.isSendDisabled,
|
|
15087
|
+
sendButtonTitle: state.sendButtonTitle,
|
|
15088
|
+
handleSendMessages: state.handleSendMessages,
|
|
15089
|
+
selectedRowIdsCount: state.selectedRowIds.length,
|
|
15090
|
+
finalRecipientCount: state.finalRecipientCount,
|
|
15091
|
+
validMainRowsCount: state.validMainRowsCount,
|
|
15092
|
+
isSendingBroadcast: state.isSendingBroadcast,
|
|
15093
|
+
broadcastProgress: state.broadcastProgress,
|
|
15094
|
+
broadcastSummary: state.broadcastSummary,
|
|
15095
|
+
clearBroadcastSummary: state.clearBroadcastSummary
|
|
15096
|
+
}
|
|
15097
|
+
)
|
|
14791
15098
|
] }),
|
|
14792
15099
|
/* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsxs)("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
|
|
14793
15100
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react17.Loader2, { className: "w-6 h-6 animate-spin text-emerald-600" }),
|
|
@@ -14813,8 +15120,7 @@ function WhatsAppComponent(props) {
|
|
|
14813
15120
|
orgId,
|
|
14814
15121
|
componentId: `${componentId || "whatsapp"}-embedded-table`,
|
|
14815
15122
|
className: "h-full flex-1 border-0 rounded-2xl shadow-none",
|
|
14816
|
-
rowStatusMap: state.rowStatusMap
|
|
14817
|
-
hideRelationButtons: true
|
|
15123
|
+
rowStatusMap: state.rowStatusMap
|
|
14818
15124
|
}
|
|
14819
15125
|
) })
|
|
14820
15126
|
] }),
|
|
@@ -14995,18 +15301,18 @@ function WhatsAppComponent(props) {
|
|
|
14995
15301
|
}
|
|
14996
15302
|
|
|
14997
15303
|
// src/components/FormBlock/FormBlock.tsx
|
|
14998
|
-
var
|
|
15304
|
+
var import_react28 = require("react");
|
|
14999
15305
|
var import_lucide_react18 = require("lucide-react");
|
|
15000
15306
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
15001
15307
|
function FormBlock({ settings: schema, executeAction, componentId, className = "", onSuccess }) {
|
|
15002
15308
|
const { showError, addToast } = useToast();
|
|
15003
|
-
const [formData, setFormData] = (0,
|
|
15004
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
15005
|
-
const [isSubmitted, setIsSubmitted] = (0,
|
|
15006
|
-
const [columns, setColumns] = (0,
|
|
15007
|
-
const [isLoadingSchema, setIsLoadingSchema] = (0,
|
|
15309
|
+
const [formData, setFormData] = (0, import_react28.useState)({});
|
|
15310
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react28.useState)(false);
|
|
15311
|
+
const [isSubmitted, setIsSubmitted] = (0, import_react28.useState)(false);
|
|
15312
|
+
const [columns, setColumns] = (0, import_react28.useState)((schema == null ? void 0 : schema.columns) || []);
|
|
15313
|
+
const [isLoadingSchema, setIsLoadingSchema] = (0, import_react28.useState)(false);
|
|
15008
15314
|
const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
15009
|
-
(0,
|
|
15315
|
+
(0, import_react28.useEffect)(() => {
|
|
15010
15316
|
let isMounted = true;
|
|
15011
15317
|
if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction) {
|
|
15012
15318
|
setIsLoadingSchema(true);
|
|
@@ -15172,6 +15478,7 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15172
15478
|
COLUMN_TYPE_LABELS,
|
|
15173
15479
|
ColumnHeaderTitle,
|
|
15174
15480
|
CreateTemplateModal,
|
|
15481
|
+
DEFAULT_FILTER_COLUMN_TYPES,
|
|
15175
15482
|
DEFAULT_PLACEMENT_STATUS_COLORS,
|
|
15176
15483
|
DatePickerCell,
|
|
15177
15484
|
DynamicFiltersBlock,
|
|
@@ -15186,6 +15493,7 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15186
15493
|
RELATION_BUTTON_COUNTS_ACTION,
|
|
15187
15494
|
RELATION_LABEL_KEY,
|
|
15188
15495
|
RELATION_SEP,
|
|
15496
|
+
RESOLVE_DEFAULT_FILTERS_ACTION,
|
|
15189
15497
|
RelationFilterPopover,
|
|
15190
15498
|
RelationPickerCell,
|
|
15191
15499
|
SettingsAndActionsBlock,
|
|
@@ -15206,6 +15514,7 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15206
15514
|
buildRelationRef,
|
|
15207
15515
|
calculateMinColumnWidth,
|
|
15208
15516
|
checkElementTruncation,
|
|
15517
|
+
cleanPlacementFilterDefaults,
|
|
15209
15518
|
cn,
|
|
15210
15519
|
columnRefLabel,
|
|
15211
15520
|
computeFormulaValue,
|
|
@@ -15221,6 +15530,8 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15221
15530
|
formatTimeInput,
|
|
15222
15531
|
formatTimeIso,
|
|
15223
15532
|
generateWhatsAppLink,
|
|
15533
|
+
getColumnDefaultFilter,
|
|
15534
|
+
getDefaultFilterColumns,
|
|
15224
15535
|
getDeterministicPastelBadge,
|
|
15225
15536
|
getEligibleCopyTargets,
|
|
15226
15537
|
getNextVariableIndex,
|
|
@@ -15256,11 +15567,14 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15256
15567
|
renameCopyTarget,
|
|
15257
15568
|
resolveDefaultStatusId,
|
|
15258
15569
|
resolveProtocol,
|
|
15570
|
+
sanitizeDefaultFilter,
|
|
15259
15571
|
sanitizePhoneNumber,
|
|
15260
15572
|
sanitizeTemplateNameInput,
|
|
15261
15573
|
seamlessVariableEngine,
|
|
15262
15574
|
splitHeaderTitle,
|
|
15575
|
+
supportsDefaultFilter,
|
|
15263
15576
|
tableColumns,
|
|
15577
|
+
toColumnFilterValue,
|
|
15264
15578
|
useColumnReorder,
|
|
15265
15579
|
useColumnResize,
|
|
15266
15580
|
useSmartTooltip,
|
|
@@ -15272,5 +15586,6 @@ var UNIVERSE_COMPONENTS = {
|
|
|
15272
15586
|
validateTemplateBody,
|
|
15273
15587
|
validateTemplateButtons,
|
|
15274
15588
|
validateWhatsAppTemplate,
|
|
15275
|
-
validateWordToVariableRatio
|
|
15589
|
+
validateWordToVariableRatio,
|
|
15590
|
+
withDefaultFilter
|
|
15276
15591
|
});
|