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
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const admin = require("@strapi/strapi/admin");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
- const ValidationRulesTab = require("./ValidationRulesTab-r6S-ZFDp.js");
8
+ const ValidationRulesTab = require("./ValidationRulesTab-of8bIzre.js");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
11
11
  function parseCsvRows(csvText) {
@@ -537,6 +537,113 @@ function areClientValuesEqual(a, b) {
537
537
  }
538
538
  return String(na) === String(nb);
539
539
  }
540
+ const relationLabelRegistry = /* @__PURE__ */ new Map();
541
+ function registerRelationLabel(key, label) {
542
+ if (key !== void 0 && key !== null && label && typeof label === "string" && label.trim()) {
543
+ relationLabelRegistry.set(String(key).trim(), label.trim());
544
+ }
545
+ }
546
+ function registerRelationOptions(options) {
547
+ if (Array.isArray(options)) {
548
+ for (const opt of options) {
549
+ if (opt && opt.label) {
550
+ if (opt.documentId) registerRelationLabel(opt.documentId, opt.label);
551
+ if (opt.id !== void 0 && opt.id !== null) registerRelationLabel(opt.id, opt.label);
552
+ }
553
+ }
554
+ }
555
+ }
556
+ function getCachedRelationLabel(key) {
557
+ if (key === void 0 || key === null) return void 0;
558
+ return relationLabelRegistry.get(String(key).trim());
559
+ }
560
+ function resolveEntityLabel(item, options) {
561
+ if (item === void 0 || item === null) return "";
562
+ if (typeof item !== "object") {
563
+ const s = String(item).trim();
564
+ if (options && Array.isArray(options)) {
565
+ const match = options.find((o) => o.documentId === s || String(o.id) === s);
566
+ if (match?.label) return match.label.trim();
567
+ }
568
+ const cached = getCachedRelationLabel(s);
569
+ if (cached) return cached;
570
+ return s;
571
+ }
572
+ if (item.label && typeof item.label === "string" && item.label.trim()) {
573
+ return item.label.trim();
574
+ }
575
+ const candidateFields = [
576
+ "name",
577
+ "title",
578
+ "authorName",
579
+ "label",
580
+ "heading",
581
+ "subject",
582
+ "fullName",
583
+ "username",
584
+ "email",
585
+ "slug"
586
+ ];
587
+ for (const field of candidateFields) {
588
+ if (item[field] !== void 0 && item[field] !== null && String(item[field]).trim() !== "") {
589
+ const resolved = String(item[field]).trim();
590
+ if (item.documentId) registerRelationLabel(item.documentId, resolved);
591
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
592
+ return resolved;
593
+ }
594
+ }
595
+ if (item.firstname || item.lastname) {
596
+ const fn = [item.firstname, item.lastname].filter(Boolean).join(" ").trim();
597
+ if (fn) {
598
+ if (item.documentId) registerRelationLabel(item.documentId, fn);
599
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, fn);
600
+ return fn;
601
+ }
602
+ }
603
+ const systemKeys = /* @__PURE__ */ new Set([
604
+ "id",
605
+ "documentId",
606
+ "createdAt",
607
+ "updatedAt",
608
+ "publishedAt",
609
+ "locale",
610
+ "createdBy",
611
+ "updatedBy",
612
+ "__component",
613
+ "isRelation",
614
+ "relationType",
615
+ "targetUid",
616
+ "targetDisplayName",
617
+ "isMulti",
618
+ "mode",
619
+ "documentIds"
620
+ ]);
621
+ for (const [k, v] of Object.entries(item)) {
622
+ if (!systemKeys.has(k) && typeof v === "string" && v.trim() !== "") {
623
+ const resolved = v.trim();
624
+ if (item.documentId) registerRelationLabel(item.documentId, resolved);
625
+ if (item.id !== void 0 && item.id !== null) registerRelationLabel(item.id, resolved);
626
+ return resolved;
627
+ }
628
+ }
629
+ if (item.documentId) {
630
+ if (options && Array.isArray(options)) {
631
+ const match = options.find((o) => o.documentId === item.documentId);
632
+ if (match?.label) return match.label.trim();
633
+ }
634
+ const cached = getCachedRelationLabel(item.documentId);
635
+ if (cached) return cached;
636
+ }
637
+ if (item.id !== void 0 && item.id !== null) {
638
+ if (options && Array.isArray(options)) {
639
+ const match = options.find((o) => String(o.id) === String(item.id));
640
+ if (match?.label) return match.label.trim();
641
+ }
642
+ const cached = getCachedRelationLabel(item.id);
643
+ if (cached) return cached;
644
+ }
645
+ return item.documentId || (item.id !== void 0 && item.id !== null ? `Entry #${item.id}` : JSON.stringify(item));
646
+ }
540
647
  function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false) {
541
648
  if (rawVal && typeof rawVal === "object" && !Array.isArray(rawVal) && rawVal.mode) {
542
649
  return {
@@ -549,14 +656,14 @@ function extractRelationEditCommand(rawVal, currentDisplayVal, isMulti = false)
549
656
  return {
550
657
  mode: "set",
551
658
  documentIds: rawVal.map((r) => r?.documentId).filter(Boolean),
552
- label: rawVal.map((r) => r?.name || r?.title || r?.email || r?.documentId).filter(Boolean).join(", ")
659
+ label: rawVal.map((r) => resolveEntityLabel(r)).filter(Boolean).join(", ")
553
660
  };
554
661
  }
555
662
  if (rawVal && typeof rawVal === "object" && rawVal.documentId) {
556
663
  return {
557
664
  mode: "set",
558
665
  documentIds: [rawVal.documentId],
559
- label: rawVal.name || rawVal.title || rawVal.email || rawVal.documentId
666
+ label: resolveEntityLabel(rawVal)
560
667
  };
561
668
  }
562
669
  if (typeof rawVal === "string") {
@@ -850,7 +957,10 @@ function getAllNestedValues(obj, path, availableAttributes) {
850
957
  rootTarget.forEach((item, idx) => {
851
958
  if (!item || typeof item !== "object") return;
852
959
  if (parsed.targetIndex !== void 0 && idx !== parsed.targetIndex) return;
853
- if (parsed.targetComponentUid && item.__component !== parsed.targetComponentUid) return;
960
+ const itemComp = item.__component;
961
+ const targetComp = parsed.targetComponentUid;
962
+ const compMatches = !targetComp || itemComp === targetComp || itemComp && (itemComp.toLowerCase() === targetComp.toLowerCase() || itemComp.split(".")[1]?.toLowerCase() === targetComp.toLowerCase() || itemComp.toLowerCase().replace(/[-_]/g, "") === targetComp.toLowerCase().replace(/[-_]/g, ""));
963
+ if (!compMatches) return;
854
964
  const subPath = tail.join(".");
855
965
  const scopedPath = item.__component ? `${head}[${item.__component}].${subPath}` : "";
856
966
  const isSupported = availableAttributes ? availableAttributes.includes(scopedPath) : false;
@@ -905,6 +1015,66 @@ function getAllNestedValues(obj, path, availableAttributes) {
905
1015
  }
906
1016
  return [];
907
1017
  }
1018
+ function formatAttributeHeaderLabel(attr) {
1019
+ if (!attr) return "";
1020
+ if (attr === "updated_at" || attr === "updatedAt") return "Updated At";
1021
+ if (attr === "created_at" || attr === "createdAt") return "Created At";
1022
+ if (attr === "published_at" || attr === "publishedAt") return "Published At";
1023
+ const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\](?:\.(.+))?$/);
1024
+ if (bracketMatch) {
1025
+ const root = bracketMatch[1].replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1026
+ const comp = formatComponentName(bracketMatch[2]);
1027
+ const sub = bracketMatch[3] ? bracketMatch[3].split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ") : "";
1028
+ return sub ? `${root} [${comp}] > ${sub}` : `${root} [${comp}]`;
1029
+ }
1030
+ if (attr.includes(".")) {
1031
+ return attr.split(".").map((s) => s.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase())).join(" > ");
1032
+ }
1033
+ return attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1034
+ }
1035
+ function resolveEffectiveRelationMeta(attr, colRelations, globalRelationsMeta) {
1036
+ if (!attr) return void 0;
1037
+ const rels = colRelations;
1038
+ if (rels) {
1039
+ if (rels[attr]) return rels[attr];
1040
+ const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
1041
+ for (const k of Object.keys(rels)) {
1042
+ if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return rels[k];
1043
+ }
1044
+ for (const k of Object.keys(rels)) {
1045
+ if (k.startsWith(`${attr}.`) || k.toLowerCase().startsWith(`${attr.toLowerCase()}.`)) {
1046
+ return rels[k];
1047
+ }
1048
+ }
1049
+ const attrLeaf = attr.includes(".") ? attr.split(".").pop() : "";
1050
+ for (const [k, rel] of Object.entries(rels)) {
1051
+ const bracketMatch = k.match(/\[([^\]]+)\](?:\.(.+))?/);
1052
+ if (bracketMatch) {
1053
+ const compUid = bracketMatch[1];
1054
+ const compClean = compUid.includes(".") ? compUid.split(".")[1] : compUid;
1055
+ const normComp = compClean.toLowerCase().replace(/[-_ /]/g, "");
1056
+ const subPath = bracketMatch[2] || "";
1057
+ const normSub = subPath.toLowerCase().replace(/[-_ /]/g, "");
1058
+ 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()))) {
1059
+ return rel;
1060
+ }
1061
+ }
1062
+ }
1063
+ for (const [k, rel] of Object.entries(rels)) {
1064
+ if (k.endsWith(`.${attr}`) || k.toLowerCase().endsWith(`.${attr.toLowerCase()}`)) {
1065
+ return rel;
1066
+ }
1067
+ }
1068
+ }
1069
+ if (globalRelationsMeta) {
1070
+ if (globalRelationsMeta[attr]) return globalRelationsMeta[attr];
1071
+ const norm = attr.toLowerCase().replace(/[-_ /]/g, "");
1072
+ for (const k of Object.keys(globalRelationsMeta)) {
1073
+ if (k.toLowerCase().replace(/[-_ /]/g, "") === norm) return globalRelationsMeta[k];
1074
+ }
1075
+ }
1076
+ return void 0;
1077
+ }
908
1078
  function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribute) {
909
1079
  const cols = [
910
1080
  {
@@ -925,26 +1095,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
925
1095
  if (attr === "name" || attr === "title" || attr === selectedAttribute || searchAttribute && attr === searchAttribute) {
926
1096
  return;
927
1097
  }
928
- let formattedLabel = attr;
929
- if (attr === "updated_at" || attr === "updatedAt") {
930
- formattedLabel = "Updated At";
931
- } else if (attr === "created_at" || attr === "createdAt") {
932
- formattedLabel = "Created At";
933
- } else if (attr === "published_at" || attr === "publishedAt") {
934
- formattedLabel = "Published At";
935
- } else {
936
- const bracketMatch = attr.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
937
- if (bracketMatch) {
938
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
939
- const comp = formatComponentName(bracketMatch[2]);
940
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
941
- formattedLabel = `${root} [${comp}] > ${sub}`;
942
- } else if (attr.includes(".")) {
943
- formattedLabel = attr.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
944
- } else {
945
- formattedLabel = attr.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
946
- }
947
- }
1098
+ const formattedLabel = formatAttributeHeaderLabel(attr);
948
1099
  cols.push({
949
1100
  key: `attr_${attr}`,
950
1101
  label: formattedLabel,
@@ -980,16 +1131,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
980
1131
  });
981
1132
  }
982
1133
  if (searchAttribute && searchAttribute !== selectedAttribute) {
983
- let formattedSearchLabel = searchAttribute;
984
- const bracketMatch = searchAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
985
- if (bracketMatch) {
986
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
987
- const comp = formatComponentName(bracketMatch[2]);
988
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
989
- formattedSearchLabel = `${root} [${comp}] > ${sub}`;
990
- } else if (searchAttribute.includes(".")) {
991
- formattedSearchLabel = searchAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
992
- }
1134
+ const formattedSearchLabel = formatAttributeHeaderLabel(searchAttribute);
993
1135
  cols.push({
994
1136
  key: "search_attr",
995
1137
  label: `Search: "${formattedSearchLabel}"`,
@@ -998,18 +1140,7 @@ function getAvailableColumnsForCollection(col, selectedAttribute, searchAttribut
998
1140
  });
999
1141
  }
1000
1142
  if (selectedAttribute && selectedAttribute.trim()) {
1001
- let formattedTargetLabel = selectedAttribute;
1002
- const bracketMatch = selectedAttribute.match(/^([^.[]+)\[([^\]]+)\]\.(.+)$/);
1003
- if (bracketMatch) {
1004
- const root = bracketMatch[1].charAt(0).toUpperCase() + bracketMatch[1].slice(1);
1005
- const comp = formatComponentName(bracketMatch[2]);
1006
- const sub = bracketMatch[3].split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
1007
- formattedTargetLabel = `${root} [${comp}] > ${sub}`;
1008
- } else if (selectedAttribute.includes(".")) {
1009
- formattedTargetLabel = selectedAttribute.split(".").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" > ");
1010
- } else {
1011
- formattedTargetLabel = selectedAttribute.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
1012
- }
1143
+ const formattedTargetLabel = formatAttributeHeaderLabel(selectedAttribute);
1013
1144
  cols.push({
1014
1145
  key: "current_attr",
1015
1146
  label: `Current Value: "${formattedTargetLabel}"`,
@@ -1125,18 +1256,21 @@ function formatFullTooltipValue(val) {
1125
1256
  return isNaN(val.getTime()) ? "(invalid date)" : val.toISOString();
1126
1257
  }
1127
1258
  if (typeof val === "string") {
1259
+ const cached = getCachedRelationLabel(val);
1260
+ if (cached) return cached;
1128
1261
  return val;
1129
1262
  }
1130
1263
  if (Array.isArray(val)) {
1131
1264
  if (val.length === 0) return "(empty array)";
1132
- try {
1133
- return JSON.stringify(val, null, 2);
1134
- } catch {
1135
- return String(val);
1136
- }
1265
+ return val.map(
1266
+ (item) => typeof item === "object" && item !== null ? resolveEntityLabel(item) : getCachedRelationLabel(item) || String(item)
1267
+ ).join(", ");
1137
1268
  }
1138
1269
  if (typeof val === "object") {
1139
1270
  if (val.isRelation && val.display) return val.display;
1271
+ if (val.documentId || val.authorName || val.name || val.title) {
1272
+ return resolveEntityLabel(val);
1273
+ }
1140
1274
  try {
1141
1275
  return JSON.stringify(val, null, 2);
1142
1276
  } catch {
@@ -1151,7 +1285,7 @@ function getCellTooltipText(colDef, entry, colAttributes, selectedAttribute, sea
1151
1285
  case "select":
1152
1286
  return void 0;
1153
1287
  case "identifier": {
1154
- const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
1288
+ const mainText = resolveEntityLabel(entry) || `Entry #${entry.id || entry.documentId}`;
1155
1289
  const parts = [String(mainText)];
1156
1290
  if (entry.documentId) parts.push(`Document ID: ${entry.documentId}`);
1157
1291
  if (entry.id && String(entry.id) !== String(entry.documentId)) parts.push(`ID: ${entry.id}`);
@@ -1488,19 +1622,28 @@ function CsvManagerTab() {
1488
1622
  }
1489
1623
  };
1490
1624
  const getAttrDepth = (attr) => attributesMeta[attr]?.depth ?? (attr.includes(".") ? attr.split(".").length - 1 : 0);
1625
+ const getEffectiveRelMeta = React.useCallback(
1626
+ (attr) => {
1627
+ return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
1628
+ },
1629
+ [selectedCol, relationsMeta]
1630
+ );
1491
1631
  React.useEffect(() => {
1492
- if (searchAttribute && relationsMeta[searchAttribute]) {
1493
- fetchSearchRelationOptions(relationsMeta[searchAttribute].targetUid);
1632
+ const activeRel = getEffectiveRelMeta(searchAttribute);
1633
+ if (searchAttribute && activeRel) {
1634
+ fetchSearchRelationOptions(activeRel.targetUid);
1494
1635
  } else {
1495
1636
  setSearchRelationOptions([]);
1496
1637
  }
1497
- }, [searchAttribute, relationsMeta]);
1638
+ }, [searchAttribute, getEffectiveRelMeta]);
1498
1639
  const fetchSearchRelationOptions = async (targetUid) => {
1499
1640
  try {
1500
1641
  setSearchRelationOptionsLoading(true);
1501
1642
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
1502
1643
  if (res.data && res.data.success) {
1503
- setSearchRelationOptions(res.data.options || []);
1644
+ const opts = res.data.options || [];
1645
+ setSearchRelationOptions(opts);
1646
+ registerRelationOptions(opts);
1504
1647
  }
1505
1648
  } catch {
1506
1649
  setSearchRelationOptions([]);
@@ -2187,12 +2330,16 @@ function CsvManagerTab() {
2187
2330
  }
2188
2331
  },
2189
2332
  children: (selectedCol?.attributes || []).map((attr) => {
2190
- const rel = relationsMeta[attr];
2333
+ const rel = getEffectiveRelMeta(attr);
2191
2334
  const depth = getAttrDepth(attr);
2335
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
2192
2336
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
2193
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
2337
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
2194
2338
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
2195
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
2339
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
2340
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
2341
+ friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
2342
+ ] }),
2196
2343
  rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
2197
2344
  "relation ➔ ",
2198
2345
  rel.targetDisplayName
@@ -2228,11 +2375,11 @@ function CsvManagerTab() {
2228
2375
  ] }),
2229
2376
  (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: [
2230
2377
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: searchAttribute ? `Value for "${searchAttribute}"` : "Value to match" }),
2231
- searchAttribute && relationsMeta[searchAttribute] ? /* @__PURE__ */ jsxRuntime.jsx(
2378
+ searchAttribute && getEffectiveRelMeta(searchAttribute) ? /* @__PURE__ */ jsxRuntime.jsx(
2232
2379
  designSystem.Combobox,
2233
2380
  {
2234
2381
  autocomplete: { type: "list", filter: "contains" },
2235
- placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[searchAttribute].targetDisplayName} or type text...`,
2382
+ placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(searchAttribute).targetDisplayName} or type text...`,
2236
2383
  value: filterQuery,
2237
2384
  onClear: () => setFilterQuery(""),
2238
2385
  onChange: (val) => {
@@ -4013,6 +4160,7 @@ const BulkUpdatePreviewModal = ({
4013
4160
  isOpen,
4014
4161
  onClose,
4015
4162
  onProceed,
4163
+ canProceed,
4016
4164
  loading,
4017
4165
  previewData,
4018
4166
  attribute,
@@ -4023,6 +4171,8 @@ const BulkUpdatePreviewModal = ({
4023
4171
  }) => {
4024
4172
  const [filterTab, setFilterTab] = React.useState("all");
4025
4173
  const [searchQuery, setSearchQuery] = React.useState("");
4174
+ const { canWorkspaceProceedToExecute } = ValidationRulesTab.useBulkUpdaterRBAC();
4175
+ const allowProceed = canProceed !== void 0 ? canProceed : canWorkspaceProceedToExecute;
4026
4176
  const filteredDiffs = React.useMemo(() => {
4027
4177
  if (!previewData || !previewData.diffs) return [];
4028
4178
  let items = previewData.diffs;
@@ -4369,7 +4519,7 @@ const BulkUpdatePreviewModal = ({
4369
4519
  },
4370
4520
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
4371
4521
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "M", onClick: onClose, children: "Close Preview" }),
4372
- /* @__PURE__ */ jsxRuntime.jsxs(
4522
+ allowProceed && /* @__PURE__ */ jsxRuntime.jsxs(
4373
4523
  designSystem.Button,
4374
4524
  {
4375
4525
  variant: "default",
@@ -5935,7 +6085,7 @@ function renderHeaderCell(colDef, col, currentSort, selectedAttribute, searchAtt
5935
6085
  colDef.key
5936
6086
  );
5937
6087
  }
5938
- function formatDisplayValue(val) {
6088
+ function formatDisplayValue(val, options) {
5939
6089
  if (val === void 0 || val === null || val === "") {
5940
6090
  return "(empty / not set)";
5941
6091
  }
@@ -5951,16 +6101,16 @@ function formatDisplayValue(val) {
5951
6101
  if (Array.isArray(val)) {
5952
6102
  if (val.length === 0) return "(empty / unlinked)";
5953
6103
  return val.map(
5954
- (item) => typeof item === "object" && item !== null ? item.name || item.title || item.email || item.username || item.documentId || item.id : String(item)
6104
+ (item) => typeof item === "object" && item !== null ? resolveEntityLabel(item, options) : resolveEntityLabel(item, options)
5955
6105
  ).join(", ");
5956
6106
  }
5957
6107
  if (typeof val === "object" && val !== null) {
5958
6108
  if (val.isRelation && val.display) return val.display;
5959
- return val.name || val.title || val.email || val.username || val.documentId || val.id || JSON.stringify(val);
6109
+ return resolveEntityLabel(val, options);
5960
6110
  }
5961
- return String(val);
6111
+ return resolveEntityLabel(val, options);
5962
6112
  }
5963
- function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip) {
6113
+ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribute, isMatch, hasAttr, isSelected, onToggleSelect, pendingBatches = [], isDzExpanded = false, onToggleExpandDz, filterQuery = "", gridCtx, cellTooltip, searchRelOptions, relationOptions) {
5964
6114
  switch (colDef.key) {
5965
6115
  case "select":
5966
6116
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5971,7 +6121,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
5971
6121
  }
5972
6122
  );
5973
6123
  case "identifier": {
5974
- const mainText = entry.name || entry.title || `Entry #${entry.id || entry.documentId}`;
6124
+ const mainText = entry.name || entry.title || entry.authorName || resolveEntityLabel(entry, searchRelOptions) || `Entry #${entry.id || entry.documentId}`;
5975
6125
  const dzField = Object.keys(entry).find(
5976
6126
  (k) => Array.isArray(entry[k]) && entry[k].length > 0 && entry[k].some((item) => item && item.__component)
5977
6127
  );
@@ -6007,7 +6157,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6007
6157
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6008
6158
  }
6009
6159
  if (matches.length === 1 && !matches[0].componentUid) {
6010
- const displayStr = formatDisplayValue(matches[0].value);
6160
+ const displayStr = formatDisplayValue(matches[0].value, searchRelOptions);
6011
6161
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6012
6162
  return /* @__PURE__ */ jsxRuntime.jsx(
6013
6163
  designSystem.Typography,
@@ -6029,7 +6179,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6029
6179
  }
6030
6180
  const qLower = (filterQuery || "").trim().toLowerCase();
6031
6181
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6032
- const displayStr = formatDisplayValue(m.value);
6182
+ const displayStr = formatDisplayValue(m.value, searchRelOptions);
6033
6183
  const isMatchItem = qLower && displayStr.toLowerCase().includes(qLower);
6034
6184
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6035
6185
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6081,8 +6231,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6081
6231
  if (matches.length === 0) {
6082
6232
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6083
6233
  }
6234
+ const activeRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
6084
6235
  if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
6085
- const displayStr = formatDisplayValue(matches[0].value);
6236
+ const displayStr = formatDisplayValue(matches[0].value, activeRelOpts);
6086
6237
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6087
6238
  return /* @__PURE__ */ jsxRuntime.jsx(
6088
6239
  designSystem.Typography,
@@ -6102,7 +6253,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6102
6253
  );
6103
6254
  }
6104
6255
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6105
- const displayStr = formatDisplayValue(m.value);
6256
+ const displayStr = formatDisplayValue(m.value, activeRelOpts);
6106
6257
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6107
6258
  return /* @__PURE__ */ jsxRuntime.jsxs(
6108
6259
  designSystem.Flex,
@@ -6234,8 +6385,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6234
6385
  if (matches.length === 0) {
6235
6386
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "(empty / not set)" });
6236
6387
  }
6388
+ const targetRelOpts = gridCtx?.relationOptions || relationOptions || searchRelOptions;
6237
6389
  if (matches.length === 1 && !matches[0].componentUid) {
6238
- const displayStr = formatDisplayValue(matches[0].value);
6390
+ const displayStr = formatDisplayValue(matches[0].value, targetRelOpts);
6239
6391
  const isUnset = displayStr === "(empty / not set)" || displayStr === "(empty / unlinked)";
6240
6392
  return /* @__PURE__ */ jsxRuntime.jsx(
6241
6393
  designSystem.Typography,
@@ -6255,7 +6407,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6255
6407
  );
6256
6408
  }
6257
6409
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m) => {
6258
- const displayStr = formatDisplayValue(m.value);
6410
+ const displayStr = formatDisplayValue(m.value, targetRelOpts);
6259
6411
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6260
6412
  return /* @__PURE__ */ jsxRuntime.jsxs(
6261
6413
  designSystem.Flex,
@@ -6316,8 +6468,9 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6316
6468
  if (matches.length === 0) {
6317
6469
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral500", style: { fontStyle: "italic" }, children: "-" });
6318
6470
  }
6471
+ const attrRelOpts = attrName === searchAttribute ? searchRelOptions : attrName === selectedAttribute ? gridCtx?.relationOptions || relationOptions : searchRelOptions || relationOptions;
6319
6472
  if (matches.length === 1 && !matches[0].componentUid && !matches[0].path.includes("[#")) {
6320
- const displayStr = formatDisplayValue(matches[0].value);
6473
+ const displayStr = formatDisplayValue(matches[0].value, attrRelOpts);
6321
6474
  return /* @__PURE__ */ jsxRuntime.jsx(
6322
6475
  designSystem.Typography,
6323
6476
  {
@@ -6329,7 +6482,7 @@ function renderCellContent(colDef, entry, col, selectedAttribute, searchAttribut
6329
6482
  );
6330
6483
  }
6331
6484
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", style: { maxWidth: 320 }, children: matches.map((m, mIdx) => {
6332
- const displayStr = formatDisplayValue(m.value);
6485
+ const displayStr = formatDisplayValue(m.value, attrRelOpts);
6333
6486
  const occTooltip = `#${m.index} ${m.componentName || "Item"}${m.componentId !== void 0 ? ` (id: ${m.componentId})` : ""}: ${formatFullTooltipValue(m.value)}`;
6334
6487
  return /* @__PURE__ */ jsxRuntime.jsxs(
6335
6488
  designSystem.Flex,
@@ -6380,6 +6533,7 @@ const BulkUpdater = () => {
6380
6533
  const { get, post } = admin.useFetchClient();
6381
6534
  const { toggleNotification } = admin.useNotification();
6382
6535
  const permissions = ValidationRulesTab.useBulkUpdaterRBAC();
6536
+ const canAnyUpdateExecution = permissions.canWorkspaceSubmitForChecker || permissions.canWorkspaceForceRunNow || permissions.canWorkspaceQueueForOffPeak;
6383
6537
  const getInitialTab = () => {
6384
6538
  try {
6385
6539
  const params = new URLSearchParams(window.location.search);
@@ -6428,6 +6582,7 @@ const BulkUpdater = () => {
6428
6582
  const [auditEnabled, setAuditEnabled] = React.useState(false);
6429
6583
  const [executionWindow, setExecutionWindow] = React.useState(null);
6430
6584
  const [showConfirmModal, setShowConfirmModal] = React.useState(false);
6585
+ const [confirmModalSource, setConfirmModalSource] = React.useState("direct");
6431
6586
  const [pendingBatches, setPendingBatches] = React.useState([]);
6432
6587
  const [pendingBatchesLoading, setPendingBatchesLoading] = React.useState(false);
6433
6588
  const [approvingBatchId, setApprovingBatchId] = React.useState(null);
@@ -6470,7 +6625,9 @@ const BulkUpdater = () => {
6470
6625
  setRelationOptionsLoading(true);
6471
6626
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
6472
6627
  if (res.data && res.data.success) {
6473
- setRelationOptions(res.data.options || []);
6628
+ const opts = res.data.options || [];
6629
+ setRelationOptions(opts);
6630
+ registerRelationOptions(opts);
6474
6631
  }
6475
6632
  } catch {
6476
6633
  setRelationOptions([]);
@@ -6507,7 +6664,9 @@ const BulkUpdater = () => {
6507
6664
  setSearchRelationOptionsLoading(true);
6508
6665
  const res = await get(`/bulk-updater/relation-options?targetUid=${encodeURIComponent(targetUid)}`);
6509
6666
  if (res.data && res.data.success) {
6510
- setSearchRelationOptions(res.data.options || []);
6667
+ const opts = res.data.options || [];
6668
+ setSearchRelationOptions(opts);
6669
+ registerRelationOptions(opts);
6511
6670
  }
6512
6671
  } catch {
6513
6672
  setSearchRelationOptions([]);
@@ -6523,13 +6682,6 @@ const BulkUpdater = () => {
6523
6682
  const [gridFilterModifiedOnly, setGridFilterModifiedOnly] = React.useState(false);
6524
6683
  const [validationRules, setValidationRules] = React.useState([]);
6525
6684
  const effectiveSearchAttribute = searchAttribute || selectedAttribute;
6526
- React.useEffect(() => {
6527
- if (effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute]) {
6528
- fetchSearchRelationOptions(relationsMeta[effectiveSearchAttribute].targetUid);
6529
- } else {
6530
- setSearchRelationOptions([]);
6531
- }
6532
- }, [effectiveSearchAttribute, relationsMeta]);
6533
6685
  const [filterOperator, setFilterOperator] = React.useState("none");
6534
6686
  const [filterQuery, setFilterQuery] = React.useState("");
6535
6687
  const [entrySearch, setEntrySearch] = React.useState("");
@@ -6940,10 +7092,24 @@ const BulkUpdater = () => {
6940
7092
  if (!collections.length || !selectedCollectionUid) return null;
6941
7093
  return collections.find((c) => c.uid === selectedCollectionUid) || null;
6942
7094
  }, [collections, selectedCollectionUid]);
7095
+ const getEffectiveRelMeta = React.useCallback(
7096
+ (attr) => {
7097
+ return resolveEffectiveRelationMeta(attr, selectedCol?.relations, relationsMeta);
7098
+ },
7099
+ [selectedCol, relationsMeta]
7100
+ );
7101
+ React.useEffect(() => {
7102
+ const activeRel = getEffectiveRelMeta(effectiveSearchAttribute);
7103
+ if (effectiveSearchAttribute && activeRel) {
7104
+ fetchSearchRelationOptions(activeRel.targetUid);
7105
+ } else {
7106
+ setSearchRelationOptions([]);
7107
+ }
7108
+ }, [effectiveSearchAttribute, getEffectiveRelMeta]);
6943
7109
  const activeAttrMeta = React.useMemo(() => {
6944
7110
  if (!selectedAttribute) return void 0;
6945
7111
  const base = selectedCol?.attributesMeta?.[selectedAttribute] || attributesMeta[selectedAttribute];
6946
- const relMeta = selectedCol?.relations?.[selectedAttribute] || relationsMeta[selectedAttribute];
7112
+ const relMeta = getEffectiveRelMeta(selectedAttribute);
6947
7113
  if (!base && !relMeta) return void 0;
6948
7114
  if (relMeta && (!base || !base.isRelation)) {
6949
7115
  return {
@@ -6954,7 +7120,7 @@ const BulkUpdater = () => {
6954
7120
  };
6955
7121
  }
6956
7122
  return base;
6957
- }, [selectedAttribute, selectedCol, attributesMeta, relationsMeta]);
7123
+ }, [selectedAttribute, selectedCol, attributesMeta, getEffectiveRelMeta]);
6958
7124
  const totalDirtyRecordsCount = React.useMemo(() => Object.keys(gridEdits).length, [gridEdits]);
6959
7125
  const totalDirtyCellsCount = React.useMemo(
6960
7126
  () => Object.values(gridEdits).reduce(
@@ -6970,7 +7136,7 @@ const BulkUpdater = () => {
6970
7136
  const handleGridCellCommit = React__default.default.useCallback(
6971
7137
  (entry, colUid, occ, newValue, validationError) => {
6972
7138
  const key = `${colUid}${KEY_SEP}${entry.documentId}`;
6973
- const recordLabel = entry.name || entry.title || entry.email || `Entry #${entry.id || entry.documentId}`;
7139
+ const recordLabel = entry.name || entry.title || entry.authorName || entry.email || `Entry #${entry.id || entry.documentId}`;
6974
7140
  setGridEdits((prev) => {
6975
7141
  const existingRec = prev[key] || {
6976
7142
  uid: colUid,
@@ -7149,8 +7315,9 @@ const BulkUpdater = () => {
7149
7315
  }
7150
7316
  setSelectedRelationDocId("");
7151
7317
  setAttributeValue("");
7152
- if (newAttr && relationsMeta[newAttr]) {
7153
- fetchRelationOptions(relationsMeta[newAttr].targetUid);
7318
+ const relForNewAttr = getEffectiveRelMeta(newAttr);
7319
+ if (newAttr && relForNewAttr) {
7320
+ fetchRelationOptions(relForNewAttr.targetUid);
7154
7321
  } else {
7155
7322
  setRelationOptions([]);
7156
7323
  }
@@ -7168,19 +7335,23 @@ const BulkUpdater = () => {
7168
7335
  }, [availableColAttributes, componentDepth, attributesMeta, selectedCol]);
7169
7336
  const memoizedComboboxOptions = React.useMemo(() => {
7170
7337
  if (depthFilteredAttributes.length === 0) {
7171
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
7338
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: "__none__", disabled: true, textValue: "No attributes available", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
7172
7339
  "No attributes available for this collection type (Depth L",
7173
7340
  componentDepth,
7174
7341
  ")"
7175
- ] }) });
7342
+ ] }) }) });
7176
7343
  }
7177
- return depthFilteredAttributes.map((attr) => {
7178
- const rel = relationsMeta[attr];
7344
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: depthFilteredAttributes.map((attr) => {
7345
+ const rel = getEffectiveRelMeta(attr);
7179
7346
  const depth = getAttrDepth(attr);
7347
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
7180
7348
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
7181
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
7349
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
7182
7350
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
7183
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: attr }),
7351
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
7352
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === selectedAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
7353
+ friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
7354
+ ] }),
7184
7355
  rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
7185
7356
  "relation ➔ ",
7186
7357
  rel.targetDisplayName
@@ -7190,16 +7361,20 @@ const BulkUpdater = () => {
7190
7361
  " component"
7191
7362
  ] }) : null
7192
7363
  ] }) }, attr);
7193
- });
7194
- }, [depthFilteredAttributes, relationsMeta, selectedAttribute, componentDepth, attributesMeta]);
7364
+ }) });
7365
+ }, [depthFilteredAttributes, getEffectiveRelMeta, selectedAttribute, componentDepth, attributesMeta]);
7195
7366
  const memoizedSearchComboboxOptions = React.useMemo(() => {
7196
7367
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: depthFilteredAttributes.map((attr) => {
7197
- const rel = relationsMeta[attr];
7368
+ const rel = getEffectiveRelMeta(attr);
7198
7369
  const depth = getAttrDepth(attr);
7370
+ const friendlyLabel = formatAttributeHeaderLabel(attr);
7199
7371
  const badgeText = rel ? `relation ${rel.targetDisplayName}` : depth > 0 ? `L${depth} component` : "";
7200
- const textValue = badgeText ? `${attr} ${badgeText}` : attr;
7372
+ const textValue = `${attr} ${friendlyLabel} ${badgeText}`.trim();
7201
7373
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: attr, textValue, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", width: "100%", gap: 2, children: [
7202
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: attr }),
7374
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
7375
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: attr === searchAttribute ? "bold" : "regular", children: friendlyLabel !== attr ? friendlyLabel : attr }),
7376
+ friendlyLabel !== attr && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", display: "block", children: attr })
7377
+ ] }),
7203
7378
  rel ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", size: "S", children: [
