@proveanything/smartlinks-utils-ui 0.11.8 → 0.11.9
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.
|
@@ -2938,9 +2938,10 @@ function useEditorBridge(args) {
|
|
|
2938
2938
|
if (isEqualSpec(target, lastTargetRef.current)) return;
|
|
2939
2939
|
lastTargetRef.current = target;
|
|
2940
2940
|
const isCreate = !!target.createMode;
|
|
2941
|
+
const prefersExplicitInitialData = !target?.createMode && !target?.recordId && target?.initialData !== void 0;
|
|
2941
2942
|
const id = selection.selectTarget({
|
|
2942
2943
|
spec: target,
|
|
2943
|
-
seed: isCreate || resolved.source === "empty" ? void 0 : {
|
|
2944
|
+
seed: isCreate || prefersExplicitInitialData || resolved.source === "empty" ? void 0 : {
|
|
2944
2945
|
value: resolved.data ?? (defaultData?.() ?? null),
|
|
2945
2946
|
facetRule: resolved.facetRule ?? null,
|
|
2946
2947
|
source: resolved.source,
|
|
@@ -2956,6 +2957,7 @@ function useEditorBridge(args) {
|
|
|
2956
2957
|
if (!id) return;
|
|
2957
2958
|
if (resolved.source === "empty" && !resolved.recordId) return;
|
|
2958
2959
|
if (target?.createMode) return;
|
|
2960
|
+
if (!target?.recordId && target?.initialData !== void 0) return;
|
|
2959
2961
|
selection.hydrate(id, resolved);
|
|
2960
2962
|
}, [resolved.source, resolved.recordId, resolved.sourceRef, resolved.data, resolved.facetRule, target?.createMode]);
|
|
2961
2963
|
const editorId = selection.currentEditorId ?? editorIdRef.current;
|
|
@@ -3036,6 +3038,7 @@ function useShellEditorTarget(args) {
|
|
|
3036
3038
|
ruleWizardStep,
|
|
3037
3039
|
ruleWizardDraftKey,
|
|
3038
3040
|
ruleWizardInitialData,
|
|
3041
|
+
explicitSingletonInitialData,
|
|
3039
3042
|
ruleWizardRule,
|
|
3040
3043
|
resolved,
|
|
3041
3044
|
defaultData,
|
|
@@ -3049,7 +3052,8 @@ function useShellEditorTarget(args) {
|
|
|
3049
3052
|
const label = deriveDraftLabel ? deriveDraftLabel(resolved.data, editingTargetScope) : void 0;
|
|
3050
3053
|
const rawScope = editingTargetScope.raw ?? "";
|
|
3051
3054
|
const isDraftScope = rawScope.includes("__draft__") || rawScope.includes("item:draft:");
|
|
3052
|
-
const
|
|
3055
|
+
const explicitSingletonDraft = !isCollection && activeScope === "product" && draftKind !== null;
|
|
3056
|
+
const draftKey = isDraftScope ? isCollection && selectedItemId && isDraftId2(selectedItemId) ? `item:${selectedItemId}` : ruleWizardDraftKey ?? `${activeScope}:${draftKind ?? "wizard"}` : explicitSingletonDraft ? `singleton:${editingTargetScope.raw}:${draftKind}` : void 0;
|
|
3053
3057
|
const itemDraftCreate = isCollection && !!selectedItemId && isDraftId2(selectedItemId);
|
|
3054
3058
|
const createMode = itemDraftCreate || isDraftScope || isCollection && !!selectedItemId && !resolved.recordId;
|
|
3055
3059
|
return {
|
|
@@ -3058,7 +3062,7 @@ function useShellEditorTarget(args) {
|
|
|
3058
3062
|
// otherwise the store's findExistingEditorIdFor would match the rule's
|
|
3059
3063
|
// editor, focus it instead of minting a new draft, and the next save
|
|
3060
3064
|
// would update the rule record in place.
|
|
3061
|
-
recordId: createMode ? void 0 : resolved.recordId,
|
|
3065
|
+
recordId: createMode || explicitSingletonDraft ? void 0 : resolved.recordId,
|
|
3062
3066
|
createMode,
|
|
3063
3067
|
// We deliberately do NOT propagate `editingTargetScope.raw` (e.g.
|
|
3064
3068
|
// `rule:<ulid>`) into `spec.ref`. `record.ref` is a host-owned
|
|
@@ -3072,7 +3076,7 @@ function useShellEditorTarget(args) {
|
|
|
3072
3076
|
label,
|
|
3073
3077
|
draftKey,
|
|
3074
3078
|
isDraftScope,
|
|
3075
|
-
initialData: createMode ? ruleWizardInitialData : void 0
|
|
3079
|
+
initialData: createMode ? ruleWizardInitialData : explicitSingletonInitialData ?? void 0
|
|
3076
3080
|
};
|
|
3077
3081
|
}, [
|
|
3078
3082
|
editingTargetScope?.raw,
|
|
@@ -3086,6 +3090,7 @@ function useShellEditorTarget(args) {
|
|
|
3086
3090
|
ruleWizardStep,
|
|
3087
3091
|
ruleWizardDraftKey,
|
|
3088
3092
|
ruleWizardInitialData,
|
|
3093
|
+
explicitSingletonInitialData,
|
|
3089
3094
|
ruleWizardRule
|
|
3090
3095
|
]);
|
|
3091
3096
|
const editorCtx = useEditorBridge({
|
|
@@ -6658,18 +6663,12 @@ function NewRuleWizard({
|
|
|
6658
6663
|
onCancel,
|
|
6659
6664
|
onNext,
|
|
6660
6665
|
onBack,
|
|
6661
|
-
canChooseSeed = false,
|
|
6662
|
-
seedMode = null,
|
|
6663
|
-
onSeedModeChange,
|
|
6664
|
-
pasteSourceLabel,
|
|
6665
6666
|
facets,
|
|
6666
6667
|
children,
|
|
6667
|
-
itemNoun = "record"
|
|
6668
|
-
seedPromptMode = "inline"
|
|
6668
|
+
itemNoun = "record"
|
|
6669
6669
|
}) {
|
|
6670
6670
|
const preview = useRulePreview({ SL, collectionId, appId, rule });
|
|
6671
6671
|
const canProceed = isFacetRuleValid(rule);
|
|
6672
|
-
const showSeedPicker = (canChooseSeed || pasteSourceLabel) && seedPromptMode === "inline";
|
|
6673
6672
|
if (step === 1) {
|
|
6674
6673
|
return /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
6675
6674
|
/* @__PURE__ */ jsx(
|
|
@@ -6682,68 +6681,17 @@ function NewRuleWizard({
|
|
|
6682
6681
|
onCancel
|
|
6683
6682
|
}
|
|
6684
6683
|
),
|
|
6685
|
-
/* @__PURE__ */
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
),
|
|
6697
|
-
showSeedPicker && /* @__PURE__ */ jsxs(
|
|
6698
|
-
"div",
|
|
6699
|
-
{
|
|
6700
|
-
className: "mt-4 rounded-lg border p-3",
|
|
6701
|
-
style: {
|
|
6702
|
-
borderColor: "hsl(var(--ra-border))",
|
|
6703
|
-
background: "hsl(var(--ra-surface))"
|
|
6704
|
-
},
|
|
6705
|
-
children: [
|
|
6706
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
6707
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", style: { color: "hsl(var(--ra-text))" }, children: "Start from" }),
|
|
6708
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs", style: { color: "hsl(var(--ra-muted-text))" }, children: "Choose whether the new rule starts empty, copies the current global record, or pastes from your clipboard." })
|
|
6709
|
-
] }),
|
|
6710
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
6711
|
-
/* @__PURE__ */ jsx(
|
|
6712
|
-
"button",
|
|
6713
|
-
{
|
|
6714
|
-
type: "button",
|
|
6715
|
-
className: "ra-btn",
|
|
6716
|
-
"data-variant": seedMode === "blank" || seedMode == null ? "primary" : "ghost",
|
|
6717
|
-
onClick: () => onSeedModeChange?.("blank"),
|
|
6718
|
-
children: "Start blank"
|
|
6719
|
-
}
|
|
6720
|
-
),
|
|
6721
|
-
canChooseSeed && /* @__PURE__ */ jsx(
|
|
6722
|
-
"button",
|
|
6723
|
-
{
|
|
6724
|
-
type: "button",
|
|
6725
|
-
className: "ra-btn",
|
|
6726
|
-
"data-variant": seedMode === "global" ? "primary" : "ghost",
|
|
6727
|
-
onClick: () => onSeedModeChange?.("global"),
|
|
6728
|
-
children: "Copy from global"
|
|
6729
|
-
}
|
|
6730
|
-
),
|
|
6731
|
-
pasteSourceLabel && /* @__PURE__ */ jsx(
|
|
6732
|
-
"button",
|
|
6733
|
-
{
|
|
6734
|
-
type: "button",
|
|
6735
|
-
className: "ra-btn",
|
|
6736
|
-
"data-variant": seedMode === "paste" ? "primary" : "ghost",
|
|
6737
|
-
onClick: () => onSeedModeChange?.("paste"),
|
|
6738
|
-
title: `Paste from ${pasteSourceLabel}`,
|
|
6739
|
-
children: "Paste from clipboard"
|
|
6740
|
-
}
|
|
6741
|
-
)
|
|
6742
|
-
] })
|
|
6743
|
-
]
|
|
6744
|
-
}
|
|
6745
|
-
)
|
|
6746
|
-
] }),
|
|
6684
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-auto px-5 py-4", children: /* @__PURE__ */ jsx(
|
|
6685
|
+
FacetRuleEditor,
|
|
6686
|
+
{
|
|
6687
|
+
value: rule,
|
|
6688
|
+
onChange: onRuleChange,
|
|
6689
|
+
facets,
|
|
6690
|
+
collectionId,
|
|
6691
|
+
preview,
|
|
6692
|
+
description: "The new rule will apply to every product whose facets match every clause below."
|
|
6693
|
+
}
|
|
6694
|
+
) }),
|
|
6747
6695
|
/* @__PURE__ */ jsx(
|
|
6748
6696
|
WizardFooter,
|
|
6749
6697
|
{
|
|
@@ -6899,6 +6847,78 @@ function WizardFooter({
|
|
|
6899
6847
|
}
|
|
6900
6848
|
);
|
|
6901
6849
|
}
|
|
6850
|
+
function CreateRecordChooser({
|
|
6851
|
+
title,
|
|
6852
|
+
body,
|
|
6853
|
+
primaryLabel,
|
|
6854
|
+
onPrimary,
|
|
6855
|
+
secondaryLabel,
|
|
6856
|
+
onSecondary,
|
|
6857
|
+
tertiaryLabel,
|
|
6858
|
+
onTertiary
|
|
6859
|
+
}) {
|
|
6860
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center px-6 py-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-xl w-full text-center space-y-4", children: [
|
|
6861
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
6862
|
+
/* @__PURE__ */ jsx(
|
|
6863
|
+
"h3",
|
|
6864
|
+
{
|
|
6865
|
+
className: "text-base font-semibold m-0",
|
|
6866
|
+
style: { color: "hsl(var(--ra-text))" },
|
|
6867
|
+
children: title
|
|
6868
|
+
}
|
|
6869
|
+
),
|
|
6870
|
+
/* @__PURE__ */ jsx(
|
|
6871
|
+
"p",
|
|
6872
|
+
{
|
|
6873
|
+
className: "text-sm m-0",
|
|
6874
|
+
style: { color: "hsl(var(--ra-muted-text))" },
|
|
6875
|
+
children: body
|
|
6876
|
+
}
|
|
6877
|
+
)
|
|
6878
|
+
] }),
|
|
6879
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
6880
|
+
/* @__PURE__ */ jsxs(
|
|
6881
|
+
"button",
|
|
6882
|
+
{
|
|
6883
|
+
type: "button",
|
|
6884
|
+
onClick: onPrimary,
|
|
6885
|
+
className: "ra-btn",
|
|
6886
|
+
"data-variant": "primary",
|
|
6887
|
+
children: [
|
|
6888
|
+
/* @__PURE__ */ jsx(FilePlus2, { "aria-hidden": "true", className: "w-4 h-4" }),
|
|
6889
|
+
/* @__PURE__ */ jsx("span", { children: primaryLabel })
|
|
6890
|
+
]
|
|
6891
|
+
}
|
|
6892
|
+
),
|
|
6893
|
+
secondaryLabel && onSecondary && /* @__PURE__ */ jsxs(
|
|
6894
|
+
"button",
|
|
6895
|
+
{
|
|
6896
|
+
type: "button",
|
|
6897
|
+
onClick: onSecondary,
|
|
6898
|
+
className: "ra-btn",
|
|
6899
|
+
"data-variant": "ghost",
|
|
6900
|
+
children: [
|
|
6901
|
+
/* @__PURE__ */ jsx(Copy, { "aria-hidden": "true", className: "w-4 h-4" }),
|
|
6902
|
+
/* @__PURE__ */ jsx("span", { children: secondaryLabel })
|
|
6903
|
+
]
|
|
6904
|
+
}
|
|
6905
|
+
),
|
|
6906
|
+
tertiaryLabel && onTertiary && /* @__PURE__ */ jsxs(
|
|
6907
|
+
"button",
|
|
6908
|
+
{
|
|
6909
|
+
type: "button",
|
|
6910
|
+
onClick: onTertiary,
|
|
6911
|
+
className: "ra-btn",
|
|
6912
|
+
"data-variant": "ghost",
|
|
6913
|
+
children: [
|
|
6914
|
+
/* @__PURE__ */ jsx(Copy, { "aria-hidden": "true", className: "w-4 h-4" }),
|
|
6915
|
+
/* @__PURE__ */ jsx("span", { children: tertiaryLabel })
|
|
6916
|
+
]
|
|
6917
|
+
}
|
|
6918
|
+
)
|
|
6919
|
+
] })
|
|
6920
|
+
] }) });
|
|
6921
|
+
}
|
|
6902
6922
|
var RuleGroupEditDialog = ({
|
|
6903
6923
|
open,
|
|
6904
6924
|
ctx,
|
|
@@ -8267,6 +8287,33 @@ function RecordsAdminShellInner(props) {
|
|
|
8267
8287
|
}
|
|
8268
8288
|
return void 0;
|
|
8269
8289
|
}, [ruleWizardSeedMode, globalSourceRecord, directGlobalSeedData, resolvedGlobalSeed.data, onCopyOverride, defaultData, wizardClipboard.entry]);
|
|
8290
|
+
const explicitSingletonInitialData = useMemo(() => {
|
|
8291
|
+
if (isCollection || activeScope !== "product" || selectedRecordId !== DRAFT_ID3) return void 0;
|
|
8292
|
+
if (draftKind === "global") {
|
|
8293
|
+
const globalSeedSource = globalSourceRecord?.data ?? directGlobalSeedData ?? resolvedGlobalSeed.data;
|
|
8294
|
+
if (!globalSeedSource) return defaultData?.();
|
|
8295
|
+
const globalSeedScope = globalSourceRecord?.scope ?? parseRef("");
|
|
8296
|
+
if (onCopyOverride) {
|
|
8297
|
+
return onCopyOverride({ value: globalSeedSource, scope: globalSeedScope });
|
|
8298
|
+
}
|
|
8299
|
+
try {
|
|
8300
|
+
return structuredClone(globalSeedSource);
|
|
8301
|
+
} catch {
|
|
8302
|
+
return JSON.parse(JSON.stringify(globalSeedSource));
|
|
8303
|
+
}
|
|
8304
|
+
}
|
|
8305
|
+
return defaultData?.() ?? {};
|
|
8306
|
+
}, [
|
|
8307
|
+
isCollection,
|
|
8308
|
+
activeScope,
|
|
8309
|
+
selectedRecordId,
|
|
8310
|
+
draftKind,
|
|
8311
|
+
globalSourceRecord,
|
|
8312
|
+
directGlobalSeedData,
|
|
8313
|
+
resolvedGlobalSeed.data,
|
|
8314
|
+
onCopyOverride,
|
|
8315
|
+
defaultData
|
|
8316
|
+
]);
|
|
8270
8317
|
const refetchAll = useCallback(async () => {
|
|
8271
8318
|
await Promise.all([
|
|
8272
8319
|
recordList.refetch(),
|
|
@@ -8285,6 +8332,7 @@ function RecordsAdminShellInner(props) {
|
|
|
8285
8332
|
ruleWizardStep,
|
|
8286
8333
|
ruleWizardDraftKey,
|
|
8287
8334
|
ruleWizardInitialData,
|
|
8335
|
+
explicitSingletonInitialData,
|
|
8288
8336
|
ruleWizardRule,
|
|
8289
8337
|
resolved: {
|
|
8290
8338
|
data: resolved.data,
|
|
@@ -8467,7 +8515,7 @@ function RecordsAdminShellInner(props) {
|
|
|
8467
8515
|
onLeftSelectRef,
|
|
8468
8516
|
onCreateItemDraftRef,
|
|
8469
8517
|
onCreateRuleFromClipboardRef,
|
|
8470
|
-
isRuleTab: activeScope === "rule"
|
|
8518
|
+
isRuleTab: activeScope === "rule" || activeScope === "collection"
|
|
8471
8519
|
});
|
|
8472
8520
|
const editorClipboard = shellClipboard.editorClipboard;
|
|
8473
8521
|
const rowClipboard = shellClipboard.rowClipboard;
|
|
@@ -8837,7 +8885,7 @@ function RecordsAdminShellInner(props) {
|
|
|
8837
8885
|
setSelectedRecordId(null);
|
|
8838
8886
|
setSelectedItemId(null);
|
|
8839
8887
|
setDraftKind("rule");
|
|
8840
|
-
setRuleWizardSeedMode(seed ??
|
|
8888
|
+
setRuleWizardSeedMode(seed ?? null);
|
|
8841
8889
|
setRuleWizardDraftKey(null);
|
|
8842
8890
|
setRuleWizardRule({ all: [] });
|
|
8843
8891
|
setRuleWizardStep(1);
|
|
@@ -8857,19 +8905,20 @@ function RecordsAdminShellInner(props) {
|
|
|
8857
8905
|
setRuleWizardStep(2);
|
|
8858
8906
|
} else {
|
|
8859
8907
|
setRuleWizardStep(2);
|
|
8860
|
-
if (ruleWizardSeedMode == null) {
|
|
8861
|
-
setRuleWizardSeedMode(singletonGlobalSeedAvailable ? "global" : "blank");
|
|
8862
|
-
}
|
|
8863
|
-
setRuleWizardDraftKey(mintRuleWizardDraftKey());
|
|
8864
|
-
setSelectedRecordId(DRAFT_ID3);
|
|
8865
8908
|
}
|
|
8866
|
-
}, [cardinality
|
|
8909
|
+
}, [cardinality]);
|
|
8910
|
+
const startRuleWizardDraft = useCallback((seed) => {
|
|
8911
|
+
setRuleWizardSeedMode(seed);
|
|
8912
|
+
setRuleWizardDraftKey(mintRuleWizardDraftKey());
|
|
8913
|
+
setSelectedRecordId(DRAFT_ID3);
|
|
8914
|
+
}, [mintRuleWizardDraftKey]);
|
|
8867
8915
|
const onRuleWizardBack = useCallback(() => {
|
|
8868
8916
|
setRuleWizardStep(1);
|
|
8869
8917
|
setRuleWizardDraftKey(null);
|
|
8918
|
+
setRuleWizardSeedMode(null);
|
|
8870
8919
|
setSelectedRecordId(null);
|
|
8871
8920
|
setSelectedItemId(null);
|
|
8872
|
-
}, [setRuleWizardDraftKey]);
|
|
8921
|
+
}, [setRuleWizardDraftKey, setRuleWizardSeedMode]);
|
|
8873
8922
|
const onRuleWizardCreateItem = useCallback(() => {
|
|
8874
8923
|
if (!isCollection) return;
|
|
8875
8924
|
const id = coerceDraftItemId2(generateItemId);
|
|
@@ -8887,6 +8936,13 @@ function RecordsAdminShellInner(props) {
|
|
|
8887
8936
|
setDraftKind("global");
|
|
8888
8937
|
});
|
|
8889
8938
|
}, [runWithGuard, activeScope]);
|
|
8939
|
+
const onCreateProductRecord = useCallback((seed) => {
|
|
8940
|
+
void runWithGuard(() => {
|
|
8941
|
+
if (activeScope !== "product") setActiveScope("product");
|
|
8942
|
+
setSelectedRecordId(DRAFT_ID3);
|
|
8943
|
+
setDraftKind(seed === "global" ? "global" : "item");
|
|
8944
|
+
});
|
|
8945
|
+
}, [runWithGuard, activeScope]);
|
|
8890
8946
|
const filteredRuleItems = useMemo(
|
|
8891
8947
|
() => isRuleTab ? applyRuleFilters(recordList.items, ruleFilters) : recordList.items,
|
|
8892
8948
|
[isRuleTab, recordList.items, ruleFilters]
|
|
@@ -9473,72 +9529,23 @@ function RecordsAdminShellInner(props) {
|
|
|
9473
9529
|
onCancel: onCancelRuleWizard,
|
|
9474
9530
|
onNext: onRuleWizardNext,
|
|
9475
9531
|
onBack: onRuleWizardBack,
|
|
9476
|
-
canChooseSeed: !isCollection && singletonGlobalSeedAvailable,
|
|
9477
|
-
seedMode: ruleWizardSeedMode,
|
|
9478
|
-
onSeedModeChange: setRuleWizardSeedMode,
|
|
9479
|
-
pasteSourceLabel: wizardClipboard.entry?.sourceLabel ?? (wizardClipboard.entry ? "clipboard" : void 0),
|
|
9480
9532
|
facets: ruleWizardFacets,
|
|
9481
9533
|
itemNoun,
|
|
9482
|
-
seedPromptMode: !isCollection ? "after-next" : "inline",
|
|
9483
9534
|
children: [
|
|
9484
|
-
ruleWizardStep === 2 && !isCollection && /* @__PURE__ */
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
{
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
{
|
|
9499
|
-
type: "button",
|
|
9500
|
-
className: "ra-btn",
|
|
9501
|
-
"data-variant": ruleWizardSeedMode === "blank" || ruleWizardSeedMode == null ? "primary" : "ghost",
|
|
9502
|
-
onClick: () => {
|
|
9503
|
-
setRuleWizardSeedMode("blank");
|
|
9504
|
-
setRuleWizardDraftKey(mintRuleWizardDraftKey());
|
|
9505
|
-
},
|
|
9506
|
-
children: "Start blank"
|
|
9507
|
-
}
|
|
9508
|
-
),
|
|
9509
|
-
singletonGlobalSeedAvailable && /* @__PURE__ */ jsx(
|
|
9510
|
-
"button",
|
|
9511
|
-
{
|
|
9512
|
-
type: "button",
|
|
9513
|
-
className: "ra-btn",
|
|
9514
|
-
"data-variant": ruleWizardSeedMode === "global" ? "primary" : "ghost",
|
|
9515
|
-
onClick: () => {
|
|
9516
|
-
setRuleWizardSeedMode("global");
|
|
9517
|
-
setRuleWizardDraftKey(mintRuleWizardDraftKey());
|
|
9518
|
-
},
|
|
9519
|
-
children: "Copy from global"
|
|
9520
|
-
}
|
|
9521
|
-
),
|
|
9522
|
-
wizardClipboard.entry && /* @__PURE__ */ jsx(
|
|
9523
|
-
"button",
|
|
9524
|
-
{
|
|
9525
|
-
type: "button",
|
|
9526
|
-
className: "ra-btn",
|
|
9527
|
-
"data-variant": ruleWizardSeedMode === "paste" ? "primary" : "ghost",
|
|
9528
|
-
onClick: () => {
|
|
9529
|
-
setRuleWizardSeedMode("paste");
|
|
9530
|
-
setRuleWizardDraftKey(mintRuleWizardDraftKey());
|
|
9531
|
-
},
|
|
9532
|
-
title: wizardClipboard.entry.sourceLabel ? `Paste from ${wizardClipboard.entry.sourceLabel}` : "Paste from clipboard",
|
|
9533
|
-
children: "Paste from clipboard"
|
|
9534
|
-
}
|
|
9535
|
-
)
|
|
9536
|
-
] })
|
|
9537
|
-
]
|
|
9538
|
-
}
|
|
9539
|
-
),
|
|
9540
|
-
/* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: editingTargetScope && renderEditorWithPreview() })
|
|
9541
|
-
] }),
|
|
9535
|
+
ruleWizardStep === 2 && !isCollection && !editingTargetScope && /* @__PURE__ */ jsx(
|
|
9536
|
+
CreateRecordChooser,
|
|
9537
|
+
{
|
|
9538
|
+
title: `Create your first ${itemNoun} for this rule`,
|
|
9539
|
+
body: `The rule is set. Now choose how to create the first ${itemNoun} that should apply to every matching product.`,
|
|
9540
|
+
primaryLabel: "Start blank",
|
|
9541
|
+
onPrimary: () => startRuleWizardDraft("blank"),
|
|
9542
|
+
secondaryLabel: singletonGlobalSeedAvailable ? "Copy from global" : void 0,
|
|
9543
|
+
onSecondary: singletonGlobalSeedAvailable ? () => startRuleWizardDraft("global") : void 0,
|
|
9544
|
+
tertiaryLabel: wizardClipboard.entry ? "Paste from clipboard" : void 0,
|
|
9545
|
+
onTertiary: wizardClipboard.entry ? () => startRuleWizardDraft("paste") : void 0
|
|
9546
|
+
}
|
|
9547
|
+
),
|
|
9548
|
+
ruleWizardStep === 2 && !isCollection && !!editingTargetScope && renderEditorWithPreview(),
|
|
9542
9549
|
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: [
|
|
9543
9550
|
/* @__PURE__ */ jsxs(
|
|
9544
9551
|
"h3",
|
|
@@ -9653,6 +9660,17 @@ function RecordsAdminShellInner(props) {
|
|
|
9653
9660
|
)
|
|
9654
9661
|
}
|
|
9655
9662
|
),
|
|
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,
|
|
9656
9674
|
ruleWizardStep === null && !isProductTab && editingTargetScope && (!isCollection || selectedItemId) && renderEditorWithPreview()
|
|
9657
9675
|
] })
|
|
9658
9676
|
]
|