@flowselections/floriday-voorraad 1.0.49 → 1.0.51

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 (32) hide show
  1. package/dist-lib/components/voorraad/CollapsibleText.d.ts.map +1 -1
  2. package/dist-lib/components/voorraad/CollapsibleText.js +14 -11
  3. package/dist-lib/components/voorraad/StockMutationHistoryCard.d.ts.map +1 -1
  4. package/dist-lib/components/voorraad/StockMutationHistoryCard.js +17 -16
  5. package/dist-lib/integrations/supabase/auth-middleware.d.ts +360 -0
  6. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  7. package/dist-lib/integrations/supabase/client.d.ts +2 -30680
  8. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  9. package/dist-lib/integrations/supabase/client.js +4 -27
  10. package/dist-lib/integrations/supabase/client.server.d.ts +360 -0
  11. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  12. package/dist-lib/integrations/supabase/types.d.ts +372 -0
  13. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  14. package/dist-lib/lib/floricode-required-features.functions.d.ts +360 -0
  15. package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -1
  16. package/dist-lib/lib/floriday-customer-offer.functions.d.ts +360 -0
  17. package/dist-lib/lib/floriday-customer-offer.functions.d.ts.map +1 -1
  18. package/dist-lib/lib/floriday-env.functions.d.ts +720 -0
  19. package/dist-lib/lib/floriday-env.functions.d.ts.map +1 -1
  20. package/dist-lib/lib/floriday-gateway.functions.d.ts +2160 -0
  21. package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
  22. package/dist-lib/lib/floriday-vbn-required.functions.d.ts +720 -0
  23. package/dist-lib/lib/floriday-vbn-required.functions.d.ts.map +1 -1
  24. package/dist-lib/lib/floriday-warehouse.functions.d.ts +1080 -0
  25. package/dist-lib/lib/floriday-warehouse.functions.d.ts.map +1 -1
  26. package/dist-lib/lib/floriday-writes.functions.d.ts +720 -0
  27. package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
  28. package/dist-lib/lib/inventory-settings.functions.d.ts +720 -0
  29. package/dist-lib/lib/inventory-settings.functions.d.ts.map +1 -1
  30. package/dist-lib/lib/stock-sync.functions.d.ts +720 -0
  31. package/dist-lib/lib/stock-sync.functions.d.ts.map +1 -1
  32. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleText.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/CollapsibleText.tsx"],"names":[],"mappings":"AAOA,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,KAAS,EAAE,SAAS,EAAE,EAAE,KAAK,+BAmDpE"}
1
+ {"version":3,"file":"CollapsibleText.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/CollapsibleText.tsx"],"names":[],"mappings":"AAOA,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,KAAS,EAAE,SAAS,EAAE,EAAE,KAAK,+BA8DpE"}
@@ -3,30 +3,33 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  * Lange tekstvelden die meer dan ~5 regels beslaan kunnen worden ingeklapt.
4
4
  * Kortere tekst wordt gewoon volledig getoond, zonder knop.
5
5
  */
6
- import { useEffect, useRef, useState } from "react";
6
+ import { useLayoutEffect, useRef, useState } from "react";
7
7
  import { ChevronDown, ChevronUp } from "lucide-react";
