@streamoid/catalogix-chat 0.2.4 → 0.2.5
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 +380 -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 flex-1", 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 flex-1", 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", 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;
|
|
@@ -2905,7 +2739,10 @@ function MapAttributesChat({
|
|
|
2905
2739
|
const item = { ...next[itemIndex] };
|
|
2906
2740
|
const attrValues = { ...item.mappedValues[attribute] || {} };
|
|
2907
2741
|
attrValues[rawValue] = mappedValue;
|
|
2908
|
-
item.mappedValues = {
|
|
2742
|
+
item.mappedValues = {
|
|
2743
|
+
...item.mappedValues,
|
|
2744
|
+
[attribute]: attrValues
|
|
2745
|
+
};
|
|
2909
2746
|
next[itemIndex] = item;
|
|
2910
2747
|
return next;
|
|
2911
2748
|
});
|
|
@@ -2916,46 +2753,46 @@ function MapAttributesChat({
|
|
|
2916
2753
|
onSubmit(data);
|
|
2917
2754
|
}, [data, onSubmit]);
|
|
2918
2755
|
if (submitted) {
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2921
|
-
|
|
2922
|
-
/* @__PURE__ */
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2756
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rounded-lg border border-border bg-muted/20 p-3 flex items-start gap-3", children: [
|
|
2757
|
+
/* @__PURE__ */ jsx21(Check2, { className: "size-4 mt-0.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
|
|
2758
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
2759
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm font-medium", children: "Attribute mapping confirmed" }),
|
|
2760
|
+
/* @__PURE__ */ jsxs10("p", { className: "text-xs text-muted-foreground", children: [
|
|
2761
|
+
progress.done,
|
|
2762
|
+
"/",
|
|
2763
|
+
progress.total,
|
|
2764
|
+
" columns mapped"
|
|
2765
|
+
] })
|
|
2929
2766
|
] })
|
|
2930
2767
|
] });
|
|
2931
2768
|
}
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2769
|
+
return /* @__PURE__ */ jsxs10(Card, { className: "w-full max-h-[45vh] gap-0 flex flex-col shadow-sm", children: [
|
|
2770
|
+
/* @__PURE__ */ jsxs10("div", { className: "px-4 pt-3 pb-2 flex-shrink-0 space-y-2", children: [
|
|
2771
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
2772
|
+
/* @__PURE__ */ jsx21("h3", { className: "text-sm font-semibold tracking-tight", children: step === "attributes" ? "Map Attributes" : "Map Values" }),
|
|
2773
|
+
/* @__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
2774
|
] }),
|
|
2938
|
-
step === "attributes" && /* @__PURE__ */
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2775
|
+
step === "attributes" && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2776
|
+
/* @__PURE__ */ jsx21("div", { className: "h-1 flex-1 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx21(
|
|
2777
|
+
"div",
|
|
2778
|
+
{
|
|
2779
|
+
className: "h-full rounded-full bg-primary transition-all",
|
|
2780
|
+
style: { width: `${progress.percent}%` }
|
|
2781
|
+
}
|
|
2782
|
+
) }),
|
|
2783
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-[11px] text-muted-foreground tabular-nums shrink-0", children: [
|
|
2784
|
+
progress.done,
|
|
2785
|
+
"/",
|
|
2786
|
+
progress.total
|
|
2787
|
+
] })
|
|
2942
2788
|
] })
|
|
2943
2789
|
] }),
|
|
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,
|
|
2790
|
+
/* @__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(
|
|
2791
|
+
AttributeRow,
|
|
2954
2792
|
{
|
|
2955
2793
|
item,
|
|
2956
2794
|
index: idx,
|
|
2957
2795
|
allAttributes,
|
|
2958
|
-
allMappedAttributes,
|
|
2959
2796
|
onMap: handleMap,
|
|
2960
2797
|
onConfirm: handleConfirm,
|
|
2961
2798
|
onIgnore: handleIgnore,
|
|
@@ -2963,7 +2800,7 @@ function MapAttributesChat({
|
|
|
2963
2800
|
onUnmap: handleUnmap
|
|
2964
2801
|
},
|
|
2965
2802
|
idx
|
|
2966
|
-
)) }) : /* @__PURE__ */
|
|
2803
|
+
)) }) : /* @__PURE__ */ jsx21(
|
|
2967
2804
|
ValueMappingPanel,
|
|
2968
2805
|
{
|
|
2969
2806
|
data,
|
|
@@ -2972,51 +2809,54 @@ function MapAttributesChat({
|
|
|
2972
2809
|
onValueChange: handleValueChange
|
|
2973
2810
|
}
|
|
2974
2811
|
) }),
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
|
|
2977
|
-
step === "values" ? /* @__PURE__ */ jsxs11(
|
|
2812
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex justify-end gap-2 px-4 py-2 flex-shrink-0 border-t border-border/50", children: [
|
|
2813
|
+
step === "values" && /* @__PURE__ */ jsxs10(
|
|
2978
2814
|
Button,
|
|
2979
2815
|
{
|
|
2980
|
-
variant: "
|
|
2816
|
+
variant: "ghost",
|
|
2981
2817
|
size: "sm",
|
|
2982
2818
|
onClick: () => setStep("attributes"),
|
|
2819
|
+
className: "h-7 text-xs text-muted-foreground hover:text-foreground",
|
|
2983
2820
|
children: [
|
|
2984
|
-
/* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ jsx21(ArrowLeft2, { className: "mr-1 size-3" }),
|
|
2985
2822
|
"Back"
|
|
2986
2823
|
]
|
|
2987
2824
|
}
|
|
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
|
-
|
|
2825
|
+
),
|
|
2826
|
+
step === "attributes" && hasLovAttributes && /* @__PURE__ */ jsxs10(
|
|
2827
|
+
Button,
|
|
2828
|
+
{
|
|
2829
|
+
variant: "ghost",
|
|
2830
|
+
size: "sm",
|
|
2831
|
+
onClick: () => setStep("values"),
|
|
2832
|
+
disabled: progress.done < progress.total,
|
|
2833
|
+
className: "h-7 text-xs",
|
|
2834
|
+
children: [
|
|
2835
|
+
"Map Values",
|
|
2836
|
+
/* @__PURE__ */ jsx21(ArrowRight, { className: "ml-1 size-3" })
|
|
2837
|
+
]
|
|
2838
|
+
}
|
|
2839
|
+
),
|
|
2840
|
+
/* @__PURE__ */ jsxs10(
|
|
2841
|
+
Button,
|
|
2842
|
+
{
|
|
2843
|
+
size: "sm",
|
|
2844
|
+
onClick: handleSubmit,
|
|
2845
|
+
disabled: progress.done < progress.total,
|
|
2846
|
+
className: "h-7 text-xs bg-primary text-primary-foreground shadow-none hover:bg-primary/90",
|
|
2847
|
+
children: [
|
|
2848
|
+
/* @__PURE__ */ jsx21(Send, { className: "mr-1 size-3" }),
|
|
2849
|
+
"Save Mapping"
|
|
2850
|
+
]
|
|
2851
|
+
}
|
|
2852
|
+
)
|
|
3013
2853
|
] })
|
|
3014
2854
|
] });
|
|
3015
2855
|
}
|
|
3016
2856
|
|
|
3017
2857
|
// src/Automations/ProductAutomation.tsx
|
|
3018
2858
|
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
|
|
2859
|
+
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader26, ChevronDown as ChevronDown2, Play } from "lucide-react";
|
|
3020
2860
|
|
|
3021
2861
|
// src/Automations/api.ts
|
|
3022
2862
|
async function fetchAutomationList(storeId, tag, includeGroupings = false) {
|
|
@@ -3144,7 +2984,7 @@ function parseLovResponse(response, curl, configs) {
|
|
|
3144
2984
|
// src/Automations/SchemaFieldRenderer.tsx
|
|
3145
2985
|
import { useCallback as useCallback6, useState as useState8 } from "react";
|
|
3146
2986
|
import { Check as Check3, ChevronsUpDown as ChevronsUpDown2, Loader2 as Loader25, X as X2 } from "lucide-react";
|
|
3147
|
-
import { jsx as
|
|
2987
|
+
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3148
2988
|
function SchemaFieldRenderer({
|
|
3149
2989
|
schema,
|
|
3150
2990
|
configs,
|
|
@@ -3152,12 +2992,12 @@ function SchemaFieldRenderer({
|
|
|
3152
2992
|
loadingOptions,
|
|
3153
2993
|
onConfigChange
|
|
3154
2994
|
}) {
|
|
3155
|
-
return /* @__PURE__ */
|
|
2995
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-4", children: schema.map((item, idx) => {
|
|
3156
2996
|
if (!shouldRenderAttribute(item.render_if, configs)) return null;
|
|
3157
2997
|
if (item.fieldtype === "object_array" && item.mapping_parameters) {
|
|
3158
|
-
return /* @__PURE__ */
|
|
2998
|
+
return /* @__PURE__ */ jsx22("div", { className: "space-y-3", children: item.mapping_parameters.map((sub, subIdx) => {
|
|
3159
2999
|
const value = configs[item.payload_key]?.[0] != null ? configs[item.payload_key][0]?.[sub.payload_key] : void 0;
|
|
3160
|
-
return /* @__PURE__ */
|
|
3000
|
+
return /* @__PURE__ */ jsx22(
|
|
3161
3001
|
FieldSwitch,
|
|
3162
3002
|
{
|
|
3163
3003
|
item: sub,
|
|
@@ -3171,7 +3011,7 @@ function SchemaFieldRenderer({
|
|
|
3171
3011
|
);
|
|
3172
3012
|
}) }, idx);
|
|
3173
3013
|
}
|
|
3174
|
-
return /* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ jsx22(
|
|
3175
3015
|
FieldSwitch,
|
|
3176
3016
|
{
|
|
3177
3017
|
item,
|
|
@@ -3196,7 +3036,7 @@ function FieldSwitch({
|
|
|
3196
3036
|
if (!shouldRenderAttribute(item.render_if, configs)) return null;
|
|
3197
3037
|
switch (item.fieldtype) {
|
|
3198
3038
|
case "freetext":
|
|
3199
|
-
return /* @__PURE__ */
|
|
3039
|
+
return /* @__PURE__ */ jsx22(
|
|
3200
3040
|
FreetextField,
|
|
3201
3041
|
{
|
|
3202
3042
|
item,
|
|
@@ -3205,7 +3045,7 @@ function FieldSwitch({
|
|
|
3205
3045
|
}
|
|
3206
3046
|
);
|
|
3207
3047
|
case "freetext_list":
|
|
3208
|
-
return /* @__PURE__ */
|
|
3048
|
+
return /* @__PURE__ */ jsx22(
|
|
3209
3049
|
FreetextListField,
|
|
3210
3050
|
{
|
|
3211
3051
|
item,
|
|
@@ -3214,7 +3054,7 @@ function FieldSwitch({
|
|
|
3214
3054
|
}
|
|
3215
3055
|
);
|
|
3216
3056
|
case "lov_singleselect":
|
|
3217
|
-
return /* @__PURE__ */
|
|
3057
|
+
return /* @__PURE__ */ jsx22(
|
|
3218
3058
|
SingleSelectField,
|
|
3219
3059
|
{
|
|
3220
3060
|
item,
|
|
@@ -3225,7 +3065,7 @@ function FieldSwitch({
|
|
|
3225
3065
|
}
|
|
3226
3066
|
);
|
|
3227
3067
|
case "lov_multipleselect":
|
|
3228
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsx22(
|
|
3229
3069
|
MultiSelectField,
|
|
3230
3070
|
{
|
|
3231
3071
|
item,
|
|
@@ -3236,7 +3076,7 @@ function FieldSwitch({
|
|
|
3236
3076
|
}
|
|
3237
3077
|
);
|
|
3238
3078
|
case "image_singleselect":
|
|
3239
|
-
return /* @__PURE__ */
|
|
3079
|
+
return /* @__PURE__ */ jsx22(
|
|
3240
3080
|
ImageSelectField,
|
|
3241
3081
|
{
|
|
3242
3082
|
item,
|
|
@@ -3245,7 +3085,7 @@ function FieldSwitch({
|
|
|
3245
3085
|
}
|
|
3246
3086
|
);
|
|
3247
3087
|
case "boolean":
|
|
3248
|
-
return /* @__PURE__ */
|
|
3088
|
+
return /* @__PURE__ */ jsx22(
|
|
3249
3089
|
BooleanField,
|
|
3250
3090
|
{
|
|
3251
3091
|
item,
|
|
@@ -3262,13 +3102,13 @@ function FreetextField({
|
|
|
3262
3102
|
value,
|
|
3263
3103
|
onChange
|
|
3264
3104
|
}) {
|
|
3265
|
-
return /* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3105
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3106
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3267
3107
|
item.title,
|
|
3268
|
-
item.required && /* @__PURE__ */
|
|
3108
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3269
3109
|
] }),
|
|
3270
|
-
item.description && /* @__PURE__ */
|
|
3271
|
-
/* @__PURE__ */
|
|
3110
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3111
|
+
/* @__PURE__ */ jsx22(
|
|
3272
3112
|
Input,
|
|
3273
3113
|
{
|
|
3274
3114
|
value: value ?? "",
|
|
@@ -3293,14 +3133,14 @@ function FreetextListField({
|
|
|
3293
3133
|
setDraft("");
|
|
3294
3134
|
}
|
|
3295
3135
|
};
|
|
3296
|
-
return /* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3136
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3137
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3298
3138
|
item.title,
|
|
3299
|
-
item.required && /* @__PURE__ */
|
|
3139
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3300
3140
|
] }),
|
|
3301
|
-
item.description && /* @__PURE__ */
|
|
3302
|
-
/* @__PURE__ */
|
|
3303
|
-
/* @__PURE__ */
|
|
3141
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3142
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-2", children: [
|
|
3143
|
+
/* @__PURE__ */ jsx22(
|
|
3304
3144
|
Input,
|
|
3305
3145
|
{
|
|
3306
3146
|
value: draft,
|
|
@@ -3309,17 +3149,17 @@ function FreetextListField({
|
|
|
3309
3149
|
placeholder: "Type and press Enter"
|
|
3310
3150
|
}
|
|
3311
3151
|
),
|
|
3312
|
-
/* @__PURE__ */
|
|
3152
|
+
/* @__PURE__ */ jsx22(Button, { variant: "outline", size: "sm", onClick: addKeyword, type: "button", children: "Add" })
|
|
3313
3153
|
] }),
|
|
3314
|
-
keywords.length > 0 && /* @__PURE__ */
|
|
3154
|
+
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
3155
|
kw,
|
|
3316
|
-
/* @__PURE__ */
|
|
3156
|
+
/* @__PURE__ */ jsx22(
|
|
3317
3157
|
"button",
|
|
3318
3158
|
{
|
|
3319
3159
|
type: "button",
|
|
3320
3160
|
onClick: () => onChange(keywords.filter((k) => k !== kw)),
|
|
3321
3161
|
className: "ml-0.5 rounded-full hover:bg-muted",
|
|
3322
|
-
children: /* @__PURE__ */
|
|
3162
|
+
children: /* @__PURE__ */ jsx22(X2, { className: "size-3" })
|
|
3323
3163
|
}
|
|
3324
3164
|
)
|
|
3325
3165
|
] }, kw)) })
|
|
@@ -3334,23 +3174,23 @@ function SingleSelectField({
|
|
|
3334
3174
|
}) {
|
|
3335
3175
|
const strOptions = Array.isArray(lovOptions) ? lovOptions.map(String) : [];
|
|
3336
3176
|
const strValue = value != null ? String(value) : "";
|
|
3337
|
-
return /* @__PURE__ */
|
|
3338
|
-
/* @__PURE__ */
|
|
3177
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3178
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3339
3179
|
item.title,
|
|
3340
|
-
item.required && /* @__PURE__ */
|
|
3180
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3341
3181
|
] }),
|
|
3342
|
-
item.description && /* @__PURE__ */
|
|
3343
|
-
loading ? /* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3182
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3183
|
+
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3184
|
+
/* @__PURE__ */ jsx22(Loader25, { className: "size-4 animate-spin" }),
|
|
3345
3185
|
"Loading options..."
|
|
3346
|
-
] }) : /* @__PURE__ */
|
|
3186
|
+
] }) : /* @__PURE__ */ jsxs11(
|
|
3347
3187
|
Select,
|
|
3348
3188
|
{
|
|
3349
3189
|
value: strValue,
|
|
3350
3190
|
onValueChange: (v) => onChange(item.valuetype === "integer" ? Number(v) : v),
|
|
3351
3191
|
children: [
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */
|
|
3192
|
+
/* @__PURE__ */ jsx22(SelectTrigger, { children: /* @__PURE__ */ jsx22(SelectValue, { placeholder: "Select..." }) }),
|
|
3193
|
+
/* @__PURE__ */ jsx22(SelectContent, { children: strOptions.map((opt) => /* @__PURE__ */ jsx22(SelectItem, { value: opt, children: opt }, opt)) })
|
|
3354
3194
|
]
|
|
3355
3195
|
}
|
|
3356
3196
|
)
|
|
@@ -3374,40 +3214,40 @@ function MultiSelectField({
|
|
|
3374
3214
|
},
|
|
3375
3215
|
[selected, onChange]
|
|
3376
3216
|
);
|
|
3377
|
-
return /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3217
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3218
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3379
3219
|
item.title,
|
|
3380
|
-
item.required && /* @__PURE__ */
|
|
3220
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3381
3221
|
] }),
|
|
3382
|
-
item.description && /* @__PURE__ */
|
|
3383
|
-
loading ? /* @__PURE__ */
|
|
3384
|
-
/* @__PURE__ */
|
|
3222
|
+
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3223
|
+
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3224
|
+
/* @__PURE__ */ jsx22(Loader25, { className: "size-4 animate-spin" }),
|
|
3385
3225
|
"Loading options..."
|
|
3386
|
-
] }) : /* @__PURE__ */
|
|
3387
|
-
/* @__PURE__ */
|
|
3226
|
+
] }) : /* @__PURE__ */ jsxs11(Popover, { open, onOpenChange: setOpen, children: [
|
|
3227
|
+
/* @__PURE__ */ jsx22(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
3388
3228
|
Button,
|
|
3389
3229
|
{
|
|
3390
3230
|
variant: "outline",
|
|
3391
3231
|
className: "w-full justify-between font-normal",
|
|
3392
3232
|
children: [
|
|
3393
|
-
selected.length > 0 ? /* @__PURE__ */
|
|
3394
|
-
/* @__PURE__ */
|
|
3233
|
+
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..." }),
|
|
3234
|
+
/* @__PURE__ */ jsx22(ChevronsUpDown2, { className: "ml-2 size-4 shrink-0 opacity-50" })
|
|
3395
3235
|
]
|
|
3396
3236
|
}
|
|
3397
3237
|
) }),
|
|
3398
|
-
/* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ jsx22(PopoverContent, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ jsxs11(Command, { children: [
|
|
3239
|
+
/* @__PURE__ */ jsx22(CommandInput, { placeholder: "Search..." }),
|
|
3240
|
+
/* @__PURE__ */ jsxs11(CommandList, { children: [
|
|
3241
|
+
/* @__PURE__ */ jsx22(CommandEmpty, { children: "No match." }),
|
|
3242
|
+
/* @__PURE__ */ jsx22(CommandGroup, { children: strOptions.map((opt) => {
|
|
3403
3243
|
const isSelected = selected.includes(opt);
|
|
3404
|
-
return /* @__PURE__ */
|
|
3244
|
+
return /* @__PURE__ */ jsxs11(
|
|
3405
3245
|
CommandItem,
|
|
3406
3246
|
{
|
|
3407
3247
|
value: opt,
|
|
3408
3248
|
onSelect: () => toggle(opt),
|
|
3409
3249
|
children: [
|
|
3410
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsx22(
|
|
3411
3251
|
Check3,
|
|
3412
3252
|
{
|
|
3413
3253
|
className: cn(
|
|
@@ -3433,12 +3273,12 @@ function ImageSelectField({
|
|
|
3433
3273
|
onChange
|
|
3434
3274
|
}) {
|
|
3435
3275
|
const images = item.lov ?? [];
|
|
3436
|
-
return /* @__PURE__ */
|
|
3437
|
-
/* @__PURE__ */
|
|
3276
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3277
|
+
/* @__PURE__ */ jsxs11(Label, { children: [
|
|
3438
3278
|
item.title,
|
|
3439
|
-
item.required && /* @__PURE__ */
|
|
3279
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3440
3280
|
] }),
|
|
3441
|
-
/* @__PURE__ */
|
|
3281
|
+
/* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-3", children: images.map((url) => /* @__PURE__ */ jsxs11(
|
|
3442
3282
|
"button",
|
|
3443
3283
|
{
|
|
3444
3284
|
type: "button",
|
|
@@ -3448,8 +3288,8 @@ function ImageSelectField({
|
|
|
3448
3288
|
value === url ? "border-primary ring-2 ring-primary/30" : "border-border hover:border-primary/50"
|
|
3449
3289
|
),
|
|
3450
3290
|
children: [
|
|
3451
|
-
/* @__PURE__ */
|
|
3452
|
-
value === url && /* @__PURE__ */
|
|
3291
|
+
/* @__PURE__ */ jsx22("img", { src: url, alt: "", className: "size-20 object-cover" }),
|
|
3292
|
+
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
3293
|
]
|
|
3454
3294
|
},
|
|
3455
3295
|
url
|
|
@@ -3461,23 +3301,23 @@ function BooleanField({
|
|
|
3461
3301
|
value,
|
|
3462
3302
|
onChange
|
|
3463
3303
|
}) {
|
|
3464
|
-
return /* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3304
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 py-1", children: [
|
|
3305
|
+
/* @__PURE__ */ jsx22(
|
|
3466
3306
|
Checkbox,
|
|
3467
3307
|
{
|
|
3468
3308
|
checked: !!value,
|
|
3469
3309
|
onCheckedChange: (checked) => onChange(!!checked)
|
|
3470
3310
|
}
|
|
3471
3311
|
),
|
|
3472
|
-
/* @__PURE__ */
|
|
3312
|
+
/* @__PURE__ */ jsxs11(Label, { className: "cursor-pointer", onClick: () => onChange(!value), children: [
|
|
3473
3313
|
item.title,
|
|
3474
|
-
item.required && /* @__PURE__ */
|
|
3314
|
+
item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
|
|
3475
3315
|
] })
|
|
3476
3316
|
] });
|
|
3477
3317
|
}
|
|
3478
3318
|
|
|
3479
3319
|
// src/Automations/ProductAutomation.tsx
|
|
3480
|
-
import { Fragment as Fragment4, jsx as
|
|
3320
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3481
3321
|
function ProductAutomation({
|
|
3482
3322
|
storeId,
|
|
3483
3323
|
workspaceId,
|
|
@@ -3650,18 +3490,18 @@ function ProductAutomation({
|
|
|
3650
3490
|
const filtered = searchQuery ? unique.filter(
|
|
3651
3491
|
(a) => a.display_name?.toLowerCase().includes(searchQuery.toLowerCase()) || a.automation.toLowerCase().includes(searchQuery.toLowerCase())
|
|
3652
3492
|
) : null;
|
|
3653
|
-
return /* @__PURE__ */
|
|
3654
|
-
/* @__PURE__ */
|
|
3655
|
-
/* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3657
|
-
/* @__PURE__ */
|
|
3493
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3494
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3495
|
+
/* @__PURE__ */ jsx23(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" }) }),
|
|
3496
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: "Automations" }),
|
|
3497
|
+
/* @__PURE__ */ jsxs12(Badge, { variant: "secondary", children: [
|
|
3658
3498
|
productsCount,
|
|
3659
3499
|
" products"
|
|
3660
3500
|
] })
|
|
3661
3501
|
] }),
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3502
|
+
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
3503
|
+
/* @__PURE__ */ jsx23(Search4, { className: "absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
|
|
3504
|
+
/* @__PURE__ */ jsx23(
|
|
3665
3505
|
Input,
|
|
3666
3506
|
{
|
|
3667
3507
|
placeholder: "Search automations...",
|
|
@@ -3671,12 +3511,12 @@ function ProductAutomation({
|
|
|
3671
3511
|
}
|
|
3672
3512
|
)
|
|
3673
3513
|
] }),
|
|
3674
|
-
/* @__PURE__ */
|
|
3675
|
-
/* @__PURE__ */
|
|
3676
|
-
/* @__PURE__ */
|
|
3677
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-4 border-b px-2 pb-2 text-xs font-medium text-muted-foreground", children: [
|
|
3515
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[5]", children: "Automation" }),
|
|
3516
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[1.5] text-center", children: "Est. Time" }),
|
|
3517
|
+
/* @__PURE__ */ jsx23("span", { className: "flex-[1.5] text-center", children: "Credits" })
|
|
3678
3518
|
] }),
|
|
3679
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__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
3520
|
AutomationRow,
|
|
3681
3521
|
{
|
|
3682
3522
|
item,
|
|
@@ -3684,8 +3524,8 @@ function ProductAutomation({
|
|
|
3684
3524
|
onClick: () => setSelected(item)
|
|
3685
3525
|
},
|
|
3686
3526
|
item.automation
|
|
3687
|
-
)) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */
|
|
3688
|
-
/* @__PURE__ */
|
|
3527
|
+
)) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */ jsxs12("div", { children: [
|
|
3528
|
+
/* @__PURE__ */ jsxs12(
|
|
3689
3529
|
"button",
|
|
3690
3530
|
{
|
|
3691
3531
|
type: "button",
|
|
@@ -3695,8 +3535,8 @@ function ProductAutomation({
|
|
|
3695
3535
|
className: "flex w-full items-center justify-between px-2 py-2 text-sm font-semibold text-muted-foreground hover:text-foreground",
|
|
3696
3536
|
children: [
|
|
3697
3537
|
group,
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
|
|
3538
|
+
/* @__PURE__ */ jsx23(
|
|
3539
|
+
ChevronDown2,
|
|
3700
3540
|
{
|
|
3701
3541
|
className: cn(
|
|
3702
3542
|
"size-4 transition-transform",
|
|
@@ -3707,7 +3547,7 @@ function ProductAutomation({
|
|
|
3707
3547
|
]
|
|
3708
3548
|
}
|
|
3709
3549
|
),
|
|
3710
|
-
expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */
|
|
3550
|
+
expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */ jsx23(
|
|
3711
3551
|
AutomationRow,
|
|
3712
3552
|
{
|
|
3713
3553
|
item,
|
|
@@ -3719,15 +3559,15 @@ function ProductAutomation({
|
|
|
3719
3559
|
] }, group)) })
|
|
3720
3560
|
] });
|
|
3721
3561
|
}
|
|
3722
|
-
return /* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
3562
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3563
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3564
|
+
/* @__PURE__ */ jsx23(Button, { variant: "ghost", size: "icon", onClick: () => setSelected(null), children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" }) }),
|
|
3565
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: selected.display_name })
|
|
3726
3566
|
] }),
|
|
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__ */
|
|
3567
|
+
selected.preview && /* @__PURE__ */ jsxs12("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
|
|
3568
|
+
selected.preview.info_text.map((text, i) => /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: text }, i)),
|
|
3569
|
+
selected.preview.media.length > 0 && /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-2 pt-1", children: selected.preview.media.map(
|
|
3570
|
+
(m, i) => m.type === "image" ? /* @__PURE__ */ jsx23(
|
|
3731
3571
|
"img",
|
|
3732
3572
|
{
|
|
3733
3573
|
src: m.src,
|
|
@@ -3738,8 +3578,8 @@ function ProductAutomation({
|
|
|
3738
3578
|
) : null
|
|
3739
3579
|
) })
|
|
3740
3580
|
] }),
|
|
3741
|
-
/* @__PURE__ */
|
|
3742
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ jsx23(Separator2, {}),
|
|
3582
|
+
/* @__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
3583
|
SchemaFieldRenderer,
|
|
3744
3584
|
{
|
|
3745
3585
|
schema,
|
|
@@ -3749,26 +3589,26 @@ function ProductAutomation({
|
|
|
3749
3589
|
onConfigChange: handleConfigChange
|
|
3750
3590
|
}
|
|
3751
3591
|
) }),
|
|
3752
|
-
/* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
3754
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx23(Separator2, {}),
|
|
3593
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
3594
|
+
/* @__PURE__ */ jsx23(
|
|
3755
3595
|
Button,
|
|
3756
3596
|
{
|
|
3757
3597
|
onClick: handleRun,
|
|
3758
3598
|
disabled: !isRunAllowed() || applying,
|
|
3759
3599
|
className: "flex-1",
|
|
3760
|
-
children: applying ? /* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
3600
|
+
children: applying ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
3601
|
+
/* @__PURE__ */ jsx23(Loader26, { className: "size-4 animate-spin" }),
|
|
3762
3602
|
"Applying..."
|
|
3763
|
-
] }) : /* @__PURE__ */
|
|
3764
|
-
/* @__PURE__ */
|
|
3603
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
3604
|
+
/* @__PURE__ */ jsx23(Play, { className: "size-4" }),
|
|
3765
3605
|
"Run Automation"
|
|
3766
3606
|
] })
|
|
3767
3607
|
}
|
|
3768
3608
|
),
|
|
3769
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: () => setSelected(null), children: "Cancel" })
|
|
3770
3610
|
] }),
|
|
3771
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__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
3612
|
] });
|
|
3773
3613
|
}
|
|
3774
3614
|
function AutomationRow({
|
|
@@ -3778,19 +3618,19 @@ function AutomationRow({
|
|
|
3778
3618
|
}) {
|
|
3779
3619
|
const estTime = item.estimate_time_saved ? formatTimeSaved(item.estimate_time_saved * productsCount) : "\u2014";
|
|
3780
3620
|
const credits = item.credits ? Math.ceil(item.credits * productsCount) : 0;
|
|
3781
|
-
return /* @__PURE__ */
|
|
3621
|
+
return /* @__PURE__ */ jsxs12(
|
|
3782
3622
|
"button",
|
|
3783
3623
|
{
|
|
3784
3624
|
type: "button",
|
|
3785
3625
|
onClick,
|
|
3786
3626
|
className: "flex w-full items-center gap-4 rounded-md px-2 py-2.5 text-left hover:bg-accent",
|
|
3787
3627
|
children: [
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */
|
|
3790
|
-
item.description && /* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-[5] min-w-0", children: [
|
|
3629
|
+
/* @__PURE__ */ jsx23("div", { className: "text-sm font-medium", children: item.display_name }),
|
|
3630
|
+
item.description && /* @__PURE__ */ jsx23("div", { className: "truncate text-xs text-muted-foreground", children: item.description })
|
|
3791
3631
|
] }),
|
|
3792
|
-
/* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: estTime }),
|
|
3633
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: credits })
|
|
3794
3634
|
]
|
|
3795
3635
|
}
|
|
3796
3636
|
);
|
|
@@ -3804,7 +3644,7 @@ function formatTimeSaved(totalSeconds) {
|
|
|
3804
3644
|
// src/Automations/StoreAutomation.tsx
|
|
3805
3645
|
import { useState as useState10, useEffect as useEffect6, useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
3806
3646
|
import { ArrowLeft as ArrowLeft4, Settings } from "lucide-react";
|
|
3807
|
-
import { Fragment as Fragment5, jsx as
|
|
3647
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3808
3648
|
function StoreAutomation({
|
|
3809
3649
|
storeId,
|
|
3810
3650
|
channelsWithVersion,
|
|
@@ -3861,7 +3701,7 @@ function StoreAutomation({
|
|
|
3861
3701
|
setSelectedAutomation(null);
|
|
3862
3702
|
};
|
|
3863
3703
|
if (selectedAutomation) {
|
|
3864
|
-
return /* @__PURE__ */
|
|
3704
|
+
return /* @__PURE__ */ jsx24(
|
|
3865
3705
|
AutomationConfigEditor,
|
|
3866
3706
|
{
|
|
3867
3707
|
storeId,
|
|
@@ -3873,46 +3713,46 @@ function StoreAutomation({
|
|
|
3873
3713
|
}
|
|
3874
3714
|
);
|
|
3875
3715
|
}
|
|
3876
|
-
return /* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
onClose && /* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3716
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3717
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3718
|
+
onClose && /* @__PURE__ */ jsx24(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx24(ArrowLeft4, { className: "size-4" }) }),
|
|
3719
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-base font-semibold", children: "Default Store Automations" })
|
|
3880
3720
|
] }),
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
loading ? /* @__PURE__ */
|
|
3883
|
-
/* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3885
|
-
/* @__PURE__ */
|
|
3886
|
-
/* @__PURE__ */
|
|
3887
|
-
/* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3722
|
+
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: [
|
|
3723
|
+
/* @__PURE__ */ jsx24(TableHeader, { children: /* @__PURE__ */ jsxs13(TableRow, { children: [
|
|
3724
|
+
/* @__PURE__ */ jsx24(TableHead, { children: "Automation" }),
|
|
3725
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-24 text-center", children: "Avg. Time" }),
|
|
3726
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-28 text-center", children: "Credits/Prd" }),
|
|
3727
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-28 text-center", children: "Status" }),
|
|
3728
|
+
/* @__PURE__ */ jsx24(TableHead, { className: "w-12" })
|
|
3889
3729
|
] }) }),
|
|
3890
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ jsx24(TableBody, { children: automations.map((a) => /* @__PURE__ */ jsxs13(
|
|
3891
3731
|
TableRow,
|
|
3892
3732
|
{
|
|
3893
3733
|
className: "cursor-pointer",
|
|
3894
3734
|
onClick: () => setSelectedAutomation(a),
|
|
3895
3735
|
children: [
|
|
3896
|
-
/* @__PURE__ */
|
|
3897
|
-
/* @__PURE__ */
|
|
3898
|
-
a.description && /* @__PURE__ */
|
|
3736
|
+
/* @__PURE__ */ jsxs13(TableCell, { children: [
|
|
3737
|
+
/* @__PURE__ */ jsx24("div", { className: "text-sm font-medium", children: a.display_name }),
|
|
3738
|
+
a.description && /* @__PURE__ */ jsx24("div", { className: "text-xs text-muted-foreground", children: a.description })
|
|
3899
3739
|
] }),
|
|
3900
|
-
/* @__PURE__ */
|
|
3901
|
-
/* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3740
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center text-xs", children: a.estimate_run_time ?? "\u2014" }),
|
|
3741
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center text-xs", children: a.credits ?? "\u2014" }),
|
|
3742
|
+
/* @__PURE__ */ jsx24(TableCell, { className: "text-center", children: /* @__PURE__ */ jsxs13(
|
|
3903
3743
|
"div",
|
|
3904
3744
|
{
|
|
3905
3745
|
className: "flex items-center justify-center gap-2",
|
|
3906
3746
|
onClick: (e) => e.stopPropagation(),
|
|
3907
3747
|
children: [
|
|
3908
|
-
/* @__PURE__ */
|
|
3748
|
+
/* @__PURE__ */ jsx24(
|
|
3909
3749
|
Switch,
|
|
3910
3750
|
{
|
|
3911
3751
|
checked: a.isEnabled,
|
|
3912
3752
|
onCheckedChange: () => toggleAutomation(a.automation)
|
|
3913
3753
|
}
|
|
3914
3754
|
),
|
|
3915
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ jsx24(
|
|
3916
3756
|
Badge,
|
|
3917
3757
|
{
|
|
3918
3758
|
variant: a.isEnabled ? "default" : "secondary",
|
|
@@ -3923,16 +3763,16 @@ function StoreAutomation({
|
|
|
3923
3763
|
]
|
|
3924
3764
|
}
|
|
3925
3765
|
) }),
|
|
3926
|
-
/* @__PURE__ */
|
|
3766
|
+
/* @__PURE__ */ jsx24(TableCell, { children: /* @__PURE__ */ jsx24(Settings, { className: "size-4 text-muted-foreground" }) })
|
|
3927
3767
|
]
|
|
3928
3768
|
},
|
|
3929
3769
|
a.automation
|
|
3930
3770
|
)) })
|
|
3931
3771
|
] }) }),
|
|
3932
|
-
/* @__PURE__ */
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
onClose && /* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3773
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex justify-end gap-2", children: [
|
|
3774
|
+
onClose && /* @__PURE__ */ jsx24(Button, { variant: "outline", onClick: onClose, children: "Cancel" }),
|
|
3775
|
+
/* @__PURE__ */ jsx24(Button, { onClick: handleSave, children: "Save Changes" })
|
|
3936
3776
|
] })
|
|
3937
3777
|
] });
|
|
3938
3778
|
}
|
|
@@ -4013,36 +3853,36 @@ function AutomationConfigEditor({
|
|
|
4013
3853
|
},
|
|
4014
3854
|
[]
|
|
4015
3855
|
);
|
|
4016
|
-
return /* @__PURE__ */
|
|
4017
|
-
/* @__PURE__ */
|
|
4018
|
-
/* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex h-full flex-col gap-3 p-3", children: [
|
|
3857
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3858
|
+
/* @__PURE__ */ jsx24(
|
|
4019
3859
|
Button,
|
|
4020
3860
|
{
|
|
4021
3861
|
variant: "ghost",
|
|
4022
3862
|
size: "icon",
|
|
4023
3863
|
onClick: () => onClose(automation, configs),
|
|
4024
|
-
children: /* @__PURE__ */
|
|
3864
|
+
children: /* @__PURE__ */ jsx24(ArrowLeft4, { className: "size-4" })
|
|
4025
3865
|
}
|
|
4026
3866
|
),
|
|
4027
|
-
/* @__PURE__ */
|
|
3867
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-base font-semibold", children: automation.display_name })
|
|
4028
3868
|
] }),
|
|
4029
|
-
/* @__PURE__ */
|
|
4030
|
-
/* @__PURE__ */
|
|
3869
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-4 text-sm", children: [
|
|
3870
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
|
|
4031
3871
|
"Est. time: ",
|
|
4032
|
-
/* @__PURE__ */
|
|
3872
|
+
/* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.estimate_run_time ?? "\u2014" })
|
|
4033
3873
|
] }),
|
|
4034
|
-
/* @__PURE__ */
|
|
3874
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
|
|
4035
3875
|
"Credits/prd: ",
|
|
4036
|
-
/* @__PURE__ */
|
|
3876
|
+
/* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.credits ?? "\u2014" })
|
|
4037
3877
|
] })
|
|
4038
3878
|
] }),
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3880
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3881
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm font-medium", children: automation.isEnabled ? "Enabled" : "Disabled" }),
|
|
3882
|
+
/* @__PURE__ */ jsx24(Switch, { checked: automation.isEnabled, onCheckedChange: onToggle })
|
|
4043
3883
|
] }),
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3885
|
+
/* @__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
3886
|
SchemaFieldRenderer,
|
|
4047
3887
|
{
|
|
4048
3888
|
schema,
|
|
@@ -4051,13 +3891,13 @@ function AutomationConfigEditor({
|
|
|
4051
3891
|
loadingOptions,
|
|
4052
3892
|
onConfigChange: handleConfigChange
|
|
4053
3893
|
}
|
|
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__ */
|
|
3894
|
+
) : /* @__PURE__ */ jsx24("p", { className: "py-4 text-center text-sm text-muted-foreground", children: "Enable this automation to configure it." }) }),
|
|
3895
|
+
automation.preview && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3896
|
+
/* @__PURE__ */ jsx24(Separator2, {}),
|
|
3897
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
|
|
3898
|
+
automation.preview.info_text.map((text, i) => /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: text }, i)),
|
|
3899
|
+
automation.preview.media.length > 0 && /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2 pt-1", children: automation.preview.media.map(
|
|
3900
|
+
(m, i) => m.type === "image" ? /* @__PURE__ */ jsx24(
|
|
4061
3901
|
"img",
|
|
4062
3902
|
{
|
|
4063
3903
|
src: m.src,
|
|
@@ -4073,7 +3913,7 @@ function AutomationConfigEditor({
|
|
|
4073
3913
|
}
|
|
4074
3914
|
|
|
4075
3915
|
// src/CatalogixChat.tsx
|
|
4076
|
-
import { jsx as
|
|
3916
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4077
3917
|
var SECTION_MAP = {
|
|
4078
3918
|
"catalogix:create-store": "create_store",
|
|
4079
3919
|
create_or_select_store: "create_store",
|
|
@@ -4103,7 +3943,7 @@ function CatalogixChat(props) {
|
|
|
4103
3943
|
configureApi({ catalogixBaseUrl });
|
|
4104
3944
|
}, [catalogixBaseUrl]);
|
|
4105
3945
|
if (section === "select_products") {
|
|
4106
|
-
return /* @__PURE__ */
|
|
3946
|
+
return /* @__PURE__ */ jsx25(
|
|
4107
3947
|
SelectProducts,
|
|
4108
3948
|
{
|
|
4109
3949
|
workspaceId,
|
|
@@ -4119,7 +3959,7 @@ function CatalogixChat(props) {
|
|
|
4119
3959
|
);
|
|
4120
3960
|
}
|
|
4121
3961
|
if (section === "create_store") {
|
|
4122
|
-
return /* @__PURE__ */
|
|
3962
|
+
return /* @__PURE__ */ jsx25(
|
|
4123
3963
|
CreateStore,
|
|
4124
3964
|
{
|
|
4125
3965
|
workspaceId,
|
|
@@ -4133,7 +3973,7 @@ function CatalogixChat(props) {
|
|
|
4133
3973
|
);
|
|
4134
3974
|
}
|
|
4135
3975
|
if (section === "map_attributes") {
|
|
4136
|
-
return /* @__PURE__ */
|
|
3976
|
+
return /* @__PURE__ */ jsx25(
|
|
4137
3977
|
MapAttributesChat,
|
|
4138
3978
|
{
|
|
4139
3979
|
mappingData: uiProps.mappingData ?? [],
|
|
@@ -4149,7 +3989,7 @@ function CatalogixChat(props) {
|
|
|
4149
3989
|
);
|
|
4150
3990
|
}
|
|
4151
3991
|
if (section === "trigger_automation") {
|
|
4152
|
-
return /* @__PURE__ */
|
|
3992
|
+
return /* @__PURE__ */ jsx25(
|
|
4153
3993
|
ProductAutomation,
|
|
4154
3994
|
{
|
|
4155
3995
|
storeId,
|
|
@@ -4169,7 +4009,7 @@ function CatalogixChat(props) {
|
|
|
4169
4009
|
);
|
|
4170
4010
|
}
|
|
4171
4011
|
if (section === "automations") {
|
|
4172
|
-
return /* @__PURE__ */
|
|
4012
|
+
return /* @__PURE__ */ jsx25(
|
|
4173
4013
|
StoreAutomation,
|
|
4174
4014
|
{
|
|
4175
4015
|
storeId,
|
|
@@ -4180,11 +4020,11 @@ function CatalogixChat(props) {
|
|
|
4180
4020
|
}
|
|
4181
4021
|
);
|
|
4182
4022
|
}
|
|
4183
|
-
return /* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ jsx25("div", { className: "p-4 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxs14("p", { children: [
|
|
4024
|
+
/* @__PURE__ */ jsx25("strong", { children: "Catalogix" }),
|
|
4185
4025
|
" \u2014 unknown section:",
|
|
4186
4026
|
" ",
|
|
4187
|
-
/* @__PURE__ */
|
|
4027
|
+
/* @__PURE__ */ jsx25("code", { children: section || "(none)" })
|
|
4188
4028
|
] }) });
|
|
4189
4029
|
}
|
|
4190
4030
|
|