7204
7379
  "relation ➔ ",
7205
7380
  rel.targetDisplayName
@@ -7210,7 +7385,7 @@ const BulkUpdater = () => {
7210
7385
  ] }) : null
7211
7386
  ] }) }, `search_${attr}`);
7212
7387
  }) });
7213
- }, [depthFilteredAttributes, relationsMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
7388
+ }, [depthFilteredAttributes, getEffectiveRelMeta, searchAttribute, selectedAttribute, componentDepth, attributesMeta]);
7214
7389
  const handleSearchAttributeChange = (newAttr) => {
7215
7390
  const finalAttr = newAttr === "__default__" ? "" : newAttr;
7216
7391
  setSearchAttribute(finalAttr);
@@ -7313,6 +7488,7 @@ const BulkUpdater = () => {
7313
7488
  if (!obj || typeof obj !== "object") return false;
7314
7489
  if (testString(obj.name)) return true;
7315
7490
  if (testString(obj.title)) return true;
7491
+ if (testString(obj.authorName)) return true;
7316
7492
  if (testString(obj.email)) return true;
7317
7493
  if (testString(obj.username)) return true;
7318
7494
  if (testString(obj.documentId)) return true;
@@ -7504,7 +7680,7 @@ const BulkUpdater = () => {
7504
7680
  () => gridEditMode ? computeLifecycleStatsForKeys(gridTargetKeys) : selectedLifecycleStats,
7505
7681
  [gridEditMode, gridTargetKeys, computeLifecycleStatsForKeys, selectedLifecycleStats]
7506
7682
  );
7507
- const handleOpenConfirmModal = () => {
7683
+ const handleOpenConfirmModal = (source = "direct") => {
7508
7684
  if (!selectedAttribute) {
7509
7685
  toggleNotification({
7510
7686
  type: "warning",
@@ -7539,6 +7715,7 @@ const BulkUpdater = () => {
7539
7715
  }
7540
7716
  setPublishStrategy("safe");
7541
7717
  setUnreviewedConsent(false);
7718
+ setConfirmModalSource(source === "preview" ? "preview" : "direct");
7542
7719
  setShowConfirmModal(true);
7543
7720
  };
7544
7721
  const handleOpenPreviewModal = async () => {
@@ -7654,8 +7831,10 @@ const BulkUpdater = () => {
7654
7831
  }
7655
7832
  const displaySummaryVal = gridEditMode ? `Grid Editing (${gridSerialized.totalEditCount} edits across ${targets.length} records)` : attributeValue;
7656
7833
  try {
7834
+ const isFromPreview = confirmModalSource === "preview";
7657
7835
  setUpdating(true);
7658
7836
  setShowConfirmModal(false);
7837
+ setConfirmModalSource("direct");
7659
7838
  setShowProcessingDashboard(true);
7660
7839
  setIsSubmittingBatch(true);
7661
7840
  setLastResults(null);
@@ -7693,7 +7872,8 @@ const BulkUpdater = () => {
7693
7872
  publishOnApproval,
7694
7873
  publishStrategy,
7695
7874
  unreviewedConsent,
7696
- unreviewedCount: selectedLifecycleStats.unreviewedCount
7875
+ unreviewedCount: selectedLifecycleStats.unreviewedCount,
7876
+ ...isFromPreview ? { initiatedFromPreview: true } : {}
7697
7877
  };
7698
7878
  const res = await post("/bulk-updater/batch-update", payload);
7699
7879
  setIsSubmittingBatch(false);
@@ -8570,13 +8750,13 @@ const BulkUpdater = () => {
8570
8750
  ]
8571
8751
  }
8572
8752
  ) }),
8573
- (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && relationsMeta[effectiveSearchAttribute] ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
8574
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Target ${relationsMeta[effectiveSearchAttribute].targetDisplayName} Relation` }),
8753
+ (filterOperator === "equals" || filterOperator === "contains" || filterOperator === "starts_with") && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: effectiveSearchAttribute && getEffectiveRelMeta(effectiveSearchAttribute) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
8754
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Target ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} Relation` }),
8575
8755
  /* @__PURE__ */ jsxRuntime.jsx(
8576
8756
  designSystem.Combobox,
8577
8757
  {
8578
8758
  autocomplete: { type: "list", filter: "contains" },
8579
- placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[effectiveSearchAttribute].targetDisplayName} or type text...`,
8759
+ placeholder: searchRelationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(effectiveSearchAttribute).targetDisplayName} or type text...`,
8580
8760
  value: filterQuery,
8581
8761
  onClear: () => setFilterQuery(""),
8582
8762
  onChange: (val) => {
@@ -9219,7 +9399,7 @@ const BulkUpdater = () => {
9219
9399
  recordEdits,
9220
9400
  relationOptions,
9221
9401
  relationOptionsLoading,
9222
- relationIsMulti: Boolean(relationsMeta[selectedAttribute]?.isMulti),
9402
+ relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
9223
9403
  validationRules,
9224
9404
  onCommitEdit: handleGridCellCommit,
9225
9405
  onResetEdit: handleGridCellReset
@@ -9257,7 +9437,9 @@ const BulkUpdater = () => {
9257
9437
  onToggleExpandDz,
9258
9438
  filterQuery,
9259
9439
  gridCtx,
9260
- cellTooltip
9440
+ cellTooltip,
9441
+ searchRelationOptions,
9442
+ relationOptions
9261
9443
  ) }, colDef.key);
9262
9444
  })
9263
9445
  }
@@ -9289,7 +9471,7 @@ const BulkUpdater = () => {
9289
9471
  recordEdits,
9290
9472
  relationOptions,
9291
9473
  relationOptionsLoading,
9292
- relationIsMulti: Boolean(relationsMeta[selectedAttribute]?.isMulti),
9474
+ relationIsMulti: Boolean(getEffectiveRelMeta(selectedAttribute)?.isMulti),
9293
9475
  validationRules,
9294
9476
  onToggleDzBlock: toggleDzBlock,
9295
9477
  onCommitEdit: handleGridCellCommit,
@@ -9482,28 +9664,28 @@ const BulkUpdater = () => {
9482
9664
  )
9483
9665
  ] })
