@streamoid/catalogix-chat 0.2.10 → 0.2.11
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 +158 -112
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/CatalogixChat.tsx
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as useEffect8 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/api.ts
|
|
5
5
|
var _config = {
|
|
@@ -2435,17 +2435,19 @@ function CreateStore({
|
|
|
2435
2435
|
}
|
|
2436
2436
|
|
|
2437
2437
|
// src/MapAttributes/index.tsx
|
|
2438
|
-
import { useState as useState7, useMemo as useMemo5, useCallback as useCallback5 } from "react";
|
|
2438
|
+
import React7, { useState as useState7, useMemo as useMemo5, useCallback as useCallback5, useTransition, useEffect as useEffect5 } from "react";
|
|
2439
2439
|
import {
|
|
2440
2440
|
Check as Check2,
|
|
2441
2441
|
X,
|
|
2442
2442
|
ChevronRight as ChevronRight2,
|
|
2443
|
+
ChevronDown as ChevronDown2,
|
|
2443
2444
|
Pencil as Pencil2,
|
|
2444
2445
|
Search as Search3,
|
|
2445
2446
|
ArrowRight,
|
|
2446
2447
|
ArrowLeft as ArrowLeft2,
|
|
2447
2448
|
Send,
|
|
2448
|
-
AlertTriangle
|
|
2449
|
+
AlertTriangle,
|
|
2450
|
+
Loader2 as Loader25
|
|
2449
2451
|
} from "lucide-react";
|
|
2450
2452
|
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2451
2453
|
function getAllAttributes(mpAttributes) {
|
|
@@ -2462,7 +2464,7 @@ function hasIncompleteLovValues(item, valuesOntologyAttributes, uniqueValues) {
|
|
|
2462
2464
|
}
|
|
2463
2465
|
return false;
|
|
2464
2466
|
}
|
|
2465
|
-
|
|
2467
|
+
var AttributeRow = React7.memo(function AttributeRow2({
|
|
2466
2468
|
item,
|
|
2467
2469
|
index,
|
|
2468
2470
|
allAttributes,
|
|
@@ -2595,7 +2597,38 @@ function AttributeRow({
|
|
|
2595
2597
|
)
|
|
2596
2598
|
] })
|
|
2597
2599
|
] });
|
|
2598
|
-
}
|
|
2600
|
+
});
|
|
2601
|
+
var ValueRow = React7.memo(function ValueRow2({
|
|
2602
|
+
raw,
|
|
2603
|
+
mapped,
|
|
2604
|
+
options,
|
|
2605
|
+
itemIndex,
|
|
2606
|
+
attribute,
|
|
2607
|
+
onValueChange
|
|
2608
|
+
}) {
|
|
2609
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2610
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate min-w-0 flex-1", children: raw }),
|
|
2611
|
+
/* @__PURE__ */ jsx21(ArrowRight, { className: "size-3 shrink-0 text-muted-foreground/50" }),
|
|
2612
|
+
/* @__PURE__ */ jsxs10(
|
|
2613
|
+
Select,
|
|
2614
|
+
{
|
|
2615
|
+
value: mapped || "__unmapped__",
|
|
2616
|
+
onValueChange: (v) => {
|
|
2617
|
+
const val = v === "__skip__" ? null : v;
|
|
2618
|
+
onValueChange(itemIndex, attribute, raw, val);
|
|
2619
|
+
},
|
|
2620
|
+
children: [
|
|
2621
|
+
/* @__PURE__ */ jsx21(SelectTrigger, { className: "h-7 w-[140px] text-xs", children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Select..." }) }),
|
|
2622
|
+
/* @__PURE__ */ jsxs10(SelectContent, { children: [
|
|
2623
|
+
/* @__PURE__ */ jsx21(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
|
|
2624
|
+
/* @__PURE__ */ jsx21(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
|
|
2625
|
+
options.map((v) => /* @__PURE__ */ jsx21(SelectItem, { value: v, children: v }, v))
|
|
2626
|
+
] })
|
|
2627
|
+
]
|
|
2628
|
+
}
|
|
2629
|
+
)
|
|
2630
|
+
] });
|
|
2631
|
+
});
|
|
2599
2632
|
function ValueMappingPanel({
|
|
2600
2633
|
data,
|
|
2601
2634
|
valuesOntologyAttributes,
|
|
@@ -2603,6 +2636,7 @@ function ValueMappingPanel({
|
|
|
2603
2636
|
lovOptions,
|
|
2604
2637
|
onValueChange
|
|
2605
2638
|
}) {
|
|
2639
|
+
const [expandedIndex, setExpandedIndex] = useState7(null);
|
|
2606
2640
|
const lovItems = useMemo5(() => {
|
|
2607
2641
|
const items = [];
|
|
2608
2642
|
data.forEach((item, itemIndex) => {
|
|
@@ -2634,63 +2668,62 @@ function ValueMappingPanel({
|
|
|
2634
2668
|
});
|
|
2635
2669
|
return items;
|
|
2636
2670
|
}, [data, valuesOntologyAttributes, uniqueValues]);
|
|
2671
|
+
useEffect5(() => {
|
|
2672
|
+
const first = lovItems.findIndex((i) => i.mappedCount < i.totalCount);
|
|
2673
|
+
setExpandedIndex(first >= 0 ? first : 0);
|
|
2674
|
+
}, [lovItems.length]);
|
|
2637
2675
|
if (lovItems.length === 0) {
|
|
2638
2676
|
return /* @__PURE__ */ jsx21("div", { className: "flex items-center justify-center py-6 text-xs text-muted-foreground", children: "No value mapping required." });
|
|
2639
2677
|
}
|
|
2640
|
-
return /* @__PURE__ */ jsx21("div", { className: "divide-y divide-border/50", children: lovItems.map((item, idx) =>
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2678
|
+
return /* @__PURE__ */ jsx21("div", { className: "divide-y divide-border/50", children: lovItems.map((item, idx) => {
|
|
2679
|
+
const isExpanded = expandedIndex === idx;
|
|
2680
|
+
const isComplete = item.mappedCount >= item.totalCount;
|
|
2681
|
+
const options = lovOptions[item.attribute] ?? [...new Set(
|
|
2682
|
+
Object.values(item.mappedValues).filter(Boolean)
|
|
2683
|
+
)];
|
|
2684
|
+
return /* @__PURE__ */ jsxs10("div", { className: "py-1", children: [
|
|
2645
2685
|
/* @__PURE__ */ jsxs10(
|
|
2646
|
-
"
|
|
2686
|
+
"button",
|
|
2647
2687
|
{
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
),
|
|
2688
|
+
type: "button",
|
|
2689
|
+
onClick: () => setExpandedIndex(isExpanded ? null : idx),
|
|
2690
|
+
className: "w-full flex items-center gap-1.5 py-1.5 hover:bg-muted/50 rounded-sm px-1 -mx-1 transition-colors",
|
|
2652
2691
|
children: [
|
|
2653
|
-
|
|
2654
|
-
"
|
|
2655
|
-
|
|
2692
|
+
isExpanded ? /* @__PURE__ */ jsx21(ChevronDown2, { className: "size-3 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx21(ChevronRight2, { className: "size-3 shrink-0 text-muted-foreground" }),
|
|
2693
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs font-medium truncate", children: item.feedCol }),
|
|
2694
|
+
/* @__PURE__ */ jsx21(ArrowRight, { className: "size-3 shrink-0 text-muted-foreground/50" }),
|
|
2695
|
+
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate", children: item.attribute }),
|
|
2696
|
+
/* @__PURE__ */ jsxs10(
|
|
2697
|
+
"span",
|
|
2698
|
+
{
|
|
2699
|
+
className: cn(
|
|
2700
|
+
"ml-auto text-[11px] tabular-nums shrink-0",
|
|
2701
|
+
isComplete ? "text-emerald-600 dark:text-emerald-400" : "text-amber-600 dark:text-amber-400"
|
|
2702
|
+
),
|
|
2703
|
+
children: [
|
|
2704
|
+
item.mappedCount,
|
|
2705
|
+
"/",
|
|
2706
|
+
item.totalCount
|
|
2707
|
+
]
|
|
2708
|
+
}
|
|
2709
|
+
)
|
|
2656
2710
|
]
|
|
2657
2711
|
}
|
|
2658
|
-
)
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
const val = v === "__skip__" ? null : v;
|
|
2674
|
-
onValueChange(
|
|
2675
|
-
item.itemIndex,
|
|
2676
|
-
item.attribute,
|
|
2677
|
-
raw,
|
|
2678
|
-
val
|
|
2679
|
-
);
|
|
2680
|
-
},
|
|
2681
|
-
children: [
|
|
2682
|
-
/* @__PURE__ */ jsx21(SelectTrigger, { className: "h-7 w-[140px] text-xs", children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Select..." }) }),
|
|
2683
|
-
/* @__PURE__ */ jsxs10(SelectContent, { children: [
|
|
2684
|
-
/* @__PURE__ */ jsx21(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
|
|
2685
|
-
/* @__PURE__ */ jsx21(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
|
|
2686
|
-
options.map((v) => /* @__PURE__ */ jsx21(SelectItem, { value: v, children: v }, v))
|
|
2687
|
-
] })
|
|
2688
|
-
]
|
|
2689
|
-
}
|
|
2690
|
-
)
|
|
2691
|
-
] }, raw);
|
|
2692
|
-
}) })
|
|
2693
|
-
] }, idx)) });
|
|
2712
|
+
),
|
|
2713
|
+
isExpanded && /* @__PURE__ */ jsx21("div", { className: "space-y-1 pl-4 pb-1.5 pt-1", children: item.rawValues.map((raw) => /* @__PURE__ */ jsx21(
|
|
2714
|
+
ValueRow,
|
|
2715
|
+
{
|
|
2716
|
+
raw,
|
|
2717
|
+
mapped: item.mappedValues[raw],
|
|
2718
|
+
options,
|
|
2719
|
+
itemIndex: item.itemIndex,
|
|
2720
|
+
attribute: item.attribute,
|
|
2721
|
+
onValueChange
|
|
2722
|
+
},
|
|
2723
|
+
raw
|
|
2724
|
+
)) })
|
|
2725
|
+
] }, idx);
|
|
2726
|
+
}) });
|
|
2694
2727
|
}
|
|
2695
2728
|
function MapAttributesChat({
|
|
2696
2729
|
mappingData: initialData,
|
|
@@ -2705,6 +2738,8 @@ function MapAttributesChat({
|
|
|
2705
2738
|
() => initialData.map((item) => ({ ...item }))
|
|
2706
2739
|
);
|
|
2707
2740
|
const [step, setStep] = useState7("attributes");
|
|
2741
|
+
const [isPending, startTransition] = useTransition();
|
|
2742
|
+
const [isSaving, setIsSaving] = useState7(false);
|
|
2708
2743
|
const allAttributes = useMemo5(
|
|
2709
2744
|
() => getAllAttributes(mpAttributes),
|
|
2710
2745
|
[mpAttributes]
|
|
@@ -2804,23 +2839,31 @@ function MapAttributesChat({
|
|
|
2804
2839
|
}, []);
|
|
2805
2840
|
const handleValueChange = useCallback5(
|
|
2806
2841
|
(itemIndex, attribute, rawValue, mappedValue) => {
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2842
|
+
startTransition(() => {
|
|
2843
|
+
setData((prev) => {
|
|
2844
|
+
const next = [...prev];
|
|
2845
|
+
const item = { ...next[itemIndex] };
|
|
2846
|
+
const attrValues = { ...item.mappedValues[attribute] || {} };
|
|
2847
|
+
attrValues[rawValue] = mappedValue;
|
|
2848
|
+
item.mappedValues = {
|
|
2849
|
+
...item.mappedValues,
|
|
2850
|
+
[attribute]: attrValues
|
|
2851
|
+
};
|
|
2852
|
+
next[itemIndex] = item;
|
|
2853
|
+
return next;
|
|
2854
|
+
});
|
|
2818
2855
|
});
|
|
2819
2856
|
},
|
|
2820
2857
|
[]
|
|
2821
2858
|
);
|
|
2859
|
+
const handleGoToValues = useCallback5(() => {
|
|
2860
|
+
startTransition(() => setStep("values"));
|
|
2861
|
+
}, []);
|
|
2822
2862
|
const handleSubmit = useCallback5(() => {
|
|
2823
|
-
|
|
2863
|
+
setIsSaving(true);
|
|
2864
|
+
requestAnimationFrame(() => {
|
|
2865
|
+
onSubmit(data);
|
|
2866
|
+
});
|
|
2824
2867
|
}, [data, onSubmit]);
|
|
2825
2868
|
if (submitted) {
|
|
2826
2869
|
return /* @__PURE__ */ jsxs10("div", { className: "rounded-lg border border-border bg-muted/20 p-3 flex items-start gap-3", children: [
|
|
@@ -2877,30 +2920,33 @@ function MapAttributesChat({
|
|
|
2877
2920
|
] })
|
|
2878
2921
|
] })
|
|
2879
2922
|
] }),
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
|
|
2882
|
-
{
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2923
|
+
/* @__PURE__ */ jsxs10("div", { className: "px-4 overflow-y-auto flex-1 min-h-0 relative", children: [
|
|
2924
|
+
isPending && /* @__PURE__ */ jsx21("div", { className: "absolute inset-0 z-10 flex items-center justify-center bg-background/60 backdrop-blur-[1px]", children: /* @__PURE__ */ jsx21(Loader25, { className: "size-5 animate-spin text-muted-foreground" }) }),
|
|
2925
|
+
step === "attributes" ? /* @__PURE__ */ jsx21("div", { className: "divide-y divide-border/50", children: sortedIndices.map((idx) => /* @__PURE__ */ jsx21(
|
|
2926
|
+
AttributeRow,
|
|
2927
|
+
{
|
|
2928
|
+
item: data[idx],
|
|
2929
|
+
index: idx,
|
|
2930
|
+
allAttributes,
|
|
2931
|
+
needsValueAttention: lovAttentionSet.has(idx),
|
|
2932
|
+
onMap: handleMap,
|
|
2933
|
+
onConfirm: handleConfirm,
|
|
2934
|
+
onIgnore: handleIgnore,
|
|
2935
|
+
onEdit: handleEdit,
|
|
2936
|
+
onUnmap: handleUnmap
|
|
2937
|
+
},
|
|
2938
|
+
idx
|
|
2939
|
+
)) }) : /* @__PURE__ */ jsx21(
|
|
2940
|
+
ValueMappingPanel,
|
|
2941
|
+
{
|
|
2942
|
+
data,
|
|
2943
|
+
valuesOntologyAttributes,
|
|
2944
|
+
uniqueValues,
|
|
2945
|
+
lovOptions,
|
|
2946
|
+
onValueChange: handleValueChange
|
|
2947
|
+
}
|
|
2948
|
+
)
|
|
2949
|
+
] }),
|
|
2904
2950
|
/* @__PURE__ */ jsxs10("div", { className: "flex justify-end gap-2 px-4 py-2 flex-shrink-0 border-t border-border/50", children: [
|
|
2905
2951
|
step === "values" && /* @__PURE__ */ jsxs10(
|
|
2906
2952
|
Button,
|
|
@@ -2920,12 +2966,12 @@ function MapAttributesChat({
|
|
|
2920
2966
|
{
|
|
2921
2967
|
variant: "ghost",
|
|
2922
2968
|
size: "sm",
|
|
2923
|
-
onClick:
|
|
2924
|
-
disabled: progress.done < progress.total,
|
|
2969
|
+
onClick: handleGoToValues,
|
|
2970
|
+
disabled: progress.done < progress.total || isPending,
|
|
2925
2971
|
className: "h-7 text-xs",
|
|
2926
2972
|
children: [
|
|
2927
|
-
"
|
|
2928
|
-
|
|
2973
|
+
isPending ? /* @__PURE__ */ jsx21(Loader25, { className: "mr-1 size-3 animate-spin" }) : /* @__PURE__ */ jsx21(ArrowRight, { className: "ml-1 size-3" }),
|
|
2974
|
+
isPending ? "Loading..." : "Map Values"
|
|
2929
2975
|
]
|
|
2930
2976
|
}
|
|
2931
2977
|
),
|
|
@@ -2934,11 +2980,11 @@ function MapAttributesChat({
|
|
|
2934
2980
|
{
|
|
2935
2981
|
size: "sm",
|
|
2936
2982
|
onClick: handleSubmit,
|
|
2937
|
-
disabled: progress.done < progress.total || hasLovAttributes && !allValuesComplete,
|
|
2983
|
+
disabled: progress.done < progress.total || hasLovAttributes && !allValuesComplete || isSaving,
|
|
2938
2984
|
className: "h-7 text-xs bg-primary text-primary-foreground shadow-none hover:bg-primary/90",
|
|
2939
2985
|
children: [
|
|
2940
|
-
/* @__PURE__ */ jsx21(Send, { className: "mr-1 size-3" }),
|
|
2941
|
-
"Save Mapping"
|
|
2986
|
+
isSaving ? /* @__PURE__ */ jsx21(Loader25, { className: "mr-1 size-3 animate-spin" }) : /* @__PURE__ */ jsx21(Send, { className: "mr-1 size-3" }),
|
|
2987
|
+
isSaving ? "Saving..." : "Save Mapping"
|
|
2942
2988
|
]
|
|
2943
2989
|
}
|
|
2944
2990
|
)
|
|
@@ -2947,8 +2993,8 @@ function MapAttributesChat({
|
|
|
2947
2993
|
}
|
|
2948
2994
|
|
|
2949
2995
|
// src/Automations/ProductAutomation.tsx
|
|
2950
|
-
import { useState as useState9, useEffect as
|
|
2951
|
-
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as
|
|
2996
|
+
import { useState as useState9, useEffect as useEffect6, useCallback as useCallback7, useRef as useRef5 } from "react";
|
|
2997
|
+
import { ArrowLeft as ArrowLeft3, Search as Search4, Loader2 as Loader27, ChevronDown as ChevronDown3, Play } from "lucide-react";
|
|
2952
2998
|
|
|
2953
2999
|
// src/Automations/api.ts
|
|
2954
3000
|
async function fetchAutomationList(storeId, tag, includeGroupings = false) {
|
|
@@ -3075,7 +3121,7 @@ function parseLovResponse(response, curl, configs) {
|
|
|
3075
3121
|
|
|
3076
3122
|
// src/Automations/SchemaFieldRenderer.tsx
|
|
3077
3123
|
import { useCallback as useCallback6, useState as useState8 } from "react";
|
|
3078
|
-
import { Check as Check3, ChevronsUpDown as ChevronsUpDown2, Loader2 as
|
|
3124
|
+
import { Check as Check3, ChevronsUpDown as ChevronsUpDown2, Loader2 as Loader26, X as X2 } from "lucide-react";
|
|
3079
3125
|
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3080
3126
|
function SchemaFieldRenderer({
|
|
3081
3127
|
schema,
|
|
@@ -3273,7 +3319,7 @@ function SingleSelectField({
|
|
|
3273
3319
|
] }),
|
|
3274
3320
|
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3275
3321
|
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3276
|
-
/* @__PURE__ */ jsx22(
|
|
3322
|
+
/* @__PURE__ */ jsx22(Loader26, { className: "size-4 animate-spin" }),
|
|
3277
3323
|
"Loading options..."
|
|
3278
3324
|
] }) : /* @__PURE__ */ jsxs11(
|
|
3279
3325
|
Select,
|
|
@@ -3313,7 +3359,7 @@ function MultiSelectField({
|
|
|
3313
3359
|
] }),
|
|
3314
3360
|
item.description && /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
3315
3361
|
loading ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
3316
|
-
/* @__PURE__ */ jsx22(
|
|
3362
|
+
/* @__PURE__ */ jsx22(Loader26, { className: "size-4 animate-spin" }),
|
|
3317
3363
|
"Loading options..."
|
|
3318
3364
|
] }) : /* @__PURE__ */ jsxs11(Popover, { open, onOpenChange: setOpen, children: [
|
|
3319
3365
|
/* @__PURE__ */ jsx22(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
@@ -3443,7 +3489,7 @@ function ProductAutomation({
|
|
|
3443
3489
|
const loadingOptionsRef = useRef5(loadingOptions);
|
|
3444
3490
|
loadingOptionsRef.current = loadingOptions;
|
|
3445
3491
|
const productsCount = selectedProducts.includes("all") ? excludedProducts.length === 0 ? totalProducts : totalProducts - excludedProducts.length : productsCountProp;
|
|
3446
|
-
|
|
3492
|
+
useEffect6(() => {
|
|
3447
3493
|
setLoading(true);
|
|
3448
3494
|
fetchAutomationList(storeId, "product", true).then((data) => {
|
|
3449
3495
|
const groups = {};
|
|
@@ -3459,7 +3505,7 @@ function ProductAutomation({
|
|
|
3459
3505
|
if (sorted.length > 0) setExpandedGroups([sorted[0]]);
|
|
3460
3506
|
}).catch(console.error).finally(() => setLoading(false));
|
|
3461
3507
|
}, [storeId]);
|
|
3462
|
-
|
|
3508
|
+
useEffect6(() => {
|
|
3463
3509
|
if (!selected) {
|
|
3464
3510
|
setSchema([]);
|
|
3465
3511
|
setConfigs({});
|
|
@@ -3478,7 +3524,7 @@ function ProductAutomation({
|
|
|
3478
3524
|
configsRef.current = defaults;
|
|
3479
3525
|
}).catch(console.error).finally(() => setSchemaLoading(false));
|
|
3480
3526
|
}, [selected, storeId]);
|
|
3481
|
-
|
|
3527
|
+
useEffect6(() => {
|
|
3482
3528
|
if (schema.length === 0) return;
|
|
3483
3529
|
const flatItems = schema.flatMap((s) => s.mapping_parameters ?? [s]);
|
|
3484
3530
|
for (const item of flatItems) {
|
|
@@ -3628,7 +3674,7 @@ function ProductAutomation({
|
|
|
3628
3674
|
children: [
|
|
3629
3675
|
group,
|
|
3630
3676
|
/* @__PURE__ */ jsx23(
|
|
3631
|
-
|
|
3677
|
+
ChevronDown3,
|
|
3632
3678
|
{
|
|
3633
3679
|
className: cn(
|
|
3634
3680
|
"size-4 transition-transform",
|
|
@@ -3690,7 +3736,7 @@ function ProductAutomation({
|
|
|
3690
3736
|
disabled: !isRunAllowed() || applying,
|
|
3691
3737
|
className: "flex-1",
|
|
3692
3738
|
children: applying ? /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
3693
|
-
/* @__PURE__ */ jsx23(
|
|
3739
|
+
/* @__PURE__ */ jsx23(Loader27, { className: "size-4 animate-spin" }),
|
|
3694
3740
|
"Applying..."
|
|
3695
3741
|
] }) : /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
3696
3742
|
/* @__PURE__ */ jsx23(Play, { className: "size-4" }),
|
|
@@ -3734,7 +3780,7 @@ function formatTimeSaved(totalSeconds) {
|
|
|
3734
3780
|
}
|
|
3735
3781
|
|
|
3736
3782
|
// src/Automations/StoreAutomation.tsx
|
|
3737
|
-
import { useState as useState10, useEffect as
|
|
3783
|
+
import { useState as useState10, useEffect as useEffect7, useCallback as useCallback8, useRef as useRef6 } from "react";
|
|
3738
3784
|
import { ArrowLeft as ArrowLeft4, Settings } from "lucide-react";
|
|
3739
3785
|
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3740
3786
|
function StoreAutomation({
|
|
@@ -3748,7 +3794,7 @@ function StoreAutomation({
|
|
|
3748
3794
|
const [automations, setAutomations] = useState10([]);
|
|
3749
3795
|
const [selectedConfigs, setSelectedConfigs] = useState10({ ...enabledAutomations });
|
|
3750
3796
|
const [selectedAutomation, setSelectedAutomation] = useState10(null);
|
|
3751
|
-
|
|
3797
|
+
useEffect7(() => {
|
|
3752
3798
|
setLoading(true);
|
|
3753
3799
|
fetchAutomationList(storeId, "default").then((data) => {
|
|
3754
3800
|
setAutomations(
|
|
@@ -3887,7 +3933,7 @@ function AutomationConfigEditor({
|
|
|
3887
3933
|
configsRef.current = configs;
|
|
3888
3934
|
const optionsRef = useRef6(options);
|
|
3889
3935
|
optionsRef.current = options;
|
|
3890
|
-
|
|
3936
|
+
useEffect7(() => {
|
|
3891
3937
|
if (!automation.isEnabled) return;
|
|
3892
3938
|
setSchemaLoading(true);
|
|
3893
3939
|
fetchAutomationSchema(storeId, automation.automation, "default").then((items) => {
|
|
@@ -3902,7 +3948,7 @@ function AutomationConfigEditor({
|
|
|
3902
3948
|
}
|
|
3903
3949
|
}).catch(console.error).finally(() => setSchemaLoading(false));
|
|
3904
3950
|
}, [storeId, automation, initialConfigs]);
|
|
3905
|
-
|
|
3951
|
+
useEffect7(() => {
|
|
3906
3952
|
if (schema.length === 0) return;
|
|
3907
3953
|
for (const item of schema) {
|
|
3908
3954
|
if (!item.curl) continue;
|
|
@@ -4031,7 +4077,7 @@ function CatalogixChat(props) {
|
|
|
4031
4077
|
const filters = uiProps.filters ?? {};
|
|
4032
4078
|
const selectedPageRange = uiProps.selectedPageRange ?? [];
|
|
4033
4079
|
const enabledAutomations = uiProps.enabledAutomations ?? {};
|
|
4034
|
-
|
|
4080
|
+
useEffect8(() => {
|
|
4035
4081
|
configureApi({ catalogixBaseUrl });
|
|
4036
4082
|
}, [catalogixBaseUrl]);
|
|
4037
4083
|
if (section === "select_products") {
|
package/package.json
CHANGED