@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.mjs
CHANGED
|
@@ -1064,8 +1064,57 @@ function getRelationButtonColumns(columns) {
|
|
|
1064
1064
|
return (columns || []).filter((c) => isRelationButtonsColumn(c) && c.name !== "_id");
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
+
// ../shared/src/defaultFilters.ts
|
|
1068
|
+
var DEFAULT_FILTER_COLUMN_TYPES = ["STRING", "RELATION"];
|
|
1069
|
+
var RESOLVE_DEFAULT_FILTERS_ACTION = "RESOLVE_DEFAULT_FILTERS";
|
|
1070
|
+
var isString = (v) => typeof v === "string";
|
|
1071
|
+
function supportsDefaultFilter(type) {
|
|
1072
|
+
if (!type) return false;
|
|
1073
|
+
return DEFAULT_FILTER_COLUMN_TYPES.includes(String(type).toUpperCase());
|
|
1074
|
+
}
|
|
1075
|
+
function sanitizeDefaultFilter(raw) {
|
|
1076
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1077
|
+
const value = raw.value;
|
|
1078
|
+
if (!isString(value) || value.trim() === "") return null;
|
|
1079
|
+
const label = raw.label;
|
|
1080
|
+
return __spreadValues({ value: value.trim() }, isString(label) && label.trim() ? { label: label.trim() } : {});
|
|
1081
|
+
}
|
|
1082
|
+
function getColumnDefaultFilter(col) {
|
|
1083
|
+
var _a;
|
|
1084
|
+
if (!col || !supportsDefaultFilter(col.type)) return null;
|
|
1085
|
+
return sanitizeDefaultFilter((_a = col.config) == null ? void 0 : _a.defaultFilter);
|
|
1086
|
+
}
|
|
1087
|
+
function getDefaultFilterColumns(columns) {
|
|
1088
|
+
const out = [];
|
|
1089
|
+
for (const c of columns || []) {
|
|
1090
|
+
if (!(c == null ? void 0 : c.name) || c.name === "_id") continue;
|
|
1091
|
+
const setting = getColumnDefaultFilter(c);
|
|
1092
|
+
if (setting) out.push({ name: c.name, type: String(c.type).toUpperCase(), setting });
|
|
1093
|
+
}
|
|
1094
|
+
return out;
|
|
1095
|
+
}
|
|
1096
|
+
function toColumnFilterValue(type, value) {
|
|
1097
|
+
return String(type).toUpperCase() === "RELATION" ? [value] : value;
|
|
1098
|
+
}
|
|
1099
|
+
function withDefaultFilter(config, type, setting) {
|
|
1100
|
+
const next = __spreadValues({}, config || {});
|
|
1101
|
+
const clean = supportsDefaultFilter(type) ? sanitizeDefaultFilter(setting) : null;
|
|
1102
|
+
if (clean) next.defaultFilter = clean;
|
|
1103
|
+
else delete next.defaultFilter;
|
|
1104
|
+
return next;
|
|
1105
|
+
}
|
|
1106
|
+
function cleanPlacementFilterDefaults(defaults, allowedKeys) {
|
|
1107
|
+
if (!defaults || typeof defaults !== "object") return void 0;
|
|
1108
|
+
const out = {};
|
|
1109
|
+
for (const key of allowedKeys) {
|
|
1110
|
+
const v = defaults[key];
|
|
1111
|
+
if (key && isString(v) && v.trim() !== "") out[key] = v;
|
|
1112
|
+
}
|
|
1113
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1067
1116
|
// src/components/TableBlock/TableBlockClient.tsx
|
|
1068
|
-
import React13, { useState as
|
|
1117
|
+
import React13, { useState as useState15, useMemo as useMemo7, useEffect as useEffect13, useCallback as useCallback12, useRef as useRef13 } from "react";
|
|
1069
1118
|
|
|
1070
1119
|
// src/hooks/useToast.ts
|
|
1071
1120
|
import { useContext as useContext2 } from "react";
|
|
@@ -6106,6 +6155,49 @@ function RelationButtonsBar({
|
|
|
6106
6155
|
);
|
|
6107
6156
|
}
|
|
6108
6157
|
|
|
6158
|
+
// src/components/TableBlock/useDefaultColumnFilters.ts
|
|
6159
|
+
import { useEffect as useEffect12, useRef as useRef12, useState as useState14 } from "react";
|
|
6160
|
+
var RESOLVE_TIMEOUT_MS = 8e3;
|
|
6161
|
+
function unwrap2(res) {
|
|
6162
|
+
const body = (res == null ? void 0 : res.data) && typeof res.data === "object" && !Array.isArray(res.data) ? res.data : res;
|
|
6163
|
+
const filters = body == null ? void 0 : body.filters;
|
|
6164
|
+
return filters && typeof filters === "object" ? filters : {};
|
|
6165
|
+
}
|
|
6166
|
+
function useDefaultColumnFilters({ columns, tableId, executeAction, onResolved }) {
|
|
6167
|
+
const hasDefaults = getDefaultFilterColumns(columns).length > 0;
|
|
6168
|
+
const [ready, setReady] = useState14(() => !hasDefaults);
|
|
6169
|
+
const doneRef = useRef12(false);
|
|
6170
|
+
const onResolvedRef = useRef12(onResolved);
|
|
6171
|
+
onResolvedRef.current = onResolved;
|
|
6172
|
+
const actionRef = useRef12(executeAction);
|
|
6173
|
+
actionRef.current = executeAction;
|
|
6174
|
+
useEffect12(() => {
|
|
6175
|
+
if (doneRef.current || !hasDefaults) return;
|
|
6176
|
+
doneRef.current = true;
|
|
6177
|
+
const exec = actionRef.current;
|
|
6178
|
+
if (!tableId || !exec) {
|
|
6179
|
+
setReady(true);
|
|
6180
|
+
return;
|
|
6181
|
+
}
|
|
6182
|
+
let settled = false;
|
|
6183
|
+
const finish = (filters) => {
|
|
6184
|
+
if (settled) return;
|
|
6185
|
+
settled = true;
|
|
6186
|
+
if (filters && Object.keys(filters).length > 0) onResolvedRef.current(filters);
|
|
6187
|
+
setReady(true);
|
|
6188
|
+
};
|
|
6189
|
+
const timer = setTimeout(() => finish(), RESOLVE_TIMEOUT_MS);
|
|
6190
|
+
Promise.resolve(exec(RESOLVE_DEFAULT_FILTERS_ACTION, { tableId })).then(
|
|
6191
|
+
(res) => finish(unwrap2(res)),
|
|
6192
|
+
(err) => {
|
|
6193
|
+
console.warn("[TableBlock] Failed to resolve default filters:", err);
|
|
6194
|
+
finish();
|
|
6195
|
+
}
|
|
6196
|
+
).finally(() => clearTimeout(timer));
|
|
6197
|
+
}, [hasDefaults, tableId]);
|
|
6198
|
+
return ready;
|
|
6199
|
+
}
|
|
6200
|
+
|
|
6109
6201
|
// src/components/TableBlock/TableBlockClient.tsx
|
|
6110
6202
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6111
6203
|
function TableBlockClient({
|
|
@@ -6134,7 +6226,7 @@ function TableBlockClient({
|
|
|
6134
6226
|
hideRelationButtons
|
|
6135
6227
|
}) {
|
|
6136
6228
|
const { showError, addToast } = useToast();
|
|
6137
|
-
const [isExporting, setIsExporting] =
|
|
6229
|
+
const [isExporting, setIsExporting] = useState15(false);
|
|
6138
6230
|
const resolvedRole = role ? getRolePermissions(role) : void 0;
|
|
6139
6231
|
const effectivePermissions = permissions || (resolvedRole == null ? void 0 : resolvedRole.permissions) || {
|
|
6140
6232
|
canCreate: !readOnly,
|
|
@@ -6153,18 +6245,18 @@ function TableBlockClient({
|
|
|
6153
6245
|
return calculateMinColumnWidth(colName, false, col == null ? void 0 : col.type);
|
|
6154
6246
|
}
|
|
6155
6247
|
});
|
|
6156
|
-
const executeActionRef =
|
|
6157
|
-
|
|
6248
|
+
const executeActionRef = useRef13(executeAction);
|
|
6249
|
+
useEffect13(() => {
|
|
6158
6250
|
executeActionRef.current = executeAction;
|
|
6159
6251
|
}, [executeAction]);
|
|
6160
|
-
const [isMounted, setIsMounted] =
|
|
6161
|
-
const [isInitialLoading, setIsInitialLoading] =
|
|
6162
|
-
const [page, setPage] =
|
|
6163
|
-
const [limit, setLimit] =
|
|
6164
|
-
const [totalRecords, setTotalRecords] =
|
|
6165
|
-
const [totalPages, setTotalPages] =
|
|
6166
|
-
const [showSummary, setShowSummary] =
|
|
6167
|
-
|
|
6252
|
+
const [isMounted, setIsMounted] = useState15(false);
|
|
6253
|
+
const [isInitialLoading, setIsInitialLoading] = useState15(true);
|
|
6254
|
+
const [page, setPage] = useState15(1);
|
|
6255
|
+
const [limit, setLimit] = useState15(50);
|
|
6256
|
+
const [totalRecords, setTotalRecords] = useState15(0);
|
|
6257
|
+
const [totalPages, setTotalPages] = useState15(1);
|
|
6258
|
+
const [showSummary, setShowSummary] = useState15(false);
|
|
6259
|
+
useEffect13(() => {
|
|
6168
6260
|
if (typeof window !== "undefined") {
|
|
6169
6261
|
const savedSummary = localStorage.getItem(`table_summary_${tableKey}`);
|
|
6170
6262
|
if (savedSummary !== null) {
|
|
@@ -6233,15 +6325,15 @@ function TableBlockClient({
|
|
|
6233
6325
|
return ((_a = a.order) != null ? _a : 0) - ((_b = b.order) != null ? _b : 0);
|
|
6234
6326
|
});
|
|
6235
6327
|
}, []);
|
|
6236
|
-
const [localColumns, setLocalColumns] =
|
|
6237
|
-
|
|
6328
|
+
const [localColumns, setLocalColumns] = useState15(() => (schema == null ? void 0 : schema.columns) || []);
|
|
6329
|
+
useEffect13(() => {
|
|
6238
6330
|
if ((schema == null ? void 0 : schema.columns) && schema.columns.length > 0) {
|
|
6239
6331
|
setLocalColumns((prev) => mergeColumnDefs(prev, schema.columns));
|
|
6240
6332
|
}
|
|
6241
6333
|
}, [schema == null ? void 0 : schema.columns, mergeColumnDefs]);
|
|
6242
|
-
const [dirty, setDirty] =
|
|
6243
|
-
const dirtyRef =
|
|
6244
|
-
|
|
6334
|
+
const [dirty, setDirty] = useState15({ added: [], modified: {}, deleted: [] });
|
|
6335
|
+
const dirtyRef = useRef13(dirty);
|
|
6336
|
+
useEffect13(() => {
|
|
6245
6337
|
dirtyRef.current = dirty;
|
|
6246
6338
|
}, [dirty]);
|
|
6247
6339
|
const mergeWithDirty = useCallback12((baseRecords) => {
|
|
@@ -6257,8 +6349,8 @@ function TableBlockClient({
|
|
|
6257
6349
|
const uniqueAdded = added.filter((r) => !baseIds.has(r.id));
|
|
6258
6350
|
return [...uniqueAdded, ...modifiedRecords];
|
|
6259
6351
|
}, []);
|
|
6260
|
-
const [data, setData] =
|
|
6261
|
-
const [serverRecords, setServerRecords] =
|
|
6352
|
+
const [data, setData] = useState15(() => normalizeRecords(initialRecords));
|
|
6353
|
+
const [serverRecords, setServerRecords] = useState15(() => normalizeRecords(initialRecords));
|
|
6262
6354
|
const filteredData = data;
|
|
6263
6355
|
const isEqualValues = (a, b) => {
|
|
6264
6356
|
if (a === b) return true;
|
|
@@ -6270,29 +6362,29 @@ function TableBlockClient({
|
|
|
6270
6362
|
}
|
|
6271
6363
|
return false;
|
|
6272
6364
|
};
|
|
6273
|
-
const [baseRecordsMap, setBaseRecordsMap] =
|
|
6365
|
+
const [baseRecordsMap, setBaseRecordsMap] = useState15(() => {
|
|
6274
6366
|
const map = /* @__PURE__ */ new Map();
|
|
6275
6367
|
(normalizeRecords(initialRecords) || []).forEach((r) => map.set(r.id, __spreadValues({}, r.data)));
|
|
6276
6368
|
return map;
|
|
6277
6369
|
});
|
|
6278
|
-
|
|
6370
|
+
useEffect13(() => {
|
|
6279
6371
|
if (initialRecords && initialRecords.length > 0) {
|
|
6280
6372
|
const map = /* @__PURE__ */ new Map();
|
|
6281
6373
|
(normalizeRecords(initialRecords) || []).forEach((r) => map.set(r.id, __spreadValues({}, r.data)));
|
|
6282
6374
|
setBaseRecordsMap(map);
|
|
6283
6375
|
}
|
|
6284
6376
|
}, [initialRecords]);
|
|
6285
|
-
const [searchQuery, setSearchQuery] =
|
|
6286
|
-
const [columnFilters, setColumnFilters] =
|
|
6287
|
-
const [activeSearchCol, setActiveSearchCol] =
|
|
6288
|
-
const activeSearchRef =
|
|
6289
|
-
const [activeRelationCol, setActiveRelationCol] =
|
|
6290
|
-
const [relationTriggerRect, setRelationTriggerRect] =
|
|
6291
|
-
const filterButtonRefs =
|
|
6292
|
-
const [relationOptions, setRelationOptions] =
|
|
6293
|
-
const [relationFilterOptions, setRelationFilterOptions] =
|
|
6294
|
-
const [loadingFilterCol, setLoadingFilterCol] =
|
|
6295
|
-
const relationDictionaryRef =
|
|
6377
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
6378
|
+
const [columnFilters, setColumnFilters] = useState15({});
|
|
6379
|
+
const [activeSearchCol, setActiveSearchCol] = useState15(null);
|
|
6380
|
+
const activeSearchRef = useRef13(null);
|
|
6381
|
+
const [activeRelationCol, setActiveRelationCol] = useState15(null);
|
|
6382
|
+
const [relationTriggerRect, setRelationTriggerRect] = useState15(null);
|
|
6383
|
+
const filterButtonRefs = useRef13({});
|
|
6384
|
+
const [relationOptions, setRelationOptions] = useState15({});
|
|
6385
|
+
const [relationFilterOptions, setRelationFilterOptions] = useState15({});
|
|
6386
|
+
const [loadingFilterCol, setLoadingFilterCol] = useState15(null);
|
|
6387
|
+
const relationDictionaryRef = useRef13({});
|
|
6296
6388
|
const mergeRelationOptions = useCallback12((colName, newOptions) => {
|
|
6297
6389
|
if (!Array.isArray(newOptions) || newOptions.length === 0) return;
|
|
6298
6390
|
if (!relationDictionaryRef.current[colName]) {
|
|
@@ -6316,7 +6408,7 @@ function TableBlockClient({
|
|
|
6316
6408
|
}));
|
|
6317
6409
|
}
|
|
6318
6410
|
}, []);
|
|
6319
|
-
|
|
6411
|
+
useEffect13(() => {
|
|
6320
6412
|
if (!activeSearchCol) return;
|
|
6321
6413
|
const handleMouseDown = (e) => {
|
|
6322
6414
|
if (activeSearchRef.current && !activeSearchRef.current.contains(e.target)) {
|
|
@@ -6337,23 +6429,29 @@ function TableBlockClient({
|
|
|
6337
6429
|
});
|
|
6338
6430
|
return JSON.stringify(active);
|
|
6339
6431
|
}, [columnFilters]);
|
|
6340
|
-
const
|
|
6341
|
-
|
|
6432
|
+
const defaultFiltersReady = useDefaultColumnFilters({
|
|
6433
|
+
columns: localColumns,
|
|
6434
|
+
tableId: (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id),
|
|
6435
|
+
executeAction,
|
|
6436
|
+
onResolved: (resolved) => setColumnFilters((prev) => __spreadValues(__spreadValues({}, resolved), prev))
|
|
6437
|
+
});
|
|
6438
|
+
const [debouncedSearch, setDebouncedSearch] = useState15(searchQuery);
|
|
6439
|
+
useEffect13(() => {
|
|
6342
6440
|
const timer = setTimeout(() => {
|
|
6343
6441
|
setDebouncedSearch(searchQuery.trim());
|
|
6344
6442
|
}, 300);
|
|
6345
6443
|
return () => clearTimeout(timer);
|
|
6346
6444
|
}, [searchQuery]);
|
|
6347
|
-
const isSearchMountedRef =
|
|
6348
|
-
|
|
6445
|
+
const isSearchMountedRef = useRef13(false);
|
|
6446
|
+
useEffect13(() => {
|
|
6349
6447
|
if (!isSearchMountedRef.current) {
|
|
6350
6448
|
isSearchMountedRef.current = true;
|
|
6351
6449
|
return;
|
|
6352
6450
|
}
|
|
6353
6451
|
setPage(1);
|
|
6354
6452
|
}, [debouncedSearch]);
|
|
6355
|
-
const [isFetching, setIsFetching] =
|
|
6356
|
-
const fetchRequestIdRef =
|
|
6453
|
+
const [isFetching, setIsFetching] = useState15(false);
|
|
6454
|
+
const fetchRequestIdRef = useRef13(0);
|
|
6357
6455
|
const fetchTableData = useCallback12((targetPage, targetLimit, targetSearch, targetFiltersKey) => {
|
|
6358
6456
|
const tableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
6359
6457
|
const action = executeActionRef.current;
|
|
@@ -6478,11 +6576,12 @@ function TableBlockClient({
|
|
|
6478
6576
|
}
|
|
6479
6577
|
});
|
|
6480
6578
|
}, [schema == null ? void 0 : schema.tableMetaId, schema == null ? void 0 : schema.tableId, schema == null ? void 0 : schema.id, mergeColumnDefs, mergeWithDirty, mergeRelationOptions]);
|
|
6481
|
-
|
|
6579
|
+
useEffect13(() => {
|
|
6580
|
+
if (!defaultFiltersReady) return;
|
|
6482
6581
|
fetchTableData(page, limit, debouncedSearch, filtersKey);
|
|
6483
|
-
}, [page, limit, debouncedSearch, filtersKey, fetchTableData]);
|
|
6484
|
-
|
|
6485
|
-
if (initialRecords) {
|
|
6582
|
+
}, [page, limit, debouncedSearch, filtersKey, fetchTableData, defaultFiltersReady]);
|
|
6583
|
+
useEffect13(() => {
|
|
6584
|
+
if (initialRecords && defaultFiltersReady) {
|
|
6486
6585
|
const norm = normalizeRecords(initialRecords);
|
|
6487
6586
|
setServerRecords(norm);
|
|
6488
6587
|
const hasActiveFilters = Boolean(debouncedSearch) || Object.keys(columnFilters).length > 0;
|
|
@@ -6543,7 +6642,7 @@ function TableBlockClient({
|
|
|
6543
6642
|
setData(mergeWithDirty(norm));
|
|
6544
6643
|
}
|
|
6545
6644
|
}
|
|
6546
|
-
}, [initialRecords, mergeWithDirty, debouncedSearch, columnFilters, fetchTableData, page, limit, filtersKey]);
|
|
6645
|
+
}, [initialRecords, mergeWithDirty, debouncedSearch, columnFilters, fetchTableData, page, limit, filtersKey, defaultFiltersReady]);
|
|
6547
6646
|
const refetchTableData = useCallback12(() => {
|
|
6548
6647
|
return fetchTableData(page, limit, debouncedSearch, filtersKey);
|
|
6549
6648
|
}, [page, limit, debouncedSearch, filtersKey, fetchTableData]);
|
|
@@ -6572,9 +6671,9 @@ function TableBlockClient({
|
|
|
6572
6671
|
const handleNextPage = () => {
|
|
6573
6672
|
setPage((prev) => Math.min(totalPages, prev + 1));
|
|
6574
6673
|
};
|
|
6575
|
-
const [selectedIds, setSelectedIds] =
|
|
6576
|
-
const isExternalSyncRef =
|
|
6577
|
-
|
|
6674
|
+
const [selectedIds, setSelectedIds] = useState15(/* @__PURE__ */ new Set());
|
|
6675
|
+
const isExternalSyncRef = useRef13(false);
|
|
6676
|
+
useEffect13(() => {
|
|
6578
6677
|
if (selectedRowIds !== void 0) {
|
|
6579
6678
|
const nextSet = new Set(selectedRowIds);
|
|
6580
6679
|
setSelectedIds((prev) => {
|
|
@@ -6586,8 +6685,8 @@ function TableBlockClient({
|
|
|
6586
6685
|
});
|
|
6587
6686
|
}
|
|
6588
6687
|
}, [selectedRowIds]);
|
|
6589
|
-
const isFirstSelectionChangeRef =
|
|
6590
|
-
|
|
6688
|
+
const isFirstSelectionChangeRef = useRef13(true);
|
|
6689
|
+
useEffect13(() => {
|
|
6591
6690
|
if (isFirstSelectionChangeRef.current) {
|
|
6592
6691
|
isFirstSelectionChangeRef.current = false;
|
|
6593
6692
|
if (selectedIds.size === 0) return;
|
|
@@ -6598,11 +6697,11 @@ function TableBlockClient({
|
|
|
6598
6697
|
}
|
|
6599
6698
|
onSelectionChange == null ? void 0 : onSelectionChange(Array.from(selectedIds));
|
|
6600
6699
|
}, [selectedIds, onSelectionChange]);
|
|
6601
|
-
const [pendingDeletions, setPendingDeletions] =
|
|
6602
|
-
const [isSaving, setIsSaving] =
|
|
6700
|
+
const [pendingDeletions, setPendingDeletions] = useState15([]);
|
|
6701
|
+
const [isSaving, setIsSaving] = useState15(false);
|
|
6603
6702
|
const isUpdatingActive = Boolean(isUpdating || isSaving);
|
|
6604
|
-
const [isSaveSuccess, setIsSaveSuccess] =
|
|
6605
|
-
const [expandedRowIds, setExpandedRowIds] =
|
|
6703
|
+
const [isSaveSuccess, setIsSaveSuccess] = useState15(false);
|
|
6704
|
+
const [expandedRowIds, setExpandedRowIds] = useState15(/* @__PURE__ */ new Set());
|
|
6606
6705
|
const schemaColsString = useMemo7(() => JSON.stringify(localColumns || []), [localColumns]);
|
|
6607
6706
|
const refetchRelation = useCallback12(async (colName, params) => {
|
|
6608
6707
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -6679,8 +6778,8 @@ function TableBlockClient({
|
|
|
6679
6778
|
setLoadingFilterCol(null);
|
|
6680
6779
|
}
|
|
6681
6780
|
}, [schemaColsString, schema == null ? void 0 : schema.tableMetaId, schema == null ? void 0 : schema.tableId, schema == null ? void 0 : schema.id, executeAction, mergeRelationOptions]);
|
|
6682
|
-
const requestedRelationIdsRef =
|
|
6683
|
-
|
|
6781
|
+
const requestedRelationIdsRef = useRef13({});
|
|
6782
|
+
useEffect13(() => {
|
|
6684
6783
|
if (!executeAction || !data || data.length === 0) return;
|
|
6685
6784
|
let parsedCols = [];
|
|
6686
6785
|
try {
|
|
@@ -6733,7 +6832,7 @@ function TableBlockClient({
|
|
|
6733
6832
|
}
|
|
6734
6833
|
});
|
|
6735
6834
|
}, [data, schemaColsString, executeAction, relationOptions, mergeRelationOptions]);
|
|
6736
|
-
|
|
6835
|
+
useEffect13(() => {
|
|
6737
6836
|
let parsedCols = [];
|
|
6738
6837
|
try {
|
|
6739
6838
|
parsedCols = JSON.parse(schemaColsString);
|
|
@@ -6769,9 +6868,9 @@ function TableBlockClient({
|
|
|
6769
6868
|
const systemFields = ["_id", "createdAt", "updatedAt", "orgId", "tableId"];
|
|
6770
6869
|
return normalizedColumns.filter((col) => !systemFields.includes(col.name));
|
|
6771
6870
|
}, [normalizedColumns]);
|
|
6772
|
-
const [isColumnsDropdownOpen, setIsColumnsDropdownOpen] =
|
|
6773
|
-
const dropdownRef =
|
|
6774
|
-
|
|
6871
|
+
const [isColumnsDropdownOpen, setIsColumnsDropdownOpen] = useState15(false);
|
|
6872
|
+
const dropdownRef = useRef13(null);
|
|
6873
|
+
useEffect13(() => {
|
|
6775
6874
|
const handleClickOutside = (e) => {
|
|
6776
6875
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
6777
6876
|
setIsColumnsDropdownOpen(false);
|
|
@@ -8034,7 +8133,7 @@ function ExpandedSubTables({
|
|
|
8034
8133
|
context
|
|
8035
8134
|
}) {
|
|
8036
8135
|
var _a;
|
|
8037
|
-
const [activeTab, setActiveTab] =
|
|
8136
|
+
const [activeTab, setActiveTab] = useState15((_a = subTableColumns[0]) == null ? void 0 : _a.name);
|
|
8038
8137
|
if (subTableColumns.length === 0) return null;
|
|
8039
8138
|
if (subTableColumns.length === 1) {
|
|
8040
8139
|
const stCol = subTableColumns[0];
|
|
@@ -8263,12 +8362,13 @@ function TableBlock(props) {
|
|
|
8263
8362
|
}
|
|
8264
8363
|
|
|
8265
8364
|
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
8266
|
-
import { useState as
|
|
8365
|
+
import { useState as useState16, useEffect as useEffect14, useRef as useRef14, useCallback as useCallback13, useMemo as useMemo9 } from "react";
|
|
8267
8366
|
import { AgGridReact } from "ag-grid-react";
|
|
8268
8367
|
import {
|
|
8269
8368
|
ModuleRegistry,
|
|
8270
8369
|
AllCommunityModule
|
|
8271
8370
|
} from "ag-grid-community";
|
|
8371
|
+
import { Filter as Filter2 } from "lucide-react";
|
|
8272
8372
|
|
|
8273
8373
|
// src/components/PlacementBlock/PlacementSettings.tsx
|
|
8274
8374
|
import React14 from "react";
|
|
@@ -8663,8 +8763,144 @@ var PlacementSettings = ({ config, onChange, tables }) => {
|
|
|
8663
8763
|
] });
|
|
8664
8764
|
};
|
|
8665
8765
|
|
|
8666
|
-
// src/components/PlacementBlock/
|
|
8766
|
+
// src/components/PlacementBlock/PlacementRelationButtons.tsx
|
|
8767
|
+
import { useMemo as useMemo8 } from "react";
|
|
8667
8768
|
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
8769
|
+
var GROUP_COLORS = [
|
|
8770
|
+
{ title: "bg-blue-600 text-white", active: "bg-blue-600 border-blue-600 text-white hover:bg-blue-700", count: "text-blue-700" },
|
|
8771
|
+
{ title: "bg-violet-600 text-white", active: "bg-violet-600 border-violet-600 text-white hover:bg-violet-700", count: "text-violet-700" },
|
|
8772
|
+
{ title: "bg-emerald-600 text-white", active: "bg-emerald-600 border-emerald-600 text-white hover:bg-emerald-700", count: "text-emerald-700" },
|
|
8773
|
+
{ title: "bg-amber-500 text-white", active: "bg-amber-500 border-amber-500 text-white hover:bg-amber-600", count: "text-amber-700" },
|
|
8774
|
+
{ title: "bg-rose-600 text-white", active: "bg-rose-600 border-rose-600 text-white hover:bg-rose-700", count: "text-rose-700" }
|
|
8775
|
+
];
|
|
8776
|
+
var isRawObjectId2 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
|
|
8777
|
+
function rowMatchesRelationFilter(row, colName, id) {
|
|
8778
|
+
var _a;
|
|
8779
|
+
return normalizeRelationValue((_a = row.data) == null ? void 0 : _a[colName]).includes(id);
|
|
8780
|
+
}
|
|
8781
|
+
var PlacementRelationButtons = ({
|
|
8782
|
+
columnNames,
|
|
8783
|
+
rows,
|
|
8784
|
+
filters,
|
|
8785
|
+
onFilterChange,
|
|
8786
|
+
relationOptions,
|
|
8787
|
+
className = ""
|
|
8788
|
+
}) => {
|
|
8789
|
+
const groups = useMemo8(() => {
|
|
8790
|
+
const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
8791
|
+
return (columnNames || []).map((colName) => {
|
|
8792
|
+
var _a, _b, _c, _d;
|
|
8793
|
+
const otherEntries = activeEntries.filter(([name]) => name !== colName);
|
|
8794
|
+
const base = otherEntries.length === 0 ? rows : rows.filter((r) => otherEntries.every(([name, val]) => rowMatchesRelationFilter(r, name, val)));
|
|
8795
|
+
const counts = /* @__PURE__ */ new Map();
|
|
8796
|
+
for (const r of base) {
|
|
8797
|
+
new Set(normalizeRelationValue((_a = r.data) == null ? void 0 : _a[colName])).forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
|
|
8798
|
+
}
|
|
8799
|
+
const activeId = filters[colName] ? String(filters[colName]) : null;
|
|
8800
|
+
const labelById = /* @__PURE__ */ new Map();
|
|
8801
|
+
for (const opt of relationOptions[colName] || []) {
|
|
8802
|
+
const id = String((_c = (_b = opt == null ? void 0 : opt.id) != null ? _b : opt == null ? void 0 : opt._id) != null ? _c : "");
|
|
8803
|
+
const label = String((_d = opt == null ? void 0 : opt.label) != null ? _d : "").trim();
|
|
8804
|
+
if (id && label && !isRawObjectId2(label)) labelById.set(id, label);
|
|
8805
|
+
}
|
|
8806
|
+
const options = [];
|
|
8807
|
+
const ids = /* @__PURE__ */ new Set([...counts.keys(), ...activeId ? [activeId] : []]);
|
|
8808
|
+
ids.forEach((id) => {
|
|
8809
|
+
const label = labelById.get(id);
|
|
8810
|
+
if (!label) return;
|
|
8811
|
+
options.push({ id, label, count: counts.get(id) || 0 });
|
|
8812
|
+
});
|
|
8813
|
+
options.sort((a, b) => a.label.localeCompare(b.label, "he"));
|
|
8814
|
+
return { key: colName, title: colName, options, activeId };
|
|
8815
|
+
});
|
|
8816
|
+
}, [columnNames, rows, filters, relationOptions]);
|
|
8817
|
+
if (!columnNames || columnNames.length === 0) return null;
|
|
8818
|
+
return /* @__PURE__ */ jsx18(
|
|
8819
|
+
"div",
|
|
8820
|
+
{
|
|
8821
|
+
className: `border-t border-slate-100 pt-3 ${className}`,
|
|
8822
|
+
"data-testid": "placement-relation-buttons",
|
|
8823
|
+
children: groups.every((g) => g.options.length === 0) ? /* @__PURE__ */ jsx18("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" }) : (
|
|
8824
|
+
// כל עמודה במתחם נפרד: בשורה הראשונה הכותרת (תגית צבעונית), ומהשורה שמתחת הכפתורים
|
|
8825
|
+
/* @__PURE__ */ jsx18("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-2.5", children: groups.map((group, gi) => {
|
|
8826
|
+
if (group.options.length === 0) return null;
|
|
8827
|
+
const color = GROUP_COLORS[gi % GROUP_COLORS.length];
|
|
8828
|
+
return /* @__PURE__ */ jsxs15("div", { className: "bg-white border border-slate-200 rounded-xl p-3 flex flex-col gap-2.5 shadow-2xs", children: [
|
|
8829
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between gap-2 pb-2 border-b border-slate-100", children: [
|
|
8830
|
+
/* @__PURE__ */ jsx18("span", { className: `px-2.5 py-0.5 rounded-md text-xs font-bold truncate ${color.title}`, title: group.title, children: group.title }),
|
|
8831
|
+
group.activeId && /* @__PURE__ */ jsx18(
|
|
8832
|
+
"button",
|
|
8833
|
+
{
|
|
8834
|
+
type: "button",
|
|
8835
|
+
onClick: () => onFilterChange(group.key, ""),
|
|
8836
|
+
className: "text-[11px] font-semibold text-rose-600 hover:text-rose-700 hover:underline cursor-pointer shrink-0",
|
|
8837
|
+
children: "\u05E0\u05E7\u05D4 \u05E1\u05D9\u05E0\u05D5\u05DF"
|
|
8838
|
+
}
|
|
8839
|
+
)
|
|
8840
|
+
] }),
|
|
8841
|
+
/* @__PURE__ */ jsx18("div", { className: "flex flex-wrap items-end gap-x-2 gap-y-2.5", children: group.options.map((opt) => {
|
|
8842
|
+
const active = group.activeId === opt.id;
|
|
8843
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center gap-0.5", children: [
|
|
8844
|
+
/* @__PURE__ */ jsx18("span", { className: `text-[11px] font-bold leading-none ${active ? color.count : "text-slate-500"}`, children: opt.count }),
|
|
8845
|
+
/* @__PURE__ */ jsx18(
|
|
8846
|
+
"button",
|
|
8847
|
+
{
|
|
8848
|
+
type: "button",
|
|
8849
|
+
onClick: () => onFilterChange(group.key, active ? "" : opt.id),
|
|
8850
|
+
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}`,
|
|
8851
|
+
"aria-pressed": active,
|
|
8852
|
+
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"}`,
|
|
8853
|
+
children: opt.label
|
|
8854
|
+
}
|
|
8855
|
+
)
|
|
8856
|
+
] }, opt.id);
|
|
8857
|
+
}) })
|
|
8858
|
+
] }, group.key);
|
|
8859
|
+
}) })
|
|
8860
|
+
)
|
|
8861
|
+
}
|
|
8862
|
+
);
|
|
8863
|
+
};
|
|
8864
|
+
|
|
8865
|
+
// src/components/PlacementBlock/placementDefaultFilters.ts
|
|
8866
|
+
function getPlacementFilterRefs(config) {
|
|
8867
|
+
const defined = Array.isArray(config == null ? void 0 : config.filterFields) ? config.filterFields : [];
|
|
8868
|
+
const legacy = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
|
|
8869
|
+
return (defined.length > 0 ? defined : legacy).filter((r) => typeof r === "string" && r);
|
|
8870
|
+
}
|
|
8871
|
+
function resolveFilterColName(ref, targetColumns) {
|
|
8872
|
+
const direct = (targetColumns || []).find((c) => (c == null ? void 0 : c.id) === ref || (c == null ? void 0 : c.name) === ref);
|
|
8873
|
+
if (direct) return direct.name;
|
|
8874
|
+
const { relationColumn } = parseColumnRef(ref);
|
|
8875
|
+
if (relationColumn) {
|
|
8876
|
+
const rel = (targetColumns || []).find(
|
|
8877
|
+
(c) => (c == null ? void 0 : c.name) === relationColumn && String(c == null ? void 0 : c.type).toUpperCase() === "RELATION"
|
|
8878
|
+
);
|
|
8879
|
+
if (rel) return rel.name;
|
|
8880
|
+
}
|
|
8881
|
+
return ref;
|
|
8882
|
+
}
|
|
8883
|
+
function computePlacementDefaultFilters(args) {
|
|
8884
|
+
const { refs, defaults, targetColumns, rows, getText } = args;
|
|
8885
|
+
const applied = {};
|
|
8886
|
+
if (!defaults) return applied;
|
|
8887
|
+
for (const ref of refs) {
|
|
8888
|
+
const want = defaults[ref];
|
|
8889
|
+
if (typeof want !== "string" || want === "") continue;
|
|
8890
|
+
const colName = resolveFilterColName(ref, targetColumns);
|
|
8891
|
+
if (colName in applied) continue;
|
|
8892
|
+
const validRows = rows.filter(
|
|
8893
|
+
(r) => Object.entries(applied).every(([name, value]) => getText(name, r.data) === value)
|
|
8894
|
+
);
|
|
8895
|
+
if (validRows.some((r) => getText(colName, r.data) === want)) {
|
|
8896
|
+
applied[colName] = want;
|
|
8897
|
+
}
|
|
8898
|
+
}
|
|
8899
|
+
return applied;
|
|
8900
|
+
}
|
|
8901
|
+
|
|
8902
|
+
// src/components/PlacementBlock/PlacementBlock.tsx
|
|
8903
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
8668
8904
|
ModuleRegistry.registerModules([AllCommunityModule]);
|
|
8669
8905
|
var FETCH_LIMIT = 1e3;
|
|
8670
8906
|
function normalizeRows(records) {
|
|
@@ -8701,7 +8937,7 @@ var ColorDotRenderer = (props) => {
|
|
|
8701
8937
|
const { statuses, defaultStatusId } = props;
|
|
8702
8938
|
const status = statuses.find((c) => c.id === item.statusId) || statuses.find((c) => c.id === defaultStatusId) || statuses[0];
|
|
8703
8939
|
if (!status) return null;
|
|
8704
|
-
return /* @__PURE__ */
|
|
8940
|
+
return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsx19(
|
|
8705
8941
|
"button",
|
|
8706
8942
|
{
|
|
8707
8943
|
type: "button",
|
|
@@ -8715,7 +8951,7 @@ var ColorDotRenderer = (props) => {
|
|
|
8715
8951
|
};
|
|
8716
8952
|
var CheckCellRenderer = (props) => {
|
|
8717
8953
|
if (!props.data) return null;
|
|
8718
|
-
return /* @__PURE__ */
|
|
8954
|
+
return /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsx19(
|
|
8719
8955
|
"input",
|
|
8720
8956
|
{
|
|
8721
8957
|
type: "checkbox",
|
|
@@ -8726,7 +8962,7 @@ var CheckCellRenderer = (props) => {
|
|
|
8726
8962
|
}
|
|
8727
8963
|
) });
|
|
8728
8964
|
};
|
|
8729
|
-
var CheckHeader = (props) => /* @__PURE__ */
|
|
8965
|
+
var CheckHeader = (props) => /* @__PURE__ */ jsx19("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ jsx19(
|
|
8730
8966
|
"input",
|
|
8731
8967
|
{
|
|
8732
8968
|
type: "checkbox",
|
|
@@ -8739,23 +8975,48 @@ var CheckHeader = (props) => /* @__PURE__ */ jsx18("div", { className: "flex ite
|
|
|
8739
8975
|
"aria-label": "\u05D1\u05D7\u05D9\u05E8\u05EA \u05DB\u05DC \u05D4\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD"
|
|
8740
8976
|
}
|
|
8741
8977
|
) });
|
|
8978
|
+
var RelationFilterHeader = (props) => {
|
|
8979
|
+
const btnRef = useRef14(null);
|
|
8980
|
+
return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center justify-center w-full min-w-0 leading-tight select-none", title: props.displayName, children: [
|
|
8981
|
+
/* @__PURE__ */ jsx19(
|
|
8982
|
+
"button",
|
|
8983
|
+
{
|
|
8984
|
+
ref: btnRef,
|
|
8985
|
+
type: "button",
|
|
8986
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
8987
|
+
onClick: (e) => {
|
|
8988
|
+
var _a;
|
|
8989
|
+
e.stopPropagation();
|
|
8990
|
+
e.preventDefault();
|
|
8991
|
+
const rect = (_a = btnRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
8992
|
+
if (rect) props.onOpen(props.colName, rect);
|
|
8993
|
+
},
|
|
8994
|
+
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"}`,
|
|
8995
|
+
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",
|
|
8996
|
+
"aria-label": `\u05E1\u05D9\u05E0\u05D5\u05DF \u05DC\u05E4\u05D9 ${props.displayName}`,
|
|
8997
|
+
children: /* @__PURE__ */ jsx19(Filter2, { className: "w-3 h-3" })
|
|
8998
|
+
}
|
|
8999
|
+
),
|
|
9000
|
+
/* @__PURE__ */ jsx19("span", { className: "truncate w-full text-center", children: props.displayName })
|
|
9001
|
+
] });
|
|
9002
|
+
};
|
|
8742
9003
|
var PlacementBlock = (props) => {
|
|
8743
9004
|
var _a, _b;
|
|
8744
9005
|
const { executeAction, fetchSourceData, fetchTargetData, updateAssignment, className = "" } = props;
|
|
8745
|
-
const config =
|
|
9006
|
+
const config = useMemo9(() => {
|
|
8746
9007
|
var _a2, _b2, _c;
|
|
8747
9008
|
const raw = (_a2 = props.config) != null ? _a2 : props.settings;
|
|
8748
9009
|
if (!raw) return void 0;
|
|
8749
9010
|
return ((_b2 = raw.config) == null ? void 0 : _b2.sourceTableId) || ((_c = raw.config) == null ? void 0 : _c.targetTableId) ? raw.config : raw;
|
|
8750
9011
|
}, [props.config, props.settings]);
|
|
8751
|
-
const statuses =
|
|
9012
|
+
const statuses = useMemo9(
|
|
8752
9013
|
() => {
|
|
8753
9014
|
var _a2;
|
|
8754
9015
|
return ((_a2 = config == null ? void 0 : config.statusColors) == null ? void 0 : _a2.length) ? config.statusColors : DEFAULT_PLACEMENT_STATUS_COLORS;
|
|
8755
9016
|
},
|
|
8756
9017
|
[config == null ? void 0 : config.statusColors]
|
|
8757
9018
|
);
|
|
8758
|
-
const defaultStatusId =
|
|
9019
|
+
const defaultStatusId = useMemo9(
|
|
8759
9020
|
() => resolveDefaultStatusId(statuses, config == null ? void 0 : config.defaultReturnStatusId),
|
|
8760
9021
|
[statuses, config == null ? void 0 : config.defaultReturnStatusId]
|
|
8761
9022
|
);
|
|
@@ -8763,26 +9024,30 @@ var PlacementBlock = (props) => {
|
|
|
8763
9024
|
const targetTableId = config == null ? void 0 : config.targetTableId;
|
|
8764
9025
|
const displayField = (config == null ? void 0 : config.sourceDisplayFieldId) || "name";
|
|
8765
9026
|
const assignmentField = config == null ? void 0 : config.targetAssignmentFieldId;
|
|
8766
|
-
const executeActionRef =
|
|
9027
|
+
const executeActionRef = useRef14(executeAction);
|
|
8767
9028
|
executeActionRef.current = executeAction;
|
|
8768
|
-
const legacyRef =
|
|
9029
|
+
const legacyRef = useRef14({ fetchSourceData, fetchTargetData, updateAssignment });
|
|
8769
9030
|
legacyRef.current = { fetchSourceData, fetchTargetData, updateAssignment };
|
|
8770
|
-
const [sourceRows, setSourceRows] =
|
|
8771
|
-
const [sourceColumns, setSourceColumns] =
|
|
8772
|
-
const [
|
|
8773
|
-
const [
|
|
8774
|
-
const [
|
|
8775
|
-
const [
|
|
8776
|
-
const [
|
|
8777
|
-
const [
|
|
8778
|
-
const [
|
|
8779
|
-
const [
|
|
8780
|
-
const [
|
|
8781
|
-
const [
|
|
8782
|
-
const [
|
|
8783
|
-
const [
|
|
8784
|
-
const [
|
|
8785
|
-
const [
|
|
9031
|
+
const [sourceRows, setSourceRows] = useState16([]);
|
|
9032
|
+
const [sourceColumns, setSourceColumns] = useState16([]);
|
|
9033
|
+
const [sourceRelOptions, setSourceRelOptions] = useState16({});
|
|
9034
|
+
const [sourceRelFilters, setSourceRelFilters] = useState16({});
|
|
9035
|
+
const [targetRows, setTargetRows] = useState16([]);
|
|
9036
|
+
const [targetColumns, setTargetColumns] = useState16([]);
|
|
9037
|
+
const [targetRelOptions, setTargetRelOptions] = useState16({});
|
|
9038
|
+
const [selectedTargetId, setSelectedTargetId] = useState16("");
|
|
9039
|
+
const [candidateIds, setCandidateIds] = useState16([]);
|
|
9040
|
+
const [checkedIds, setCheckedIds] = useState16([]);
|
|
9041
|
+
const [isSaving, setIsSaving] = useState16(false);
|
|
9042
|
+
const [sourceSearch, setSourceSearch] = useState16("");
|
|
9043
|
+
const [candidateSearch, setCandidateSearch] = useState16("");
|
|
9044
|
+
const [statusMap, setStatusMap] = useState16({});
|
|
9045
|
+
const [isLoading, setIsLoading] = useState16(false);
|
|
9046
|
+
const [loadError, setLoadError] = useState16(null);
|
|
9047
|
+
const [saveError, setSaveError] = useState16(null);
|
|
9048
|
+
const [colFilters, setColFilters] = useState16({ source: {}, cand: {} });
|
|
9049
|
+
const [filterPopover, setFilterPopover] = useState16(null);
|
|
9050
|
+
const [targetFilters, setTargetFilters] = useState16({});
|
|
8786
9051
|
const loadTable = useCallback13(async (tableId, kind) => {
|
|
8787
9052
|
const exec = executeActionRef.current;
|
|
8788
9053
|
if (exec) {
|
|
@@ -8796,7 +9061,7 @@ var PlacementBlock = (props) => {
|
|
|
8796
9061
|
}
|
|
8797
9062
|
throw new Error("executeAction \u05DC\u05D0 \u05D4\u05D5\u05E2\u05D1\u05E8 \u05DC\u05E8\u05DB\u05D9\u05D1 \u05D4\u05E9\u05D9\u05D1\u05D5\u05E5");
|
|
8798
9063
|
}, []);
|
|
8799
|
-
|
|
9064
|
+
useEffect14(() => {
|
|
8800
9065
|
if (!sourceTableId || !targetTableId) return;
|
|
8801
9066
|
let cancelled = false;
|
|
8802
9067
|
(async () => {
|
|
@@ -8810,6 +9075,7 @@ var PlacementBlock = (props) => {
|
|
|
8810
9075
|
if (cancelled) return;
|
|
8811
9076
|
setSourceRows(src.rows);
|
|
8812
9077
|
setSourceColumns(src.columns);
|
|
9078
|
+
setSourceRelOptions(src.relationOptions || {});
|
|
8813
9079
|
setTargetRows(tgt.rows);
|
|
8814
9080
|
setTargetColumns(tgt.columns);
|
|
8815
9081
|
setTargetRelOptions(tgt.relationOptions || {});
|
|
@@ -8843,7 +9109,50 @@ var PlacementBlock = (props) => {
|
|
|
8843
9109
|
}
|
|
8844
9110
|
return text2;
|
|
8845
9111
|
}, [targetRelOptions, targetRows, sourceRows]);
|
|
8846
|
-
const
|
|
9112
|
+
const relationLabelMaps = useMemo9(() => {
|
|
9113
|
+
const maps = {};
|
|
9114
|
+
Object.entries(sourceRelOptions || {}).forEach(([colName, opts]) => {
|
|
9115
|
+
const m = /* @__PURE__ */ new Map();
|
|
9116
|
+
(opts || []).forEach((o) => {
|
|
9117
|
+
var _a2, _b2, _c;
|
|
9118
|
+
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);
|
|
9119
|
+
if (label) m.set(String((_c = o.id) != null ? _c : o._id), label);
|
|
9120
|
+
});
|
|
9121
|
+
maps[colName] = m;
|
|
9122
|
+
});
|
|
9123
|
+
return maps;
|
|
9124
|
+
}, [sourceRelOptions]);
|
|
9125
|
+
const relationLabelsOf = useCallback13((row, colName) => {
|
|
9126
|
+
var _a2;
|
|
9127
|
+
const map = relationLabelMaps[colName];
|
|
9128
|
+
const ids = normalizeRelationValue((_a2 = row.data) == null ? void 0 : _a2[colName]);
|
|
9129
|
+
const labels = map ? ids.map((id) => map.get(String(id))).filter((l) => !!l) : [];
|
|
9130
|
+
if (labels.length) return labels;
|
|
9131
|
+
const txt = cellText(readColumnValue(row.data, colName));
|
|
9132
|
+
return txt && !/^[a-fA-F0-9]{24}$/.test(txt) ? txt.split(", ").filter(Boolean) : [];
|
|
9133
|
+
}, [relationLabelMaps]);
|
|
9134
|
+
const rowPassesColFilters = useCallback13((row, filters) => {
|
|
9135
|
+
return Object.entries(filters).every(([colName, f]) => {
|
|
9136
|
+
if (!f) return true;
|
|
9137
|
+
const labels = relationLabelsOf(row, colName);
|
|
9138
|
+
if (Array.isArray(f)) return f.length === 0 || labels.some((l) => f.includes(l));
|
|
9139
|
+
if (f.operator === "notIn") return !labels.some((l) => f.values.includes(l));
|
|
9140
|
+
return true;
|
|
9141
|
+
});
|
|
9142
|
+
}, [relationLabelsOf]);
|
|
9143
|
+
const setColFilter = useCallback13((grid, colName, payload) => {
|
|
9144
|
+
setColFilters((prev) => {
|
|
9145
|
+
const next = __spreadValues({}, prev[grid]);
|
|
9146
|
+
if (payload === void 0) delete next[colName];
|
|
9147
|
+
else next[colName] = payload;
|
|
9148
|
+
return __spreadProps(__spreadValues({}, prev), { [grid]: next });
|
|
9149
|
+
});
|
|
9150
|
+
}, []);
|
|
9151
|
+
const openColFilter = useCallback13((grid, colName, rect) => {
|
|
9152
|
+
setFilterPopover((cur) => cur && cur.grid === grid && cur.colName === colName ? null : { grid, colName, rect });
|
|
9153
|
+
}, []);
|
|
9154
|
+
const closeColFilter = useCallback13(() => setFilterPopover(null), []);
|
|
9155
|
+
const filterColumns = useMemo9(() => {
|
|
8847
9156
|
const definedFilters = (config == null ? void 0 : config.filterFields) || [];
|
|
8848
9157
|
const legacyFilters = [config == null ? void 0 : config.targetFilterField1Id, config == null ? void 0 : config.targetFilterField2Id].filter(Boolean);
|
|
8849
9158
|
const fieldsToUse = definedFilters.length > 0 ? definedFilters : legacyFilters;
|
|
@@ -8869,7 +9178,7 @@ var PlacementBlock = (props) => {
|
|
|
8869
9178
|
return targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)).slice(0, 3);
|
|
8870
9179
|
}, [targetColumns, assignmentField, config]);
|
|
8871
9180
|
const rawSelectorField = (config == null ? void 0 : config.targetSelectorFieldId) || (config == null ? void 0 : config.targetDisplayFieldId) || ((_a = filterColumns[0]) == null ? void 0 : _a.name) || "";
|
|
8872
|
-
const selectorField =
|
|
9181
|
+
const selectorField = useMemo9(() => {
|
|
8873
9182
|
const { relationColumn } = parseColumnRef(rawSelectorField);
|
|
8874
9183
|
if (relationColumn && !targetColumns.some((c) => c.name === rawSelectorField) && targetColumns.some((c) => {
|
|
8875
9184
|
var _a2;
|
|
@@ -8879,7 +9188,7 @@ var PlacementBlock = (props) => {
|
|
|
8879
9188
|
}
|
|
8880
9189
|
return rawSelectorField;
|
|
8881
9190
|
}, [rawSelectorField, targetColumns]);
|
|
8882
|
-
const filteredTargetRows =
|
|
9191
|
+
const filteredTargetRows = useMemo9(() => {
|
|
8883
9192
|
return targetRows.filter((r) => {
|
|
8884
9193
|
return filterColumns.every((col) => {
|
|
8885
9194
|
const filterVal = targetFilters[col.name];
|
|
@@ -8888,7 +9197,7 @@ var PlacementBlock = (props) => {
|
|
|
8888
9197
|
});
|
|
8889
9198
|
});
|
|
8890
9199
|
}, [targetRows, targetFilters, filterColumns, displayValue]);
|
|
8891
|
-
|
|
9200
|
+
useEffect14(() => {
|
|
8892
9201
|
if (filteredTargetRows.length > 0) {
|
|
8893
9202
|
if (!selectedTargetId || !filteredTargetRows.some((r) => r.id === selectedTargetId)) {
|
|
8894
9203
|
setSelectedTargetId(filteredTargetRows[0].id);
|
|
@@ -8897,11 +9206,27 @@ var PlacementBlock = (props) => {
|
|
|
8897
9206
|
setSelectedTargetId("");
|
|
8898
9207
|
}
|
|
8899
9208
|
}, [filteredTargetRows, selectedTargetId]);
|
|
8900
|
-
const
|
|
9209
|
+
const appliedDefaultsKeyRef = useRef14("");
|
|
9210
|
+
useEffect14(() => {
|
|
9211
|
+
const defaults = config == null ? void 0 : config.targetFilterDefaults;
|
|
9212
|
+
if (isLoading || !defaults || targetRows.length === 0 || targetColumns.length === 0) return;
|
|
9213
|
+
const key = `${targetTableId}|${JSON.stringify(defaults)}`;
|
|
9214
|
+
if (appliedDefaultsKeyRef.current === key) return;
|
|
9215
|
+
appliedDefaultsKeyRef.current = key;
|
|
9216
|
+
const resolved = computePlacementDefaultFilters({
|
|
9217
|
+
refs: getPlacementFilterRefs(config),
|
|
9218
|
+
defaults,
|
|
9219
|
+
targetColumns,
|
|
9220
|
+
rows: targetRows,
|
|
9221
|
+
getText: (colName, data) => displayValue(targetColumns.find((c) => c.name === colName) || { name: colName }, readColumnValue(data, colName))
|
|
9222
|
+
});
|
|
9223
|
+
if (Object.keys(resolved).length > 0) setTargetFilters((prev) => __spreadValues(__spreadValues({}, resolved), prev));
|
|
9224
|
+
}, [config, isLoading, targetRows, targetColumns, targetTableId, displayValue]);
|
|
9225
|
+
const assignmentColumn = useMemo9(() => targetColumns.find((c) => c.name === assignmentField), [targetColumns, assignmentField]);
|
|
8901
9226
|
const isRelationField = ((_b = assignmentColumn == null ? void 0 : assignmentColumn.type) == null ? void 0 : _b.toUpperCase()) === "RELATION";
|
|
8902
9227
|
const assignmentLabel = (assignmentColumn == null ? void 0 : assignmentColumn.label) || (assignmentColumn == null ? void 0 : assignmentColumn.name) || assignmentField || "";
|
|
8903
9228
|
const nameOf = useCallback13((row) => cellText(readColumnValue(row.data, displayField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD", [displayField]);
|
|
8904
|
-
const assignedIds =
|
|
9229
|
+
const assignedIds = useMemo9(() => {
|
|
8905
9230
|
var _a2;
|
|
8906
9231
|
const target = targetRows.find((r) => r.id === selectedTargetId);
|
|
8907
9232
|
if (!target || !assignmentField) return [];
|
|
@@ -8915,21 +9240,35 @@ var PlacementBlock = (props) => {
|
|
|
8915
9240
|
}).filter((id) => !!id && sourceRows.some((s) => s.id === id));
|
|
8916
9241
|
return Array.from(new Set(ids));
|
|
8917
9242
|
}, [selectedTargetId, targetRows, sourceRows, assignmentField, isRelationField, nameOf]);
|
|
8918
|
-
const assignedIdsRef =
|
|
9243
|
+
const assignedIdsRef = useRef14(assignedIds);
|
|
8919
9244
|
assignedIdsRef.current = assignedIds;
|
|
8920
|
-
|
|
9245
|
+
useEffect14(() => {
|
|
8921
9246
|
setCandidateIds(assignedIdsRef.current);
|
|
8922
9247
|
setCheckedIds(assignedIdsRef.current);
|
|
8923
9248
|
}, [selectedTargetId, sourceRows]);
|
|
8924
9249
|
const toGridRow = useCallback13((r, checked = false) => __spreadProps(__spreadValues({}, r.data), { id: r.id, __label: nameOf(r), __checked: checked, statusId: statusMap[r.id] || defaultStatusId }), [nameOf, statusMap, defaultStatusId]);
|
|
8925
|
-
const
|
|
9250
|
+
const candidateRows = useMemo9(() => candidateIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r), [candidateIds, sourceRows]);
|
|
9251
|
+
const candidateGridData = useMemo9(() => {
|
|
8926
9252
|
const checked = new Set(checkedIds);
|
|
8927
|
-
return
|
|
8928
|
-
}, [
|
|
8929
|
-
const
|
|
9253
|
+
return candidateRows.filter((r) => rowPassesColFilters(r, colFilters.cand)).map((r) => toGridRow(r, checked.has(r.id)));
|
|
9254
|
+
}, [candidateRows, checkedIds, toGridRow, rowPassesColFilters, colFilters.cand]);
|
|
9255
|
+
const availableRows = useMemo9(() => {
|
|
8930
9256
|
const set = new Set(candidateIds);
|
|
8931
|
-
return sourceRows.filter((r) => !set.has(r.id))
|
|
8932
|
-
}, [candidateIds, sourceRows
|
|
9257
|
+
return sourceRows.filter((r) => !set.has(r.id));
|
|
9258
|
+
}, [candidateIds, sourceRows]);
|
|
9259
|
+
const relationButtonColumns = useMemo9(() => {
|
|
9260
|
+
const wanted = Array.isArray(config == null ? void 0 : config.relationButtonColumns) ? config.relationButtonColumns : [];
|
|
9261
|
+
return wanted.filter((name) => sourceColumns.some((c) => (c == null ? void 0 : c.name) === name && String(c == null ? void 0 : c.type).toUpperCase() === "RELATION"));
|
|
9262
|
+
}, [config, sourceColumns]);
|
|
9263
|
+
const hasRelationButtons = relationButtonColumns.length > 0;
|
|
9264
|
+
const handleRelationFilterChange = useCallback13((colName, id) => {
|
|
9265
|
+
setSourceRelFilters((prev) => __spreadProps(__spreadValues({}, prev), { [colName]: id }));
|
|
9266
|
+
}, []);
|
|
9267
|
+
const availableGridData = useMemo9(() => {
|
|
9268
|
+
const active = Object.entries(sourceRelFilters).filter(([name, v]) => !!v && relationButtonColumns.includes(name));
|
|
9269
|
+
const byButtons = active.length === 0 ? availableRows : availableRows.filter((r) => active.every(([name, v]) => rowMatchesRelationFilter(r, name, v)));
|
|
9270
|
+
return byButtons.filter((r) => rowPassesColFilters(r, colFilters.source)).map((r) => toGridRow(r));
|
|
9271
|
+
}, [availableRows, sourceRelFilters, relationButtonColumns, toGridRow, rowPassesColFilters, colFilters.source]);
|
|
8933
9272
|
const persistAssignment = useCallback13(async (nextIds) => {
|
|
8934
9273
|
const exec = executeActionRef.current;
|
|
8935
9274
|
if (exec && targetTableId && assignmentField && selectedTargetId) {
|
|
@@ -8950,9 +9289,9 @@ var PlacementBlock = (props) => {
|
|
|
8950
9289
|
setCheckedIds((prev) => prev.filter((x) => x !== id));
|
|
8951
9290
|
setStatusMap((prev) => __spreadProps(__spreadValues({}, prev), { [id]: defaultStatusId }));
|
|
8952
9291
|
}, [defaultStatusId]);
|
|
8953
|
-
const moveToCandidatesRef =
|
|
9292
|
+
const moveToCandidatesRef = useRef14(moveToCandidates);
|
|
8954
9293
|
moveToCandidatesRef.current = moveToCandidates;
|
|
8955
|
-
const moveToSourceRef =
|
|
9294
|
+
const moveToSourceRef = useRef14(moveToSource);
|
|
8956
9295
|
moveToSourceRef.current = moveToSource;
|
|
8957
9296
|
const toggleChecked = useCallback13((id) => {
|
|
8958
9297
|
setCheckedIds((prev) => prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]);
|
|
@@ -8966,7 +9305,7 @@ var PlacementBlock = (props) => {
|
|
|
8966
9305
|
setCandidateIds([]);
|
|
8967
9306
|
setCheckedIds([]);
|
|
8968
9307
|
}, []);
|
|
8969
|
-
const checkedCandidates =
|
|
9308
|
+
const checkedCandidates = useMemo9(() => candidateIds.filter((id) => checkedIds.includes(id)), [candidateIds, checkedIds]);
|
|
8970
9309
|
const isDirty = checkedCandidates.length !== assignedIds.length || checkedCandidates.some((id) => !assignedIds.includes(id));
|
|
8971
9310
|
const submitAssignment = useCallback13(async () => {
|
|
8972
9311
|
if (!selectedTargetId) {
|
|
@@ -9007,7 +9346,8 @@ var PlacementBlock = (props) => {
|
|
|
9007
9346
|
setIsSaving(false);
|
|
9008
9347
|
}
|
|
9009
9348
|
}, [selectedTargetId, assignedIds, assignmentLabel, persistAssignment]);
|
|
9010
|
-
const makeColDefs = useCallback13((columns, fallbackName, withCheckbox = false) => {
|
|
9349
|
+
const makeColDefs = useCallback13((columns, fallbackName, grid, withCheckbox = false) => {
|
|
9350
|
+
const gridFilters = colFilters[grid];
|
|
9011
9351
|
const defs = [];
|
|
9012
9352
|
if (withCheckbox) {
|
|
9013
9353
|
defs.push({
|
|
@@ -9037,21 +9377,50 @@ var PlacementBlock = (props) => {
|
|
|
9037
9377
|
var _a2;
|
|
9038
9378
|
return (_a2 = p.data) == null ? void 0 : _a2[displayField];
|
|
9039
9379
|
}, valueFormatter: (p) => cellText(p.value), getQuickFilterText: (p) => cellText(p.value), rowDrag: true, flex: 1, minWidth: 120 });
|
|
9040
|
-
ordered.forEach((c, i) =>
|
|
9380
|
+
ordered.forEach((c, i) => {
|
|
9381
|
+
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 };
|
|
9382
|
+
if (String(c.type).toUpperCase() === "RELATION") {
|
|
9383
|
+
def.headerComponent = RelationFilterHeader;
|
|
9384
|
+
def.headerComponentParams = { colName: c.name, active: !!gridFilters[c.name], onOpen: (name, rect) => openColFilter(grid, name, rect) };
|
|
9385
|
+
}
|
|
9386
|
+
defs.push(def);
|
|
9387
|
+
});
|
|
9041
9388
|
} else {
|
|
9042
9389
|
defs.push({ field: "__label", headerName: fallbackName, rowDrag: true, flex: 1 });
|
|
9043
9390
|
}
|
|
9044
9391
|
return defs;
|
|
9045
|
-
}, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked]);
|
|
9392
|
+
}, [cycleStatus, statuses, defaultStatusId, displayField, displayValue, toggleChecked, toggleAll, allChecked, someChecked, colFilters, openColFilter]);
|
|
9046
9393
|
const sourceHeader = displayField === "name" ? "\u05E9\u05DD" : columnRefLabel(displayField);
|
|
9047
|
-
const sourceColDefs =
|
|
9048
|
-
const candidateColDefs =
|
|
9394
|
+
const sourceColDefs = useMemo9(() => makeColDefs(sourceColumns, sourceHeader, "source"), [makeColDefs, sourceColumns, sourceHeader]);
|
|
9395
|
+
const candidateColDefs = useMemo9(() => makeColDefs(sourceColumns, sourceHeader, "cand", true), [makeColDefs, sourceColumns, sourceHeader]);
|
|
9396
|
+
const defaultColDef = useMemo9(() => ({ resizable: true }), []);
|
|
9397
|
+
const scrollableColIds = (defs) => defs.filter((d) => !d.pinned).map((d) => {
|
|
9398
|
+
var _a2;
|
|
9399
|
+
return (_a2 = d.colId) != null ? _a2 : d.field;
|
|
9400
|
+
}).filter(Boolean);
|
|
9401
|
+
const expandColumns = useCallback13((api) => {
|
|
9402
|
+
api == null ? void 0 : api.sizeColumnsToFit();
|
|
9403
|
+
}, []);
|
|
9404
|
+
const shrinkColumns = useCallback13((api, defs) => {
|
|
9405
|
+
api == null ? void 0 : api.autoSizeColumns(scrollableColIds(defs));
|
|
9406
|
+
}, []);
|
|
9407
|
+
const popoverOptions = useMemo9(() => {
|
|
9408
|
+
if (!filterPopover) return [];
|
|
9409
|
+
const rows = filterPopover.grid === "source" ? availableRows : candidateRows;
|
|
9410
|
+
const set = /* @__PURE__ */ new Set();
|
|
9411
|
+
rows.forEach((r) => relationLabelsOf(r, filterPopover.colName).forEach((l) => set.add(l)));
|
|
9412
|
+
return Array.from(set).sort((a, b) => a.localeCompare(b, "he")).map((label) => ({ id: label, label }));
|
|
9413
|
+
}, [filterPopover, availableRows, candidateRows, relationLabelsOf]);
|
|
9414
|
+
const popoverColumn = useMemo9(
|
|
9415
|
+
() => filterPopover ? sourceColumns.find((c) => c.name === filterPopover.colName) : void 0,
|
|
9416
|
+
[filterPopover, sourceColumns]
|
|
9417
|
+
);
|
|
9049
9418
|
const getRowId = useCallback13((p) => p.data.id, []);
|
|
9050
|
-
const sourceContainerRef =
|
|
9051
|
-
const assignedContainerRef =
|
|
9052
|
-
const [sourceApi, setSourceApi] =
|
|
9053
|
-
const [assignedApi, setAssignedApi] =
|
|
9054
|
-
|
|
9419
|
+
const sourceContainerRef = useRef14(null);
|
|
9420
|
+
const assignedContainerRef = useRef14(null);
|
|
9421
|
+
const [sourceApi, setSourceApi] = useState16(null);
|
|
9422
|
+
const [assignedApi, setAssignedApi] = useState16(null);
|
|
9423
|
+
useEffect14(() => {
|
|
9055
9424
|
if (!sourceApi || !assignedApi) return;
|
|
9056
9425
|
const toAssigned = { getContainer: () => assignedContainerRef.current, onDragStop: (p) => {
|
|
9057
9426
|
var _a2, _b2;
|
|
@@ -9074,11 +9443,11 @@ var PlacementBlock = (props) => {
|
|
|
9074
9443
|
}
|
|
9075
9444
|
};
|
|
9076
9445
|
}, [sourceApi, assignedApi]);
|
|
9077
|
-
const selectorLabel =
|
|
9446
|
+
const selectorLabel = useMemo9(() => {
|
|
9078
9447
|
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
9079
9448
|
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";
|
|
9080
9449
|
}, [targetColumns, selectorField]);
|
|
9081
|
-
const assignedText =
|
|
9450
|
+
const assignedText = useMemo9(
|
|
9082
9451
|
() => assignedIds.map((id) => sourceRows.find((r) => r.id === id)).filter((r) => !!r).map(nameOf).join(", "),
|
|
9083
9452
|
[assignedIds, sourceRows, nameOf]
|
|
9084
9453
|
);
|
|
@@ -9087,48 +9456,48 @@ var PlacementBlock = (props) => {
|
|
|
9087
9456
|
const col = targetColumns.find((c) => c.name === selectorField || c.id === selectorField);
|
|
9088
9457
|
return displayValue(col || { name: selectorField }, readColumnValue(r.data, selectorField)) || "\u05DC\u05DC\u05D0 \u05E9\u05DD";
|
|
9089
9458
|
}, [selectorField, targetColumns, displayValue]);
|
|
9090
|
-
const previewColumns =
|
|
9459
|
+
const previewColumns = useMemo9(() => targetColumns.filter((c) => isUserColumn(c) && c.name !== assignmentField && !["id", "_id", "id_", "statusId"].includes(c.name)), [targetColumns, assignmentField]);
|
|
9091
9460
|
if (!config || !sourceTableId || !targetTableId) {
|
|
9092
|
-
return /* @__PURE__ */
|
|
9461
|
+
return /* @__PURE__ */ jsx19("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)." });
|
|
9093
9462
|
}
|
|
9094
9463
|
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";
|
|
9095
9464
|
const labelClass = "block text-[11px] font-semibold text-slate-500 mb-1";
|
|
9096
|
-
return /* @__PURE__ */
|
|
9097
|
-
(loadError || saveError) && /* @__PURE__ */
|
|
9098
|
-
/* @__PURE__ */
|
|
9099
|
-
/* @__PURE__ */
|
|
9100
|
-
/* @__PURE__ */
|
|
9101
|
-
/* @__PURE__ */
|
|
9465
|
+
return /* @__PURE__ */ jsxs16("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: [
|
|
9466
|
+
(loadError || saveError) && /* @__PURE__ */ jsx19("div", { className: "p-3 text-xs rounded-lg bg-rose-50 border border-rose-200 text-rose-700", children: loadError || saveError }),
|
|
9467
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col lg:flex-row gap-4", children: [
|
|
9468
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
9469
|
+
/* @__PURE__ */ jsxs16("h4", { className: "font-bold text-teal-900 border-b border-teal-200 pb-2 mb-3 text-base flex items-center gap-2", children: [
|
|
9470
|
+
/* @__PURE__ */ jsx19("span", { children: "\u{1F4CC}" }),
|
|
9102
9471
|
" \u05E4\u05E8\u05D8\u05D9 \u05D4\u05D9\u05E2\u05D3 \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5"
|
|
9103
9472
|
] }),
|
|
9104
|
-
activeTarget ? /* @__PURE__ */
|
|
9105
|
-
/* @__PURE__ */
|
|
9473
|
+
activeTarget ? /* @__PURE__ */ jsxs16("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: [
|
|
9474
|
+
/* @__PURE__ */ jsx19("div", { className: "col-span-full font-bold text-slate-900 text-lg mb-1", children: targetLabel(activeTarget) }),
|
|
9106
9475
|
previewColumns.map((col) => ({ col, text: displayValue(col, readColumnValue(activeTarget.data, col.name)) })).filter(({ col, text: text2 }) => {
|
|
9107
9476
|
var _a2;
|
|
9108
9477
|
return text2 && (col.type === "RELATION" || typeof ((_a2 = activeTarget.data) == null ? void 0 : _a2[col.name]) !== "object");
|
|
9109
|
-
}).map(({ col, text: text2 }) => /* @__PURE__ */
|
|
9110
|
-
/* @__PURE__ */
|
|
9478
|
+
}).map(({ col, text: text2 }) => /* @__PURE__ */ jsxs16("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: [
|
|
9479
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-semibold shrink-0", children: [
|
|
9111
9480
|
col.label || col.name,
|
|
9112
9481
|
":"
|
|
9113
9482
|
] }),
|
|
9114
|
-
/* @__PURE__ */
|
|
9483
|
+
/* @__PURE__ */ jsx19("span", { className: "break-words", children: text2 })
|
|
9115
9484
|
] }, col.name)),
|
|
9116
|
-
assignmentField && assignedText && /* @__PURE__ */
|
|
9117
|
-
/* @__PURE__ */
|
|
9485
|
+
assignmentField && assignedText && /* @__PURE__ */ jsxs16("div", { className: "flex gap-2 items-start", children: [
|
|
9486
|
+
/* @__PURE__ */ jsxs16("span", { className: "font-semibold shrink-0", children: [
|
|
9118
9487
|
assignmentLabel,
|
|
9119
9488
|
":"
|
|
9120
9489
|
] }),
|
|
9121
|
-
/* @__PURE__ */
|
|
9490
|
+
/* @__PURE__ */ jsx19("span", { className: "break-words", title: assignedText, children: assignedText })
|
|
9122
9491
|
] }),
|
|
9123
|
-
/* @__PURE__ */
|
|
9492
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
9124
9493
|
"\u05DE\u05E9\u05D5\u05D1\u05E6\u05D9\u05DD \u05DB\u05E8\u05D2\u05E2: ",
|
|
9125
9494
|
assignedIds.length
|
|
9126
9495
|
] })
|
|
9127
|
-
] }) : /* @__PURE__ */
|
|
9496
|
+
] }) : /* @__PURE__ */ jsx19("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." })
|
|
9128
9497
|
] }),
|
|
9129
|
-
/* @__PURE__ */
|
|
9130
|
-
/* @__PURE__ */
|
|
9131
|
-
/* @__PURE__ */
|
|
9498
|
+
/* @__PURE__ */ jsx19("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__ */ jsxs16("div", { children: [
|
|
9499
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9500
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col sm:flex-row gap-3", children: [
|
|
9132
9501
|
filterColumns.map((col, index) => {
|
|
9133
9502
|
const previousColumns = filterColumns.slice(0, index);
|
|
9134
9503
|
const validRowsForThisFilter = targetRows.filter((r) => {
|
|
@@ -9141,9 +9510,9 @@ var PlacementBlock = (props) => {
|
|
|
9141
9510
|
const uniqueValues = Array.from(new Set(
|
|
9142
9511
|
validRowsForThisFilter.map((r) => displayValue(col, readColumnValue(r.data, col.name)))
|
|
9143
9512
|
)).filter(Boolean).sort((a, b) => a.localeCompare(b, "he"));
|
|
9144
|
-
return /* @__PURE__ */
|
|
9145
|
-
/* @__PURE__ */
|
|
9146
|
-
/* @__PURE__ */
|
|
9513
|
+
return /* @__PURE__ */ jsxs16("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
9514
|
+
/* @__PURE__ */ jsx19("label", { className: labelClass, children: col.label || columnRefLabel(col.name) }),
|
|
9515
|
+
/* @__PURE__ */ jsxs16(
|
|
9147
9516
|
"select",
|
|
9148
9517
|
{
|
|
9149
9518
|
className: selectClass,
|
|
@@ -9159,64 +9528,93 @@ var PlacementBlock = (props) => {
|
|
|
9159
9528
|
});
|
|
9160
9529
|
},
|
|
9161
9530
|
children: [
|
|
9162
|
-
/* @__PURE__ */
|
|
9163
|
-
uniqueValues.map((v) => /* @__PURE__ */
|
|
9531
|
+
/* @__PURE__ */ jsx19("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
9532
|
+
uniqueValues.map((v) => /* @__PURE__ */ jsx19("option", { value: v, children: v }, v))
|
|
9164
9533
|
]
|
|
9165
9534
|
}
|
|
9166
9535
|
)
|
|
9167
9536
|
] }, col.name);
|
|
9168
9537
|
}),
|
|
9169
|
-
/* @__PURE__ */
|
|
9170
|
-
/* @__PURE__ */
|
|
9171
|
-
/* @__PURE__ */
|
|
9172
|
-
/* @__PURE__ */
|
|
9538
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 basis-0 min-w-0", children: [
|
|
9539
|
+
/* @__PURE__ */ jsx19("label", { className: labelClass, children: selectorLabel }),
|
|
9540
|
+
/* @__PURE__ */ jsxs16("select", { className: selectClass, value: selectedTargetId, onChange: (e) => setSelectedTargetId(e.target.value), children: [
|
|
9541
|
+
/* @__PURE__ */ jsxs16("option", { value: "", children: [
|
|
9173
9542
|
"-- \u05D1\u05D7\u05E8 \u05DE\u05EA\u05D5\u05DA ",
|
|
9174
9543
|
filteredTargetRows.length,
|
|
9175
9544
|
" \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA --"
|
|
9176
9545
|
] }),
|
|
9177
|
-
filteredTargetRows.map((r) => /* @__PURE__ */
|
|
9546
|
+
filteredTargetRows.map((r) => /* @__PURE__ */ jsx19("option", { value: r.id, children: targetLabel(r) }, r.id))
|
|
9178
9547
|
] })
|
|
9179
9548
|
] })
|
|
9180
|
-
] })
|
|
9549
|
+
] }),
|
|
9550
|
+
hasRelationButtons && /* @__PURE__ */ jsx19(
|
|
9551
|
+
PlacementRelationButtons,
|
|
9552
|
+
{
|
|
9553
|
+
className: "mt-4 pb-24",
|
|
9554
|
+
columnNames: relationButtonColumns,
|
|
9555
|
+
rows: availableRows,
|
|
9556
|
+
filters: sourceRelFilters,
|
|
9557
|
+
onFilterChange: handleRelationFilterChange,
|
|
9558
|
+
relationOptions: sourceRelOptions
|
|
9559
|
+
}
|
|
9560
|
+
)
|
|
9181
9561
|
] }) })
|
|
9182
9562
|
] }),
|
|
9183
|
-
/* @__PURE__ */
|
|
9184
|
-
/* @__PURE__ */
|
|
9185
|
-
/* @__PURE__ */
|
|
9186
|
-
/* @__PURE__ */
|
|
9187
|
-
/* @__PURE__ */
|
|
9563
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col lg:flex-row w-full gap-4 h-[550px]", children: [
|
|
9564
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
9565
|
+
/* @__PURE__ */ jsxs16("div", { className: "bg-slate-100 p-3 border-b border-slate-200 flex flex-col gap-2", children: [
|
|
9566
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex justify-between items-center font-bold text-slate-800 text-sm", children: [
|
|
9567
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
9188
9568
|
"\u05E8\u05E9\u05D9\u05DE\u05EA \u05DE\u05E7\u05D5\u05E8 (",
|
|
9189
9569
|
availableGridData.length,
|
|
9190
9570
|
")"
|
|
9191
9571
|
] }),
|
|
9192
|
-
/* @__PURE__ */
|
|
9572
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
9573
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9574
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9575
|
+
/* @__PURE__ */ jsx19("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" })
|
|
9576
|
+
] })
|
|
9193
9577
|
] }),
|
|
9194
|
-
/* @__PURE__ */
|
|
9578
|
+
/* @__PURE__ */ jsx19("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" })
|
|
9195
9579
|
] }),
|
|
9196
|
-
/* @__PURE__ */
|
|
9580
|
+
/* @__PURE__ */ jsx19("div", { ref: sourceContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ jsx19(AgGridReact, { rowData: availableGridData, columnDefs: sourceColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: sourceSearch, onGridReady: (e) => setSourceApi(e.api), loading: isLoading }) })
|
|
9197
9581
|
] }),
|
|
9198
|
-
/* @__PURE__ */
|
|
9199
|
-
/* @__PURE__ */
|
|
9200
|
-
/* @__PURE__ */
|
|
9201
|
-
/* @__PURE__ */
|
|
9202
|
-
/* @__PURE__ */
|
|
9582
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
9583
|
+
/* @__PURE__ */ jsxs16("div", { className: "bg-blue-50/80 p-3 border-b border-blue-100 flex flex-col gap-2", children: [
|
|
9584
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap justify-between items-center gap-2", children: [
|
|
9585
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 font-bold text-blue-900 text-sm", children: [
|
|
9586
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
9203
9587
|
"\u05DE\u05D5\u05E2\u05DE\u05D3\u05D9\u05DD \u05DC\u05E9\u05D9\u05D1\u05D5\u05E5 (",
|
|
9204
9588
|
candidateGridData.length,
|
|
9205
9589
|
")"
|
|
9206
9590
|
] }),
|
|
9207
|
-
/* @__PURE__ */
|
|
9591
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9592
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9593
|
+
/* @__PURE__ */ jsx19("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" })
|
|
9208
9594
|
] }),
|
|
9209
|
-
/* @__PURE__ */
|
|
9210
|
-
/* @__PURE__ */
|
|
9211
|
-
/* @__PURE__ */
|
|
9212
|
-
/* @__PURE__ */
|
|
9595
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
9596
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9597
|
+
/* @__PURE__ */ jsx19("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" }),
|
|
9598
|
+
/* @__PURE__ */ jsx19("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" })
|
|
9213
9599
|
] })
|
|
9214
9600
|
] }),
|
|
9215
|
-
/* @__PURE__ */
|
|
9601
|
+
/* @__PURE__ */ jsx19("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" })
|
|
9216
9602
|
] }),
|
|
9217
|
-
/* @__PURE__ */
|
|
9603
|
+
/* @__PURE__ */ jsx19("div", { ref: assignedContainerRef, className: "ag-theme-quartz flex-1 w-full h-full", children: /* @__PURE__ */ jsx19(AgGridReact, { rowData: candidateGridData, columnDefs: candidateColDefs, defaultColDef, headerHeight: 56, getRowId, enableRtl: true, rowDragManaged: false, quickFilterText: candidateSearch, onGridReady: (e) => setAssignedApi(e.api), loading: isLoading }) })
|
|
9218
9604
|
] })
|
|
9219
|
-
] })
|
|
9605
|
+
] }),
|
|
9606
|
+
filterPopover && popoverColumn && /* @__PURE__ */ jsx19(
|
|
9607
|
+
RelationFilterPopover,
|
|
9608
|
+
{
|
|
9609
|
+
isOpen: true,
|
|
9610
|
+
onClose: closeColFilter,
|
|
9611
|
+
column: popoverColumn,
|
|
9612
|
+
triggerRect: filterPopover.rect,
|
|
9613
|
+
options: popoverOptions,
|
|
9614
|
+
filterValue: colFilters[filterPopover.grid][filterPopover.colName],
|
|
9615
|
+
onSelectionChange: (payload) => setColFilter(filterPopover.grid, filterPopover.colName, payload)
|
|
9616
|
+
}
|
|
9617
|
+
)
|
|
9220
9618
|
] });
|
|
9221
9619
|
};
|
|
9222
9620
|
|
|
@@ -9225,7 +9623,7 @@ import React20 from "react";
|
|
|
9225
9623
|
import { CheckCircle2 as CheckCircle24, AlertCircle as AlertCircle5, X as X12, Loader2 as Loader28, Phone as Phone4, Send as Send3, Image as ImageIcon3, FileText as FileText4, Video as Video3 } from "lucide-react";
|
|
9226
9624
|
|
|
9227
9625
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
9228
|
-
import { useState as
|
|
9626
|
+
import { useState as useState17, useEffect as useEffect15, useRef as useRef15, useMemo as useMemo10 } from "react";
|
|
9229
9627
|
import {
|
|
9230
9628
|
X as X9,
|
|
9231
9629
|
Plus,
|
|
@@ -9368,7 +9766,7 @@ function readFileAsBase64(file) {
|
|
|
9368
9766
|
}
|
|
9369
9767
|
|
|
9370
9768
|
// src/components/WhatsAppComponent/CreateTemplateModal.tsx
|
|
9371
|
-
import { Fragment as Fragment4, jsx as
|
|
9769
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
9372
9770
|
function CreateTemplateModal({
|
|
9373
9771
|
isOpen,
|
|
9374
9772
|
onClose,
|
|
@@ -9378,26 +9776,26 @@ function CreateTemplateModal({
|
|
|
9378
9776
|
executeAction,
|
|
9379
9777
|
orgId
|
|
9380
9778
|
}) {
|
|
9381
|
-
const [templateName, setTemplateName] =
|
|
9382
|
-
const [language, setLanguage] =
|
|
9383
|
-
const [category, setCategory] =
|
|
9384
|
-
const [bodyText, setBodyText] =
|
|
9385
|
-
const [variableSamples, setVariableSamples] =
|
|
9386
|
-
const [hasFileHeader, setHasFileHeader] =
|
|
9387
|
-
const [selectedFile, setSelectedFile] =
|
|
9388
|
-
const [fileBase64, setFileBase64] =
|
|
9389
|
-
const [buttons, setButtons] =
|
|
9390
|
-
const [isAddButtonOpen, setIsAddButtonOpen] =
|
|
9391
|
-
const addButtonDropdownRef =
|
|
9392
|
-
const [isSubmitting, setIsSubmitting] =
|
|
9393
|
-
const [submittingStep, setSubmittingStep] =
|
|
9394
|
-
const [submitError, setSubmitError] =
|
|
9395
|
-
const [fileError, setFileError] =
|
|
9396
|
-
const textareaRef =
|
|
9397
|
-
const fileInputRef =
|
|
9398
|
-
const emojiPickerRef =
|
|
9399
|
-
const [isEmojiPickerOpen, setIsEmojiPickerOpen] =
|
|
9400
|
-
|
|
9779
|
+
const [templateName, setTemplateName] = useState17("");
|
|
9780
|
+
const [language, setLanguage] = useState17("he");
|
|
9781
|
+
const [category, setCategory] = useState17("MARKETING");
|
|
9782
|
+
const [bodyText, setBodyText] = useState17("");
|
|
9783
|
+
const [variableSamples, setVariableSamples] = useState17({});
|
|
9784
|
+
const [hasFileHeader, setHasFileHeader] = useState17(false);
|
|
9785
|
+
const [selectedFile, setSelectedFile] = useState17(null);
|
|
9786
|
+
const [fileBase64, setFileBase64] = useState17("");
|
|
9787
|
+
const [buttons, setButtons] = useState17([]);
|
|
9788
|
+
const [isAddButtonOpen, setIsAddButtonOpen] = useState17(false);
|
|
9789
|
+
const addButtonDropdownRef = useRef15(null);
|
|
9790
|
+
const [isSubmitting, setIsSubmitting] = useState17(false);
|
|
9791
|
+
const [submittingStep, setSubmittingStep] = useState17("");
|
|
9792
|
+
const [submitError, setSubmitError] = useState17(null);
|
|
9793
|
+
const [fileError, setFileError] = useState17(null);
|
|
9794
|
+
const textareaRef = useRef15(null);
|
|
9795
|
+
const fileInputRef = useRef15(null);
|
|
9796
|
+
const emojiPickerRef = useRef15(null);
|
|
9797
|
+
const [isEmojiPickerOpen, setIsEmojiPickerOpen] = useState17(false);
|
|
9798
|
+
useEffect15(() => {
|
|
9401
9799
|
function handleClickOutside(event) {
|
|
9402
9800
|
if (emojiPickerRef.current && !emojiPickerRef.current.contains(event.target)) {
|
|
9403
9801
|
setIsEmojiPickerOpen(false);
|
|
@@ -9421,7 +9819,7 @@ function CreateTemplateModal({
|
|
|
9421
9819
|
document.removeEventListener("keydown", handleKeyDown2);
|
|
9422
9820
|
};
|
|
9423
9821
|
}, [isEmojiPickerOpen, isAddButtonOpen]);
|
|
9424
|
-
|
|
9822
|
+
useEffect15(() => {
|
|
9425
9823
|
if (isOpen) {
|
|
9426
9824
|
setTemplateName("");
|
|
9427
9825
|
setLanguage("he");
|
|
@@ -9440,10 +9838,10 @@ function CreateTemplateModal({
|
|
|
9440
9838
|
setIsEmojiPickerOpen(false);
|
|
9441
9839
|
}
|
|
9442
9840
|
}, [isOpen]);
|
|
9443
|
-
const uniqueVariables =
|
|
9841
|
+
const uniqueVariables = useMemo10(() => {
|
|
9444
9842
|
return extractUniqueVariableIndices(bodyText);
|
|
9445
9843
|
}, [bodyText]);
|
|
9446
|
-
|
|
9844
|
+
useEffect15(() => {
|
|
9447
9845
|
setVariableSamples((prev) => {
|
|
9448
9846
|
const next = {};
|
|
9449
9847
|
uniqueVariables.forEach((idx) => {
|
|
@@ -9454,7 +9852,7 @@ function CreateTemplateModal({
|
|
|
9454
9852
|
}, [uniqueVariables]);
|
|
9455
9853
|
const isNameEmpty = templateName.trim().length === 0;
|
|
9456
9854
|
const isNamePatternValid = isValidTemplateName(templateName);
|
|
9457
|
-
const isNameDuplicate =
|
|
9855
|
+
const isNameDuplicate = useMemo10(() => {
|
|
9458
9856
|
const trimmedName = templateName.trim().toLowerCase();
|
|
9459
9857
|
if (!trimmedName) return false;
|
|
9460
9858
|
if (existingTemplates && existingTemplates.length > 0) {
|
|
@@ -9464,9 +9862,9 @@ function CreateTemplateModal({
|
|
|
9464
9862
|
}
|
|
9465
9863
|
return isDuplicateTemplateName(trimmedName, existingTemplateNames, language);
|
|
9466
9864
|
}, [templateName, language, existingTemplates, existingTemplateNames]);
|
|
9467
|
-
const ratioInfo =
|
|
9468
|
-
const seqInfo =
|
|
9469
|
-
const validationResult =
|
|
9865
|
+
const ratioInfo = useMemo10(() => validateWordToVariableRatio(bodyText), [bodyText]);
|
|
9866
|
+
const seqInfo = useMemo10(() => validateSequentialVariables(bodyText), [bodyText]);
|
|
9867
|
+
const validationResult = useMemo10(() => {
|
|
9470
9868
|
return validateWhatsAppTemplate({
|
|
9471
9869
|
name: templateName,
|
|
9472
9870
|
language,
|
|
@@ -9720,12 +10118,12 @@ function CreateTemplateModal({
|
|
|
9720
10118
|
}
|
|
9721
10119
|
};
|
|
9722
10120
|
if (!isOpen) return null;
|
|
9723
|
-
return /* @__PURE__ */
|
|
10121
|
+
return /* @__PURE__ */ jsx20(
|
|
9724
10122
|
"div",
|
|
9725
10123
|
{
|
|
9726
10124
|
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",
|
|
9727
10125
|
dir: "rtl",
|
|
9728
|
-
children: /* @__PURE__ */
|
|
10126
|
+
children: /* @__PURE__ */ jsxs17(
|
|
9729
10127
|
"div",
|
|
9730
10128
|
{
|
|
9731
10129
|
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",
|
|
@@ -9733,43 +10131,43 @@ function CreateTemplateModal({
|
|
|
9733
10131
|
"aria-modal": "true",
|
|
9734
10132
|
"aria-labelledby": "modal-title",
|
|
9735
10133
|
children: [
|
|
9736
|
-
/* @__PURE__ */
|
|
9737
|
-
/* @__PURE__ */
|
|
9738
|
-
/* @__PURE__ */
|
|
9739
|
-
/* @__PURE__ */
|
|
9740
|
-
/* @__PURE__ */
|
|
9741
|
-
/* @__PURE__ */
|
|
10134
|
+
/* @__PURE__ */ jsxs17("div", { className: "px-6 py-4 border-b border-slate-100 flex items-center justify-between bg-slate-50/70", children: [
|
|
10135
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2.5", children: [
|
|
10136
|
+
/* @__PURE__ */ jsx20("div", { className: "w-8 h-8 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx20(Plus, { className: "w-4 h-4" }) }),
|
|
10137
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10138
|
+
/* @__PURE__ */ jsx20("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" }),
|
|
10139
|
+
/* @__PURE__ */ jsx20("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" })
|
|
9742
10140
|
] })
|
|
9743
10141
|
] }),
|
|
9744
|
-
/* @__PURE__ */
|
|
10142
|
+
/* @__PURE__ */ jsx20(
|
|
9745
10143
|
"button",
|
|
9746
10144
|
{
|
|
9747
10145
|
type: "button",
|
|
9748
10146
|
onClick: onClose,
|
|
9749
10147
|
className: "p-1.5 text-slate-400 hover:text-slate-700 hover:bg-slate-200/60 rounded-lg transition-colors cursor-pointer",
|
|
9750
10148
|
"aria-label": "\u05E1\u05D2\u05D5\u05E8",
|
|
9751
|
-
children: /* @__PURE__ */
|
|
10149
|
+
children: /* @__PURE__ */ jsx20(X9, { className: "w-5 h-5" })
|
|
9752
10150
|
}
|
|
9753
10151
|
)
|
|
9754
10152
|
] }),
|
|
9755
|
-
/* @__PURE__ */
|
|
9756
|
-
/* @__PURE__ */
|
|
9757
|
-
submitError && /* @__PURE__ */
|
|
9758
|
-
/* @__PURE__ */
|
|
9759
|
-
/* @__PURE__ */
|
|
10153
|
+
/* @__PURE__ */ jsxs17("form", { onSubmit: handleSubmit, className: "flex flex-col overflow-hidden flex-1", children: [
|
|
10154
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-6 overflow-y-auto space-y-5 flex-1", children: [
|
|
10155
|
+
submitError && /* @__PURE__ */ jsxs17("div", { className: "p-3 bg-rose-50 border border-rose-200 rounded-xl text-xs text-rose-800 flex items-center gap-2", children: [
|
|
10156
|
+
/* @__PURE__ */ jsx20(AlertCircle2, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
10157
|
+
/* @__PURE__ */ jsx20("span", { children: submitError })
|
|
9760
10158
|
] }),
|
|
9761
|
-
/* @__PURE__ */
|
|
9762
|
-
/* @__PURE__ */
|
|
9763
|
-
/* @__PURE__ */
|
|
10159
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1.5", children: [
|
|
10160
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
10161
|
+
/* @__PURE__ */ jsxs17("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
9764
10162
|
"\u05E9\u05DD \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4 ",
|
|
9765
|
-
/* @__PURE__ */
|
|
10163
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
9766
10164
|
] }),
|
|
9767
|
-
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */
|
|
9768
|
-
/* @__PURE__ */
|
|
10165
|
+
templateName && isNamePatternValid && !isNameDuplicate && /* @__PURE__ */ jsxs17("span", { className: "text-[11px] text-emerald-600 font-semibold flex items-center gap-1", children: [
|
|
10166
|
+
/* @__PURE__ */ jsx20(CheckCircle22, { className: "w-3.5 h-3.5" }),
|
|
9769
10167
|
" \u05E9\u05DD \u05EA\u05E7\u05D9\u05DF"
|
|
9770
10168
|
] })
|
|
9771
10169
|
] }),
|
|
9772
|
-
/* @__PURE__ */
|
|
10170
|
+
/* @__PURE__ */ jsx20(
|
|
9773
10171
|
"input",
|
|
9774
10172
|
{
|
|
9775
10173
|
type: "text",
|
|
@@ -9781,47 +10179,47 @@ function CreateTemplateModal({
|
|
|
9781
10179
|
required: true
|
|
9782
10180
|
}
|
|
9783
10181
|
),
|
|
9784
|
-
/* @__PURE__ */
|
|
9785
|
-
!isNameEmpty && isNameDuplicate && /* @__PURE__ */
|
|
9786
|
-
/* @__PURE__ */
|
|
10182
|
+
/* @__PURE__ */ jsx20("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." }),
|
|
10183
|
+
!isNameEmpty && isNameDuplicate && /* @__PURE__ */ jsxs17("p", { className: "text-[11px] text-rose-600 font-semibold flex items-center gap-1 mt-1", children: [
|
|
10184
|
+
/* @__PURE__ */ jsx20(AlertCircle2, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
9787
10185
|
"\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 (",
|
|
9788
10186
|
language,
|
|
9789
10187
|
"). \u05D0\u05E0\u05D0 \u05D1\u05D7\u05E8 \u05E9\u05DD \u05D9\u05D9\u05D7\u05D5\u05D3\u05D9 \u05D0\u05D5 \u05E9\u05E4\u05D4 \u05D0\u05D7\u05E8\u05EA."
|
|
9790
10188
|
] })
|
|
9791
10189
|
] }),
|
|
9792
|
-
/* @__PURE__ */
|
|
9793
|
-
/* @__PURE__ */
|
|
9794
|
-
/* @__PURE__ */
|
|
9795
|
-
/* @__PURE__ */
|
|
10190
|
+
/* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10191
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1.5", children: [
|
|
10192
|
+
/* @__PURE__ */ jsx20("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E9\u05E4\u05D4" }),
|
|
10193
|
+
/* @__PURE__ */ jsx20(
|
|
9796
10194
|
"select",
|
|
9797
10195
|
{
|
|
9798
10196
|
value: language,
|
|
9799
10197
|
onChange: (e) => setLanguage(e.target.value),
|
|
9800
10198
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
9801
|
-
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */
|
|
10199
|
+
children: LANGUAGE_OPTIONS.map((opt) => /* @__PURE__ */ jsx20("option", { value: opt.value, children: opt.label }, opt.value))
|
|
9802
10200
|
}
|
|
9803
10201
|
)
|
|
9804
10202
|
] }),
|
|
9805
|
-
/* @__PURE__ */
|
|
9806
|
-
/* @__PURE__ */
|
|
9807
|
-
/* @__PURE__ */
|
|
10203
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1.5", children: [
|
|
10204
|
+
/* @__PURE__ */ jsx20("label", { className: "block text-xs font-semibold text-slate-700", children: "\u05E7\u05D8\u05D2\u05D5\u05E8\u05D9\u05D4" }),
|
|
10205
|
+
/* @__PURE__ */ jsx20(
|
|
9808
10206
|
"select",
|
|
9809
10207
|
{
|
|
9810
10208
|
value: category,
|
|
9811
10209
|
onChange: (e) => setCategory(e.target.value),
|
|
9812
10210
|
className: "w-full px-3 py-2 text-xs bg-slate-50 border border-slate-200 rounded-xl text-slate-800 outline-hidden",
|
|
9813
|
-
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */
|
|
10211
|
+
children: CATEGORY_OPTIONS.map((opt) => /* @__PURE__ */ jsx20("option", { value: opt.value, children: opt.label }, opt.value))
|
|
9814
10212
|
}
|
|
9815
10213
|
)
|
|
9816
10214
|
] })
|
|
9817
10215
|
] }),
|
|
9818
|
-
/* @__PURE__ */
|
|
9819
|
-
/* @__PURE__ */
|
|
10216
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-2", children: [
|
|
10217
|
+
/* @__PURE__ */ jsxs17("label", { className: "block text-xs font-bold text-slate-800", children: [
|
|
9820
10218
|
"\u05EA\u05D5\u05DB\u05DF \u05D2\u05D5\u05E3 \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 ",
|
|
9821
|
-
/* @__PURE__ */
|
|
10219
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
9822
10220
|
] }),
|
|
9823
|
-
/* @__PURE__ */
|
|
9824
|
-
/* @__PURE__ */
|
|
10221
|
+
/* @__PURE__ */ jsxs17("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: [
|
|
10222
|
+
/* @__PURE__ */ jsx20(
|
|
9825
10223
|
"textarea",
|
|
9826
10224
|
{
|
|
9827
10225
|
ref: textareaRef,
|
|
@@ -9836,14 +10234,14 @@ function CreateTemplateModal({
|
|
|
9836
10234
|
required: true
|
|
9837
10235
|
}
|
|
9838
10236
|
),
|
|
9839
|
-
/* @__PURE__ */
|
|
10237
|
+
/* @__PURE__ */ jsxs17(
|
|
9840
10238
|
"div",
|
|
9841
10239
|
{
|
|
9842
10240
|
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",
|
|
9843
10241
|
dir: language === "en_US" ? "ltr" : "rtl",
|
|
9844
10242
|
children: [
|
|
9845
|
-
/* @__PURE__ */
|
|
9846
|
-
/* @__PURE__ */
|
|
10243
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
10244
|
+
/* @__PURE__ */ jsx20(
|
|
9847
10245
|
"button",
|
|
9848
10246
|
{
|
|
9849
10247
|
type: "button",
|
|
@@ -9851,10 +10249,10 @@ function CreateTemplateModal({
|
|
|
9851
10249
|
onClick: () => handleApplyFormatting("*"),
|
|
9852
10250
|
title: "\u05DE\u05D5\u05D3\u05D2\u05E9 (Bold) *\u05D8\u05E7\u05E1\u05D8*",
|
|
9853
10251
|
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",
|
|
9854
|
-
children: /* @__PURE__ */
|
|
10252
|
+
children: /* @__PURE__ */ jsx20(Bold, { className: "w-3.5 h-3.5" })
|
|
9855
10253
|
}
|
|
9856
10254
|
),
|
|
9857
|
-
/* @__PURE__ */
|
|
10255
|
+
/* @__PURE__ */ jsx20(
|
|
9858
10256
|
"button",
|
|
9859
10257
|
{
|
|
9860
10258
|
type: "button",
|
|
@@ -9862,10 +10260,10 @@ function CreateTemplateModal({
|
|
|
9862
10260
|
onClick: () => handleApplyFormatting("_"),
|
|
9863
10261
|
title: "\u05E0\u05D8\u05D5\u05D9 (Italic) _\u05D8\u05E7\u05E1\u05D8_",
|
|
9864
10262
|
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",
|
|
9865
|
-
children: /* @__PURE__ */
|
|
10263
|
+
children: /* @__PURE__ */ jsx20(Italic, { className: "w-3.5 h-3.5" })
|
|
9866
10264
|
}
|
|
9867
10265
|
),
|
|
9868
|
-
/* @__PURE__ */
|
|
10266
|
+
/* @__PURE__ */ jsx20(
|
|
9869
10267
|
"button",
|
|
9870
10268
|
{
|
|
9871
10269
|
type: "button",
|
|
@@ -9873,12 +10271,12 @@ function CreateTemplateModal({
|
|
|
9873
10271
|
onClick: () => handleApplyFormatting("~"),
|
|
9874
10272
|
title: "\u05E7\u05D5 \u05D7\u05D5\u05E6\u05D4 (Strikethrough) ~\u05D8\u05E7\u05E1\u05D8~",
|
|
9875
10273
|
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",
|
|
9876
|
-
children: /* @__PURE__ */
|
|
10274
|
+
children: /* @__PURE__ */ jsx20(Strikethrough, { className: "w-3.5 h-3.5" })
|
|
9877
10275
|
}
|
|
9878
10276
|
),
|
|
9879
|
-
/* @__PURE__ */
|
|
9880
|
-
/* @__PURE__ */
|
|
9881
|
-
/* @__PURE__ */
|
|
10277
|
+
/* @__PURE__ */ jsx20("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
10278
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative inline-block", ref: emojiPickerRef, children: [
|
|
10279
|
+
/* @__PURE__ */ jsx20(
|
|
9882
10280
|
"button",
|
|
9883
10281
|
{
|
|
9884
10282
|
type: "button",
|
|
@@ -9886,16 +10284,16 @@ function CreateTemplateModal({
|
|
|
9886
10284
|
onClick: () => setIsEmojiPickerOpen(!isEmojiPickerOpen),
|
|
9887
10285
|
title: "\u05D4\u05D5\u05E1\u05E3 \u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9 (Emoji)",
|
|
9888
10286
|
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"}`,
|
|
9889
|
-
children: /* @__PURE__ */
|
|
10287
|
+
children: /* @__PURE__ */ jsx20(Smile, { className: "w-4 h-4" })
|
|
9890
10288
|
}
|
|
9891
10289
|
),
|
|
9892
|
-
isEmojiPickerOpen && /* @__PURE__ */
|
|
10290
|
+
isEmojiPickerOpen && /* @__PURE__ */ jsx20(
|
|
9893
10291
|
"div",
|
|
9894
10292
|
{
|
|
9895
10293
|
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`,
|
|
9896
10294
|
dir: "ltr",
|
|
9897
10295
|
onMouseDown: (e) => e.stopPropagation(),
|
|
9898
|
-
children: /* @__PURE__ */
|
|
10296
|
+
children: /* @__PURE__ */ jsx20(
|
|
9899
10297
|
EmojiPicker,
|
|
9900
10298
|
{
|
|
9901
10299
|
onEmojiClick: (emojiData) => {
|
|
@@ -9912,8 +10310,8 @@ function CreateTemplateModal({
|
|
|
9912
10310
|
}
|
|
9913
10311
|
)
|
|
9914
10312
|
] }),
|
|
9915
|
-
/* @__PURE__ */
|
|
9916
|
-
/* @__PURE__ */
|
|
10313
|
+
/* @__PURE__ */ jsx20("div", { className: "h-4 w-px bg-slate-200 mx-1" }),
|
|
10314
|
+
/* @__PURE__ */ jsxs17(
|
|
9917
10315
|
"button",
|
|
9918
10316
|
{
|
|
9919
10317
|
type: "button",
|
|
@@ -9923,28 +10321,28 @@ function CreateTemplateModal({
|
|
|
9923
10321
|
"aria-label": language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4",
|
|
9924
10322
|
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",
|
|
9925
10323
|
children: [
|
|
9926
|
-
/* @__PURE__ */
|
|
9927
|
-
/* @__PURE__ */
|
|
10324
|
+
/* @__PURE__ */ jsx20(Plus, { className: "w-3.5 h-3.5" }),
|
|
10325
|
+
/* @__PURE__ */ jsx20("span", { children: language === "en_US" ? "Add variable" : "\u05DE\u05E9\u05EA\u05E0\u05D4" })
|
|
9928
10326
|
]
|
|
9929
10327
|
}
|
|
9930
10328
|
)
|
|
9931
10329
|
] }),
|
|
9932
|
-
/* @__PURE__ */
|
|
10330
|
+
/* @__PURE__ */ jsxs17(
|
|
9933
10331
|
"div",
|
|
9934
10332
|
{
|
|
9935
10333
|
className: "flex items-center gap-1 font-mono text-[11px]",
|
|
9936
10334
|
dir: "ltr",
|
|
9937
10335
|
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)",
|
|
9938
10336
|
children: [
|
|
9939
|
-
/* @__PURE__ */
|
|
10337
|
+
/* @__PURE__ */ jsx20(
|
|
9940
10338
|
"span",
|
|
9941
10339
|
{
|
|
9942
10340
|
className: `font-semibold transition-colors ${bodyText.length >= 1024 ? "text-rose-600" : bodyText.length >= 950 ? "text-amber-600" : "text-slate-500"}`,
|
|
9943
10341
|
children: bodyText.length
|
|
9944
10342
|
}
|
|
9945
10343
|
),
|
|
9946
|
-
/* @__PURE__ */
|
|
9947
|
-
/* @__PURE__ */
|
|
10344
|
+
/* @__PURE__ */ jsx20("span", { className: "text-slate-300", children: "/" }),
|
|
10345
|
+
/* @__PURE__ */ jsx20("span", { className: "text-slate-400", children: "1024" })
|
|
9948
10346
|
]
|
|
9949
10347
|
}
|
|
9950
10348
|
)
|
|
@@ -9952,30 +10350,30 @@ function CreateTemplateModal({
|
|
|
9952
10350
|
}
|
|
9953
10351
|
)
|
|
9954
10352
|
] }),
|
|
9955
|
-
/* @__PURE__ */
|
|
9956
|
-
/* @__PURE__ */
|
|
10353
|
+
/* @__PURE__ */ jsx20("div", { className: "flex flex-wrap items-center justify-between text-[11px] text-slate-400 px-1 gap-2", children: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3", children: [
|
|
10354
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
9957
10355
|
ratioInfo.staticWordsCount,
|
|
9958
10356
|
" \u05DE\u05D9\u05DC\u05D9\u05DD"
|
|
9959
10357
|
] }),
|
|
9960
|
-
/* @__PURE__ */
|
|
10358
|
+
/* @__PURE__ */ jsxs17("span", { children: [
|
|
9961
10359
|
ratioInfo.variableCount,
|
|
9962
10360
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
9963
10361
|
] })
|
|
9964
10362
|
] }) }),
|
|
9965
|
-
uniqueVariables.length > 0 && /* @__PURE__ */
|
|
9966
|
-
/* @__PURE__ */
|
|
9967
|
-
/* @__PURE__ */
|
|
9968
|
-
/* @__PURE__ */
|
|
10363
|
+
uniqueVariables.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
10364
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1.5 text-xs font-bold text-slate-800", children: [
|
|
10365
|
+
/* @__PURE__ */ jsx20(Info2, { className: "w-4 h-4 text-emerald-600" }),
|
|
10366
|
+
/* @__PURE__ */ jsx20("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)" })
|
|
9969
10367
|
] }),
|
|
9970
|
-
/* @__PURE__ */
|
|
9971
|
-
/* @__PURE__ */
|
|
9972
|
-
/* @__PURE__ */
|
|
10368
|
+
/* @__PURE__ */ jsx20("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." }),
|
|
10369
|
+
/* @__PURE__ */ jsx20("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1", children: uniqueVariables.map((idx) => /* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10370
|
+
/* @__PURE__ */ jsxs17("label", { className: "block text-[11px] font-semibold text-slate-700 font-mono", children: [
|
|
9973
10371
|
"\u05D3\u05D5\u05D2\u05DE\u05D4 \u05E2\u05D1\u05D5\u05E8 ",
|
|
9974
10372
|
`{{${idx}}}`,
|
|
9975
10373
|
" ",
|
|
9976
|
-
/* @__PURE__ */
|
|
10374
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
9977
10375
|
] }),
|
|
9978
|
-
/* @__PURE__ */
|
|
10376
|
+
/* @__PURE__ */ jsx20(
|
|
9979
10377
|
"input",
|
|
9980
10378
|
{
|
|
9981
10379
|
type: "text",
|
|
@@ -9990,21 +10388,21 @@ function CreateTemplateModal({
|
|
|
9990
10388
|
)
|
|
9991
10389
|
] }, idx)) })
|
|
9992
10390
|
] }),
|
|
9993
|
-
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */
|
|
9994
|
-
/* @__PURE__ */
|
|
9995
|
-
/* @__PURE__ */
|
|
9996
|
-
/* @__PURE__ */
|
|
10391
|
+
bodyText.trim().length > 0 && validationResult.errors.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "p-3.5 bg-amber-50 border border-amber-200 rounded-xl space-y-1.5 text-xs text-amber-900", children: [
|
|
10392
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1.5 font-bold", children: [
|
|
10393
|
+
/* @__PURE__ */ jsx20(AlertCircle2, { className: "w-4 h-4 text-amber-600 shrink-0" }),
|
|
10394
|
+
/* @__PURE__ */ jsx20("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:" })
|
|
9997
10395
|
] }),
|
|
9998
|
-
/* @__PURE__ */
|
|
10396
|
+
/* @__PURE__ */ jsx20("ul", { className: "list-disc list-inside space-y-1 text-[11px] pr-2 leading-relaxed", children: validationResult.errors.map((err, i) => /* @__PURE__ */ jsx20("li", { children: err }, i)) })
|
|
9999
10397
|
] })
|
|
10000
10398
|
] }),
|
|
10001
|
-
/* @__PURE__ */
|
|
10002
|
-
/* @__PURE__ */
|
|
10003
|
-
/* @__PURE__ */
|
|
10004
|
-
/* @__PURE__ */
|
|
10005
|
-
/* @__PURE__ */
|
|
10399
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3", children: [
|
|
10400
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
10401
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
10402
|
+
/* @__PURE__ */ jsx20(Paperclip, { className: "w-4 h-4 text-slate-600" }),
|
|
10403
|
+
/* @__PURE__ */ jsx20("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)" })
|
|
10006
10404
|
] }),
|
|
10007
|
-
/* @__PURE__ */
|
|
10405
|
+
/* @__PURE__ */ jsx20(
|
|
10008
10406
|
"input",
|
|
10009
10407
|
{
|
|
10010
10408
|
type: "checkbox",
|
|
@@ -10020,12 +10418,12 @@ function CreateTemplateModal({
|
|
|
10020
10418
|
}
|
|
10021
10419
|
)
|
|
10022
10420
|
] }),
|
|
10023
|
-
hasFileHeader && /* @__PURE__ */
|
|
10024
|
-
fileError && /* @__PURE__ */
|
|
10025
|
-
/* @__PURE__ */
|
|
10026
|
-
/* @__PURE__ */
|
|
10421
|
+
hasFileHeader && /* @__PURE__ */ jsxs17("div", { className: "space-y-3 pt-1", children: [
|
|
10422
|
+
fileError && /* @__PURE__ */ jsxs17("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: [
|
|
10423
|
+
/* @__PURE__ */ jsx20(AlertCircle2, { className: "w-4 h-4 text-rose-600 shrink-0" }),
|
|
10424
|
+
/* @__PURE__ */ jsx20("span", { children: fileError })
|
|
10027
10425
|
] }),
|
|
10028
|
-
/* @__PURE__ */
|
|
10426
|
+
/* @__PURE__ */ jsx20(
|
|
10029
10427
|
"input",
|
|
10030
10428
|
{
|
|
10031
10429
|
ref: fileInputRef,
|
|
@@ -10035,7 +10433,7 @@ function CreateTemplateModal({
|
|
|
10035
10433
|
className: "hidden"
|
|
10036
10434
|
}
|
|
10037
10435
|
),
|
|
10038
|
-
!selectedFile && /* @__PURE__ */
|
|
10436
|
+
!selectedFile && /* @__PURE__ */ jsxs17(
|
|
10039
10437
|
"button",
|
|
10040
10438
|
{
|
|
10041
10439
|
type: "button",
|
|
@@ -10045,49 +10443,49 @@ function CreateTemplateModal({
|
|
|
10045
10443
|
},
|
|
10046
10444
|
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",
|
|
10047
10445
|
children: [
|
|
10048
|
-
/* @__PURE__ */
|
|
10049
|
-
/* @__PURE__ */
|
|
10050
|
-
/* @__PURE__ */
|
|
10051
|
-
/* @__PURE__ */
|
|
10446
|
+
/* @__PURE__ */ jsx20("div", { className: "w-9 h-9 rounded-full bg-slate-100 text-slate-500 flex items-center justify-center", children: /* @__PURE__ */ jsx20(Upload2, { className: "w-4 h-4" }) }),
|
|
10447
|
+
/* @__PURE__ */ jsxs17("div", { className: "text-center", children: [
|
|
10448
|
+
/* @__PURE__ */ jsx20("span", { className: "text-xs font-bold text-emerald-700 block", children: "\u05DC\u05D7\u05E5 \u05DC\u05D1\u05D7\u05D9\u05E8\u05EA \u05E7\u05D5\u05D1\u05E5" }),
|
|
10449
|
+
/* @__PURE__ */ jsx20("span", { className: "text-[10px] text-slate-400", children: "PDF, JPG, PNG, MP4 \u05E2\u05D3 5MB" })
|
|
10052
10450
|
] })
|
|
10053
10451
|
]
|
|
10054
10452
|
}
|
|
10055
10453
|
),
|
|
10056
|
-
selectedFile && /* @__PURE__ */
|
|
10057
|
-
/* @__PURE__ */
|
|
10058
|
-
/* @__PURE__ */
|
|
10059
|
-
/* @__PURE__ */
|
|
10060
|
-
/* @__PURE__ */
|
|
10061
|
-
/* @__PURE__ */
|
|
10454
|
+
selectedFile && /* @__PURE__ */ jsxs17("div", { className: "p-3 bg-white border border-emerald-200 rounded-xl flex items-center justify-between gap-3 shadow-2xs", children: [
|
|
10455
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2.5 overflow-hidden", children: [
|
|
10456
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(FileText2, { className: "w-4 h-4" }) : selectedFile.type.includes("video") || selectedFile.name.toLowerCase().match(/\.(mp4|mov|avi|webm)$/) ? /* @__PURE__ */ jsx20(Video, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx20(ImageIcon, { className: "w-4 h-4" }) }),
|
|
10457
|
+
/* @__PURE__ */ jsxs17("div", { className: "overflow-hidden", children: [
|
|
10458
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-bold text-slate-800 truncate", title: selectedFile.name, children: /* @__PURE__ */ jsx20("span", { dir: "ltr", className: "inline-block truncate max-w-full", children: selectedFile.name }) }),
|
|
10459
|
+
/* @__PURE__ */ jsx20("p", { className: "text-[10px] text-slate-400", children: /* @__PURE__ */ jsxs17("span", { dir: "ltr", className: "inline-block", children: [
|
|
10062
10460
|
formatFileSize(selectedFile.size),
|
|
10063
10461
|
selectedFile.type ? ` \u2022 ${selectedFile.type}` : ""
|
|
10064
10462
|
] }) })
|
|
10065
10463
|
] })
|
|
10066
10464
|
] }),
|
|
10067
|
-
/* @__PURE__ */
|
|
10465
|
+
/* @__PURE__ */ jsx20(
|
|
10068
10466
|
"button",
|
|
10069
10467
|
{
|
|
10070
10468
|
type: "button",
|
|
10071
10469
|
onClick: handleRemoveFile,
|
|
10072
10470
|
className: "p-1 text-slate-400 hover:text-rose-600 rounded-md transition-colors cursor-pointer",
|
|
10073
10471
|
title: "\u05D4\u05E1\u05E8 \u05E7\u05D5\u05D1\u05E5",
|
|
10074
|
-
children: /* @__PURE__ */
|
|
10472
|
+
children: /* @__PURE__ */ jsx20(Trash22, { className: "w-4 h-4" })
|
|
10075
10473
|
}
|
|
10076
10474
|
)
|
|
10077
10475
|
] })
|
|
10078
10476
|
] })
|
|
10079
10477
|
] }),
|
|
10080
|
-
/* @__PURE__ */
|
|
10081
|
-
/* @__PURE__ */
|
|
10082
|
-
/* @__PURE__ */
|
|
10083
|
-
/* @__PURE__ */
|
|
10084
|
-
/* @__PURE__ */
|
|
10085
|
-
/* @__PURE__ */
|
|
10086
|
-
/* @__PURE__ */
|
|
10478
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-4 bg-slate-50 border border-slate-200 rounded-xl space-y-3.5", children: [
|
|
10479
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
10480
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
10481
|
+
/* @__PURE__ */ jsx20(MousePointerClick, { className: "w-4 h-4 text-slate-600" }),
|
|
10482
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10483
|
+
/* @__PURE__ */ jsx20("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)" }),
|
|
10484
|
+
/* @__PURE__ */ jsx20("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)" })
|
|
10087
10485
|
] })
|
|
10088
10486
|
] }),
|
|
10089
|
-
/* @__PURE__ */
|
|
10090
|
-
/* @__PURE__ */
|
|
10487
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
10488
|
+
/* @__PURE__ */ jsxs17(
|
|
10091
10489
|
"span",
|
|
10092
10490
|
{
|
|
10093
10491
|
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"}`,
|
|
@@ -10097,8 +10495,8 @@ function CreateTemplateModal({
|
|
|
10097
10495
|
]
|
|
10098
10496
|
}
|
|
10099
10497
|
),
|
|
10100
|
-
/* @__PURE__ */
|
|
10101
|
-
/* @__PURE__ */
|
|
10498
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative", ref: addButtonDropdownRef, children: [
|
|
10499
|
+
/* @__PURE__ */ jsxs17(
|
|
10102
10500
|
"button",
|
|
10103
10501
|
{
|
|
10104
10502
|
type: "button",
|
|
@@ -10107,9 +10505,9 @@ function CreateTemplateModal({
|
|
|
10107
10505
|
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"}`,
|
|
10108
10506
|
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",
|
|
10109
10507
|
children: [
|
|
10110
|
-
/* @__PURE__ */
|
|
10111
|
-
/* @__PURE__ */
|
|
10112
|
-
/* @__PURE__ */
|
|
10508
|
+
/* @__PURE__ */ jsx20(Plus, { className: "w-3.5 h-3.5" }),
|
|
10509
|
+
/* @__PURE__ */ jsx20("span", { children: "\u05D4\u05D5\u05E1\u05E3 \u05DB\u05E4\u05EA\u05D5\u05E8" }),
|
|
10510
|
+
/* @__PURE__ */ jsx20(
|
|
10113
10511
|
ChevronDown2,
|
|
10114
10512
|
{
|
|
10115
10513
|
className: `w-3.5 h-3.5 transition-transform ${isAddButtonOpen ? "rotate-180" : ""}`
|
|
@@ -10118,63 +10516,63 @@ function CreateTemplateModal({
|
|
|
10118
10516
|
]
|
|
10119
10517
|
}
|
|
10120
10518
|
),
|
|
10121
|
-
isAddButtonOpen && /* @__PURE__ */
|
|
10122
|
-
/* @__PURE__ */
|
|
10519
|
+
isAddButtonOpen && /* @__PURE__ */ jsxs17("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: [
|
|
10520
|
+
/* @__PURE__ */ jsxs17(
|
|
10123
10521
|
"button",
|
|
10124
10522
|
{
|
|
10125
10523
|
type: "button",
|
|
10126
10524
|
onClick: () => handleAddButton("QUICK_REPLY"),
|
|
10127
10525
|
className: "w-full p-2 text-right rounded-lg hover:bg-slate-50 flex items-start gap-2.5 transition-colors cursor-pointer group",
|
|
10128
10526
|
children: [
|
|
10129
|
-
/* @__PURE__ */
|
|
10130
|
-
/* @__PURE__ */
|
|
10131
|
-
/* @__PURE__ */
|
|
10132
|
-
/* @__PURE__ */
|
|
10527
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(MessageSquare, { className: "w-3.5 h-3.5" }) }),
|
|
10528
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10529
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-slate-800", children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" }),
|
|
10530
|
+
/* @__PURE__ */ jsx20("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" })
|
|
10133
10531
|
] })
|
|
10134
10532
|
]
|
|
10135
10533
|
}
|
|
10136
10534
|
),
|
|
10137
|
-
/* @__PURE__ */
|
|
10535
|
+
/* @__PURE__ */ jsxs17(
|
|
10138
10536
|
"button",
|
|
10139
10537
|
{
|
|
10140
10538
|
type: "button",
|
|
10141
10539
|
onClick: () => handleAddButton("URL"),
|
|
10142
10540
|
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",
|
|
10143
10541
|
children: [
|
|
10144
|
-
/* @__PURE__ */
|
|
10145
|
-
/* @__PURE__ */
|
|
10146
|
-
/* @__PURE__ */
|
|
10147
|
-
/* @__PURE__ */
|
|
10542
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(ExternalLink3, { className: "w-3.5 h-3.5" }) }),
|
|
10543
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10544
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-slate-800", children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" }),
|
|
10545
|
+
/* @__PURE__ */ jsx20("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" })
|
|
10148
10546
|
] })
|
|
10149
10547
|
]
|
|
10150
10548
|
}
|
|
10151
10549
|
),
|
|
10152
|
-
/* @__PURE__ */
|
|
10550
|
+
/* @__PURE__ */ jsxs17(
|
|
10153
10551
|
"button",
|
|
10154
10552
|
{
|
|
10155
10553
|
type: "button",
|
|
10156
10554
|
onClick: () => handleAddButton("PHONE_NUMBER"),
|
|
10157
10555
|
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",
|
|
10158
10556
|
children: [
|
|
10159
|
-
/* @__PURE__ */
|
|
10160
|
-
/* @__PURE__ */
|
|
10161
|
-
/* @__PURE__ */
|
|
10162
|
-
/* @__PURE__ */
|
|
10557
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(Phone, { className: "w-3.5 h-3.5" }) }),
|
|
10558
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10559
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-slate-800", children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" }),
|
|
10560
|
+
/* @__PURE__ */ jsx20("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" })
|
|
10163
10561
|
] })
|
|
10164
10562
|
]
|
|
10165
10563
|
}
|
|
10166
10564
|
),
|
|
10167
|
-
/* @__PURE__ */
|
|
10565
|
+
/* @__PURE__ */ jsxs17(
|
|
10168
10566
|
"button",
|
|
10169
10567
|
{
|
|
10170
10568
|
type: "button",
|
|
10171
10569
|
onClick: () => handleAddButton("COPY_CODE"),
|
|
10172
10570
|
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",
|
|
10173
10571
|
children: [
|
|
10174
|
-
/* @__PURE__ */
|
|
10175
|
-
/* @__PURE__ */
|
|
10176
|
-
/* @__PURE__ */
|
|
10177
|
-
/* @__PURE__ */
|
|
10572
|
+
/* @__PURE__ */ jsx20("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__ */ jsx20(Copy3, { className: "w-3.5 h-3.5" }) }),
|
|
10573
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
10574
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs font-semibold text-slate-800", children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" }),
|
|
10575
|
+
/* @__PURE__ */ jsx20("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" })
|
|
10178
10576
|
] })
|
|
10179
10577
|
]
|
|
10180
10578
|
}
|
|
@@ -10183,55 +10581,55 @@ function CreateTemplateModal({
|
|
|
10183
10581
|
] })
|
|
10184
10582
|
] })
|
|
10185
10583
|
] }),
|
|
10186
|
-
buttons.length === 0 && /* @__PURE__ */
|
|
10187
|
-
buttons.length > 0 && /* @__PURE__ */
|
|
10584
|
+
buttons.length === 0 && /* @__PURE__ */ jsx20("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.' }),
|
|
10585
|
+
buttons.length > 0 && /* @__PURE__ */ jsx20("div", { className: "space-y-2.5", children: buttons.map((btn, index) => {
|
|
10188
10586
|
const btnNum = index + 1;
|
|
10189
|
-
return /* @__PURE__ */
|
|
10587
|
+
return /* @__PURE__ */ jsxs17(
|
|
10190
10588
|
"div",
|
|
10191
10589
|
{
|
|
10192
10590
|
className: "p-3 bg-white border border-slate-200 rounded-xl space-y-2.5 shadow-2xs transition-all hover:border-slate-300",
|
|
10193
10591
|
children: [
|
|
10194
|
-
/* @__PURE__ */
|
|
10195
|
-
/* @__PURE__ */
|
|
10196
|
-
/* @__PURE__ */
|
|
10592
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
10593
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
10594
|
+
/* @__PURE__ */ jsxs17("span", { className: "text-[11px] font-bold text-slate-400 font-mono", children: [
|
|
10197
10595
|
"#",
|
|
10198
10596
|
btnNum
|
|
10199
10597
|
] }),
|
|
10200
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */
|
|
10201
|
-
/* @__PURE__ */
|
|
10202
|
-
/* @__PURE__ */
|
|
10598
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ jsxs17("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: [
|
|
10599
|
+
/* @__PURE__ */ jsx20(MessageSquare, { className: "w-3 h-3" }),
|
|
10600
|
+
/* @__PURE__ */ jsx20("span", { children: "Custom (\u05EA\u05D2\u05D5\u05D1\u05D4 \u05DE\u05D4\u05D9\u05E8\u05D4)" })
|
|
10203
10601
|
] }),
|
|
10204
|
-
btn.type === "URL" && /* @__PURE__ */
|
|
10205
|
-
/* @__PURE__ */
|
|
10206
|
-
/* @__PURE__ */
|
|
10602
|
+
btn.type === "URL" && /* @__PURE__ */ jsxs17("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: [
|
|
10603
|
+
/* @__PURE__ */ jsx20(ExternalLink3, { className: "w-3 h-3" }),
|
|
10604
|
+
/* @__PURE__ */ jsx20("span", { children: "Visit website (\u05E7\u05D9\u05E9\u05D5\u05E8 \u05DC\u05D0\u05EA\u05E8)" })
|
|
10207
10605
|
] }),
|
|
10208
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */
|
|
10209
|
-
/* @__PURE__ */
|
|
10210
|
-
/* @__PURE__ */
|
|
10606
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ jsxs17("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: [
|
|
10607
|
+
/* @__PURE__ */ jsx20(Phone, { className: "w-3 h-3" }),
|
|
10608
|
+
/* @__PURE__ */ jsx20("span", { children: "Call phone number (\u05D7\u05D9\u05D5\u05D2 \u05DC\u05DE\u05E1\u05E4\u05E8)" })
|
|
10211
10609
|
] }),
|
|
10212
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */
|
|
10213
|
-
/* @__PURE__ */
|
|
10214
|
-
/* @__PURE__ */
|
|
10610
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ jsxs17("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: [
|
|
10611
|
+
/* @__PURE__ */ jsx20(Copy3, { className: "w-3 h-3" }),
|
|
10612
|
+
/* @__PURE__ */ jsx20("span", { children: "Copy offer code (\u05D4\u05E2\u05EA\u05E7\u05EA \u05E7\u05D5\u05D3)" })
|
|
10215
10613
|
] })
|
|
10216
10614
|
] }),
|
|
10217
|
-
/* @__PURE__ */
|
|
10615
|
+
/* @__PURE__ */ jsx20(
|
|
10218
10616
|
"button",
|
|
10219
10617
|
{
|
|
10220
10618
|
type: "button",
|
|
10221
10619
|
onClick: () => handleRemoveButton(index),
|
|
10222
10620
|
className: "p-1 text-slate-400 hover:text-rose-600 hover:bg-rose-50 rounded-lg transition-colors cursor-pointer",
|
|
10223
10621
|
title: "\u05D4\u05E1\u05E8 \u05DB\u05E4\u05EA\u05D5\u05E8",
|
|
10224
|
-
children: /* @__PURE__ */
|
|
10622
|
+
children: /* @__PURE__ */ jsx20(Trash22, { className: "w-3.5 h-3.5" })
|
|
10225
10623
|
}
|
|
10226
10624
|
)
|
|
10227
10625
|
] }),
|
|
10228
|
-
btn.type === "QUICK_REPLY" && /* @__PURE__ */
|
|
10229
|
-
/* @__PURE__ */
|
|
10230
|
-
/* @__PURE__ */
|
|
10626
|
+
btn.type === "QUICK_REPLY" && /* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10627
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10628
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10231
10629
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10232
|
-
/* @__PURE__ */
|
|
10630
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10233
10631
|
] }),
|
|
10234
|
-
/* @__PURE__ */
|
|
10632
|
+
/* @__PURE__ */ jsxs17(
|
|
10235
10633
|
"span",
|
|
10236
10634
|
{
|
|
10237
10635
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10242,7 +10640,7 @@ function CreateTemplateModal({
|
|
|
10242
10640
|
}
|
|
10243
10641
|
)
|
|
10244
10642
|
] }),
|
|
10245
|
-
/* @__PURE__ */
|
|
10643
|
+
/* @__PURE__ */ jsx20(
|
|
10246
10644
|
"input",
|
|
10247
10645
|
{
|
|
10248
10646
|
type: "text",
|
|
@@ -10254,14 +10652,14 @@ function CreateTemplateModal({
|
|
|
10254
10652
|
}
|
|
10255
10653
|
)
|
|
10256
10654
|
] }),
|
|
10257
|
-
btn.type === "URL" && /* @__PURE__ */
|
|
10258
|
-
/* @__PURE__ */
|
|
10259
|
-
/* @__PURE__ */
|
|
10260
|
-
/* @__PURE__ */
|
|
10655
|
+
btn.type === "URL" && /* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10656
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10657
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10658
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10261
10659
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10262
|
-
/* @__PURE__ */
|
|
10660
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10263
10661
|
] }),
|
|
10264
|
-
/* @__PURE__ */
|
|
10662
|
+
/* @__PURE__ */ jsxs17(
|
|
10265
10663
|
"span",
|
|
10266
10664
|
{
|
|
10267
10665
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10272,7 +10670,7 @@ function CreateTemplateModal({
|
|
|
10272
10670
|
}
|
|
10273
10671
|
)
|
|
10274
10672
|
] }),
|
|
10275
|
-
/* @__PURE__ */
|
|
10673
|
+
/* @__PURE__ */ jsx20(
|
|
10276
10674
|
"input",
|
|
10277
10675
|
{
|
|
10278
10676
|
type: "text",
|
|
@@ -10284,18 +10682,18 @@ function CreateTemplateModal({
|
|
|
10284
10682
|
}
|
|
10285
10683
|
)
|
|
10286
10684
|
] }),
|
|
10287
|
-
/* @__PURE__ */
|
|
10288
|
-
/* @__PURE__ */
|
|
10289
|
-
/* @__PURE__ */
|
|
10685
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10686
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10687
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10290
10688
|
"\u05DB\u05EA\u05D5\u05D1\u05EA URL \u05E1\u05D8\u05D8\u05D9\u05EA ",
|
|
10291
|
-
/* @__PURE__ */
|
|
10689
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10292
10690
|
] }),
|
|
10293
|
-
/* @__PURE__ */
|
|
10691
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10294
10692
|
(btn.url || "").length,
|
|
10295
10693
|
"/2000"
|
|
10296
10694
|
] })
|
|
10297
10695
|
] }),
|
|
10298
|
-
/* @__PURE__ */
|
|
10696
|
+
/* @__PURE__ */ jsx20(
|
|
10299
10697
|
"input",
|
|
10300
10698
|
{
|
|
10301
10699
|
type: "url",
|
|
@@ -10309,14 +10707,14 @@ function CreateTemplateModal({
|
|
|
10309
10707
|
)
|
|
10310
10708
|
] })
|
|
10311
10709
|
] }),
|
|
10312
|
-
btn.type === "PHONE_NUMBER" && /* @__PURE__ */
|
|
10313
|
-
/* @__PURE__ */
|
|
10314
|
-
/* @__PURE__ */
|
|
10315
|
-
/* @__PURE__ */
|
|
10710
|
+
btn.type === "PHONE_NUMBER" && /* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10711
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10712
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10713
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10316
10714
|
"\u05D8\u05E7\u05E1\u05D8 \u05D4\u05DB\u05E4\u05EA\u05D5\u05E8 ",
|
|
10317
|
-
/* @__PURE__ */
|
|
10715
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10318
10716
|
] }),
|
|
10319
|
-
/* @__PURE__ */
|
|
10717
|
+
/* @__PURE__ */ jsxs17(
|
|
10320
10718
|
"span",
|
|
10321
10719
|
{
|
|
10322
10720
|
className: `font-mono text-[10px] ${(btn.text || "").length >= 25 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10327,7 +10725,7 @@ function CreateTemplateModal({
|
|
|
10327
10725
|
}
|
|
10328
10726
|
)
|
|
10329
10727
|
] }),
|
|
10330
|
-
/* @__PURE__ */
|
|
10728
|
+
/* @__PURE__ */ jsx20(
|
|
10331
10729
|
"input",
|
|
10332
10730
|
{
|
|
10333
10731
|
type: "text",
|
|
@@ -10339,18 +10737,18 @@ function CreateTemplateModal({
|
|
|
10339
10737
|
}
|
|
10340
10738
|
)
|
|
10341
10739
|
] }),
|
|
10342
|
-
/* @__PURE__ */
|
|
10343
|
-
/* @__PURE__ */
|
|
10344
|
-
/* @__PURE__ */
|
|
10740
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10741
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10742
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10345
10743
|
"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF (\u05E4\u05D5\u05E8\u05DE\u05D8: +[\u05E7\u05D9\u05D3\u05D5\u05DE\u05EA][\u05DE\u05E1\u05E4\u05E8]) ",
|
|
10346
|
-
/* @__PURE__ */
|
|
10744
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10347
10745
|
] }),
|
|
10348
|
-
/* @__PURE__ */
|
|
10746
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10349
10747
|
(btn.phone_number || "").length,
|
|
10350
10748
|
"/20"
|
|
10351
10749
|
] })
|
|
10352
10750
|
] }),
|
|
10353
|
-
/* @__PURE__ */
|
|
10751
|
+
/* @__PURE__ */ jsx20(
|
|
10354
10752
|
"input",
|
|
10355
10753
|
{
|
|
10356
10754
|
type: "tel",
|
|
@@ -10364,14 +10762,14 @@ function CreateTemplateModal({
|
|
|
10364
10762
|
)
|
|
10365
10763
|
] })
|
|
10366
10764
|
] }),
|
|
10367
|
-
btn.type === "COPY_CODE" && /* @__PURE__ */
|
|
10368
|
-
/* @__PURE__ */
|
|
10369
|
-
/* @__PURE__ */
|
|
10370
|
-
/* @__PURE__ */
|
|
10765
|
+
btn.type === "COPY_CODE" && /* @__PURE__ */ jsxs17("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
10766
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10767
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10768
|
+
/* @__PURE__ */ jsxs17("label", { className: "font-semibold text-slate-700", children: [
|
|
10371
10769
|
"\u05E7\u05D5\u05D3 \u05D4\u05E6\u05E2\u05D4 / \u05E7\u05D5\u05E4\u05D5\u05DF ",
|
|
10372
|
-
/* @__PURE__ */
|
|
10770
|
+
/* @__PURE__ */ jsx20("span", { className: "text-rose-500", children: "*" })
|
|
10373
10771
|
] }),
|
|
10374
|
-
/* @__PURE__ */
|
|
10772
|
+
/* @__PURE__ */ jsxs17(
|
|
10375
10773
|
"span",
|
|
10376
10774
|
{
|
|
10377
10775
|
className: `font-mono text-[10px] ${(btn.example || "").length >= 15 ? "text-amber-600 font-bold" : "text-slate-400"}`,
|
|
@@ -10382,7 +10780,7 @@ function CreateTemplateModal({
|
|
|
10382
10780
|
}
|
|
10383
10781
|
)
|
|
10384
10782
|
] }),
|
|
10385
|
-
/* @__PURE__ */
|
|
10783
|
+
/* @__PURE__ */ jsx20(
|
|
10386
10784
|
"input",
|
|
10387
10785
|
{
|
|
10388
10786
|
type: "text",
|
|
@@ -10395,15 +10793,15 @@ function CreateTemplateModal({
|
|
|
10395
10793
|
}
|
|
10396
10794
|
)
|
|
10397
10795
|
] }),
|
|
10398
|
-
/* @__PURE__ */
|
|
10399
|
-
/* @__PURE__ */
|
|
10400
|
-
/* @__PURE__ */
|
|
10401
|
-
/* @__PURE__ */
|
|
10796
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-1", children: [
|
|
10797
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
10798
|
+
/* @__PURE__ */ jsx20("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)" }),
|
|
10799
|
+
/* @__PURE__ */ jsxs17("span", { className: "font-mono text-[10px] text-slate-400", children: [
|
|
10402
10800
|
(btn.text || "").length,
|
|
10403
10801
|
"/25"
|
|
10404
10802
|
] })
|
|
10405
10803
|
] }),
|
|
10406
|
-
/* @__PURE__ */
|
|
10804
|
+
/* @__PURE__ */ jsx20(
|
|
10407
10805
|
"input",
|
|
10408
10806
|
{
|
|
10409
10807
|
type: "text",
|
|
@@ -10423,8 +10821,8 @@ function CreateTemplateModal({
|
|
|
10423
10821
|
}) })
|
|
10424
10822
|
] })
|
|
10425
10823
|
] }),
|
|
10426
|
-
/* @__PURE__ */
|
|
10427
|
-
/* @__PURE__ */
|
|
10824
|
+
/* @__PURE__ */ jsxs17("div", { className: "px-6 py-4 border-t border-slate-100 flex items-center justify-end gap-3 bg-slate-50/50", children: [
|
|
10825
|
+
/* @__PURE__ */ jsx20(
|
|
10428
10826
|
"button",
|
|
10429
10827
|
{
|
|
10430
10828
|
type: "button",
|
|
@@ -10434,19 +10832,19 @@ function CreateTemplateModal({
|
|
|
10434
10832
|
children: "\u05D1\u05D9\u05D8\u05D5\u05DC"
|
|
10435
10833
|
}
|
|
10436
10834
|
),
|
|
10437
|
-
/* @__PURE__ */
|
|
10835
|
+
/* @__PURE__ */ jsx20(
|
|
10438
10836
|
"button",
|
|
10439
10837
|
{
|
|
10440
10838
|
type: "submit",
|
|
10441
10839
|
disabled: !canSubmit,
|
|
10442
10840
|
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"}`,
|
|
10443
10841
|
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",
|
|
10444
|
-
children: isSubmitting ? /* @__PURE__ */
|
|
10445
|
-
/* @__PURE__ */
|
|
10446
|
-
/* @__PURE__ */
|
|
10447
|
-
] }) : /* @__PURE__ */
|
|
10448
|
-
/* @__PURE__ */
|
|
10449
|
-
/* @__PURE__ */
|
|
10842
|
+
children: isSubmitting ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
10843
|
+
/* @__PURE__ */ jsx20(Loader24, { className: "w-4 h-4 animate-spin" }),
|
|
10844
|
+
/* @__PURE__ */ jsx20("span", { children: submittingStep || "\u05D9\u05D5\u05E6\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA..." })
|
|
10845
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
10846
|
+
/* @__PURE__ */ jsx20(CheckCircle22, { className: "w-4 h-4" }),
|
|
10847
|
+
/* @__PURE__ */ jsx20("span", { children: "\u05E9\u05DC\u05D7 \u05DC\u05D1\u05D3\u05D9\u05E7\u05D4" })
|
|
10450
10848
|
] })
|
|
10451
10849
|
}
|
|
10452
10850
|
)
|
|
@@ -10460,11 +10858,11 @@ function CreateTemplateModal({
|
|
|
10460
10858
|
}
|
|
10461
10859
|
|
|
10462
10860
|
// src/components/WhatsAppComponent/hooks/useWhatsAppState.ts
|
|
10463
|
-
import { useState as
|
|
10861
|
+
import { useState as useState18, useEffect as useEffect16, useRef as useRef16, useMemo as useMemo11, useCallback as useCallback14 } from "react";
|
|
10464
10862
|
|
|
10465
10863
|
// src/components/WhatsAppComponent/utils/recipientEngine.ts
|
|
10466
10864
|
var STORAGE_KEY_TEST_PHONE = "whatsapp_test_phone";
|
|
10467
|
-
function
|
|
10865
|
+
function isRawObjectId3(str) {
|
|
10468
10866
|
if (typeof str !== "string") return false;
|
|
10469
10867
|
const trimmed = str.trim();
|
|
10470
10868
|
return /^[0-9a-fA-F]{24}$/.test(trimmed) || trimmed.startsWith("temp_");
|
|
@@ -10474,14 +10872,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10474
10872
|
if (!opt) return "";
|
|
10475
10873
|
if (typeof opt === "string") {
|
|
10476
10874
|
const trimmed = opt.trim();
|
|
10477
|
-
if (!
|
|
10875
|
+
if (!isRawObjectId3(trimmed)) return trimmed;
|
|
10478
10876
|
if (allRelationOptions) {
|
|
10479
10877
|
for (const list of Object.values(allRelationOptions)) {
|
|
10480
10878
|
if (Array.isArray(list)) {
|
|
10481
10879
|
const match = list.find((item) => ((item == null ? void 0 : item.id) || (item == null ? void 0 : item._id)) === trimmed);
|
|
10482
10880
|
if (match) {
|
|
10483
10881
|
const resolved = getRelationOptionLabel(match, colDef);
|
|
10484
|
-
if (resolved && !
|
|
10882
|
+
if (resolved && !isRawObjectId3(resolved)) {
|
|
10485
10883
|
return resolved;
|
|
10486
10884
|
}
|
|
10487
10885
|
}
|
|
@@ -10494,11 +10892,11 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10494
10892
|
const displayField = (_a = colDef == null ? void 0 : colDef.config) == null ? void 0 : _a.displayField;
|
|
10495
10893
|
if (displayField && opt.data && opt.data[displayField] !== void 0 && opt.data[displayField] !== null) {
|
|
10496
10894
|
const val = String(opt.data[displayField]).trim();
|
|
10497
|
-
if (val && !
|
|
10895
|
+
if (val && !isRawObjectId3(val) && val !== rawId) return val;
|
|
10498
10896
|
}
|
|
10499
10897
|
if (opt.label && typeof opt.label === "string") {
|
|
10500
10898
|
const trimmed = opt.label.trim();
|
|
10501
|
-
if (trimmed && !
|
|
10899
|
+
if (trimmed && !isRawObjectId3(trimmed) && trimmed !== rawId) {
|
|
10502
10900
|
return trimmed;
|
|
10503
10901
|
}
|
|
10504
10902
|
}
|
|
@@ -10521,14 +10919,14 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10521
10919
|
const val = opt.data[key];
|
|
10522
10920
|
if (val !== void 0 && val !== null) {
|
|
10523
10921
|
const str = String(val).trim();
|
|
10524
|
-
if (str && !
|
|
10922
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10525
10923
|
}
|
|
10526
10924
|
}
|
|
10527
10925
|
for (const [k, v] of Object.entries(opt.data)) {
|
|
10528
10926
|
if (k.startsWith("_") || k.toLowerCase().endsWith("id") || k.toLowerCase() === "id") continue;
|
|
10529
10927
|
if (v !== void 0 && v !== null) {
|
|
10530
10928
|
const str = String(v).trim();
|
|
10531
|
-
if (str && !
|
|
10929
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10532
10930
|
}
|
|
10533
10931
|
}
|
|
10534
10932
|
}
|
|
@@ -10537,7 +10935,7 @@ function getRelationOptionLabel(opt, colDef, allRelationOptions) {
|
|
|
10537
10935
|
const val = opt[key];
|
|
10538
10936
|
if (val !== void 0 && val !== null) {
|
|
10539
10937
|
const str = String(val).trim();
|
|
10540
|
-
if (str && !
|
|
10938
|
+
if (str && !isRawObjectId3(str) && str !== rawId) return str;
|
|
10541
10939
|
}
|
|
10542
10940
|
}
|
|
10543
10941
|
if (opt.label && typeof opt.label === "string" && opt.label.trim()) {
|
|
@@ -11765,28 +12163,28 @@ function useWhatsAppState(props) {
|
|
|
11765
12163
|
data: injectedData
|
|
11766
12164
|
} = props;
|
|
11767
12165
|
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);
|
|
11768
|
-
const [tableColumns2, setTableColumns] =
|
|
12166
|
+
const [tableColumns2, setTableColumns] = useState18(() => {
|
|
11769
12167
|
return Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
11770
12168
|
});
|
|
11771
|
-
const [rawRecords, setRawRecords] =
|
|
12169
|
+
const [rawRecords, setRawRecords] = useState18(() => {
|
|
11772
12170
|
if (Array.isArray(injectedData)) return injectedData;
|
|
11773
12171
|
if (Array.isArray(injectedData == null ? void 0 : injectedData.records)) return injectedData.records;
|
|
11774
12172
|
return [];
|
|
11775
12173
|
});
|
|
11776
|
-
const [relationOptions, setRelationOptions] =
|
|
12174
|
+
const [relationOptions, setRelationOptions] = useState18(() => {
|
|
11777
12175
|
return (injectedData == null ? void 0 : injectedData.relationOptions) || {};
|
|
11778
12176
|
});
|
|
11779
|
-
const [isLoadingTableData, setIsLoadingTableData] =
|
|
11780
|
-
const [activeSubtableScans, setActiveSubtableScans] =
|
|
11781
|
-
const [tableError, setTableError] =
|
|
11782
|
-
const [filters, setFilters] =
|
|
11783
|
-
const [selectedRowIds, setSelectedRowIds] =
|
|
11784
|
-
const [autoSelectCount, setAutoSelectCount] =
|
|
11785
|
-
const isAutoSelectingRef =
|
|
11786
|
-
const isManualOverrideRef =
|
|
11787
|
-
const prevAutoSelectCountRef =
|
|
11788
|
-
const fetchedTableIdsRef =
|
|
11789
|
-
const fullyFetchedRelationKeysRef =
|
|
12177
|
+
const [isLoadingTableData, setIsLoadingTableData] = useState18(() => Boolean(settings == null ? void 0 : settings.tableMetaId));
|
|
12178
|
+
const [activeSubtableScans, setActiveSubtableScans] = useState18(0);
|
|
12179
|
+
const [tableError, setTableError] = useState18(null);
|
|
12180
|
+
const [filters, setFilters] = useState18({});
|
|
12181
|
+
const [selectedRowIds, setSelectedRowIds] = useState18([]);
|
|
12182
|
+
const [autoSelectCount, setAutoSelectCount] = useState18(null);
|
|
12183
|
+
const isAutoSelectingRef = useRef16(false);
|
|
12184
|
+
const isManualOverrideRef = useRef16(false);
|
|
12185
|
+
const prevAutoSelectCountRef = useRef16(null);
|
|
12186
|
+
const fetchedTableIdsRef = useRef16(/* @__PURE__ */ new Set());
|
|
12187
|
+
const fullyFetchedRelationKeysRef = useRef16(/* @__PURE__ */ new Set());
|
|
11790
12188
|
const loadTableData = useCallback14(async () => {
|
|
11791
12189
|
var _a2;
|
|
11792
12190
|
const tableId = (settings == null ? void 0 : settings.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableMetaId) || (injectedData == null ? void 0 : injectedData.tableId);
|
|
@@ -11854,10 +12252,10 @@ function useWhatsAppState(props) {
|
|
|
11854
12252
|
executeAction,
|
|
11855
12253
|
orgId
|
|
11856
12254
|
]);
|
|
11857
|
-
|
|
12255
|
+
useEffect16(() => {
|
|
11858
12256
|
loadTableData();
|
|
11859
12257
|
}, [loadTableData]);
|
|
11860
|
-
const filterableColumns =
|
|
12258
|
+
const filterableColumns = useMemo11(() => {
|
|
11861
12259
|
return (tableColumns2 || []).filter((col) => {
|
|
11862
12260
|
var _a2;
|
|
11863
12261
|
if (!col || col.name === "_id" || col.id === "_id") return false;
|
|
@@ -11865,15 +12263,15 @@ function useWhatsAppState(props) {
|
|
|
11865
12263
|
return type === "RELATION" || type === "BOOLEAN";
|
|
11866
12264
|
});
|
|
11867
12265
|
}, [tableColumns2]);
|
|
11868
|
-
const [referencedTableSchemas, setReferencedTableSchemas] =
|
|
11869
|
-
const subtableCols =
|
|
12266
|
+
const [referencedTableSchemas, setReferencedTableSchemas] = useState18({});
|
|
12267
|
+
const subtableCols = useMemo11(() => {
|
|
11870
12268
|
return (tableColumns2 || []).filter((col) => {
|
|
11871
12269
|
var _a2;
|
|
11872
12270
|
const type = (_a2 = col.type) == null ? void 0 : _a2.toUpperCase();
|
|
11873
12271
|
return type === "RELATION" || type === "SUB_TABLE" || type === "SUBTABLE";
|
|
11874
12272
|
});
|
|
11875
12273
|
}, [tableColumns2]);
|
|
11876
|
-
|
|
12274
|
+
useEffect16(() => {
|
|
11877
12275
|
if (!executeAction) return;
|
|
11878
12276
|
const unrequestedCols = subtableCols.filter((col) => {
|
|
11879
12277
|
var _a2;
|
|
@@ -11919,20 +12317,20 @@ function useWhatsAppState(props) {
|
|
|
11919
12317
|
const isScanningPhoneColumns = Boolean(
|
|
11920
12318
|
isLoadingTableData || activeSubtableScans > 0 || tableColumns2.length === 0 && Boolean(settings == null ? void 0 : settings.tableMetaId)
|
|
11921
12319
|
);
|
|
11922
|
-
const targetPhoneOptions =
|
|
12320
|
+
const targetPhoneOptions = useMemo11(() => {
|
|
11923
12321
|
const cols = tableColumns2 && tableColumns2.length > 0 ? tableColumns2 : Array.isArray(settings == null ? void 0 : settings.columns) ? settings.columns : [];
|
|
11924
12322
|
return scanTargetPhoneOptions(cols, referencedTableSchemas);
|
|
11925
12323
|
}, [tableColumns2, settings == null ? void 0 : settings.columns, referencedTableSchemas]);
|
|
11926
|
-
const phoneColumns =
|
|
12324
|
+
const phoneColumns = useMemo11(() => {
|
|
11927
12325
|
return targetPhoneOptions.map((opt) => ({ name: opt.label, id: opt.id, type: "PHONE" }));
|
|
11928
12326
|
}, [targetPhoneOptions]);
|
|
11929
|
-
const [phoneColumnId, setPhoneColumnId] =
|
|
11930
|
-
const [subtableFilterColumn, setSubtableFilterColumn] =
|
|
11931
|
-
const [subtableFilterValue, setSubtableFilterValue] =
|
|
11932
|
-
const [subtableSendLimit, setSubtableSendLimit] =
|
|
12327
|
+
const [phoneColumnId, setPhoneColumnId] = useState18("");
|
|
12328
|
+
const [subtableFilterColumn, setSubtableFilterColumn] = useState18("");
|
|
12329
|
+
const [subtableFilterValue, setSubtableFilterValue] = useState18("");
|
|
12330
|
+
const [subtableSendLimit, setSubtableSendLimit] = useState18(
|
|
11933
12331
|
(settings == null ? void 0 : settings.subtableSendLimit) || "PRIMARY"
|
|
11934
12332
|
);
|
|
11935
|
-
|
|
12333
|
+
useEffect16(() => {
|
|
11936
12334
|
if (targetPhoneOptions.length > 0) {
|
|
11937
12335
|
const isValid = targetPhoneOptions.some(
|
|
11938
12336
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
@@ -11944,13 +12342,13 @@ function useWhatsAppState(props) {
|
|
|
11944
12342
|
setPhoneColumnId("");
|
|
11945
12343
|
}
|
|
11946
12344
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
11947
|
-
const selectedPhoneOption =
|
|
12345
|
+
const selectedPhoneOption = useMemo11(() => {
|
|
11948
12346
|
if (!phoneColumnId) return targetPhoneOptions[0] || null;
|
|
11949
12347
|
return targetPhoneOptions.find(
|
|
11950
12348
|
(opt) => opt.id === phoneColumnId || opt.columnName === phoneColumnId
|
|
11951
12349
|
) || targetPhoneOptions[0] || null;
|
|
11952
12350
|
}, [targetPhoneOptions, phoneColumnId]);
|
|
11953
|
-
const subtableFilterableColumns =
|
|
12351
|
+
const subtableFilterableColumns = useMemo11(() => {
|
|
11954
12352
|
var _a2, _b2, _c;
|
|
11955
12353
|
if (!selectedPhoneOption || selectedPhoneOption.type !== "SUBTABLE") {
|
|
11956
12354
|
return [];
|
|
@@ -11969,14 +12367,14 @@ function useWhatsAppState(props) {
|
|
|
11969
12367
|
return type === "BOOLEAN" || type === "RELATION";
|
|
11970
12368
|
});
|
|
11971
12369
|
}, [selectedPhoneOption, referencedTableSchemas, tableColumns2]);
|
|
11972
|
-
const selectedSubtableFilterCol =
|
|
12370
|
+
const selectedSubtableFilterCol = useMemo11(() => {
|
|
11973
12371
|
return subtableFilterableColumns.find((c) => c.name === subtableFilterColumn);
|
|
11974
12372
|
}, [subtableFilterableColumns, subtableFilterColumn]);
|
|
11975
|
-
const [enablePostSendAction, setEnablePostSendAction] =
|
|
11976
|
-
const [postSendActionColumn, setPostSendActionColumn] =
|
|
11977
|
-
const [postSendActionValue, setPostSendActionValue] =
|
|
11978
|
-
const [postSendActionTargetType, setPostSendActionTargetType] =
|
|
11979
|
-
const postSendActionTargetOptions =
|
|
12373
|
+
const [enablePostSendAction, setEnablePostSendAction] = useState18(false);
|
|
12374
|
+
const [postSendActionColumn, setPostSendActionColumn] = useState18("");
|
|
12375
|
+
const [postSendActionValue, setPostSendActionValue] = useState18("");
|
|
12376
|
+
const [postSendActionTargetType, setPostSendActionTargetType] = useState18("MAIN");
|
|
12377
|
+
const postSendActionTargetOptions = useMemo11(() => {
|
|
11980
12378
|
var _a2, _b2, _c;
|
|
11981
12379
|
const options = [];
|
|
11982
12380
|
(tableColumns2 || []).forEach((col) => {
|
|
@@ -12021,14 +12419,14 @@ function useWhatsAppState(props) {
|
|
|
12021
12419
|
}
|
|
12022
12420
|
return options;
|
|
12023
12421
|
}, [tableColumns2, selectedPhoneOption, referencedTableSchemas]);
|
|
12024
|
-
const selectedPostSendOption =
|
|
12422
|
+
const selectedPostSendOption = useMemo11(() => {
|
|
12025
12423
|
return postSendActionTargetOptions.find(
|
|
12026
12424
|
(opt) => opt.id === postSendActionColumn || opt.columnName === postSendActionColumn
|
|
12027
12425
|
);
|
|
12028
12426
|
}, [postSendActionTargetOptions, postSendActionColumn]);
|
|
12029
12427
|
const selectedPostSendCol = selectedPostSendOption;
|
|
12030
|
-
const [isTestPromptOpen, setIsTestPromptOpen] =
|
|
12031
|
-
const [testPhoneNumber, setTestPhoneNumber] =
|
|
12428
|
+
const [isTestPromptOpen, setIsTestPromptOpen] = useState18(false);
|
|
12429
|
+
const [testPhoneNumber, setTestPhoneNumber] = useState18(() => {
|
|
12032
12430
|
if (typeof window !== "undefined") {
|
|
12033
12431
|
try {
|
|
12034
12432
|
return localStorage.getItem(STORAGE_KEY_TEST_PHONE) || "";
|
|
@@ -12038,10 +12436,10 @@ function useWhatsAppState(props) {
|
|
|
12038
12436
|
}
|
|
12039
12437
|
return "";
|
|
12040
12438
|
});
|
|
12041
|
-
const [testFeedback, setTestFeedback] =
|
|
12042
|
-
const [isSendingTest, setIsSendingTest] =
|
|
12043
|
-
const [isSendingBroadcast, setIsSendingBroadcast] =
|
|
12044
|
-
const [broadcastProgress, setBroadcastProgress] =
|
|
12439
|
+
const [testFeedback, setTestFeedback] = useState18(null);
|
|
12440
|
+
const [isSendingTest, setIsSendingTest] = useState18(false);
|
|
12441
|
+
const [isSendingBroadcast, setIsSendingBroadcast] = useState18(false);
|
|
12442
|
+
const [broadcastProgress, setBroadcastProgress] = useState18({
|
|
12045
12443
|
current: 0,
|
|
12046
12444
|
total: 0,
|
|
12047
12445
|
successful: 0,
|
|
@@ -12049,8 +12447,8 @@ function useWhatsAppState(props) {
|
|
|
12049
12447
|
skipped: 0,
|
|
12050
12448
|
percent: 0
|
|
12051
12449
|
});
|
|
12052
|
-
const [broadcastSummary, setBroadcastSummary] =
|
|
12053
|
-
const [rowStatusMap, setRowStatusMap] =
|
|
12450
|
+
const [broadcastSummary, setBroadcastSummary] = useState18(null);
|
|
12451
|
+
const [rowStatusMap, setRowStatusMap] = useState18({});
|
|
12054
12452
|
const clearBroadcastSummary = useCallback14(() => {
|
|
12055
12453
|
setBroadcastSummary(null);
|
|
12056
12454
|
}, []);
|
|
@@ -12107,7 +12505,7 @@ function useWhatsAppState(props) {
|
|
|
12107
12505
|
},
|
|
12108
12506
|
[relationOptions, subtableFilterableColumns, postSendActionTargetOptions, tableColumns2, filterableColumns]
|
|
12109
12507
|
);
|
|
12110
|
-
|
|
12508
|
+
useEffect16(() => {
|
|
12111
12509
|
var _a2, _b2, _c, _d, _e;
|
|
12112
12510
|
if (!executeAction) return;
|
|
12113
12511
|
const targets = [];
|
|
@@ -12201,7 +12599,7 @@ function useWhatsAppState(props) {
|
|
|
12201
12599
|
}
|
|
12202
12600
|
});
|
|
12203
12601
|
}, [filterableColumns, selectedPhoneOption, referencedTableSchemas, tableColumns2, executeAction, selectedPostSendOption, orgId]);
|
|
12204
|
-
|
|
12602
|
+
useEffect16(() => {
|
|
12205
12603
|
var _a2, _b2, _c;
|
|
12206
12604
|
if (!executeAction || !selectedSubtableFilterCol) return;
|
|
12207
12605
|
if (((_a2 = selectedSubtableFilterCol.type) == null ? void 0 : _a2.toUpperCase()) !== "RELATION") return;
|
|
@@ -12252,7 +12650,7 @@ function useWhatsAppState(props) {
|
|
|
12252
12650
|
}
|
|
12253
12651
|
})();
|
|
12254
12652
|
}, [selectedSubtableFilterCol, selectedPhoneOption, executeAction, orgId]);
|
|
12255
|
-
|
|
12653
|
+
useEffect16(() => {
|
|
12256
12654
|
var _a2, _b2;
|
|
12257
12655
|
if (!executeAction || !selectedPostSendOption) return;
|
|
12258
12656
|
if (selectedPostSendOption.type !== "RELATION") return;
|
|
@@ -12305,7 +12703,7 @@ function useWhatsAppState(props) {
|
|
|
12305
12703
|
}
|
|
12306
12704
|
})();
|
|
12307
12705
|
}, [selectedPostSendOption, executeAction, orgId]);
|
|
12308
|
-
const filteredRecords =
|
|
12706
|
+
const filteredRecords = useMemo11(() => {
|
|
12309
12707
|
const activeEntries = Object.entries(filters).filter(
|
|
12310
12708
|
([_, val]) => val !== void 0 && val !== null && val !== ""
|
|
12311
12709
|
);
|
|
@@ -12337,7 +12735,7 @@ function useWhatsAppState(props) {
|
|
|
12337
12735
|
});
|
|
12338
12736
|
}, [rawRecords, filters, filterableColumns]);
|
|
12339
12737
|
const filteredData = filteredRecords;
|
|
12340
|
-
|
|
12738
|
+
useEffect16(() => {
|
|
12341
12739
|
if (autoSelectCount !== null && autoSelectCount > 0) {
|
|
12342
12740
|
isAutoSelectingRef.current = true;
|
|
12343
12741
|
const sliced = filteredData.slice(0, autoSelectCount);
|
|
@@ -12398,7 +12796,7 @@ function useWhatsAppState(props) {
|
|
|
12398
12796
|
const handleClearFilters = () => {
|
|
12399
12797
|
setFilters({});
|
|
12400
12798
|
};
|
|
12401
|
-
const activeFiltersCount =
|
|
12799
|
+
const activeFiltersCount = useMemo11(() => {
|
|
12402
12800
|
return Object.values(filters).filter((v) => v !== "").length;
|
|
12403
12801
|
}, [filters]);
|
|
12404
12802
|
const handleSelectionChange = useCallback14((selectedIds) => {
|
|
@@ -12437,14 +12835,14 @@ function useWhatsAppState(props) {
|
|
|
12437
12835
|
return prev;
|
|
12438
12836
|
});
|
|
12439
12837
|
}, [autoSelectCount]);
|
|
12440
|
-
const [templates, setTemplates] =
|
|
12441
|
-
const [selectedTemplateId, setSelectedTemplateId] =
|
|
12442
|
-
const [isLoading, setIsLoading] =
|
|
12443
|
-
const [fetchError, setFetchError] =
|
|
12444
|
-
const [isModalOpen, setIsModalOpen] =
|
|
12445
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
12446
|
-
const [isDeleting, setIsDeleting] =
|
|
12447
|
-
const [feedback, setFeedback] =
|
|
12838
|
+
const [templates, setTemplates] = useState18([]);
|
|
12839
|
+
const [selectedTemplateId, setSelectedTemplateId] = useState18(null);
|
|
12840
|
+
const [isLoading, setIsLoading] = useState18(true);
|
|
12841
|
+
const [fetchError, setFetchError] = useState18(null);
|
|
12842
|
+
const [isModalOpen, setIsModalOpen] = useState18(false);
|
|
12843
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState18(false);
|
|
12844
|
+
const [isDeleting, setIsDeleting] = useState18(false);
|
|
12845
|
+
const [feedback, setFeedback] = useState18(null);
|
|
12448
12846
|
const loadTemplates = useCallback14(async () => {
|
|
12449
12847
|
var _a2, _b2;
|
|
12450
12848
|
if (!executeAction) {
|
|
@@ -12497,13 +12895,13 @@ function useWhatsAppState(props) {
|
|
|
12497
12895
|
setIsLoading(false);
|
|
12498
12896
|
}
|
|
12499
12897
|
}, [executeAction, orgId]);
|
|
12500
|
-
|
|
12898
|
+
useEffect16(() => {
|
|
12501
12899
|
loadTemplates();
|
|
12502
12900
|
}, [loadTemplates]);
|
|
12503
|
-
const selectedTemplate =
|
|
12901
|
+
const selectedTemplate = useMemo11(() => {
|
|
12504
12902
|
return templates.find((t) => t.id === selectedTemplateId) || null;
|
|
12505
12903
|
}, [templates, selectedTemplateId]);
|
|
12506
|
-
const templateBodyText =
|
|
12904
|
+
const templateBodyText = useMemo11(() => {
|
|
12507
12905
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return "";
|
|
12508
12906
|
const bodyComp = selectedTemplate.components.find(
|
|
12509
12907
|
(c) => {
|
|
@@ -12513,7 +12911,7 @@ function useWhatsAppState(props) {
|
|
|
12513
12911
|
);
|
|
12514
12912
|
return (bodyComp == null ? void 0 : bodyComp.text) || "";
|
|
12515
12913
|
}, [selectedTemplate]);
|
|
12516
|
-
const templateHeaderComp =
|
|
12914
|
+
const templateHeaderComp = useMemo11(() => {
|
|
12517
12915
|
if (!(selectedTemplate == null ? void 0 : selectedTemplate.components)) return null;
|
|
12518
12916
|
return selectedTemplate.components.find(
|
|
12519
12917
|
(c) => {
|
|
@@ -12522,8 +12920,8 @@ function useWhatsAppState(props) {
|
|
|
12522
12920
|
}
|
|
12523
12921
|
) || null;
|
|
12524
12922
|
}, [selectedTemplate]);
|
|
12525
|
-
const [headerMediaUrl, setHeaderMediaUrl] =
|
|
12526
|
-
|
|
12923
|
+
const [headerMediaUrl, setHeaderMediaUrl] = useState18("");
|
|
12924
|
+
useEffect16(() => {
|
|
12527
12925
|
if (!templateHeaderComp) {
|
|
12528
12926
|
setHeaderMediaUrl("");
|
|
12529
12927
|
return;
|
|
@@ -12573,7 +12971,7 @@ function useWhatsAppState(props) {
|
|
|
12573
12971
|
);
|
|
12574
12972
|
setHeaderMediaUrl(defaultUrl || "");
|
|
12575
12973
|
}, [templateHeaderComp, selectedTemplate == null ? void 0 : selectedTemplate.name]);
|
|
12576
|
-
const [isUploadingMedia, setIsUploadingMedia] =
|
|
12974
|
+
const [isUploadingMedia, setIsUploadingMedia] = useState18(false);
|
|
12577
12975
|
const handleFileUpload = useCallback14(
|
|
12578
12976
|
async (file, templateName) => {
|
|
12579
12977
|
const tplName = templateName || (selectedTemplate == null ? void 0 : selectedTemplate.name) || "";
|
|
@@ -12615,14 +13013,14 @@ function useWhatsAppState(props) {
|
|
|
12615
13013
|
},
|
|
12616
13014
|
[selectedTemplate == null ? void 0 : selectedTemplate.name]
|
|
12617
13015
|
);
|
|
12618
|
-
const templateVariables =
|
|
13016
|
+
const templateVariables = useMemo11(() => {
|
|
12619
13017
|
return extractTemplateVariables(selectedTemplate);
|
|
12620
13018
|
}, [selectedTemplate]);
|
|
12621
|
-
const [variableMapping, setVariableMapping] =
|
|
12622
|
-
|
|
13019
|
+
const [variableMapping, setVariableMapping] = useState18({});
|
|
13020
|
+
useEffect16(() => {
|
|
12623
13021
|
setVariableMapping({});
|
|
12624
13022
|
}, [selectedTemplateId]);
|
|
12625
|
-
const textableColumnOptions =
|
|
13023
|
+
const textableColumnOptions = useMemo11(() => {
|
|
12626
13024
|
return getTextableColumnOptions({
|
|
12627
13025
|
tableColumns: tableColumns2,
|
|
12628
13026
|
selectedPhoneOption,
|
|
@@ -12648,7 +13046,7 @@ function useWhatsAppState(props) {
|
|
|
12648
13046
|
});
|
|
12649
13047
|
});
|
|
12650
13048
|
};
|
|
12651
|
-
const existingTemplateNames =
|
|
13049
|
+
const existingTemplateNames = useMemo11(() => {
|
|
12652
13050
|
return templates.map((t) => t.name);
|
|
12653
13051
|
}, [templates]);
|
|
12654
13052
|
const handleDeleteTemplate = async () => {
|
|
@@ -12695,14 +13093,14 @@ function useWhatsAppState(props) {
|
|
|
12695
13093
|
postSendActionColumn,
|
|
12696
13094
|
postSendActionValue
|
|
12697
13095
|
);
|
|
12698
|
-
const isStaticVariableMissing =
|
|
13096
|
+
const isStaticVariableMissing = useMemo11(() => {
|
|
12699
13097
|
return isStaticVariableIncomplete(templateVariables, variableMapping);
|
|
12700
13098
|
}, [templateVariables, variableMapping]);
|
|
12701
|
-
const currentRecords =
|
|
13099
|
+
const currentRecords = useMemo11(() => {
|
|
12702
13100
|
var _a2;
|
|
12703
13101
|
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 : [];
|
|
12704
13102
|
}, [rawRecords, props.data]);
|
|
12705
|
-
const preparedRecipients =
|
|
13103
|
+
const preparedRecipients = useMemo11(() => {
|
|
12706
13104
|
return prepareRecipients({
|
|
12707
13105
|
selectedIds: selectedRowIds,
|
|
12708
13106
|
records: currentRecords,
|
|
@@ -12722,7 +13120,7 @@ function useWhatsAppState(props) {
|
|
|
12722
13120
|
selectedSubtableFilterCol
|
|
12723
13121
|
]);
|
|
12724
13122
|
const finalRecipientCount = preparedRecipients.length;
|
|
12725
|
-
const validMainRowsCount =
|
|
13123
|
+
const validMainRowsCount = useMemo11(() => {
|
|
12726
13124
|
const rowIdSet = new Set(
|
|
12727
13125
|
preparedRecipients.map((r) => r.mainRowId).filter(Boolean)
|
|
12728
13126
|
);
|
|
@@ -13137,7 +13535,7 @@ function useWhatsAppState(props) {
|
|
|
13137
13535
|
}
|
|
13138
13536
|
|
|
13139
13537
|
// src/components/WhatsAppComponent/ui/TemplateSelectionBlock.tsx
|
|
13140
|
-
import { useRef as
|
|
13538
|
+
import { useRef as useRef17 } from "react";
|
|
13141
13539
|
import {
|
|
13142
13540
|
FileText as FileText3,
|
|
13143
13541
|
Trash2 as Trash23,
|
|
@@ -13154,7 +13552,7 @@ import {
|
|
|
13154
13552
|
CheckCircle2 as CheckCircle23,
|
|
13155
13553
|
AlertCircle as AlertCircle3
|
|
13156
13554
|
} from "lucide-react";
|
|
13157
|
-
import { Fragment as Fragment5, jsx as
|
|
13555
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
13158
13556
|
function TemplateSelectionBlock({
|
|
13159
13557
|
selectedTemplate,
|
|
13160
13558
|
selectedTemplateId,
|
|
@@ -13180,16 +13578,16 @@ function TemplateSelectionBlock({
|
|
|
13180
13578
|
isUploadingMedia = false,
|
|
13181
13579
|
handleFileUpload
|
|
13182
13580
|
}) {
|
|
13183
|
-
const fileInputRef =
|
|
13184
|
-
return /* @__PURE__ */
|
|
13185
|
-
/* @__PURE__ */
|
|
13186
|
-
/* @__PURE__ */
|
|
13187
|
-
/* @__PURE__ */
|
|
13188
|
-
/* @__PURE__ */
|
|
13189
|
-
/* @__PURE__ */
|
|
13581
|
+
const fileInputRef = useRef17(null);
|
|
13582
|
+
return /* @__PURE__ */ jsxs18("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: [
|
|
13583
|
+
/* @__PURE__ */ jsxs18("div", { className: "space-y-1.5 shrink-0", children: [
|
|
13584
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between pb-1.5 border-b border-slate-200/70 shrink-0 gap-2", children: [
|
|
13585
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
13586
|
+
/* @__PURE__ */ jsx21(FileText3, { className: "w-4 h-4 text-emerald-600 shrink-0" }),
|
|
13587
|
+
/* @__PURE__ */ jsx21("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" })
|
|
13190
13588
|
] }),
|
|
13191
|
-
/* @__PURE__ */
|
|
13192
|
-
/* @__PURE__ */
|
|
13589
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1.5 shrink-0", children: [
|
|
13590
|
+
/* @__PURE__ */ jsxs18(
|
|
13193
13591
|
"button",
|
|
13194
13592
|
{
|
|
13195
13593
|
type: "button",
|
|
@@ -13198,12 +13596,12 @@ function TemplateSelectionBlock({
|
|
|
13198
13596
|
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"}`,
|
|
13199
13597
|
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}"`,
|
|
13200
13598
|
children: [
|
|
13201
|
-
isDeleting ? /* @__PURE__ */
|
|
13202
|
-
/* @__PURE__ */
|
|
13599
|
+
isDeleting ? /* @__PURE__ */ jsx21(Loader25, { className: "w-3.5 h-3.5 animate-spin text-rose-500" }) : /* @__PURE__ */ jsx21(Trash23, { className: "w-3.5 h-3.5 text-rose-500" }),
|
|
13600
|
+
/* @__PURE__ */ jsx21("span", { children: "\u05DE\u05D7\u05D9\u05E7\u05D4" })
|
|
13203
13601
|
]
|
|
13204
13602
|
}
|
|
13205
13603
|
),
|
|
13206
|
-
/* @__PURE__ */
|
|
13604
|
+
/* @__PURE__ */ jsxs18(
|
|
13207
13605
|
"button",
|
|
13208
13606
|
{
|
|
13209
13607
|
type: "button",
|
|
@@ -13211,40 +13609,40 @@ function TemplateSelectionBlock({
|
|
|
13211
13609
|
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",
|
|
13212
13610
|
title: "\u05E6\u05D5\u05E8 \u05EA\u05D1\u05E0\u05D9\u05EA \u05D7\u05D3\u05E9\u05D4",
|
|
13213
13611
|
children: [
|
|
13214
|
-
/* @__PURE__ */
|
|
13215
|
-
/* @__PURE__ */
|
|
13612
|
+
/* @__PURE__ */ jsx21(Plus2, { className: "w-3.5 h-3.5" }),
|
|
13613
|
+
/* @__PURE__ */ jsx21("span", { children: "\u05D7\u05D3\u05E9" })
|
|
13216
13614
|
]
|
|
13217
13615
|
}
|
|
13218
13616
|
)
|
|
13219
13617
|
] })
|
|
13220
13618
|
] }),
|
|
13221
|
-
/* @__PURE__ */
|
|
13222
|
-
/* @__PURE__ */
|
|
13619
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
13620
|
+
/* @__PURE__ */ jsxs18(
|
|
13223
13621
|
"button",
|
|
13224
13622
|
{
|
|
13225
13623
|
type: "button",
|
|
13226
13624
|
onClick: () => setIsDropdownOpen((prev) => !prev),
|
|
13227
13625
|
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",
|
|
13228
13626
|
children: [
|
|
13229
|
-
selectedTemplate ? /* @__PURE__ */
|
|
13230
|
-
/* @__PURE__ */
|
|
13627
|
+
selectedTemplate ? /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
13628
|
+
/* @__PURE__ */ jsx21(
|
|
13231
13629
|
"span",
|
|
13232
13630
|
{
|
|
13233
13631
|
className: `w-2 h-2 rounded-full shrink-0 ${getStatusConfig(selectedTemplate.status).dotColor}`
|
|
13234
13632
|
}
|
|
13235
13633
|
),
|
|
13236
|
-
/* @__PURE__ */
|
|
13237
|
-
/* @__PURE__ */
|
|
13634
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-semibold text-slate-900 truncate", children: selectedTemplate.name }),
|
|
13635
|
+
/* @__PURE__ */ jsxs18("span", { className: "text-[10px] text-slate-400 shrink-0", children: [
|
|
13238
13636
|
"(",
|
|
13239
13637
|
selectedTemplate.category,
|
|
13240
13638
|
" \u2022 ",
|
|
13241
13639
|
selectedTemplate.language,
|
|
13242
13640
|
")"
|
|
13243
13641
|
] })
|
|
13244
|
-
] }) : /* @__PURE__ */
|
|
13245
|
-
/* @__PURE__ */
|
|
13246
|
-
isLoadingTemplates && /* @__PURE__ */
|
|
13247
|
-
/* @__PURE__ */
|
|
13642
|
+
] }) : /* @__PURE__ */ jsx21("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..." }),
|
|
13643
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1.5 shrink-0 mr-1", children: [
|
|
13644
|
+
isLoadingTemplates && /* @__PURE__ */ jsx21(Loader25, { className: "w-3.5 h-3.5 text-emerald-600 animate-spin" }),
|
|
13645
|
+
/* @__PURE__ */ jsx21(
|
|
13248
13646
|
ChevronDown3,
|
|
13249
13647
|
{
|
|
13250
13648
|
className: `w-3.5 h-3.5 text-slate-400 transition-transform ${isDropdownOpen ? "rotate-180" : ""}`
|
|
@@ -13254,21 +13652,21 @@ function TemplateSelectionBlock({
|
|
|
13254
13652
|
]
|
|
13255
13653
|
}
|
|
13256
13654
|
),
|
|
13257
|
-
isDropdownOpen && /* @__PURE__ */
|
|
13258
|
-
/* @__PURE__ */
|
|
13655
|
+
isDropdownOpen && /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13656
|
+
/* @__PURE__ */ jsx21(
|
|
13259
13657
|
"div",
|
|
13260
13658
|
{
|
|
13261
13659
|
className: "fixed inset-0 z-40",
|
|
13262
13660
|
onClick: () => setIsDropdownOpen(false)
|
|
13263
13661
|
}
|
|
13264
13662
|
),
|
|
13265
|
-
/* @__PURE__ */
|
|
13266
|
-
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */
|
|
13663
|
+
/* @__PURE__ */ jsxs18("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: [
|
|
13664
|
+
templates.length === 0 && !isLoadingTemplates && /* @__PURE__ */ jsx21("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".' }),
|
|
13267
13665
|
templates.map((tpl) => {
|
|
13268
13666
|
const statusConfig = getStatusConfig(tpl.status);
|
|
13269
13667
|
const isSelected = tpl.id === selectedTemplateId;
|
|
13270
13668
|
const canSelect = statusConfig.isSelectable;
|
|
13271
|
-
return /* @__PURE__ */
|
|
13669
|
+
return /* @__PURE__ */ jsxs18(
|
|
13272
13670
|
"div",
|
|
13273
13671
|
{
|
|
13274
13672
|
onClick: () => {
|
|
@@ -13281,29 +13679,29 @@ function TemplateSelectionBlock({
|
|
|
13281
13679
|
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" : ""}`,
|
|
13282
13680
|
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,
|
|
13283
13681
|
children: [
|
|
13284
|
-
/* @__PURE__ */
|
|
13285
|
-
/* @__PURE__ */
|
|
13682
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 overflow-hidden", children: [
|
|
13683
|
+
/* @__PURE__ */ jsx21(
|
|
13286
13684
|
"span",
|
|
13287
13685
|
{
|
|
13288
13686
|
className: `w-2 h-2 rounded-full shrink-0 ${statusConfig.dotColor}`
|
|
13289
13687
|
}
|
|
13290
13688
|
),
|
|
13291
|
-
/* @__PURE__ */
|
|
13292
|
-
/* @__PURE__ */
|
|
13689
|
+
/* @__PURE__ */ jsxs18("div", { className: "overflow-hidden", children: [
|
|
13690
|
+
/* @__PURE__ */ jsx21(
|
|
13293
13691
|
"p",
|
|
13294
13692
|
{
|
|
13295
13693
|
className: `text-xs font-semibold truncate ${isSelected ? "text-emerald-700" : canSelect ? "text-slate-800" : "text-slate-500"}`,
|
|
13296
13694
|
children: tpl.name
|
|
13297
13695
|
}
|
|
13298
13696
|
),
|
|
13299
|
-
/* @__PURE__ */
|
|
13697
|
+
/* @__PURE__ */ jsxs18("p", { className: "text-[10px] text-slate-400", children: [
|
|
13300
13698
|
tpl.category,
|
|
13301
13699
|
" \u2022 ",
|
|
13302
13700
|
tpl.language
|
|
13303
13701
|
] })
|
|
13304
13702
|
] })
|
|
13305
13703
|
] }),
|
|
13306
|
-
/* @__PURE__ */
|
|
13704
|
+
/* @__PURE__ */ jsx21(
|
|
13307
13705
|
"span",
|
|
13308
13706
|
{
|
|
13309
13707
|
className: `text-[9px] font-semibold px-2 py-0.5 rounded-full border shrink-0 ${statusConfig.badgeBg} ${statusConfig.badgeText}`,
|
|
@@ -13319,18 +13717,18 @@ function TemplateSelectionBlock({
|
|
|
13319
13717
|
] })
|
|
13320
13718
|
] })
|
|
13321
13719
|
] }),
|
|
13322
|
-
/* @__PURE__ */
|
|
13323
|
-
/* @__PURE__ */
|
|
13324
|
-
/* @__PURE__ */
|
|
13325
|
-
selectedTemplate && /* @__PURE__ */
|
|
13720
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1 min-h-0 flex flex-col gap-2", children: [
|
|
13721
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between text-[11px] font-semibold text-slate-600 shrink-0", children: [
|
|
13722
|
+
/* @__PURE__ */ jsx21("span", { children: "\u05EA\u05E6\u05D5\u05D2\u05EA \u05D4\u05D5\u05D3\u05E2\u05D4" }),
|
|
13723
|
+
selectedTemplate && /* @__PURE__ */ jsxs18("span", { className: "text-[10px] text-slate-400", children: [
|
|
13326
13724
|
"(",
|
|
13327
13725
|
templateBodyText.length,
|
|
13328
13726
|
" \u05EA\u05D5\u05D5\u05D9\u05DD)"
|
|
13329
13727
|
] })
|
|
13330
13728
|
] }),
|
|
13331
|
-
selectedTemplate ? /* @__PURE__ */
|
|
13332
|
-
/* @__PURE__ */
|
|
13333
|
-
/* @__PURE__ */
|
|
13729
|
+
selectedTemplate ? /* @__PURE__ */ jsx21("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__ */ jsxs18("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: [
|
|
13730
|
+
/* @__PURE__ */ jsx21("span", { children: "\u05DC\u05D0 \u05E0\u05D1\u05D7\u05E8\u05D4 \u05EA\u05D1\u05E0\u05D9\u05EA" }),
|
|
13731
|
+
/* @__PURE__ */ jsx21("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"' })
|
|
13334
13732
|
] }),
|
|
13335
13733
|
selectedTemplate && (() => {
|
|
13336
13734
|
var _a;
|
|
@@ -13339,19 +13737,19 @@ function TemplateSelectionBlock({
|
|
|
13339
13737
|
);
|
|
13340
13738
|
const tplButtons = (buttonsComp == null ? void 0 : buttonsComp.buttons) || [];
|
|
13341
13739
|
if (!tplButtons || tplButtons.length === 0) return null;
|
|
13342
|
-
return /* @__PURE__ */
|
|
13740
|
+
return /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1.5 shrink-0 pt-0.5", children: tplButtons.map((btn, idx) => {
|
|
13343
13741
|
const btnType = (btn.type || "").toUpperCase();
|
|
13344
13742
|
const btnText = btn.text || (btnType === "COPY_CODE" ? `\u05D4\u05E2\u05EA\u05E7 \u05E7\u05D5\u05D3: ${btn.example}` : "\u05DB\u05E4\u05EA\u05D5\u05E8");
|
|
13345
|
-
return /* @__PURE__ */
|
|
13743
|
+
return /* @__PURE__ */ jsxs18(
|
|
13346
13744
|
"div",
|
|
13347
13745
|
{
|
|
13348
13746
|
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",
|
|
13349
13747
|
children: [
|
|
13350
|
-
btnType === "QUICK_REPLY" && /* @__PURE__ */
|
|
13351
|
-
btnType === "URL" && /* @__PURE__ */
|
|
13352
|
-
btnType === "PHONE_NUMBER" && /* @__PURE__ */
|
|
13353
|
-
btnType === "COPY_CODE" && /* @__PURE__ */
|
|
13354
|
-
/* @__PURE__ */
|
|
13748
|
+
btnType === "QUICK_REPLY" && /* @__PURE__ */ jsx21(MessageSquare2, { className: "w-3 h-3 text-emerald-600" }),
|
|
13749
|
+
btnType === "URL" && /* @__PURE__ */ jsx21(ExternalLink4, { className: "w-3 h-3 text-sky-600" }),
|
|
13750
|
+
btnType === "PHONE_NUMBER" && /* @__PURE__ */ jsx21(Phone2, { className: "w-3 h-3 text-violet-600" }),
|
|
13751
|
+
btnType === "COPY_CODE" && /* @__PURE__ */ jsx21(Copy4, { className: "w-3 h-3 text-amber-600" }),
|
|
13752
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate max-w-[180px]", children: btnText })
|
|
13355
13753
|
]
|
|
13356
13754
|
},
|
|
13357
13755
|
idx
|
|
@@ -13366,9 +13764,9 @@ function TemplateSelectionBlock({
|
|
|
13366
13764
|
const docFilename = resolveDocumentFilename(templateHeaderComp, headerMediaUrl);
|
|
13367
13765
|
const hasValidMedia = Boolean(headerMediaUrl && headerMediaUrl.trim() && headerMediaUrl.startsWith("http"));
|
|
13368
13766
|
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";
|
|
13369
|
-
return /* @__PURE__ */
|
|
13370
|
-
/* @__PURE__ */
|
|
13371
|
-
/* @__PURE__ */
|
|
13767
|
+
return /* @__PURE__ */ jsxs18("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: [
|
|
13768
|
+
/* @__PURE__ */ jsx21("div", { className: "flex items-center gap-2.5 overflow-hidden", children: headerFormat === "IMAGE" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13769
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21(
|
|
13372
13770
|
"img",
|
|
13373
13771
|
{
|
|
13374
13772
|
src: headerMediaUrl,
|
|
@@ -13378,33 +13776,33 @@ function TemplateSelectionBlock({
|
|
|
13378
13776
|
e.currentTarget.style.display = "none";
|
|
13379
13777
|
}
|
|
13380
13778
|
}
|
|
13381
|
-
) : /* @__PURE__ */
|
|
13382
|
-
/* @__PURE__ */
|
|
13383
|
-
/* @__PURE__ */
|
|
13384
|
-
/* @__PURE__ */
|
|
13779
|
+
) : /* @__PURE__ */ jsx21(ImageIcon2, { className: "w-4 h-4 text-amber-600" }) }),
|
|
13780
|
+
/* @__PURE__ */ jsxs18("div", { className: "overflow-hidden", children: [
|
|
13781
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05EA\u05DE\u05D5\u05E0\u05EA \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
13782
|
+
/* @__PURE__ */ jsx21("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" })
|
|
13385
13783
|
] })
|
|
13386
|
-
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */
|
|
13387
|
-
/* @__PURE__ */
|
|
13388
|
-
/* @__PURE__ */
|
|
13389
|
-
/* @__PURE__ */
|
|
13390
|
-
/* @__PURE__ */
|
|
13784
|
+
] }) : headerFormat === "DOCUMENT" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13785
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21(FileText3, { className: "w-4 h-4" }) }),
|
|
13786
|
+
/* @__PURE__ */ jsxs18("div", { className: "overflow-hidden", children: [
|
|
13787
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05DE\u05E1\u05DE\u05DA \u05DB\u05D5\u05EA\u05E8\u05EA (PDF)" }),
|
|
13788
|
+
/* @__PURE__ */ jsx21("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" })
|
|
13391
13789
|
] })
|
|
13392
|
-
] }) : /* @__PURE__ */
|
|
13393
|
-
/* @__PURE__ */
|
|
13394
|
-
/* @__PURE__ */
|
|
13395
|
-
/* @__PURE__ */
|
|
13396
|
-
/* @__PURE__ */
|
|
13790
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13791
|
+
/* @__PURE__ */ jsx21("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__ */ jsx21(Video2, { className: "w-4 h-4" }) }),
|
|
13792
|
+
/* @__PURE__ */ jsxs18("div", { className: "overflow-hidden", children: [
|
|
13793
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-bold text-slate-800 block truncate", children: "\u05E1\u05E8\u05D8\u05D5\u05DF \u05DB\u05D5\u05EA\u05E8\u05EA" }),
|
|
13794
|
+
/* @__PURE__ */ jsx21("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" })
|
|
13397
13795
|
] })
|
|
13398
13796
|
] }) }),
|
|
13399
|
-
/* @__PURE__ */
|
|
13400
|
-
hasValidMedia ? /* @__PURE__ */
|
|
13401
|
-
/* @__PURE__ */
|
|
13797
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
13798
|
+
hasValidMedia ? /* @__PURE__ */ jsxs18("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: [
|
|
13799
|
+
/* @__PURE__ */ jsx21(CheckCircle23, { className: "w-3 h-3 text-emerald-600" }),
|
|
13402
13800
|
"\u05E7\u05D5\u05D1\u05E5 \u05DE\u05E6\u05D5\u05E8\u05E3 \u05EA\u05E7\u05D9\u05DF"
|
|
13403
|
-
] }) : /* @__PURE__ */
|
|
13404
|
-
/* @__PURE__ */
|
|
13801
|
+
] }) : /* @__PURE__ */ jsxs18("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: [
|
|
13802
|
+
/* @__PURE__ */ jsx21(AlertCircle3, { className: "w-3 h-3 text-amber-600 shrink-0" }),
|
|
13405
13803
|
"\u05E0\u05D3\u05E8\u05E9 \u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D5\u05D1\u05E5 \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D6\u05D5"
|
|
13406
13804
|
] }),
|
|
13407
|
-
hasValidMedia && /* @__PURE__ */
|
|
13805
|
+
hasValidMedia && /* @__PURE__ */ jsx21(
|
|
13408
13806
|
"a",
|
|
13409
13807
|
{
|
|
13410
13808
|
href: headerMediaUrl,
|
|
@@ -13412,10 +13810,10 @@ function TemplateSelectionBlock({
|
|
|
13412
13810
|
rel: "noopener noreferrer",
|
|
13413
13811
|
title: "\u05EA\u05E6\u05D5\u05D2\u05D4 \u05DE\u05E7\u05D3\u05D9\u05DE\u05D4 \u05E9\u05DC \u05D4\u05E7\u05D5\u05D1\u05E5",
|
|
13414
13812
|
className: "p-1 text-slate-400 hover:text-emerald-700 hover:bg-slate-200/60 rounded-md transition-colors",
|
|
13415
|
-
children: /* @__PURE__ */
|
|
13813
|
+
children: /* @__PURE__ */ jsx21(ExternalLink4, { className: "w-3.5 h-3.5" })
|
|
13416
13814
|
}
|
|
13417
13815
|
),
|
|
13418
|
-
/* @__PURE__ */
|
|
13816
|
+
/* @__PURE__ */ jsx21(
|
|
13419
13817
|
"input",
|
|
13420
13818
|
{
|
|
13421
13819
|
ref: fileInputRef,
|
|
@@ -13433,7 +13831,7 @@ function TemplateSelectionBlock({
|
|
|
13433
13831
|
disabled: isUploadingMedia
|
|
13434
13832
|
}
|
|
13435
13833
|
),
|
|
13436
|
-
/* @__PURE__ */
|
|
13834
|
+
/* @__PURE__ */ jsx21(
|
|
13437
13835
|
"button",
|
|
13438
13836
|
{
|
|
13439
13837
|
type: "button",
|
|
@@ -13444,39 +13842,39 @@ function TemplateSelectionBlock({
|
|
|
13444
13842
|
},
|
|
13445
13843
|
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"}`,
|
|
13446
13844
|
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`,
|
|
13447
|
-
children: isUploadingMedia ? /* @__PURE__ */
|
|
13448
|
-
/* @__PURE__ */
|
|
13449
|
-
/* @__PURE__ */
|
|
13450
|
-
] }) : /* @__PURE__ */
|
|
13451
|
-
/* @__PURE__ */
|
|
13452
|
-
/* @__PURE__ */
|
|
13845
|
+
children: isUploadingMedia ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13846
|
+
/* @__PURE__ */ jsx21(Loader25, { className: "w-3.5 h-3.5 animate-spin" }),
|
|
13847
|
+
/* @__PURE__ */ jsx21("span", { children: "\u05DE\u05E2\u05DC\u05D4..." })
|
|
13848
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
13849
|
+
/* @__PURE__ */ jsx21(Upload3, { className: "w-3.5 h-3.5" }),
|
|
13850
|
+
/* @__PURE__ */ jsx21("span", { children: hasValidMedia ? "\u05D4\u05D7\u05DC\u05E3 \u05E7\u05D5\u05D1\u05E5" : uploadButtonLabel })
|
|
13453
13851
|
] })
|
|
13454
13852
|
}
|
|
13455
13853
|
)
|
|
13456
13854
|
] })
|
|
13457
13855
|
] });
|
|
13458
13856
|
})(),
|
|
13459
|
-
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */
|
|
13460
|
-
/* @__PURE__ */
|
|
13461
|
-
/* @__PURE__ */
|
|
13462
|
-
/* @__PURE__ */
|
|
13857
|
+
selectedTemplate && templateVariables.length > 0 && /* @__PURE__ */ jsxs18("div", { className: "shrink-0 flex flex-col gap-1.5 pt-2 border-t border-slate-200/80 pb-0", children: [
|
|
13858
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between shrink-0", children: [
|
|
13859
|
+
/* @__PURE__ */ jsx21("span", { className: "text-[11px] font-bold text-slate-700", children: "\u05DE\u05D9\u05E4\u05D5\u05D9 \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD" }),
|
|
13860
|
+
/* @__PURE__ */ jsxs18("span", { className: "text-[9px] font-semibold text-emerald-700 bg-emerald-50 px-1.5 py-0.5 rounded border border-emerald-200", children: [
|
|
13463
13861
|
templateVariables.length,
|
|
13464
13862
|
" \u05DE\u05E9\u05EA\u05E0\u05D9\u05DD"
|
|
13465
13863
|
] })
|
|
13466
13864
|
] }),
|
|
13467
|
-
/* @__PURE__ */
|
|
13865
|
+
/* @__PURE__ */ jsx21("div", { className: "max-h-48 overflow-y-auto space-y-1.5 pr-0.5", children: templateVariables.map((varKey) => {
|
|
13468
13866
|
var _a;
|
|
13469
13867
|
const mapping = variableMapping[varKey] || { type: "column", value: "" };
|
|
13470
13868
|
const isStatic = mapping.type === "static";
|
|
13471
13869
|
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 || "";
|
|
13472
|
-
return /* @__PURE__ */
|
|
13870
|
+
return /* @__PURE__ */ jsxs18(
|
|
13473
13871
|
"div",
|
|
13474
13872
|
{
|
|
13475
13873
|
className: "flex items-center gap-1.5 p-1 bg-white border border-slate-200 rounded-xl text-xs shrink-0",
|
|
13476
13874
|
children: [
|
|
13477
|
-
/* @__PURE__ */
|
|
13478
|
-
/* @__PURE__ */
|
|
13479
|
-
/* @__PURE__ */
|
|
13875
|
+
/* @__PURE__ */ jsx21("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}}}` }),
|
|
13876
|
+
/* @__PURE__ */ jsxs18("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: [
|
|
13877
|
+
/* @__PURE__ */ jsx21(
|
|
13480
13878
|
"button",
|
|
13481
13879
|
{
|
|
13482
13880
|
type: "button",
|
|
@@ -13485,7 +13883,7 @@ function TemplateSelectionBlock({
|
|
|
13485
13883
|
children: "\u05E2\u05DE\u05D5\u05D3\u05D4"
|
|
13486
13884
|
}
|
|
13487
13885
|
),
|
|
13488
|
-
/* @__PURE__ */
|
|
13886
|
+
/* @__PURE__ */ jsx21(
|
|
13489
13887
|
"button",
|
|
13490
13888
|
{
|
|
13491
13889
|
type: "button",
|
|
@@ -13495,7 +13893,7 @@ function TemplateSelectionBlock({
|
|
|
13495
13893
|
}
|
|
13496
13894
|
)
|
|
13497
13895
|
] }),
|
|
13498
|
-
isStatic ? /* @__PURE__ */
|
|
13896
|
+
isStatic ? /* @__PURE__ */ jsx21(
|
|
13499
13897
|
"input",
|
|
13500
13898
|
{
|
|
13501
13899
|
type: "text",
|
|
@@ -13504,20 +13902,20 @@ function TemplateSelectionBlock({
|
|
|
13504
13902
|
placeholder: "\u05D4\u05D6\u05DF \u05E2\u05E8\u05DA \u05E7\u05D1\u05D5\u05E2 (\u05D7\u05D5\u05D1\u05D4)...",
|
|
13505
13903
|
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"}`
|
|
13506
13904
|
}
|
|
13507
|
-
) : /* @__PURE__ */
|
|
13508
|
-
/* @__PURE__ */
|
|
13905
|
+
) : /* @__PURE__ */ jsxs18("div", { className: "relative flex-1 min-w-0", children: [
|
|
13906
|
+
/* @__PURE__ */ jsxs18(
|
|
13509
13907
|
"select",
|
|
13510
13908
|
{
|
|
13511
13909
|
value: selectedColVal,
|
|
13512
13910
|
onChange: (e) => handleVariableValueChange(varKey, e.target.value),
|
|
13513
13911
|
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",
|
|
13514
13912
|
children: [
|
|
13515
|
-
/* @__PURE__ */
|
|
13516
|
-
textableColumnOptions.map((opt) => /* @__PURE__ */
|
|
13913
|
+
/* @__PURE__ */ jsx21("option", { value: "", children: "\u05D1\u05D7\u05E8 \u05E2\u05DE\u05D5\u05D3\u05D4..." }),
|
|
13914
|
+
textableColumnOptions.map((opt) => /* @__PURE__ */ jsx21("option", { value: opt.id, children: opt.label }, opt.id))
|
|
13517
13915
|
]
|
|
13518
13916
|
}
|
|
13519
13917
|
),
|
|
13520
|
-
/* @__PURE__ */
|
|
13918
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
13521
13919
|
] })
|
|
13522
13920
|
]
|
|
13523
13921
|
},
|
|
@@ -13531,13 +13929,13 @@ function TemplateSelectionBlock({
|
|
|
13531
13929
|
|
|
13532
13930
|
// src/components/WhatsAppComponent/ui/DynamicFiltersBlock.tsx
|
|
13533
13931
|
import {
|
|
13534
|
-
Filter as
|
|
13932
|
+
Filter as Filter3,
|
|
13535
13933
|
X as X10,
|
|
13536
13934
|
ChevronDown as ChevronDown4,
|
|
13537
13935
|
CheckSquare,
|
|
13538
13936
|
RefreshCw
|
|
13539
13937
|
} from "lucide-react";
|
|
13540
|
-
import { Fragment as Fragment6, jsx as
|
|
13938
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
13541
13939
|
function DynamicFiltersBlock({
|
|
13542
13940
|
filterableColumns,
|
|
13543
13941
|
filters,
|
|
@@ -13552,31 +13950,31 @@ function DynamicFiltersBlock({
|
|
|
13552
13950
|
loadTableData,
|
|
13553
13951
|
isLoadingTableData
|
|
13554
13952
|
}) {
|
|
13555
|
-
return /* @__PURE__ */
|
|
13556
|
-
/* @__PURE__ */
|
|
13557
|
-
/* @__PURE__ */
|
|
13558
|
-
/* @__PURE__ */
|
|
13559
|
-
/* @__PURE__ */
|
|
13560
|
-
/* @__PURE__ */
|
|
13561
|
-
activeFiltersCount > 0 && /* @__PURE__ */
|
|
13953
|
+
return /* @__PURE__ */ jsxs19("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: [
|
|
13954
|
+
/* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
|
|
13955
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
13956
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
|
|
13957
|
+
/* @__PURE__ */ jsx22(Filter3, { className: "w-4 h-4 text-emerald-600" }),
|
|
13958
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05D3\u05D9\u05E0\u05DE\u05D9" }),
|
|
13959
|
+
activeFiltersCount > 0 && /* @__PURE__ */ jsx22("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 })
|
|
13562
13960
|
] }),
|
|
13563
|
-
activeFiltersCount > 0 && /* @__PURE__ */
|
|
13961
|
+
activeFiltersCount > 0 && /* @__PURE__ */ jsxs19(
|
|
13564
13962
|
"button",
|
|
13565
13963
|
{
|
|
13566
13964
|
type: "button",
|
|
13567
13965
|
onClick: handleClearFilters,
|
|
13568
13966
|
className: "text-[11px] text-rose-600 hover:text-rose-700 font-semibold hover:underline flex items-center gap-1 cursor-pointer",
|
|
13569
13967
|
children: [
|
|
13570
|
-
/* @__PURE__ */
|
|
13571
|
-
/* @__PURE__ */
|
|
13968
|
+
/* @__PURE__ */ jsx22(X10, { className: "w-3 h-3" }),
|
|
13969
|
+
/* @__PURE__ */ jsx22("span", { children: "\u05E0\u05E7\u05D4" })
|
|
13572
13970
|
]
|
|
13573
13971
|
}
|
|
13574
13972
|
)
|
|
13575
13973
|
] }),
|
|
13576
|
-
/* @__PURE__ */
|
|
13577
|
-
/* @__PURE__ */
|
|
13578
|
-
/* @__PURE__ */
|
|
13579
|
-
] }) : /* @__PURE__ */
|
|
13974
|
+
/* @__PURE__ */ jsx22("div", { className: "py-1", children: filterableColumns.length === 0 ? /* @__PURE__ */ jsxs19("div", { className: "flex flex-col items-center justify-center text-center p-4 text-xs text-slate-400 gap-1", children: [
|
|
13975
|
+
/* @__PURE__ */ jsx22("span", { children: "\u05D0\u05D9\u05DF \u05E9\u05D3\u05D5\u05EA \u05DC\u05E1\u05D9\u05E0\u05D5\u05DF \u05D1\u05D8\u05D1\u05DC\u05D4 \u05D6\u05D5" }),
|
|
13976
|
+
/* @__PURE__ */ jsx22("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" })
|
|
13977
|
+
] }) : /* @__PURE__ */ jsx22("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-2", children: filterableColumns.map((col) => {
|
|
13580
13978
|
var _a, _b, _c;
|
|
13581
13979
|
const colType = (_a = col.type) == null ? void 0 : _a.toUpperCase();
|
|
13582
13980
|
const isBoolean = colType === "BOOLEAN";
|
|
@@ -13584,9 +13982,9 @@ function DynamicFiltersBlock({
|
|
|
13584
13982
|
const isActive = Boolean(currentValue);
|
|
13585
13983
|
const refTableId = ((_b = col == null ? void 0 : col.config) == null ? void 0 : _b.referencedTableId) || (col == null ? void 0 : col.referencedTableId);
|
|
13586
13984
|
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] : [];
|
|
13587
|
-
return /* @__PURE__ */
|
|
13588
|
-
/* @__PURE__ */
|
|
13589
|
-
/* @__PURE__ */
|
|
13985
|
+
return /* @__PURE__ */ jsxs19("div", { className: "space-y-1", children: [
|
|
13986
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between", children: [
|
|
13987
|
+
/* @__PURE__ */ jsx22(
|
|
13590
13988
|
"label",
|
|
13591
13989
|
{
|
|
13592
13990
|
className: "text-[11px] font-semibold text-slate-700 truncate max-w-[130px]",
|
|
@@ -13594,49 +13992,49 @@ function DynamicFiltersBlock({
|
|
|
13594
13992
|
children: col.name
|
|
13595
13993
|
}
|
|
13596
13994
|
),
|
|
13597
|
-
/* @__PURE__ */
|
|
13995
|
+
/* @__PURE__ */ jsx22("span", { className: "text-[9px] text-slate-400 font-mono", children: isBoolean ? "\u05DB\u05DF/\u05DC\u05D0" : "\u05E7\u05E9\u05E8" })
|
|
13598
13996
|
] }),
|
|
13599
|
-
/* @__PURE__ */
|
|
13600
|
-
/* @__PURE__ */
|
|
13997
|
+
/* @__PURE__ */ jsxs19("div", { className: "relative", children: [
|
|
13998
|
+
/* @__PURE__ */ jsxs19(
|
|
13601
13999
|
"select",
|
|
13602
14000
|
{
|
|
13603
14001
|
value: currentValue,
|
|
13604
14002
|
onChange: (e) => handleFilterChange(col.name, e.target.value),
|
|
13605
14003
|
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"}`,
|
|
13606
14004
|
children: [
|
|
13607
|
-
/* @__PURE__ */
|
|
13608
|
-
isBoolean ? /* @__PURE__ */
|
|
13609
|
-
/* @__PURE__ */
|
|
13610
|
-
/* @__PURE__ */
|
|
13611
|
-
] }) : options.map((opt) => /* @__PURE__ */
|
|
14005
|
+
/* @__PURE__ */ jsx22("option", { value: "", children: "\u05D4\u05DB\u05DC" }),
|
|
14006
|
+
isBoolean ? /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
14007
|
+
/* @__PURE__ */ jsx22("option", { value: "true", children: "\u05DB\u05DF" }),
|
|
14008
|
+
/* @__PURE__ */ jsx22("option", { value: "false", children: "\u05DC\u05D0" })
|
|
14009
|
+
] }) : options.map((opt) => /* @__PURE__ */ jsx22("option", { value: opt.id || opt._id, children: getRelationOptionLabel(opt, col, relationOptions) }, opt.id || opt._id))
|
|
13612
14010
|
]
|
|
13613
14011
|
}
|
|
13614
14012
|
),
|
|
13615
|
-
/* @__PURE__ */
|
|
14013
|
+
/* @__PURE__ */ jsx22(ChevronDown4, { className: "w-3 h-3 text-slate-400 absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
13616
14014
|
] })
|
|
13617
14015
|
] }, col.name);
|
|
13618
14016
|
}) }) })
|
|
13619
14017
|
] }),
|
|
13620
|
-
/* @__PURE__ */
|
|
13621
|
-
/* @__PURE__ */
|
|
14018
|
+
/* @__PURE__ */ jsxs19("div", { className: "pt-2.5 mt-2 border-t border-slate-200/80 flex items-center justify-between gap-1.5 shrink-0", children: [
|
|
14019
|
+
/* @__PURE__ */ jsxs19(
|
|
13622
14020
|
"div",
|
|
13623
14021
|
{
|
|
13624
14022
|
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"}`,
|
|
13625
14023
|
children: [
|
|
13626
|
-
/* @__PURE__ */
|
|
14024
|
+
/* @__PURE__ */ jsx22(
|
|
13627
14025
|
CheckSquare,
|
|
13628
14026
|
{
|
|
13629
14027
|
className: `w-3 h-3 ${selectedRowIds.length > 0 ? "text-emerald-600" : "text-slate-400"}`
|
|
13630
14028
|
}
|
|
13631
14029
|
),
|
|
13632
|
-
/* @__PURE__ */
|
|
14030
|
+
/* @__PURE__ */ jsxs19("span", { children: [
|
|
13633
14031
|
"\u05E0\u05D1\u05D7\u05E8\u05D5 ",
|
|
13634
14032
|
selectedRowIds.length
|
|
13635
14033
|
] })
|
|
13636
14034
|
]
|
|
13637
14035
|
}
|
|
13638
14036
|
),
|
|
13639
|
-
/* @__PURE__ */
|
|
14037
|
+
/* @__PURE__ */ jsx22(
|
|
13640
14038
|
"button",
|
|
13641
14039
|
{
|
|
13642
14040
|
type: "button",
|
|
@@ -13644,7 +14042,7 @@ function DynamicFiltersBlock({
|
|
|
13644
14042
|
disabled: isLoadingTableData,
|
|
13645
14043
|
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",
|
|
13646
14044
|
title: "\u05E8\u05E2\u05E0\u05DF \u05E0\u05EA\u05D5\u05E0\u05D9 \u05D8\u05D1\u05DC\u05D4",
|
|
13647
|
-
children: /* @__PURE__ */
|
|
14045
|
+
children: /* @__PURE__ */ jsx22(
|
|
13648
14046
|
RefreshCw,
|
|
13649
14047
|
{
|
|
13650
14048
|
className: `w-3.5 h-3.5 ${isLoadingTableData ? "animate-spin text-emerald-600" : ""}`
|
|
@@ -13656,85 +14054,6 @@ function DynamicFiltersBlock({
|
|
|
13656
14054
|
] });
|
|
13657
14055
|
}
|
|
13658
14056
|
|
|
13659
|
-
// src/components/WhatsAppComponent/ui/WhatsAppRelationButtons.tsx
|
|
13660
|
-
import { useMemo as useMemo11 } from "react";
|
|
13661
|
-
import { Zap } from "lucide-react";
|
|
13662
|
-
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
13663
|
-
var isRawObjectId3 = (s) => /^[0-9a-fA-F]{24}$/.test(s);
|
|
13664
|
-
function recordMatches(record, colDef, filterVal) {
|
|
13665
|
-
var _a;
|
|
13666
|
-
if (!colDef) return true;
|
|
13667
|
-
const cell = ((record == null ? void 0 : record.data) || {})[colDef.name];
|
|
13668
|
-
const type = (_a = colDef.type) == null ? void 0 : _a.toUpperCase();
|
|
13669
|
-
if (type === "BOOLEAN") {
|
|
13670
|
-
const isTrue = cell === true || cell === "true" || cell === 1;
|
|
13671
|
-
return isTrue === (filterVal === "true");
|
|
13672
|
-
}
|
|
13673
|
-
if (type === "RELATION") {
|
|
13674
|
-
return normalizeRelationValue(cell).includes(filterVal);
|
|
13675
|
-
}
|
|
13676
|
-
return true;
|
|
13677
|
-
}
|
|
13678
|
-
function WhatsAppRelationButtons({
|
|
13679
|
-
columnNames,
|
|
13680
|
-
tableColumns: tableColumns2,
|
|
13681
|
-
records,
|
|
13682
|
-
filters,
|
|
13683
|
-
onFilterChange,
|
|
13684
|
-
relationOptions,
|
|
13685
|
-
getRelationOptionsForCol
|
|
13686
|
-
}) {
|
|
13687
|
-
const groups = useMemo11(() => {
|
|
13688
|
-
var _a, _b;
|
|
13689
|
-
const activeEntries = Object.entries(filters).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
13690
|
-
const result = [];
|
|
13691
|
-
for (const colName of columnNames || []) {
|
|
13692
|
-
const colDef = (tableColumns2 || []).find((c) => c.name === colName);
|
|
13693
|
-
if (!colDef || ((_a = colDef.type) == null ? void 0 : _a.toUpperCase()) !== "RELATION") continue;
|
|
13694
|
-
const otherEntries = activeEntries.filter(([name]) => name !== colName);
|
|
13695
|
-
const base = otherEntries.length === 0 ? records : records.filter(
|
|
13696
|
-
(rec) => otherEntries.every(
|
|
13697
|
-
([name, val]) => recordMatches(rec, (tableColumns2 || []).find((c) => c.name === name), val)
|
|
13698
|
-
)
|
|
13699
|
-
);
|
|
13700
|
-
const counts = /* @__PURE__ */ new Map();
|
|
13701
|
-
for (const rec of base) {
|
|
13702
|
-
const ids = new Set(normalizeRelationValue(((rec == null ? void 0 : rec.data) || {})[colName]));
|
|
13703
|
-
ids.forEach((id) => counts.set(id, (counts.get(id) || 0) + 1));
|
|
13704
|
-
}
|
|
13705
|
-
const optionList = ((_b = getRelationOptionsForCol ? getRelationOptionsForCol(colName) : []) == null ? void 0 : _b.length) > 0 ? getRelationOptionsForCol(colName) : relationOptions[colName] || [];
|
|
13706
|
-
const activeId = filters[colName] ? String(filters[colName]) : null;
|
|
13707
|
-
const seen = /* @__PURE__ */ new Set();
|
|
13708
|
-
const options = [];
|
|
13709
|
-
for (const opt of optionList) {
|
|
13710
|
-
const id = String((opt == null ? void 0 : opt.id) || (opt == null ? void 0 : opt._id) || "");
|
|
13711
|
-
if (!id || seen.has(id)) continue;
|
|
13712
|
-
const count = counts.get(id) || 0;
|
|
13713
|
-
if (count === 0 && id !== activeId) continue;
|
|
13714
|
-
seen.add(id);
|
|
13715
|
-
options.push({ id, label: getRelationOptionLabel(opt, colDef, relationOptions), count });
|
|
13716
|
-
}
|
|
13717
|
-
counts.forEach((count, id) => {
|
|
13718
|
-
if (seen.has(id)) return;
|
|
13719
|
-
const label = getRelationOptionLabel(id, colDef, relationOptions);
|
|
13720
|
-
if (!label || isRawObjectId3(label)) return;
|
|
13721
|
-
seen.add(id);
|
|
13722
|
-
options.push({ id, label, count });
|
|
13723
|
-
});
|
|
13724
|
-
result.push({ key: colName, title: colName, options, activeId });
|
|
13725
|
-
}
|
|
13726
|
-
return result;
|
|
13727
|
-
}, [columnNames, tableColumns2, records, filters, relationOptions, getRelationOptionsForCol]);
|
|
13728
|
-
if (!columnNames || columnNames.length === 0) return null;
|
|
13729
|
-
return /* @__PURE__ */ jsx22("div", { className: "relative min-h-[12rem] 2xl:min-h-0", "data-testid": "whatsapp-relation-buttons", children: /* @__PURE__ */ jsxs19("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: [
|
|
13730
|
-
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 pb-2 border-b border-slate-200/70 shrink-0", children: [
|
|
13731
|
-
/* @__PURE__ */ jsx22(Zap, { className: "w-4 h-4 text-emerald-600" }),
|
|
13732
|
-
/* @__PURE__ */ jsx22("span", { className: "text-xs font-bold text-slate-800", children: "\u05E1\u05D9\u05E0\u05D5\u05DF \u05DE\u05D4\u05D9\u05E8" })
|
|
13733
|
-
] }),
|
|
13734
|
-
/* @__PURE__ */ jsx22("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__ */ jsx22("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__ */ jsx22(RelationButtonsView, { groups, stacked: true, onSelect: (col, id) => onFilterChange(col, id || "") }) })
|
|
13735
|
-
] }) });
|
|
13736
|
-
}
|
|
13737
|
-
|
|
13738
14057
|
// src/components/WhatsAppComponent/ui/SettingsAndActionsBlock.tsx
|
|
13739
14058
|
import {
|
|
13740
14059
|
Phone as Phone3,
|
|
@@ -14226,16 +14545,16 @@ function SettingsAndActionsBlock({
|
|
|
14226
14545
|
}
|
|
14227
14546
|
|
|
14228
14547
|
// src/components/WhatsAppComponent/inbox/useInboxState.ts
|
|
14229
|
-
import { useState as
|
|
14548
|
+
import { useState as useState19, useEffect as useEffect17, useCallback as useCallback15, useRef as useRef18 } from "react";
|
|
14230
14549
|
function useInboxState(orgId, actions) {
|
|
14231
|
-
const [conversations, setConversations] =
|
|
14232
|
-
const [activeConversationId, setActiveConversationId] =
|
|
14233
|
-
const [messages, setMessages] =
|
|
14234
|
-
const [isLoading, setIsLoading] =
|
|
14235
|
-
const [isSending, setIsSending] =
|
|
14236
|
-
const [error, setError] =
|
|
14237
|
-
const actionsRef =
|
|
14238
|
-
|
|
14550
|
+
const [conversations, setConversations] = useState19([]);
|
|
14551
|
+
const [activeConversationId, setActiveConversationId] = useState19(null);
|
|
14552
|
+
const [messages, setMessages] = useState19([]);
|
|
14553
|
+
const [isLoading, setIsLoading] = useState19(false);
|
|
14554
|
+
const [isSending, setIsSending] = useState19(false);
|
|
14555
|
+
const [error, setError] = useState19(null);
|
|
14556
|
+
const actionsRef = useRef18(actions);
|
|
14557
|
+
useEffect17(() => {
|
|
14239
14558
|
actionsRef.current = actions;
|
|
14240
14559
|
});
|
|
14241
14560
|
const fetchConversations = useCallback15(async () => {
|
|
@@ -14260,7 +14579,7 @@ function useInboxState(orgId, actions) {
|
|
|
14260
14579
|
}
|
|
14261
14580
|
if (!silent) setIsLoading(false);
|
|
14262
14581
|
}, []);
|
|
14263
|
-
|
|
14582
|
+
useEffect17(() => {
|
|
14264
14583
|
fetchConversations();
|
|
14265
14584
|
const interval = setInterval(() => {
|
|
14266
14585
|
fetchConversations();
|
|
@@ -14359,17 +14678,17 @@ function ConversationList({ conversations, activeId, onSelect }) {
|
|
|
14359
14678
|
}
|
|
14360
14679
|
|
|
14361
14680
|
// src/components/WhatsAppComponent/inbox/ChatWindow.tsx
|
|
14362
|
-
import { useState as
|
|
14681
|
+
import { useState as useState20, useRef as useRef19, useEffect as useEffect18 } from "react";
|
|
14363
14682
|
import { Send as Send2, User as User2, Loader2 as Loader27 } from "lucide-react";
|
|
14364
14683
|
import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
14365
14684
|
function ChatWindow({ activeConversation, messages, isLoading, isSending, onSendMessage }) {
|
|
14366
|
-
const [inputText, setInputText] =
|
|
14367
|
-
const messagesTopRef =
|
|
14685
|
+
const [inputText, setInputText] = useState20("");
|
|
14686
|
+
const messagesTopRef = useRef19(null);
|
|
14368
14687
|
const scrollToTop = () => {
|
|
14369
14688
|
var _a;
|
|
14370
14689
|
(_a = messagesTopRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
14371
14690
|
};
|
|
14372
|
-
|
|
14691
|
+
useEffect18(() => {
|
|
14373
14692
|
scrollToTop();
|
|
14374
14693
|
}, [messages.length, activeConversation == null ? void 0 : activeConversation.id]);
|
|
14375
14694
|
const handleSend = (e) => {
|
|
@@ -14486,13 +14805,6 @@ function WhatsAppComponent(props) {
|
|
|
14486
14805
|
const { className = "", settings, orgId, componentId, executeAction } = props;
|
|
14487
14806
|
const state = useWhatsAppState(props);
|
|
14488
14807
|
const [activeTab, setActiveTab] = React20.useState("broadcast");
|
|
14489
|
-
const relationButtonColumns = (Array.isArray(settings == null ? void 0 : settings.relationButtonColumns) ? settings.relationButtonColumns : []).filter(
|
|
14490
|
-
(name) => (state.tableColumns || []).some((c) => {
|
|
14491
|
-
var _a2;
|
|
14492
|
-
return c.name === name && ((_a2 = c.type) == null ? void 0 : _a2.toUpperCase()) === "RELATION";
|
|
14493
|
-
})
|
|
14494
|
-
);
|
|
14495
|
-
const hasRelationButtons = relationButtonColumns.length > 0;
|
|
14496
14808
|
return /* @__PURE__ */ jsxs24(
|
|
14497
14809
|
"div",
|
|
14498
14810
|
{
|
|
@@ -14600,111 +14912,97 @@ function WhatsAppComponent(props) {
|
|
|
14600
14912
|
)
|
|
14601
14913
|
] }),
|
|
14602
14914
|
/* @__PURE__ */ jsxs24("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
14603
|
-
/* @__PURE__ */ jsxs24("div", { className:
|
|
14604
|
-
|
|
14605
|
-
|
|
14915
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid grid-cols-1 lg:grid-cols-12 gap-4 shrink-0 items-stretch", children: [
|
|
14916
|
+
/* @__PURE__ */ jsx27(
|
|
14917
|
+
TemplateSelectionBlock,
|
|
14918
|
+
{
|
|
14919
|
+
selectedTemplate: state.selectedTemplate,
|
|
14920
|
+
selectedTemplateId: state.selectedTemplateId,
|
|
14921
|
+
setSelectedTemplateId: state.setSelectedTemplateId,
|
|
14922
|
+
templates: state.templates,
|
|
14923
|
+
isLoadingTemplates: state.isLoadingTemplates,
|
|
14924
|
+
isDropdownOpen: state.isDropdownOpen,
|
|
14925
|
+
setIsDropdownOpen: state.setIsDropdownOpen,
|
|
14926
|
+
templateBodyText: state.templateBodyText,
|
|
14927
|
+
templateHeaderComp: state.templateHeaderComp,
|
|
14928
|
+
headerMediaUrl: state.headerMediaUrl,
|
|
14929
|
+
handleHeaderMediaUrlChange: state.handleHeaderMediaUrlChange,
|
|
14930
|
+
handleResetHeaderMediaUrl: state.handleResetHeaderMediaUrl,
|
|
14931
|
+
templateVariables: state.templateVariables,
|
|
14932
|
+
variableMapping: state.variableMapping,
|
|
14933
|
+
handleVariableTypeChange: state.handleVariableTypeChange,
|
|
14934
|
+
handleVariableValueChange: state.handleVariableValueChange,
|
|
14935
|
+
textableColumnOptions: state.textableColumnOptions,
|
|
14936
|
+
handleDeleteTemplate: state.handleDeleteTemplate,
|
|
14937
|
+
isDeleting: state.isDeleting,
|
|
14938
|
+
setIsModalOpen: state.setIsModalOpen,
|
|
14939
|
+
setFeedback: state.setFeedback,
|
|
14940
|
+
isUploadingMedia: state.isUploadingMedia,
|
|
14941
|
+
handleFileUpload: state.handleFileUpload
|
|
14942
|
+
}
|
|
14943
|
+
),
|
|
14944
|
+
/* @__PURE__ */ jsx27(
|
|
14945
|
+
DynamicFiltersBlock,
|
|
14606
14946
|
{
|
|
14607
|
-
|
|
14608
|
-
tableColumns: state.tableColumns,
|
|
14609
|
-
records: state.rawRecords,
|
|
14947
|
+
filterableColumns: state.filterableColumns,
|
|
14610
14948
|
filters: state.filters,
|
|
14611
|
-
|
|
14949
|
+
handleFilterChange: state.handleFilterChange,
|
|
14950
|
+
handleClearFilters: state.handleClearFilters,
|
|
14951
|
+
activeFiltersCount: state.activeFiltersCount,
|
|
14612
14952
|
relationOptions: state.relationOptions,
|
|
14613
|
-
getRelationOptionsForCol: state.getRelationOptionsForCol
|
|
14953
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14954
|
+
selectedRowIds: state.selectedRowIds,
|
|
14955
|
+
filteredRecordsCount: state.filteredRecords.length,
|
|
14956
|
+
rawRecordsCount: state.rawRecords.length,
|
|
14957
|
+
loadTableData: state.loadTableData,
|
|
14958
|
+
isLoadingTableData: state.isLoadingTableData
|
|
14614
14959
|
}
|
|
14615
14960
|
),
|
|
14616
|
-
/* @__PURE__ */
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
),
|
|
14662
|
-
/* @__PURE__ */ jsx27(
|
|
14663
|
-
SettingsAndActionsBlock,
|
|
14664
|
-
{
|
|
14665
|
-
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
14666
|
-
targetPhoneOptions: state.targetPhoneOptions,
|
|
14667
|
-
phoneColumnId: state.phoneColumnId,
|
|
14668
|
-
setPhoneColumnId: state.setPhoneColumnId,
|
|
14669
|
-
selectedPhoneOption: state.selectedPhoneOption,
|
|
14670
|
-
autoSelectCount: state.autoSelectCount,
|
|
14671
|
-
setAutoSelectCount: state.setAutoSelectCount,
|
|
14672
|
-
subtableFilterColumn: state.subtableFilterColumn,
|
|
14673
|
-
setSubtableFilterColumn: state.setSubtableFilterColumn,
|
|
14674
|
-
subtableFilterValue: state.subtableFilterValue,
|
|
14675
|
-
setSubtableFilterValue: state.setSubtableFilterValue,
|
|
14676
|
-
subtableSendLimit: state.subtableSendLimit,
|
|
14677
|
-
setSubtableSendLimit: state.setSubtableSendLimit,
|
|
14678
|
-
subtableFilterableColumns: state.subtableFilterableColumns,
|
|
14679
|
-
selectedSubtableFilterCol: state.selectedSubtableFilterCol,
|
|
14680
|
-
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14681
|
-
relationOptions: state.relationOptions,
|
|
14682
|
-
enablePostSendAction: state.enablePostSendAction,
|
|
14683
|
-
setEnablePostSendAction: state.setEnablePostSendAction,
|
|
14684
|
-
postSendActionColumn: state.postSendActionColumn,
|
|
14685
|
-
setPostSendActionColumn: state.setPostSendActionColumn,
|
|
14686
|
-
postSendActionValue: state.postSendActionValue,
|
|
14687
|
-
setPostSendActionValue: state.setPostSendActionValue,
|
|
14688
|
-
postSendActionTargetType: state.postSendActionTargetType,
|
|
14689
|
-
setPostSendActionTargetType: state.setPostSendActionTargetType,
|
|
14690
|
-
postSendActionTargetOptions: state.postSendActionTargetOptions,
|
|
14691
|
-
selectedPostSendOption: state.selectedPostSendCol,
|
|
14692
|
-
isTestDisabled: state.isTestDisabled,
|
|
14693
|
-
testButtonTitle: state.testButtonTitle,
|
|
14694
|
-
setIsTestPromptOpen: state.setIsTestPromptOpen,
|
|
14695
|
-
isSendDisabled: state.isSendDisabled,
|
|
14696
|
-
sendButtonTitle: state.sendButtonTitle,
|
|
14697
|
-
handleSendMessages: state.handleSendMessages,
|
|
14698
|
-
selectedRowIdsCount: state.selectedRowIds.length,
|
|
14699
|
-
finalRecipientCount: state.finalRecipientCount,
|
|
14700
|
-
validMainRowsCount: state.validMainRowsCount,
|
|
14701
|
-
isSendingBroadcast: state.isSendingBroadcast,
|
|
14702
|
-
broadcastProgress: state.broadcastProgress,
|
|
14703
|
-
broadcastSummary: state.broadcastSummary,
|
|
14704
|
-
clearBroadcastSummary: state.clearBroadcastSummary
|
|
14705
|
-
}
|
|
14706
|
-
)
|
|
14707
|
-
] })
|
|
14961
|
+
/* @__PURE__ */ jsx27(
|
|
14962
|
+
SettingsAndActionsBlock,
|
|
14963
|
+
{
|
|
14964
|
+
isScanningPhoneColumns: state.isScanningPhoneColumns,
|
|
14965
|
+
targetPhoneOptions: state.targetPhoneOptions,
|
|
14966
|
+
phoneColumnId: state.phoneColumnId,
|
|
14967
|
+
setPhoneColumnId: state.setPhoneColumnId,
|
|
14968
|
+
selectedPhoneOption: state.selectedPhoneOption,
|
|
14969
|
+
autoSelectCount: state.autoSelectCount,
|
|
14970
|
+
setAutoSelectCount: state.setAutoSelectCount,
|
|
14971
|
+
subtableFilterColumn: state.subtableFilterColumn,
|
|
14972
|
+
setSubtableFilterColumn: state.setSubtableFilterColumn,
|
|
14973
|
+
subtableFilterValue: state.subtableFilterValue,
|
|
14974
|
+
setSubtableFilterValue: state.setSubtableFilterValue,
|
|
14975
|
+
subtableSendLimit: state.subtableSendLimit,
|
|
14976
|
+
setSubtableSendLimit: state.setSubtableSendLimit,
|
|
14977
|
+
subtableFilterableColumns: state.subtableFilterableColumns,
|
|
14978
|
+
selectedSubtableFilterCol: state.selectedSubtableFilterCol,
|
|
14979
|
+
getRelationOptionsForCol: state.getRelationOptionsForCol,
|
|
14980
|
+
relationOptions: state.relationOptions,
|
|
14981
|
+
enablePostSendAction: state.enablePostSendAction,
|
|
14982
|
+
setEnablePostSendAction: state.setEnablePostSendAction,
|
|
14983
|
+
postSendActionColumn: state.postSendActionColumn,
|
|
14984
|
+
setPostSendActionColumn: state.setPostSendActionColumn,
|
|
14985
|
+
postSendActionValue: state.postSendActionValue,
|
|
14986
|
+
setPostSendActionValue: state.setPostSendActionValue,
|
|
14987
|
+
postSendActionTargetType: state.postSendActionTargetType,
|
|
14988
|
+
setPostSendActionTargetType: state.setPostSendActionTargetType,
|
|
14989
|
+
postSendActionTargetOptions: state.postSendActionTargetOptions,
|
|
14990
|
+
selectedPostSendOption: state.selectedPostSendCol,
|
|
14991
|
+
isTestDisabled: state.isTestDisabled,
|
|
14992
|
+
testButtonTitle: state.testButtonTitle,
|
|
14993
|
+
setIsTestPromptOpen: state.setIsTestPromptOpen,
|
|
14994
|
+
isSendDisabled: state.isSendDisabled,
|
|
14995
|
+
sendButtonTitle: state.sendButtonTitle,
|
|
14996
|
+
handleSendMessages: state.handleSendMessages,
|
|
14997
|
+
selectedRowIdsCount: state.selectedRowIds.length,
|
|
14998
|
+
finalRecipientCount: state.finalRecipientCount,
|
|
14999
|
+
validMainRowsCount: state.validMainRowsCount,
|
|
15000
|
+
isSendingBroadcast: state.isSendingBroadcast,
|
|
15001
|
+
broadcastProgress: state.broadcastProgress,
|
|
15002
|
+
broadcastSummary: state.broadcastSummary,
|
|
15003
|
+
clearBroadcastSummary: state.clearBroadcastSummary
|
|
15004
|
+
}
|
|
15005
|
+
)
|
|
14708
15006
|
] }),
|
|
14709
15007
|
/* @__PURE__ */ jsx27("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__ */ jsxs24("div", { className: "flex-1 flex flex-col items-center justify-center p-12 text-center text-xs text-slate-400 gap-2", children: [
|
|
14710
15008
|
/* @__PURE__ */ jsx27(Loader28, { className: "w-6 h-6 animate-spin text-emerald-600" }),
|
|
@@ -14730,8 +15028,7 @@ function WhatsAppComponent(props) {
|
|
|
14730
15028
|
orgId,
|
|
14731
15029
|
componentId: `${componentId || "whatsapp"}-embedded-table`,
|
|
14732
15030
|
className: "h-full flex-1 border-0 rounded-2xl shadow-none",
|
|
14733
|
-
rowStatusMap: state.rowStatusMap
|
|
14734
|
-
hideRelationButtons: true
|
|
15031
|
+
rowStatusMap: state.rowStatusMap
|
|
14735
15032
|
}
|
|
14736
15033
|
) })
|
|
14737
15034
|
] }),
|
|
@@ -14912,18 +15209,18 @@ function WhatsAppComponent(props) {
|
|
|
14912
15209
|
}
|
|
14913
15210
|
|
|
14914
15211
|
// src/components/FormBlock/FormBlock.tsx
|
|
14915
|
-
import { useState as
|
|
15212
|
+
import { useState as useState21, useEffect as useEffect19 } from "react";
|
|
14916
15213
|
import { Loader2 as Loader29, CheckCircle2 as CheckCircle25 } from "lucide-react";
|
|
14917
15214
|
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
14918
15215
|
function FormBlock({ settings: schema, executeAction, componentId, className = "", onSuccess }) {
|
|
14919
15216
|
const { showError, addToast } = useToast();
|
|
14920
|
-
const [formData, setFormData] =
|
|
14921
|
-
const [isSubmitting, setIsSubmitting] =
|
|
14922
|
-
const [isSubmitted, setIsSubmitted] =
|
|
14923
|
-
const [columns, setColumns] =
|
|
14924
|
-
const [isLoadingSchema, setIsLoadingSchema] =
|
|
15217
|
+
const [formData, setFormData] = useState21({});
|
|
15218
|
+
const [isSubmitting, setIsSubmitting] = useState21(false);
|
|
15219
|
+
const [isSubmitted, setIsSubmitted] = useState21(false);
|
|
15220
|
+
const [columns, setColumns] = useState21((schema == null ? void 0 : schema.columns) || []);
|
|
15221
|
+
const [isLoadingSchema, setIsLoadingSchema] = useState21(false);
|
|
14925
15222
|
const targetTableId = (schema == null ? void 0 : schema.tableMetaId) || (schema == null ? void 0 : schema.tableId) || (schema == null ? void 0 : schema.id);
|
|
14926
|
-
|
|
15223
|
+
useEffect19(() => {
|
|
14927
15224
|
let isMounted = true;
|
|
14928
15225
|
if ((!(schema == null ? void 0 : schema.columns) || schema.columns.length === 0) && targetTableId && executeAction) {
|
|
14929
15226
|
setIsLoadingSchema(true);
|
|
@@ -15088,6 +15385,7 @@ export {
|
|
|
15088
15385
|
COLUMN_TYPE_LABELS,
|
|
15089
15386
|
ColumnHeaderTitle,
|
|
15090
15387
|
CreateTemplateModal,
|
|
15388
|
+
DEFAULT_FILTER_COLUMN_TYPES,
|
|
15091
15389
|
DEFAULT_PLACEMENT_STATUS_COLORS,
|
|
15092
15390
|
DatePickerCell,
|
|
15093
15391
|
DynamicFiltersBlock,
|
|
@@ -15102,6 +15400,7 @@ export {
|
|
|
15102
15400
|
RELATION_BUTTON_COUNTS_ACTION,
|
|
15103
15401
|
RELATION_LABEL_KEY,
|
|
15104
15402
|
RELATION_SEP,
|
|
15403
|
+
RESOLVE_DEFAULT_FILTERS_ACTION,
|
|
15105
15404
|
RelationFilterPopover,
|
|
15106
15405
|
RelationPickerCell,
|
|
15107
15406
|
SettingsAndActionsBlock,
|
|
@@ -15122,6 +15421,7 @@ export {
|
|
|
15122
15421
|
buildRelationRef,
|
|
15123
15422
|
calculateMinColumnWidth,
|
|
15124
15423
|
checkElementTruncation,
|
|
15424
|
+
cleanPlacementFilterDefaults,
|
|
15125
15425
|
cn,
|
|
15126
15426
|
columnRefLabel,
|
|
15127
15427
|
computeFormulaValue,
|
|
@@ -15137,6 +15437,8 @@ export {
|
|
|
15137
15437
|
formatTimeInput,
|
|
15138
15438
|
formatTimeIso,
|
|
15139
15439
|
generateWhatsAppLink,
|
|
15440
|
+
getColumnDefaultFilter,
|
|
15441
|
+
getDefaultFilterColumns,
|
|
15140
15442
|
getDeterministicPastelBadge,
|
|
15141
15443
|
getEligibleCopyTargets,
|
|
15142
15444
|
getNextVariableIndex,
|
|
@@ -15172,11 +15474,14 @@ export {
|
|
|
15172
15474
|
renameCopyTarget,
|
|
15173
15475
|
resolveDefaultStatusId,
|
|
15174
15476
|
resolveProtocol,
|
|
15477
|
+
sanitizeDefaultFilter,
|
|
15175
15478
|
sanitizePhoneNumber,
|
|
15176
15479
|
sanitizeTemplateNameInput,
|
|
15177
15480
|
seamlessVariableEngine,
|
|
15178
15481
|
splitHeaderTitle,
|
|
15482
|
+
supportsDefaultFilter,
|
|
15179
15483
|
tableColumns,
|
|
15484
|
+
toColumnFilterValue,
|
|
15180
15485
|
useColumnReorder,
|
|
15181
15486
|
useColumnResize,
|
|
15182
15487
|
useSmartTooltip,
|
|
@@ -15188,5 +15493,6 @@ export {
|
|
|
15188
15493
|
validateTemplateBody,
|
|
15189
15494
|
validateTemplateButtons,
|
|
15190
15495
|
validateWhatsAppTemplate,
|
|
15191
|
-
validateWordToVariableRatio
|
|
15496
|
+
validateWordToVariableRatio,
|
|
15497
|
+
withDefaultFilter
|
|
15192
15498
|
};
|