@flowselections/core 1.0.8 → 1.0.10

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 (137) 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.d.ts.map +1 -1
  9. package/dist/components/layout/Header.js +11 -30
  10. package/dist/components/layout/InstellingenPage.d.ts +4 -4
  11. package/dist/components/layout/InstellingenPage.js +78 -78
  12. package/dist/components/layout/LoginPage.d.ts +5 -5
  13. package/dist/components/layout/LoginPage.js +57 -57
  14. package/dist/components/layout/NotificationBell.d.ts +1 -1
  15. package/dist/components/layout/NotificationBell.js +45 -45
  16. package/dist/components/layout/ResetWachtwoordPage.d.ts +5 -5
  17. package/dist/components/layout/ResetWachtwoordPage.js +51 -51
  18. package/dist/components/layout/Sidebar.d.ts +8 -8
  19. package/dist/components/layout/Sidebar.d.ts.map +1 -1
  20. package/dist/components/layout/Sidebar.js +29 -31
  21. package/dist/components/ui/accordion.d.ts +7 -7
  22. package/dist/components/ui/accordion.js +13 -13
  23. package/dist/components/ui/alert-dialog.d.ts +20 -20
  24. package/dist/components/ui/alert-dialog.js +26 -26
  25. package/dist/components/ui/alert.d.ts +8 -8
  26. package/dist/components/ui/alert.js +22 -22
  27. package/dist/components/ui/aspect-ratio.d.ts +3 -3
  28. package/dist/components/ui/aspect-ratio.js +3 -3
  29. package/dist/components/ui/avatar.d.ts +6 -6
  30. package/dist/components/ui/avatar.js +12 -12
  31. package/dist/components/ui/badge.d.ts +9 -9
  32. package/dist/components/ui/badge.js +20 -20
  33. package/dist/components/ui/breadcrumb.d.ts +19 -19
  34. package/dist/components/ui/breadcrumb.js +23 -23
  35. package/dist/components/ui/button.d.ts +11 -11
  36. package/dist/components/ui/button.js +33 -33
  37. package/dist/components/ui/calendar.d.ts +8 -8
  38. package/dist/components/ui/calendar.js +74 -74
  39. package/dist/components/ui/card.d.ts +8 -8
  40. package/dist/components/ui/card.js +16 -16
  41. package/dist/components/ui/carousel.d.ts +18 -18
  42. package/dist/components/ui/carousel.js +98 -98
  43. package/dist/components/ui/chart.d.ts +62 -62
  44. package/dist/components/ui/chart.js +130 -130
  45. package/dist/components/ui/checkbox.d.ts +4 -4
  46. package/dist/components/ui/checkbox.js +8 -8
  47. package/dist/components/ui/collapsible.d.ts +5 -5
  48. package/dist/components/ui/collapsible.js +6 -6
  49. package/dist/components/ui/command.d.ts +80 -80
  50. package/dist/components/ui/command.js +29 -29
  51. package/dist/components/ui/context-menu.d.ts +27 -27
  52. package/dist/components/ui/context-menu.js +33 -33
  53. package/dist/components/ui/dialog.d.ts +19 -19
  54. package/dist/components/ui/dialog.js +23 -23
  55. package/dist/components/ui/drawer.d.ts +22 -22
  56. package/dist/components/ui/drawer.js +22 -22
  57. package/dist/components/ui/dropdown-menu.d.ts +27 -27
  58. package/dist/components/ui/dropdown-menu.js +36 -36
  59. package/dist/components/ui/form.d.ts +23 -23
  60. package/dist/components/ui/form.js +65 -65
  61. package/dist/components/ui/hover-card.d.ts +6 -6
  62. package/dist/components/ui/hover-card.js +9 -9
  63. package/dist/components/ui/icon-picker.d.ts +14 -14
  64. package/dist/components/ui/icon-picker.js +73 -73
  65. package/dist/components/ui/input-otp.d.ts +34 -34
  66. package/dist/components/ui/input-otp.js +18 -18
  67. package/dist/components/ui/input.d.ts +3 -3
  68. package/dist/components/ui/input.js +8 -8
  69. package/dist/components/ui/label.d.ts +5 -5
  70. package/dist/components/ui/label.js +10 -10
  71. package/dist/components/ui/menubar.d.ts +28 -28
  72. package/dist/components/ui/menubar.js +45 -45
  73. package/dist/components/ui/navigation-menu.d.ts +12 -12
  74. package/dist/components/ui/navigation-menu.js +24 -24
  75. package/dist/components/ui/pagination.d.ts +28 -28
  76. package/dist/components/ui/pagination.js +23 -23
  77. package/dist/components/ui/popover.d.ts +7 -7
  78. package/dist/components/ui/popover.js +10 -10
  79. package/dist/components/ui/progress.d.ts +4 -4
  80. package/dist/components/ui/progress.js +8 -8
  81. package/dist/components/ui/radio-group.d.ts +5 -5
  82. package/dist/components/ui/radio-group.js +14 -14
  83. package/dist/components/ui/resizable.d.ts +7 -7
  84. package/dist/components/ui/resizable.js +8 -8
  85. package/dist/components/ui/scroll-area.d.ts +5 -5
  86. package/dist/components/ui/scroll-area.js +11 -11
  87. package/dist/components/ui/select.d.ts +13 -13
  88. package/dist/components/ui/select.js +27 -27
  89. package/dist/components/ui/separator.d.ts +4 -4
  90. package/dist/components/ui/separator.js +7 -7
  91. package/dist/components/ui/sheet.d.ts +25 -25
  92. package/dist/components/ui/sheet.js +37 -37
  93. package/dist/components/ui/sidebar.d.ts +65 -65
  94. package/dist/components/ui/sidebar.js +224 -224
  95. package/dist/components/ui/skeleton.d.ts +2 -2
  96. package/dist/components/ui/skeleton.js +6 -6
  97. package/dist/components/ui/slider.d.ts +4 -4
  98. package/dist/components/ui/slider.js +7 -7
  99. package/dist/components/ui/sonner.d.ts +4 -4
  100. package/dist/components/ui/sonner.js +13 -13
  101. package/dist/components/ui/switch.d.ts +4 -4
  102. package/dist/components/ui/switch.js +7 -7
  103. package/dist/components/ui/table.d.ts +10 -10
  104. package/dist/components/ui/table.js +20 -20
  105. package/dist/components/ui/tabs.d.ts +7 -7
  106. package/dist/components/ui/tabs.js +12 -12
  107. package/dist/components/ui/textarea.d.ts +3 -3
  108. package/dist/components/ui/textarea.js +8 -8
  109. package/dist/components/ui/toggle-group.d.ts +12 -12
  110. package/dist/components/ui/toggle-group.js +21 -21
  111. package/dist/components/ui/toggle.d.ts +12 -12
  112. package/dist/components/ui/toggle.js +25 -25
  113. package/dist/components/ui/tooltip.d.ts +7 -7
  114. package/dist/components/ui/tooltip.js +11 -11
  115. package/dist/hooks/use-mobile.d.ts +1 -1
  116. package/dist/hooks/use-mobile.js +15 -15
  117. package/dist/hooks/useHuisstijl.d.ts +2 -0
  118. package/dist/hooks/useHuisstijl.d.ts.map +1 -0
  119. package/dist/hooks/useHuisstijl.js +22 -0
  120. package/dist/index.d.ts +32 -31
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +34 -33
  123. package/dist/lib/utils.d.ts +2 -2
  124. package/dist/lib/utils.js +5 -5
  125. package/dist/lib/validationSchemas.d.ts +14 -14
  126. package/dist/lib/validationSchemas.js +25 -25
  127. package/dist/supabase/auth-middleware.d.ts +638 -638
  128. package/dist/supabase/auth-middleware.js +52 -52
  129. package/dist/supabase/client.d.ts +634 -634
  130. package/dist/supabase/client.js +13 -13
  131. package/dist/supabase/client.server.d.ts +634 -634
  132. package/dist/supabase/client.server.js +30 -30
  133. package/dist/supabase/types.d.ts +716 -716
  134. package/dist/supabase/types.js +7 -7
  135. package/dist/types/module.d.ts +19 -19
  136. package/dist/types/module.js +1 -1
  137. 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