@flowselections/mailbox-orders 1.0.16 → 1.0.18

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 (28) 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/MailboxInboxPage.d.ts +2 -0
  5. package/dist-lib/components/MailboxInboxPage.d.ts.map +1 -0
  6. package/dist-lib/components/MailboxInboxPage.js +120 -0
  7. package/dist-lib/components/settings/ImapAccountsCard.d.ts +2 -0
  8. package/dist-lib/components/settings/ImapAccountsCard.d.ts.map +1 -0
  9. package/dist-lib/components/settings/ImapAccountsCard.js +136 -0
  10. package/dist-lib/components/settings/ImapProfilesCard.d.ts +2 -0
  11. package/dist-lib/components/settings/ImapProfilesCard.d.ts.map +1 -0
  12. package/dist-lib/components/settings/ImapProfilesCard.js +101 -0
  13. package/dist-lib/components/settings/MailboxSettingsCard.d.ts +2 -0
  14. package/dist-lib/components/settings/MailboxSettingsCard.d.ts.map +1 -0
  15. package/dist-lib/components/settings/MailboxSettingsCard.js +85 -0
  16. package/dist-lib/integrations/supabase/client.d.ts +4 -1
  17. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  18. package/dist-lib/integrations/supabase/client.server.d.ts +4 -1
  19. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  20. package/dist-lib/integrations/supabase/types.d.ts +4 -1
  21. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  22. package/dist-lib/lib/imap.functions.d.ts +32852 -0
  23. package/dist-lib/lib/imap.functions.d.ts.map +1 -0
  24. package/dist-lib/lib/imap.functions.js +235 -0
  25. package/dist-lib/lib/mailbox-auto.server.d.ts +9 -0
  26. package/dist-lib/lib/mailbox-auto.server.d.ts.map +1 -0
  27. package/dist-lib/lib/mailbox-auto.server.js +198 -0
  28. package/package.json +2 -2
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button, Input, Label, Switch, toast, } from "@flowselections/core";
4
+ import { Mail, RefreshCw } from "lucide-react";
5
+ import { getMailboxSettings, saveMailboxSettings, testMailboxConnection, pollMailbox, } from "../../lib/mailbox.functions";
6
+ export function MailboxSettingsCard() {
7
+ const [form, setForm] = useState({
8
+ imap_host: "",
9
+ imap_port: 993,
10
+ imap_username: "",
11
+ imap_use_tls: true,
12
+ folder: "INBOX",
13
+ polling_enabled: false,
14
+ });
15
+ const [loading, setLoading] = useState(true);
16
+ const [saving, setSaving] = useState(false);
17
+ const [testing, setTesting] = useState(false);
18
+ const [polling, setPolling] = useState(false);
19
+ useEffect(() => {
20
+ (async () => {
21
+ try {
22
+ const res = await getMailboxSettings();
23
+ if (res?.settings) {
24
+ setForm({
25
+ imap_host: res.settings.imap_host ?? "",
26
+ imap_port: res.settings.imap_port ?? 993,
27
+ imap_username: res.settings.imap_username ?? "",
28
+ imap_use_tls: res.settings.imap_use_tls ?? true,
29
+ folder: res.settings.folder ?? "INBOX",
30
+ polling_enabled: res.settings.polling_enabled ?? false,
31
+ });
32
+ }
33
+ }
34
+ finally {
35
+ setLoading(false);
36
+ }
37
+ })();
38
+ }, []);
39
+ const handleSave = async () => {
40
+ setSaving(true);
41
+ try {
42
+ await saveMailboxSettings({ data: form });
43
+ toast.success("Instellingen opgeslagen");
44
+ }
45
+ catch (e) {
46
+ toast.error(e?.message ?? "Opslaan mislukt");
47
+ }
48
+ finally {
49
+ setSaving(false);
50
+ }
51
+ };
52
+ const handleTest = async () => {
53
+ setTesting(true);
54
+ try {
55
+ const res = await testMailboxConnection();
56
+ if (res?.ok)
57
+ toast.success("Verbinding OK");
58
+ else
59
+ toast.error(res?.error ?? "Verbinding mislukt");
60
+ }
61
+ catch (e) {
62
+ toast.error(e?.message ?? "Verbinding mislukt");
63
+ }
64
+ finally {
65
+ setTesting(false);
66
+ }
67
+ };
68
+ const handlePoll = async () => {
69
+ setPolling(true);
70
+ try {
71
+ const res = await pollMailbox();
72
+ if (res?.ok)
73
+ toast.success(`${res.inserted ?? 0} nieuwe e-mail(s) opgehaald`);
74
+ else
75
+ toast.error(res?.error ?? "Ophalen mislukt");
76
+ }
77
+ catch (e) {
78
+ toast.error(e?.message ?? "Ophalen mislukt");
79
+ }
80
+ finally {
81
+ setPolling(false);
82
+ }
83
+ };
84
+ return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Mail, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Mailbox (IMAP)" })] }), _jsx(CardDescription, { children: "IMAP-mailbox waaruit bestel-e-mails worden opgehaald. Het wachtwoord staat als geheime sleutel opgeslagen." })] }), _jsx(CardContent, { className: "space-y-4", children: loading ? (_jsx("div", { className: "text-sm text-muted-foreground", children: "Laden..." })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "space-y-2 col-span-2", children: [_jsx(Label, { htmlFor: "host", children: "IMAP host" }), _jsx(Input, { id: "host", value: form.imap_host, onChange: (e) => setForm({ ...form, imap_host: e.target.value }), placeholder: "imap.example.com" })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "port", children: "Poort" }), _jsx(Input, { id: "port", type: "number", value: form.imap_port, onChange: (e) => setForm({ ...form, imap_port: Number(e.target.value) }) })] }), _jsxs("div", { className: "space-y-2 flex flex-col", children: [_jsx(Label, { htmlFor: "tls", children: "TLS" }), _jsx(Switch, { id: "tls", checked: form.imap_use_tls, onCheckedChange: (v) => setForm({ ...form, imap_use_tls: v }) })] }), _jsxs("div", { className: "space-y-2 col-span-2", children: [_jsx(Label, { htmlFor: "user", children: "Gebruikersnaam" }), _jsx(Input, { id: "user", value: form.imap_username, onChange: (e) => setForm({ ...form, imap_username: e.target.value }), placeholder: "bestellingen@example.com" })] }), _jsxs("div", { className: "space-y-2 col-span-2", children: [_jsx(Label, { htmlFor: "folder", children: "Map" }), _jsx(Input, { id: "folder", value: form.folder, onChange: (e) => setForm({ ...form, folder: e.target.value }) })] }), _jsxs("div", { className: "space-y-2 col-span-2 flex items-center justify-between", children: [_jsx(Label, { htmlFor: "poll", children: "Automatisch ophalen (elke 5 min)" }), _jsx(Switch, { id: "poll", checked: form.polling_enabled, onCheckedChange: (v) => setForm({ ...form, polling_enabled: v }) })] })] }), _jsxs("div", { className: "flex gap-2 flex-wrap", children: [_jsx(Button, { onClick: handleSave, disabled: saving, children: saving ? "Opslaan..." : "Opslaan" }), _jsx(Button, { variant: "outline", onClick: handleTest, disabled: testing, children: testing ? "Testen..." : "Test verbinding" }), _jsxs(Button, { variant: "outline", onClick: handlePoll, disabled: polling, children: [_jsx(RefreshCw, { className: `h-4 w-4 mr-2 ${polling ? "animate-spin" : ""}` }), "Nu ophalen"] })] }), _jsxs("p", { className: "text-xs text-muted-foreground", children: ["Het IMAP-wachtwoord is opgeslagen als geheime sleutel ", _jsx("code", { children: "MAILBOX_IMAP_PASSWORD" }), "."] })] })) })] }));
85
+ }
@@ -10201,6 +10201,7 @@ export declare const supabase: import("@supabase/supabase-js").SupabaseClient<Da
10201
10201
  module_registry: {
10202
10202
  Row: {
10203
10203
  created_at: string;
10204
+ enforce: boolean;
10204
10205
  is_active: boolean;
10205
10206
  last_seen_at: string;
10206
10207
  module_id: string;
@@ -10210,6 +10211,7 @@ export declare const supabase: import("@supabase/supabase-js").SupabaseClient<Da
10210
10211
  };
10211
10212
  Insert: {
10212
10213
  created_at?: string;
10214
+ enforce?: boolean;
10213
10215
  is_active?: boolean;
10214
10216
  last_seen_at?: string;
10215
10217
  module_id: string;
@@ -10219,6 +10221,7 @@ export declare const supabase: import("@supabase/supabase-js").SupabaseClient<Da
10219
10221
  };
10220
10222
  Update: {
10221
10223
  created_at?: string;
10224
+ enforce?: boolean;
10222
10225
  is_active?: boolean;
10223
10226
  last_seen_at?: string;
10224
10227
  module_id?: string;
@@ -19418,7 +19421,7 @@ export declare const supabase: import("@supabase/supabase-js").SupabaseClient<Da
19418
19421
  Returns: string;
19419
19422
  } | {
19420
19423
  Args: {
19421
- _feature_id?: string;
19424
+ _feature_id: string;
19422
19425
  _module_id: string;
19423
19426
  _user_id: string;
19424
19427
  };