@flowselections/logistiek-engine 1.0.7 → 1.0.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.
Files changed (34) hide show
  1. package/README.md +24 -24
  2. package/dist-lib/components/RuleEnginePage.d.ts +1 -1
  3. package/dist-lib/components/RuleEnginePage.d.ts.map +1 -1
  4. package/dist-lib/components/RuleEnginePage.js +22 -2
  5. package/dist-lib/hooks/useRecalcJob.js +1 -1
  6. package/dist-lib/hooks/useRuleEngine.d.ts.map +1 -1
  7. package/dist-lib/hooks/useRuleEngine.js +3 -1
  8. package/dist-lib/integrations/supabase/auth-attacher.js +1 -1
  9. package/dist-lib/integrations/supabase/auth-middleware.d.ts +695 -128
  10. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  11. package/dist-lib/integrations/supabase/client.d.ts +8 -787
  12. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  13. package/dist-lib/integrations/supabase/client.server.d.ts +695 -128
  14. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  15. package/dist-lib/integrations/supabase/moduleClient.d.ts +21640 -0
  16. package/dist-lib/integrations/supabase/moduleClient.d.ts.map +1 -0
  17. package/dist-lib/integrations/supabase/moduleClient.js +31 -0
  18. package/dist-lib/integrations/supabase/types.d.ts +727 -155
  19. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  20. package/dist-lib/integrations/supabase/types.js +3 -0
  21. package/dist-lib/lib/floridayDocuments.functions.d.ts +2085 -384
  22. package/dist-lib/lib/floridayDocuments.functions.d.ts.map +1 -1
  23. package/dist-lib/lib/floridayPush.functions.d.ts +695 -128
  24. package/dist-lib/lib/floridayPush.functions.d.ts.map +1 -1
  25. package/dist-lib/lib/loadCarrierPlanning.functions.d.ts +3505 -645
  26. package/dist-lib/lib/loadCarrierPlanning.functions.d.ts.map +1 -1
  27. package/dist-lib/lib/logisticsRecalcJob.functions.d.ts +1390 -256
  28. package/dist-lib/lib/logisticsRecalcJob.functions.d.ts.map +1 -1
  29. package/dist-lib/lib/logisticsRecalculate.functions.d.ts +695 -128
  30. package/dist-lib/lib/logisticsRecalculate.functions.d.ts.map +1 -1
  31. package/dist-lib/lib/modulePrompts.d.ts +0 -1
  32. package/dist-lib/lib/modulePrompts.d.ts.map +1 -1
  33. package/dist-lib/lib/modulePrompts.js +970 -960
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # logistiek Engine
2
-
3
- blank project start
4
-
5
- This project was built with [Lovable](https://lovable.dev).
6
-
7
- ## Build with Lovable
8
-
9
- Continue developing this project in the [Lovable editor](https://lovable.dev/projects/316ec9c5-0f01-408a-b7ec-3d4dccf9b65d).
10
-
11
- - **Ship faster**: describe what you want to build and Lovable handles the code.
12
- - **Stay in sync**: every change made in Lovable is committed straight to this repository.
13
- - **Full ownership**: this code is yours. Push to `main` on GitHub and your changes sync back into Lovable, ready for your next prompt.
14
-
15
- ## Development
16
-
17
- Prefer working locally? You need Node.js and npm — [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating).
18
-
19
- ```sh
20
- git clone <this-repository-url>
21
- cd <repository-name>
22
- npm i
23
- npm run dev
24
- ```
1
+ # logistiek Engine
2
+
3
+ blank project start
4
+
5
+ This project was built with [Lovable](https://lovable.dev).
6
+
7
+ ## Build with Lovable
8
+
9
+ Continue developing this project in the [Lovable editor](https://lovable.dev/projects/316ec9c5-0f01-408a-b7ec-3d4dccf9b65d).
10
+
11
+ - **Ship faster**: describe what you want to build and Lovable handles the code.
12
+ - **Stay in sync**: every change made in Lovable is committed straight to this repository.
13
+ - **Full ownership**: this code is yours. Push to `main` on GitHub and your changes sync back into Lovable, ready for your next prompt.
14
+
15
+ ## Development
16
+
17
+ Prefer working locally? You need Node.js and npm — [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating).
18
+
19
+ ```sh
20
+ git clone <this-repository-url>
21
+ cd <repository-name>
22
+ npm i
23
+ npm run dev
24
+ ```
@@ -3,5 +3,5 @@ export interface RuleEnginePageProps {
3
3
  strategyId?: string | null;
4
4
  strategyName?: string | null;
5
5
  }
6
- export declare function RuleEnginePage({ strategyId, strategyName }?: RuleEnginePageProps): import("react").JSX.Element;
6
+ export declare function RuleEnginePage({ strategyId: strategyIdProp, strategyName: strategyNameProp, }?: RuleEnginePageProps): import("react").JSX.Element;
7
7
  //# sourceMappingURL=RuleEnginePage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RuleEnginePage.d.ts","sourceRoot":"","sources":["../../src/components/RuleEnginePage.tsx"],"names":[],"mappings":"AAiEA,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAQD,wBAAgB,cAAc,CAAC,EAAE,UAAiB,EAAE,YAAmB,EAAE,GAAE,mBAAwB,+BAkYlG"}
1
+ {"version":3,"file":"RuleEnginePage.d.ts","sourceRoot":"","sources":["../../src/components/RuleEnginePage.tsx"],"names":[],"mappings":"AAmEA,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAQD,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EAAE,cAAqB,EACjC,YAAY,EAAE,gBAAuB,GACtC,GAAE,mBAAwB,+BAuZ1B"}
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // src/components/RuleEnginePage.tsx — logistieke werkwijze instellen
4
4
  // ============================================================================
5
5
  import { useMemo, useState } from "react";
6
+ import { useSearch } from "@tanstack/react-router";
6
7
  import { Badge, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Input, Label, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Skeleton, } from "@flowselections/core";
7
8
  import { AlertTriangle, CheckCircle2, ChevronLeft, ChevronRight, MoreVertical, Plus, RefreshCw, Save, Trash2, } from "lucide-react";
8
9
  import { toast } from "@flowselections/core";
@@ -19,7 +20,26 @@ const WIDE_TYPES = ["priority", "toggle", "days", "radio", "textarea"];
19
20
  function fieldClass(field) {
20
21
  return WIDE_TYPES.includes(field.type) ? "md:col-span-2" : "";
21
22
  }
22
- export function RuleEnginePage({ strategyId = null, strategyName = null } = {}) {
23
+ export function RuleEnginePage({ strategyId: strategyIdProp = null, strategyName: strategyNameProp = null, } = {}) {
24
+ // De shell rendert deze pagina zonder props; lees de gekozen werkwijze daarom zelf uit de URL.
25
+ const routeSearch = useSearch({ strict: false });
26
+ const urlSearch = useMemo(() => {
27
+ const fromRoute = {
28
+ strategy: typeof routeSearch?.strategy === "string" ? routeSearch.strategy : null,
29
+ naam: typeof routeSearch?.naam === "string" ? routeSearch.naam : null,
30
+ };
31
+ if (fromRoute.strategy)
32
+ return fromRoute;
33
+ if (typeof window === "undefined")
34
+ return fromRoute;
35
+ const params = new URLSearchParams(window.location.search);
36
+ return {
37
+ strategy: params.get("strategy"),
38
+ naam: params.get("naam") ?? fromRoute.naam,
39
+ };
40
+ }, [routeSearch]);
41
+ const strategyId = strategyIdProp ?? urlSearch.strategy ?? null;
42
+ const strategyName = strategyNameProp ?? urlSearch.naam ?? null;
23
43
  const { versions, activeConfig, loading, saving, error, createConfig, patchSettings, saveConfig, activateConfig, restoreVersion, deleteConfig, } = useRuleEngine({ strategyId, strategyName });
24
44
  const [stepIndex, setStepIndex] = useState(0);
25
45
  const [createOpen, setCreateOpen] = useState(false);
@@ -100,7 +120,7 @@ export function RuleEnginePage({ strategyId = null, strategyName = null } = {})
100
120
  ? "Bezig…"
101
121
  : "Opslaan & opnieuw berekenen"] })] })] }), error && (_jsx("p", { className: "rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: "De gegevens konden niet worden geladen. Probeer het opnieuw." })), showJobLine && (_jsxs("div", { className: `rounded-md border px-3 py-2 text-sm ${job?.status === "error" ? "border-destructive/50 bg-destructive/5 text-destructive" : "border-border"}`, children: [_jsx("span", { children: running
102
122
  ? `${phaseLabel(job?.phase)} — ${job?.processed ?? 0} verwerkt`
103
- : "De laatste berekening is niet volledig gelukt." }), jobProblems.length > 0 && (_jsx("ul", { className: "mt-1 list-disc pl-5 text-xs", children: jobProblems.map((p, i) => (_jsx("li", { children: p }, i))) }))] })), !loading && activeConfig && !activeConfig.is_active && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-500/60 bg-amber-500/5 px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex items-start gap-2", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600" }), "Deze werkwijze staat nog op ", _jsx("strong", { children: "concept" }), " en telt nog niet mee bij het inplannen."] }), _jsxs(Button, { size: "sm", onClick: () => activateConfig(activeConfig.id), children: [_jsx(CheckCircle2, { className: "h-4 w-4" }), "Nu activeren"] })] })), loading ? (_jsxs("div", { className: "space-y-3", children: [_jsx(Skeleton, { className: "h-10 w-full" }), _jsx(Skeleton, { className: "h-64 w-full" })] })) : !activeConfig ? (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Nog geen werkwijze" }), _jsx(CardDescription, { children: "Maak een werkwijze aan om vast te leggen hoe jouw orders verwerkt worden." })] }), _jsx(CardContent, { children: _jsxs(Button, { onClick: () => setCreateOpen(true), children: [_jsx(Plus, { className: "h-4 w-4" }), "Werkwijze aanmaken"] }) })] })) : (_jsxs("div", { className: "grid gap-6 lg:h-[calc(100vh-13rem)] lg:grid-cols-[220px_minmax(0,1fr)_320px]", children: [_jsx("nav", { className: "space-y-1 lg:overflow-y-auto lg:pr-1", children: WIZARD_STEPS.map((item, index) => (_jsxs("button", { type: "button", onClick: () => setStepIndex(index), className: `flex w-full items-center gap-3 rounded-lg border p-2.5 text-left transition-colors ${index === stepIndex
123
+ : "De laatste berekening is niet volledig gelukt." }), jobProblems.length > 0 && (_jsx("ul", { className: "mt-1 list-disc pl-5 text-xs", children: jobProblems.map((p, i) => (_jsx("li", { children: p }, i))) }))] })), !loading && activeConfig && !activeConfig.is_active && (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-500/60 bg-amber-500/5 px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex items-start gap-2", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600" }), "Deze werkwijze staat nog op ", _jsx("strong", { children: "concept" }), " en telt nog niet mee bij het inplannen."] }), _jsxs(Button, { size: "sm", onClick: () => activateConfig(activeConfig.id), children: [_jsx(CheckCircle2, { className: "h-4 w-4" }), "Nu activeren"] })] })), loading || (strategyId && !activeConfig && !error) ? (_jsxs("div", { className: "space-y-3", children: [_jsx(Skeleton, { className: "h-10 w-full" }), _jsx(Skeleton, { className: "h-64 w-full" })] })) : !activeConfig ? (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Nog geen werkwijze" }), _jsx(CardDescription, { children: "Maak een werkwijze aan om vast te leggen hoe jouw orders verwerkt worden." })] }), _jsx(CardContent, { children: _jsxs(Button, { onClick: () => setCreateOpen(true), children: [_jsx(Plus, { className: "h-4 w-4" }), "Werkwijze aanmaken"] }) })] })) : (_jsxs("div", { className: "grid gap-6 lg:h-[calc(100vh-13rem)] lg:grid-cols-[220px_minmax(0,1fr)_320px]", children: [_jsx("nav", { className: "space-y-1 lg:overflow-y-auto lg:pr-1", children: WIZARD_STEPS.map((item, index) => (_jsxs("button", { type: "button", onClick: () => setStepIndex(index), className: `flex w-full items-center gap-3 rounded-lg border p-2.5 text-left transition-colors ${index === stepIndex
104
124
  ? "border-primary bg-primary/5"
105
125
  : "border-transparent hover:bg-muted"}`, children: [_jsx("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold", children: index + 1 }), _jsx("span", { className: "text-sm font-medium", children: item.label })] }, item.id))) }), _jsxs("div", { className: "space-y-4 lg:min-h-0 lg:overflow-y-auto lg:pr-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { className: "pb-3", children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx(CardTitle, { className: "text-base", children: step.label }), _jsx(CardDescription, { children: step.description })] }), _jsx(Badge, { variant: activeConfig.is_active ? "default" : "secondary", children: activeConfig.is_active ? "Actief" : "Concept" })] }) }), _jsx(CardContent, { className: "space-y-3", children: step.groups.map((group, groupIndex) => {
106
126
  const visibleFields = group.fields.filter((field) => fieldVisible(field, stepValues, settings));
@@ -3,7 +3,7 @@
3
3
  // ============================================================================
4
4
  import { useCallback, useEffect, useRef, useState } from "react";
5
5
  import { useServerFn } from "@tanstack/react-start";
6
- import { supabase } from "../integrations/supabase/client";
6
+ import { supabase } from "../integrations/supabase/moduleClient";
7
7
  import { startRecalcJob, tickRecalcJob } from "../lib/logisticsRecalcJob.functions";
8
8
  const PHASE_LABEL = {
9
9
  buffers: "Orderbuffers indelen",
@@ -1 +1 @@
1
- {"version":3,"file":"useRuleEngine.d.ts","sourceRoot":"","sources":["../../src/hooks/useRuleEngine.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEtG,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAA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AAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAiBD,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB;;;;;;;;;yBAwF3C,MAAM,gBAAgB,MAAM;8BA2BE,MAAM,YAAY,kBAAkB;yBAUhE,UAAU,YAAY;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;+BA4CtD,MAAM;8BA+BP,WAAW;6BAYqB,MAAM;;EA4BzD"}
@@ -52,8 +52,10 @@ export function useRuleEngine(options) {
52
52
  })
53
53
  .select()
54
54
  .single();
55
- if (createError)
55
+ if (createError) {
56
+ toast.error("De werkwijze kon niet worden geopend. Probeer het opnieuw.");
56
57
  throw createError;
58
+ }
57
59
  rows = [toConfig(created)];
58
60
  }
59
61
  setConfigs(rows);
@@ -1,6 +1,6 @@
1
1
  // This file is automatically generated. Do not edit it directly.
2
2
  import { createMiddleware } from '@tanstack/react-start';
3
- import { supabase } from './client';
3
+ import { supabase } from './moduleClient';
4
4
  // Must be registered as a global `functionMiddleware` in `src/start.ts`; otherwise
5
5
  // the browser never attaches the bearer token to serverFn RPCs.
6
6
  export const attachSupabaseAuth = createMiddleware({ type: 'function' }).client(async ({ next }) => {