8
8
  export function CollapsibleText({ text, lines = 5, className }) {
9
9
  const value = (text ?? "").trim();
10
- const ref = useRef(null);
10
+ const containerRef = useRef(null);
11
+ const measureRef = useRef(null);
11
12
  const [expanded, setExpanded] = useState(false);
12
13
  const [overflowing, setOverflowing] = useState(false);
13
- useEffect(() => {
14
- const el = ref.current;
15
- if (!el)
14
+ useLayoutEffect(() => {
15
+ const container = containerRef.current;
16
+ const measure = measureRef.current;
17
+ if (!container || !measure)
16
18
  return;
17
19
  const check = () => {
18
- // Alleen meten zolang de tekst ingeklapt is; uitgeklapt past hij immers.
19
- if (!expanded)
20
- setOverflowing(el.scrollHeight > el.clientHeight + 1);
20
+ const lineHeight = Number.parseFloat(getComputedStyle(measure).lineHeight);
21
+ if (!Number.isFinite(lineHeight))
22
+ return;
23
+ setOverflowing(measure.scrollHeight > lineHeight * lines + 1);
21
24
  };
22
25
  check();
23
26
  if (typeof ResizeObserver !== "undefined") {
24
27
  const ro = new ResizeObserver(check);
25
- ro.observe(el);
28
+ ro.observe(container);
26
29
  return () => ro.disconnect();
27
30
  }
28
- }, [value, expanded]);
31
+ }, [value, lines]);
29
32
  if (!value)
30
33
  return _jsx("span", { className: "text-muted-foreground", children: "\u2014" });
31
- return (_jsxs("div", { className: className, children: [_jsx("p", { ref: ref, className: "break-words", style: expanded ? undefined : { WebkitLineClamp: lines, display: "-webkit-box", WebkitBoxOrient: "vertical", overflow: "hidden" }, children: value }), (overflowing || expanded) && (_jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), className: "mt-1 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline", children: expanded ? (_jsxs(_Fragment, { children: [_jsx(ChevronUp, { className: "h-3.5 w-3.5" }), " Inklappen"] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDown, { className: "h-3.5 w-3.5" }), " Meer tonen"] })) }))] }));
34
+ return (_jsxs("div", { ref: containerRef, className: `relative min-w-0 ${className ?? ""}`, children: [_jsx("p", { ref: measureRef, "aria-hidden": "true", className: "pointer-events-none invisible absolute inset-x-0 top-0 break-words", children: value }), _jsx("p", { className: "break-words", style: expanded ? undefined : { WebkitLineClamp: lines, display: "-webkit-box", WebkitBoxOrient: "vertical", overflow: "hidden" }, children: value }), (overflowing || expanded) && (_jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), className: "mt-1 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline", children: expanded ? (_jsxs(_Fragment, { children: [_jsx(ChevronUp, { className: "h-3.5 w-3.5" }), " Inklappen"] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDown, { className: "h-3.5 w-3.5" }), " Meer tonen"] })) }))] }));
32
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StockMutationHistoryCard.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockMutationHistoryCard.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AA8CD,wBAAgB,wBAAwB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,KAAK,+BAmM1E"}
1
+ {"version":3,"file":"StockMutationHistoryCard.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockMutationHistoryCard.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AA8CD,wBAAgB,wBAAwB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,KAAK,+BAyN1E"}
@@ -1,12 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /**
3
3
  * Afboekgeschiedenis: wanneer is er voorraad bij- of afgeboekt en waarom.
4
4
  * Leest public.stock_mutation_log op de sleutel van dit artikel (inclusief
5
5
  * de groepssleutel wanneer het artikel via een groep wordt afgeboekt).
6
6
  */
7
7
  import { useEffect, useState } from "react";
8
- import { Card, CardContent, Badge } from "@flowselections/core";
9
- import { Loader2, History } from "lucide-react";
8
+ import { Card, CardContent, Badge, Button } from "@flowselections/core";
9
+ import { ChevronDown, ChevronUp, Loader2, History } from "lucide-react";
10
10
  import { supabase } from "../../integrations/supabase/client";
11
11
  import { CollapsibleText } from "./CollapsibleText";