9484
9666
  }
9485
- ) : relationsMeta[selectedAttribute] ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
9667
+ ) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, style: { width: "100%" }, children: [
9486
9668
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", wrap: "wrap", children: [
9487
9669
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral700", children: [
9488
9670
  "Target ",
9489
- relationsMeta[selectedAttribute].targetDisplayName,
9671
+ getEffectiveRelMeta(selectedAttribute).targetDisplayName,
9490
9672
  " Relation:"
9491
9673
  ] }),
9492
9674
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
9493
- relationsMeta[selectedAttribute].relationType,
9675
+ getEffectiveRelMeta(selectedAttribute).relationType,
9494
9676
  " → ",
9495
- relationsMeta[selectedAttribute].targetDisplayName
9677
+ getEffectiveRelMeta(selectedAttribute).targetDisplayName
9496
9678
  ] }),
9497
- relationsMeta[selectedAttribute].isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
9679
+ getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: "Multi-Relation" })
9498
9680
  ] }),
9499
9681
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", style: { width: "100%" }, children: [
9500
9682
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1, minWidth: 200 }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
9501
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Choose ${relationsMeta[selectedAttribute].targetDisplayName}` }),
9683
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: `Choose ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}` }),
9502
9684
  /* @__PURE__ */ jsxRuntime.jsxs(
9503
9685
  designSystem.Combobox,
9504
9686
  {
9505
9687
  autocomplete: { type: "list", filter: "contains" },
9506
- placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${relationsMeta[selectedAttribute].targetDisplayName}...`,
9688
+ placeholder: relationOptionsLoading ? "Loading entities..." : `Search & pick ${getEffectiveRelMeta(selectedAttribute).targetDisplayName}...`,
9507
9689
  value: selectedRelationDocId,
