@streamoid/catalogix-chat 0.2.3 → 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.js CHANGED
@@ -2434,9 +2434,429 @@ function CreateStore({
2434
2434
  ] });
2435
2435
  }
2436
2436
 
2437
+ // src/MapAttributes/index.tsx
2438
+ import { useState as useState7, useMemo as useMemo5, useCallback as useCallback5 } from "react";
2439
+ import {
2440
+ Check as Check2,
2441
+ X,
2442
+ ChevronRight as ChevronRight2,
2443
+ Pencil as Pencil2,
2444
+ Search as Search3,
2445
+ ArrowRight,
2446
+ ArrowLeft as ArrowLeft2,
2447
+ Send
2448
+ } from "lucide-react";
2449
+ import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
2450
+ function getAllAttributes(mpAttributes) {
2451
+ return Object.values(mpAttributes).flat();
2452
+ }
2453
+ function AttributeRow({
2454
+ item,
2455
+ index,
2456
+ allAttributes,
2457
+ onMap,
2458
+ onConfirm,
2459
+ onIgnore,
2460
+ onEdit,
2461
+ onUnmap
2462
+ }) {
2463
+ const [popoverOpen, setPopoverOpen] = useState7(false);
2464
+ const hasMappedCols = item.mappedCols.length > 0 || item.customCols.length > 0;
2465
+ const availableAttributes = useMemo5(() => {
2466
+ const mapped = /* @__PURE__ */ new Set([...item.mappedCols, ...item.customCols]);
2467
+ return allAttributes.filter((a) => !mapped.has(a));
2468
+ }, [allAttributes, item.mappedCols, item.customCols]);
2469
+ if (item.isConfirmed) {
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
+ )
2484
+ ] });
2485
+ }
2486
+ if (item.isIgnored) {
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
+ )
2499
+ ] });
2500
+ }
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: [
2512
+ col,
2513
+ /* @__PURE__ */ jsx21(
2514
+ "button",
2515
+ {
2516
+ type: "button",
2517
+ onClick: () => onUnmap(index, attrIdx),
2518
+ className: "ml-0.5 rounded-full hover:bg-muted",
2519
+ children: /* @__PURE__ */ jsx21(X, { className: "size-2.5" })
2520
+ }
2521
+ )
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",
2561
+ {
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" })
2567
+ }
2568
+ ),
2569
+ /* @__PURE__ */ jsx21(
2570
+ "button",
2571
+ {
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" })
2577
+ }
2578
+ )
2579
+ ] })
2580
+ ] });
2581
+ }
2582
+ function ValueMappingPanel({
2583
+ data,
2584
+ valuesOntologyAttributes,
2585
+ uniqueValues,
2586
+ onValueChange
2587
+ }) {
2588
+ const lovItems = useMemo5(() => {
2589
+ const items = [];
2590
+ data.forEach((item, itemIndex) => {
2591
+ if (item.isIgnored || !item.isConfirmed) return;
2592
+ item.mappedCols.forEach((attr) => {
2593
+ if (!valuesOntologyAttributes.includes(attr)) return;
2594
+ const rawVals = uniqueValues[item.feedCol] || [];
2595
+ if (rawVals.length === 0) return;
2596
+ const existing = item.mappedValues[attr] || {};
2597
+ const valueMap = {};
2598
+ rawVals.forEach((v) => {
2599
+ valueMap[v] = existing[v] ?? null;
2600
+ });
2601
+ items.push({
2602
+ itemIndex,
2603
+ feedCol: item.feedCol,
2604
+ attribute: attr,
2605
+ rawValues: rawVals,
2606
+ mappedValues: valueMap,
2607
+ totalCount: rawVals.length,
2608
+ mappedCount: Object.values(valueMap).filter((v) => v !== null).length
2609
+ });
2610
+ });
2611
+ });
2612
+ return items;
2613
+ }, [data, valuesOntologyAttributes, uniqueValues]);
2614
+ if (lovItems.length === 0) {
2615
+ return /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center py-6 text-xs text-muted-foreground", children: "No value mapping required." });
2616
+ }
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
+ )
2636
+ ] }),
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)) });
2668
+ }
2669
+ function MapAttributesChat({
2670
+ mappingData: initialData,
2671
+ mpAttributes,
2672
+ valuesOntologyAttributes,
2673
+ uniqueValues,
2674
+ submitted,
2675
+ onSubmit
2676
+ }) {
2677
+ const [data, setData] = useState7(
2678
+ () => initialData.map((item) => ({ ...item }))
2679
+ );
2680
+ const [step, setStep] = useState7("attributes");
2681
+ const allAttributes = useMemo5(
2682
+ () => getAllAttributes(mpAttributes),
2683
+ [mpAttributes]
2684
+ );
2685
+ const progress = useMemo5(() => {
2686
+ const total = data.length;
2687
+ const done = data.filter((i) => i.isConfirmed || i.isIgnored).length;
2688
+ return { total, done, percent: total > 0 ? done / total * 100 : 0 };
2689
+ }, [data]);
2690
+ const hasLovAttributes = useMemo5(
2691
+ () => data.some(
2692
+ (item) => item.isConfirmed && item.mappedCols.some((c) => valuesOntologyAttributes.includes(c))
2693
+ ),
2694
+ [data, valuesOntologyAttributes]
2695
+ );
2696
+ const handleMap = useCallback5((index, attribute) => {
2697
+ setData((prev) => {
2698
+ const next = [...prev];
2699
+ const item = { ...next[index] };
2700
+ item.mappedCols = [...item.mappedCols, attribute];
2701
+ next[index] = item;
2702
+ return next;
2703
+ });
2704
+ }, []);
2705
+ const handleUnmap = useCallback5((index, attrIndex) => {
2706
+ setData((prev) => {
2707
+ const next = [...prev];
2708
+ const item = { ...next[index] };
2709
+ item.mappedCols = item.mappedCols.filter((_, i) => i !== attrIndex);
2710
+ next[index] = item;
2711
+ return next;
2712
+ });
2713
+ }, []);
2714
+ const handleConfirm = useCallback5((index) => {
2715
+ setData((prev) => {
2716
+ const next = [...prev];
2717
+ next[index] = { ...next[index], isConfirmed: true, isIgnored: false };
2718
+ return next;
2719
+ });
2720
+ }, []);
2721
+ const handleIgnore = useCallback5((index) => {
2722
+ setData((prev) => {
2723
+ const next = [...prev];
2724
+ next[index] = { ...next[index], isIgnored: true, isConfirmed: false };
2725
+ return next;
2726
+ });
2727
+ }, []);
2728
+ const handleEdit = useCallback5((index) => {
2729
+ setData((prev) => {
2730
+ const next = [...prev];
2731
+ next[index] = { ...next[index], isConfirmed: false, isIgnored: false };
2732
+ return next;
2733
+ });
2734
+ }, []);
2735
+ const handleValueChange = useCallback5(
2736
+ (itemIndex, attribute, rawValue, mappedValue) => {
2737
+ setData((prev) => {
2738
+ const next = [...prev];
2739
+ const item = { ...next[itemIndex] };
2740
+ const attrValues = { ...item.mappedValues[attribute] || {} };
2741
+ attrValues[rawValue] = mappedValue;
2742
+ item.mappedValues = {
2743
+ ...item.mappedValues,
2744
+ [attribute]: attrValues
2745
+ };
2746
+ next[itemIndex] = item;
2747
+ return next;
2748
+ });
2749
+ },
2750
+ []
2751
+ );
2752
+ const handleSubmit = useCallback5(() => {
2753
+ onSubmit(data);
2754
+ }, [data, onSubmit]);
2755
+ if (submitted) {
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
+ ] })
2766
+ ] })
2767
+ ] });
2768
+ }
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" })
2774
+ ] }),
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
+ ] })
2788
+ ] })
2789
+ ] }),
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,
2792
+ {
2793
+ item,
2794
+ index: idx,
2795
+ allAttributes,
2796
+ onMap: handleMap,
2797
+ onConfirm: handleConfirm,
2798
+ onIgnore: handleIgnore,
2799
+ onEdit: handleEdit,
2800
+ onUnmap: handleUnmap
2801
+ },
2802
+ idx
2803
+ )) }) : /* @__PURE__ */ jsx21(
2804
+ ValueMappingPanel,
2805
+ {
2806
+ data,
2807
+ valuesOntologyAttributes,
2808
+ uniqueValues,
2809
+ onValueChange: handleValueChange
2810
+ }
2811
+ ) }),
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(
2814
+ Button,
2815
+ {
2816
+ variant: "ghost",
2817
+ size: "sm",
2818
+ onClick: () => setStep("attributes"),
2819
+ className: "h-7 text-xs text-muted-foreground hover:text-foreground",
2820
+ children: [
2821
+ /* @__PURE__ */ jsx21(ArrowLeft2, { className: "mr-1 size-3" }),
2822
+ "Back"
2823
+ ]
2824
+ }
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
+ )
2853
+ ] })
2854
+ ] });
2855
+ }
2856
+
2437
2857
  // src/Automations/ProductAutomation.tsx
