@flowselections/core 1.0.8 → 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 (132) hide show
  1. package/dist/auth/useAuth.d.ts +27 -27
  2. package/dist/auth/useAuth.js +72 -72
  3. package/dist/components/instellingen/NotificationSettingsCard.d.ts +1 -1
  4. package/dist/components/instellingen/NotificationSettingsCard.js +63 -63
  5. package/dist/components/layout/BugsDialog.d.ts +6 -6
  6. package/dist/components/layout/BugsDialog.js +148 -148
  7. package/dist/components/layout/Header.d.ts +5 -5
  8. package/dist/components/layout/Header.js +30 -30
  9. package/dist/components/layout/InstellingenPage.d.ts +4 -4
  10. package/dist/components/layout/InstellingenPage.js +78 -78
  11. package/dist/components/layout/LoginPage.d.ts +5 -5
  12. package/dist/components/layout/LoginPage.js +57 -57
  13. package/dist/components/layout/NotificationBell.d.ts +1 -1
  14. package/dist/components/layout/NotificationBell.js +45 -45
  15. package/dist/components/layout/ResetWachtwoordPage.d.ts +5 -5
  16. package/dist/components/layout/ResetWachtwoordPage.js +51 -51
  17. package/dist/components/layout/Sidebar.d.ts +8 -8
  18. package/dist/components/layout/Sidebar.d.ts.map +1 -1
  19. package/dist/components/layout/Sidebar.js +29 -31
  20. package/dist/components/ui/accordion.d.ts +7 -7
  21. package/dist/components/ui/accordion.js +13 -13
  22. package/dist/components/ui/alert-dialog.d.ts +20 -20
  23. package/dist/components/ui/alert-dialog.js +26 -26
  24. package/dist/components/ui/alert.d.ts +8 -8
  25. package/dist/components/ui/alert.js +22 -22
  26. package/dist/components/ui/aspect-ratio.d.ts +3 -3
  27. package/dist/components/ui/aspect-ratio.js +3 -3
  28. package/dist/components/ui/avatar.d.ts +6 -6
  29. package/dist/components/ui/avatar.js +12 -12
  30. package/dist/components/ui/badge.d.ts +9 -9
  31. package/dist/components/ui/badge.js +20 -20
  32. package/dist/components/ui/breadcrumb.d.ts +19 -19
  33. package/dist/components/ui/breadcrumb.js +23 -23
  34. package/dist/components/ui/button.d.ts +11 -11
  35. package/dist/components/ui/button.js +33 -33
  36. package/dist/components/ui/calendar.d.ts +8 -8
  37. package/dist/components/ui/calendar.js +74 -74
  38. package/dist/components/ui/card.d.ts +8 -8
  39. package/dist/components/ui/card.js +16 -16
  40. package/dist/components/ui/carousel.d.ts +18 -18
  41. package/dist/components/ui/carousel.js +98 -98
  42. package/dist/components/ui/chart.d.ts +62 -62
  43. package/dist/components/ui/chart.js +130 -130
  44. package/dist/components/ui/checkbox.d.ts +4 -4
  45. package/dist/components/ui/checkbox.js +8 -8
  46. package/dist/components/ui/collapsible.d.ts +5 -5
  47. package/dist/components/ui/collapsible.js +6 -6
  48. package/dist/components/ui/command.d.ts +80 -80
  49. package/dist/components/ui/command.js +29 -29
  50. package/dist/components/ui/context-menu.d.ts +27 -27
  51. package/dist/components/ui/context-menu.js +33 -33
  52. package/dist/components/ui/dialog.d.ts +19 -19
  53. package/dist/components/ui/dialog.js +23 -23
  54. package/dist/components/ui/drawer.d.ts +22 -22
  55. package/dist/components/ui/drawer.js +22 -22
  56. package/dist/components/ui/dropdown-menu.d.ts +27 -27
  57. package/dist/components/ui/dropdown-menu.js +36 -36
  58. package/dist/components/ui/form.d.ts +23 -23
  59. package/dist/components/ui/form.js +65 -65
  60. package/dist/components/ui/hover-card.d.ts +6 -6
  61. package/dist/components/ui/hover-card.js +9 -9
  62. package/dist/components/ui/icon-picker.d.ts +14 -14
  63. package/dist/components/ui/icon-picker.js +73 -73
  64. package/dist/components/ui/input-otp.d.ts +34 -34
  65. package/dist/components/ui/input-otp.js +18 -18
  66. package/dist/components/ui/input.d.ts +3 -3
  67. package/dist/components/ui/input.js +8 -8
  68. package/dist/components/ui/label.d.ts +5 -5
  69. package/dist/components/ui/label.js +10 -10
  70. package/dist/components/ui/menubar.d.ts +28 -28
  71. package/dist/components/ui/menubar.js +45 -45
  72. package/dist/components/ui/navigation-menu.d.ts +12 -12
  73. package/dist/components/ui/navigation-menu.js +24 -24
  74. package/dist/components/ui/pagination.d.ts +28 -28
  75. package/dist/components/ui/pagination.js +23 -23
  76. package/dist/components/ui/popover.d.ts +7 -7
  77. package/dist/components/ui/popover.js +10 -10
  78. package/dist/components/ui/progress.d.ts +4 -4
  79. package/dist/components/ui/progress.js +8 -8
  80. package/dist/components/ui/radio-group.d.ts +5 -5
  81. package/dist/components/ui/radio-group.js +14 -14
  82. package/dist/components/ui/resizable.d.ts +7 -7
  83. package/dist/components/ui/resizable.js +8 -8
  84. package/dist/components/ui/scroll-area.d.ts +5 -5
  85. package/dist/components/ui/scroll-area.js +11 -11
  86. package/dist/components/ui/select.d.ts +13 -13
  87. package/dist/components/ui/select.js +27 -27
  88. package/dist/components/ui/separator.d.ts +4 -4
  89. package/dist/components/ui/separator.js +7 -7
  90. package/dist/components/ui/sheet.d.ts +25 -25
  91. package/dist/components/ui/sheet.js +37 -37
  92. package/dist/components/ui/sidebar.d.ts +65 -65
  93. package/dist/components/ui/sidebar.js +224 -224
  94. package/dist/components/ui/skeleton.d.ts +2 -2
  95. package/dist/components/ui/skeleton.js +6 -6
  96. package/dist/components/ui/slider.d.ts +4 -4
  97. package/dist/components/ui/slider.js +7 -7
  98. package/dist/components/ui/sonner.d.ts +4 -4
  99. package/dist/components/ui/sonner.js +13 -13
  100. package/dist/components/ui/switch.d.ts +4 -4
  101. package/dist/components/ui/switch.js +7 -7
  102. package/dist/components/ui/table.d.ts +10 -10
  103. package/dist/components/ui/table.js +20 -20
  104. package/dist/components/ui/tabs.d.ts +7 -7
  105. package/dist/components/ui/tabs.js +12 -12
  106. package/dist/components/ui/textarea.d.ts +3 -3
  107. package/dist/components/ui/textarea.js +8 -8
  108. package/dist/components/ui/toggle-group.d.ts +12 -12
  109. package/dist/components/ui/toggle-group.js +21 -21
  110. package/dist/components/ui/toggle.d.ts +12 -12
  111. package/dist/components/ui/toggle.js +25 -25
  112. package/dist/components/ui/tooltip.d.ts +7 -7
  113. package/dist/components/ui/tooltip.js +11 -11
  114. package/dist/hooks/use-mobile.d.ts +1 -1
  115. package/dist/hooks/use-mobile.js +15 -15
  116. package/dist/index.d.ts +31 -31
  117. package/dist/index.js +33 -33
  118. package/dist/lib/utils.d.ts +2 -2
  119. package/dist/lib/utils.js +5 -5
  120. package/dist/lib/validationSchemas.d.ts +14 -14
  121. package/dist/lib/validationSchemas.js +25 -25
  122. package/dist/supabase/auth-middleware.d.ts +638 -638
  123. package/dist/supabase/auth-middleware.js +52 -52
  124. package/dist/supabase/client.d.ts +634 -634
  125. package/dist/supabase/client.js +13 -13
  126. package/dist/supabase/client.server.d.ts +634 -634
  127. package/dist/supabase/client.server.js +30 -30
  128. package/dist/supabase/types.d.ts +716 -716
  129. package/dist/supabase/types.js +7 -7
  130. package/dist/types/module.d.ts +19 -19
  131. package/dist/types/module.js +1 -1
  132. package/package.json +1 -1
