strapi-plugin-bulk-updater 1.6.10 → 1.7.0

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.
Files changed (28) hide show
  1. package/dist/_chunks/{BulkUpdater-DISkZC1Y.mjs → BulkUpdater-CV49TvOV.mjs} +338 -136
  2. package/dist/_chunks/BulkUpdater-CV49TvOV.mjs.map +1 -0
  3. package/dist/_chunks/{BulkUpdater-BY8IXT4R.js → BulkUpdater-Cnzgw4UH.js} +336 -134
  4. package/dist/_chunks/BulkUpdater-Cnzgw4UH.js.map +1 -0
  5. package/dist/_chunks/{SettingsPage-D9vD1BKo.mjs → SettingsPage-DXRWLRp_.mjs} +2 -2
  6. package/dist/_chunks/{SettingsPage-D9vD1BKo.mjs.map → SettingsPage-DXRWLRp_.mjs.map} +1 -1
  7. package/dist/_chunks/{SettingsPage-vH-eanBJ.js → SettingsPage-w_Lz-N0V.js} +2 -2
  8. package/dist/_chunks/{SettingsPage-vH-eanBJ.js.map → SettingsPage-w_Lz-N0V.js.map} +1 -1
  9. package/dist/_chunks/{ValidationRulesTab-DdwR3lWq.mjs → ValidationRulesTab-eN_vH3TB.mjs} +22 -2
  10. package/dist/_chunks/ValidationRulesTab-eN_vH3TB.mjs.map +1 -0
  11. package/dist/_chunks/{ValidationRulesTab-r6S-ZFDp.js → ValidationRulesTab-of8bIzre.js} +22 -2
  12. package/dist/_chunks/ValidationRulesTab-of8bIzre.js.map +1 -0
  13. package/dist/_chunks/{index-AXTojFac.mjs → index-2DodYa70.mjs} +7 -3
  14. package/dist/_chunks/index-2DodYa70.mjs.map +1 -0
  15. package/dist/_chunks/{index-aoOgZpZE.js → index-C2HoRm23.js} +7 -3
  16. package/dist/_chunks/{index-AXTojFac.mjs.map → index-C2HoRm23.js.map} +1 -1
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/server/index.js +292 -81
  20. package/dist/server/index.js.map +1 -1
  21. package/dist/server/index.mjs +292 -81
  22. package/dist/server/index.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/dist/_chunks/BulkUpdater-BY8IXT4R.js.map +0 -1
  25. package/dist/_chunks/BulkUpdater-DISkZC1Y.mjs.map +0 -1
  26. package/dist/_chunks/ValidationRulesTab-DdwR3lWq.mjs.map +0 -1
  27. package/dist/_chunks/ValidationRulesTab-r6S-ZFDp.js.map +0 -1
  28. package/dist/_chunks/index-aoOgZpZE.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import React__default, { useRef, useState, useEffect, useMemo } from "react";
2
+ import React__default, { useRef, useState, useEffect, useCallback, useMemo } from "react";
3
3
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
4
4
  import { Box, Flex, Typography, Button, Combobox, ComboboxOption, Badge, SingleSelect, SingleSelectOption, TextInput, Checkbox, Alert, Table, Thead, Tr, Th, Tbody, Td, Loader, Textarea, Field } from "@strapi/design-system";
5
5
  import { ArrowClockwise, Download, Search, Cog, Upload, ChevronLeft, ChevronRight, Eye, Check, Play } from "@strapi/icons";
6
- import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-DdwR3lWq.mjs";
6
+ import { u as useBulkUpdaterRBAC, i as isAbortError, V as ValidationRulesTab } from "./ValidationRulesTab-eN_vH3TB.mjs";
7
7
  function parseCsvRows(csvText) {
8
8
  if (!csvText) return [];
9
9
  let text = csvText;
@@ -533,6 +533,113 @@ function areClientValuesEqual(a, b) {
533
533
  }
534
534
  return String(na) === String(nb);
535
535
  }
536
+ const relationLabelRegistry = /* @__PURE__ */ new Map();
537
+ function registerRelationLabel(key, label) {
538
+ if (key !== void 0 && key !== null && label && typeof label === "string" && label.trim()) {
539
+ relationLabelRegistry.set(String(key).trim(), label.trim());
540
+ }
541
+ }
542
+ function registerRelationOptions(options) {
543
+ if (Array.isArray(options)) {
544
+ for (const opt of options) {
545
+ if (opt && opt.label) {
546
+ if (opt.documentId) registerRelationLabel(opt.documentId, opt.label);
547
+ if (opt.id !== void 0 && opt.id !== null) registerRelationLabel(opt.id, opt.label);
548
+ }
549
+ }
550
+ }
551
+ }
552
+ function getCachedRelationLabel(key) {
553
+ if (key === void 0 || key === null) return void 0;
554
+ return relationLabelRegistry.get(String(key).trim());
555
+ }
556
+ function resolveEntityLabel(item, options) {
557
+ if (item === void 0 || item === null) return "";
558
+ if (typeof item !== "object") {
559
+ const s = String(item).trim();
560
+ if (options && Array.isArray(options)) {
561
+ const match = options.find((o) => o.documentId === s || String(o.id) === s);
562
+ if (match?.label) return match.label.trim();
563
+ }
564
+ const cached = getCachedRelationLabel(s);
565
+ if (cached) return cached;
566
+ return s;
567
+ }
568
+ if (item.label && typeof item.label === "string" && item.label.trim()) {
569
+ return item.label.trim();
570
+ }
571
+ const candidateFields = [
572
+ "name",
573
+ "title",
574
+ "authorName",
575
+ "label",
576
+ "heading",
577
+ "subject",
578
+ "fullName",
579
+ "username",
580
+ "email",
581
+ "slug"
582
+ ];
583
+ for (const field of candidateFields) {
584
+ if (item[field] !== void 0 && item[field] !== null && String(item[field]).trim() !== "") {
585
+ const resolved = String(item[field]).trim();
586
+ if (item.documentId) registerRelationLabel(item.documentId, resolved);
587
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
588
+ return resolved;
589
+ }
590
+ }
591
+ if (item.firstname || item.lastname) {
592
+ const fn = [item.firstname, item.lastname].filter(Boolean).join(" ").trim();
593
+ if (fn) {
594
+ if (item.documentId) registerRelationLabel(item.documentId, fn);
595
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, fn);
596
+ return fn;
597
+ }
598
+ }
599
+ const systemKeys = /* @__PURE__ */ new Set([
600
+ "id",
601
+ "documentId",
602
+ "createdAt",
603
+ "updatedAt",
604
+ "publishedAt",
605
+ "locale",
606
+ "createdBy",
607
+ "updatedBy",
608
+ "__component",
609
+ "isRelation",
610
+ "relationType",
611
+ "targetUid",
612
+ "targetDisplayName",
613
+ "isMulti",
614
+ "mode",
615
+ "documentIds"
616
+ ]);
617
+ for (const [k, v] of Object.entries(item)) {
618
+ if (!systemKeys.has(k) && typeof v === "string" && v.trim() !== "") {
619
+ const resolved = v.trim();
620
+ if (item.documentId) registerRelationLabel(item.documentId, resolved);
621
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
622
+ return resolved;
623
+ }
624
+ }
625
+ if (item.documentId) {
626
+ if (options && Array.isArray(options)) {
627
+ const match = options.find((o) => o.documentId === item.documentId);
628
+ if (match?.label) return match.label.trim();
629
+ }
630
+ const cached = getCachedRelationLabel(item.documentId);
631
+ if (cached) return cached;
632
+ }
633
+ if (item.id !== void 0 && item.id !== null) {
634
+ if (options && Array.isArray(options)) {
635
+ const match = options.find((o) => String(o.id) === String(item.id));
636
+ if (match?.label) return match.label.trim();
637
+ }
638
+ const cached = getCachedRelationLabel(item.id);
639
+ if (cached) return cached;
640
+ }
641
+ return item.documentId || (item.id !== void 0 && item.id !== null ? `Entry #${item.id}` : JSON.stringify(item));
642
+ }
536
643
  function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false) {
537
644
  if (rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) && rawVal.mode) {
538
645
  return {
@@ -545,14 +652,14 @@ function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false)
545
652
  return {
546
653
  mode: "set",
547
654
  documentIds: rawVal.map((r) => r?.documentId).filter(Boolean),
548
- label: rawVal.map((r) => r?.name || r?.title || r?.email || r?.documentId).filter(Boolean).join(", ")
655
+ label: rawVal.map((r) => resolveEntityLabel(r)).filter(Boolean).join(", ")
549
656
  };
550
657
  }
