@flowselections/mailbox-orders 1.0.3 → 1.0.5

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 (30) hide show
  1. package/dist-lib/components/CartAssignmentWizard.d.ts +6 -0
  2. package/dist-lib/components/CartAssignmentWizard.d.ts.map +1 -0
  3. package/dist-lib/components/CartAssignmentWizard.js +199 -0
  4. package/dist-lib/components/MailboxProcessedPage.d.ts.map +1 -1
  5. package/dist-lib/components/MailboxProcessedPage.js +25 -4
  6. package/dist-lib/components/MailboxProposalsPage.d.ts.map +1 -1
  7. package/dist-lib/components/MailboxProposalsPage.js +325 -60
  8. package/dist-lib/components/SearchableSelect.d.ts +2 -1
  9. package/dist-lib/components/SearchableSelect.d.ts.map +1 -1
  10. package/dist-lib/components/SearchableSelect.js +4 -3
  11. package/dist-lib/index.d.ts +0 -1
  12. package/dist-lib/index.d.ts.map +1 -1
  13. package/dist-lib/index.js +2 -4
  14. package/dist-lib/integrations/supabase/auth-attacher.d.ts.map +1 -1
  15. package/dist-lib/integrations/supabase/auth-attacher.js +37 -3
  16. package/dist-lib/integrations/supabase/auth-middleware.d.ts +3460 -157
  17. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  18. package/dist-lib/integrations/supabase/client.d.ts +3460 -157
  19. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  20. package/dist-lib/integrations/supabase/client.server.d.ts +3460 -157
  21. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  22. package/dist-lib/integrations/supabase/types.d.ts +3553 -157
  23. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  24. package/dist-lib/integrations/supabase/types.js +2 -0
  25. package/dist-lib/lib/mailbox-template.functions.d.ts +43350 -23532
  26. package/dist-lib/lib/mailbox-template.functions.d.ts.map +1 -1
  27. package/dist-lib/lib/mailbox.functions.d.ts +142263 -33138
  28. package/dist-lib/lib/mailbox.functions.d.ts.map +1 -1
  29. package/dist-lib/lib/mailbox.functions.js +392 -18
  30. package/package.json +2 -7
@@ -9,7 +9,41 @@ export const attachSupabaseAuth = createMiddleware({ type: 'function' }).client(
9
9
  const { supabase } = await import('./client');
10
10
  const { data } = await supabase.auth.getSession();
11
11
  const token = data.session?.access_token;
12
- return next({
13
- headers: token ? { Authorization: `Bearer ${token}` } : {},
14
- });
12
+ const redirectToLogin = async () => {
13
+ try {
14
+ await supabase.auth.signOut();
15
+ }
16
+ catch { /* noop */ }
17
+ try {
18
+ window.localStorage.clear();
19
+ }
20
+ catch { /* noop */ }
21
+ if (!window.location.pathname.startsWith('/login')) {
22
+ window.location.replace('/login');
23
+ }
24
+ };
25
+ try {
26
+ return await next({
27
+ headers: token ? { Authorization: `Bearer ${token}` } : {},
28
+ });
29
+ }
30
+ catch (err) {
31
+ // TanStack geeft door auth-middleware gegooide Response-objecten soms als
32
+ // raw Response terug aan de browser. Als we die opnieuw gooien, toont de
33
+ // runtime overlay alleen `[object Response]`. Zet ze daarom om naar óf een
34
+ // stille login-redirect (401) óf een normale Error met leesbare tekst.
35
+ if (err instanceof Response) {
36
+ if (err.status === 401) {
37
+ await redirectToLogin();
38
+ throw new Error('Sessie verlopen — log opnieuw in.');
39
+ }
40
+ let message = '';
41
+ try {
42
+ message = await err.clone().text();
43
+ }
44
+ catch { /* noop */ }
45
+ throw new Error(message || `Serverfout (${err.status})`);
46
+ }
47
+ throw err;
48
+ }
15
49
  });