@streamoid/catalogix-chat 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -139,12 +139,13 @@ interface MapAttributesChatProps {
|
|
|
139
139
|
valuesOntologyAttributes: string[];
|
|
140
140
|
columns: string[];
|
|
141
141
|
uniqueValues: Record<string, string[]>;
|
|
142
|
+
lovOptions?: Record<string, string[]>;
|
|
142
143
|
storeId: string;
|
|
143
144
|
submitted?: boolean;
|
|
144
145
|
submittedValues?: Record<string, unknown>;
|
|
145
146
|
onSubmit: (values: Record<string, unknown>) => void;
|
|
146
147
|
}
|
|
147
|
-
declare function MapAttributesChat({ mappingData: initialData, mpAttributes, valuesOntologyAttributes, uniqueValues, submitted, onSubmit, }: MapAttributesChatProps): react_jsx_runtime.JSX.Element;
|
|
148
|
+
declare function MapAttributesChat({ mappingData: initialData, mpAttributes, valuesOntologyAttributes, uniqueValues, lovOptions, submitted, onSubmit, }: MapAttributesChatProps): react_jsx_runtime.JSX.Element;
|
|
148
149
|
|
|
149
150
|
interface ProductAutomationProps {
|
|
150
151
|
storeId: string;
|
package/dist/index.js
CHANGED
|
@@ -2458,7 +2458,7 @@ function hasIncompleteLovValues(item, valuesOntologyAttributes, uniqueValues) {
|
|
|
2458
2458
|
const rawVals = uniqueValues[item.feedCol] || [];
|
|
2459
2459
|
if (rawVals.length === 0) continue;
|
|
2460
2460
|
const mapped = item.mappedValues[attr] || {};
|
|
2461
|
-
if (rawVals.some((v) => mapped[v]
|
|
2461
|
+
if (rawVals.some((v) => !mapped[v])) return true;
|
|
2462
2462
|
}
|
|
2463
2463
|
return false;
|
|
2464
2464
|
}
|
|
@@ -2600,6 +2600,7 @@ function ValueMappingPanel({
|
|
|
2600
2600
|
data,
|
|
2601
2601
|
valuesOntologyAttributes,
|
|
2602
2602
|
uniqueValues,
|
|
2603
|
+
lovOptions,
|
|
2603
2604
|
onValueChange
|
|
2604
2605
|
}) {
|
|
2605
2606
|
const lovItems = useMemo5(() => {
|
|
@@ -2613,7 +2614,7 @@ function ValueMappingPanel({
|
|
|
2613
2614
|
const existing = item.mappedValues[attr] || {};
|
|
2614
2615
|
const valueMap = {};
|
|
2615
2616
|
rawVals.forEach((v) => {
|
|
2616
|
-
valueMap[v] = existing[v]
|
|
2617
|
+
valueMap[v] = existing[v] || null;
|
|
2617
2618
|
});
|
|
2618
2619
|
items.push({
|
|
2619
2620
|
itemIndex,
|
|
@@ -2626,6 +2627,11 @@ function ValueMappingPanel({
|
|
|
2626
2627
|
});
|
|
2627
2628
|
});
|
|
2628
2629
|
});
|
|
2630
|
+
items.sort((a, b) => {
|
|
2631
|
+
const aIncomplete = a.mappedCount < a.totalCount ? 0 : 1;
|
|
2632
|
+
const bIncomplete = b.mappedCount < b.totalCount ? 0 : 1;
|
|
2633
|
+
return aIncomplete - bIncomplete;
|
|
2634
|
+
});
|
|
2629
2635
|
return items;
|
|
2630
2636
|
}, [data, valuesOntologyAttributes, uniqueValues]);
|
|
2631
2637
|
if (lovItems.length === 0) {
|
|
@@ -2653,13 +2659,16 @@ function ValueMappingPanel({
|
|
|
2653
2659
|
] }),
|
|
2654
2660
|
/* @__PURE__ */ jsx21("div", { className: "space-y-1", children: item.rawValues.map((raw) => {
|
|
2655
2661
|
const mapped = item.mappedValues[raw];
|
|
2662
|
+
const options = lovOptions[item.attribute] ?? [...new Set(
|
|
2663
|
+
Object.values(item.mappedValues).filter(Boolean)
|
|
2664
|
+
)];
|
|
2656
2665
|
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2657
2666
|
/* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate min-w-0 flex-1", children: raw }),
|
|
2658
2667
|
/* @__PURE__ */ jsx21(ArrowRight, { className: "size-3 shrink-0 text-muted-foreground/50" }),
|
|
2659
2668
|
/* @__PURE__ */ jsxs10(
|
|
2660
2669
|
Select,
|
|
2661
2670
|
{
|
|
2662
|
-
value: mapped
|
|
2671
|
+
value: mapped || "__unmapped__",
|
|
2663
2672
|
onValueChange: (v) => {
|
|
2664
2673
|
const val = v === "__skip__" ? null : v;
|
|
2665
2674
|
onValueChange(
|
|
@@ -2674,7 +2683,7 @@ function ValueMappingPanel({
|
|
|
2674
2683
|
/* @__PURE__ */ jsxs10(SelectContent, { children: [
|
|
2675
2684
|
/* @__PURE__ */ jsx21(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
|
|
2676
2685
|
/* @__PURE__ */ jsx21(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
|
|
2677
|
-
|
|
2686
|
+
options.map((v) => /* @__PURE__ */ jsx21(SelectItem, { value: v, children: v }, v))
|
|
2678
2687
|
] })
|
|
2679
2688
|
]
|
|
2680
2689
|
}
|
|
@@ -2688,6 +2697,7 @@ function MapAttributesChat({
|
|
|
2688
2697
|
mpAttributes,
|
|
2689
2698
|
valuesOntologyAttributes,
|
|
2690
2699
|
uniqueValues,
|
|
2700
|
+
lovOptions = {},
|
|
2691
2701
|
submitted,
|
|
2692
2702
|
onSubmit
|
|
2693
2703
|
}) {
|
|
@@ -2717,7 +2727,7 @@ function MapAttributesChat({
|
|
|
2717
2727
|
if (!valuesOntologyAttributes.includes(attr)) continue;
|
|
2718
2728
|
const rawVals = uniqueValues[item.feedCol] || [];
|
|
2719
2729
|
const mapped = item.mappedValues[attr] || {};
|
|
2720
|
-
if (rawVals.some((v) => mapped[v]
|
|
2730
|
+
if (rawVals.some((v) => !mapped[v])) return false;
|
|
2721
2731
|
}
|
|
2722
2732
|
}
|
|
2723
2733
|
return true;
|
|
@@ -2887,6 +2897,7 @@ function MapAttributesChat({
|
|
|
2887
2897
|
data,
|
|
2888
2898
|
valuesOntologyAttributes,
|
|
2889
2899
|
uniqueValues,
|
|
2900
|
+
lovOptions,
|
|
2890
2901
|
onValueChange: handleValueChange
|
|
2891
2902
|
}
|
|
2892
2903
|
) }),
|
|
@@ -4062,6 +4073,7 @@ function CatalogixChat(props) {
|
|
|
4062
4073
|
valuesOntologyAttributes: uiProps.valuesOntologyAttributes ?? [],
|
|
4063
4074
|
columns: uiProps.columns ?? [],
|
|
4064
4075
|
uniqueValues: uiProps.uniqueValues ?? {},
|
|
4076
|
+
lovOptions: uiProps.lovOptions ?? {},
|
|
4065
4077
|
storeId,
|
|
4066
4078
|
submitted: props.submitted,
|
|
4067
4079
|
submittedValues: props.submittedValues,
|
package/package.json
CHANGED