@streamoid/catalogix-chat 0.2.4 → 0.2.6
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/index.d.ts +1 -1
- package/dist/index.js +392 -540
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2435,7 +2435,7 @@ function CreateStore({
|
|
|
2435
2435
|
}
|
|
2436
2436
|
|
|
2437
2437
|
// src/MapAttributes/index.tsx
|
|
2438
|
-
import
|
|
2438
|
+
import { useState as useState7, useMemo as useMemo5, useCallback as useCallback5 } from "react";
|
|
2439
2439
|
import {
|
|
2440
2440
|
Check as Check2,
|
|
2441
2441
|
X,
|
|
@@ -2443,81 +2443,17 @@ import {
|
|
|
2443
2443
|
Pencil as Pencil2,
|
|
2444
2444
|
Search as Search3,
|
|
2445
2445
|
ArrowRight,
|
|
2446
|
-
ArrowLeft as ArrowLeft2
|
|
2446
|
+
ArrowLeft as ArrowLeft2,
|
|
2447
|
+
Send
|
|
2447
2448
|
} from "lucide-react";
|
|
2448
|
-
|
|
2449
|
-
// src/ui/scroll-area.tsx
|
|
2450
|
-
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
2451
2449
|
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2452
|
-
function ScrollArea({
|
|
2453
|
-
className,
|
|
2454
|
-
children,
|
|
2455
|
-
...props
|
|
2456
|
-
}) {
|
|
2457
|
-
return /* @__PURE__ */ jsxs10(
|
|
2458
|
-
ScrollAreaPrimitive.Root,
|
|
2459
|
-
{
|
|
2460
|
-
"data-slot": "scroll-area",
|
|
2461
|
-
className: cn("relative", className),
|
|
2462
|
-
...props,
|
|
2463
|
-
children: [
|
|
2464
|
-
/* @__PURE__ */ jsx21(
|
|
2465
|
-
ScrollAreaPrimitive.Viewport,
|
|
2466
|
-
{
|
|
2467
|
-
"data-slot": "scroll-area-viewport",
|
|
2468
|
-
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
|
|
2469
|
-
children
|
|
2470
|
-
}
|
|
2471
|
-
),
|
|
2472
|
-
/* @__PURE__ */ jsx21(ScrollBar, {}),
|
|
2473
|
-
/* @__PURE__ */ jsx21(ScrollAreaPrimitive.Corner, {})
|
|
2474
|
-
]
|
|
2475
|
-
}
|
|
2476
|
-
);
|
|
2477
|
-
}
|
|
2478
|
-
function ScrollBar({
|
|
2479
|
-
className,
|
|
2480
|
-
orientation = "vertical",
|
|
2481
|
-
...props
|
|
2482
|
-
}) {
|
|
2483
|
-
return /* @__PURE__ */ jsx21(
|
|
2484
|
-
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
2485
|
-
{
|
|
2486
|
-
"data-slot": "scroll-area-scrollbar",
|
|
2487
|
-
orientation,
|
|
2488
|
-
className: cn(
|
|
2489
|
-
"flex touch-none p-px transition-colors select-none",
|
|
2490
|
-
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
|
|
2491
|
-
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
|
|
2492
|
-
className
|
|
2493
|
-
),
|
|
2494
|
-
...props,
|
|
2495
|
-
children: /* @__PURE__ */ jsx21(
|
|
2496
|
-
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
2497
|
-
{
|
|
2498
|
-
"data-slot": "scroll-area-thumb",
|
|
2499
|
-
className: "bg-border relative flex-1 rounded-full"
|
|
2500
|
-
}
|
|
2501
|
-
)
|
|
2502
|
-
}
|
|
2503
|
-
);
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
// src/MapAttributes/index.tsx
|
|
2507
|
-
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2508
2450
|
function getAllAttributes(mpAttributes) {
|
|
2509
2451
|
return Object.values(mpAttributes).flat();
|
|
2510
2452
|
}
|
|
2511
|
-
function
|
|
2512
|
-
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
2513
|
-
if (index < 26) return `Column ${letters[index]}`;
|
|
2514
|
-
return `Column ${index + 1}`;
|
|
2515
|
-
}
|
|
2516
|
-
function SingleAttributeRow({
|
|
2453
|
+
function AttributeRow({
|
|
2517
2454
|
item,
|
|
2518
2455
|
index,
|
|
2519
2456
|
allAttributes,
|
|
2520
|
-
allMappedAttributes,
|
|
2521
2457
|
onMap,
|
|
2522
2458
|
onConfirm,
|
|
2523
2459
|
onIgnore,
|
|
@@ -2531,122 +2467,113 @@ function SingleAttributeRow({
|
|
|
2531
2467
|
return allAttributes.filter((a) => !mapped.has(a));
|
|
2532
2468
|
}, [allAttributes, item.mappedCols, item.customCols]);
|
|
2533
2469
|
if (item.isConfirmed) {
|
|
2534
|
-
return /* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
"Confirmed"
|
|
2549
|
-
]
|
|
2550
|
-
}
|
|
2551
|
-
),
|
|
2552
|
-
/* @__PURE__ */ jsx22(Button, { variant: "ghost", size: "sm", onClick: () => onEdit(index), children: /* @__PURE__ */ jsx22(Pencil2, { className: "size-3.5" }) })
|
|
2553
|
-
] })
|
|
2470
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 py-1.5 group", children: [
|
|
2471
|
+
/* @__PURE__ */ jsx21(Check2, { className: "size-3 shrink-0 text-emerald-600 dark:text-emerald-400" }),
|
|
2472
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-medium truncate", children: item.feedCol }),
|
|
2473
|
+
/* @__PURE__ */ jsx21(ChevronRight2, { className: "size-3 shrink-0 text-muted-foreground" }),
|
|
2474
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate", children: [...item.mappedCols, ...item.customCols].join(", ") }),
|
|
2475
|
+
/* @__PURE__ */ jsx21(
|
|
2476
|
+
"button",
|
|
2477
|
+
{
|
|
2478
|
+
type: "button",
|
|
2479
|
+
onClick: () => onEdit(index),
|
|
2480
|
+
className: "p-0.5 rounded opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-foreground transition-opacity",
|
|
2481
|
+
children: /* @__PURE__ */ jsx21(Pencil2, { className: "size-3" })
|
|
2482
|
+
}
|
|
2483
|
+
)
|
|
2554
2484
|
] });
|
|
2555
2485
|
}
|
|
2556
2486
|
if (item.isIgnored) {
|
|
2557
|
-
return /* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2487
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 py-1.5 group", children: [
|
|
2488
|
+
/* @__PURE__ */ jsx21(X, { className: "size-3 shrink-0 text-destructive" }),
|
|
2489
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground line-through truncate", children: item.feedCol }),
|
|
2490
|
+
/* @__PURE__ */ jsx21(
|
|
2491
|
+
"button",
|
|
2492
|
+
{
|
|
2493
|
+
type: "button",
|
|
2494
|
+
onClick: () => onEdit(index),
|
|
2495
|
+
className: "p-0.5 rounded opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-foreground transition-opacity",
|
|
2496
|
+
children: /* @__PURE__ */ jsx21(Pencil2, { className: "size-3" })
|
|
2497
|
+
}
|
|
2498
|
+
)
|
|
2566
2499
|
] });
|
|
2567
2500
|
}
|
|
2568
|
-
return /* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2501
|
+
return /* @__PURE__ */ jsxs10("div", { className: "py-2 space-y-1.5 border-l-2 border-destructive/60 pl-2", children: [
|
|
2502
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0", children: [
|
|
2503
|
+
/* @__PURE__ */ jsx21("p", { className: "text-xs font-medium", children: item.feedCol }),
|
|
2504
|
+
item.rows.length > 0 && /* @__PURE__ */ jsx21("p", { className: "text-[11px] text-muted-foreground truncate", children: item.rows.slice(0, 3).join(", ") })
|
|
2505
|
+
] }),
|
|
2506
|
+
item.mappedCols.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1", children: item.mappedCols.map((col, attrIdx) => /* @__PURE__ */ jsxs10(
|
|
2507
|
+
Badge,
|
|
2508
|
+
{
|
|
2509
|
+
variant: "secondary",
|
|
2510
|
+
className: "gap-0.5 text-[11px] h-5 px-1.5",
|
|
2511
|
+
children: [
|
|
2578
2512
|
col,
|
|
2579
|
-
/* @__PURE__ */
|
|
2513
|
+
/* @__PURE__ */ jsx21(
|
|
2580
2514
|
"button",
|
|
2581
2515
|
{
|
|
2582
2516
|
type: "button",
|
|
2583
2517
|
onClick: () => onUnmap(index, attrIdx),
|
|
2584
2518
|
className: "ml-0.5 rounded-full hover:bg-muted",
|
|
2585
|
-
children: /* @__PURE__ */
|
|
2519
|
+
children: /* @__PURE__ */ jsx21(X, { className: "size-2.5" })
|
|
2586
2520
|
}
|
|
2587
2521
|
)
|
|
2588
|
-
]
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
] })
|
|
2628
|
-
] }) })
|
|
2629
|
-
] })
|
|
2630
|
-
] })
|
|
2631
|
-
] }),
|
|
2632
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 pt-1", children: [
|
|
2633
|
-
/* @__PURE__ */ jsx22(
|
|
2634
|
-
Button,
|
|
2522
|
+
]
|
|
2523
|
+
},
|
|
2524
|
+
attrIdx
|
|
2525
|
+
)) }),
|
|
2526
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1.5", children: [
|
|
2527
|
+
/* @__PURE__ */ jsxs10(Popover, { open: popoverOpen, onOpenChange: setPopoverOpen, children: [
|
|
2528
|
+
/* @__PURE__ */ jsx21(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
2529
|
+
Button,
|
|
2530
|
+
{
|
|
2531
|
+
variant: "outline",
|
|
2532
|
+
size: "sm",
|
|
2533
|
+
className: "h-7 flex-1 justify-start text-xs font-normal",
|
|
2534
|
+
children: [
|
|
2535
|
+
/* @__PURE__ */ jsx21(Search3, { className: "mr-1.5 size-3 text-muted-foreground" }),
|
|
2536
|
+
hasMappedCols ? "Add another..." : "Select attribute..."
|
|
2537
|
+
]
|
|
2538
|
+
}
|
|
2539
|
+
) }),
|
|
2540
|
+
/* @__PURE__ */ jsx21(PopoverContent, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ jsxs10(Command, { children: [
|
|
2541
|
+
/* @__PURE__ */ jsx21(CommandInput, { placeholder: "Search..." }),
|
|
2542
|
+
/* @__PURE__ */ jsxs10(CommandList, { children: [
|
|
2543
|
+
/* @__PURE__ */ jsx21(CommandEmpty, { children: "No match." }),
|
|
2544
|
+
/* @__PURE__ */ jsx21(CommandGroup, { children: availableAttributes.map((attr) => /* @__PURE__ */ jsx21(
|
|
2545
|
+
CommandItem,
|
|
2546
|
+
{
|
|
2547
|
+
value: attr,
|
|
2548
|
+
onSelect: () => {
|
|
2549
|
+
onMap(index, attr);
|
|
2550
|
+
setPopoverOpen(false);
|
|
2551
|
+
},
|
|
2552
|
+
children: attr
|
|
2553
|
+
},
|
|
2554
|
+
attr
|
|
2555
|
+
)) })
|
|
2556
|
+
] })
|
|
2557
|
+
] }) })
|
|
2558
|
+
] }),
|
|
2559
|
+
hasMappedCols && /* @__PURE__ */ jsx21(
|
|
2560
|
+
"button",
|
|
2635
2561
|
{
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
className: "text-
|
|
2639
|
-
|
|
2640
|
-
children: "
|
|
2562
|
+
type: "button",
|
|
2563
|
+
onClick: () => onConfirm(index),
|
|
2564
|
+
className: "p-1 rounded text-emerald-600 hover:bg-emerald-600/10 dark:text-emerald-400 dark:hover:bg-emerald-400/10 transition-colors",
|
|
2565
|
+
title: "Confirm",
|
|
2566
|
+
children: /* @__PURE__ */ jsx21(Check2, { className: "size-3.5" })
|
|
2641
2567
|
}
|
|
2642
2568
|
),
|
|
2643
|
-
|
|
2644
|
-
|
|
2569
|
+
/* @__PURE__ */ jsx21(
|
|
2570
|
+
"button",
|
|
2645
2571
|
{
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2572
|
+
type: "button",
|
|
2573
|
+
onClick: () => onIgnore(index),
|
|
2574
|
+
className: "p-1 rounded text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",
|
|
2575
|
+
title: "Ignore",
|
|
2576
|
+
children: /* @__PURE__ */ jsx21(X, { className: "size-3.5" })
|
|
2650
2577
|
}
|
|
2651
2578
|
)
|
|
2652
2579
|
] })
|
|
@@ -2658,7 +2585,6 @@ function ValueMappingPanel({
|
|
|
2658
2585
|
uniqueValues,
|
|
2659
2586
|
onValueChange
|
|
2660
2587
|
}) {
|
|
2661
|
-
const [selectedAttrIndex, setSelectedAttrIndex] = useState7(null);
|
|
2662
2588
|
const lovItems = useMemo5(() => {
|
|
2663
2589
|
const items = [];
|
|
2664
2590
|
data.forEach((item, itemIndex) => {
|
|
@@ -2685,149 +2611,67 @@ function ValueMappingPanel({
|
|
|
2685
2611
|
});
|
|
2686
2612
|
return items;
|
|
2687
2613
|
}, [data, valuesOntologyAttributes, uniqueValues]);
|
|
2688
|
-
const needsMapping = lovItems.filter((i) => i.mappedCount < i.totalCount);
|
|
2689
|
-
const complete = lovItems.filter((i) => i.mappedCount >= i.totalCount);
|
|
2690
|
-
const selected = selectedAttrIndex !== null ? lovItems[selectedAttrIndex] : null;
|
|
2691
2614
|
if (lovItems.length === 0) {
|
|
2692
|
-
return /* @__PURE__ */
|
|
2615
|
+
return /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center py-6 text-xs text-muted-foreground", children: "No value mapping required." });
|
|
2693
2616
|
}
|
|
2694
|
-
return /* @__PURE__ */
|
|
2695
|
-
/* @__PURE__ */
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
children: [
|
|
2714
|
-
/* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-1 font-medium", children: [
|
|
2715
|
-
item.feedCol,
|
|
2716
|
-
/* @__PURE__ */ jsx22(ChevronRight2, { className: "size-3 text-muted-foreground" }),
|
|
2717
|
-
item.attribute
|
|
2718
|
-
] }),
|
|
2719
|
-
/* @__PURE__ */ jsxs11("span", { className: "text-amber-600", children: [
|
|
2720
|
-
"Mapping required (",
|
|
2721
|
-
item.mappedCount,
|
|
2722
|
-
"/",
|
|
2723
|
-
item.totalCount,
|
|
2724
|
-
")"
|
|
2725
|
-
] })
|
|
2726
|
-
]
|
|
2727
|
-
},
|
|
2728
|
-
`need-${i}`
|
|
2729
|
-
);
|
|
2730
|
-
})
|
|
2731
|
-
] }),
|
|
2732
|
-
complete.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-1", children: [
|
|
2733
|
-
/* @__PURE__ */ jsxs11("p", { className: "text-xs font-medium text-green-600", children: [
|
|
2734
|
-
"Mapping Complete (",
|
|
2735
|
-
complete.length,
|
|
2736
|
-
")"
|
|
2737
|
-
] }),
|
|
2738
|
-
complete.map((item, i) => {
|
|
2739
|
-
const globalIdx = lovItems.indexOf(item);
|
|
2740
|
-
return /* @__PURE__ */ jsxs11(
|
|
2741
|
-
"button",
|
|
2742
|
-
{
|
|
2743
|
-
type: "button",
|
|
2744
|
-
onClick: () => setSelectedAttrIndex(globalIdx),
|
|
2745
|
-
className: cn(
|
|
2746
|
-
"flex w-full flex-col items-start rounded-md border px-2.5 py-2 text-left text-xs transition-colors",
|
|
2747
|
-
selectedAttrIndex === globalIdx ? "border-primary bg-primary/5" : "hover:bg-accent"
|
|
2748
|
-
),
|
|
2749
|
-
children: [
|
|
2750
|
-
/* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-1 font-medium", children: [
|
|
2751
|
-
item.feedCol,
|
|
2752
|
-
/* @__PURE__ */ jsx22(ChevronRight2, { className: "size-3 text-muted-foreground" }),
|
|
2753
|
-
item.attribute
|
|
2754
|
-
] }),
|
|
2755
|
-
/* @__PURE__ */ jsxs11("span", { className: "text-green-600", children: [
|
|
2756
|
-
"All values mapped (",
|
|
2757
|
-
item.mappedCount,
|
|
2758
|
-
"/",
|
|
2759
|
-
item.totalCount,
|
|
2760
|
-
")"
|
|
2761
|
-
] })
|
|
2762
|
-
]
|
|
2763
|
-
},
|
|
2764
|
-
`done-${i}`
|
|
2765
|
-
);
|
|
2766
|
-
})
|
|
2767
|
-
] })
|
|
2617
|
+
return /* @__PURE__ */ jsx21("div", { className: "divide-y divide-border/50", children: lovItems.map((item, idx) => /* @__PURE__ */ jsxs10("div", { className: "py-2.5 space-y-1.5", children: [
|
|
2618
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1.5", children: [
|
|
2619
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-medium", children: item.feedCol }),
|
|
2620
|
+
/* @__PURE__ */ jsx21(ChevronRight2, { className: "size-3 text-muted-foreground" }),
|
|
2621
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: item.attribute }),
|
|
2622
|
+
/* @__PURE__ */ jsxs10(
|
|
2623
|
+
"span",
|
|
2624
|
+
{
|
|
2625
|
+
className: cn(
|
|
2626
|
+
"ml-auto text-[11px] tabular-nums",
|
|
2627
|
+
item.mappedCount >= item.totalCount ? "text-emerald-600 dark:text-emerald-400" : "text-muted-foreground"
|
|
2628
|
+
),
|
|
2629
|
+
children: [
|
|
2630
|
+
item.mappedCount,
|
|
2631
|
+
"/",
|
|
2632
|
+
item.totalCount
|
|
2633
|
+
]
|
|
2634
|
+
}
|
|
2635
|
+
)
|
|
2768
2636
|
] }),
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
onValueChange(
|
|
2801
|
-
selected.itemIndex,
|
|
2802
|
-
selected.attribute,
|
|
2803
|
-
raw,
|
|
2804
|
-
val
|
|
2805
|
-
);
|
|
2806
|
-
},
|
|
2807
|
-
children: [
|
|
2808
|
-
/* @__PURE__ */ jsx22(SelectTrigger, { className: "h-7 text-xs", children: /* @__PURE__ */ jsx22(SelectValue, { placeholder: "Select value..." }) }),
|
|
2809
|
-
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
2810
|
-
/* @__PURE__ */ jsx22(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Select value..." }) }),
|
|
2811
|
-
/* @__PURE__ */ jsx22(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx22("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
|
|
2812
|
-
selected.rawValues.map((v) => /* @__PURE__ */ jsx22(SelectItem, { value: v, children: v }, v))
|
|
2813
|
-
] })
|
|
2814
|
-
]
|
|
2815
|
-
}
|
|
2816
|
-
)
|
|
2817
|
-
] }, raw);
|
|
2818
|
-
})
|
|
2819
|
-
] })
|
|
2820
|
-
] }) : /* @__PURE__ */ jsx22("div", { className: "flex h-full items-center justify-center p-6 text-sm text-muted-foreground", children: "Select an attribute to map its values" }) })
|
|
2821
|
-
] });
|
|
2637
|
+
/* @__PURE__ */ jsx21("div", { className: "space-y-1", children: item.rawValues.map((raw) => {
|
|
2638
|
+
const mapped = item.mappedValues[raw];
|
|
2639
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2640
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate min-w-0 flex-1", children: raw }),
|
|
2641
|
+
/* @__PURE__ */ jsx21(ArrowRight, { className: "size-3 shrink-0 text-muted-foreground/50" }),
|
|
2642
|
+
/* @__PURE__ */ jsxs10(
|
|
2643
|
+
Select,
|
|
2644
|
+
{
|
|
2645
|
+
value: mapped ?? "__unmapped__",
|
|
2646
|
+
onValueChange: (v) => {
|
|
2647
|
+
const val = v === "__skip__" ? null : v;
|
|
2648
|
+
onValueChange(
|
|
2649
|
+
item.itemIndex,
|
|
2650
|
+
item.attribute,
|
|
2651
|
+
raw,
|
|
2652
|
+
val
|
|
2653
|
+
);
|
|
2654
|
+
},
|
|
2655
|
+
children: [
|
|
2656
|
+
/* @__PURE__ */ jsx21(SelectTrigger, { className: "h-7 w-[140px] text-xs", children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Select..." }) }),
|
|
2657
|
+
/* @__PURE__ */ jsxs10(SelectContent, { children: [
|
|
2658
|
+
/* @__PURE__ */ jsx21(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
|
|
2659
|
+
/* @__PURE__ */ jsx21(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
|
|
2660
|
+
item.rawValues.map((v) => /* @__PURE__ */ jsx21(SelectItem, { value: v, children: v }, v))
|
|
2661
|
+
] })
|
|
2662
|
+
]
|
|
2663
|
+
}
|
|
2664
|
+
)
|
|
2665
|
+
] }, raw);
|
|
2666
|
+
}) })
|
|
2667
|
+
] }, idx)) });
|
|
2822
2668
|
}
|
|
2823
2669
|
function MapAttributesChat({
|
|
2824
2670
|
mappingData: initialData,
|
|
2825
2671
|
mpAttributes,
|
|
2826
2672
|
valuesOntologyAttributes,
|
|
2827
|
-
columns,
|
|
2828
2673
|
uniqueValues,
|
|
2829
2674
|
submitted,
|
|
2830
|
-
submittedValues,
|
|
2831
2675
|
onSubmit
|
|
2832
2676
|
}) {
|
|
2833
2677
|
const [data, setData] = useState7(
|
|
@@ -2838,16 +2682,6 @@ function MapAttributesChat({
|
|
|
2838
2682
|
() => getAllAttributes(mpAttributes),
|
|
2839
2683
|
[mpAttributes]
|
|
2840
2684
|
);
|
|
2841
|
-
const allMappedAttributes = useMemo5(() => {
|
|
2842
|
-
const set = /* @__PURE__ */ new Set();
|
|
2843
|
-
data.forEach((item) => {
|
|
2844
|
-
if (!item.isIgnored) {
|
|
2845
|
-
item.mappedCols.forEach((c) => set.add(c));
|
|
2846
|
-
item.customCols.forEach((c) => set.add(c));
|
|
2847
|
-
}
|
|
2848
|
-
});
|
|
2849
|
-
return set;
|
|
2850
|
-
}, [data]);
|
|
2851
2685
|
const progress = useMemo5(() => {
|
|
2852
2686
|
const total = data.length;
|
|
2853
2687
|
const done = data.filter((i) => i.isConfirmed || i.isIgnored).length;
|
|
@@ -2859,6 +2693,18 @@ function MapAttributesChat({
|
|
|
2859
2693
|
),
|
|
2860
2694
|
[data, valuesOntologyAttributes]
|
|
2861
2695
|
);
|
|
2696
|
+
const allValuesComplete = useMemo5(() => {
|
|
2697
|
+
for (const item of data) {
|
|
2698
|
+
if (item.isIgnored || !item.isConfirmed) continue;
|
|
2699
|
+
for (const attr of item.mappedCols) {
|
|
2700
|
+
if (!valuesOntologyAttributes.includes(attr)) continue;
|
|
2701
|
+
const rawVals = uniqueValues[item.feedCol] || [];
|
|
2702
|
+
const mapped = item.mappedValues[attr] || {};
|
|
2703
|
+
if (rawVals.some((v) => mapped[v] == null)) return false;
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return true;
|
|
2707
|
+
}, [data, valuesOntologyAttributes, uniqueValues]);
|
|
2862
2708
|
const handleMap = useCallback5((index, attribute) => {
|
|
2863
2709
|
setData((prev) => {
|
|
2864
2710
|
const next = [...prev];
|
|
@@ -2905,7 +2751,10 @@ function MapAttributesChat({
|
|
|
2905
2751
|
const item = { ...next[itemIndex] };
|
|
2906
2752
|
const attrValues = { ...item.mappedValues[attribute] || {} };
|
|
2907
2753
|
attrValues[rawValue] = mappedValue;
|
|
2908
|
-
item.mappedValues = {
|
|
2754
|
+
item.mappedValues = {
|
|
2755
|
+
...item.mappedValues,
|
|
2756
|
+
[attribute]: attrValues
|
|
2757
|
+
};
|
|
2909
2758
|
next[itemIndex] = item;
|
|
2910
2759
|
return next;
|
|
2911
2760
|
});
|
|
@@ -2916,46 +2765,46 @@ function MapAttributesChat({
|
|
|
2916
2765
|
onSubmit(data);
|
|
2917
2766
|
}, [data, onSubmit]);
|
|
2918
2767
|
if (submitted) {
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2768
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rounded-lg border border-border bg-muted/20 p-3 flex items-start gap-3", children: [
|
|
2769
|
+
/* @__PURE__ */ jsx21(Check2, { className: "size-4 mt-0.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
|
|
2770
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
2771
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm font-medium", children: "Attribute mapping confirmed" }),
|
|
2772
|
+
/* @__PURE__ */ jsxs10("p", { className: "text-xs text-muted-foreground", children: [
|
|
2773
|
+
progress.done,
|
|
2774
|
+
"/",
|
|
2775
|
+
progress.total,
|
|
2776
|
+
" columns mapped"
|
|
2777
|
+
] })
|
|
2929
2778
|
] })
|
|
2930
2779
|
] });
|
|
2931
2780
|
}
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2781
|
+
return /* @__PURE__ */ jsxs10(Card, { className: "w-[60%] max-w-2xl max-h-[45vh] gap-0 flex flex-col shadow-sm", children: [
|
|
2782
|
+
/* @__PURE__ */ jsxs10("div", { className: "px-4 pt-3 pb-2 flex-shrink-0 space-y-2", children: [
|
|
2783
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
2784
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold tracking-tight", children: step === "attributes" ? "Map Attributes" : "Map Values" }),
|
|
2785
|
+
/* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground leading-snug", children: step === "attributes" ? "Match each feed column to a marketplace attribute" : "Normalize values for controlled-vocabulary attributes" })
|
|
2937
2786
|
] }),
|
|
2938
|
-
step === "attributes" && /* @__PURE__ */
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2787
|
+
step === "attributes" && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2788
|
+
/* @__PURE__ */ jsx21("div", { className: "h-1 flex-1 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx21(
|
|
2789
|
+
"div",
|
|
2790
|
+
{
|
|
2791
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
2792
|
+
style: { width: `${progress.percent}%` }
|
|
2793
|
+
}
|
|
2794
|
+
) }),
|
|
2795
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-[11px] text-muted-foreground tabular-nums shrink-0", children: [
|
|
2796
|
+
progress.done,
|
|
2797
|
+
"/",
|
|
2798
|
+
progress.total
|
|
2799
|
+
] })
|
|
2942
2800
|
] })
|
|
2943
2801
|
] }),
|
|
2944
|
-
step === "attributes"
|
|
2945
|
-
|
|
2946
|
-
{
|
|
2947
|
-
className: "h-full rounded-full bg-primary transition-all",
|
|
2948
|
-
style: { width: `${progress.percent}%` }
|
|
2949
|
-
}
|
|
2950
|
-
) }),
|
|
2951
|
-
/* @__PURE__ */ jsx22(Separator2, {}),
|
|
2952
|
-
/* @__PURE__ */ jsx22(ScrollArea, { className: "max-h-[420px]", children: step === "attributes" ? /* @__PURE__ */ jsx22("div", { className: "space-y-2 pr-3", children: data.map((item, idx) => /* @__PURE__ */ jsx22(
|
|
2953
|
-
SingleAttributeRow,
|
|
2802
|
+
/* @__PURE__ */ jsx21("div", { className: "px-4 overflow-y-auto flex-1 min-h-0", children: step === "attributes" ? /* @__PURE__ */ jsx21("div", { className: "divide-y divide-border/50", children: data.map((item, idx) => /* @__PURE__ */ jsx21(
|
|
2803
|
+
AttributeRow,
|
|
2954
2804
|
{
|
|
2955
2805
|
item,
|
|
2956
2806
|
index: idx,
|
|
2957
2807
|
allAttributes,
|
|
2958
|
-
allMappedAttributes,
|
|
2959
2808
|
onMap: handleMap,
|
|
2960
2809
|
onConfirm: handleConfirm,
|
|
2961
2810
|
onIgnore: handleIgnore,
|
|
@@ -2963,7 +2812,7 @@ function MapAttributesChat({
|
|
|
2963
2812
|
onUnmap: handleUnmap
|
|
2964
2813
|
},
|
|
2965
2814
|
idx
|
|
2966
|
-
)) }) : /* @__PURE__ */
|
|
2815
|
+
)) }) : /* @__PURE__ */ jsx21(
|
|
2967
2816
|
ValueMappingPanel,
|
|
2968
2817
|
{
|
|
2969
2818
|
data,
|
|
@@ -2972,51 +2821,54 @@ function MapAttributesChat({
|
|
|
2972
2821
|
onValueChange: handleValueChange
|
|
2973
2822
|
}
|
|
2974
2823
|
) }),
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
|
|
2977
|
-
step === "values" ? /* @__PURE__ */ jsxs11(
|
|
2824
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex justify-end gap-2 px-4 py-2 flex-shrink-0 border-t border-border/50", children: [
|
|
2825
|
+
step === "values" && /* @__PURE__ */ jsxs10(
|
|
2978
2826
|
Button,
|
|
2979
2827
|
{
|
|
2980
|
-
variant: "
|
|
2828
|
+
variant: "ghost",
|
|
2981
2829
|
size: "sm",
|
|
2982
2830
|
onClick: () => setStep("attributes"),
|
|
2831
|
+
className: "h-7 text-xs text-muted-foreground hover:text-foreground",
|
|
2983
2832
|
children: [
|
|
2984
|
-
/* @__PURE__ */
|
|
2833
|
+
/* @__PURE__ */ jsx21(ArrowLeft2, { className: "mr-1 size-3" }),
|
|
2985
2834
|
"Back"
|
|
2986
2835
|
]
|
|
2987
2836
|
}
|
|
2988
|
-
)
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2837
|
+
),
|
|
2838
|
+
step === "attributes" && hasLovAttributes && /* @__PURE__ */ jsxs10(
|
|
2839
|
+
Button,
|
|
2840
|
+
{
|
|
2841
|
+
variant: "ghost",
|
|
2842
|
+
size: "sm",
|
|
2843
|
+
onClick: () => setStep("values"),
|
|
2844
|
+
disabled: progress.done < progress.total,
|
|
2845
|
+
className: "h-7 text-xs",
|
|
2846
|
+
children: [
|
|
2847
|
+
"Map Values",
|
|
2848
|
+
/* @__PURE__ */ jsx21(ArrowRight, { className: "ml-1 size-3" })
|
|
2849
|
+
]
|
|
2850
|
+
}
|
|
2851
|
+
),
|
|
2852
|
+
/* @__PURE__ */ jsxs10(
|
|
2853
|
+
Button,
|
|
2854
|
+
{
|
|
2855
|
+
size: "sm",
|
|
2856
|
+
onClick: handleSubmit,
|
|
2857
|
+
disabled: progress.done < progress.total || hasLovAttributes && !allValuesComplete,
|
|
2858
|
+
className: "h-7 text-xs bg-primary text-primary-foreground shadow-none hover:bg-primary/90",
|
|
2859
|
+
children: [
|
|
2860
|
+
/* @__PURE__ */ jsx21(Send, { className: "mr-1 size-3" }),
|
|
2861
|
+
"Save Mapping"
|
|
2862
|
+
]
|
|
2863
|
+
}
|
|
2864
|
+
)
|
|
3013
2865
|
] })
|
|
3014
2866
|
] });
|
|
3015
2867
|
}
|
|
3016
2868
|
|
|
3017
2869
|
// src/Automations/ProductAutomation.tsx
|
|
3018
2870
|
import { useState as useState9, useEffect as useEffect5, useCallback as useCallback7, useRef as useRef5 } from "react";
|
|
3019
|
-
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader26, ChevronDown as
|
|
2871
|
+
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader26, ChevronDown as ChevronDown2, Play } from "lucide-react";
|
|
3020
2872
|
|
|
3021
2873
|
// src/Automations/api.ts
|
|
3022
2874
|
async function fetchAutomationList(storeId, tag, includeGroupings = false) {
|
|
@@ -3144,7 +2996,7 @@ function parseLovResponse(response, curl, configs) {
|
|
|
3144
2996
|
// src/Automations/SchemaFieldRenderer.tsx
|
|
3145
2997
|
import { useCallback as useCallback6, useState as useState8 } from "react";
|
|
3146
2998
|
import { Check as Check3, ChevronsUpDown as ChevronsUpDown2, Loader2 as Loader25, X as X2 } from "lucide-react";
|
|
3147
|
-
import { jsx as
|
|
2999
|
+
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3148
3000
|
function SchemaFieldRenderer({
|
|
3149
3001
|
schema,
|
|
3150
3002
|
configs,
|
|
@@ -3152,12 +3004,12 @@ function SchemaFieldRenderer({
|
|
|
3152
3004
|
loadingOptions,
|
|
3153
3005
|
onConfigChange
|
|
3154
3006
|
}) {
|
|
3155
|
-
return /* @__PURE__ */
|
|
3007
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-4", children: schema.map((item, idx) => {
|
|
3156
3008
|
if (!shouldRenderAttribute(item.render_if, configs)) return null;
|
|
3157
3009
|
if (item.fieldtype === "object_array" && item.mapping_parameters) {
|
|
3158
|
-
return /* @__PURE__ */
|
|
3010
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-3", children: item.mapping_parameters.map((sub, subIdx) => {
|
|
3159
3011
|
const value = configs[item.payload_key]?.[0] != null ? configs[item.payload_key][0]?.[sub.payload_key] : void 0;
|
|
3160
|
-
return /* @__PURE__ */
|
|
3012
|
+
return /* @__PURE__ */ jsx22(
|
|
3161
3013
|
FieldSwitch,
|
|
3162
3014
|
{
|
|
3163
3015
|
item: sub,
|
|
@@ -3171,7 +3023,7 @@ function SchemaFieldRenderer({
|
|
|
3171
3023
|
);
|
|
3172
3024
|
}) }, idx);
|
|
3173
3025
|
}
|
|
3174
|
-
return /* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ jsx22(
|
|
3175
3027
|
FieldSwitch,
|
|
3176
3028
|
{
|
|
3177
3029
|
item,
|
|
@@ -3196,7 +3048,7 @@ function FieldSwitch({
|
|
|
3196
3048
|
if (!shouldRenderAttribute(item.render_if, configs)) return null;
|
|
3197
3049
|
switch (item.fieldtype) {
|
|
3198
3050
|
case "freetext":
|
|
3199
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ jsx22(
|
|
3200
3052
|
FreetextField,
|
|
3201
3053
|
{
|
|
3202
3054
|
item,
|
|
@@ -3205,7 +3057,7 @@ function FieldSwitch({
|
|
|
3205
3057
|
}
|
|
3206
3058
|
);
|
|
3207
3059
|
case "freetext_list":
|
|
3208
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ jsx22(
|
|
3209
3061
|
FreetextListField,
|
|
3210
3062
|
{
|
|
3211
3063
|
item,
|
|
@@ -3214,7 +3066,7 @@ function FieldSwitch({
|
|
|
3214
3066
|
}
|
|
3215
3067
|
);
|
|
3216
3068
|
case "lov_singleselect":
|
|
3217
|
-
return /* @__PURE__ */
|
|
3069
|
+
return /* @__PURE__ */ jsx22(
|
|
3218
3070
|
SingleSelectField,
|
|
3219
3071
|
{
|
|
3220
3072
|
item,
|
|
@@ -3225,7 +3077,7 @@ function FieldSwitch({
|
|
|
3225
3077
|
}
|
|
3226
3078
|
);
|
|
3227
3079
|
case "lov_multipleselect":
|
|
3228
|
-
return /* @__PURE__ */
|
|
3080
|
+
return /* @__PURE__ */ jsx22(
|
|
3229
3081
|
MultiSelectField,
|
|
3230
3082
|
{
|
|
3231
3083
|
item,
|
|
@@ -3236,7 +3088,7 @@ function FieldSwitch({
|
|
|
3236
3088
|
}
|
|
3237
3089
|
);
|
|
3238
3090
|
case "image_singleselect":
|
|
3239
|
-
return /* @__PURE__ */
|
|
3091
|
+
return /* @__PURE__ */ jsx22(
|
|
3240
3092
|
ImageSelectField,
|
|
3241
3093
|
{
|
|
3242
3094
|
item,
|
|
@@ -3245,7 +3097,7 @@ function FieldSwitch({
|
|
|
3245
3097
|
}
|
|
3246
3098
|
);
|
|
3247
3099
|
case "boolean":
|
|
3248
|
-
return /* @__PURE__ */
|
|
3100
|
+
return /* @__PURE__ */ jsx22(
|
|
3249
3101
|
BooleanField,
|
|
3250
3102
|
{
|
|
3251
3103
|
item,
|
|
@@ -3262,13 +3114,13 @@ function FreetextField({
|
|
|
3262
3114
|
value,
|
|
3263
3115
|
onChange
|
|
3264
3116
|
}) {
|
|
3265
|
-
return /* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3117
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3118
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3267
3119
|
item.title,
|
|
3268
|
-
item.required && /* @__PURE__ */
|
|
3120
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3269
3121
|
] }),
|
|
3270
|
-
item.description && /* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3122
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3123
|
+
/* @__PURE__ */ jsx22(
|
|
3272
3124
|
Input,
|
|
3273
3125
|
{
|
|
3274
3126
|
value: value ?? "",
|
|
@@ -3293,14 +3145,14 @@ function FreetextListField({
|
|
|
3293
3145
|
setDraft("");
|
|
3294
3146
|
}
|
|
3295
3147
|
};
|
|
3296
|
-
return /* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3148
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3149
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3298
3150
|
item.title,
|
|
3299
|
-
item.required && /* @__PURE__ */
|
|
3151
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3300
3152
|
] }),
|
|
3301
|
-
item.description && /* @__PURE__ */
|
|
3302
|
-
/* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3153
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3154
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
|
|
3155
|
+
/* @__PURE__ */ jsx22(
|
|
3304
3156
|
Input,
|
|
3305
3157
|
{
|
|
3306
3158
|
value: draft,
|
|
@@ -3309,17 +3161,17 @@ function FreetextListField({
|
|
|
3309
3161
|
placeholder: "Type and press Enter"
|
|
3310
3162
|
}
|
|
3311
3163
|
),
|
|
3312
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ jsx22(Button, { variant: "outline", size: "sm", onClick: addKeyword, type: "button", children: "Add" })
|
|
3313
3165
|
] }),
|
|
3314
|
-
keywords.length > 0 && /* @__PURE__ */
|
|
3166
|
+
keywords.length > 0 && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1.5 pt-1", children: keywords.map((kw) => /* @__PURE__ */ jsxs11(Badge, { variant: "secondary", className: "gap-1 pr-1", children: [
|
|
3315
3167
|
kw,
|
|
3316
|
-
/* @__PURE__ */
|
|
3168
|
+
/* @__PURE__ */ jsx22(
|
|
3317
3169
|
"button",
|
|
3318
3170
|
{
|
|
3319
3171
|
type: "button",
|
|
3320
3172
|
onClick: () => onChange(keywords.filter((k) => k !== kw)),
|
|
3321
3173
|
className: "ml-0.5 rounded-full hover:bg-muted",
|
|
3322
|
-
children: /* @__PURE__ */
|
|
3174
|
+
children: /* @__PURE__ */ jsx22(X2, { className: "size-3" })
|
|
3323
3175
|
}
|
|
3324
3176
|
)
|
|
3325
3177
|
] }, kw)) })
|
|
@@ -3334,23 +3186,23 @@ function SingleSelectField({
|
|
|
3334
3186
|
}) {
|
|
3335
3187
|
const strOptions = Array.isArray(lovOptions) ? lovOptions.map(String) : [];
|
|
3336
3188
|
const strValue = value != null ? String(value) : "";
|
|
3337
|
-
return /* @__PURE__ */
|
|
3338
|
-
/* @__PURE__ */
|
|
3189
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3190
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3339
3191
|
item.title,
|
|
3340
|
-
item.required && /* @__PURE__ */
|
|
3192
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3341
3193
|
] }),
|
|
3342
|
-
item.description && /* @__PURE__ */
|
|
3343
|
-
loading ? /* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3194
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3195
|
+
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3196
|
+
/* @__PURE__ */ jsx22(Loader25, { className: "size-4 animate-spin" }),
|
|
3345
3197
|
"Loading options..."
|
|
3346
|
-
] }) : /* @__PURE__ */
|
|
3198
|
+
] }) : /* @__PURE__ */ jsxs11(
|
|
3347
3199
|
Select,
|
|
3348
3200
|
{
|
|
3349
3201
|
value: strValue,
|
|
3350
3202
|
onValueChange: (v) => onChange(item.valuetype === "integer" ? Number(v) : v),
|
|
3351
3203
|
children: [
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsx22(SelectTrigger, { children: /* @__PURE__ */ jsx22(SelectValue, { placeholder: "Select..." }) }),
|
|
3205
|
+
/* @__PURE__ */ jsx22(SelectContent, { children: strOptions.map((opt) => /* @__PURE__ */ jsx22(SelectItem, { value: opt, children: opt }, opt)) })
|
|
3354
3206
|
]
|
|
3355
3207
|
}
|
|
3356
3208
|
)
|
|
@@ -3374,40 +3226,40 @@ function MultiSelectField({
|
|
|
3374
3226
|
},
|
|
3375
3227
|
[selected, onChange]
|
|
3376
3228
|
);
|
|
3377
|
-
return /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3230
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3379
3231
|
item.title,
|
|
3380
|
-
item.required && /* @__PURE__ */
|
|
3232
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3381
3233
|
] }),
|
|
3382
|
-
item.description && /* @__PURE__ */
|
|
3383
|
-
loading ? /* @__PURE__ */
|
|
3384
|
-
/* @__PURE__ */
|
|
3234
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3235
|
+
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3236
|
+
/* @__PURE__ */ jsx22(Loader25, { className: "size-4 animate-spin" }),
|
|
3385
3237
|
"Loading options..."
|
|
3386
|
-
] }) : /* @__PURE__ */
|
|
3387
|
-
/* @__PURE__ */
|
|
3238
|
+
] }) : /* @__PURE__ */ jsxs11(Popover, { open, onOpenChange: setOpen, children: [
|
|
3239
|
+
/* @__PURE__ */ jsx22(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
3388
3240
|
Button,
|
|
3389
3241
|
{
|
|
3390
3242
|
variant: "outline",
|
|
3391
3243
|
className: "w-full justify-between font-normal",
|
|
3392
3244
|
children: [
|
|
3393
|
-
selected.length > 0 ? /* @__PURE__ */
|
|
3394
|
-
/* @__PURE__ */
|
|
3245
|
+
selected.length > 0 ? /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-1", children: selected.map((s) => /* @__PURE__ */ jsx22(Badge, { variant: "secondary", className: "text-xs", children: s }, s)) }) : /* @__PURE__ */ jsx22("span", { className: "text-muted-foreground", children: "Select..." }),
|
|
3246
|
+
/* @__PURE__ */ jsx22(ChevronsUpDown2, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
3395
3247
|
]
|
|
3396
3248
|
}
|
|
3397
3249
|
) }),
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsx22(PopoverContent, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ jsxs11(Command, { children: [
|
|
3251
|
+
/* @__PURE__ */ jsx22(CommandInput, { placeholder: "Search..." }),
|
|
3252
|
+
/* @__PURE__ */ jsxs11(CommandList, { children: [
|
|
3253
|
+
/* @__PURE__ */ jsx22(CommandEmpty, { children: "No match." }),
|
|
3254
|
+
/* @__PURE__ */ jsx22(CommandGroup, { children: strOptions.map((opt) => {
|
|
3403
3255
|
const isSelected = selected.includes(opt);
|
|
3404
|
-
return /* @__PURE__ */
|
|
3256
|
+
return /* @__PURE__ */ jsxs11(
|
|
3405
3257
|
CommandItem,
|
|
3406
3258
|
{
|
|
3407
3259
|
value: opt,
|
|
3408
3260
|
onSelect: () => toggle(opt),
|
|
3409
3261
|
children: [
|
|
3410
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx22(
|
|
3411
3263
|
Check3,
|
|
3412
3264
|
{
|
|
3413
3265
|
className: cn(
|
|
@@ -3433,12 +3285,12 @@ function ImageSelectField({
|
|
|
3433
3285
|
onChange
|
|
3434
3286
|
}) {
|
|
3435
3287
|
const images = item.lov ?? [];
|
|
3436
|
-
return /* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3289
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3438
3290
|
item.title,
|
|
3439
|
-
item.required && /* @__PURE__ */
|
|
3291
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3440
3292
|
] }),
|
|
3441
|
-
/* @__PURE__ */
|
|
3293
|
+
/* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-3", children: images.map((url) => /* @__PURE__ */ jsxs11(
|
|
3442
3294
|
"button",
|
|
3443
3295
|
{
|
|
3444
3296
|
type: "button",
|
|
@@ -3448,8 +3300,8 @@ function ImageSelectField({
|
|
|
3448
3300
|
value === url ? "border-primary ring-2 ring-primary/30" : "border-border hover:border-primary/50"
|
|
3449
3301
|
),
|
|
3450
3302
|
children: [
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
value === url && /* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsx22("img", { src: url, alt: "", className: "size-20 object-cover" }),
|
|
3304
|
+
value === url && /* @__PURE__ */ jsx22("div", { className: "absolute right-1 top-1 rounded-full bg-primary p-0.5 text-primary-foreground", children: /* @__PURE__ */ jsx22(Check3, { className: "size-3" }) })
|
|
3453
3305
|
]
|
|
3454
3306
|
},
|
|
3455
3307
|
url
|
|
@@ -3461,23 +3313,23 @@ function BooleanField({
|
|
|
3461
3313
|
value,
|
|
3462
3314
|
onChange
|
|
3463
3315
|
}) {
|
|
3464
|
-
return /* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3316
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 py-1", children: [
|
|
3317
|
+
/* @__PURE__ */ jsx22(
|
|
3466
3318
|
Checkbox,
|
|
3467
3319
|
{
|
|
3468
3320
|
checked: !!value,
|
|
3469
3321
|
onCheckedChange: (checked) => onChange(!!checked)
|
|
3470
3322
|
}
|
|
3471
3323
|
),
|
|
3472
|
-
/* @__PURE__ */
|
|
3324
|
+
/* @__PURE__ */ jsxs11(Label, { className: "cursor-pointer", onClick: () => onChange(!value), children: [
|
|
3473
3325
|
item.title,
|
|
3474
|
-
item.required && /* @__PURE__ */
|
|
3326
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3475
3327
|
] })
|
|
3476
3328
|
] });
|
|
3477
3329
|
}
|
|
3478
3330
|
|
|
3479
3331
|
// src/Automations/ProductAutomation.tsx
|
|
3480
|
-
import { Fragment as Fragment4, jsx as
|
|
3332
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3481
3333
|
function ProductAutomation({
|
|
3482
3334
|
storeId,
|
|
3483
3335
|
workspaceId,
|
|
@@ -3650,18 +3502,18 @@ function ProductAutomation({
|
|
|
3650
3502
|
const filtered = searchQuery ? unique.filter(
|
|
3651
3503
|
(a) => a.display_name?.toLowerCase().includes(searchQuery.toLowerCase()) || a.automation.toLowerCase().includes(searchQuery.toLowerCase())
|
|
3652
3504
|
) : null;
|
|
3653
|
-
return /* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3657
|
-
/* @__PURE__ */
|
|
3505
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3506
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3507
|
+
/* @__PURE__ */ jsx23(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" }) }),
|
|
3508
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: "Automations" }),
|
|
3509
|
+
/* @__PURE__ */ jsxs12(Badge, { variant: "secondary", children: [
|
|
3658
3510
|
productsCount,
|
|
3659
3511
|
" products"
|
|
3660
3512
|
] })
|
|
3661
3513
|
] }),
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
3515
|
+
/* @__PURE__ */ jsx23(Search4, { className: "absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
|
|
3516
|
+
/* @__PURE__ */ jsx23(
|
|
3665
3517
|
Input,
|
|
3666
3518
|
{
|
|
3667
3519
|
placeholder: "Search automations...",
|
|
@@ -3671,12 +3523,12 @@ function ProductAutomation({
|
|
|
3671
3523
|
}
|
|
3672
3524
|
)
|
|
3673
3525
|
] }),
|
|
3674
|
-
/* @__PURE__ */
|
|
3675
|
-
/* @__PURE__ */
|
|
3676
|
-
/* @__PURE__ */
|
|
3677
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-4 border-b px-2 pb-2 text-xs font-medium text-muted-foreground", children: [
|
|
3527
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[5]", children: "Automation" }),
|
|
3528
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[1.5] text-center", children: "Est. Time" }),
|
|
3529
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[1.5] text-center", children: "Credits" })
|
|
3678
3530
|
] }),
|
|
3679
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-y-auto", children: loading ? /* @__PURE__ */ jsx23("div", { className: "space-y-3 p-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx23(Skeleton, { className: "h-14 w-full rounded-md" }, i)) }) : filtered ? filtered.map((item) => /* @__PURE__ */ jsx23(
|
|
3680
3532
|
AutomationRow,
|
|
3681
3533
|
{
|
|
3682
3534
|
item,
|
|
@@ -3684,8 +3536,8 @@ function ProductAutomation({
|
|
|
3684
3536
|
onClick: () => setSelected(item)
|
|
3685
3537
|
},
|
|
3686
3538
|
item.automation
|
|
3687
|
-
)) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */
|
|
3688
|
-
/* @__PURE__ */
|
|
3539
|
+
)) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */ jsxs12("div", { children: [
|
|
3540
|
+
/* @__PURE__ */ jsxs12(
|
|
3689
3541
|
"button",
|
|
3690
3542
|
{
|
|
3691
3543
|
type: "button",
|
|
@@ -3695,8 +3547,8 @@ function ProductAutomation({
|
|
|
3695
3547
|
className: "flex w-full items-center justify-between px-2 py-2 text-sm font-semibold text-muted-foreground hover:text-foreground",
|
|
3696
3548
|
children: [
|
|
3697
3549
|
group,
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
|
|
3550
|
+
/* @__PURE__ */ jsx23(
|
|
3551
|
+
ChevronDown2,
|
|
3700
3552
|
{
|
|
3701
3553
|
className: cn(
|
|
3702
3554
|
"size-4 transition-transform",
|
|
@@ -3707,7 +3559,7 @@ function ProductAutomation({
|
|
|
3707
3559
|
]
|
|
3708
3560
|
}
|
|
3709
3561
|
),
|
|
3710
|
-
expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */
|
|
3562
|
+
expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */ jsx23(
|
|
3711
3563
|
AutomationRow,
|
|
3712
3564
|
{
|
|
3713
3565
|
item,
|
|
@@ -3719,15 +3571,15 @@ function ProductAutomation({
|
|
|
3719
3571
|
] }, group)) })
|
|
3720
3572
|
] });
|
|
3721
3573
|
}
|
|
3722
|
-
return /* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
3574
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3575
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3576
|
+
/* @__PURE__ */ jsx23(Button, { variant: "ghost", size: "icon", onClick: () => setSelected(null), children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" }) }),
|
|
3577
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: selected.display_name })
|
|
3726
3578
|
] }),
|
|
3727
|
-
selected.preview && /* @__PURE__ */
|
|
3728
|
-
selected.preview.info_text.map((text, i) => /* @__PURE__ */
|
|
3729
|
-
selected.preview.media.length > 0 && /* @__PURE__ */
|
|
3730
|
-
(m, i) => m.type === "image" ? /* @__PURE__ */
|
|
3579
|
+
selected.preview && /* @__PURE__ */ jsxs12("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
|
|
3580
|
+
selected.preview.info_text.map((text, i) => /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: text }, i)),
|
|
3581
|
+
selected.preview.media.length > 0 && /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-2 pt-1", children: selected.preview.media.map(
|
|
3582
|
+
(m, i) => m.type === "image" ? /* @__PURE__ */ jsx23(
|
|
3731
3583
|
"img",
|
|
3732
3584
|
{
|
|
3733
3585
|
src: m.src,
|
|
@@ -3738,8 +3590,8 @@ function ProductAutomation({
|
|
|
3738
3590
|
) : null
|
|
3739
3591
|
) })
|
|
3740
3592
|
] }),
|
|
3741
|
-
/* @__PURE__ */
|
|
3742
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsx23(Separator2, {}),
|
|
3594
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-y-auto", children: schemaLoading ? /* @__PURE__ */ jsx23("div", { className: "space-y-3 p-2", children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx23(Skeleton, { className: "h-12 w-full rounded-md" }, i)) }) : /* @__PURE__ */ jsx23(
|
|
3743
3595
|
SchemaFieldRenderer,
|
|
3744
3596
|
{
|
|
3745
3597
|
schema,
|
|
@@ -3749,26 +3601,26 @@ function ProductAutomation({
|
|
|
3749
3601
|
onConfigChange: handleConfigChange
|
|
3750
3602
|
}
|
|
3751
3603
|
) }),
|
|
3752
|
-
/* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
3754
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx23(Separator2, {}),
|
|
3605
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3606
|
+
/* @__PURE__ */ jsx23(
|
|
3755
3607
|
Button,
|
|
3756
3608
|
{
|
|
3757
3609
|
onClick: handleRun,
|
|
3758
3610
|
disabled: !isRunAllowed() || applying,
|
|
3759
3611
|
className: "flex-1",
|
|
3760
|
-
children: applying ? /* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
3612
|
+
children: applying ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
3613
|
+
/* @__PURE__ */ jsx23(Loader26, { className: "size-4 animate-spin" }),
|
|
3762
3614
|
"Applying..."
|
|
3763
|
-
] }) : /* @__PURE__ */
|
|
3764
|
-
/* @__PURE__ */
|
|
3615
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
3616
|
+
/* @__PURE__ */ jsx23(Play, { className: "size-4" }),
|
|
3765
3617
|
"Run Automation"
|
|
3766
3618
|
] })
|
|
3767
3619
|
}
|
|
3768
3620
|
),
|
|
3769
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: () => setSelected(null), children: "Cancel" })
|
|
3770
3622
|
] }),
|
|
3771
|
-
/* @__PURE__ */
|
|
3623
|
+
/* @__PURE__ */ jsx23("p", { className: "text-center text-xs text-muted-foreground", children: "By applying, you will override existing automations for the selected products with this new run." })
|
|
3772
3624
|
] });
|
|
3773
3625
|
}
|
|
3774
3626
|
function AutomationRow({
|
|
@@ -3778,19 +3630,19 @@ function AutomationRow({
|
|
|
3778
3630
|
}) {
|
|
3779
3631
|
const estTime = item.estimate_time_saved ? formatTimeSaved(item.estimate_time_saved * productsCount) : "\u2014";
|
|
3780
3632
|
const credits = item.credits ? Math.ceil(item.credits * productsCount) : 0;
|
|
3781
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ jsxs12(
|
|
3782
3634
|
"button",
|
|
3783
3635
|
{
|
|
3784
3636
|
type: "button",
|
|
3785
3637
|
onClick,
|
|
3786
3638
|
className: "flex w-full items-center gap-4 rounded-md px-2 py-2.5 text-left hover:bg-accent",
|
|
3787
3639
|
children: [
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */
|
|
3790
|
-
item.description && /* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-[5] min-w-0", children: [
|
|
3641
|
+
/* @__PURE__ */ jsx23("div", { className: "text-sm font-medium", children: item.display_name }),
|
|
3642
|
+
item.description && /* @__PURE__ */ jsx23("div", { className: "truncate text-xs text-muted-foreground", children: item.description })
|
|
3791
3643
|
] }),
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3644
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: estTime }),
|
|
3645
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: credits })
|
|
3794
3646
|
]
|
|
3795
3647
|
}
|
|
3796
3648
|
);
|
|
@@ -3804,7 +3656,7 @@ function formatTimeSaved(totalSeconds) {
|
|
|
3804
3656
|
// src/Automations/StoreAutomation.tsx
|
|
3805
3657
|
import { useState as useState10, useEffect as useEffect6, useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
3806
3658
|
import { ArrowLeft as ArrowLeft4, Settings } from "lucide-react";
|
|
3807
|
-
import { Fragment as Fragment5, jsx as
|
|
3659
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3808
3660
|
function StoreAutomation({
|
|
3809
3661
|
storeId,
|
|
3810
3662
|
channelsWithVersion,
|
|
@@ -3861,7 +3713,7 @@ function StoreAutomation({
|
|
|
3861
3713
|
setSelectedAutomation(null);
|
|
3862
3714
|
};
|
|
3863
3715
|
if (selectedAutomation) {
|
|
3864
|
-
return /* @__PURE__ */
|
|
3716
|
+
return /* @__PURE__ */ jsx24(
|
|
3865
3717
|
AutomationConfigEditor,
|
|
3866
3718
|
{
|
|
3867
3719
|
storeId,
|
|
@@ -3873,46 +3725,46 @@ function StoreAutomation({
|
|
|
3873
3725
|
}
|
|
3874
3726
|
);
|
|
3875
3727
|
}
|
|
3876
|
-
return /* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
onClose && /* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3729
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3730
|
+
onClose && /* @__PURE__ */ jsx24(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx24(ArrowLeft4, { className: "size-4" }) }),
|
|
3731
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-base font-semibold", children: "Default Store Automations" })
|
|
3880
3732
|
] }),
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
loading ? /* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */
|
|
3886
|
-
/* @__PURE__ */
|
|
3887
|
-
/* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3734
|
+
loading ? /* @__PURE__ */ jsx24("div", { className: "space-y-3 p-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx24(Skeleton, { className: "h-14 w-full rounded-md" }, i)) }) : /* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs13(Table, { children: [
|
|
3735
|
+
/* @__PURE__ */ jsx24(TableHeader, { children: /* @__PURE__ */ jsxs13(TableRow, { children: [
|
|
3736
|
+
/* @__PURE__ */ jsx24(TableHead, { children: "Automation" }),
|
|
3737
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-24 text-center", children: "Avg. Time" }),
|
|
3738
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-28 text-center", children: "Credits/Prd" }),
|
|
3739
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-28 text-center", children: "Status" }),
|
|
3740
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-12" })
|
|
3889
3741
|
] }) }),
|
|
3890
|
-
/* @__PURE__ */
|
|
3742
|
+
/* @__PURE__ */ jsx24(TableBody, { children: automations.map((a) => /* @__PURE__ */ jsxs13(
|
|
3891
3743
|
TableRow,
|
|
3892
3744
|
{
|
|
3893
3745
|
className: "cursor-pointer",
|
|
3894
3746
|
onClick: () => setSelectedAutomation(a),
|
|
3895
3747
|
children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
3898
|
-
a.description && /* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ jsxs13(TableCell, { children: [
|
|
3749
|
+
/* @__PURE__ */ jsx24("div", { className: "text-sm font-medium", children: a.display_name }),
|
|
3750
|
+
a.description && /* @__PURE__ */ jsx24("div", { className: "text-xs text-muted-foreground", children: a.description })
|
|
3899
3751
|
] }),
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center text-xs", children: a.estimate_run_time ?? "\u2014" }),
|
|
3753
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center text-xs", children: a.credits ?? "\u2014" }),
|
|
3754
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center", children: /* @__PURE__ */ jsxs13(
|
|
3903
3755
|
"div",
|
|
3904
3756
|
{
|
|
3905
3757
|
className: "flex items-center justify-center gap-2",
|
|
3906
3758
|
onClick: (e) => e.stopPropagation(),
|
|
3907
3759
|
children: [
|
|
3908
|
-
/* @__PURE__ */
|
|
3760
|
+
/* @__PURE__ */ jsx24(
|
|
3909
3761
|
Switch,
|
|
3910
3762
|
{
|
|
3911
3763
|
checked: a.isEnabled,
|
|
3912
3764
|
onCheckedChange: () => toggleAutomation(a.automation)
|
|
3913
3765
|
}
|
|
3914
3766
|
),
|
|
3915
|
-
/* @__PURE__ */
|
|
3767
|
+
/* @__PURE__ */ jsx24(
|
|
3916
3768
|
Badge,
|
|
3917
3769
|
{
|
|
3918
3770
|
variant: a.isEnabled ? "default" : "secondary",
|
|
@@ -3923,16 +3775,16 @@ function StoreAutomation({
|
|
|
3923
3775
|
]
|
|
3924
3776
|
}
|
|
3925
3777
|
) }),
|
|
3926
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ jsx24(TableCell, { children: /* @__PURE__ */ jsx24(Settings, { className: "size-4 text-muted-foreground" }) })
|
|
3927
3779
|
]
|
|
3928
3780
|
},
|
|
3929
3781
|
a.automation
|
|
3930
3782
|
)) })
|
|
3931
3783
|
] }) }),
|
|
3932
|
-
/* @__PURE__ */
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
onClose && /* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3784
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3785
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2", children: [
|
|
3786
|
+
onClose && /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: onClose, children: "Cancel" }),
|
|
3787
|
+
/* @__PURE__ */ jsx24(Button, { onClick: handleSave, children: "Save Changes" })
|
|
3936
3788
|
] })
|
|
3937
3789
|
] });
|
|
3938
3790
|
}
|
|
@@ -4013,36 +3865,36 @@ function AutomationConfigEditor({
|
|
|
4013
3865
|
},
|
|
4014
3866
|
[]
|
|
4015
3867
|
);
|
|
4016
|
-
return /* @__PURE__ */
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
/* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3869
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3870
|
+
/* @__PURE__ */ jsx24(
|
|
4019
3871
|
Button,
|
|
4020
3872
|
{
|
|
4021
3873
|
variant: "ghost",
|
|
4022
3874
|
size: "icon",
|
|
4023
3875
|
onClick: () => onClose(automation, configs),
|
|
4024
|
-
children: /* @__PURE__ */
|
|
3876
|
+
children: /* @__PURE__ */ jsx24(ArrowLeft4, { className: "size-4" })
|
|
4025
3877
|
}
|
|
4026
3878
|
),
|
|
4027
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-base font-semibold", children: automation.display_name })
|
|
4028
3880
|
] }),
|
|
4029
|
-
/* @__PURE__ */
|
|
4030
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-4 text-sm", children: [
|
|
3882
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
|
|
4031
3883
|
"Est. time: ",
|
|
4032
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.estimate_run_time ?? "\u2014" })
|
|
4033
3885
|
] }),
|
|
4034
|
-
/* @__PURE__ */
|
|
3886
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
|
|
4035
3887
|
"Credits/prd: ",
|
|
4036
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.credits ?? "\u2014" })
|
|
4037
3889
|
] })
|
|
4038
3890
|
] }),
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
/* @__PURE__ */
|
|
3891
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3892
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3893
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm font-medium", children: automation.isEnabled ? "Enabled" : "Disabled" }),
|
|
3894
|
+
/* @__PURE__ */ jsx24(Switch, { checked: automation.isEnabled, onCheckedChange: onToggle })
|
|
4043
3895
|
] }),
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
3896
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3897
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-y-auto", children: automation.isEnabled ? schemaLoading ? /* @__PURE__ */ jsx24("div", { className: "space-y-3 p-2", children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx24(Skeleton, { className: "h-12 w-full rounded-md" }, i)) }) : /* @__PURE__ */ jsx24(
|
|
4046
3898
|
SchemaFieldRenderer,
|
|
4047
3899
|
{
|
|
4048
3900
|
schema,
|
|
@@ -4051,13 +3903,13 @@ function AutomationConfigEditor({
|
|
|
4051
3903
|
loadingOptions,
|
|
4052
3904
|
onConfigChange: handleConfigChange
|
|
4053
3905
|
}
|
|
4054
|
-
) : /* @__PURE__ */
|
|
4055
|
-
automation.preview && /* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
4057
|
-
/* @__PURE__ */
|
|
4058
|
-
automation.preview.info_text.map((text, i) => /* @__PURE__ */
|
|
4059
|
-
automation.preview.media.length > 0 && /* @__PURE__ */
|
|
4060
|
-
(m, i) => m.type === "image" ? /* @__PURE__ */
|
|
3906
|
+
) : /* @__PURE__ */ jsx24("p", { className: "py-4 text-center text-sm text-muted-foreground", children: "Enable this automation to configure it." }) }),
|
|
3907
|
+
automation.preview && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3908
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3909
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
|
|
3910
|
+
automation.preview.info_text.map((text, i) => /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: text }, i)),
|
|
3911
|
+
automation.preview.media.length > 0 && /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2 pt-1", children: automation.preview.media.map(
|
|
3912
|
+
(m, i) => m.type === "image" ? /* @__PURE__ */ jsx24(
|
|
4061
3913
|
"img",
|
|
4062
3914
|
{
|
|
4063
3915
|
src: m.src,
|
|
@@ -4073,7 +3925,7 @@ function AutomationConfigEditor({
|
|
|
4073
3925
|
}
|
|
4074
3926
|
|
|
4075
3927
|
// src/CatalogixChat.tsx
|
|
4076
|
-
import { jsx as
|
|
3928
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4077
3929
|
var SECTION_MAP = {
|
|
4078
3930
|
"catalogix:create-store": "create_store",
|
|
4079
3931
|
create_or_select_store: "create_store",
|
|
@@ -4103,7 +3955,7 @@ function CatalogixChat(props) {
|
|
|
4103
3955
|
configureApi({ catalogixBaseUrl });
|
|
4104
3956
|
}, [catalogixBaseUrl]);
|
|
4105
3957
|
if (section === "select_products") {
|
|
4106
|
-
return /* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ jsx25(
|
|
4107
3959
|
SelectProducts,
|
|
4108
3960
|
{
|
|
4109
3961
|
workspaceId,
|
|
@@ -4119,7 +3971,7 @@ function CatalogixChat(props) {
|
|
|
4119
3971
|
);
|
|
4120
3972
|
}
|
|
4121
3973
|
if (section === "create_store") {
|
|
4122
|
-
return /* @__PURE__ */
|
|
3974
|
+
return /* @__PURE__ */ jsx25(
|
|
4123
3975
|
CreateStore,
|
|
4124
3976
|
{
|
|
4125
3977
|
workspaceId,
|
|
@@ -4133,7 +3985,7 @@ function CatalogixChat(props) {
|
|
|
4133
3985
|
);
|
|
4134
3986
|
}
|
|
4135
3987
|
if (section === "map_attributes") {
|
|
4136
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsx25(
|
|
4137
3989
|
MapAttributesChat,
|
|
4138
3990
|
{
|
|
4139
3991
|
mappingData: uiProps.mappingData ?? [],
|
|
@@ -4149,7 +4001,7 @@ function CatalogixChat(props) {
|
|
|
4149
4001
|
);
|
|
4150
4002
|
}
|
|
4151
4003
|
if (section === "trigger_automation") {
|
|
4152
|
-
return /* @__PURE__ */
|
|
4004
|
+
return /* @__PURE__ */ jsx25(
|
|
4153
4005
|
ProductAutomation,
|
|
4154
4006
|
{
|
|
4155
4007
|
storeId,
|
|
@@ -4169,7 +4021,7 @@ function CatalogixChat(props) {
|
|
|
4169
4021
|
);
|
|
4170
4022
|
}
|
|
4171
4023
|
if (section === "automations") {
|
|
4172
|
-
return /* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsx25(
|
|
4173
4025
|
StoreAutomation,
|
|
4174
4026
|
{
|
|
4175
4027
|
storeId,
|
|
@@ -4180,11 +4032,11 @@ function CatalogixChat(props) {
|
|
|
4180
4032
|
}
|
|
4181
4033
|
);
|
|
4182
4034
|
}
|
|
4183
|
-
return /* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ jsx25("div", { className: "p-4 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxs14("p", { children: [
|
|
4036
|
+
/* @__PURE__ */ jsx25("strong", { children: "Catalogix" }),
|
|
4185
4037
|
" \u2014 unknown section:",
|
|
4186
4038
|
" ",
|
|
4187
|
-
/* @__PURE__ */
|
|
4039
|
+
/* @__PURE__ */ jsx25("code", { children: section || "(none)" })
|
|
4188
4040
|
] }) });
|
|
4189
4041
|
}
|
|
4190
4042
|
|