@proveanything/smartlinks-utils-ui 1.13.18 → 1.14.0
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.
|
@@ -1254,7 +1254,7 @@ var useProductBrowse = (args) => {
|
|
|
1254
1254
|
if (search.trim()) body.query = { search: search.trim() };
|
|
1255
1255
|
let res = null;
|
|
1256
1256
|
if (SL?.products?.query) {
|
|
1257
|
-
res = await SL.products.query(collectionId, body);
|
|
1257
|
+
res = await SL.products.query(collectionId, body, admin);
|
|
1258
1258
|
} else if (SL?.product?.query) {
|
|
1259
1259
|
res = await SL.product.query(collectionId, body, admin);
|
|
1260
1260
|
} else {
|
|
@@ -1468,7 +1468,7 @@ var useSingleProduct = (args) => {
|
|
|
1468
1468
|
if (p) return toBrowseItem2(p, productId);
|
|
1469
1469
|
}
|
|
1470
1470
|
if (SL?.products?.get) {
|
|
1471
|
-
const p = await SL.products.get(collectionId, productId);
|
|
1471
|
+
const p = await SL.products.get(collectionId, productId, admin);
|
|
1472
1472
|
if (p) return toBrowseItem2(p, productId);
|
|
1473
1473
|
}
|
|
1474
1474
|
const list = SL?.products?.list ? await SL.products.list(collectionId, admin) : SL?.product?.list ? await SL.product.list(collectionId, admin) : [];
|
|
@@ -9565,6 +9565,32 @@ function RecordsAdminShellInner(props) {
|
|
|
9565
9565
|
} = selection;
|
|
9566
9566
|
const [isReconcilingRecordSelection, setIsReconcilingRecordSelection] = useState(false);
|
|
9567
9567
|
const { dismissed, dismiss, undismiss } = useIntroDismissed(SL, collectionId, appId, recordType);
|
|
9568
|
+
const primeResolvedFromRow = useCallback((row) => {
|
|
9569
|
+
if (!row?.id) return;
|
|
9570
|
+
if (row.data === void 0) return;
|
|
9571
|
+
const cacheKey = resolvedRecordQueryKey({
|
|
9572
|
+
collectionId,
|
|
9573
|
+
appId,
|
|
9574
|
+
recordType,
|
|
9575
|
+
productId: row.scope?.productId,
|
|
9576
|
+
variantId: row.scope?.variantId,
|
|
9577
|
+
batchId: row.scope?.batchId,
|
|
9578
|
+
facetId: row.scope?.facetId,
|
|
9579
|
+
facetValue: row.scope?.facetValue,
|
|
9580
|
+
proofId: row.scope?.proofId,
|
|
9581
|
+
recordId: row.id,
|
|
9582
|
+
withParent: true
|
|
9583
|
+
});
|
|
9584
|
+
if (queryClient.getQueryData(cacheKey) !== void 0) return;
|
|
9585
|
+
queryClient.setQueryData(cacheKey, {
|
|
9586
|
+
data: row.data,
|
|
9587
|
+
source: "self",
|
|
9588
|
+
sourceRef: row.ref || void 0,
|
|
9589
|
+
recordId: row.id,
|
|
9590
|
+
facetRule: row.facetRule ?? null,
|
|
9591
|
+
lifecycleStatus: row.lifecycleStatus
|
|
9592
|
+
});
|
|
9593
|
+
}, [queryClient, collectionId, appId, recordType]);
|
|
9568
9594
|
const mintRuleWizardDraftKey = useCallback(
|
|
9569
9595
|
() => `rule-wizard:${typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`}`,
|
|
9570
9596
|
[]
|
|
@@ -9706,10 +9732,12 @@ function RecordsAdminShellInner(props) {
|
|
|
9706
9732
|
if (cardinality === "singleton") {
|
|
9707
9733
|
const conflict = findConflictForRecord(first.id, singletonConflicts);
|
|
9708
9734
|
if (conflict?.active.id) {
|
|
9735
|
+
primeResolvedFromRow(recordList.items.find((it) => it.id === conflict.active.id) ?? null);
|
|
9709
9736
|
setSelectedRecordId(conflict.active.id);
|
|
9710
9737
|
return;
|
|
9711
9738
|
}
|
|
9712
9739
|
}
|
|
9740
|
+
primeResolvedFromRow(first);
|
|
9713
9741
|
setSelectedRecordId(first.id);
|
|
9714
9742
|
}, [activeScope, selectedRecordId, recordList.items, cardinality, ruleWizardStep, draftKind, isReconcilingRecordSelection, singletonConflicts]);
|
|
9715
9743
|
const editingScopes = useEditingScope({
|
|
@@ -10004,8 +10032,8 @@ function RecordsAdminShellInner(props) {
|
|
|
10004
10032
|
if (savedFromRuleWizard && !isCollection && savedRecordId) {
|
|
10005
10033
|
setSelectedRecordId(savedRecordId);
|
|
10006
10034
|
}
|
|
10007
|
-
if (!isCollection && isCreate &&
|
|
10008
|
-
setSelectedRecordId(savedRecordId
|
|
10035
|
+
if (!isCollection && isCreate && savedRecordId) {
|
|
10036
|
+
setSelectedRecordId(savedRecordId);
|
|
10009
10037
|
}
|
|
10010
10038
|
setIsReconcilingRecordSelection(false);
|
|
10011
10039
|
},
|
|
@@ -11064,6 +11092,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11064
11092
|
setSelectedBatchId(void 0);
|
|
11065
11093
|
setDrillTab("product");
|
|
11066
11094
|
} else {
|
|
11095
|
+
primeResolvedFromRow(item);
|
|
11067
11096
|
setSelectedRecordId(item.id ?? null);
|
|
11068
11097
|
setDraftKind(null);
|
|
11069
11098
|
if (ruleWizardStep !== null) {
|
|
@@ -11465,6 +11494,12 @@ function RecordsAdminShellInner(props) {
|
|
|
11465
11494
|
},
|
|
11466
11495
|
onArchiveDuplicates: enableArchiveDuplicates ? async () => {
|
|
11467
11496
|
const ids = singletonConflicts.flatMap((c) => c.duplicates.map((d) => d.id)).filter((id) => !!id);
|
|
11497
|
+
const survivorIfStrandedArchive = (() => {
|
|
11498
|
+
if (!selectedRecordId || selectedRecordId === DRAFT_ID3) return void 0;
|
|
11499
|
+
if (!ids.includes(selectedRecordId)) return void 0;
|
|
11500
|
+
const c = singletonConflicts.find((c2) => c2.duplicates.some((d) => d.id === selectedRecordId));
|
|
11501
|
+
return c?.active.id;
|
|
11502
|
+
})();
|
|
11468
11503
|
for (const id of ids) {
|
|
11469
11504
|
try {
|
|
11470
11505
|
const updated = await SL.app.records.update(collectionId, appId, id, { status: archivedStatusValue }, true);
|
|
@@ -11482,9 +11517,18 @@ function RecordsAdminShellInner(props) {
|
|
|
11482
11517
|
}
|
|
11483
11518
|
}
|
|
11484
11519
|
markScopeCountsStale(queryClient, ctx);
|
|
11520
|
+
if (survivorIfStrandedArchive) {
|
|
11521
|
+
setSelectedRecordId(survivorIfStrandedArchive);
|
|
11522
|
+
}
|
|
11485
11523
|
} : void 0,
|
|
11486
11524
|
onDeleteDuplicates: enableDeleteDuplicates ? async () => {
|
|
11487
11525
|
const ids = singletonConflicts.flatMap((c) => c.duplicates.map((d) => d.id)).filter((id) => !!id);
|
|
11526
|
+
const survivorIfStrandedDelete = (() => {
|
|
11527
|
+
if (!selectedRecordId || selectedRecordId === DRAFT_ID3) return void 0;
|
|
11528
|
+
if (!ids.includes(selectedRecordId)) return void 0;
|
|
11529
|
+
const c = singletonConflicts.find((c2) => c2.duplicates.some((d) => d.id === selectedRecordId));
|
|
11530
|
+
return c?.active.id;
|
|
11531
|
+
})();
|
|
11488
11532
|
for (const id of ids) {
|
|
11489
11533
|
try {
|
|
11490
11534
|
await SL.app.records.remove(collectionId, appId, id, true);
|
|
@@ -11500,6 +11544,11 @@ function RecordsAdminShellInner(props) {
|
|
|
11500
11544
|
}
|
|
11501
11545
|
}
|
|
11502
11546
|
markScopeCountsStale(queryClient, ctx);
|
|
11547
|
+
if (survivorIfStrandedDelete) {
|
|
11548
|
+
setSelectedRecordId(survivorIfStrandedDelete);
|
|
11549
|
+
} else if (selectedRecordId && ids.includes(selectedRecordId)) {
|
|
11550
|
+
setSelectedRecordId(null);
|
|
11551
|
+
}
|
|
11503
11552
|
} : void 0,
|
|
11504
11553
|
i18n: {
|
|
11505
11554
|
title: i18n.conflictBannerTitle,
|
|
@@ -12275,7 +12324,13 @@ function useRecordEditor(args) {
|
|
|
12275
12324
|
source: "self",
|
|
12276
12325
|
sourceRef: scope.raw,
|
|
12277
12326
|
recordId: resolved.recordId,
|
|
12278
|
-
parentValue: previousCache?.parentValue ?? resolved.parentValue
|
|
12327
|
+
parentValue: previousCache?.parentValue ?? resolved.parentValue,
|
|
12328
|
+
// Preserve the record's `facetRule` across the optimistic flip so
|
|
12329
|
+
// rule-targeted rows don't briefly look like unanchored globals
|
|
12330
|
+
// (which would cascade into the editor seeding an empty rule and
|
|
12331
|
+
// the next save creating a duplicate global).
|
|
12332
|
+
facetRule: facetRule ?? previousCache?.facetRule ?? null,
|
|
12333
|
+
lifecycleStatus: previousCache?.lifecycleStatus
|
|
12279
12334
|
});
|
|
12280
12335
|
try {
|
|
12281
12336
|
if (resolved.recordId && resolved.source === "self") {
|