551
658
  if (rawVal && typeof rawVal === "object" && rawVal.documentId) {
552
659
  return {
553
660
  mode: "set",
554
661
  documentIds: [rawVal.documentId],
555
- label: rawVal.name || rawVal.title || rawVal.email || rawVal.documentId
662
+ label: resolveEntityLabel(rawVal)
556
663
  };
557
664
  }
558
665
  if (typeof rawVal === "string") {
@@ -846,7 +953,10 @@ function getAllNestedValues(obj, path, availableAttributes) {
846
953
  rootTarget.forEach((item, idx) => {
847
954
  if (!item || typeof item !== "object") return;
848
955
  if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
849
- if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
956
+ const itemComp = item.__component;
957
+ const targetComp = parsed.targetComponentUid;
958
+ const compMatches = !targetComp || itemComp === targetComp || itemComp && (itemComp.toLowerCase() === targetComp.toLowerCase() || itemComp.split(".")[1]?.toLowerCase() === targetComp.toLowerCase() || itemComp.toLowerCase().replace(/[-_]/g, "") === targetComp.toLowerCase().replace(/[-_]/g, ""));
959
+ if (!compMatches) return;
850
960
  const subPath = tail.join(".");
851
961
  const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
852
962
  const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
@@ -901,6 +1011,66 @@ function getAllNestedValues(obj, path, availableAttributes) {
901
1011
  }
902
1012
  return [];
903
1013
  }
1014
+ function formatAttributeHeaderLabel(attr) {
1015
+ if (!attr) return "";
1016
+ if (attr === "updated_at" || attr === "updatedAt") return "Updated At";
1017
+ if (attr === "created_at" || attr === "createdAt") return "Created At";
1018
+ if (attr === "published_at" || attr === "publishedAt") return "Published At";
1019
+ const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\](?:\.(.+))?$/);
1020
+ if (bracketMatch) {
1021
+ const root = bracketMatch[1].replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1022
+ const comp = formatComponentName(bracketMatch[2]);
1023
+ const sub = bracketMatch[3] ? bracketMatch[3].split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ") : "";
1024
+ return sub ? `${root} [${comp}] > ${sub}` : `${root} [${comp}]`;
1025
+ }
1026
+ if (attr.includes(".")) {
1027
+ return attr.split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ");
1028
+ }
1029
+ return attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1030
+ }
1031
+ function resolveEffectiveRelationMeta(attr, colRelations, globalRelationsMeta) {
1032
+ if (!attr) return void 0;
1033
+ const rels = colRelations;
1034
+ if (rels) {
1035
+ if (rels[attr]) return rels[attr];
1036
+ const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
1037
+ for (const k of Object.keys(rels)) {
1038
+ if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return rels[k];
1039
+ }
1040
+ for (const k of Object.keys(rels)) {
1041
+ if (k.startsWith(`${attr}.`) || k.toLowerCase().startsWith(`${attr.toLowerCase()}.`)) {
1042
+ return rels[k];
1043
+ }
1044
+ }
1045
+ const attrLeaf = attr.includes(".") ? attr.split(".").pop() : "";
1046
+ for (const [k, rel] of Object.entries(rels)) {
1047
+ const bracketMatch = k.match(/\[([^\]]+)\](?:\.(.+))?/);
1048
+ if (bracketMatch) {
1049
+ const compUid = bracketMatch[1];
1050
+ const compClean = compUid.includes(".") ? compUid.split(".")[1] : compUid;
1051
+ const normComp = compClean.toLowerCase().replace(/[-_ /]/g, "");
1052
+ const subPath = bracketMatch[2] || "";
1053
+ const normSub = subPath.toLowerCase().replace(/[-_ /]/g, "");
1054
+ if (normComp === norm || compUid.toLowerCase() === attr.toLowerCase() || compClean.toLowerCase() === attr.toLowerCase() || attrLeaf && normSub === attrLeaf.toLowerCase().replace(/[-_ /]/g, "") && (norm.includes(normComp) || attr.toLowerCase().includes(compUid.toLowerCase()))) {
1055
+ return rel;
1056
+ }
1057
+ }
1058
+ }
1059
+ for (const [k, rel] of Object.entries(rels)) {
1060
+ if (k.endsWith(`.${attr}`) || k.toLowerCase().endsWith(`.${attr.toLowerCase()}`)) {
1061
+ return rel;
1062
+ }
1063
+ }
1064
+ }
1065
+ if (globalRelationsMeta) {
1066
+ if (globalRelationsMeta[attr]) return globalRelationsMeta[attr];
1067
+ const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
1068
+ for (const k of Object.keys(globalRelationsMeta)) {
1069
+ if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return globalRelationsMeta[k];
1070
+ }
1071
+ }
1072
+ return void 0;
1073
+ }
904
1074
  function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
