Seth commited on
Commit ·
bdec327
1
Parent(s): 40b20ff
update
Browse files
frontend/src/components/settings/ConnectMailboxSettings.jsx
CHANGED
|
@@ -1,14 +1,12 @@
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { Mail, RefreshCw, Loader2 } from 'lucide-react';
|
| 3 |
import { Button } from '@/components/ui/button';
|
| 4 |
-
import { Input } from '@/components/ui/input';
|
| 5 |
import { apiFetch } from '@/lib/api';
|
| 6 |
import { cn } from '@/lib/utils';
|
| 7 |
|
| 8 |
export default function ConnectMailboxSettings() {
|
| 9 |
const [loading, setLoading] = useState(true);
|
| 10 |
const [busy, setBusy] = useState(false);
|
| 11 |
-
const [profileName, setProfileName] = useState('');
|
| 12 |
const [accounts, setAccounts] = useState([]);
|
| 13 |
const [defaultRefId, setDefaultRefId] = useState(null);
|
| 14 |
|
|
@@ -17,7 +15,6 @@ export default function ConnectMailboxSettings() {
|
|
| 17 |
try {
|
| 18 |
const r = await apiFetch('/api/unipile/mailbox/campaign-defaults');
|
| 19 |
const d = r.ok ? await r.json() : {};
|
| 20 |
-
setProfileName(d.mailbox_profile_display_name || '');
|
| 21 |
setAccounts(d.accounts || []);
|
| 22 |
setDefaultRefId(d.default_mailbox_unipile_account_ref_id ?? null);
|
| 23 |
} catch {
|
|
@@ -38,8 +35,7 @@ export default function ConnectMailboxSettings() {
|
|
| 38 |
method: 'POST',
|
| 39 |
headers: { 'Content-Type': 'application/json' },
|
| 40 |
body: JSON.stringify({
|
| 41 |
-
label:
|
| 42 |
-
mailbox_profile_display_name: profileName.trim() || undefined,
|
| 43 |
}),
|
| 44 |
});
|
| 45 |
const data = await res.json().catch(() => ({}));
|
|
@@ -69,15 +65,6 @@ export default function ConnectMailboxSettings() {
|
|
| 69 |
<Button type="button" disabled={busy} onClick={connectAccount} className="bg-slate-900 text-white">
|
| 70 |
Connect mailbox
|
| 71 |
</Button>
|
| 72 |
-
<div className="flex-1 md:max-w-md">
|
| 73 |
-
<label className="mb-1 block text-xs font-medium text-slate-600">Mailbox profile name</label>
|
| 74 |
-
<Input
|
| 75 |
-
placeholder="e.g. Seth S"
|
| 76 |
-
value={profileName}
|
| 77 |
-
onChange={(e) => setProfileName(e.target.value)}
|
| 78 |
-
className="h-10"
|
| 79 |
-
/>
|
| 80 |
-
</div>
|
| 81 |
</div>
|
| 82 |
|
| 83 |
{loading ? (
|
|
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { Mail, RefreshCw, Loader2 } from 'lucide-react';
|
| 3 |
import { Button } from '@/components/ui/button';
|
|
|
|
| 4 |
import { apiFetch } from '@/lib/api';
|
| 5 |
import { cn } from '@/lib/utils';
|
| 6 |
|
| 7 |
export default function ConnectMailboxSettings() {
|
| 8 |
const [loading, setLoading] = useState(true);
|
| 9 |
const [busy, setBusy] = useState(false);
|
|
|
|
| 10 |
const [accounts, setAccounts] = useState([]);
|
| 11 |
const [defaultRefId, setDefaultRefId] = useState(null);
|
| 12 |
|
|
|
|
| 15 |
try {
|
| 16 |
const r = await apiFetch('/api/unipile/mailbox/campaign-defaults');
|
| 17 |
const d = r.ok ? await r.json() : {};
|
|
|
|
| 18 |
setAccounts(d.accounts || []);
|
| 19 |
setDefaultRefId(d.default_mailbox_unipile_account_ref_id ?? null);
|
| 20 |
} catch {
|
|
|
|
| 35 |
method: 'POST',
|
| 36 |
headers: { 'Content-Type': 'application/json' },
|
| 37 |
body: JSON.stringify({
|
| 38 |
+
label: 'Mailbox',
|
|
|
|
| 39 |
}),
|
| 40 |
});
|
| 41 |
const data = await res.json().catch(() => ({}));
|
|
|
|
| 65 |
<Button type="button" disabled={busy} onClick={connectAccount} className="bg-slate-900 text-white">
|
| 66 |
Connect mailbox
|
| 67 |
</Button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
</div>
|
| 69 |
|
| 70 |
{loading ? (
|
frontend/src/components/settings/LinkedInConnectSettings.jsx
CHANGED
|
@@ -1,19 +1,12 @@
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { Link2, RefreshCw, Loader2 } from 'lucide-react';
|
| 3 |
import { Button } from '@/components/ui/button';
|
| 4 |
-
import { Input } from '@/components/ui/input';
|
| 5 |
import { apiFetch } from '@/lib/api';
|
| 6 |
import { cn } from '@/lib/utils';
|
| 7 |
|
| 8 |
-
function defaultAccountLabelFromProfile(profile) {
|
| 9 |
-
const p = (profile || '').trim();
|
| 10 |
-
return p ? `${p}'s LinkedIn account` : 'LinkedIn account';
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
export default function LinkedInConnectSettings() {
|
| 14 |
const [loading, setLoading] = useState(true);
|
| 15 |
const [busy, setBusy] = useState(false);
|
| 16 |
-
const [profileName, setProfileName] = useState('');
|
| 17 |
const [accounts, setAccounts] = useState([]);
|
| 18 |
const [defaultRefId, setDefaultRefId] = useState(null);
|
| 19 |
|
|
@@ -22,7 +15,6 @@ export default function LinkedInConnectSettings() {
|
|
| 22 |
try {
|
| 23 |
const r = await apiFetch('/api/unipile/linkedin/campaign-defaults');
|
| 24 |
const d = r.ok ? await r.json() : {};
|
| 25 |
-
setProfileName(d.linkedin_profile_display_name || '');
|
| 26 |
setAccounts(d.accounts || []);
|
| 27 |
setDefaultRefId(d.default_unipile_account_ref_id ?? null);
|
| 28 |
} catch {
|
|
@@ -43,8 +35,7 @@ export default function LinkedInConnectSettings() {
|
|
| 43 |
method: 'POST',
|
| 44 |
headers: { 'Content-Type': 'application/json' },
|
| 45 |
body: JSON.stringify({
|
| 46 |
-
label:
|
| 47 |
-
linkedin_profile_display_name: profileName.trim() || undefined,
|
| 48 |
}),
|
| 49 |
});
|
| 50 |
const data = await res.json().catch(() => ({}));
|
|
@@ -74,15 +65,6 @@ export default function LinkedInConnectSettings() {
|
|
| 74 |
<Link2 className="mr-2 h-4 w-4" />
|
| 75 |
Connect account
|
| 76 |
</Button>
|
| 77 |
-
<div className="flex-1 md:max-w-md">
|
| 78 |
-
<label className="mb-1 block text-xs font-medium text-slate-600">LinkedIn profile name</label>
|
| 79 |
-
<Input
|
| 80 |
-
placeholder="e.g. Seth S — shown in campaigns"
|
| 81 |
-
value={profileName}
|
| 82 |
-
onChange={(e) => setProfileName(e.target.value)}
|
| 83 |
-
className="h-10"
|
| 84 |
-
/>
|
| 85 |
-
</div>
|
| 86 |
</div>
|
| 87 |
|
| 88 |
{loading ? (
|
|
|
|
| 1 |
import React, { useCallback, useEffect, useState } from 'react';
|
| 2 |
import { Link2, RefreshCw, Loader2 } from 'lucide-react';
|
| 3 |
import { Button } from '@/components/ui/button';
|
|
|
|
| 4 |
import { apiFetch } from '@/lib/api';
|
| 5 |
import { cn } from '@/lib/utils';
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
export default function LinkedInConnectSettings() {
|
| 8 |
const [loading, setLoading] = useState(true);
|
| 9 |
const [busy, setBusy] = useState(false);
|
|
|
|
| 10 |
const [accounts, setAccounts] = useState([]);
|
| 11 |
const [defaultRefId, setDefaultRefId] = useState(null);
|
| 12 |
|
|
|
|
| 15 |
try {
|
| 16 |
const r = await apiFetch('/api/unipile/linkedin/campaign-defaults');
|
| 17 |
const d = r.ok ? await r.json() : {};
|
|
|
|
| 18 |
setAccounts(d.accounts || []);
|
| 19 |
setDefaultRefId(d.default_unipile_account_ref_id ?? null);
|
| 20 |
} catch {
|
|
|
|
| 35 |
method: 'POST',
|
| 36 |
headers: { 'Content-Type': 'application/json' },
|
| 37 |
body: JSON.stringify({
|
| 38 |
+
label: 'LinkedIn account',
|
|
|
|
| 39 |
}),
|
| 40 |
});
|
| 41 |
const data = await res.json().catch(() => ({}));
|
|
|
|
| 65 |
<Link2 className="mr-2 h-4 w-4" />
|
| 66 |
Connect account
|
| 67 |
</Button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
</div>
|
| 69 |
|
| 70 |
{loading ? (
|