@@ -1,28 +1,28 @@
1
- import { User, Session } from "@supabase/supabase-js";
2
- export type AppRole = "admin" | "manager" | "warehouse" | "sales" | "developer";
3
- export interface AuthState {
4
- user: User | null;
5
- session: Session | null;
6
- loading: boolean;
7
- roles: AppRole[];
8
- isAdmin: boolean;
9
- isAuthenticated: boolean;
10
- profile: {
11
- display_name: string | null;
12
- email: string | null;
13
- } | null;
14
- }
15
- export interface AuthActions {
16
- signIn: (email: string, password: string) => Promise<{
17
- error: Error | null;
18
- }>;
19
- signOut: () => Promise<void>;
20
- resetPassword: (email: string) => Promise<{
21
- error: Error | null;
22
- }>;
23
- refreshRoles: () => Promise<void>;
24
- }
25
- export type AuthContext = AuthState & AuthActions;
26
- export declare function useAuthState(): AuthContext;
27
- export declare function useAuth(): AuthContext;
1
+ import { User, Session } from "@supabase/supabase-js";
2
+ export type AppRole = "admin" | "manager" | "warehouse" | "sales" | "developer";
3
+ export interface AuthState {
4
+ user: User | null;
5
+ session: Session | null;
6
+ loading: boolean;
7
+ roles: AppRole[];
8
+ isAdmin: boolean;
9
+ isAuthenticated: boolean;
10
+ profile: {
11
+ display_name: string | null;
12
+ email: string | null;
13
+ } | null;
14
+ }
15
+ export interface AuthActions {
16
+ signIn: (email: string, password: string) => Promise<{
17
+ error: Error | null;
18
+ }>;
19
+ signOut: () => Promise<void>;
20
+ resetPassword: (email: string) => Promise<{
21
+ error: Error | null;
22
+ }>;
23
+ refreshRoles: () => Promise<void>;
24
+ }
25
+ export type AuthContext = AuthState & AuthActions;
26
+ export declare function useAuthState(): AuthContext;
27
+ export declare function useAuth(): AuthContext;
28
28
  //# sourceMappingURL=useAuth.d.ts.map
