@proveanything/smartlinks-utils-ui 0.12.22 → 0.12.23

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.
@@ -154,6 +154,13 @@ interface ResolvedRecord<TData = unknown> {
154
154
  * against.
155
155
  */
156
156
  facetRule?: FacetRule | null;
157
+ /**
158
+ * Lifecycle status (`active` / `archived` / `draft` / host custom) of
159
+ * the resolved record, when `source === 'self'` or `'inherited'`.
160
+ * Surfaced so the editor footer's lifecycle menu can render against
161
+ * pinned-anchor (singleton) records the rail does not list directly.
162
+ */
163
+ lifecycleStatus?: string;
157
164
  }
158
165
 
159
166
  interface EditorContext<TData = unknown> {
@@ -2219,6 +2226,7 @@ declare function useResolvedRecord<T = unknown>(args: UseResolvedRecordArgs): {
2219
2226
  matchedAt?: _proveanything_smartlinks.MatchedAt;
2220
2227
  matchedRule?: _proveanything_smartlinks.FacetRule;
2221
2228
  facetRule?: _proveanything_smartlinks.FacetRule | null;
2229
+ lifecycleStatus?: string;
2222
2230
  };
2223
2231
 
2224
2232
  interface UseCollectionItemsArgs {
@@ -16,6 +16,7 @@ import { createPortal } from 'react-dom';
16
16
  var RECORD_LIST_QK = ["records-admin", "list"];
17
17
  var COLLECTION_ITEMS_QK = ["records-admin", "collection-items"];
18
18
  var SCOPE_COUNTS_QK = ["records-admin", "scope-counts"];
19
+ var RESOLVED_RECORD_QK = ["records-admin", "resolved"];
19
20
  var matchesCtx = (queryKey, prefix, ctx) => {
20
21
  if (queryKey.length < prefix.length + 3) return false;
21
22
  for (let i = 0; i < prefix.length; i += 1) {
@@ -178,6 +179,13 @@ function patchRecordStatusInCaches(queryClient, ctx, recordId, status) {
178
179
  return touched ? { ...prev, records } : prev;
179
180
  });
180
181
  }
182
+ const resolved = queryClient.getQueriesData({
183
+ queryKey: RESOLVED_RECORD_QK
184
+ });
185
+ for (const [key, cache] of resolved) {
186
+ if (!cache || cache.recordId !== recordId) continue;
187
+ queryClient.setQueryData(key, { ...cache, lifecycleStatus: status });
188
+ }
181
189
  }
182
190
  function markScopeCountsStale(queryClient, ctx) {
183
191
  const all = queryClient.getQueriesData({
@@ -547,7 +555,8 @@ var resolveRecord = async (args) => {
547
555
  recordId: winner.id,
548
556
  parentValue: args.withParent && parent ? parent.data : void 0,
549
557
  matchedAt: winner.matchedAt,
550
- matchedRule: winner.matchedRule
558
+ matchedRule: winner.matchedRule,
559
+ lifecycleStatus: winner.status
551
560
  };
552
561
  }
553
562
  return {
@@ -557,7 +566,8 @@ var resolveRecord = async (args) => {
557
566
  recordId: winner.id,
558
567
  parentValue: args.withParent ? winner.data : void 0,
559
568
  matchedAt: winner.matchedAt,
560
- matchedRule: winner.matchedRule
569
+ matchedRule: winner.matchedRule,
570
+ lifecycleStatus: winner.status
561
571
  };
562
572
  };
563
573
 
@@ -621,7 +631,8 @@ function useResolvedRecord(args) {
621
631
  source: "self",
622
632
  sourceRef: rec.ref ?? void 0,
623
633
  recordId: rec.id,
624
- facetRule: recFacetRule
634
+ facetRule: recFacetRule,
635
+ lifecycleStatus: rec.status
625
636
  };
626
637
  }
627
638
  const target = {
@@ -10232,7 +10243,18 @@ function RecordsAdminShellInner(props) {
10232
10243
  ]
10233
10244
  }
10234
10245
  ) : null;
10235
- const selectedSummary = isCollection && selectedItemId && !isDraftId3(selectedItemId) ? collectionItems.items.find((r) => r.id === selectedItemId || r.itemId === selectedItemId) : selectedRecordId && selectedRecordId !== DRAFT_ID3 ? recordList.items.find((r) => r.id === selectedRecordId) ?? globalScopedList.items.find((r) => r.id === selectedRecordId) ?? ruleScopedList.items.find((r) => r.id === selectedRecordId) ?? collectionItems.items.find((r) => r.id === selectedRecordId) : void 0;
10246
+ let selectedSummary = isCollection && selectedItemId && !isDraftId3(selectedItemId) ? collectionItems.items.find((r) => r.id === selectedItemId || r.itemId === selectedItemId) : selectedRecordId && selectedRecordId !== DRAFT_ID3 ? recordList.items.find((r) => r.id === selectedRecordId) ?? globalScopedList.items.find((r) => r.id === selectedRecordId) ?? ruleScopedList.items.find((r) => r.id === selectedRecordId) ?? collectionItems.items.find((r) => r.id === selectedRecordId) : void 0;
10247
+ if (!selectedSummary && !isCollection && resolved.source === "self" && resolved.recordId && editingTargetScope) {
10248
+ selectedSummary = {
10249
+ id: resolved.recordId,
10250
+ ref: resolved.sourceRef ?? editingTargetScope.raw,
10251
+ scope: editingTargetScope,
10252
+ data: resolved.data,
10253
+ status: "configured",
10254
+ label: "",
10255
+ lifecycleStatus: resolved.lifecycleStatus
10256
+ };
10257
+ }
10236
10258
  const editorLifecycleControl = selectedSummary?.id ? /* @__PURE__ */ jsx(
10237
10259
  LifecycleStatusControl,
10238
10260
  {