9508
9690
  onChange: (val) => {
9509
9691
  const docId = val ? String(val) : "";
@@ -9522,7 +9704,7 @@ const BulkUpdater = () => {
9522
9704
  }
9523
9705
  )
9524
9706
  ] }) }),
9525
- relationsMeta[selectedAttribute].isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
9707
+ getEffectiveRelMeta(selectedAttribute).isMulti && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { width: 170 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
9526
9708
  designSystem.SingleSelect,
9527
9709
  {
9528
9710
  label: "Action Mode",
@@ -9582,10 +9764,10 @@ const BulkUpdater = () => {
9582
9764
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Play, {}),
9583
9765
  variant: "default",
9584
9766
  size: "L",
9585
- onClick: handleOpenConfirmModal,
9767
+ onClick: () => handleOpenConfirmModal("direct"),
9586
9768
  loading: updating,
9587
- disabled: !permissions.canWorkspaceExecute || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9588
- title: !permissions.canWorkspaceExecute ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9769
+ disabled: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) || (loading || !selectedAttribute || !selectedAttribute.trim() || (gridEditMode ? gridSerialized.targets.length === 0 || gridSerialized.hasValidationErrors : totalSelectedCount === 0)),
9770
+ title: !(permissions.canWorkspaceExecute || canAnyUpdateExecution) ? "You do not have permission to execute bulk updates (action: plugin::bulk-updater.workspace.execute)." : void 0,
9589
9771
  children: [
9590
9772
  "Update Selected (",
9591
9773
  gridEditMode ? gridSerialized.targets.length : totalSelectedCount,
@@ -10161,7 +10343,10 @@ const BulkUpdater = () => {
10161
10343
  boxSizing: "border-box",
10162
10344
  overflowY: "auto"
10163
10345
  },
10164
- onClick: () => setShowConfirmModal(false),
10346
+ onClick: () => {
10347
+ setShowConfirmModal(false);
10348
+ setConfirmModalSource("direct");
10349
+ },
10165
10350
  children: /* @__PURE__ */ jsxRuntime.jsxs(
10166
10351
  designSystem.Box,
10167
10352
  {
@@ -10221,8 +10406,8 @@ const BulkUpdater = () => {
10221
10406
  " heterogeneous edits across ",
10222
10407
  gridSerialized.targets.length,
10223
10408
  " records)"
10224
- ] }) : relationsMeta[selectedAttribute] ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
10225
- relationsMeta[selectedAttribute].isMulti ? `[${relationMode.toUpperCase()}] ` : "",
10409
+ ] }) : getEffectiveRelMeta(selectedAttribute) ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedRelationDocId === "__clear__" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "danger100", textColor: "danger700", children: "Clear / Unlink Relation" }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "secondary100", textColor: "secondary700", children: [
10410
+ getEffectiveRelMeta(selectedAttribute).isMulti ? `[${relationMode.toUpperCase()}] ` : "",
10226
10411
  relationOptions.find((o) => o.documentId === selectedRelationDocId)?.label || selectedRelationDocId || "(none selected)"
10227
10412
  ] }) }) : useRegex ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
