@proveanything/smartlinks-utils-ui 0.9.2 → 0.9.3
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/{chunk-CBIKDA3S.js → chunk-2IQEDRSZ.js} +4 -31
- package/dist/chunk-2IQEDRSZ.js.map +1 -0
- package/dist/chunk-OLYC54YT.js +59 -0
- package/dist/chunk-OLYC54YT.js.map +1 -0
- package/dist/components/AssetPicker/index.css +2153 -3
- package/dist/components/AssetPicker/index.css.map +1 -1
- package/dist/components/AssetPicker/index.js +2 -1
- package/dist/components/ConditionsEditor/index.css +2153 -3
- package/dist/components/ConditionsEditor/index.css.map +1 -1
- package/dist/components/FontPicker/index.css +2153 -3
- package/dist/components/FontPicker/index.css.map +1 -1
- package/dist/components/IconPicker/index.css +2153 -3
- package/dist/components/IconPicker/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.css +25 -16
- package/dist/components/RecordsAdmin/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.d.ts +18 -2
- package/dist/components/RecordsAdmin/index.js +284 -58
- package/dist/components/RecordsAdmin/index.js.map +1 -1
- package/dist/index.css +2153 -3
- package/dist/index.css.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-CBIKDA3S.js.map +0 -1
|
@@ -493,7 +493,17 @@ interface DeepLinkAdapter {
|
|
|
493
493
|
subscribe(listener: () => void): () => void;
|
|
494
494
|
}
|
|
495
495
|
interface DeepLinkOptions {
|
|
496
|
-
/**
|
|
496
|
+
/**
|
|
497
|
+
* Master switch. **Default `true` as of v0.10.** Most hosts want URL
|
|
498
|
+
* round-tripping (refresh / share-link restores the open record), so the
|
|
499
|
+
* shell installs a default adapter automatically — `window.location` +
|
|
500
|
+
* `window.history` for standalone hosts, or a postMessage relay when
|
|
501
|
+
* mounted inside a SmartLinks iframe.
|
|
502
|
+
*
|
|
503
|
+
* Set to `false` to run an isolated shell whose state never touches the
|
|
504
|
+
* URL. Useful for embedded previews, modal pickers, or hosts that own
|
|
505
|
+
* a more opinionated URL scheme they don't want the shell to touch.
|
|
506
|
+
*/
|
|
497
507
|
enabled?: boolean;
|
|
498
508
|
/** Push/replace strategy. Default `'smart'`. */
|
|
499
509
|
history?: DeepLinkHistoryMode;
|
|
@@ -1376,13 +1386,19 @@ interface PreviewScopePickerProps {
|
|
|
1376
1386
|
/** Are variants/batches available for drill-down. */
|
|
1377
1387
|
showVariants: boolean;
|
|
1378
1388
|
showBatches: boolean;
|
|
1389
|
+
/** Active rail tab. The picker hides itself on product/variant/batch
|
|
1390
|
+
* tabs because the editing scope already pins a product there. */
|
|
1391
|
+
activeScope?: ScopeKind;
|
|
1379
1392
|
/** i18n strings (uses defaults if omitted). */
|
|
1380
1393
|
i18n?: {
|
|
1381
1394
|
previewAs?: string;
|
|
1382
1395
|
previewAsDefault?: string;
|
|
1396
|
+
change?: string;
|
|
1397
|
+
searchProducts?: string;
|
|
1398
|
+
close?: string;
|
|
1383
1399
|
};
|
|
1384
1400
|
}
|
|
1385
|
-
declare const PreviewScopePicker: ({ SL, collectionId, editingScope, value, onChange, showVariants, showBatches, i18n, }: PreviewScopePickerProps) => react_jsx_runtime.JSX.Element | null;
|
|
1401
|
+
declare const PreviewScopePicker: ({ SL, collectionId, editingScope, value, onChange, showVariants, showBatches, activeScope, i18n, }: PreviewScopePickerProps) => react_jsx_runtime.JSX.Element | null;
|
|
1386
1402
|
|
|
1387
1403
|
declare const ScopeBreadcrumb: ({ scope }: {
|
|
1388
1404
|
scope: ParsedRef;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertComponentStylesLoaded } from '../../chunk-OLYC54YT.js';
|
|
1
2
|
import '../../chunk-5UQQYXCX.js';
|
|
2
3
|
import { FacetRuleEditor } from '../../chunk-JMCV6FOW.js';
|
|
3
4
|
import { useFacets } from '../../chunk-4LHF5JB7.js';
|
|
@@ -5,7 +6,7 @@ import { cn } from '../../chunk-L7FQ52F5.js';
|
|
|
5
6
|
import { parsedRefToTarget, parsedRefToScope, matchRecords, scopesEqual, getRecordById, listRecords, upsertRecord, updateRecord, createRecord, removeRecord } from '../../chunk-KFKVGUUP.js';
|
|
6
7
|
export { bulkDelete, bulkUpsert, createRecord, getRecordById, listRecords, matchRecords, parsedRefToScope, parsedRefToTarget, removeRecord, restoreRecord, scopesEqual, upsertRecord } from '../../chunk-KFKVGUUP.js';
|
|
7
8
|
import { createContext, useState, useEffect, useCallback, useMemo, useRef, useContext, useSyncExternalStore, createElement, useId } from 'react';
|
|
8
|
-
import { ChevronDown, Database, Lightbulb, SearchX, Inbox, LayoutGrid, Eye, MoreHorizontal, Download, Upload, Trash2, Copy, Pencil, Plus, CircleDashed, ArrowDownLeft, CheckCircle2, List, SlidersHorizontal, Globe, Tag, Boxes, Layers, Package, Rows3, ChevronRight, Eraser, ClipboardPaste, Box, X, Image, Table, ArrowLeft, ChevronLeft, AlertTriangle, Info, HelpCircle,
|
|
9
|
+
import { ChevronDown, Database, Lightbulb, SearchX, Inbox, LayoutGrid, Eye, MoreHorizontal, Download, Upload, Trash2, Copy, Pencil, Plus, CircleDashed, ArrowDownLeft, CheckCircle2, List, SlidersHorizontal, Globe, Tag, Boxes, Layers, Package, Rows3, ChevronRight, Eraser, ClipboardPaste, Box, X, Search, Image, Table, ArrowLeft, ChevronLeft, AlertTriangle, Info, HelpCircle, CornerDownLeft, Circle, AlertCircle, Undo2, Save, Loader2, XCircle, ArrowRight, BookOpen, Globe2, Target, Check, Settings2 } from 'lucide-react';
|
|
9
10
|
import { useQuery, useQueryClient, useInfiniteQuery } from '@tanstack/react-query';
|
|
10
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
12
|
import { createPortal } from 'react-dom';
|
|
@@ -2113,13 +2114,24 @@ var useShellDeepLink = (args) => {
|
|
|
2113
2114
|
setSelectedVariantId,
|
|
2114
2115
|
selectedBatchId,
|
|
2115
2116
|
setSelectedBatchId,
|
|
2116
|
-
setFacetBrowseFilter
|
|
2117
|
+
setFacetBrowseFilter,
|
|
2118
|
+
isCollection,
|
|
2119
|
+
setSelectedItemId,
|
|
2120
|
+
collectionItems,
|
|
2121
|
+
recordListItems,
|
|
2122
|
+
recordListLoading,
|
|
2123
|
+
skipNextItemResetRef
|
|
2117
2124
|
} = args;
|
|
2118
2125
|
const lastAppliedDLRef = useRef("");
|
|
2119
2126
|
const [pendingDeepLinkRecordId, setPendingDeepLinkRecordId] = useState(null);
|
|
2127
|
+
const warnedMissingRef = useRef(/* @__PURE__ */ new Set());
|
|
2120
2128
|
useEffect(() => {
|
|
2121
2129
|
if (!deepLinkState.enabled) return;
|
|
2122
2130
|
if (selectedItemId) return;
|
|
2131
|
+
console.debug("[RecordsAdminShell] rail-scope emit", {
|
|
2132
|
+
scope: editingScope?.raw ?? null,
|
|
2133
|
+
itemView
|
|
2134
|
+
});
|
|
2123
2135
|
deepLinkState.emit({ scope: editingScope?.raw ?? null, recordId: null }, "scope");
|
|
2124
2136
|
lastAppliedDLRef.current = `${""}|${editingScope?.raw ?? ""}|${itemView}`;
|
|
2125
2137
|
}, [deepLinkState.enabled, editingScope?.raw, selectedItemId, itemView]);
|
|
@@ -2159,6 +2171,53 @@ var useShellDeepLink = (args) => {
|
|
|
2159
2171
|
});
|
|
2160
2172
|
}
|
|
2161
2173
|
}, [deepLinkState.enabled, deepLinkState.urlState]);
|
|
2174
|
+
useEffect(() => {
|
|
2175
|
+
const pending = pendingDeepLinkRecordId;
|
|
2176
|
+
if (!pending) return;
|
|
2177
|
+
if (isCollection) {
|
|
2178
|
+
const hit2 = collectionItems.items.find((it) => it.id === pending || it.itemId === pending);
|
|
2179
|
+
if (hit2) {
|
|
2180
|
+
skipNextItemResetRef.current = true;
|
|
2181
|
+
setSelectedItemId(pending);
|
|
2182
|
+
setPendingDeepLinkRecordId(null);
|
|
2183
|
+
return;
|
|
2184
|
+
}
|
|
2185
|
+
if (!collectionItems.isLoading) {
|
|
2186
|
+
if (!warnedMissingRef.current.has(pending)) {
|
|
2187
|
+
warnedMissingRef.current.add(pending);
|
|
2188
|
+
console.warn("[RecordsAdminShell] deep-linked recordId not found in collection items \u2014 clearing pending selection", {
|
|
2189
|
+
recordId: pending,
|
|
2190
|
+
scope: editingScope?.raw ?? null
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
setPendingDeepLinkRecordId(null);
|
|
2194
|
+
}
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
const hit = recordListItems.find((it) => it.id === pending);
|
|
2198
|
+
if (hit) {
|
|
2199
|
+
if (selectedRecordId !== pending) setSelectedRecordId(pending);
|
|
2200
|
+
setPendingDeepLinkRecordId(null);
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
if (!recordListLoading) {
|
|
2204
|
+
if (!warnedMissingRef.current.has(pending)) {
|
|
2205
|
+
warnedMissingRef.current.add(pending);
|
|
2206
|
+
console.warn("[RecordsAdminShell] deep-linked recordId not found in records list \u2014 clearing pending selection", {
|
|
2207
|
+
recordId: pending,
|
|
2208
|
+
scope: editingScope?.raw ?? null
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
setPendingDeepLinkRecordId(null);
|
|
2212
|
+
}
|
|
2213
|
+
}, [
|
|
2214
|
+
pendingDeepLinkRecordId,
|
|
2215
|
+
isCollection,
|
|
2216
|
+
collectionItems.items,
|
|
2217
|
+
collectionItems.isLoading,
|
|
2218
|
+
recordListItems,
|
|
2219
|
+
recordListLoading
|
|
2220
|
+
]);
|
|
2162
2221
|
return { pendingDeepLinkRecordId, lastAppliedDLRef };
|
|
2163
2222
|
};
|
|
2164
2223
|
var isFacetRuleValid = (rule) => {
|
|
@@ -4012,7 +4071,7 @@ var classify2 = (mode, kind) => {
|
|
|
4012
4071
|
return SMART_PUSH.includes(kind) ? "push" : "replace";
|
|
4013
4072
|
};
|
|
4014
4073
|
function useDeepLinkState(options) {
|
|
4015
|
-
const enabled =
|
|
4074
|
+
const enabled = options?.enabled !== false;
|
|
4016
4075
|
const history = options?.history ?? "smart";
|
|
4017
4076
|
const paramNames = useMemo(() => ({
|
|
4018
4077
|
...DEFAULT_DEEP_LINK_PARAM_NAMES,
|
|
@@ -4042,8 +4101,15 @@ function useDeepLinkState(options) {
|
|
|
4042
4101
|
return adapter.subscribe(() => setUrlState(adapter.read()));
|
|
4043
4102
|
}, [adapter]);
|
|
4044
4103
|
const emit = useCallback((partial, kind) => {
|
|
4045
|
-
if (!adapter)
|
|
4104
|
+
if (!adapter) {
|
|
4105
|
+
console.debug("[smartlinks-ui] deep-link emit skipped \u2014 no adapter (deepLink not enabled?)", {
|
|
4106
|
+
partial,
|
|
4107
|
+
kind
|
|
4108
|
+
});
|
|
4109
|
+
return;
|
|
4110
|
+
}
|
|
4046
4111
|
const mode = classify2(history, kind);
|
|
4112
|
+
console.debug("[smartlinks-ui] deep-link emit", { partial, kind, mode });
|
|
4047
4113
|
adapter.write(partial, mode);
|
|
4048
4114
|
setUrlState((prev) => ({ ...prev, ...partial }));
|
|
4049
4115
|
}, [adapter, history]);
|
|
@@ -5101,14 +5167,16 @@ var PreviewScopePicker = ({
|
|
|
5101
5167
|
onChange,
|
|
5102
5168
|
showVariants,
|
|
5103
5169
|
showBatches,
|
|
5170
|
+
activeScope,
|
|
5104
5171
|
i18n
|
|
5105
5172
|
}) => {
|
|
5106
5173
|
const productPinned = !!editingScope.productId;
|
|
5174
|
+
const hideForTab = activeScope === "product" || activeScope === "variant" || activeScope === "batch";
|
|
5107
5175
|
const products = useProductBrowse({
|
|
5108
5176
|
SL,
|
|
5109
5177
|
collectionId,
|
|
5110
5178
|
pageSize: 100,
|
|
5111
|
-
enabled: !productPinned
|
|
5179
|
+
enabled: !productPinned && !hideForTab
|
|
5112
5180
|
});
|
|
5113
5181
|
const variants = useProductChildren({
|
|
5114
5182
|
SL,
|
|
@@ -5122,11 +5190,8 @@ var PreviewScopePicker = ({
|
|
|
5122
5190
|
productId: value.productId,
|
|
5123
5191
|
kind: showBatches ? "batch" : null
|
|
5124
5192
|
});
|
|
5125
|
-
const isDefault = useMemo(
|
|
5126
|
-
() => value.raw === editingScope.raw,
|
|
5127
|
-
[value.raw, editingScope.raw]
|
|
5128
|
-
);
|
|
5129
5193
|
useEffect(() => {
|
|
5194
|
+
if (hideForTab) return;
|
|
5130
5195
|
if (productPinned) return;
|
|
5131
5196
|
if (value.productId) return;
|
|
5132
5197
|
const first = products.items[0];
|
|
@@ -5138,9 +5203,10 @@ var PreviewScopePicker = ({
|
|
|
5138
5203
|
batchId: void 0,
|
|
5139
5204
|
raw: `product:${first.id}`
|
|
5140
5205
|
});
|
|
5141
|
-
}, [productPinned, value.productId, products.items]);
|
|
5142
|
-
const [
|
|
5143
|
-
|
|
5206
|
+
}, [hideForTab, productPinned, value.productId, products.items]);
|
|
5207
|
+
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
5208
|
+
if (hideForTab) return null;
|
|
5209
|
+
const showProductPicker = !productPinned;
|
|
5144
5210
|
const showVariantPicker = showVariants && !!value.productId && variants.items.length > 0;
|
|
5145
5211
|
const showBatchPicker = showBatches && !!value.productId && batches.items.length > 0;
|
|
5146
5212
|
if (!showProductPicker && !showVariantPicker && !showBatchPicker) {
|
|
@@ -5151,6 +5217,16 @@ var PreviewScopePicker = ({
|
|
|
5151
5217
|
borderColor: "hsl(var(--ra-border))",
|
|
5152
5218
|
color: "hsl(var(--ra-text))"
|
|
5153
5219
|
};
|
|
5220
|
+
const pickProduct = (productId) => {
|
|
5221
|
+
onChange({
|
|
5222
|
+
...value,
|
|
5223
|
+
productId,
|
|
5224
|
+
variantId: void 0,
|
|
5225
|
+
batchId: void 0,
|
|
5226
|
+
raw: `product:${productId}`
|
|
5227
|
+
});
|
|
5228
|
+
setLightboxOpen(false);
|
|
5229
|
+
};
|
|
5154
5230
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
5155
5231
|
/* @__PURE__ */ jsxs(
|
|
5156
5232
|
"span",
|
|
@@ -5163,56 +5239,27 @@ var PreviewScopePicker = ({
|
|
|
5163
5239
|
]
|
|
5164
5240
|
}
|
|
5165
5241
|
),
|
|
5166
|
-
|
|
5167
|
-
"
|
|
5168
|
-
{
|
|
5169
|
-
type: "button",
|
|
5170
|
-
onClick: () => onChange(editingScope),
|
|
5171
|
-
className: "text-[10px] px-2 py-1 rounded-md border hover:bg-[hsl(var(--ra-muted))]",
|
|
5172
|
-
style: selectStyle,
|
|
5173
|
-
children: [
|
|
5174
|
-
"\u21BA ",
|
|
5175
|
-
i18n?.previewAsDefault ?? "Same as edited"
|
|
5176
|
-
]
|
|
5177
|
-
}
|
|
5178
|
-
),
|
|
5179
|
-
showProductPicker && !productPickerOpen && currentProductName && /* @__PURE__ */ jsxs(
|
|
5180
|
-
"button",
|
|
5242
|
+
showProductPicker && /* @__PURE__ */ jsxs(
|
|
5243
|
+
"span",
|
|
5181
5244
|
{
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
className: "text-[10px] px-2 py-1 rounded-md border hover:bg-[hsl(var(--ra-muted))] inline-flex items-center gap-1 max-w-[12rem] truncate",
|
|
5185
|
-
style: selectStyle,
|
|
5186
|
-
title: `Preview as ${currentProductName} \u2014 click to change`,
|
|
5245
|
+
className: "inline-flex items-center gap-1.5 text-[11px] truncate max-w-[18rem]",
|
|
5246
|
+
style: { color: "hsl(var(--ra-text))" },
|
|
5187
5247
|
children: [
|
|
5188
|
-
"
|
|
5189
|
-
/* @__PURE__ */ jsx(
|
|
5190
|
-
|
|
5248
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium truncate", title: currentProductName, children: currentProductName || "\u2014" }),
|
|
5249
|
+
/* @__PURE__ */ jsx(
|
|
5250
|
+
"button",
|
|
5251
|
+
{
|
|
5252
|
+
type: "button",
|
|
5253
|
+
onClick: () => setLightboxOpen(true),
|
|
5254
|
+
className: "text-[10px] px-1.5 py-0.5 rounded-md border hover:bg-[hsl(var(--ra-muted))]",
|
|
5255
|
+
style: selectStyle,
|
|
5256
|
+
title: i18n?.change ?? "Change preview product",
|
|
5257
|
+
children: i18n?.change ?? "Change"
|
|
5258
|
+
}
|
|
5259
|
+
)
|
|
5191
5260
|
]
|
|
5192
5261
|
}
|
|
5193
5262
|
),
|
|
5194
|
-
showProductPicker && productPickerOpen && /* @__PURE__ */ jsx(
|
|
5195
|
-
"select",
|
|
5196
|
-
{
|
|
5197
|
-
className: SELECT_CLS,
|
|
5198
|
-
style: selectStyle,
|
|
5199
|
-
autoFocus: true,
|
|
5200
|
-
onBlur: () => setProductPickerOpen(false),
|
|
5201
|
-
value: value.productId ?? "",
|
|
5202
|
-
onChange: (e) => {
|
|
5203
|
-
const productId = e.target.value || void 0;
|
|
5204
|
-
onChange({
|
|
5205
|
-
...value,
|
|
5206
|
-
productId,
|
|
5207
|
-
variantId: void 0,
|
|
5208
|
-
batchId: void 0,
|
|
5209
|
-
raw: productId ? `product:${productId}` : ""
|
|
5210
|
-
});
|
|
5211
|
-
setProductPickerOpen(false);
|
|
5212
|
-
},
|
|
5213
|
-
children: products.items.map((p) => /* @__PURE__ */ jsx("option", { value: p.id, children: p.name }, p.id))
|
|
5214
|
-
}
|
|
5215
|
-
),
|
|
5216
5263
|
showVariantPicker && /* @__PURE__ */ jsxs(
|
|
5217
5264
|
"select",
|
|
5218
5265
|
{
|
|
@@ -5253,9 +5300,161 @@ var PreviewScopePicker = ({
|
|
|
5253
5300
|
batches.items.map((b) => /* @__PURE__ */ jsx("option", { value: b.id, children: b.name }, b.id))
|
|
5254
5301
|
]
|
|
5255
5302
|
}
|
|
5303
|
+
),
|
|
5304
|
+
lightboxOpen && /* @__PURE__ */ jsx(
|
|
5305
|
+
ProductPickerLightbox,
|
|
5306
|
+
{
|
|
5307
|
+
SL,
|
|
5308
|
+
collectionId,
|
|
5309
|
+
currentProductId: value.productId,
|
|
5310
|
+
onPick: pickProduct,
|
|
5311
|
+
onClose: () => setLightboxOpen(false),
|
|
5312
|
+
i18n
|
|
5313
|
+
}
|
|
5256
5314
|
)
|
|
5257
5315
|
] });
|
|
5258
5316
|
};
|
|
5317
|
+
var ProductPickerLightbox = ({
|
|
5318
|
+
SL,
|
|
5319
|
+
collectionId,
|
|
5320
|
+
currentProductId,
|
|
5321
|
+
onPick,
|
|
5322
|
+
onClose,
|
|
5323
|
+
i18n
|
|
5324
|
+
}) => {
|
|
5325
|
+
const [search, setSearch] = useState("");
|
|
5326
|
+
const inputRef = useRef(null);
|
|
5327
|
+
const browse = useProductBrowse({
|
|
5328
|
+
SL,
|
|
5329
|
+
collectionId,
|
|
5330
|
+
search,
|
|
5331
|
+
pageSize: 50,
|
|
5332
|
+
enabled: true
|
|
5333
|
+
});
|
|
5334
|
+
useEffect(() => {
|
|
5335
|
+
const prev = document.body.style.overflow;
|
|
5336
|
+
document.body.style.overflow = "hidden";
|
|
5337
|
+
const t = window.setTimeout(() => inputRef.current?.focus(), 0);
|
|
5338
|
+
const onKey = (e) => {
|
|
5339
|
+
if (e.key === "Escape") {
|
|
5340
|
+
e.stopPropagation();
|
|
5341
|
+
onClose();
|
|
5342
|
+
}
|
|
5343
|
+
};
|
|
5344
|
+
window.addEventListener("keydown", onKey, true);
|
|
5345
|
+
return () => {
|
|
5346
|
+
window.clearTimeout(t);
|
|
5347
|
+
window.removeEventListener("keydown", onKey, true);
|
|
5348
|
+
document.body.style.overflow = prev;
|
|
5349
|
+
};
|
|
5350
|
+
}, [onClose]);
|
|
5351
|
+
if (typeof document === "undefined") return null;
|
|
5352
|
+
return createPortal(
|
|
5353
|
+
/* @__PURE__ */ jsxs(
|
|
5354
|
+
"div",
|
|
5355
|
+
{
|
|
5356
|
+
className: "ra-shell ra-confirm-root",
|
|
5357
|
+
role: "presentation",
|
|
5358
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
5359
|
+
onClick: (e) => e.stopPropagation(),
|
|
5360
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
5361
|
+
children: [
|
|
5362
|
+
/* @__PURE__ */ jsx("div", { className: "ra-confirm-backdrop", onClick: onClose }),
|
|
5363
|
+
/* @__PURE__ */ jsxs(
|
|
5364
|
+
"div",
|
|
5365
|
+
{
|
|
5366
|
+
role: "dialog",
|
|
5367
|
+
"aria-modal": "true",
|
|
5368
|
+
"aria-label": i18n?.searchProducts ?? "Search products",
|
|
5369
|
+
className: "ra-confirm-card",
|
|
5370
|
+
style: { width: "min(520px, 100%)", padding: "1rem" },
|
|
5371
|
+
children: [
|
|
5372
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
5373
|
+
/* @__PURE__ */ jsx(Search, { className: "w-4 h-4 opacity-60" }),
|
|
5374
|
+
/* @__PURE__ */ jsx(
|
|
5375
|
+
"input",
|
|
5376
|
+
{
|
|
5377
|
+
ref: inputRef,
|
|
5378
|
+
type: "text",
|
|
5379
|
+
value: search,
|
|
5380
|
+
onChange: (e) => setSearch(e.target.value),
|
|
5381
|
+
placeholder: i18n?.searchProducts ?? "Search products\u2026",
|
|
5382
|
+
className: "flex-1 text-sm px-2 py-1.5 rounded-md border bg-transparent focus:outline-none focus:ring-1",
|
|
5383
|
+
style: {
|
|
5384
|
+
borderColor: "hsl(var(--ra-border))",
|
|
5385
|
+
color: "hsl(var(--ra-text))"
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
5388
|
+
),
|
|
5389
|
+
/* @__PURE__ */ jsx(
|
|
5390
|
+
"button",
|
|
5391
|
+
{
|
|
5392
|
+
type: "button",
|
|
5393
|
+
onClick: onClose,
|
|
5394
|
+
className: "p-1 rounded-md hover:bg-[hsl(var(--ra-muted))]",
|
|
5395
|
+
"aria-label": i18n?.close ?? "Close",
|
|
5396
|
+
style: { color: "hsl(var(--ra-muted-text))" },
|
|
5397
|
+
children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
|
|
5398
|
+
}
|
|
5399
|
+
)
|
|
5400
|
+
] }),
|
|
5401
|
+
/* @__PURE__ */ jsxs(
|
|
5402
|
+
"div",
|
|
5403
|
+
{
|
|
5404
|
+
className: "overflow-y-auto rounded-md border",
|
|
5405
|
+
style: {
|
|
5406
|
+
maxHeight: "50vh",
|
|
5407
|
+
borderColor: "hsl(var(--ra-border))"
|
|
5408
|
+
},
|
|
5409
|
+
children: [
|
|
5410
|
+
browse.isLoading && browse.items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-xs px-3 py-4 text-center", style: { color: "hsl(var(--ra-muted-text))" }, children: "Loading\u2026" }) : browse.items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-xs px-3 py-4 text-center", style: { color: "hsl(var(--ra-muted-text))" }, children: "No products match." }) : /* @__PURE__ */ jsx("ul", { className: "divide-y", style: { borderColor: "hsl(var(--ra-border))" }, children: browse.items.map((p) => {
|
|
5411
|
+
const active = p.id === currentProductId;
|
|
5412
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
5413
|
+
"button",
|
|
5414
|
+
{
|
|
5415
|
+
type: "button",
|
|
5416
|
+
onClick: () => onPick(p.id),
|
|
5417
|
+
className: "w-full text-left px-3 py-2 text-sm hover:bg-[hsl(var(--ra-muted))] flex items-center justify-between gap-3",
|
|
5418
|
+
style: {
|
|
5419
|
+
color: "hsl(var(--ra-text))",
|
|
5420
|
+
background: active ? "hsl(var(--ra-muted))" : "transparent"
|
|
5421
|
+
},
|
|
5422
|
+
children: [
|
|
5423
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-col min-w-0", children: [
|
|
5424
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: p.name }),
|
|
5425
|
+
p.sku ? /* @__PURE__ */ jsx("span", { className: "truncate text-[11px]", style: { color: "hsl(var(--ra-muted-text))" }, children: p.sku }) : null
|
|
5426
|
+
] }),
|
|
5427
|
+
active ? /* @__PURE__ */ jsx("span", { className: "text-[10px] uppercase tracking-wide", style: { color: "hsl(var(--ra-muted-text))" }, children: "current" }) : null
|
|
5428
|
+
]
|
|
5429
|
+
}
|
|
5430
|
+
) }, p.id);
|
|
5431
|
+
}) }),
|
|
5432
|
+
browse.hasNextPage && /* @__PURE__ */ jsx("div", { className: "px-3 py-2 border-t", style: { borderColor: "hsl(var(--ra-border))" }, children: /* @__PURE__ */ jsx(
|
|
5433
|
+
"button",
|
|
5434
|
+
{
|
|
5435
|
+
type: "button",
|
|
5436
|
+
onClick: () => browse.fetchNextPage(),
|
|
5437
|
+
disabled: browse.isFetchingNextPage,
|
|
5438
|
+
className: "text-xs w-full py-1 rounded-md border hover:bg-[hsl(var(--ra-muted))]",
|
|
5439
|
+
style: {
|
|
5440
|
+
borderColor: "hsl(var(--ra-border))",
|
|
5441
|
+
color: "hsl(var(--ra-text))"
|
|
5442
|
+
},
|
|
5443
|
+
children: browse.isFetchingNextPage ? "Loading\u2026" : "Load more"
|
|
5444
|
+
}
|
|
5445
|
+
) })
|
|
5446
|
+
]
|
|
5447
|
+
}
|
|
5448
|
+
)
|
|
5449
|
+
]
|
|
5450
|
+
}
|
|
5451
|
+
)
|
|
5452
|
+
]
|
|
5453
|
+
}
|
|
5454
|
+
),
|
|
5455
|
+
document.body
|
|
5456
|
+
);
|
|
5457
|
+
};
|
|
5259
5458
|
var ICONS2 = {
|
|
5260
5459
|
table: Table,
|
|
5261
5460
|
cards: LayoutGrid,
|
|
@@ -7010,6 +7209,18 @@ function RecordsAdminShellInner(props) {
|
|
|
7010
7209
|
const i18n = { ...DEFAULT_I18N, ...i18nOverride ?? {} };
|
|
7011
7210
|
const icons = useMemo(() => mergeIcons(iconsOverride), [iconsOverride]);
|
|
7012
7211
|
const deepLinkState = useDeepLinkState(deepLink);
|
|
7212
|
+
const deepLinkLoggedRef = useRef(false);
|
|
7213
|
+
if (!deepLinkLoggedRef.current) {
|
|
7214
|
+
deepLinkLoggedRef.current = true;
|
|
7215
|
+
console.debug("[RecordsAdminShell] deep-link config", {
|
|
7216
|
+
enabled: deepLinkState.enabled,
|
|
7217
|
+
hostPassedOption: !!deepLink,
|
|
7218
|
+
// Resolved adapter mode: 'host' = host-supplied, 'default' = built-in
|
|
7219
|
+
// (window.location standalone, postMessage inside the SmartLinks iframe).
|
|
7220
|
+
adapterMode: deepLink?.adapter ? "host" : "default",
|
|
7221
|
+
paramNames: deepLinkState.paramNames
|
|
7222
|
+
});
|
|
7223
|
+
}
|
|
7013
7224
|
const multiOpenWarnedRef = useRef(false);
|
|
7014
7225
|
if (editorTabs === "multi" && !multiOpenWarnedRef.current) {
|
|
7015
7226
|
multiOpenWarnedRef.current = true;
|
|
@@ -7240,7 +7451,18 @@ function RecordsAdminShellInner(props) {
|
|
|
7240
7451
|
setSelectedVariantId,
|
|
7241
7452
|
selectedBatchId,
|
|
7242
7453
|
setSelectedBatchId,
|
|
7243
|
-
setFacetBrowseFilter
|
|
7454
|
+
setFacetBrowseFilter,
|
|
7455
|
+
// Pending-recordId resolution — without these the URL's `recordId` is
|
|
7456
|
+
// parsed but never opens the editor on refresh / share-link load.
|
|
7457
|
+
isCollection,
|
|
7458
|
+
setSelectedItemId,
|
|
7459
|
+
collectionItems: {
|
|
7460
|
+
items: collectionItems.items,
|
|
7461
|
+
isLoading: collectionItems.isLoading
|
|
7462
|
+
},
|
|
7463
|
+
recordListItems: recordList.items,
|
|
7464
|
+
recordListLoading: recordList.isLoading,
|
|
7465
|
+
skipNextItemResetRef
|
|
7244
7466
|
});
|
|
7245
7467
|
const supportedForResolution = useMemo(() => requestedScopes, [requestedScopes]);
|
|
7246
7468
|
const resolved = useResolvedRecord({
|
|
@@ -7487,6 +7709,7 @@ function RecordsAdminShellInner(props) {
|
|
|
7487
7709
|
onChange: setPreviewScope,
|
|
7488
7710
|
showVariants: drillVariantsAllowed,
|
|
7489
7711
|
showBatches: drillBatchesAllowed,
|
|
7712
|
+
activeScope,
|
|
7490
7713
|
i18n: { previewAs: i18n.previewAs, previewAsDefault: i18n.previewAsDefault }
|
|
7491
7714
|
}
|
|
7492
7715
|
) : null;
|
|
@@ -9220,6 +9443,9 @@ function useMergedRecord(args) {
|
|
|
9220
9443
|
};
|
|
9221
9444
|
}
|
|
9222
9445
|
|
|
9446
|
+
// src/components/RecordsAdmin/index.ts
|
|
9447
|
+
assertComponentStylesLoaded("records-admin");
|
|
9448
|
+
|
|
9223
9449
|
export { ALL_ITEM_VIEWS, ALL_PRESENTATIONS, BatchList, BulkActionsMenu, DEFAULT_DEEP_LINK_PARAM_NAMES, DEFAULT_I18N, DEFAULT_ICONS, DefaultItemCards, DefaultItemTable, DefaultRecordCard, DefaultRecordRow, DeleteButton, DirtyDraftProvider, DrawerPreview, EditorItemNav, EmptyState, ErrorState, FacetList, InheritanceMarker, InheritanceProvider, InlinePreview, IntroCard, ItemListView, ItemViewSwitcher, LoadingState, PresentationSwitcher, PreviewScopePicker, PreviewToggleButton, ProductDrillDown, ProductList, RecordBrowser, RecordEditor, RecordList, RecordsAdminShell, ResolvedPreview, ScopeBreadcrumb, ScopeTabs, SiblingRail, SidePreview, StatusDot, StatusFilterPills, StatusIcon, TabbedPreview, UtilityRow, VariantList, buildDraftKey, buildRef, checkPasteCompatibility, cloneValue, createDefaultDeepLinkAdapter, createPostMessageDeepLinkAdapter, downloadBlob, exportCsv, importCsv, isInSmartLinksIframe, mergeIcons, normaliseRule, parseRef, pickHeaderIcon, resolutionChain, resolveRecord, ruleHash, rulesEqual, scopeCountsQueryKey, statusToneLabel, summariseRule, useCollectedRecords, useCollectionItems, useDeepLinkState, useDirtyDraft, useDirtyDraftActions, useDirtyDraftStore, useDirtyDrafts, useDirtyNavigation, useFacetBrowse, useIntroDismissed, useItemViewPref, useMergedRecord, usePresentationPref, useProductBrowse, useProductChildren, useRecordClipboard, useRecordEditor, useRecordList, useResolveAllRecords, useResolvedRecord, useRulePreview, useScopeCounts, useScopeProbe, useUnsavedGuard };
|
|
9224
9450
|
//# sourceMappingURL=index.js.map
|
|
9225
9451
|
//# sourceMappingURL=index.js.map
|