@streamoid/catalogix-chat 0.2.12 → 0.2.14

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2459,7 +2459,9 @@ async function fetchLovValues(storeId, marketplace, feedCol, smpAttr) {
2459
2459
  const res = await fetchJson(
2460
2460
  `${catalogixBaseUrl}/api/v1/store/${storeId}/product/${marketplace}/metavalue/unique_attributes/get?${params}`
2461
2461
  );
2462
- return (res.data?.ontology_values ?? []).map((v) => v.value);
2462
+ return (res.data?.ontology_values ?? []).map(
2463
+ (v) => typeof v === "string" ? v : v.value
2464
+ );
2463
2465
  }
2464
2466
  function getAllAttributes(mpAttributes) {
2465
2467
  return Object.values(mpAttributes).flat();
@@ -2613,31 +2615,66 @@ var ValueRow = React7.memo(function ValueRow2({
2613
2615
  raw,
2614
2616
  mapped,
2615
2617
  options,
2618
+ loading,
2616
2619
  itemIndex,
2617
2620
  attribute,
2618
2621
  onValueChange
2619
2622
  }) {
2623
+ const [open, setOpen] = useState7(false);
2620
2624
  return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2621
2625
  /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground truncate min-w-0 flex-1", children: raw }),
2622
2626
  /* @__PURE__ */ jsx21(ArrowRight, { className: "size-3 shrink-0 text-muted-foreground/50" }),
2623
- /* @__PURE__ */ jsxs10(
2624
- Select,
2625
- {
2626
- value: mapped || "__unmapped__",
2627
- onValueChange: (v) => {
2628
- const val = v === "__skip__" ? null : v;
2629
- onValueChange(itemIndex, attribute, raw, val);
2630
- },
2631
- children: [
2632
- /* @__PURE__ */ jsx21(SelectTrigger, { className: "h-7 w-[140px] text-xs", children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Select..." }) }),
2633
- /* @__PURE__ */ jsxs10(SelectContent, { children: [
2634
- /* @__PURE__ */ jsx21(SelectItem, { value: "__unmapped__", children: /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
2635
- /* @__PURE__ */ jsx21(SelectItem, { value: "__skip__", children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" }) }),
2636
- options.map((v) => /* @__PURE__ */ jsx21(SelectItem, { value: v, children: v }, v))
2627
+ /* @__PURE__ */ jsxs10(Popover, { open, onOpenChange: setOpen, children: [
2628
+ /* @__PURE__ */ jsx21(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
2629
+ Button,
2630
+ {
2631
+ variant: "outline",
2632
+ size: "sm",
2633
+ className: "h-7 w-[160px] justify-between text-xs font-normal",
2634
+ children: [
2635
+ /* @__PURE__ */ jsx21("span", { className: "truncate", children: mapped || /* @__PURE__ */ jsx21("span", { className: "text-muted-foreground", children: "Select..." }) }),
2636
+ loading && !options.length ? /* @__PURE__ */ jsx21(Loader25, { className: "size-3 shrink-0 animate-spin text-muted-foreground" }) : /* @__PURE__ */ jsx21(ChevronDown2, { className: "size-3 shrink-0 text-muted-foreground" })
2637
+ ]
2638
+ }
2639
+ ) }),
2640
+ /* @__PURE__ */ jsx21(PopoverContent, { className: "w-[200px] p-0", align: "start", children: /* @__PURE__ */ jsxs10(Command, { children: [
2641
+ /* @__PURE__ */ jsx21(CommandInput, { placeholder: "Search..." }),
2642
+ /* @__PURE__ */ jsx21(CommandList, { children: loading && !options.length ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-center gap-2 py-4 text-xs text-muted-foreground", children: [
2643
+ /* @__PURE__ */ jsx21(Loader25, { className: "size-3 animate-spin" }),
2644
+ "Loading..."
2645
+ ] }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
2646
+ /* @__PURE__ */ jsx21(CommandEmpty, { children: "No match." }),
2647
+ /* @__PURE__ */ jsxs10(CommandGroup, { children: [
2648
+ /* @__PURE__ */ jsx21(
2649
+ CommandItem,
2650
+ {
2651
+ value: "__skip__",
2652
+ onSelect: () => {
2653
+ onValueChange(itemIndex, attribute, raw, null);
2654
+ setOpen(false);
2655
+ },
2656
+ children: /* @__PURE__ */ jsx21("span", { className: "italic text-muted-foreground", children: "Skip" })
2657
+ }
2658
+ ),
2659
+ options.map((v) => /* @__PURE__ */ jsxs10(
2660
+ CommandItem,
2661
+ {
2662
+ value: v,
2663
+ onSelect: () => {
2664
+ onValueChange(itemIndex, attribute, raw, v);
2665
+ setOpen(false);
2666
+ },
2667
+ children: [
2668
+ v,
2669
+ mapped === v && /* @__PURE__ */ jsx21(Check2, { className: "ml-auto size-3" })
2670
+ ]
2671
+ },
2672
+ v
2673
+ ))
2637
2674
  ] })
2638
- ]
2639
- }
2640
- )
2675
+ ] }) })
2676
+ ] }) })
2677
+ ] })
2641
2678
  ] });
2642
2679
  });
2643
2680
  function ValueMappingPanel({
@@ -2743,15 +2780,13 @@ function ValueMappingPanel({
2743
2780
  ]
2744
2781
  }
2745
2782
  ),
2746
- isExpanded && /* @__PURE__ */ jsx21("div", { className: "space-y-1 pl-4 pb-1.5 pt-1", children: loadingLov && !lovCache[item.attribute] ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 py-2 text-xs text-muted-foreground", children: [
2747
- /* @__PURE__ */ jsx21(Loader25, { className: "size-3 animate-spin" }),
2748
- "Loading values..."
2749
- ] }) : item.rawValues.map((raw) => /* @__PURE__ */ jsx21(
2783
+ isExpanded && /* @__PURE__ */ jsx21("div", { className: "space-y-1 pl-4 pb-1.5 pt-1", children: item.rawValues.map((raw) => /* @__PURE__ */ jsx21(
2750
2784
  ValueRow,
2751
2785
  {
2752
2786
  raw,
2753
2787
  mapped: item.mappedValues[raw],
2754
2788
  options,
2789
+ loading: loadingLov && !lovCache[item.attribute],
2755
2790
  itemIndex: item.itemIndex,
2756
2791
  attribute: item.attribute,
2757
2792
  onValueChange
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/catalogix-chat",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Catalogix chat components for the Streamoid chat host — store creation, product selection, automations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",