-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpersonaquanta-outreach.html
More file actions
653 lines (596 loc) · 25.1 KB
/
Copy pathpersonaquanta-outreach.html
File metadata and controls
653 lines (596 loc) · 25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
<!DOCTYPE html>
<html lang="uk">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PersonaQuanta — Outreach Generator</title>
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Instrument+Sans:wght@400;500;600&family=DM+Serif+Display:ital@0;1&display=swap" rel="stylesheet">
<style>
:root {
--bg: #06090F;
--surf: rgba(255,255,255,.045);
--surf2: rgba(255,255,255,.025);
--bdr: rgba(255,255,255,.09);
--text: #E8EEFF;
--muted: rgba(232,238,255,.6);
--muted2: rgba(232,238,255,.38);
--acc: #2AA7FF;
--acc2: #00D9AE;
--acc3: #FFB547;
--red: #FF6060;
--sans: 'Instrument Sans', system-ui, sans-serif;
--mono: 'DM Mono', monospace;
--serif: 'DM Serif Display', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
font-family: var(--sans);
background: var(--bg);
color: var(--text);
min-height: 100vh;
}
body::before {
content: '';
position: fixed; inset: 0; z-index: 0; pointer-events: none;
background:
radial-gradient(ellipse 900px 500px at 80% -5%, rgba(42,167,255,.1) 0%, transparent 60%),
radial-gradient(ellipse 600px 400px at 5% 40%, rgba(0,217,174,.07) 0%, transparent 55%);
}
/* ── NAV ── */
.nav {
position: sticky; top: 0; z-index: 100;
display: flex; align-items: center; justify-content: space-between;
padding: 14px 28px;
background: rgba(6,9,15,.85);
backdrop-filter: blur(16px);
border-bottom: 1px solid var(--bdr);
}
.brand { font-family: var(--serif); font-size: 17px; color: var(--text); }
.brand span { font-family: var(--mono); font-size: 10px; color: var(--muted2); margin-left: 10px; letter-spacing: .1em; }
.nav-btn {
font-family: var(--mono); font-size: 10px; color: var(--muted2);
background: var(--surf); border: 1px solid var(--bdr);
border-radius: 6px; padding: 6px 12px; cursor: pointer;
transition: color .15s, border-color .15s;
}
.nav-btn:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
/* ── GATE ── */
#gate {
position: relative; z-index: 1;
display: flex; align-items: center; justify-content: center;
min-height: calc(100vh - 53px); padding: 40px 24px;
}
.gate-card {
width: 100%; max-width: 420px;
background: var(--surf); border: 1px solid var(--bdr);
border-radius: 18px; padding: 40px 36px;
}
.gate-label {
font-family: var(--mono); font-size: 10px; color: var(--acc);
letter-spacing: .12em; margin-bottom: 14px;
}
.gate-title { font-family: var(--serif); font-size: 26px; color: var(--text); margin-bottom: 10px; }
.gate-sub { font-size: 13px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }
/* ── MAIN LAYOUT ── */
#app { display: none; position: relative; z-index: 1; }
.layout {
max-width: 1140px; margin: 0 auto;
display: grid; grid-template-columns: 370px 1fr;
gap: 22px; padding: 28px 24px 60px;
}
@media (max-width: 820px) {
.layout { grid-template-columns: 1fr; }
}
/* ── PANEL ── */
.panel {
background: var(--surf); border: 1px solid var(--bdr);
border-radius: 14px; padding: 24px 22px;
}
.panel-title {
font-family: var(--mono); font-size: 9.5px; color: var(--muted2);
letter-spacing: .1em; margin-bottom: 20px;
}
/* ── FORM FIELDS ── */
.field { margin-bottom: 15px; }
.field label {
display: block; font-family: var(--mono); font-size: 9px;
color: var(--muted2); letter-spacing: .09em; margin-bottom: 6px;
}
.field input, .field select, .field textarea {
width: 100%; padding: 10px 13px; border-radius: 9px;
background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
color: var(--text); font-family: var(--sans); font-size: 13px;
outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
border-color: rgba(42,167,255,.45);
}
.field select { background: #0c1220; }
.field textarea { resize: vertical; line-height: 1.55; color: var(--muted); }
.field textarea::placeholder { color: var(--muted2); }
.field input::placeholder { color: var(--muted2); }
/* ── BUTTONS ── */
.btn-primary {
width: 100%; padding: 13px; border-radius: 10px;
background: var(--acc); border: none;
color: #06090F; font-weight: 700; font-size: 14px;
font-family: var(--sans); cursor: pointer;
transition: opacity .15s, transform .1s;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-copy {
font-family: var(--mono); font-size: 10px; color: var(--muted2);
background: var(--surf2); border: 1px solid var(--bdr);
border-radius: 6px; padding: 6px 11px; cursor: pointer;
transition: all .15s; white-space: nowrap;
}
.btn-copy:hover { color: var(--acc2); border-color: rgba(0,217,174,.3); }
.btn-copy.copied { color: var(--acc2); border-color: rgba(0,217,174,.4); background: rgba(0,217,174,.08); }
/* ── TABS ── */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
padding: 8px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
cursor: pointer; border: 1px solid var(--bdr);
background: var(--surf2); color: var(--muted);
font-family: var(--sans); transition: all .15s;
}
.tab.active {
background: var(--acc); border-color: var(--acc); color: #06090F;
}
.tab-actions { margin-left: auto; display: flex; gap: 6px; }
/* ── MESSAGE BOX ── */
.msg-box {
background: var(--surf); border: 1px solid var(--bdr);
border-radius: 12px; padding: 22px 20px;
position: relative; min-height: 220px;
}
.msg-text {
font-size: 13.5px; line-height: 1.78; color: var(--text);
white-space: pre-wrap; word-break: break-word;
font-family: var(--sans);
}
.copy-float {
position: absolute; top: 14px; right: 14px;
}
.word-count {
font-family: var(--mono); font-size: 10px; color: var(--muted2);
text-align: right; margin-top: 8px;
}
/* ── HOOK BADGE ── */
.hook-badge {
display: flex; gap: 12px; align-items: flex-start;
background: rgba(0,217,174,.07); border: 1px solid rgba(0,217,174,.2);
border-radius: 10px; padding: 13px 16px; margin-bottom: 16px;
}
.hook-icon { color: var(--acc2); font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.hook-label {
font-family: var(--mono); font-size: 9px; color: var(--acc2);
letter-spacing: .09em; margin-bottom: 5px;
}
.hook-text { font-size: 12px; color: var(--muted); line-height: 1.6; }
/* ── EMPTY STATE ── */
.empty {
min-height: 420px; display: flex; flex-direction: column;
align-items: center; justify-content: center; gap: 14px;
border: 1px dashed rgba(255,255,255,.08); border-radius: 14px;
color: var(--muted2); text-align: center;
}
.empty-icon { font-size: 36px; opacity: .4; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--muted); }
.empty-sub { font-size: 12px; max-width: 260px; line-height: 1.65; }
/* ── SPINNER ── */
.spinner-wrap {
min-height: 420px; display: flex; flex-direction: column;
align-items: center; justify-content: center; gap: 18px;
}
.spinner {
width: 38px; height: 38px; border-radius: 50%;
border: 2px solid rgba(42,167,255,.15);
border-top-color: var(--acc);
animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-label { font-size: 12px; color: var(--muted2); font-family: var(--mono); }
/* ── HISTORY ── */
.history-section { margin-top: 16px; }
.history-label {
font-family: var(--mono); font-size: 9px; color: var(--muted2);
letter-spacing: .1em; margin-bottom: 10px;
}
.hist-item {
padding: 10px 14px; border-radius: 9px; margin-bottom: 6px;
background: var(--surf2); border: 1px solid var(--bdr);
cursor: pointer; display: flex; justify-content: space-between;
align-items: center; transition: border-color .15s;
}
.hist-item:hover { border-color: rgba(255,255,255,.18); }
.hist-name { font-size: 12px; color: var(--text); font-weight: 600; }
.hist-role { font-size: 10px; color: var(--muted2); margin-top: 2px; }
.hist-time { font-family: var(--mono); font-size: 10px; color: var(--muted2); }
/* ── ERROR ── */
.error-box {
background: rgba(255,80,80,.08); border: 1px solid rgba(255,80,80,.22);
border-radius: 8px; padding: 10px 14px;
font-size: 12px; color: var(--red); margin-bottom: 14px;
}
/* ── DIVIDER ── */
.divider {
border: none; border-top: 1px solid var(--bdr); margin: 16px 0;
}
</style>
</head>
<body>
<!-- NAV -->
<nav class="nav">
<div class="brand">
PersonaQuanta
<span>· OUTREACH GENERATOR</span>
</div>
<button class="nav-btn" onclick="resetKey()">⚙ API KEY</button>
</nav>
<!-- GATE -->
<div id="gate">
<div class="gate-card">
<div class="gate-label">PERSONAQUANTA</div>
<div class="gate-title">Outreach Generator</div>
<div class="gate-sub">
Персоналізовані повідомлення для кожного контакту — LinkedIn DM, Email, два follow-up. Введи Anthropic API key щоб почати.
</div>
<div class="field">
<label>ANTHROPIC API KEY</label>
<input type="password" id="api-key-input" placeholder="sk-ant-api03-..." autocomplete="off"
onkeydown="if(event.key==='Enter') activateKey()" />
</div>
<div id="gate-error" class="error-box" style="display:none"></div>
<button class="btn-primary" onclick="activateKey()">Продовжити →</button>
<div style="margin-top:16px;font-family:var(--mono);font-size:10px;color:var(--muted2);line-height:1.7;">
Key використовується тільки в цьому браузері для запитів до Claude API.<br>
Не зберігається на сервері. Знайти: console.anthropic.com
</div>
</div>
</div>
<!-- MAIN APP -->
<div id="app">
<div class="layout">
<!-- LEFT: FORM -->
<div>
<div class="panel">
<div class="panel-title">CONTACT DETAILS</div>
<div class="field">
<label>ІМ'Я *</label>
<input type="text" id="f-name" placeholder="Sarah" />
</div>
<div class="field">
<label>КОМПАНІЯ *</label>
<input type="text" id="f-company" placeholder="Monzo, Lemonade, Revolut..." />
</div>
<div class="field">
<label>ПОСАДА</label>
<select id="f-title">
<option>Head of Product</option>
<option>VP Product</option>
<option>CPO / Chief Product Officer</option>
<option>VP Growth</option>
<option>Head of Growth</option>
<option>CDO / Chief Digital Officer</option>
<option>Head of CX</option>
<option>VP Customer Experience</option>
<option>Head of Partnerships</option>
<option>Founder / CEO</option>
<option>Co-founder</option>
</select>
</div>
<div class="field">
<label>ТИП КОМПАНІЇ</label>
<select id="f-type">
<option>Neobank</option>
<option>Insurtech</option>
<option>Embedded Finance</option>
<option>Wealth Management</option>
<option>Financial Wellness App</option>
<option>Lending Platform</option>
<option>Traditional Insurance Carrier</option>
<option>Bank Innovation Lab</option>
<option>Fintech Startup</option>
</select>
</div>
<div class="field">
<label>КАНАЛ</label>
<select id="f-channel">
<option>Обидва (LinkedIn + Email)</option>
<option>Тільки LinkedIn DM</option>
<option>Тільки Email</option>
</select>
</div>
<hr class="divider">
<div class="field">
<label>КОНТЕКСТ (необов'язково)</label>
<textarea id="f-context" rows="3"
placeholder="Нещодавно запустили продукт, підняли раунд, активно наймають..."></textarea>
</div>
<div class="field">
<label>НОВИНИ / ТРИГЕР (необов'язково)</label>
<textarea id="f-news" rows="3"
placeholder="Пост в LinkedIn, job posting, виступ на конференції, конкретна подія..."></textarea>
</div>
<div id="form-error" class="error-box" style="display:none"></div>
<button class="btn-primary" id="gen-btn" onclick="generate()">
Генерувати повідомлення →
</button>
</div>
<!-- HISTORY -->
<div class="history-section" id="history-section" style="display:none">
<div class="history-label">ОСТАННІ КОНТАКТИ</div>
<div id="history-list"></div>
</div>
</div>
<!-- RIGHT: RESULTS -->
<div id="right-panel">
<div class="empty">
<div class="empty-icon">◈</div>
<div class="empty-title">Заповни форму зліва</div>
<div class="empty-sub">
Введи ім'я і компанію, натисни «Генерувати» — отримаєш 5 персоналізованих повідомлень
</div>
</div>
</div>
</div>
</div>
<script>
// ── STATE ──────────────────────────────────────────────────────────────
let apiKey = '';
let history = [];
let currentResult = null;
let activeTab = 'linkedin_dm';
const SYSTEM_PROMPT = `You are a B2B outreach specialist writing cold messages for PersonaQuanta — an engagement & education layer for fintech and life insurance product teams.
PersonaQuanta sells a Pilot Blueprint Pack (not production software) that helps product teams build an interactive "economic persona" experience: users answer a short questionnaire and receive explainable indices (NW/LEP/SEV/CS) with uncertainty ranges, confidence scores (CONF), top drivers, and what-if exploration.
Core positioning:
- "Engagement & education layer" — not a decisioning engine
- Pseudonym-first (no real name required, no bank logins)
- Explainable Top Drivers (plain language)
- CONF + uncertainty ranges (no false precision)
- What-if exploration (3 presets: income, debt, coverage)
- Blueprint your team implements — not production software
- Founding Cohort: 10 companies, 3 spots filled
- Pilot Blueprint Pack: Option A $4,900 / B $9,900 / C $14,900 (one-time)
NEVER say: entertainment-first, magic score, AI model, underwriting tool, credit scoring
ALWAYS say: engagement & education layer, explainable economic profile, uncertainty-aware ranges
Write messages that:
1. Open with a specific hook tied to their role or company — not generic openers
2. Connect that hook to PersonaQuanta value in ONE sentence
3. Are short (LinkedIn DM <120 words, Email <200 words)
4. End with one low-commitment CTA
5. Sound like a founder, not a sales rep
Output ONLY valid JSON, no markdown, no code fences, no explanation:
{"linkedin_dm":"...","email_subject":"...","email_body":"...","followup_d3":"...","followup_d7":"...","hook_used":"one sentence explaining the hook angle used"}`;
// ── KEY ────────────────────────────────────────────────────────────────
function activateKey() {
const val = document.getElementById('api-key-input').value.trim();
const err = document.getElementById('gate-error');
if (!val.startsWith('sk-')) {
err.textContent = 'Key повинен починатись з sk-';
err.style.display = 'block'; return;
}
apiKey = val;
err.style.display = 'none';
document.getElementById('gate').style.display = 'none';
document.getElementById('app').style.display = 'block';
}
function resetKey() {
apiKey = '';
document.getElementById('api-key-input').value = '';
document.getElementById('gate').style.display = 'flex';
document.getElementById('app').style.display = 'none';
}
// ── GENERATE ───────────────────────────────────────────────────────────
async function generate() {
const name = document.getElementById('f-name').value.trim();
const company = document.getElementById('f-company').value.trim();
const title = document.getElementById('f-title').value;
const type = document.getElementById('f-type').value;
const channel = document.getElementById('f-channel').value;
const context = document.getElementById('f-context').value.trim();
const news = document.getElementById('f-news').value.trim();
const errEl = document.getElementById('form-error');
if (!name || !company) {
errEl.textContent = "Введи ім'я і назву компанії.";
errEl.style.display = 'block'; return;
}
errEl.style.display = 'none';
const btn = document.getElementById('gen-btn');
btn.disabled = true; btn.textContent = 'Генерую...';
showSpinner();
const userPrompt = `Write outreach messages for:
- First name: ${name}
- Title: ${title}
- Company: ${company}
- Company type: ${type}
- Channel preference: ${channel}
- Additional context: ${context || 'none'}
- Recent news or trigger: ${news || 'none'}
Generate all 5 message variants tailored to their role (${title}) at a ${type}.`;
try {
const res = await fetch('https://pq-proxy.personaquanta.workers.dev', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey,
'anthropic-version': '2023-06-01',
'anthropic-dangerous-request-source': 'true',
'anthropic-beta': 'cors-allowed',
},
body: JSON.stringify({
model: 'claude-sonnet-4-5',
max_tokens: 1500,
system: SYSTEM_PROMPT,
messages: [{ role: 'user', content: userPrompt }],
}),
});
if (!res.ok) {
let errMsg = `HTTP ${res.status}`;
try {
const e = await res.json();
errMsg = e.error?.message || e.error?.type || JSON.stringify(e);
} catch {}
throw new Error(`API Error ${res.status}: ${errMsg}`);
}
const data = await res.json();
console.log('API response:', JSON.stringify(data).slice(0, 300));
const raw = data.content.map(b => b.text || '').join('');
const clean = raw.replace(/```json|```/g, '').trim();
const parsed = JSON.parse(clean);
currentResult = parsed;
const entry = { name, company, title, type, context, news, channel, result: parsed, ts: Date.now() };
history = [entry, ...history].slice(0, 10);
renderHistory();
renderResult(parsed);
activeTab = 'linkedin_dm';
} catch(e) {
console.error('Full error:', e);
const msg = e.message || '';
if (msg.includes('Failed to fetch') || msg.includes('NetworkError')) {
showError('Мережева помилка. Перевір: 1) чи правильний API key, 2) чи є баланс на console.anthropic.com');
} else {
showError(msg || 'Помилка. Перевір API key і спробуй ще раз.');
}
} finally {
btn.disabled = false; btn.textContent = 'Генерувати повідомлення →';
}
}
// ── RENDER ─────────────────────────────────────────────────────────────
function showSpinner() {
document.getElementById('right-panel').innerHTML = `
<div class="spinner-wrap">
<div class="spinner"></div>
<div class="spinner-label">Генерую персоналізовані повідомлення...</div>
</div>`;
}
function showError(msg) {
document.getElementById('right-panel').innerHTML = `
<div class="empty">
<div class="empty-icon" style="color:var(--red)">⚠</div>
<div class="empty-title" style="color:var(--red)">Помилка</div>
<div class="empty-sub">${msg}</div>
</div>`;
}
const TABS_CFG = [
{ key: 'linkedin_dm', label: '◈ LinkedIn DM' },
{ key: 'email', label: '✉ Email' },
{ key: 'followup_d3', label: '⟳ Follow-up D+3' },
{ key: 'followup_d7', label: '⤷ Follow-up D+7' },
];
function getTabContent(result, key) {
if (key === 'email') return `Subject: ${result.email_subject}\n\n${result.email_body}`;
return result[key] || '';
}
function renderResult(result) {
const panel = document.getElementById('right-panel');
panel.innerHTML = `
<div class="hook-badge">
<div class="hook-icon">◎</div>
<div>
<div class="hook-label">HOOK ВИКОРИСТАНИЙ</div>
<div class="hook-text" id="hook-text">${result.hook_used}</div>
</div>
</div>
<div class="tabs" id="tabs-row"></div>
<div class="msg-box">
<div class="msg-text" id="msg-content"></div>
<div class="copy-float">
<button class="btn-copy" id="copy-btn" onclick="copyActive()">Копіювати</button>
</div>
</div>
<div class="word-count" id="word-count"></div>
`;
buildTabs(result);
switchTab(result, 'linkedin_dm');
}
function buildTabs(result) {
const row = document.getElementById('tabs-row');
row.innerHTML = '';
TABS_CFG.forEach(t => {
const btn = document.createElement('button');
btn.className = 'tab' + (t.key === activeTab ? ' active' : '');
btn.textContent = t.label;
btn.onclick = () => switchTab(result, t.key);
row.appendChild(btn);
});
// copy all
const all = document.createElement('div');
all.className = 'tab-actions';
all.innerHTML = `<button class="btn-copy" id="copy-all-btn" onclick="copyAll()">Копіювати все</button>`;
row.appendChild(all);
}
function switchTab(result, key) {
activeTab = key;
document.querySelectorAll('.tab').forEach(b => {
b.classList.toggle('active', b.textContent.trim() === TABS_CFG.find(t=>t.key===key)?.label.trim());
});
const content = getTabContent(result, key);
document.getElementById('msg-content').textContent = content;
const wc = content.split(/\s+/).filter(Boolean).length;
document.getElementById('word-count').textContent = `${wc} слів`;
// rebuild tabs to update active state properly
buildTabs(result);
}
let copyTimer = null;
function copyActive() {
if (!currentResult) return;
const content = getTabContent(currentResult, activeTab);
navigator.clipboard.writeText(content);
const btn = document.getElementById('copy-btn');
btn.textContent = '✓ Скопійовано'; btn.classList.add('copied');
clearTimeout(copyTimer);
copyTimer = setTimeout(() => { btn.textContent = 'Копіювати'; btn.classList.remove('copied'); }, 2000);
}
function copyAll() {
if (!currentResult) return;
const r = currentResult;
const all = [
`=== LINKEDIN DM ===\n${r.linkedin_dm}`,
`=== EMAIL ===\nSubject: ${r.email_subject}\n\n${r.email_body}`,
`=== FOLLOW-UP D+3 ===\n${r.followup_d3}`,
`=== FOLLOW-UP D+7 ===\n${r.followup_d7}`,
].join('\n\n---\n\n');
navigator.clipboard.writeText(all);
const btn = document.getElementById('copy-all-btn');
btn.textContent = '✓ Все скопійовано'; btn.classList.add('copied');
setTimeout(() => { btn.textContent = 'Копіювати все'; btn.classList.remove('copied'); }, 2000);
}
function renderHistory() {
const sec = document.getElementById('history-section');
const list = document.getElementById('history-list');
if (!history.length) { sec.style.display = 'none'; return; }
sec.style.display = 'block';
list.innerHTML = history.map((h, i) => `
<div class="hist-item" onclick="loadHistory(${i})">
<div>
<div class="hist-name">${h.name} @ ${h.company}</div>
<div class="hist-role">${h.title}</div>
</div>
<div class="hist-time">${new Date(h.ts).toLocaleTimeString('uk',{hour:'2-digit',minute:'2-digit'})}</div>
</div>
`).join('');
}
function loadHistory(i) {
const h = history[i];
document.getElementById('f-name').value = h.name;
document.getElementById('f-company').value = h.company;
document.getElementById('f-title').value = h.title;
document.getElementById('f-type').value = h.type;
document.getElementById('f-channel').value = h.channel;
document.getElementById('f-context').value = h.context;
document.getElementById('f-news').value = h.news;
currentResult = h.result;
activeTab = 'linkedin_dm';
renderResult(h.result);
}
</script>
<div style="text-align:center;font-size:11px;color:#4A5568;padding:16px;margin-top:8px;border-top:1px solid rgba(255,255,255,0.06);">
© 2026 PersonaQuanta · All rights reserved · <a href="https://www.linkedin.com/in/pozhydaiev/" style="color:#2AA7FF;text-decoration:none;" target="_blank">linkedin.com/in/pozhydaiev</a>
</div>
</body>
</html>