@@ -1,72 +1,72 @@
1
- import { useState, useEffect, useCallback } from "react";
2
- import { supabase } from "../supabase/client";
3
- export function useAuthState() {
4
- const [user, setUser] = useState(null);
5
- const [session, setSession] = useState(null);
6
- const [loading, setLoading] = useState(true);
7
- const [roles, setRoles] = useState([]);
8
- const [profile, setProfile] = useState(null);
9
- const isAdmin = roles.includes("admin");
10
- const isAuthenticated = !!user;
11
- const fetchUserData = useCallback(async (userId) => {
12
- try {
13
- const [rolesRes, profileRes] = await Promise.all([
14
- supabase.from("user_roles").select("role").eq("user_id", userId),
15
- supabase.from("profiles").select("display_name, email").eq("id", userId).single(),
16
- ]);
17
- if (rolesRes.data)
18
- setRoles(rolesRes.data.map((r) => r.role));
19
- if (profileRes.data)
20
- setProfile(profileRes.data);
21
- }
22
- catch (error) {
23
- console.error("Error fetching user data:", error);
24
- }
25
- }, []);
26
- const refreshRoles = useCallback(async () => {
27
- if (user)
28
- await fetchUserData(user.id);
29
- }, [user, fetchUserData]);
30
- useEffect(() => {
31
- const { data: { subscription } } = supabase.auth.onAuthStateChange((_event, session) => {
32
- setSession(session);
33
- setUser(session?.user ?? null);
34
- setLoading(false);
35
- if (session?.user) {
36
- setTimeout(() => fetchUserData(session.user.id), 0);
37
- }
38
- else {
39
- setRoles([]);
40
- setProfile(null);
41
- }
42
- });
43
- supabase.auth.getSession().then(({ data: { session } }) => {
44
- setSession(session);
45
- setUser(session?.user ?? null);
46
- setLoading(false);
47
- if (session?.user)
48
- fetchUserData(session.user.id);
49
- });
50
- return () => subscription.unsubscribe();
51
- }, [fetchUserData]);
52
- const signIn = async (email, password) => {
53
- const { error } = await supabase.auth.signInWithPassword({ email, password });
54
- return { error: error };
55
- };
56
- const signOut = async () => {
57
- await supabase.auth.signOut();
58
- };
59
- const resetPassword = async (email) => {
60
- const { error } = await supabase.auth.resetPasswordForEmail(email, {
61
- redirectTo: `${window.location.origin}/reset-wachtwoord`,
62
- });
63
- return { error: error };
64
- };
65
- return {
66
- user, session, loading, roles, isAdmin, isAuthenticated, profile,
67
- signIn, signOut, resetPassword, refreshRoles,
68
- };
69
- }
70
- export function useAuth() {
71
- return useAuthState();
72
- }
1
+ import { useState, useEffect, useCallback } from "react";
2
+ import { supabase } from "../supabase/client";
3
+ export function useAuthState() {
4
+ const [user, setUser] = useState(null);
5
+ const [session, setSession] = useState(null);
6
+ const [loading, setLoading] = useState(true);
7
+ const [roles, setRoles] = useState([]);
8
+ const [profile, setProfile] = useState(null);
9
+ const isAdmin = roles.includes("admin");
10
+ const isAuthenticated = !!user;
11
+ const fetchUserData = useCallback(async (userId) => {
12
+ try {
13
+ const [rolesRes, profileRes] = await Promise.all([
14
+ supabase.from("user_roles").select("role").eq("user_id", userId),
15
+ supabase.from("profiles").select("display_name, email").eq("id", userId).single(),
16
+ ]);
17
+ if (rolesRes.data)
18
+ setRoles(rolesRes.data.map((r) => r.role));
19
+ if (profileRes.data)
20
+ setProfile(profileRes.data);
21
+ }
22
+ catch (error) {
23
+ console.error("Error fetching user data:", error);
24
+ }
25
+ }, []);
26
+ const refreshRoles = useCallback(async () => {
27
+ if (user)
28
+ await fetchUserData(user.id);
29
+ }, [user, fetchUserData]);
30
+ useEffect(() => {
31
+ const { data: { subscription } } = supabase.auth.onAuthStateChange((_event, session) => {
32
+ setSession(session);
33
+ setUser(session?.user ?? null);
34
+ setLoading(false);
35
+ if (session?.user) {
36
+ setTimeout(() => fetchUserData(session.user.id), 0);
37
+ }
38
+ else {
39
+ setRoles([]);
40
+ setProfile(null);
41
+ }
42
+ });
43
+ supabase.auth.getSession().then(({ data: { session } }) => {
44
+ setSession(session);
45
+ setUser(session?.user ?? null);
46
+ setLoading(false);
47
+ if (session?.user)
48
+ fetchUserData(session.user.id);
49
+ });
50
+ return () => subscription.unsubscribe();
51
+ }, [fetchUserData]);
52
+ const signIn = async (email, password) => {
53
+ const { error } = await supabase.auth.signInWithPassword({ email, password });
54
+ return { error: error };
55
+ };
56
+ const signOut = async () => {
57
+ await supabase.auth.signOut();
58
+ };
59
+ const resetPassword = async (email) => {
60
+ const { error } = await supabase.auth.resetPasswordForEmail(email, {
61
+ redirectTo: `${window.location.origin}/reset-wachtwoord`,
62
+ });
63
+ return { error: error };
64
+ };
65
+ return {
66
+ user, session, loading, roles, isAdmin, isAuthenticated, profile,
67
+ signIn, signOut, resetPassword, refreshRoles,
68
+ };
69
+ }
70
+ export function useAuth() {
71
+ return useAuthState();
72
+ }
@@ -1,2 +1,2 @@
1
- export declare function NotificationSettingsCard(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function NotificationSettingsCard(): import("react/jsx-runtime").JSX.Element;
2
2
  //# sourceMappingURL=NotificationSettingsCard.d.ts.map
@@ -1,63 +1,63 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card";
4
- import { Switch } from "../ui/switch";
5
- import { Bell, Loader2 } from "lucide-react";
6
- import { supabase } from "../../supabase/client";
7
- import { toast } from "sonner";
8
- export function NotificationSettingsCard() {
9
- const [prefs, setPrefs] = useState({ email_notifications: true });
10
- const [loading, setLoading] = useState(true);
11
- const [saving, setSaving] = useState(false);
12
- useEffect(() => {
13
- (async () => {
14
- try {
15
- const { data: { user } } = await supabase.auth.getUser();
16
- if (!user)
17
- return;
18
- const { data } = await supabase
19
- .from("profiles")
20
- .select("notification_preferences")
21
- .eq("id", user.id)
22
- .maybeSingle();
23
- if (data?.notification_preferences) {
24
- setPrefs(data.notification_preferences);
25
- }
26
- }
27
- catch {
28
- // ignore
29
- }
30
- finally {
31
- setLoading(false);
32
- }
33
- })();
34
- }, []);
35
- const updatePref = async (key, value) => {
36
- const newPrefs = { ...prefs, [key]: value };
37
- setPrefs(newPrefs);
38
- setSaving(true);
39
- try {
40
- const { data: { user } } = await supabase.auth.getUser();
41
- if (!user)
42
- throw new Error("Niet ingelogd");
43
- const { error } = await supabase
44
- .from("profiles")
45
- .update({ notification_preferences: newPrefs })
46
- .eq("id", user.id);
47
- if (error)
48
- throw error;
49
- toast.success("Notificatie-instelling opgeslagen");
50
- }
51
- catch {
52
- setPrefs(prefs); // rollback
53
- toast.error("Fout bij opslaan");
54
- }
55
- finally {
56
- setSaving(false);
57
- }
58
- };
59
- if (loading) {
60
- return (_jsx(Card, { children: _jsx(CardContent, { className: "flex items-center justify-center py-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) }));
61
- }
62
- return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Bell, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Notificatievoorkeuren" })] }), _jsx(CardDescription, { children: "Beheer je notificatie-instellingen" })] }), _jsx(CardContent, { className: "space-y-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium", children: "E-mailnotificaties" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Ontvang meldingen per e-mail" })] }), _jsx(Switch, { checked: prefs.email_notifications, onCheckedChange: (v) => updatePref("email_notifications", v), disabled: saving })] }) })] }));
63
- }
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card";
4
+ import { Switch } from "../ui/switch";
5
+ import { Bell, Loader2 } from "lucide-react";
6
+ import { supabase } from "../../supabase/client";
7
+ import { toast } from "sonner";
8
+ export function NotificationSettingsCard() {
9
+ const [prefs, setPrefs] = useState({ email_notifications: true });
10
+ const [loading, setLoading] = useState(true);
11
+ const [saving, setSaving] = useState(false);
12
+ useEffect(() => {
13
+ (async () => {
14
+ try {
15
+ const { data: { user } } = await supabase.auth.getUser();
16
+ if (!user)
17
+ return;
18
+ const { data } = await supabase
19
+ .from("profiles")
20
+ .select("notification_preferences")
21
+ .eq("id", user.id)
22
+ .maybeSingle();
23
+ if (data?.notification_preferences) {
24
+ setPrefs(data.notification_preferences);
25
+ }
26
+ }
27
+ catch {
28
+ // ignore
29
+ }
30
+ finally {
31
+ setLoading(false);
32
+ }
33
+ })();
34
+ }, []);
35
+ const updatePref = async (key, value) => {
36
+ const newPrefs = { ...prefs, [key]: value };
37
+ setPrefs(newPrefs);
38
+ setSaving(true);
39
+ try {
40
+ const { data: { user } } = await supabase.auth.getUser();
41
+ if (!user)
42
+ throw new Error("Niet ingelogd");
43
+ const { error } = await supabase
44
+ .from("profiles")
45
+ .update({ notification_preferences: newPrefs })
46
+ .eq("id", user.id);
47
+ if (error)
48
+ throw error;
49
+ toast.success("Notificatie-instelling opgeslagen");
50
+ }
51
+ catch {
52
+ setPrefs(prefs); // rollback
53
+ toast.error("Fout bij opslaan");
54
+ }
55
+ finally {
56
+ setSaving(false);
57
+ }
58
+ };
59
+ if (loading) {
60
+ return (_jsx(Card, { children: _jsx(CardContent, { className: "flex items-center justify-center py-8", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) }));
61
+ }
62
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Bell, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Notificatievoorkeuren" })] }), _jsx(CardDescription, { children: "Beheer je notificatie-instellingen" })] }), _jsx(CardContent, { className: "space-y-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium", children: "E-mailnotificaties" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Ontvang meldingen per e-mail" })] }), _jsx(Switch, { checked: prefs.email_notifications, onCheckedChange: (v) => updatePref("email_notifications", v), disabled: saving })] }) })] }));
63
+ }
@@ -1,7 +1,7 @@
1
- interface BugsDialogProps {
2
- open: boolean;
3
- onOpenChange: (open: boolean) => void;
4
- }
5
- export declare function BugsDialog({ open, onOpenChange }: BugsDialogProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
1
+ interface BugsDialogProps {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ }
5
+ export declare function BugsDialog({ open, onOpenChange }: BugsDialogProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
7
7
  //# sourceMappingURL=BugsDialog.d.ts.map