12
12
  const TYPE_LABEL = {
@@ -42,6 +42,7 @@ function formatMoment(v) {
42
42
  export function StockMutationHistoryCard({ tradeItemKey, productId }) {
43
43
  const [rows, setRows] = useState(null);
44
44
  const [error, setError] = useState(null);
45
+ const [expanded, setExpanded] = useState(false);
45
46
  useEffect(() => {
46
47
  let cancelled = false;
47
48
  const load = async () => {
@@ -119,17 +120,17 @@ export function StockMutationHistoryCard({ tradeItemKey, productId }) {
119
120
  supabase.removeChannel(channel);
120
121
  };
121
122
  }, [tradeItemKey, productId]);
122
- return (_jsxs(Card, { children: [_jsxs("div", { className: "grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 px-6 py-4", children: [_jsx("span", { className: "flex h-7 w-7 items-center justify-center rounded-full border border-primary/40 bg-primary/10 text-primary", children: _jsx(History, { className: "h-4 w-4" }) }), _jsx("span", { className: "font-medium", children: "Afboekgeschiedenis" }), _jsx("span", { className: "text-xs text-muted-foreground tabular-nums", children: rows ? `${rows.length} mutatie${rows.length === 1 ? "" : "s"}` : "" })] }), _jsxs(CardContent, { className: "pt-0", children: [error && (_jsxs("div", { className: "text-sm text-destructive", children: ["Kon voorraadmutaties niet laden: ", error] })), !rows && !error && (_jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Mutaties laden\u2026"] })), rows && rows.length === 0 && !error && (_jsx("div", { className: "text-sm text-muted-foreground", children: "Nog geen voorraadmutaties voor dit artikel." })), rows && rows.length > 0 && (_jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-xs uppercase text-muted-foreground", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 text-left", children: "Wanneer" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Soort" }), _jsx("th", { className: "px-3 py-2 text-right", children: "Aantal" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Van \u2192 naar" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Order" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Reden" })] }) }), _jsx("tbody", { children: rows.map((r) => {
123
- const meta = TYPE_LABEL[r.mutation_type] ?? {
124
- label: r.mutation_type || "Onbekend",
125
- tone: "bg-slate-100 text-slate-700 border-slate-200",
126
- };
127
- const physChanged = r.physical_before !== null &&
128
- r.physical_after !== null &&
129
- r.physical_before !== r.physical_after;
130
- const resChanged = r.reserved_before !== null &&
131
- r.reserved_after !== null &&
132
- r.reserved_before !== r.reserved_after;
133
- return (_jsxs("tr", { className: "border-t align-top", children: [_jsx("td", { className: "whitespace-nowrap px-3 py-2", children: formatMoment(r.created_at) }), _jsx("td", { className: "px-3 py-2", children: _jsx(Badge, { variant: "outline", className: `border ${meta.tone}`, children: meta.label }) }), _jsxs("td", { className: `px-3 py-2 text-right tabular-nums font-medium ${r.qty_delta < 0 ? "text-rose-700" : r.qty_delta > 0 ? "text-emerald-700" : ""}`, children: [r.qty_delta > 0 ? "+" : "", r.qty_delta] }), _jsxs("td", { className: "whitespace-nowrap px-3 py-2 tabular-nums text-muted-foreground", children: [physChanged && (_jsxs("div", { children: ["Liggend ", r.physical_before, " \u2192 ", r.physical_after] })), resChanged && (_jsxs("div", { children: ["Gereserveerd ", r.reserved_before, " \u2192 ", r.reserved_after] })), !physChanged && !resChanged && _jsx("span", { children: "\u2014" })] }), _jsx("td", { className: "whitespace-nowrap px-3 py-2", children: r.order_id ? (_jsx("a", { href: `/floriday-verkoop/verkooporders/${r.order_id}`, className: "text-primary hover:underline", children: r.order_number ?? "Order" })) : (_jsx("span", { className: "text-muted-foreground", children: "\u2014" })) }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: _jsx(CollapsibleText, { text: r.reason }) })] }, r.id));
134
- }) })] }) }))] })] }));
123
+ return (_jsxs(Card, { children: [_jsxs("div", { className: "grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 px-6 py-4", children: [_jsx("span", { className: "flex h-7 w-7 items-center justify-center rounded-full border border-primary/40 bg-primary/10 text-primary", children: _jsx(History, { className: "h-4 w-4" }) }), _jsx("span", { className: "font-medium", children: "Afboekgeschiedenis" }), _jsx("span", { className: "text-xs text-muted-foreground tabular-nums", children: rows ? `${rows.length} mutatie${rows.length === 1 ? "" : "s"}` : "" })] }), _jsxs(CardContent, { className: "pt-0", children: [error && (_jsxs("div", { className: "text-sm text-destructive", children: ["Kon voorraadmutaties niet laden: ", error] })), !rows && !error && (_jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Mutaties laden\u2026"] })), rows && rows.length === 0 && !error && (_jsx("div", { className: "text-sm text-muted-foreground", children: "Nog geen voorraadmutaties voor dit artikel." })), rows && rows.length > 0 && (_jsxs("div", { className: "overflow-x-auto rounded-md border", children: [_jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-xs uppercase text-muted-foreground", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 text-left", children: "Wanneer" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Soort" }), _jsx("th", { className: "px-3 py-2 text-right", children: "Aantal" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Van \u2192 naar" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Order" }), _jsx("th", { className: "px-3 py-2 text-left", children: "Reden" })] }) }), _jsx("tbody", { children: (expanded ? rows : rows.slice(0, 5)).map((r) => {
124
+ const meta = TYPE_LABEL[r.mutation_type] ?? {
125
+ label: r.mutation_type || "Onbekend",
126
+ tone: "bg-slate-100 text-slate-700 border-slate-200",
127
+ };
128
+ const physChanged = r.physical_before !== null &&
129
+ r.physical_after !== null &&
130
+ r.physical_before !== r.physical_after;
131
+ const resChanged = r.reserved_before !== null &&
132
+ r.reserved_after !== null &&
133
+ r.reserved_before !== r.reserved_after;
134
+ return (_jsxs("tr", { className: "border-t align-top", children: [_jsx("td", { className: "whitespace-nowrap px-3 py-2", children: formatMoment(r.created_at) }), _jsx("td", { className: "px-3 py-2", children: _jsx(Badge, { variant: "outline", className: `border ${meta.tone}`, children: meta.label }) }), _jsxs("td", { className: `px-3 py-2 text-right tabular-nums font-medium ${r.qty_delta < 0 ? "text-rose-700" : r.qty_delta > 0 ? "text-emerald-700" : ""}`, children: [r.qty_delta > 0 ? "+" : "", r.qty_delta] }), _jsxs("td", { className: "whitespace-nowrap px-3 py-2 tabular-nums text-muted-foreground", children: [physChanged && (_jsxs("div", { children: ["Liggend ", r.physical_before, " \u2192 ", r.physical_after] })), resChanged && (_jsxs("div", { children: ["Gereserveerd ", r.reserved_before, " \u2192 ", r.reserved_after] })), !physChanged && !resChanged && _jsx("span", { children: "\u2014" })] }), _jsx("td", { className: "whitespace-nowrap px-3 py-2", children: r.order_id ? (_jsx("a", { href: `/floriday-verkoop/verkooporders/${r.order_id}`, className: "text-primary hover:underline", children: r.order_number ?? "Order" })) : (_jsx("span", { className: "text-muted-foreground", children: "\u2014" })) }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: _jsx(CollapsibleText, { text: r.reason }) })] }, r.id));
135
+ }) })] }), rows.length > 5 && (_jsx("div", { className: "flex justify-center border-t bg-muted/20 px-3 py-2", children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => setExpanded((current) => !current), className: "gap-1.5", children: expanded ? (_jsxs(_Fragment, { children: [_jsx(ChevronUp, { className: "h-4 w-4" }), " Inklappen"] })) : (_jsxs(_Fragment, { children: [_jsx(ChevronDown, { className: "h-4 w-4" }), " Meer tonen (", rows.length - 5, ")"] })) }) }))] }))] })] }));
135
136
  }