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.js CHANGED
@@ -57357,7 +57357,8 @@ const ItemManagerPanel = _ref => {
57357
57357
  isLoadingText = "Loading Vendors...",
57358
57358
  onLastRowsReached = () => {},
57359
57359
  lastRowsThreshold = 3,
57360
- onBackFromList = null
57360
+ onBackFromList = null,
57361
+ onPackageAdded = null
57361
57362
  } = _ref;
57362
57363
  const [screen, setScreen] = React$1.useState("initial");
57363
57364
  const [selectedVendor, setSelectedVendor] = React$1.useState(null);
@@ -57410,6 +57411,8 @@ const ItemManagerPanel = _ref => {
57410
57411
  setScreen("subitem");
57411
57412
  };
57412
57413
  const addNewPackage = (vendorName, packageName, component) => {
57414
+ console.log('🟢 addNewPackage called');
57415
+ console.log('onPackageAdded exists?', !!onPackageAdded);
57413
57416
  setItemAndPackage(prev => {
57414
57417
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
57415
57418
  if (vendorIndex === -1) {
@@ -57430,6 +57433,11 @@ const ItemManagerPanel = _ref => {
57430
57433
  }, ...prev.slice(vendorIndex + 1)];
57431
57434
  }
57432
57435
  });
57436
+
57437
+ // DON'T clear search here - REMOVE THIS
57438
+ if (onPackageAdded) {
57439
+ onPackageAdded();
57440
+ }
57433
57441
  setScreen("subitem");
57434
57442
  };
57435
57443
  const hasValidStatus = pkg => pkg.hasOwnProperty("status") && pkg.status != null && pkg.status !== undefined && pkg.status !== "";
@@ -57450,7 +57458,6 @@ const ItemManagerPanel = _ref => {
57450
57458
  return {
57451
57459
  ...vendor,
57452
57460
  packages: vendor.packages.map(pkg => {
57453
- // Find the package to update by comparing with the original package
57454
57461
  if (pkg.brands === originalPackage.brands && JSON.stringify(pkg.component) === JSON.stringify(originalPackage.component)) {
57455
57462
  return {
57456
57463
  ...pkg,
@@ -57463,6 +57470,12 @@ const ItemManagerPanel = _ref => {
57463
57470
  };
57464
57471
  });
57465
57472
  });
57473
+ if (onPackageAdded) {
57474
+ console.log('🟢 Calling onPackageAdded');
57475
+ onPackageAdded();
57476
+ } else {
57477
+ console.log('🔴 onPackageAdded is null/undefined!');
57478
+ }
57466
57479
  setScreen("subitem");
57467
57480
  };
57468
57481
  const onDeleteVendor = vendor => {
@@ -57505,6 +57518,11 @@ const ItemManagerPanel = _ref => {
57505
57518
  packages: []
57506
57519
  } : item));
57507
57520
  }
57521
+
57522
+ // Clear search when going back to initial screen
57523
+ if (onSearchChange) {
57524
+ onSearchChange("");
57525
+ }
57508
57526
  setScreen("initial");
57509
57527
  },
57510
57528
  onTrashClick: () => onDeleteInner(selectedVendor),