10228
10413
  "Replace ",
@@ -10505,9 +10690,20 @@ const BulkUpdater = () => {
10505
10690
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, style: { width: "100%" }, children: [
10506
10691
  publishOnApproval && updateModalLifecycleStats.unreviewedCount > 0 && publishStrategy === "all" && !unreviewedConsent && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger700", fontWeight: "bold", children: "⚠️ Explicit consent is required before publishing records with unreviewed draft revisions." }),
10507
10692
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 3, style: { width: "100%" }, children: [
10508
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "M", onClick: () => setShowConfirmModal(false), children: "Cancel" }),
10509
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: [
10510
- /* @__PURE__ */ jsxRuntime.jsx(
10693
+ /* @__PURE__ */ jsxRuntime.jsx(
10694
+ designSystem.Button,
10695
+ {
10696
+ variant: "tertiary",
10697
+ size: "M",
10698
+ onClick: () => {
10699
+ setShowConfirmModal(false);
10700
+ setConfirmModalSource("direct");
10701
+ },
10702
+ children: "Cancel"
10703
+ }
10704
+ ),
10705
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", justifyContent: "flex-end", alignItems: "center", children: !canAnyUpdateExecution ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.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__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10706
+ permissions.canWorkspaceSubmitForChecker && /* @__PURE__ */ jsxRuntime.jsx(
10511
10707
  designSystem.Button,
10512
10708
  {
10513
10709
  variant: executionWindow?.isBusinessHours ? "default" : "secondary",
@@ -10519,7 +10715,7 @@ const BulkUpdater = () => {
10519
10715
  }
10520
10716
  ),
10521
10717
  executionWindow?.isBusinessHours ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10522
- /* @__PURE__ */ jsxRuntime.jsxs(
10718
+ permissions.canWorkspaceQueueForOffPeak && /* @__PURE__ */ jsxRuntime.jsxs(
10523
10719
  designSystem.Button,
10524
10720
  {
10525
10721
  variant: "secondary",
@@ -10534,7 +10730,7 @@ const BulkUpdater = () => {
10534
10730
  ]
10535
10731
  }
10536
10732
  ),
10537
- /* @__PURE__ */ jsxRuntime.jsx(
10733
+ permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsxRuntime.jsx(
10538
10734
  designSystem.Button,
10539
10735
  {
10540
10736
  variant: "danger-light",
@@ -10545,7 +10741,7 @@ const BulkUpdater = () => {
10545
10741
  children: "Force Run Now"
10546
10742
  }
10547
10743
  )
10548
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
10744
+ ] }) : permissions.canWorkspaceForceRunNow && /* @__PURE__ */ jsxRuntime.jsx(
10549
10745
  designSystem.Button,
10550
10746
  {
10551
10747
  variant: "default",
@@ -10556,7 +10752,7 @@ const BulkUpdater = () => {
10556
10752
  children: "Confirm & Execute Now"
10557
10753
  }
10558
10754
  )
10559
- ] })
10755
+ ] }) })
10560
10756
  ] })
