@proveanything/smartlinks-utils-ui 0.11.9 → 0.11.11

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.
@@ -2043,7 +2043,7 @@ var useEditingScope = (args) => {
2043
2043
  const editingItemRecordId = isCollection ? selectedItemId : null;
2044
2044
  const editingScope = useMemo(() => {
2045
2045
  if (activeScope === "rule" || activeScope === "collection" || activeScope === "all") {
2046
- if (activeScope === "rule" && ruleWizardStep === 2 && selectedRecordId === null) {
2046
+ if (activeScope === "rule" && isCollection && ruleWizardStep === 2 && selectedRecordId === null) {
2047
2047
  return { ...parseRef(""), kind: "rule", raw: "rule:__draft__" };
2048
2048
  }
2049
2049
  if (selectedRecordId === null) {
@@ -9126,6 +9126,10 @@ function RecordsAdminShellInner(props) {
9126
9126
  return;
9127
9127
  }
9128
9128
  if (isProductTab) {
9129
+ if (item.scope.productId !== selectedProductId) {
9130
+ setSelectedRecordId(null);
9131
+ setDraftKind(null);
9132
+ }
9129
9133
  setSelectedProductId(item.scope.productId);
9130
9134
  setSelectedVariantId(void 0);
9131
9135
  setSelectedBatchId(void 0);
@@ -9532,7 +9536,7 @@ function RecordsAdminShellInner(props) {
9532
9536
  facets: ruleWizardFacets,
9533
9537
  itemNoun,
9534
9538
  children: [
9535
- ruleWizardStep === 2 && !isCollection && !editingTargetScope && /* @__PURE__ */ jsx(
9539
+ ruleWizardStep === 2 && !isCollection && selectedRecordId !== DRAFT_ID3 && /* @__PURE__ */ jsx(
9536
9540
  CreateRecordChooser,
9537
9541
  {
9538
9542
  title: `Create your first ${itemNoun} for this rule`,
@@ -9545,7 +9549,7 @@ function RecordsAdminShellInner(props) {
9545
9549
  onTertiary: wizardClipboard.entry ? () => startRuleWizardDraft("paste") : void 0
9546
9550
  }
9547
9551
  ),
9548
- ruleWizardStep === 2 && !isCollection && !!editingTargetScope && renderEditorWithPreview(),
9552
+ ruleWizardStep === 2 && !isCollection && selectedRecordId === DRAFT_ID3 && !!editingTargetScope && renderEditorWithPreview(),
9549
9553
  ruleWizardStep === 2 && isCollection && !selectedItemId && /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center px-6 py-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm text-center space-y-3", children: [
9550
9554
  /* @__PURE__ */ jsxs(
9551
9555
  "h3",
@@ -9623,7 +9627,7 @@ function RecordsAdminShellInner(props) {
9623
9627
  }
9624
9628
  ),
9625
9629
  ruleWizardStep === null && !isCollection && !editingScope && activeScope === "product" && !selectedProductId && /* @__PURE__ */ jsx(EmptyState, { title: i18n.emptyTitle, body: i18n.emptyBody }),
9626
- ruleWizardStep === null && isProductTab && selectedProductId && (!isCollection || selectedItemId) && /* @__PURE__ */ jsx(
9630
+ ruleWizardStep === null && isProductTab && selectedProductId && (!isCollection || selectedItemId) && !(!isCollection && editingTargetScope && resolved.source !== "self" && selectedRecordId !== DRAFT_ID3) && /* @__PURE__ */ jsx(
9627
9631
  ProductDrillDown,
9628
9632
  {
9629
9633
  productLabel: productBrowse.items.find((p) => p.id === selectedProductId)?.name ?? selectedProductId,
@@ -9660,17 +9664,20 @@ function RecordsAdminShellInner(props) {
9660
9664
  )
9661
9665
  }
9662
9666
  ),
9663
- ruleWizardStep === null && isProductTab && selectedProductId && !isCollection && editingTargetScope && resolved.source === "empty" && selectedRecordId === null ? /* @__PURE__ */ jsx(
9664
- CreateRecordChooser,
9665
- {
9666
- title: "No record set for this product",
9667
- body: `Choose whether to create a fresh ${itemNoun} for this product or start from the global default.`,
9668
- primaryLabel: "Start blank",
9669
- onPrimary: () => onCreateProductRecord("blank"),
9670
- secondaryLabel: singletonGlobalSeedAvailable ? "Copy from global" : void 0,
9671
- onSecondary: singletonGlobalSeedAvailable ? () => onCreateProductRecord("global") : void 0
9672
- }
9673
- ) : null,
9667
+ ruleWizardStep === null && isProductTab && selectedProductId && !isCollection && editingTargetScope && resolved.source !== "self" && selectedRecordId !== DRAFT_ID3 ? (() => {
9668
+ const productName = productLookupItems.find((p) => p.id === selectedProductId)?.name ?? selectedProductId;
9669
+ return /* @__PURE__ */ jsx(
9670
+ CreateRecordChooser,
9671
+ {
9672
+ title: `No ${itemNoun} set for product: ${productName}`,
9673
+ body: `Choose whether to create a fresh ${itemNoun} for this product or start from the global default.`,
9674
+ primaryLabel: "Start blank",
9675
+ onPrimary: () => onCreateProductRecord("blank"),
9676
+ secondaryLabel: singletonGlobalSeedAvailable ? "Copy from global" : void 0,
9677
+ onSecondary: singletonGlobalSeedAvailable ? () => onCreateProductRecord("global") : void 0
9678
+ }
9679
+ );
9680
+ })() : null,
9674
9681
  ruleWizardStep === null && !isProductTab && editingTargetScope && (!isCollection || selectedItemId) && renderEditorWithPreview()
9675
9682
  ] })
9676
9683
  ]