905
1075
  const cols = [
906
1076
  {
@@ -921,26 +1091,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
921
1091
  if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
922
1092
  return;
923
1093
  }
924
- let formattedLabel = attr;
925
- if (attr === "updated_at" || attr === "updatedAt") {
926
- formattedLabel = "Updated At";
927
- } else if (attr === "created_at" || attr === "createdAt") {
928
- formattedLabel = "Created At";
929
- } else if (attr === "published_at" || attr === "publishedAt") {
930
- formattedLabel = "Published At";
931
- } else {
932
- const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
933
- if (bracketMatch) {
934
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
935
- const comp = formatComponentName(bracketMatch[2]);
936
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
937
- formattedLabel = `${root} [${comp}] > ${sub}`;
938
- } else if (attr.includes(".")) {
939
- formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
940
- } else {
941
- formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
942
- }
943
- }
1094
+ const formattedLabel = formatAttributeHeaderLabel(attr);
944
1095
  cols.push({
945
1096
  key: `attr_${attr}`,
946
1097
  label: formattedLabel,
@@ -976,16 +1127,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
976
1127
  });
977
1128
  }
978
1129
  if (searchAttribute && searchAttribute !== selectedAttribute) {
979
- let formattedSearchLabel = searchAttribute;
980
- const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
981
- if (bracketMatch) {
982
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
983
- const comp = formatComponentName(bracketMatch[2]);
984
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
985
- formattedSearchLabel = `${root} [${comp}] > ${sub}`;
986
- } else if (searchAttribute.includes(".")) {
987
- formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
988
- }
1130
+ const formattedSearchLabel = formatAttributeHeaderLabel(searchAttribute);
989
1131
  cols.push({
990
1132
  key: "search_attr",
991
1133
  label: `Search: "${formattedSearchLabel}"`,
@@ -994,18 +1136,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
994
1136
  });
995
1137
  }