2438
- import { useState as useState8, useEffect as useEffect5, useCallback as useCallback6, useRef as useRef5 } from "react";
2439
- import { ArrowLeft as ArrowLeft2, Search as Search3, Loader2 as Loader26, ChevronDown as ChevronDown2, Play } from "lucide-react";
2858
+ import { useState as useState9, useEffect as useEffect5, useCallback as useCallback7, useRef as useRef5 } from "react";
2859
+ import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader26, ChevronDown as ChevronDown2, Play } from "lucide-react";
2440
2860
 
2441
2861
  // src/Automations/api.ts
2442
2862
  async function fetchAutomationList(storeId, tag, includeGroupings = false) {
@@ -2562,9 +2982,9 @@ function parseLovResponse(response, curl, configs) {
2562
2982
  }
2563
2983
 
2564
2984
  // src/Automations/SchemaFieldRenderer.tsx
2565
- import { useCallback as useCallback5, useState as useState7 } from "react";
2566
- import { Check as Check2, ChevronsUpDown as ChevronsUpDown2, Loader2 as Loader25, X } from "lucide-react";
2567
- import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
2985
+ import { useCallback as useCallback6, useState as useState8 } from "react";
2986
+ import { Check as Check3, ChevronsUpDown as ChevronsUpDown2, Loader2 as Loader25, X as X2 } from "lucide-react";
2987
+ import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
2568
2988
  function SchemaFieldRenderer({
2569
2989
  schema,
2570
2990
  configs,
@@ -2572,12 +2992,12 @@ function SchemaFieldRenderer({
2572
2992
  loadingOptions,
2573
2993
  onConfigChange
2574
2994
  }) {
2575
- return /* @__PURE__ */ jsx21("div", { className: "space-y-4", children: schema.map((item, idx) => {
2995
+ return /* @__PURE__ */ jsx22("div", { className: "space-y-4", children: schema.map((item, idx) => {
2576
2996
  if (!shouldRenderAttribute(item.render_if, configs)) return null;
2577
2997
  if (item.fieldtype === "object_array" && item.mapping_parameters) {
2578
- return /* @__PURE__ */ jsx21("div", { className: "space-y-3", children: item.mapping_parameters.map((sub, subIdx) => {
2998
+ return /* @__PURE__ */ jsx22("div", { className: "space-y-3", children: item.mapping_parameters.map((sub, subIdx) => {
2579
2999
  const value = configs[item.payload_key]?.[0] != null ? configs[item.payload_key][0]?.[sub.payload_key] : void 0;
2580
- return /* @__PURE__ */ jsx21(
3000
+ return /* @__PURE__ */ jsx22(
2581
3001
  FieldSwitch,
2582
3002
  {
2583
3003
  item: sub,
@@ -2591,7 +3011,7 @@ function SchemaFieldRenderer({
2591
3011
  );
2592
3012
  }) }, idx);
2593
3013
  }
2594
- return /* @__PURE__ */ jsx21(
3014
+ return /* @__PURE__ */ jsx22(
2595
3015
  FieldSwitch,
2596
3016
  {
2597
3017
  item,
@@ -2616,7 +3036,7 @@ function FieldSwitch({
2616
3036
  if (!shouldRenderAttribute(item.render_if, configs)) return null;
2617
3037
  switch (item.fieldtype) {
2618
3038
  case "freetext":
2619
- return /* @__PURE__ */ jsx21(
3039
+ return /* @__PURE__ */ jsx22(
2620
3040
  FreetextField,
2621
3041
  {
2622
3042
  item,
@@ -2625,7 +3045,7 @@ function FieldSwitch({
2625
3045
  }
2626
3046
  );
2627
3047
  case "freetext_list":
2628
- return /* @__PURE__ */ jsx21(
3048
+ return /* @__PURE__ */ jsx22(
2629
3049
  FreetextListField,
2630
3050
  {
2631
3051
  item,
@@ -2634,7 +3054,7 @@ function FieldSwitch({
2634
3054
  }
2635
3055
  );
2636
3056
  case "lov_singleselect":
2637
- return /* @__PURE__ */ jsx21(
3057
+ return /* @__PURE__ */ jsx22(
2638
3058
  SingleSelectField,
2639
3059
  {
2640
3060
  item,
@@ -2645,7 +3065,7 @@ function FieldSwitch({
2645
3065
  }
2646
3066
  );
2647
3067
  case "lov_multipleselect":
2648
- return /* @__PURE__ */ jsx21(
3068
+ return /* @__PURE__ */ jsx22(
2649
3069
  MultiSelectField,
2650
3070
  {
2651
3071
  item,
@@ -2656,7 +3076,7 @@ function FieldSwitch({
2656
3076
  }
2657
3077
  );
2658
3078
  case "image_singleselect":
2659
- return /* @__PURE__ */ jsx21(
3079
+ return /* @__PURE__ */ jsx22(
2660
3080
  ImageSelectField,
2661
3081
  {
2662
3082
  item,
@@ -2665,7 +3085,7 @@ function FieldSwitch({
2665
3085
  }
2666
3086
  );
2667
3087
  case "boolean":
2668
- return /* @__PURE__ */ jsx21(
3088
+ return /* @__PURE__ */ jsx22(
2669
3089
  BooleanField,
2670
3090
  {
2671
3091
  item,
@@ -2682,13 +3102,13 @@ function FreetextField({
2682
3102
  value,
2683
3103
  onChange
2684
3104
  }) {
2685
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5", children: [
2686
- /* @__PURE__ */ jsxs10(Label, { children: [
3105
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
3106
+ /* @__PURE__ */ jsxs11(Label, { children: [
2687
3107
  item.title,
2688
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3108
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2689
3109
  ] }),
2690
- item.description && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: item.description }),
2691
- /* @__PURE__ */ jsx21(
3110
+ item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
3111
+ /* @__PURE__ */ jsx22(
2692
3112
  Input,
2693
3113
  {
2694
3114
  value: value ?? "",
@@ -2704,7 +3124,7 @@ function FreetextListField({
2704
3124
  value,
2705
3125
  onChange
2706
3126
  }) {
2707
- const [draft, setDraft] = useState7("");
3127
+ const [draft, setDraft] = useState8("");
2708
3128
  const keywords = value ?? [];
2709
3129
  const addKeyword = () => {
2710
3130
  const trimmed = draft.trim();
@@ -2713,14 +3133,14 @@ function FreetextListField({
2713
3133
  setDraft("");
2714
3134
  }
2715
3135
  };
2716
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5", children: [
2717
- /* @__PURE__ */ jsxs10(Label, { children: [
3136
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
3137
+ /* @__PURE__ */ jsxs11(Label, { children: [
2718
3138
  item.title,
2719
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3139
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2720
3140
  ] }),
2721
- item.description && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: item.description }),
2722
- /* @__PURE__ */ jsxs10("div", { className: "flex gap-2", children: [
2723
- /* @__PURE__ */ jsx21(
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(
2724
3144
  Input,
2725
3145
  {
2726
3146
  value: draft,
@@ -2729,17 +3149,17 @@ function FreetextListField({
2729
3149
  placeholder: "Type and press Enter"
2730
3150
  }
2731
3151
  ),
2732
- /* @__PURE__ */ jsx21(Button, { variant: "outline", size: "sm", onClick: addKeyword, type: "button", children: "Add" })
3152
+ /* @__PURE__ */ jsx22(Button, { variant: "outline", size: "sm", onClick: addKeyword, type: "button", children: "Add" })
2733
3153
  ] }),
2734
- keywords.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1.5 pt-1", children: keywords.map((kw) => /* @__PURE__ */ jsxs10(Badge, { variant: "secondary", className: "gap-1 pr-1", children: [
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: [
2735
3155
  kw,
2736
- /* @__PURE__ */ jsx21(
3156
+ /* @__PURE__ */ jsx22(
2737
3157
  "button",
2738
3158
  {
2739
3159
  type: "button",
2740
3160
  onClick: () => onChange(keywords.filter((k) => k !== kw)),
2741
3161
  className: "ml-0.5 rounded-full hover:bg-muted",
2742
- children: /* @__PURE__ */ jsx21(X, { className: "size-3" })
3162
+ children: /* @__PURE__ */ jsx22(X2, { className: "size-3" })
2743
3163
  }
2744
3164
  )
2745
3165
  ] }, kw)) })
@@ -2754,23 +3174,23 @@ function SingleSelectField({
2754
3174
  }) {
2755
3175
  const strOptions = Array.isArray(lovOptions) ? lovOptions.map(String) : [];
2756
3176
  const strValue = value != null ? String(value) : "";
2757
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5", children: [
2758
- /* @__PURE__ */ jsxs10(Label, { children: [
3177
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
3178
+ /* @__PURE__ */ jsxs11(Label, { children: [
2759
3179
  item.title,
2760
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3180
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2761
3181
  ] }),
2762
- item.description && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: item.description }),
2763
- loading ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
2764
- /* @__PURE__ */ jsx21(Loader25, { className: "size-4 animate-spin" }),
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" }),
2765
3185
  "Loading options..."
2766
- ] }) : /* @__PURE__ */ jsxs10(
3186
+ ] }) : /* @__PURE__ */ jsxs11(
2767
3187
  Select,
2768
3188
  {
2769
3189
  value: strValue,
2770
3190
  onValueChange: (v) => onChange(item.valuetype === "integer" ? Number(v) : v),
2771
3191
  children: [
2772
- /* @__PURE__ */ jsx21(SelectTrigger, { children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Select..." }) }),
2773
- /* @__PURE__ */ jsx21(SelectContent, { children: strOptions.map((opt) => /* @__PURE__ */ jsx21(SelectItem, { value: opt, children: opt }, opt)) })
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)) })
2774
3194
  ]
2775
3195
  }
2776
3196
  )
@@ -2783,10 +3203,10 @@ function MultiSelectField({
2783
3203
  loading,
2784
3204
  onChange
2785
3205
  }) {
2786
- const [open, setOpen] = useState7(false);
3206
+ const [open, setOpen] = useState8(false);
2787
3207
  const selected = value ?? [];
2788
3208
  const strOptions = Array.isArray(lovOptions) ? lovOptions.map(String) : [];
2789
- const toggle = useCallback5(
3209
+ const toggle = useCallback6(
2790
3210
  (opt) => {
2791
3211
  onChange(
2792
3212
  selected.includes(opt) ? selected.filter((s) => s !== opt) : [...selected, opt]
@@ -2794,41 +3214,41 @@ function MultiSelectField({
2794
3214
  },
2795
3215
  [selected, onChange]
2796
3216
  );
2797
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5", children: [
2798
- /* @__PURE__ */ jsxs10(Label, { children: [
3217
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
3218
+ /* @__PURE__ */ jsxs11(Label, { children: [
2799
3219
  item.title,
2800
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3220
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2801
3221
  ] }),
2802
- item.description && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: item.description }),
2803
- loading ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
2804
- /* @__PURE__ */ jsx21(Loader25, { className: "size-4 animate-spin" }),
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" }),
2805
3225
  "Loading options..."
2806
- ] }) : /* @__PURE__ */ jsxs10(Popover, { open, onOpenChange: setOpen, children: [
2807
- /* @__PURE__ */ jsx21(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
3226
+ ] }) : /* @__PURE__ */ jsxs11(Popover, { open, onOpenChange: setOpen, children: [
3227
+ /* @__PURE__ */ jsx22(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
2808
3228
  Button,
2809
3229
  {
2810
3230
  variant: "outline",
2811
3231
  className: "w-full justify-between font-normal",
2812
3232
  children: [
2813
- selected.length > 0 ? /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1", children: selected.map((s) => /* @__PURE__ */ jsx21(Badge, { variant: "secondary", className: "text-xs", children: s }, s)) }) : /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }),
2814
- /* @__PURE__ */ jsx21(ChevronsUpDown2, { className: "ml-2 size-4 shrink-0 opacity-50" })
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" })
2815
3235
  ]
2816
3236
  }
2817
3237
  ) }),
2818
- /* @__PURE__ */ jsx21(PopoverContent, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ jsxs10(Command, { children: [
2819
- /* @__PURE__ */ jsx21(CommandInput, { placeholder: "Search..." }),
2820
- /* @__PURE__ */ jsxs10(CommandList, { children: [
2821
- /* @__PURE__ */ jsx21(CommandEmpty, { children: "No match." }),
2822
- /* @__PURE__ */ jsx21(CommandGroup, { children: strOptions.map((opt) => {
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) => {
2823
3243
  const isSelected = selected.includes(opt);
2824
- return /* @__PURE__ */ jsxs10(
3244
+ return /* @__PURE__ */ jsxs11(
2825
3245
  CommandItem,
2826
3246
  {
2827
3247
  value: opt,
2828
3248
  onSelect: () => toggle(opt),
2829
3249
  children: [
2830
- /* @__PURE__ */ jsx21(
2831
- Check2,
3250
+ /* @__PURE__ */ jsx22(
3251
+ Check3,
2832
3252
  {
2833
3253
  className: cn(
2834
3254
  "mr-2 size-4",
@@ -2853,12 +3273,12 @@ function ImageSelectField({
2853
3273
  onChange
2854
3274
  }) {
2855
3275
  const images = item.lov ?? [];
2856
- return /* @__PURE__ */ jsxs10("div", { className: "space-y-1.5", children: [
2857
- /* @__PURE__ */ jsxs10(Label, { children: [
3276
+ return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
3277
+ /* @__PURE__ */ jsxs11(Label, { children: [
2858
3278
  item.title,
2859
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3279
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2860
3280
  ] }),
2861
- /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-3", children: images.map((url) => /* @__PURE__ */ jsxs10(
3281
+ /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-3", children: images.map((url) => /* @__PURE__ */ jsxs11(
2862
3282
  "button",
2863
3283
  {
2864
3284
  type: "button",
@@ -2868,8 +3288,8 @@ function ImageSelectField({
2868
3288
  value === url ? "border-primary ring-2 ring-primary/30" : "border-border hover:border-primary/50"
2869
3289
  ),
2870
3290
  children: [
2871
- /* @__PURE__ */ jsx21("img", { src: url, alt: "", className: "size-20 object-cover" }),
2872
- value === url && /* @__PURE__ */ jsx21("div", { className: "absolute right-1 top-1 rounded-full bg-primary p-0.5 text-primary-foreground", children: /* @__PURE__ */ jsx21(Check2, { className: "size-3" }) })
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" }) })
2873
3293
  ]
2874
3294
  },
2875
3295
  url
@@ -2881,23 +3301,23 @@ function BooleanField({
2881
3301
  value,
2882
3302
  onChange
2883
3303
  }) {
2884
- return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 py-1", children: [
2885
- /* @__PURE__ */ jsx21(
3304
+ return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 py-1", children: [
3305
+ /* @__PURE__ */ jsx22(
2886
3306
  Checkbox,
2887
3307
  {
2888
3308
  checked: !!value,
2889
3309
  onCheckedChange: (checked) => onChange(!!checked)
2890
3310
  }
2891
3311
  ),
2892
- /* @__PURE__ */ jsxs10(Label, { className: "cursor-pointer", onClick: () => onChange(!value), children: [
3312
+ /* @__PURE__ */ jsxs11(Label, { className: "cursor-pointer", onClick: () => onChange(!value), children: [
2893
3313
  item.title,
2894
- item.required && /* @__PURE__ */ jsx21("span", { className: "text-destructive", children: " *" })
3314
+ item.required && /* @__PURE__ */ jsx22("span", { className: "text-destructive", children: " *" })
2895
3315
  ] })
2896
3316
  ] });
2897
3317
  }
2898
3318
 
2899
3319
  // src/Automations/ProductAutomation.tsx
2900
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
3320
+ import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
2901
3321
  function ProductAutomation({
2902
3322
  storeId,
2903
3323
  workspaceId,
@@ -2913,17 +3333,17 @@ function ProductAutomation({
2913
3333
  onSubmit,
2914
3334
  onAutomationApplied
2915
3335
  }) {
2916
- const [loading, setLoading] = useState8(true);
2917
- const [automationGroups, setAutomationGroups] = useState8({});
2918
- const [expandedGroups, setExpandedGroups] = useState8([]);
2919
- const [searchQuery, setSearchQuery] = useState8("");
2920
- const [selected, setSelected] = useState8(null);
2921
- const [schema, setSchema] = useState8([]);
2922
- const [configs, setConfigs] = useState8({});
2923
- const [options, setOptions] = useState8({});
2924
- const [loadingOptions, setLoadingOptions] = useState8({});
2925
- const [schemaLoading, setSchemaLoading] = useState8(false);
2926
- const [applying, setApplying] = useState8(false);
3336
+ const [loading, setLoading] = useState9(true);
3337
+ const [automationGroups, setAutomationGroups] = useState9({});
3338
+ const [expandedGroups, setExpandedGroups] = useState9([]);
3339
+ const [searchQuery, setSearchQuery] = useState9("");
3340
+ const [selected, setSelected] = useState9(null);
3341
+ const [schema, setSchema] = useState9([]);
3342
+ const [configs, setConfigs] = useState9({});
3343
+ const [options, setOptions] = useState9({});
3344
+ const [loadingOptions, setLoadingOptions] = useState9({});
3345
+ const [schemaLoading, setSchemaLoading] = useState9(false);
3346
+ const [applying, setApplying] = useState9(false);
2927
3347
  const configsRef = useRef5(configs);
2928
3348
  configsRef.current = configs;
2929
3349
  const optionsRef = useRef5(options);
@@ -2994,7 +3414,7 @@ function ProductAutomation({
2994
3414
  }
2995
3415
  }
2996
3416
  }, [schema, configs, channelsWithVersion]);
2997
- const handleConfigChange = useCallback6(
3417
+ const handleConfigChange = useCallback7(
2998
3418
  (key, value, item) => {
2999
3419
  setConfigs((prev) => {
3000
3420
  const parentItem = schema.find(
@@ -3020,7 +3440,7 @@ function ProductAutomation({
3020
3440
  },
3021
3441
  [schema]
3022
3442
  );
3023
- const isRunAllowed = useCallback6(() => {
3443
+ const isRunAllowed = useCallback7(() => {
3024
3444
  for (const item of schema) {
3025
3445
  if (!shouldRenderAttribute(item.render_if, configs)) continue;
3026
3446
  if (item.required) {
@@ -3070,18 +3490,18 @@ function ProductAutomation({
3070
3490
  const filtered = searchQuery ? unique.filter(
3071
3491
  (a) => a.display_name?.toLowerCase().includes(searchQuery.toLowerCase()) || a.automation.toLowerCase().includes(searchQuery.toLowerCase())
3072
3492
  ) : null;
3073
- return /* @__PURE__ */ jsxs11("div", { className: "flex h-full flex-col gap-3 p-3", children: [
3074
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3075
- /* @__PURE__ */ jsx22(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx22(ArrowLeft2, { className: "size-4" }) }),
3076
- /* @__PURE__ */ jsx22("h3", { className: "text-base font-semibold", children: "Automations" }),
3077
- /* @__PURE__ */ jsxs11(Badge, { variant: "secondary", children: [
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: [
3078
3498
  productsCount,
3079
3499
  " products"
3080
3500
  ] })
3081
3501
  ] }),
3082
- /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
3083
- /* @__PURE__ */ jsx22(Search3, { className: "absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3084
- /* @__PURE__ */ jsx22(
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(
3085
3505
  Input,
3086
3506
  {
3087
3507
  placeholder: "Search automations...",
@@ -3091,12 +3511,12 @@ function ProductAutomation({
3091
3511
  }
3092
3512
  )
3093
3513
  ] }),
3094
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 border-b px-2 pb-2 text-xs font-medium text-muted-foreground", children: [
3095
- /* @__PURE__ */ jsx22("span", { className: "flex-[5]", children: "Automation" }),
3096
- /* @__PURE__ */ jsx22("span", { className: "flex-[1.5] text-center", children: "Est. Time" }),
3097
- /* @__PURE__ */ jsx22("span", { className: "flex-[1.5] text-center", children: "Credits" })
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" })
3098
3518
  ] }),
3099
- /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-y-auto", children: loading ? /* @__PURE__ */ jsx22("div", { className: "space-y-3 p-2", children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx22(Skeleton, { className: "h-14 w-full rounded-md" }, i)) }) : filtered ? filtered.map((item) => /* @__PURE__ */ jsx22(
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(
3100
3520
  AutomationRow,
3101
3521
  {
3102
3522
  item,
@@ -3104,8 +3524,8 @@ function ProductAutomation({
3104
3524
  onClick: () => setSelected(item)
3105
3525
  },
3106
3526
  item.automation
3107
- )) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */ jsxs11("div", { children: [
3108
- /* @__PURE__ */ jsxs11(
3527
+ )) : Object.keys(automationGroups).sort().map((group) => /* @__PURE__ */ jsxs12("div", { children: [
3528
+ /* @__PURE__ */ jsxs12(
3109
3529
  "button",
3110
3530
  {
3111
3531
  type: "button",
@@ -3115,7 +3535,7 @@ function ProductAutomation({
3115
3535
  className: "flex w-full items-center justify-between px-2 py-2 text-sm font-semibold text-muted-foreground hover:text-foreground",
3116
3536
  children: [
3117
3537
  group,
3118
- /* @__PURE__ */ jsx22(
3538
+ /* @__PURE__ */ jsx23(
3119
3539
  ChevronDown2,
3120
3540
  {
3121
3541
  className: cn(
@@ -3127,7 +3547,7 @@ function ProductAutomation({
3127
3547
  ]
3128
3548
  }
3129
3549
  ),
3130
- expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */ jsx22(
3550
+ expandedGroups.includes(group) && automationGroups[group].map((item) => /* @__PURE__ */ jsx23(
3131
3551
  AutomationRow,
3132
3552
  {
3133
3553
  item,
@@ -3139,15 +3559,15 @@ function ProductAutomation({
3139
3559
  ] }, group)) })
3140
3560
  ] });
3141
3561
  }
3142
- return /* @__PURE__ */ jsxs11("div", { className: "flex h-full flex-col gap-3 p-3", children: [
3143
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3144
- /* @__PURE__ */ jsx22(Button, { variant: "ghost", size: "icon", onClick: () => setSelected(null), children: /* @__PURE__ */ jsx22(ArrowLeft2, { className: "size-4" }) }),
3145
- /* @__PURE__ */ jsx22("h3", { className: "text-base font-semibold", children: selected.display_name })
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 })
3146
3566
  ] }),
3147
- selected.preview && /* @__PURE__ */ jsxs11("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
3148
- selected.preview.info_text.map((text, i) => /* @__PURE__ */ jsx22("p", { className: "text-muted-foreground", children: text }, i)),
3149
- selected.preview.media.length > 0 && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap gap-2 pt-1", children: selected.preview.media.map(
3150
- (m, i) => m.type === "image" ? /* @__PURE__ */ jsx22(
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(
3151
3571
  "img",
3152
3572
  {
3153
3573
  src: m.src,
@@ -3158,8 +3578,8 @@ function ProductAutomation({
3158
3578
  ) : null
3159
3579
  ) })
3160
3580
  ] }),
3161
- /* @__PURE__ */ jsx22(Separator2, {}),
3162
- /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-y-auto", children: schemaLoading ? /* @__PURE__ */ jsx22("div", { className: "space-y-3 p-2", children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx22(Skeleton, { className: "h-12 w-full rounded-md" }, i)) }) : /* @__PURE__ */ jsx22(
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(
3163
3583
  SchemaFieldRenderer,
3164
3584
  {
3165
3585
  schema,
@@ -3169,26 +3589,26 @@ function ProductAutomation({
3169
3589
  onConfigChange: handleConfigChange
3170
3590
  }
3171
3591
  ) }),
3172
- /* @__PURE__ */ jsx22(Separator2, {}),
3173
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3174
- /* @__PURE__ */ jsx22(
3592
+ /* @__PURE__ */ jsx23(Separator2, {}),
3593
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3594
+ /* @__PURE__ */ jsx23(
3175
3595
  Button,
3176
3596
  {
3177
3597
  onClick: handleRun,
3178
3598
  disabled: !isRunAllowed() || applying,
3179
3599
  className: "flex-1",
3180
- children: applying ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
3181
- /* @__PURE__ */ jsx22(Loader26, { className: "size-4 animate-spin" }),
3600
+ children: applying ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
3601
+ /* @__PURE__ */ jsx23(Loader26, { className: "size-4 animate-spin" }),
3182
3602
  "Applying..."
3183
- ] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
3184
- /* @__PURE__ */ jsx22(Play, { className: "size-4" }),
3603
+ ] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
3604
+ /* @__PURE__ */ jsx23(Play, { className: "size-4" }),
3185
3605
  "Run Automation"
3186
3606
  ] })
3187
3607
  }
3188
3608
  ),
3189
- /* @__PURE__ */ jsx22(Button, { variant: "outline", onClick: () => setSelected(null), children: "Cancel" })
3609
+ /* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: () => setSelected(null), children: "Cancel" })
3190
3610
  ] }),
3191
- /* @__PURE__ */ jsx22("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." })
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." })
3192
3612
  ] });
3193
3613
  }
3194
3614
  function AutomationRow({
@@ -3198,19 +3618,19 @@ function AutomationRow({
3198
3618
  }) {
3199
3619
  const estTime = item.estimate_time_saved ? formatTimeSaved(item.estimate_time_saved * productsCount) : "\u2014";
3200
3620
  const credits = item.credits ? Math.ceil(item.credits * productsCount) : 0;
3201
- return /* @__PURE__ */ jsxs11(
3621
+ return /* @__PURE__ */ jsxs12(
3202
3622
  "button",
3203
3623
  {
3204
3624
  type: "button",
3205
3625
  onClick,
3206
3626
  className: "flex w-full items-center gap-4 rounded-md px-2 py-2.5 text-left hover:bg-accent",
3207
3627
  children: [
3208
- /* @__PURE__ */ jsxs11("div", { className: "flex-[5] min-w-0", children: [
3209
- /* @__PURE__ */ jsx22("div", { className: "text-sm font-medium", children: item.display_name }),
3210
- item.description && /* @__PURE__ */ jsx22("div", { className: "truncate text-xs text-muted-foreground", children: item.description })
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 })
3211
3631
  ] }),
3212
- /* @__PURE__ */ jsx22("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: estTime }),
3213
- /* @__PURE__ */ jsx22("div", { className: "flex-[1.5] text-center text-xs text-muted-foreground", children: credits })
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 })
3214
3634
  ]
3215
3635
  }
3216
3636
  );
@@ -3222,9 +3642,9 @@ function formatTimeSaved(totalSeconds) {
3222
3642
  }
3223
3643
 
3224
3644
  // src/Automations/StoreAutomation.tsx
3225
- import { useState as useState9, useEffect as useEffect6, useCallback as useCallback7, useRef as useRef6 } from "react";
3226
- import { ArrowLeft as ArrowLeft3, Settings } from "lucide-react";
3227
- import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
3645
+ import { useState as useState10, useEffect as useEffect6, useCallback as useCallback8, useRef as useRef6 } from "react";
3646
+ import { ArrowLeft as ArrowLeft4, Settings } from "lucide-react";
3647
+ import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3228
3648
  function StoreAutomation({
3229
3649
  storeId,
3230
3650
  channelsWithVersion,
@@ -3232,10 +3652,10 @@ function StoreAutomation({
3232
3652
  onSubmit,
3233
3653
  onClose
3234
3654
  }) {
3235
- const [loading, setLoading] = useState9(true);
3236
- const [automations, setAutomations] = useState9([]);
3237
- const [selectedConfigs, setSelectedConfigs] = useState9({ ...enabledAutomations });
3238
- const [selectedAutomation, setSelectedAutomation] = useState9(null);
3655
+ const [loading, setLoading] = useState10(true);
3656
+ const [automations, setAutomations] = useState10([]);
3657
+ const [selectedConfigs, setSelectedConfigs] = useState10({ ...enabledAutomations });
3658
+ const [selectedAutomation, setSelectedAutomation] = useState10(null);
3239
3659
  useEffect6(() => {
3240
3660
  setLoading(true);
3241
3661
  fetchAutomationList(storeId, "default").then((data) => {
@@ -3248,7 +3668,7 @@ function StoreAutomation({
3248
3668
  );
3249
3669
  }).catch(console.error).finally(() => setLoading(false));
3250
3670
  }, [storeId, enabledAutomations]);
3251
- const toggleAutomation = useCallback7((automationName) => {
3671
+ const toggleAutomation = useCallback8((automationName) => {
3252
3672
  setAutomations(
3253
3673
  (prev) => prev.map(
3254
3674
  (a) => a.automation === automationName ? { ...a, isEnabled: !a.isEnabled } : a
@@ -3281,7 +3701,7 @@ function StoreAutomation({
3281
3701
  setSelectedAutomation(null);
3282
3702
  };
3283
3703
  if (selectedAutomation) {
3284
- return /* @__PURE__ */ jsx23(
3704
+ return /* @__PURE__ */ jsx24(
3285
3705
  AutomationConfigEditor,
3286
3706
  {
3287
3707
  storeId,
@@ -3293,46 +3713,46 @@ function StoreAutomation({
3293
3713
  }
3294
3714
  );
3295
3715
  }
3296
- return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
3297
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3298
- onClose && /* @__PURE__ */ jsx23(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" }) }),
3299
- /* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: "Default Store Automations" })
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" })
3300
3720
  ] }),
3301
- /* @__PURE__ */ jsx23(Separator2, {}),
3302
- loading ? /* @__PURE__ */ jsx23("div", { className: "space-y-3 p-2", children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx23(Skeleton, { className: "h-14 w-full rounded-md" }, i)) }) : /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs12(Table, { children: [
3303
- /* @__PURE__ */ jsx23(TableHeader, { children: /* @__PURE__ */ jsxs12(TableRow, { children: [
3304
- /* @__PURE__ */ jsx23(TableHead, { children: "Automation" }),
3305
- /* @__PURE__ */ jsx23(TableHead, { className: "w-24 text-center", children: "Avg. Time" }),
3306
- /* @__PURE__ */ jsx23(TableHead, { className: "w-28 text-center", children: "Credits/Prd" }),
3307
- /* @__PURE__ */ jsx23(TableHead, { className: "w-28 text-center", children: "Status" }),
3308
- /* @__PURE__ */ jsx23(TableHead, { className: "w-12" })
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" })
3309
3729
  ] }) }),
3310
- /* @__PURE__ */ jsx23(TableBody, { children: automations.map((a) => /* @__PURE__ */ jsxs12(
3730
+ /* @__PURE__ */ jsx24(TableBody, { children: automations.map((a) => /* @__PURE__ */ jsxs13(
3311
3731
  TableRow,
3312
3732
  {
3313
3733
  className: "cursor-pointer",
3314
3734
  onClick: () => setSelectedAutomation(a),
3315
3735
  children: [
3316
- /* @__PURE__ */ jsxs12(TableCell, { children: [
3317
- /* @__PURE__ */ jsx23("div", { className: "text-sm font-medium", children: a.display_name }),
3318
- a.description && /* @__PURE__ */ jsx23("div", { className: "text-xs text-muted-foreground", children: a.description })
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 })
3319
3739
  ] }),
3320
- /* @__PURE__ */ jsx23(TableCell, { className: "text-center text-xs", children: a.estimate_run_time ?? "\u2014" }),
3321
- /* @__PURE__ */ jsx23(TableCell, { className: "text-center text-xs", children: a.credits ?? "\u2014" }),
3322
- /* @__PURE__ */ jsx23(TableCell, { className: "text-center", children: /* @__PURE__ */ jsxs12(
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(
3323
3743
  "div",
3324
3744
  {
3325
3745
  className: "flex items-center justify-center gap-2",
3326
3746
  onClick: (e) => e.stopPropagation(),
3327
3747
  children: [
3328
- /* @__PURE__ */ jsx23(
3748
+ /* @__PURE__ */ jsx24(
3329
3749
  Switch,
3330
3750
  {
3331
3751
  checked: a.isEnabled,
3332
3752
  onCheckedChange: () => toggleAutomation(a.automation)
3333
3753
  }
3334
3754
  ),
3335
- /* @__PURE__ */ jsx23(
3755
+ /* @__PURE__ */ jsx24(
3336
3756
  Badge,
3337
3757
  {
3338
3758
  variant: a.isEnabled ? "default" : "secondary",
@@ -3343,16 +3763,16 @@ function StoreAutomation({
3343
3763
  ]
3344
3764
  }
3345
3765
  ) }),
3346
- /* @__PURE__ */ jsx23(TableCell, { children: /* @__PURE__ */ jsx23(Settings, { className: "size-4 text-muted-foreground" }) })
3766
+ /* @__PURE__ */ jsx24(TableCell, { children: /* @__PURE__ */ jsx24(Settings, { className: "size-4 text-muted-foreground" }) })
3347
3767
  ]
3348
3768
  },
3349
3769
  a.automation
3350
3770
  )) })
3351
3771
  ] }) }),
3352
- /* @__PURE__ */ jsx23(Separator2, {}),
3353
- /* @__PURE__ */ jsxs12("div", { className: "flex justify-end gap-2", children: [
3354
- onClose && /* @__PURE__ */ jsx23(Button, { variant: "outline", onClick: onClose, children: "Cancel" }),
3355
- /* @__PURE__ */ jsx23(Button, { onClick: handleSave, children: "Save Changes" })
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" })
3356
3776
  ] })
3357
3777
  ] });
3358
3778
  }
@@ -3364,13 +3784,13 @@ function AutomationConfigEditor({
3364
3784
  onClose,
3365
3785
  onToggle
3366
3786
  }) {
3367
- const [schemaLoading, setSchemaLoading] = useState9(false);
3368
- const [schema, setSchema] = useState9([]);
3369
- const [configs, setConfigs] = useState9(
3787
+ const [schemaLoading, setSchemaLoading] = useState10(false);
3788
+ const [schema, setSchema] = useState10([]);
3789
+ const [configs, setConfigs] = useState10(
3370
3790
  initialConfigs ?? {}
3371
3791
  );
3372
- const [options, setOptions] = useState9({});
3373
- const [loadingOptions, setLoadingOptions] = useState9({});
3792
+ const [options, setOptions] = useState10({});
3793
+ const [loadingOptions, setLoadingOptions] = useState10({});
3374
3794
  const configsRef = useRef6(configs);
3375
3795
  configsRef.current = configs;
3376
3796
  const optionsRef = useRef6(options);
@@ -3417,7 +3837,7 @@ function AutomationConfigEditor({
3417
3837
  }
3418
3838
  }
3419
3839
  }, [schema, configs, channelsWithVersion]);
3420
- const handleConfigChange = useCallback7(
3840
+ const handleConfigChange = useCallback8(
3421
3841
  (key, value, item) => {
3422
3842
  setConfigs((prev) => ({ ...prev, [key]: value }));
3423
3843
  if (item.linked?.length) {
@@ -3433,36 +3853,36 @@ function AutomationConfigEditor({
3433
3853
  },
3434
3854
  []
3435
3855
  );
3436
- return /* @__PURE__ */ jsxs12("div", { className: "flex h-full flex-col gap-3 p-3", children: [
3437
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3438
- /* @__PURE__ */ jsx23(
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(
3439
3859
  Button,
3440
3860
  {
3441
3861
  variant: "ghost",
3442
3862
  size: "icon",
3443
3863
  onClick: () => onClose(automation, configs),
3444
- children: /* @__PURE__ */ jsx23(ArrowLeft3, { className: "size-4" })
3864
+ children: /* @__PURE__ */ jsx24(ArrowLeft4, { className: "size-4" })
3445
3865
  }
3446
3866
  ),
3447
- /* @__PURE__ */ jsx23("h3", { className: "text-base font-semibold", children: automation.display_name })
3867
+ /* @__PURE__ */ jsx24("h3", { className: "text-base font-semibold", children: automation.display_name })
3448
3868
  ] }),
3449
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-4 text-sm", children: [
3450
- /* @__PURE__ */ jsxs12("div", { className: "text-muted-foreground", children: [
3869
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-4 text-sm", children: [
3870
+ /* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
3451
3871
  "Est. time: ",
3452
- /* @__PURE__ */ jsx23("span", { className: "text-foreground", children: automation.estimate_run_time ?? "\u2014" })
3872
+ /* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.estimate_run_time ?? "\u2014" })
3453
3873
  ] }),
3454
- /* @__PURE__ */ jsxs12("div", { className: "text-muted-foreground", children: [
3874
+ /* @__PURE__ */ jsxs13("div", { className: "text-muted-foreground", children: [
3455
3875
  "Credits/prd: ",
3456
- /* @__PURE__ */ jsx23("span", { className: "text-foreground", children: automation.credits ?? "\u2014" })
3876
+ /* @__PURE__ */ jsx24("span", { className: "text-foreground", children: automation.credits ?? "\u2014" })
3457
3877
  ] })
3458
3878
  ] }),
3459
- /* @__PURE__ */ jsx23(Separator2, {}),
3460
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3461
- /* @__PURE__ */ jsx23("span", { className: "text-sm font-medium", children: automation.isEnabled ? "Enabled" : "Disabled" }),
3462
- /* @__PURE__ */ jsx23(Switch, { checked: automation.isEnabled, onCheckedChange: onToggle })
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 })
3463
3883
  ] }),
3464
- /* @__PURE__ */ jsx23(Separator2, {}),
3465
- /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-y-auto", children: automation.isEnabled ? 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(
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(
3466
3886
  SchemaFieldRenderer,
3467
3887
  {
3468
3888
  schema,
@@ -3471,13 +3891,13 @@ function AutomationConfigEditor({
3471
3891
  loadingOptions,
3472
3892
  onConfigChange: handleConfigChange
3473
3893
  }
3474
- ) : /* @__PURE__ */ jsx23("p", { className: "py-4 text-center text-sm text-muted-foreground", children: "Enable this automation to configure it." }) }),
3475
- automation.preview && /* @__PURE__ */ jsxs12(Fragment5, { children: [
3476
- /* @__PURE__ */ jsx23(Separator2, {}),
3477
- /* @__PURE__ */ jsxs12("div", { className: "space-y-2 rounded-lg bg-muted/50 p-3 text-sm", children: [
3478
- automation.preview.info_text.map((text, i) => /* @__PURE__ */ jsx23("p", { className: "text-muted-foreground", children: text }, i)),
3479
- automation.preview.media.length > 0 && /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-2 pt-1", children: automation.preview.media.map(
3480
- (m, i) => m.type === "image" ? /* @__PURE__ */ jsx23(
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(
3481
3901
  "img",
3482
3902
  {
3483
3903
  src: m.src,
@@ -3493,14 +3913,16 @@ function AutomationConfigEditor({
3493
3913
  }
3494
3914
 
3495
3915
  // src/CatalogixChat.tsx
3496
- import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3916
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3497
3917
  var SECTION_MAP = {
3498
3918
  "catalogix:create-store": "create_store",
3499
3919
  create_or_select_store: "create_store",
3500
3920
  "catalogix:select-products": "select_products",
3501
3921
  select_products: "select_products",
3502
3922
  "catalogix:automations": "automations",
3503
- trigger_automation: "trigger_automation"
3923
+ trigger_automation: "trigger_automation",
3924
+ "catalogix:map-attributes": "map_attributes",
3925
+ map_attributes: "map_attributes"
3504
3926
  };
3505
3927
  function CatalogixChat(props) {
3506
3928
  const { uiProps, meta, onSubmit, workspaceId, userId } = props;
@@ -3521,7 +3943,7 @@ function CatalogixChat(props) {
3521
3943
  configureApi({ catalogixBaseUrl });
3522
3944
  }, [catalogixBaseUrl]);
3523
3945
  if (section === "select_products") {
3524
- return /* @__PURE__ */ jsx24(
3946
+ return /* @__PURE__ */ jsx25(
3525
3947
  SelectProducts,
3526
3948
  {
3527
3949
  workspaceId,
@@ -3537,7 +3959,7 @@ function CatalogixChat(props) {
3537
3959
  );
3538
3960
  }
3539
3961
  if (section === "create_store") {
3540
- return /* @__PURE__ */ jsx24(
3962
+ return /* @__PURE__ */ jsx25(
3541
3963
  CreateStore,
3542
3964
  {
3543
3965
  workspaceId,
@@ -3550,8 +3972,24 @@ function CatalogixChat(props) {
3550
3972
  }
3551
3973
  );
3552
3974
  }
3975
+ if (section === "map_attributes") {
3976
+ return /* @__PURE__ */ jsx25(
3977
+ MapAttributesChat,
3978
+ {
3979
+ mappingData: uiProps.mappingData ?? [],
3980
+ mpAttributes: uiProps.mpAttributes ?? {},
3981
+ valuesOntologyAttributes: uiProps.valuesOntologyAttributes ?? [],
3982
+ columns: uiProps.columns ?? [],
3983
+ uniqueValues: uiProps.uniqueValues ?? {},
3984
+ storeId,
3985
+ submitted: props.submitted,
3986
+ submittedValues: props.submittedValues,
3987
+ onSubmit: (mapping) => onSubmit(mapping, "Attribute mapping confirmed.")
3988
+ }
3989
+ );
3990
+ }
3553
3991
  if (section === "trigger_automation") {
3554
- return /* @__PURE__ */ jsx24(
3992
+ return /* @__PURE__ */ jsx25(
3555
3993
  ProductAutomation,
3556
3994
  {
3557
3995
  storeId,
@@ -3571,7 +4009,7 @@ function CatalogixChat(props) {
3571
4009
  );
3572
4010
  }
3573
4011
  if (section === "automations") {
3574
- return /* @__PURE__ */ jsx24(
4012
+ return /* @__PURE__ */ jsx25(
3575
4013
  StoreAutomation,
3576
4014
  {
3577
4015
  storeId,
@@ -3582,11 +4020,11 @@ function CatalogixChat(props) {
3582
4020
  }
3583
4021
  );
3584
4022
  }
3585
- return /* @__PURE__ */ jsx24("div", { className: "p-4 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxs13("p", { children: [
3586
- /* @__PURE__ */ jsx24("strong", { children: "Catalogix" }),
4023
+ return /* @__PURE__ */ jsx25("div", { className: "p-4 text-sm text-muted-foreground", children: /* @__PURE__ */ jsxs14("p", { children: [
4024
+ /* @__PURE__ */ jsx25("strong", { children: "Catalogix" }),
3587
4025
  " \u2014 unknown section:",
3588
4026
  " ",
3589
- /* @__PURE__ */ jsx24("code", { children: section || "(none)" })
4027
+ /* @__PURE__ */ jsx25("code", { children: section || "(none)" })
3590
4028
  ] }) });
3591
4029
  }
3592
4030
 
@@ -3632,11 +4070,26 @@ var catalogixManifest = [
3632
4070
  position: "relative",
3633
4071
  width: "100%"
3634
4072
  }
4073
+ },
4074
+ {
4075
+ name: "catalogix:map-attributes",
4076
+ aliases: ["map_attributes"],
4077
+ service: "catalogix",
4078
+ description: "Review and fix attribute mappings",
4079
+ containerStyle: {
4080
+ overflow: "auto",
4081
+ marginTop: "8px",
4082
+ paddingBottom: "16px",
4083
+ height: "600px",
4084
+ position: "relative",
4085
+ width: "100%"
4086
+ }
3635
4087
  }
3636
4088
  ];
3637
4089
  export {
3638
4090
  CatalogixChat,
3639
4091
  CreateStore,
4092
+ MapAttributesChat,
3640
4093
  ProductAutomation,
3641
4094
  SelectProducts,
3642
4095
  StoreAutomation,