@ohhwells/bridge 0.1.117-next.311 → 0.1.117-next.312

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.cjs CHANGED
@@ -10335,16 +10335,16 @@ function AiPricingCardOverlay({
10335
10335
  const runMutation = (0, import_react9.useCallback)(
10336
10336
  async (sectionId, mutate) => {
10337
10337
  const entry = findEntry(sectionId);
10338
- if (!entry) return;
10338
+ if (!entry) return false;
10339
10339
  const nextTree = mutate(entry.tree);
10340
- if (!nextTree) return;
10340
+ if (!nextTree) return false;
10341
10341
  setPending(true);
10342
10342
  setError(null);
10343
10343
  const { ok, reasons } = await requestValidateTree(postToParent2, nextTree);
10344
10344
  setPending(false);
10345
10345
  if (!ok) {
10346
10346
  setError(reasons[0] ?? "That change is not allowed.");
10347
- return;
10347
+ return false;
10348
10348
  }
10349
10349
  applyTreeLocalRef.current?.({
10350
10350
  id: sectionId,
@@ -10358,6 +10358,7 @@ function AiPricingCardOverlay({
10358
10358
  // viewport on every tier add/remove/toggle reads as the section jumping around.
10359
10359
  skipScrollIntoView: true
10360
10360
  });
10361
+ return true;
10361
10362
  },
10362
10363
  [findEntry, postToParent2, applyTreeLocalRef]
10363
10364
  );
@@ -10406,7 +10407,13 @@ function AiPricingCardOverlay({
10406
10407
  pending,
10407
10408
  error,
10408
10409
  onAddTier: () => runMutation(active.sectionId, addPricingTier),
10409
- onRemoveTier: () => runMutation(active.sectionId, (tree) => removePricingTier(tree, active.index)),
10410
+ onRemoveTier: () => {
10411
+ void runMutation(active.sectionId, (tree) => removePricingTier(tree, active.index)).then(
10412
+ (applied) => {
10413
+ if (applied) setActive(null);
10414
+ }
10415
+ );
10416
+ },
10410
10417
  onToggleFeatured: (enabled) => runMutation(
10411
10418
  active.sectionId,
10412
10419
  (tree) => setPricingCardFeatured(tree, active.index, { enabled })