10561
10757
  ] })
10562
10758
  }
@@ -10834,9 +11030,11 @@ const BulkUpdater = () => {
10834
11030
  {
10835
11031
  isOpen: showPreviewModal,
10836
11032
  onClose: () => setShowPreviewModal(false),
11033
+ canProceed: permissions.canWorkspaceProceedToExecute,
10837
11034
  onProceed: () => {
11035
+ if (!permissions.canWorkspaceProceedToExecute) return;
10838
11036
  setShowPreviewModal(false);
10839
- handleOpenConfirmModal();
11037
+ handleOpenConfirmModal("preview");
10840
11038
  },
10841
11039
  loading: previewLoading,
10842
11040
  previewData,
@@ -10844,7 +11042,7 @@ const BulkUpdater = () => {
10844
11042
  editMode: gridEditMode ? "grid" : "common",
10845
11043
  publishOnApproval,
10846
11044
  lifecycleStats: selectedLifecycleStats,
10847
- 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
11045
+ 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
10848
11046
  }
10849
11047
  ),
10850
11048
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10874,6 +11072,7 @@ const BulkUpdater = () => {
10874
11072
  );
10875
11073
  };
10876
11074
  exports.default = BulkUpdater;
11075
+ exports.formatAttributeHeaderLabel = formatAttributeHeaderLabel;
10877
11076
  exports.formatComponentName = formatComponentName;
10878
11077
  exports.formatDisplayValue = formatDisplayValue;
10879
11078
  exports.formatFullTooltipValue = formatFullTooltipValue;
@@ -10886,4 +11085,7 @@ exports.getNestedValue = getNestedValue;
10886
11085
  exports.getPropertyValue = getPropertyValue;
10887
11086
  exports.getSortOptionsForCollection = getSortOptionsForCollection;
10888
11087
  exports.parseDynamicZonePath = parseDynamicZonePath;
10889
- //# sourceMappingURL=BulkUpdater-BY8IXT4R.js.map
11088
+ exports.registerRelationOptions = registerRelationOptions;
11089
+ exports.resolveEffectiveRelationMeta = resolveEffectiveRelationMeta;
11090
+ exports.resolveEntityLabel = resolveEntityLabel;
11091
+ //# sourceMappingURL=BulkUpdater-Cnzgw4UH.js.map