996
1138
  if (selectedAttribute && selectedAttribute.trim()) {
997
- let formattedTargetLabel = selectedAttribute;
998
- const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
999
- if (bracketMatch) {
1000
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
1001
- const comp = formatComponentName(bracketMatch[2]);
1002
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
1003
- formattedTargetLabel = `${root} [${comp}] > ${sub}`;
1004
- } else if (selectedAttribute.includes(".")) {
1005
- formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
1006
- } else {
1007
- formattedTargetLabel = selectedAttribute.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1008
- }
1139
+ const formattedTargetLabel = formatAttributeHeaderLabel(selectedAttribute);
1009
1140
  cols.push({
1010
1141
  key: "current_attr",
1011
1142
  label: `Current Value: "${formattedTargetLabel}"`,
@@ -1121,18 +1252,21 @@ function formatFullTooltipValue(val) {
1121
1252
  return isNaN(val.getTime()) ? "(invalid date)" : val.toISOString();
1122
1253
  }
1123
1254
  if (typeof val === "string") {
1255
+ const cached = getCachedRelationLabel(val);
1256
+ if (cached) return cached;
1124
1257
  return val;
1125
1258
  }
1126
1259
  if (Array.isArray(val)) {
1127
1260
  if (val.length === 0) return "(empty array)";
1128
- try {
1129
- return JSON.stringify(val, null, 2);
1130
- } catch {
1131
- return String(val);
1132
- }
1261
+ return val.map(
1262
+ (item) => typeof item === "object" && item !== null ? resolveEntityLabel(item) : getCachedRelationLabel(item) || String(item)
1263
+ ).join(", ");
1133
1264
  }
1134
1265
  if (typeof val === "object") {
1135
1266
  if (val.isRelation && val.display) return val.display;
1267
+ if (val.documentId || val.authorName || val.name || val.title) {
1268
+ return resolveEntityLabel(val);
1269
+ }
1136
1270
  try {
1137
1271
  return JSON.stringify(val, null, 2);
1138
1272
  } catch {
@@ -1147,7 +1281,7 @@ function getCellTooltipText(colDef, entry, colAttributes, selectedAttribute, sea
1147
1281
  case "select":
1148
1282
  return void 0;
1149
1283
  case "identifier": {
1150
- const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
1284
+ const mainText = resolveEntityLabel(entry) || `Entry #${entry.id || entry.documentId}`;
1151
1285
  const parts = [String(mainText)];
1152
1286
  if (entry.documentId) parts.push(`Document ID: ${entry.documentId}`);
1153
1287
  if (entry.id && String(entry.id) !== String(entry.documentId)) parts.push(`ID: ${entry.id}`);
@@ -1484,19 +1618,28 @@ function CsvManagerTab() {
1484
1618
  }
1485
1619
  };
1486
1620
  const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
1621
+ const getEffectiveRelMeta = useCallback(
1622
+ (attr) => {
1623
+ return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
1624
+ },
1625
+ [selectedCol, relationsMeta]
1626
+ );
1487
1627
  useEffect(() => {
1488
- if (searchAttribute && relationsMeta[searchAttribute]) {
1489
- fetchSearchRelationOptions(relationsMeta[searchAttribute].targetUid);
1628
+ const activeRel = getEffectiveRelMeta(searchAttribute);
1629
+ if (searchAttribute && activeRel) {
1630
+ fetchSearchRelationOptions(activeRel.targetUid);
1490
1631
  } else {
1491
1632
  setSearchRelationOptions([]);
1492
1633
  }
1493
- }, [searchAttribute, relationsMeta]);
1634
+ }, [searchAttribute, getEffectiveRelMeta]);
1494
1635
  const fetchSearchRelationOptions = async (targetUid) => {
1495
1636
  try {
1496
1637
  setSearchRelationOptionsLoading(true);
1497
1638
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
1498
1639
  if (res.data && res.data.success) {
1499
- setSearchRelationOptions(res.data.options || []);
1640
+ const opts = res.data.options || [];
1641
+ setSearchRelationOptions(opts);
1642
+ registerRelationOptions(opts);
1500
1643
  }
1501
1644
  } catch {
1502
1645
  setSearchRelationOptions([]);
@@ -2183,12 +2326,16 @@ function CsvManagerTab() {
2183
2326
  }
2184
2327
  },
2185
2328
  children: (selectedCol?.attributes || []).map((attr) => {
2186
- const rel = relationsMeta[attr];
2329
+ const rel = getEffectiveRelMeta(attr);
2187
2330
  const depth = getAttrDepth(attr);
2331
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
2188
2332
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
2189
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
2333
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
2190
2334
  return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
2191
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
2335
+ /* @__PURE__ */ jsxs(Box, { children: [
2336
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
2337
+ friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
2338
+ ] }),
2192
2339
  rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
2193
2340
  "relation ➔ ",
2194
2341
  rel.targetDisplayName
@@ -2224,11 +2371,11 @@ function CsvManagerTab() {
2224
2371
  ] }),
2225
2372
  (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxs(Box, { style: { flex: 1, minWidth: 200 }, children: [
2226
2373
  /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: searchAttribute ? `Value for "${searchAttribute}"` : "Value to match" }),
2227
- searchAttribute && relationsMeta[searchAttribute] ? /* @__PURE__ */ jsx(
2374
+ searchAttribute && getEffectiveRelMeta(searchAttribute) ? /* @__PURE__ */ jsx(
2228
2375
  Combobox,
2229
2376
  {
2230
2377
  autocomplete: { type: "list", filter: "contains" },
2231
- placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[searchAttribute].targetDisplayName} or type text...`,
2378
+ placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(searchAttribute).targetDisplayName} or type text...`,
2232
2379
  value: filterQuery,
2233
2380
  onClear: () => setFilterQuery(""),
2234
2381
  onChange: (val) => {
@@ -4009,6 +4156,7 @@ const BulkUpdatePreviewModal = ({
4009
4156
  isOpen,
4010
4157
  onClose,
4011
4158
  onProceed,
4159
+ canProceed,
4012
4160
  loading,
4013
4161
  previewData,
4014
4162
  attribute,
@@ -4019,6 +4167,8 @@ const BulkUpdatePreviewModal = ({
4019
4167
  }) => {
4020
4168
  const [filterTab, setFilterTab] = useState("all");
4021
4169
  const [searchQuery, setSearchQuery] = useState("");
4170
+ const { canWorkspaceProceedToExecute } = useBulkUpdaterRBAC();
4171
+ const allowProceed = canProceed !== void 0 ? canProceed : canWorkspaceProceedToExecute;
4022
4172
  const filteredDiffs = useMemo(() => {
4023
4173
  if (!previewData || !previewData.diffs) return [];
4024
4174
  let items = previewData.diffs;
@@ -4365,7 +4515,7 @@ const BulkUpdatePreviewModal = ({
4365
4515
  },
4366
4516
  children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
4367
4517
  /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "M", onClick: onClose, children: "Close Preview" }),
4368
- /* @__PURE__ */ jsxs(
4518
+ allowProceed && /* @__PURE__ */ jsxs(
4369
4519
  Button,
4370
4520
  {
4371
4521
  variant: "default",
@@ -5931,7 +6081,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
5931
6081
  colDef.key
5932
6082
  );
5933
6083
  }
5934
- function formatDisplayValue(val) {
6084
+ function formatDisplayValue(val, options) {
5935
6085
  if (val === void 0 || val === null || val === "") {
5936
6086
  return "(empty / not set)";
5937
6087
  }
@@ -5947,16 +6097,16 @@ function formatDisplayValue(val) {
5947
6097
  if (Array.isArray(val)) {
5948
6098
  if (val.length === 0) return "(empty / unlinked)";
5949
6099
  return val.map(
5950
- (item) => typeof item === "object" && item !== null ? item.name || item.title || item.email || item.username || item.documentId || item.id : String(item)
6100
+ (item) => typeof item === "object" && item !== null ? resolveEntityLabel(item, options) : resolveEntityLabel(item, options)
5951
6101
  ).join(", ");
5952
6102
  }
5953
6103
  if (typeof val === "object" && val !== null) {
5954
6104
  if (val.isRelation && val.display) return val.display;
5955
- return val.name || val.title || val.email || val.username || val.documentId || val.id || JSON.stringify(val);
6105
+ return resolveEntityLabel(val, options);
5956
6106
  }
5957
- return String(val);
6107
+ return resolveEntityLabel(val, options);
5958
6108
  }
5959
- function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip) {
6109
+ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip, searchRelOptions, relationOptions) {
5960
6110
  switch (colDef.key) {
5961
6111
  case "select":
5962
6112
  return /* @__PURE__ */ jsx(
@@ -5967,7 +6117,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
5967
6117
  }
5968
6118
  );
5969
6119
  case "identifier": {
5970
- const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
6120
+ const mainText = entry.name || entry.title || entry.authorName || resolveEntityLabel(entry, searchRelOptions) || `Entry #${entry.id || entry.documentId}`;
5971
6121
  const dzField = Object.keys(entry).find(
5972
6122
  (k) => Array.isArray(entry[k]) && entry[k].length > 0 && entry[k].some((item) => item && item.__component)
5973
6123
  );
@@ -6003,7 +6153,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6003
6153
  return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6004
6154
  }
6005
6155
  if (matches.length === 1 && !matches[0].componentUid) {
6006
- const displayStr = formatDisplayValue(matches[0].value);
6156
+ const displayStr = formatDisplayValue(matches[0].value, searchRelOptions);
6007
6157
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6008
6158
  return /* @__PURE__ */ jsx(
6009
6159
  Typography,
@@ -6025,7 +6175,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6025
6175
  }
6026
6176
  const qLower = (filterQuery || "").trim().toLowerCase();
6027
6177
  return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6028
- const displayStr = formatDisplayValue(m.value);
6178
+ const displayStr = formatDisplayValue(m.value, searchRelOptions);
6029
6179
  const isMatchItem = qLower && displayStr.toLowerCase().includes(qLower);
6030
6180
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6031
6181
  return /* @__PURE__ */ jsxs(
@@ -6077,8 +6227,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6077
6227
  if (matches.length === 0) {
6078
6228
  return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6079
6229
  }
6230
+ const activeRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
6080
6231
  if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
6081
- const displayStr = formatDisplayValue(matches[0].value);
6232
+ const displayStr = formatDisplayValue(matches[0].value, activeRelOpts);
6082
6233
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6083
6234
  return /* @__PURE__ */ jsx(
6084
6235
  Typography,
@@ -6098,7 +6249,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6098
6249
  );
6099
6250
  }
6100
6251
  return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6101
- const displayStr = formatDisplayValue(m.value);
6252
+ const displayStr = formatDisplayValue(m.value, activeRelOpts);
6102
6253
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6103
6254
  return /* @__PURE__ */ jsxs(
6104
6255
  Flex,
@@ -6230,8 +6381,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6230
6381
  if (matches.length === 0) {
6231
6382
  return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6232
6383
  }
6384
+ const targetRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
6233
6385
  if (matches.length === 1 && !matches[0].componentUid) {
6234
- const displayStr = formatDisplayValue(matches[0].value);
6386
+ const displayStr = formatDisplayValue(matches[0].value, targetRelOpts);
6235
6387
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6236
6388
  return /* @__PURE__ */ jsx(
6237
6389
  Typography,
@@ -6251,7 +6403,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6251
6403
  );
6252
6404
  }
6253
6405
  return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6254
- const displayStr = formatDisplayValue(m.value);
6406
+ const displayStr = formatDisplayValue(m.value, targetRelOpts);
6255
6407
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6256
6408
  return /* @__PURE__ */ jsxs(
6257
6409
  Flex,
@@ -6312,8 +6464,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6312
6464
  if (matches.length === 0) {
6313
6465
  return /* @__PURE__ */ jsx(Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
6314
6466
  }
6467
+ const attrRelOpts = attrName === searchAttribute ? searchRelOptions : attrName === selectedAttribute ? gridCtx?.relationOptions || relationOptions : searchRelOptions || relationOptions;
6315
6468
  if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
6316
- const displayStr = formatDisplayValue(matches[0].value);
6469
+ const displayStr = formatDisplayValue(matches[0].value, attrRelOpts);
6317
6470
  return /* @__PURE__ */ jsx(
6318
6471
  Typography,
6319
6472
  {
@@ -6325,7 +6478,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6325
6478
  );
6326
6479
  }
6327
6480
  return /* @__PURE__ */ jsx(Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
6328
- const displayStr = formatDisplayValue(m.value);
6481
+ const displayStr = formatDisplayValue(m.value, attrRelOpts);
6329
6482
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6330
6483
  return /* @__PURE__ */ jsxs(
6331
6484
  Flex,
@@ -6376,6 +6529,7 @@ const BulkUpdater = () => {
6376
6529
  const { get, post } = useFetchClient();
6377
6530
  const { toggleNotification } = useNotification();
6378
6531
  const permissions = useBulkUpdaterRBAC();
6532
+ const canAnyUpdateExecution = permissions.canWorkspaceSubmitForChecker || permissions.canWorkspaceForceRunNow || permissions.canWorkspaceQueueForOffPeak;
6379
6533
  const getInitialTab = () => {
6380
6534
  try {
6381
6535
  const params = new URLSearchParams(window.location.search);
@@ -6424,6 +6578,7 @@ const BulkUpdater = () => {
6424
6578
  const [auditEnabled, setAuditEnabled] = useState(false);
6425
6579
  const [executionWindow, setExecutionWindow] = useState(null);
6426
6580
  const [showConfirmModal, setShowConfirmModal] = useState(false);
6581
+ const [confirmModalSource, setConfirmModalSource] = useState("direct");
6427
6582
  const [pendingBatches, setPendingBatches] = useState([]);
6428
6583
  const [pendingBatchesLoading, setPendingBatchesLoading] = useState(false);
6429
6584
  const [approvingBatchId, setApprovingBatchId] = useState(null);
@@ -6466,7 +6621,9 @@ const BulkUpdater = () => {
6466
6621
  setRelationOptionsLoading(true);
6467
6622
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
6468
6623
  if (res.data && res.data.success) {
6469
- setRelationOptions(res.data.options || []);
6624
+ const opts = res.data.options || [];
6625
+ setRelationOptions(opts);
6626
+ registerRelationOptions(opts);
6470
6627
  }
6471
6628
  } catch {
6472
6629
  setRelationOptions([]);
@@ -6503,7 +6660,9 @@ const BulkUpdater = () => {
6503
6660
  setSearchRelationOptionsLoading(true);
6504
6661
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
6505
6662
  if (res.data && res.data.success) {
6506
- setSearchRelationOptions(res.data.options || []);
6663
+ const opts = res.data.options || [];
6664
+ setSearchRelationOptions(opts);
6665
+ registerRelationOptions(opts);
6507
6666
  }
6508
6667
  } catch {
6509
6668
  setSearchRelationOptions([]);
@@ -6519,13 +6678,6 @@ const BulkUpdater = () => {
6519
6678
  const [gridFilterModifiedOnly, setGridFilterModifiedOnly] = useState(false);
6520
6679
  const [validationRules, setValidationRules] = useState([]);
6521
6680
  const effectiveSearchAttribute = searchAttribute || selectedAttribute;
6522
- useEffect(() => {
6523
- if (effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute]) {
6524
- fetchSearchRelationOptions(relationsMeta[effectiveSearchAttribute].targetUid);
6525
- } else {
6526
- setSearchRelationOptions([]);
6527
- }
6528
- }, [effectiveSearchAttribute, relationsMeta]);
6529
6681
  const [filterOperator, setFilterOperator] = useState("none");
6530
6682
  const [filterQuery, setFilterQuery] = useState("");
6531
6683
  const [entrySearch, setEntrySearch] = useState("");
@@ -6936,10 +7088,24 @@ const BulkUpdater = () => {
6936
7088
  if (!collections.length || !selectedCollectionUid) return null;
6937
7089
  return collections.find((c) => c.uid === selectedCollectionUid) || null;
6938
7090
  }, [collections, selectedCollectionUid]);
7091
+ const getEffectiveRelMeta = useCallback(
7092
+ (attr) => {
7093
+ return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
7094
+ },
7095
+ [selectedCol, relationsMeta]
7096
+ );
7097
+ useEffect(() => {
7098
+ const activeRel = getEffectiveRelMeta(effectiveSearchAttribute);
7099
+ if (effectiveSearchAttribute && activeRel) {
7100
+ fetchSearchRelationOptions(activeRel.targetUid);
7101
+ } else {
7102
+ setSearchRelationOptions([]);
7103
+ }
7104
+ }, [effectiveSearchAttribute, getEffectiveRelMeta]);
6939
7105
  const activeAttrMeta = useMemo(() => {
6940
7106
  if (!selectedAttribute) return void 0;
6941
7107
  const base = selectedCol?.attributesMeta?.[selectedAttribute] || attributesMeta[selectedAttribute];
6942
- const relMeta = selectedCol?.relations?.[selectedAttribute] || relationsMeta[selectedAttribute];
7108
+ const relMeta = getEffectiveRelMeta(selectedAttribute);
6943
7109
  if (!base && !relMeta) return void 0;
6944
7110
  if (relMeta && (!base || !base.isRelation)) {
6945
7111
  return {
@@ -6950,7 +7116,7 @@ const BulkUpdater = () => {
6950
7116
  };
6951
7117
  }
6952
7118
  return base;
6953
- }, [selectedAttribute, selectedCol, attributesMeta, relationsMeta]);
7119
+ }, [selectedAttribute, selectedCol, attributesMeta, getEffectiveRelMeta]);
6954
7120
  const totalDirtyRecordsCount = useMemo(() => Object.keys(gridEdits).length, [gridEdits]);
6955
7121
  const totalDirtyCellsCount = useMemo(
6956
7122
  () => Object.values(gridEdits).reduce(
@@ -6966,7 +7132,7 @@ const BulkUpdater = () => {
6966
7132
  const handleGridCellCommit = React__default.useCallback(
6967
7133
  (entry, colUid, occ, newValue, validationError) => {
6968
7134
  const key = `${colUid}${KEY_SEP}${entry.documentId}`;
6969
- const recordLabel = entry.name || entry.title || entry.email || `Entry #${entry.id || entry.documentId}`;
7135
+ const recordLabel = entry.name || entry.title || entry.authorName || entry.email || `Entry #${entry.id || entry.documentId}`;
6970
7136
  setGridEdits((prev) => {
6971
7137
  const existingRec = prev[key] || {
6972
7138
  uid: colUid,
@@ -7145,8 +7311,9 @@ const BulkUpdater = () => {
7145
7311
  }
7146
7312
  setSelectedRelationDocId("");
7147
7313
  setAttributeValue("");
7148
- if (newAttr && relationsMeta[newAttr]) {
7149
- fetchRelationOptions(relationsMeta[newAttr].targetUid);
7314
+ const relForNewAttr = getEffectiveRelMeta(newAttr);
7315
+ if (newAttr && relForNewAttr) {
7316
+ fetchRelationOptions(relForNewAttr.targetUid);
7150
7317
  } else {
7151
7318
  setRelationOptions([]);
7152
7319
  }
@@ -7164,19 +7331,23 @@ const BulkUpdater = () => {
7164
7331
  }, [availableColAttributes, componentDepth, attributesMeta, selectedCol]);
7165
7332
  const memoizedComboboxOptions = useMemo(() => {
7166
7333
  if (depthFilteredAttributes.length === 0) {
7167
- return /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
7334
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxs(Typography, { variant: "pi", textColor: "neutral600", children: [
7168
7335
  "No attributes available for this collection type (Depth L",
7169
7336
  componentDepth,
7170
7337
  ")"
7171
- ] }) });
7338
+ ] }) }) });
7172
7339
  }
7173
- return depthFilteredAttributes.map((attr) => {
7174
- const rel = relationsMeta[attr];
7340
+ return /* @__PURE__ */ jsx(Fragment, { children: depthFilteredAttributes.map((attr) => {
7341
+ const rel = getEffectiveRelMeta(attr);
7175
7342
  const depth = getAttrDepth(attr);
7343
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
7176
7344
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
7177
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
7345
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
7178
7346
  return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
7179
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: attr }),
7347
+ /* @__PURE__ */ jsxs(Box, { children: [
7348
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
7349
+ friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
7350
+ ] }),
7180
7351
  rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
7181
7352
  "relation ➔ ",
7182
7353
  rel.targetDisplayName
@@ -7186,16 +7357,20 @@ const BulkUpdater = () => {
7186
7357
  " component"
7187
7358
  ] }) : null
7188
7359
  ] }) }, attr);
7189
- });
7190
- }, [depthFilteredAttributes, relationsMeta, selectedAttribute, componentDepth, attributesMeta]);
7360
+ }) });
7361
+ }, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
7191
7362
  const memoizedSearchComboboxOptions = useMemo(() => {
7192
7363
  return /* @__PURE__ */ jsx(Fragment, { children: depthFilteredAttributes.map((attr) => {
7193
- const rel = relationsMeta[attr];
7364
+ const rel = getEffectiveRelMeta(attr);
7194
7365
  const depth = getAttrDepth(attr);
7366
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
7195
7367
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
7196
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
7368
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
7197
7369
  return /* @__PURE__ */ jsx(ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
7198
- /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
7370
+ /* @__PURE__ */ jsxs(Box, { children: [
7371
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
7372
+ friendlyLabel !== attr && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
7373
+ ] }),
7199
7374
  rel ? /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
7200
7375
  "relation ➔ ",
7201
7376
  rel.targetDisplayName
@@ -7206,7 +7381,7 @@ const BulkUpdater = () => {
7206
7381
  ] }) : null
7207
7382
  ] }) }, `search_${attr}`);
7208
7383
  }) });
7209
- }, [depthFilteredAttributes, relationsMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
7384
+ }, [depthFilteredAttributes, getEffectiveRelMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
7210
7385
  const handleSearchAttributeChange = (newAttr) => {
7211
7386
  const finalAttr = newAttr === "__default__" ? "" : newAttr;
7212
7387
  setSearchAttribute(finalAttr);
@@ -7309,6 +7484,7 @@ const BulkUpdater = () => {
7309
7484
  if (!obj || typeof obj !== "object") return false;
7310
7485
  if (testString(obj.name)) return true;
7311
7486
  if (testString(obj.title)) return true;
7487
+ if (testString(obj.authorName)) return true;
7312
7488
  if (testString(obj.email)) return true;
7313
7489
  if (testString(obj.username)) return true;
7314
7490
  if (testString(obj.documentId)) return true;
@@ -7500,7 +7676,7 @@ const BulkUpdater = () => {
7500
7676
  () => gridEditMode ? computeLifecycleStatsForKeys(gridTargetKeys) : selectedLifecycleStats,
7501
7677
  [gridEditMode, gridTargetKeys, computeLifecycleStatsForKeys, selectedLifecycleStats]
7502
7678
  );
7503
- const handleOpenConfirmModal = () => {
7679
+ const handleOpenConfirmModal = (source = "direct") => {
7504
7680
  if (!selectedAttribute) {
7505
7681
  toggleNotification({
7506
7682
  type: "warning",
@@ -7535,6 +7711,7 @@ const BulkUpdater = () => {
7535
7711
  }
7536
7712
  setPublishStrategy("safe");
7537
7713
  setUnreviewedConsent(false);
7714
+ setConfirmModalSource(source === "preview" ? "preview" : "direct");
7538
7715
  setShowConfirmModal(true);
7539
7716
  };
7540
7717
  const handleOpenPreviewModal = async () => {
@@ -7650,8 +7827,10 @@ const BulkUpdater = () => {
7650
7827
  }
7651
7828
  const displaySummaryVal = gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${targets.length} records)` : attributeValue;
7652
7829
  try {
7830
+ const isFromPreview = confirmModalSource === "preview";
7653
7831
  setUpdating(true);
7654
7832
  setShowConfirmModal(false);
7833
+ setConfirmModalSource("direct");
7655
7834
  setShowProcessingDashboard(true);
7656
7835
  setIsSubmittingBatch(true);
7657
7836
  setLastResults(null);
@@ -7689,7 +7868,8 @@ const BulkUpdater = () => {
7689
7868
  publishOnApproval,
7690
7869
  publishStrategy,
7691
7870
  unreviewedConsent,
7692
- unreviewedCount: selectedLifecycleStats.unreviewedCount
7871
+ unreviewedCount: selectedLifecycleStats.unreviewedCount,
7872
+ ...isFromPreview ? { initiatedFromPreview: true } : {}
7693
7873
  };
7694
7874
  const res = await post("/bulk-updater/batch-update", payload);
7695
7875
  setIsSubmittingBatch(false);
@@ -8566,13 +8746,13 @@ const BulkUpdater = () => {
8566
8746
  ]
8567
8747
  }
8568
8748
  ) }),
8569
- (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute] ? /* @__PURE__ */ jsxs(Field.Root, { children: [
8570
- /* @__PURE__ */ jsx(Field.Label, { children: `Target ${relationsMeta[effectiveSearchAttribute].targetDisplayName} Relation` }),
8749
+ (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && getEffectiveRelMeta(effectiveSearchAttribute) ? /* @__PURE__ */ jsxs(Field.Root, { children: [
8750
+ /* @__PURE__ */ jsx(Field.Label, { children: `Target ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} Relation` }),
8571
8751
  /* @__PURE__ */ jsx(
8572
8752
  Combobox,
8573
8753
  {
8574
8754
  autocomplete: { type: "list", filter: "contains" },
8575
- placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[effectiveSearchAttribute].targetDisplayName} or type text...`,
8755
+ placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} or type text...`,
8576
8756
  value: filterQuery,
8577
8757
  onClear: () => setFilterQuery(""),
8578
8758
  onChange: (val) => {
@@ -9215,7 +9395,7 @@ const BulkUpdater = () => {
9215
9395
  recordEdits,
9216
9396
  relationOptions,
9217
9397
  relationOptionsLoading,
9218
- relationIsMulti: Boolean(relationsMeta[selectedAttribute]?.isMulti),
9398
+ relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
9219
9399
  validationRules,
9220
9400
  onCommitEdit: handleGridCellCommit,
9221
9401
  onResetEdit: handleGridCellReset
@@ -9253,7 +9433,9 @@ const BulkUpdater = () => {
9253
9433
  onToggleExpandDz,
9254
9434
  filterQuery,
9255
9435
  gridCtx,
9256
- cellTooltip
9436
+ cellTooltip,
9437
+ searchRelationOptions,
9438
+ relationOptions
9257
9439
  ) }, colDef.key);
9258
9440
  })
9259
9441
  }
@@ -9285,7 +9467,7 @@ const BulkUpdater = () => {
9285
9467
  recordEdits,
9286
9468
  relationOptions,
9287
9469
  relationOptionsLoading,
9288
- relationIsMulti: Boolean(relationsMeta[selectedAttribute]?.isMulti),
9470
+ relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
9289
9471
  validationRules,
9290
9472
  onToggleDzBlock: toggleDzBlock,
9291
9473
  onCommitEdit: handleGridCellCommit,
@@ -9478,28 +9660,28 @@ const BulkUpdater = () => {
9478
9660
  )
9479
9661
  ] })
9480
9662
  }
9481
- ) : relationsMeta[selectedAttribute] ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
9663
+ ) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
9482
9664
  /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
9483
9665
  /* @__PURE__ */ jsxs(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral700", children: [
9484
9666
  "Target ",
9485
- relationsMeta[selectedAttribute].targetDisplayName,
9667
+ getEffectiveRelMeta(selectedAttribute).targetDisplayName,
9486
9668
  " Relation:"
9487
9669
  ] }),
9488
9670
  /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
9489
- relationsMeta[selectedAttribute].relationType,
9671
+ getEffectiveRelMeta(selectedAttribute).relationType,
9490
9672
  " → ",
9491
- relationsMeta[selectedAttribute].targetDisplayName
9673
+ getEffectiveRelMeta(selectedAttribute).targetDisplayName
9492
9674
  ] }),
9493
- relationsMeta[selectedAttribute].isMulti && /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
9675
+ getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
9494
9676
  ] }),
9495
9677
  /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", style: { width: "100%" }, children: [
9496
9678
  /* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 200 }, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
9497
- /* @__PURE__ */ jsx(Field.Label, { children: `Choose ${relationsMeta[selectedAttribute].targetDisplayName}` }),
9679
+ /* @__PURE__ */ jsx(Field.Label, { children: `Choose ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}` }),
9498
9680
  /* @__PURE__ */ jsxs(
9499
9681
  Combobox,
9500
9682
  {
9501
9683
  autocomplete: { type: "list", filter: "contains" },
9502
- placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[selectedAttribute].targetDisplayName}...`,
9684
+ placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}...`,
9503
9685
  value: selectedRelationDocId,
9504
9686
  onChange: (val) => {
9505
9687
  const docId = val ? String(val) : "";
@@ -9518,7 +9700,7 @@ const BulkUpdater = () => {
9518
9700
  }
9519
9701
  )
9520
9702
  ] }) }),
9521
- relationsMeta[selectedAttribute].isMulti && /* @__PURE__ */ jsx(Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxs(
9703
+ getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsx(Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxs(
9522
9704
  SingleSelect,
9523
9705
  {
9524
9706
  label: "Action Mode",
@@ -9578,10 +9760,10 @@ const BulkUpdater = () => {
9578
9760
  startIcon: /* @__PURE__ */ jsx(Play, {}),
9579
9761
  variant: "default",
9580
9762
  size: "L",
9581
- onClick: handleOpenConfirmModal,
9763
+ onClick: () => handleOpenConfirmModal("direct"),
9582
9764
  loading: updating,
9583
- disabled: !permissions.canWorkspaceExecute || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9584
- title: !permissions.canWorkspaceExecute ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9765
+ disabled: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9766
+ title: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9585
9767
  children: [
9586
9768
  "Update Selected (",
9587
9769
  gridEditMode ? gridSerialized.targets.length : totalSelectedCount,
@@ -10157,7 +10339,10 @@ const BulkUpdater = () => {
10157
10339
  boxSizing: "border-box",
10158
10340
  overflowY: "auto"
10159
10341
  },
10160
- onClick: () => setShowConfirmModal(false),
10342
+ onClick: () => {
10343
+ setShowConfirmModal(false);
10344
+ setConfirmModalSource("direct");
10345
+ },
10161
10346
  children: /* @__PURE__ */ jsxs(
10162
10347
  Box,
10163
10348
  {
@@ -10217,8 +10402,8 @@ const BulkUpdater = () => {
10217
10402
  " heterogeneous edits across ",
10218
10403
  gridSerialized.targets.length,
10219
10404
  " records)"
10220
- ] }) : relationsMeta[selectedAttribute] ? /* @__PURE__ */ jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
10221
- relationsMeta[selectedAttribute].isMulti ? `[${relationMode.toUpperCase()}] ` : "",
10405
+ ] }) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxs(Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
10406
+ getEffectiveRelMeta(selectedAttribute).isMulti ? `[${relationMode.toUpperCase()}] ` : "",
10222
10407
  relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none selected)"
10223
10408
  ] }) }) : useRegex ? /* @__PURE__ */ jsxs("span", { children: [
10224
10409
  "Replace ",
@@ -10501,9 +10686,20 @@ const BulkUpdater = () => {
10501
10686
  children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, style: { width: "100%" }, children: [
10502
10687
  publishOnApproval && updateModalLifecycleStats.unreviewedCount > 0 && publishStrategy === "all" && !unreviewedConsent && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "⚠️ Explicit consent is required before publishing records with unreviewed draft revisions." }),
10503
10688
  /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", gap: 3, style: { width: "100%" }, children: [
10504
- /* @__PURE__ */ jsx(Button, { variant: "tertiary", size: "M", onClick: () => setShowConfirmModal(false), children: "Cancel" }),
10505
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: [
10506
- /* @__PURE__ */ jsx(
10689
+ /* @__PURE__ */ jsx(
10690
+ Button,
10691
+ {
10692
+ variant: "tertiary",
10693
+ size: "M",
10694
+ onClick: () => {
10695
+ setShowConfirmModal(false);
10696
+ setConfirmModalSource("direct");
10697
+ },
10698
+ children: "Cancel"
10699
+ }
10700
+ ),
10701
+ /* @__PURE__ */ jsx(Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: !canAnyUpdateExecution ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "You do not have permission to Submit for Checker, Queue for Off-Peak, or Force Run bulk updates." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
10702
+ permissions.canWorkspaceSubmitForChecker && /* @__PURE__ */ jsx(
10507
10703
  Button,
10508
10704
  {
10509
10705
  variant: executionWindow?.isBusinessHours ? "default" : "secondary",
@@ -10515,7 +10711,7 @@ const BulkUpdater = () => {
10515
10711
  }
10516
10712
  ),
10517
10713
  executionWindow?.isBusinessHours ? /* @__PURE__ */ jsxs(Fragment, { children: [
10518
- /* @__PURE__ */ jsxs(
10714
+ permissions.canWorkspaceQueueForOffPeak && /* @__PURE__ */ jsxs(
10519
10715
  Button,
10520
10716
  {
10521
10717
  variant: "secondary",
@@ -10530,7 +10726,7 @@ const BulkUpdater = () => {
10530
10726
  ]
10531
10727
  }
10532
10728
  ),
10533
- /* @__PURE__ */ jsx(
10729
+ permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsx(
10534
10730
  Button,
10535
10731
  {
10536
10732
  variant: "danger-light",
@@ -10541,7 +10737,7 @@ const BulkUpdater = () => {
10541
10737
  children: "Force Run Now"
10542
10738
  }
10543
10739
  )
10544
- ] }) : /* @__PURE__ */ jsx(
10740
+ ] }) : permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsx(
10545
10741
  Button,
10546
10742
  {
10547
10743
  variant: "default",
@@ -10552,7 +10748,7 @@ const BulkUpdater = () => {
10552
10748
  children: "Confirm & Execute Now"
10553
10749
  }
10554
10750
  )
10555
- ] })
10751
+ ] }) })
10556
10752
  ] })
10557
10753
  ] })
10558
10754
  }
@@ -10830,9 +11026,11 @@ const BulkUpdater = () => {
10830
11026
  {
10831
11027
  isOpen: showPreviewModal,
10832
11028
  onClose: () => setShowPreviewModal(false),
11029
+ canProceed: permissions.canWorkspaceProceedToExecute,
10833
11030
  onProceed: () => {
11031
+ if (!permissions.canWorkspaceProceedToExecute) return;
10834
11032
  setShowPreviewModal(false);
10835
- handleOpenConfirmModal();
11033
+ handleOpenConfirmModal("preview");
10836
11034
  },
10837
11035
  loading: previewLoading,
10838
11036
  previewData,
@@ -10840,7 +11038,7 @@ const BulkUpdater = () => {
10840
11038
  editMode: gridEditMode ? "grid" : "common",
10841
11039
  publishOnApproval,
10842
11040
  lifecycleStats: selectedLifecycleStats,
10843
- targetValueDisplay: gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${gridSerialized.targets.length} records)` : relationsMeta[selectedAttribute] ? selectedRelationDocId === "__clear__" ? "Clear / Unlink Relation" : relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none)" : useRegex ? `Replace /${regexPattern}/g with "${attributeValue}"` : attributeValue
11041
+ targetValueDisplay: gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${gridSerialized.targets.length} records)` : getEffectiveRelMeta(selectedAttribute) ? selectedRelationDocId === "__clear__" ? "Clear / Unlink Relation" : relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none)" : useRegex ? `Replace /${regexPattern}/g with "${attributeValue}"` : attributeValue
10844
11042
  }
10845
11043
  ),
10846
11044
  /* @__PURE__ */ jsx(
@@ -10871,6 +11069,7 @@ const BulkUpdater = () => {
10871
11069
  };
10872
11070
  export {
10873
11071
  BulkUpdater as default,
11072
+ formatAttributeHeaderLabel,
10874
11073
  formatComponentName,
10875
11074
  formatDisplayValue,
10876
11075
  formatFullTooltipValue,
@@ -10882,6 +11081,9 @@ export {
10882
11081
  getNestedValue,
10883
11082
  getPropertyValue,
10884
11083
  getSortOptionsForCollection,
10885
- parseDynamicZonePath
11084
+ parseDynamicZonePath,
11085
+ registerRelationOptions,
11086
+ resolveEffectiveRelationMeta,
11087
+ resolveEntityLabel
10886
11088
  };
10887
- //# sourceMappingURL=BulkUpdater-DISkZC1Y.mjs.map
11089
+ //# sourceMappingURL=BulkUpdater-CV49TvOV.mjs.map