strapi-plugin-bulk-updater 1.6.1 → 1.6.2

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.
@@ -415,11 +415,14 @@ function buildEntriesQueryParams(options) {
415
415
  return params;
416
416
  }
417
417
  function buildCsvExportQueryParams(options) {
418
- const { limit, filter } = options;
418
+ const { limit, filter, exportMode } = options;
419
419
  const queryParams = new URLSearchParams();
420
420
  if (limit && limit > 0) {
421
421
  queryParams.set("limit", String(limit));
422
422
  }
423
+ if (exportMode) {
424
+ queryParams.set("exportMode", exportMode);
425
+ }
423
426
  if (filter.searchAttribute) {
424
427
  queryParams.set("searchAttribute", filter.searchAttribute);
425
428
  }
@@ -463,6 +466,7 @@ function CsvManagerTab() {
463
466
  const hasPendingFilterChanges = !areSearchFiltersEqual(draftFilter, appliedFilter);
464
467
  const [searchRelationOptions, setSearchRelationOptions] = React.useState([]);
465
468
  const [searchRelationOptionsLoading, setSearchRelationOptionsLoading] = React.useState(false);
469
+ const [exportMode, setExportMode] = React.useState("all");
466
470
  const [exportLimit, setExportLimit] = React.useState(0);
467
471
  const [exportLimitInput, setExportLimitInput] = React.useState("");
468
472
  const [exportingCollection, setExportingCollection] = React.useState(false);
@@ -736,7 +740,8 @@ function CsvManagerTab() {
736
740
  setExportingCollection(true);
737
741
  const queryParams = buildCsvExportQueryParams({
738
742
  limit: exportLimit,
739
- filter: appliedFilterRef.current
743
+ filter: appliedFilterRef.current,
744
+ exportMode
740
745
  });
741
746
  const res = await get(`/bulk-updater/csv/export/${selectedUid}?${queryParams.toString()}`);
742
747
  const csvStr = res.data?.csvContent || (typeof res.data === "string" ? res.data : "");
@@ -1380,6 +1385,22 @@ function CsvManagerTab() {
1380
1385
  );
1381
1386
  }) })
1382
1387
  ] }),
1388
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: 220 }, children: [
1389
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", marginBottom: 1, display: "block", children: "Object Export Mode" }),
1390
+ /* @__PURE__ */ jsxRuntime.jsxs(
1391
+ designSystem.SingleSelect,
1392
+ {
1393
+ value: exportMode,
1394
+ onChange: (val) => setExportMode(val === "metafields" || val === "topbarconfig" ? val : "all"),
1395
+ disabled: exportingCollection,
1396
+ children: [
1397
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: "All" }),
1398
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "metafields", children: "Metafields" }),
1399
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "topbarconfig", children: "Topbarconfig" })
1400
+ ]
1401
+ }
1402
+ )
1403
+ ] }),
1383
1404
  /* @__PURE__ */ jsxRuntime.jsx(
1384
1405
  designSystem.Button,
1385
1406
  {
@@ -1416,7 +1437,8 @@ function CsvManagerTab() {
1416
1437
  }
1417
1438
  )
1418
1439
  ] })
1419
- ] })
1440
+ ] }),
1441
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: exportMode === "all" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { closeLabel: "Close", variant: "warning", title: "Data Migration Export Mode", children: "All exports the complete collection data and is intended for data migration. Do not use this mode for routine updates. For targeted updates, select Metafields or Topbarconfig." }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, background: "primary100", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "primary700", children: exportMode === "metafields" ? "Exports metafields as individual first-level columns for targeted updates. Other fields retain their existing structure." : "Exports topbarconfig as individual first-level columns for targeted updates. Other fields retain their existing structure." }) }) })
1420
1442
  ] }),
1421
1443
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 5, background: "neutral100", hasRadius: true, children: [
1422
1444
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h3", fontWeight: "bold", marginBottom: 2, children: "2. Import & Batch Override CSV" }),
@@ -1486,7 +1508,21 @@ function CsvManagerTab() {
1486
1508
  const totalRows = allParsedRecords.length;
1487
1509
  const missingDocIdCount = allParsedRecords.filter((row) => !extractDocId(row)).length;
1488
1510
  const updateCount = totalRows - missingDocIdCount;
1489
- const headers = Object.keys(allParsedRecords[0]);
1511
+ const headers = Object.keys(allParsedRecords[0]).filter(
1512
+ (h) => h !== "__bulk_updater_metadata" && h !== "_bulk_updater_metadata"
1513
+ );
1514
+ let detectedPreviewMode = "legacy";
1515
+ try {
1516
+ const rawMetaCell = allParsedRecords[0]["__bulk_updater_metadata"] || allParsedRecords[0]["_bulk_updater_metadata"];
1517
+ if (rawMetaCell) {
1518
+ const parsedMeta = typeof rawMetaCell === "string" ? JSON.parse(rawMetaCell) : rawMetaCell;
1519
+ if (parsedMeta?.exportMode) {
1520
+ detectedPreviewMode = String(parsedMeta.exportMode);
1521
+ }
1522
+ }
1523
+ } catch {
1524
+ }
1525
+ const modeDisplayLabel = detectedPreviewMode === "metafields" ? "Metafields (1-Level Targeted)" : detectedPreviewMode === "topbarconfig" ? "Topbarconfig (1-Level Targeted)" : detectedPreviewMode === "all" ? "All (Full Migration Export)" : "Legacy";
1490
1526
  const totalPages = Math.ceil(totalRows / previewPageSize) || 1;
1491
1527
  const safePage = Math.min(Math.max(1, previewPage), totalPages);
1492
1528
  const startIndex = (safePage - 1) * previewPageSize;
@@ -1511,7 +1547,11 @@ function CsvManagerTab() {
1511
1547
  missingDocIdCount > 0 ? `${missingDocIdCount.toLocaleString()} new entries (missing documentId)` : ""
1512
1548
  ] })
1513
1549
  ] }),
1514
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
1550
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", children: [
1551
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral700", children: [
1552
+ "Mode: ",
1553
+ modeDisplayLabel
1554
+ ] }),
1515
1555
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { backgroundColor: "primary100", textColor: "primary700", children: [
1516
1556
  "🔄 ",
1517
1557
  updateCount.toLocaleString(),
@@ -10128,4 +10168,4 @@ exports.getNestedValue = getNestedValue;
10128
10168
  exports.getPropertyValue = getPropertyValue;
10129
10169
  exports.getSortOptionsForCollection = getSortOptionsForCollection;
10130
10170
  exports.parseDynamicZonePath = parseDynamicZonePath;
10131
- //# sourceMappingURL=BulkUpdater-DTJLdJJy.js.map
10171
+ //# sourceMappingURL=BulkUpdater-Y09TGkcC.js.map