sag_components 2.0.0-beta315 → 2.0.0-beta317

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1439,7 +1439,7 @@ declare function RangePop(props: any): any;
1439
1439
 
1440
1440
  declare function SearchInput(props: any): any;
1441
1441
 
1442
- declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, searchResults, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, }: {
1442
+ declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, searchResults, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, onPackageAdded, }: {
1443
1443
  width?: string;
1444
1444
  height?: string;
1445
1445
  disableSection?: boolean;
@@ -1466,6 +1466,7 @@ declare function ItemManagerPanel({ width, height, disableSection, onSendForms,
1466
1466
  onLastRowsReached?: () => void;
1467
1467
  lastRowsThreshold?: number;
1468
1468
  onBackFromList?: any;
1469
+ onPackageAdded?: any;
1469
1470
  }): any;
1470
1471
 
1471
1472
  /**
package/dist/index.esm.js CHANGED
@@ -57347,7 +57347,8 @@ const ItemManagerPanel = _ref => {
57347
57347
  isLoadingText = "Loading Vendors...",
57348
57348
  onLastRowsReached = () => {},
57349
57349
  lastRowsThreshold = 3,
57350
- onBackFromList = null
57350
+ onBackFromList = null,
57351
+ onPackageAdded = null
57351
57352
  } = _ref;
57352
57353
  const [screen, setScreen] = useState("initial");
57353
57354
  const [selectedVendor, setSelectedVendor] = useState(null);
@@ -57400,6 +57401,8 @@ const ItemManagerPanel = _ref => {
57400
57401
  setScreen("subitem");
57401
57402
  };
57402
57403
  const addNewPackage = (vendorName, packageName, component) => {
57404
+ console.log('🟢 addNewPackage called');
57405
+ console.log('onPackageAdded exists?', !!onPackageAdded);
57403
57406
  setItemAndPackage(prev => {
57404
57407
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
57405
57408
  if (vendorIndex === -1) {
@@ -57420,6 +57423,11 @@ const ItemManagerPanel = _ref => {
57420
57423
  }, ...prev.slice(vendorIndex + 1)];
57421
57424
  }
57422
57425
  });
57426
+
57427
+ // DON'T clear search here - REMOVE THIS
57428
+ if (onPackageAdded) {
57429
+ onPackageAdded();
57430
+ }
57423
57431
  setScreen("subitem");
57424
57432
  };
57425
57433
  const hasValidStatus = pkg => pkg.hasOwnProperty("status") && pkg.status != null && pkg.status !== undefined && pkg.status !== "";
@@ -57440,7 +57448,6 @@ const ItemManagerPanel = _ref => {
57440
57448
  return {
57441
57449
  ...vendor,
57442
57450
  packages: vendor.packages.map(pkg => {
57443
- // Find the package to update by comparing with the original package
57444
57451
  if (pkg.brands === originalPackage.brands && JSON.stringify(pkg.component) === JSON.stringify(originalPackage.component)) {
57445
57452
  return {
57446
57453
  ...pkg,
@@ -57453,6 +57460,12 @@ const ItemManagerPanel = _ref => {
57453
57460
  };
57454
57461
  });
57455
57462
  });
57463
+ if (onPackageAdded) {
57464
+ console.log('🟢 Calling onPackageAdded');
57465
+ onPackageAdded();
57466
+ } else {
57467
+ console.log('🔴 onPackageAdded is null/undefined!');
57468
+ }
57456
57469
  setScreen("subitem");
57457
57470
  };
57458
57471
  const onDeleteVendor = vendor => {
@@ -57495,6 +57508,11 @@ const ItemManagerPanel = _ref => {
57495
57508
  packages: []
57496
57509
  } : item));
57497
57510
  }
57511
+
57512
+ // Clear search when going back to initial screen
57513
+ if (onSearchChange) {
57514
+ onSearchChange("");
57515
+ }
57498
57516
  setScreen("initial");
57499
57517
  },
57500
57518
  onTrashClick: () => onDeleteInner(selectedVendor),