@cardinali-studio/adminkit 2.2.44 → 2.2.46
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.
- package/README.md +11 -0
- package/dist/app/App.js +5 -6
- package/dist/app/app.css +17 -0
- package/dist/app/delivery.js +6 -4
- package/dist/app/guide/TransferGuide.js +1 -1
- package/dist/app/routes/Deliveries.js +28 -4
- package/dist/app/routes/DeliveryEmail.d.ts +36 -0
- package/dist/app/routes/DeliveryEmail.js +73 -0
- package/dist/functions/_shared/delivery-email.js +149 -0
- package/dist/functions/api/deliveries.js +11 -2
- package/dist/functions/delivery-public/index.js +10 -1
- package/dist/functions/delivery-public/migrations/0012_delivery_email.sql +17 -0
- package/dist/functions/delivery-public/migrations/0013_delivery_email_settings.sql +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,17 @@ There is no second list of fields hidden in the UI, and no second serializer hid
|
|
|
12
12
|
|
|
13
13
|
The package also contains the React administration shell, a media library for R2, Cloudflare Pages Functions, and the persistence primitives used by the D1 publication path.
|
|
14
14
|
|
|
15
|
+
## Transfer email — 2.2.45
|
|
16
|
+
|
|
17
|
+
Transfer supports independent owner notifications and automatic recipient emails
|
|
18
|
+
through Resend, with optional recipient address, explicit opt-in, durable retries,
|
|
19
|
+
send history and confirmed resends. Transfer settings include the editable owner
|
|
20
|
+
email and owner notifications for each newly requested download. Sending stays disabled until configured per
|
|
21
|
+
site. Install migration `0012_delivery_email.sql` and configure the server-only
|
|
22
|
+
email variables described in [the integration guide](DOCS/TRANSFER-EMAIL.md).
|
|
23
|
+
Existing transfers are not emailed automatically. The illustrated Transfer guide
|
|
24
|
+
includes the email workflow and explains provider acceptance versus delivery.
|
|
25
|
+
|
|
15
26
|
## The important property
|
|
16
27
|
|
|
17
28
|
An admin panel should not damage a file merely because it does not understand all of it.
|
package/dist/app/App.js
CHANGED
|
@@ -340,12 +340,11 @@ function CurrentAdminApp({ adminInterface, setAdminInterface, }) {
|
|
|
340
340
|
? _jsx(MediaSettingsEditor, { lib: media })
|
|
341
341
|
: _jsx(MediaGrid, { lib: media })), view === "trash" && _jsx(Trash, {}), section === "requests" && (requests.error ? _jsx("p", { className: "ak-error", children: requests.error })
|
|
342
342
|
: openReq ? (_jsx(RequestDetail, { row: openReq, onMark: (h) => void requests.mark([openReq.id], h), onRemove: () => { void requests.remove([openReq.id]); go("/requests"); } }))
|
|
343
|
-
: _jsx("p", { className: "pane-empty ak-hint", children: requests.rows?.length ? "Scegli una richiesta dall'elenco." : "" })), section === "deliveries" && (deliveries.error ? _jsx("p", { className: "ak-error", children: deliveries.error })
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
_jsx(DeliveryWorkspace, { delivery: deliveries.detail, busy: deliveries.busy, onAction: deliveries.action, onRefresh: deliveries.refresh, onReload: deliveries.load, onRead: deliveries.read, onDeleted: () => go("/deliveries"), onOpen: (id) => { setQuickSelectedId(undefined); go(`/deliveries/${id}`); }, onSelected: setQuickSelectedId }, deliveries.detail ? deliveries.detail.id : `nuovo-${quickKey}`))), section === "preview" && local && _jsx(Preview, {})] })] })] }), _jsx(UploadDock, {}), pickerElement] }) }));
|
|
343
|
+
: _jsx("p", { className: "pane-empty ak-hint", children: requests.rows?.length ? "Scegli una richiesta dall'elenco." : "" })), section === "deliveries" && (deliverySettingsOpen ? (_jsx(DeliverySettings, { settings: deliveries.settings, onAction: deliveries.action, pickMedia: pickMedia })) : deliveries.error ? _jsx("p", { className: "ak-error", children: deliveries.error }) : activeDeliveryId && !deliveries.detail ? (_jsx("p", { className: "pane-empty ak-hint", children: "Carico\u2026" })) : !activeDeliveryId && route[1] !== "new" ? (_jsx(DeliveryDashboard, { onCreate: () => { setQuickSelectedId(undefined); setQuickKey(v => v + 1); go("/deliveries/new"); }, onOpen: id => go(`/deliveries/${id}`) })) : (
|
|
344
|
+
/* Un transfer nuovo e uno già spedito sono la stessa schermata: cambia solo se
|
|
345
|
+
arriva già con dei dati. La `key` la rimonta quando si passa da un transfer
|
|
346
|
+
all'altro, e quando «Nuovo transfer» chiede di ricominciare da capo. */
|
|
347
|
+
_jsx(DeliveryWorkspace, { delivery: deliveries.detail, busy: deliveries.busy, onAction: deliveries.action, onRefresh: deliveries.refresh, onReload: deliveries.load, onRead: deliveries.read, onDeleted: () => go("/deliveries"), onOpen: (id) => { setQuickSelectedId(undefined); go(`/deliveries/${id}`); }, onSelected: setQuickSelectedId }, deliveries.detail ? deliveries.detail.id : `nuovo-${quickKey}`))), section === "preview" && local && _jsx(Preview, {})] })] })] }), _jsx(UploadDock, {}), pickerElement] }) }));
|
|
349
348
|
}
|
|
350
349
|
/* Le sezioni che hanno una seconda colonna. Le altre lasciano la modifica a tutta larghezza.
|
|
351
350
|
*
|
package/dist/app/app.css
CHANGED
|
@@ -2457,3 +2457,20 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
|
|
|
2457
2457
|
.dd-heading-actions .ak-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 44px; }
|
|
2458
2458
|
.dd-heading-actions .ico { width: 15px; height: 15px; }
|
|
2459
2459
|
@media (max-width: 700px) { .dd-heading-actions { justify-content: flex-start; } }
|
|
2460
|
+
|
|
2461
|
+
/* Transfer email controls reuse the workspace card and form rhythm. */
|
|
2462
|
+
.dl-email {display:grid;gap:1rem;padding:20px;}
|
|
2463
|
+
.dl-email .dl-section-head,.dl-email-config .dl-section-head {padding:0;margin:0;}
|
|
2464
|
+
.dl-email .dl-hint,.dl-email-config p {font-size:12px;line-height:1.5;color:var(--ak-ink-quiet);margin:0;}
|
|
2465
|
+
.dl-email-config {padding:20px;display:grid;gap:12px;}
|
|
2466
|
+
.dl-email .dl-field {display:grid;gap:.4rem;}
|
|
2467
|
+
.dl-email .dl-field input {width:100%;box-sizing:border-box;}
|
|
2468
|
+
.dl-email-info {padding:.85rem 1rem;border:1px solid var(--ak-line);border-radius:var(--ak-radius,12px);}
|
|
2469
|
+
.dl-email-log {list-style:none;padding:0;margin:0;display:grid;gap:.75rem;}
|
|
2470
|
+
.dl-email-log li {display:grid;gap:.2rem;padding:.75rem 0;border-top:1px solid var(--ak-line);overflow-wrap:anywhere;}
|
|
2471
|
+
.dl-email-log li span,.dl-email .dl-field small {font-size:.85rem;color:var(--ak-ink-quiet);}
|
|
2472
|
+
.dl-email-confirm {padding:1rem;border:1px solid var(--ak-line);border-radius:var(--ak-radius,12px);}
|
|
2473
|
+
.dl-email-confirm .ak-btn {margin:.25rem .5rem .25rem 0;}
|
|
2474
|
+
|
|
2475
|
+
.dl-email-config form {display:grid;gap:16px;}
|
|
2476
|
+
.dl-email-config .dl-field input {width:100%;box-sizing:border-box;}
|
package/dist/app/delivery.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DeliveryEmailConfiguration } from "./routes/DeliveryEmail.js";
|
|
2
3
|
import { mountTransferGuide } from "./lib/transfer-guide.js";
|
|
3
4
|
import { setSiteConfig } from "./site.js";
|
|
4
5
|
import { Icon } from "./ui/icons.js";
|
|
@@ -31,7 +32,8 @@ export function mountDeliveryAdmin(options) {
|
|
|
31
32
|
function DeliveryAdmin({ name, websiteUrl }) {
|
|
32
33
|
const { adminInterface } = useAdminInterface();
|
|
33
34
|
const [route, go] = useHashRoute();
|
|
34
|
-
const
|
|
35
|
+
const settingsOpen = route[0] === "deliveries" && route[1] === "settings";
|
|
36
|
+
const id = route[0] === "deliveries" && route[1] !== "new" && !settingsOpen ? route[1] : undefined;
|
|
35
37
|
const api = useDeliveries(id);
|
|
36
38
|
const { theme, toggle } = useTheme();
|
|
37
39
|
const completions = useUploadCompletions();
|
|
@@ -48,9 +50,9 @@ function DeliveryAdmin({ name, websiteUrl }) {
|
|
|
48
50
|
const open = (value) => { setSelectedId(undefined); go(`/deliveries/${value}`); };
|
|
49
51
|
// Never render the previous transfer while the requested detail is loading.
|
|
50
52
|
const detail = id && api.detail?.id === id ? api.detail : null;
|
|
51
|
-
return _jsxs("div", { className: "app", "data-admin-interface": adminInterface, children: [_jsxs("nav", { className: "rail", "aria-label": "Navigazione", children: [_jsxs("div", { className: "rail-brand", children: [_jsx("span", { className: "rail-brand-name", children: name }), _jsx("span", { className: "rail-brand-role", children: "Consegne" })] }), _jsxs("button", { className: "rail-item is-on", "aria-label": "Transfer", onClick: () => go("/deliveries"), children: [_jsx(Icon.delivery, {}), _jsx("span", { children: "Transfer" })] }), _jsxs("div", { className: "rail-foot", children: [websiteUrl && _jsxs("a", { className: "rail-item", href: websiteUrl, target: "_blank", rel: "noreferrer", "aria-label": "Sito dello studio", children: [_jsx(Icon.out, {}), _jsx("span", { children: "Sito dello studio" })] }), _jsxs("button", { className: "rail-item", onClick: toggle, "aria-label": theme === "dark" ? "Tema chiaro" : "Tema scuro", children: [theme === "dark" ? _jsx(Icon.sun, {}) : _jsx(Icon.moon, {}), _jsx("span", { children: theme === "dark" ? "Tema chiaro" : "Tema scuro" })] })] })] }), _jsxs("aside", { className: "col", "aria-label": "Elenco transfer", children: [_jsxs("div", { className: "col-head col-head-actions dl-col-head", children: [_jsx("span", { className: "col-title", children: "Transfer" }), _jsxs("button", { type: "button", className: "ak-btn dl-dashboard-button" + (!id && route[1] !== "new" ? " is-on" : ""), "aria-current": !id && route[1] !== "new" ? "page" : undefined, onClick: () => { setSelectedId(undefined); go("/deliveries"); }, children: [_jsx(Icon.grid, {}), _jsx("span", { children: "Dashboard" })] }), _jsx(NewDeliveryButton, { onCreate: () => { setSelectedId(undefined); setDraftKey(v => v + 1); go("/deliveries/new"); } })] }), _jsx("div", { className: "col-body", children: !api.rows ? _jsx("p", { className: "ak-hint", children: "Carico\u2026" }) : api.rows.length === 0 ? _jsx("p", { className: "ak-hint", children: "Nessun transfer, per ora." })
|
|
52
|
-
: _jsx(DeliveriesList, { rows: api.rows, current: id || selectedId, onOpen: open }) }),
|
|
53
|
+
return _jsxs("div", { className: "app", "data-admin-interface": adminInterface, children: [_jsxs("nav", { className: "rail", "aria-label": "Navigazione", children: [_jsxs("div", { className: "rail-brand", children: [_jsx("span", { className: "rail-brand-name", children: name }), _jsx("span", { className: "rail-brand-role", children: "Consegne" })] }), _jsxs("button", { className: "rail-item is-on", "aria-label": "Transfer", onClick: () => go("/deliveries"), children: [_jsx(Icon.delivery, {}), _jsx("span", { children: "Transfer" })] }), _jsxs("div", { className: "rail-foot", children: [websiteUrl && _jsxs("a", { className: "rail-item", href: websiteUrl, target: "_blank", rel: "noreferrer", "aria-label": "Sito dello studio", children: [_jsx(Icon.out, {}), _jsx("span", { children: "Sito dello studio" })] }), _jsxs("button", { className: "rail-item", onClick: toggle, "aria-label": theme === "dark" ? "Tema chiaro" : "Tema scuro", children: [theme === "dark" ? _jsx(Icon.sun, {}) : _jsx(Icon.moon, {}), _jsx("span", { children: theme === "dark" ? "Tema chiaro" : "Tema scuro" })] })] })] }), _jsxs("aside", { className: "col", "aria-label": "Elenco transfer", children: [_jsxs("div", { className: "col-head col-head-actions dl-col-head", children: [_jsx("span", { className: "col-title", children: "Transfer" }), _jsxs("button", { type: "button", className: "ak-btn dl-dashboard-button" + (!id && !settingsOpen && route[1] !== "new" ? " is-on" : ""), "aria-current": !id && !settingsOpen && route[1] !== "new" ? "page" : undefined, onClick: () => { setSelectedId(undefined); go("/deliveries"); }, children: [_jsx(Icon.grid, {}), _jsx("span", { children: "Dashboard" })] }), _jsx(NewDeliveryButton, { onCreate: () => { setSelectedId(undefined); setDraftKey(v => v + 1); go("/deliveries/new"); } })] }), _jsx("div", { className: "col-body", children: !api.rows ? _jsx("p", { className: "ak-hint", children: "Carico\u2026" }) : api.rows.length === 0 ? _jsx("p", { className: "ak-hint", children: "Nessun transfer, per ora." })
|
|
54
|
+
: _jsx(DeliveriesList, { rows: api.rows, current: id || selectedId, onOpen: open }) }), _jsxs("div", { className: "dl-col-foot", children: [api.rows && _jsx(DeliveriesTotal, { rows: api.rows }), _jsxs("button", { className: "ak-btn", "aria-current": settingsOpen ? "page" : undefined, onClick: () => go("/deliveries/settings"), children: [_jsx(Icon.settings, {}), _jsx("span", { children: "Impostazioni Transfer" })] })] })] }), _jsx("main", { className: "pane", children: _jsx("div", { className: "pane-body", children: settingsOpen ? _jsxs("div", { className: "dl-work", children: [_jsx("header", { className: "dl-work-head", children: _jsx("h2", { children: "Impostazioni Transfer" }) }), _jsx(DeliveryEmailConfiguration, {})] }) : api.error ? _jsxs("div", { role: "alert", children: [_jsx("p", { className: "ak-error", children: api.error }), _jsx("button", { className: "ak-btn", onClick: () => void api.refresh(), children: "Riprova" })] })
|
|
53
55
|
: id && !detail ? _jsx("p", { className: "ak-hint", children: "Carico\u2026" })
|
|
54
|
-
: !id && route[1] !== "new" ? _jsx(DeliveryDashboard, { onCreate: () => { setSelectedId(undefined); setDraftKey(v => v + 1); go("/deliveries/new"); }, onOpen: open })
|
|
56
|
+
: !id && !settingsOpen && route[1] !== "new" ? _jsx(DeliveryDashboard, { onCreate: () => { setSelectedId(undefined); setDraftKey(v => v + 1); go("/deliveries/new"); }, onOpen: open })
|
|
55
57
|
: _jsx(DeliveryWorkspace, { delivery: detail, busy: api.busy, onAction: api.action, onRefresh: api.refresh, onReload: api.load, onRead: api.read, onDeleted: () => go("/deliveries"), onOpen: open, onSelected: setSelectedId }, id || `new-${draftKey}`) }) }), _jsx(UploadDock, {})] });
|
|
56
58
|
}
|
|
@@ -25,6 +25,6 @@ export function TransferGuide() {
|
|
|
25
25
|
const dashboard = new URL(window.location.href);
|
|
26
26
|
dashboard.searchParams.delete('adminkit-guide');
|
|
27
27
|
dashboard.hash = '/deliveries';
|
|
28
|
-
return _jsxs("div", { className: "tg-guide", children: [_jsx("a", { className: "tg-skip", href: "#inizio", children: "Vai alla guida" }), _jsxs("header", { className: "tg-top", children: [_jsx("a", { href: dashboard.href, children: "\u2190 Apri la dashboard" }), _jsx("span", { children: "Manuale d\u2019uso \u00B7 Transfer" })] }), _jsxs("div", { className: "tg-layout", children: [_jsxs("nav", { className: "tg-toc", "aria-label": "Indice della guida", children: [_jsx("p", { className: "tg-kicker", children: "In questa guida" }), chapters.map(([id, title], i) => _jsxs("a", { href: `#${id}`, children: [_jsx("span", { children: String(i + 1).padStart(2, '0') }), title] }, id))] }), _jsxs("main", { className: "tg-main", children: [_jsxs("div", { className: "tg-hero", children: [_jsx("p", { className: "tg-kicker", children: "Guida ai Transfer" }), _jsxs("h1", { children: ["Dai file al cliente,", _jsx("br", {}), "un passaggio alla volta."] }), _jsx("p", { children: "Prepara una consegna, controlla il caricamento e condividi un solo link. Qui trovi le funzioni del pannello, illustrate con schermate dimostrative." }), _jsx("div", { className: "tg-hero-note", children: "Le immagini contengono solo dati di esempio. Colori, copertine e alcune funzioni possono variare in base al sito e alle abilitazioni del tuo pannello." })] }), _jsxs(Chapter, { id: "inizio", n: "01 \u00B7 Il percorso", title: "Prima di iniziare", children: [_jsxs("ol", { className: "tg-steps", children: [_jsxs("li", { children: [_jsx("strong", { children: "Crea un nuovo transfer." }), " Scegli Galleria e conversione prima di aggiungere i file."] }), _jsxs("li", { children: [_jsx("strong", { children: "Imposta destinatario, accesso e scadenza." }), " Parti da 60 giorni, poi adatta la durata al lavoro."] }), _jsxs("li", { children: [_jsx("strong", { children: "Aggiungi file o cartelle." }), " Il caricamento parte subito: puoi completare i dettagli mentre prosegue."] }), _jsxs("li", { children: [_jsx("strong", { children: "Controlla il risultato." }), " Verifica stato, messaggio, copertina e pagina del cliente."] }), _jsxs("li", { children: [_jsx("strong", { children: "Condividi il link." }), " Attendi lo stato Pronto prima di comunicare che la consegna \u00E8 completa."] })] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Prima di scegliere i file" }), _jsx("p", { children: "Lascia aperto il browser durante il caricamento e conserva gli originali sul computer. Il limite \u00E8 di 150 GB di file sorgenti per singolo invio; conversioni e anteprime possono occupare spazio aggiuntivo sul server." })] })] }), _jsxs(Chapter, { id: "dashboard", n: "02 \u00B7 Panoramica", title: "Leggere la dashboard", children: [_jsxs("p", { children: ["La dashboard riassume le consegne ancora disponibili. Il pulsante ", _jsx("strong", { children: "Dashboard" }), ", sopra ", _jsx("strong", { children: "Nuovo transfer" }), " nella colonna sinistra, ti riporta qui anche quando hai aperto una consegna."] }), _jsx(Shot, { name: "dashboard", alt: "Dashboard Transfer con navigazione, indicatori, stima costi e inventario dello spazio", children: "Vista d\u2019insieme: navigazione a sinistra, indicatori e spazio al centro." }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Transfer attivi" }), _jsx("dd", { children: "Consegne pubblicate, con file pronti, non scadute e con almeno un link valido." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Con download richiesto / Senza richieste" }), _jsx("dd", { children: "Distinguono i transfer per cui \u00E8 stato usato almeno una volta il pulsante di download. Una richiesta non prova che lo scaricamento sia terminato." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Spazio transfer attivi" }), _jsx("dd", { children: "Il valore deriva dall\u2019ultima verifica completa del server, quando disponibile. Il trattino indica un dato non ancora rilevato, non zero." })] })] }), _jsxs("p", { children: ["Nella tabella ", _jsx("strong", { children: "Transfer attivi" }), " puoi aprire una consegna e confrontare richieste, spazio e scadenza. L\u2019elenco laterale comprende anche bozze e transfer senza file."] })] }), _jsxs(Chapter, { id: "opzioni", n: "03 \u00B7 Prima dei file", title: "Scegliere le opzioni di consegna", children: [_jsxs("p", { children: ["Il box ", _jsx("strong", { children: "Opzioni di consegna" }), " precede ", _jsx("strong", { children: "File da consegnare" }), ". Galleria e conversione sono disattivate per i nuovi transfer: puoi inviare soltanto gli originali, sempre inclusi."] }), _jsx(Shot, { name: "options", alt: "Opzioni di consegna prima dei file, Galleria attivata e conversione in bassa risoluzione con formato JPG", children: "Le scelte che modificano la preparazione dei file vanno fatte prima del caricamento." }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Galleria" }), _jsx("dd", { children: "Mostra sulla pagina del transfer le anteprime delle immagini supportate e consente di ingrandirle. Non serve per inviare documenti o altri file." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("dd", { children: "Aggiunge un secondo archivio di immagini per web e social. Non sostituisce gli originali. Le foto arrivano fino a 2048 px sul lato lungo; quelle pi\u00F9 piccole non vengono ingrandite." })] }), _jsxs("div", { children: [_jsx("dt", { children: "JPG o WebP" }), _jsx("dd", { children: "JPG \u00E8 il formato iniziale, per la compatibilit\u00E0 con dispositivi e applicazioni. WebP \u00E8 l\u2019alternativa per file pi\u00F9 piccoli. La disponibilit\u00E0 di JPG dipende dall\u2019abilitazione del sito." })] })] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Opzioni bloccate dopo il caricamento" }), _jsx("p", { children: "Anteprime e conversioni si preparano insieme ai file. Per cambiare queste opzioni, devi rimuovere i file interessati e caricarli di nuovo. Nome, messaggio e scadenza si gestiscono separatamente." })] })] }), _jsxs(Chapter, { id: "dettagli", n: "04 \u00B7 Preparazione", title: "Aggiungere file e destinatario", children: [_jsxs("p", { children: ["Usa ", _jsx("strong", { children: "Aggiungi file" }), " per selezionare uno o pi\u00F9 file, ", _jsx("strong", { children: "Aggiungi una cartella" }), " per una cartella intera, oppure trascina file e cartelle nell\u2019area tratteggiata. La struttura delle cartelle viene conservata nello ZIP."] }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Nome del transfer:" }), " identifica la consegna per il cliente ed \u00E8 usato anche per il nome dello ZIP. Scegli un nome riconoscibile, per esempio \u201CTeam building \u2014 Milano\u201D."] }), _jsxs("li", { children: [_jsx("strong", { children: "Destinatario:" }), " nome del cliente o dell\u2019azienda, facoltativo. Non \u00E8 un indirizzo email e non avvia un invio automatico."] }), _jsxs("li", { children: [_jsx("strong", { children: "Messaggio:" }), " testo di accompagnamento facoltativo, visibile sulla pagina del cliente."] })] }), _jsxs("p", { children: ["Controlla i dettagli prima di condividere. Su un transfer gi\u00E0 inviato, conferma le modifiche con ", _jsx("strong", { children: "Salva" }), " o ", _jsx("strong", { children: "Salva modifiche" }), "."] })] }), _jsxs(Chapter, { id: "accesso", n: "05 \u00B7 Disponibilit\u00E0", title: "Accesso e scadenza", children: [_jsx(Shot, { name: "access", alt: "Impostazioni di accesso con link e codice, campo codice e selettore Scadenza a 60 giorni", children: "Accesso e scadenza regolano chi pu\u00F2 entrare e fino a quando i file restano scaricabili." }), _jsxs("p", { children: [_jsx("strong", { children: "Chiunque abbia il link" }), " consente l\u2019accesso a chi lo riceve: il destinatario pu\u00F2 inoltrarlo. Se vuoi un secondo controllo, scegli ", _jsx("strong", { children: "Link e codice di accesso" }), ". Puoi cambiare il codice o generarne un altro con ", _jsx("strong", { children: "Rigenera" }), ". Dopo dieci tentativi errati, l\u2019accesso viene sospeso per un\u2019ora."] }), _jsxs("p", { children: [_jsx("strong", { children: "Scadenza" }), " parte da ", _jsx("strong", { children: "60 giorni" }), " per un nuovo transfer. Sono disponibili anche altre durate e \u201CPer sempre\u201D. Quando riapri un transfer, la data gi\u00E0 impostata viene conservata finch\u00E9 non la cambi."] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Alla scadenza" }), _jsx("p", { children: "Il link pu\u00F2 continuare a mostrare una pagina di stato, ma i file non sono pi\u00F9 scaricabili. La rimozione dei file segue le regole e i controlli del servizio: non considerare la scadenza un archivio di sicurezza." })] })] }), _jsxs(Chapter, { id: "caricamento", n: "06 \u00B7 Avanzamento", title: "Caricare, mettere in pausa e riprendere", children: [_jsx("p", { children: "Durante il caricamento il pannello indica fase, file elaborati e quantit\u00E0 inviata. La preparazione pu\u00F2 includere verifica dei file, originali, anteprime e controlli finali: non tutte le fasi avanzano alla stessa velocit\u00E0." }), _jsx(Shot, { name: "upload", alt: "Transfer con caricamento in pausa, avanzamento e riquadro Caricamenti con Riprendi e Annulla", children: "Il caricamento resta visibile nel riquadro in basso a destra anche se cambi sezione del pannello." }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Pausa / Riprendi:" }), " sospendono e riavviano il lavoro mantenendo aperta la scheda."] }), _jsxs("li", { children: [_jsx("strong", { children: "Se chiudi o ricarichi:" }), " il lavoro si interrompe. Riapri il transfer, premi \u201CRiprendi\u201D e riseleziona gli stessi file o la stessa cartella, senza modificarli. Le parti gi\u00E0 confermate vengono recuperate quando possibile."] }), _jsxs("li", { children: [_jsx("strong", { children: "Se manca la connessione:" }), " il pannello pu\u00F2 attendere la rete e riprovare. Se compare un errore, segui il messaggio e usa \u201CRiprova\u201D quando disponibile."] }), _jsxs("li", { children: [_jsx("strong", { children: "Annulla:" }), " richiede conferma e interrompe quel caricamento. I file gi\u00E0 inviati per quel lavoro vengono avviati alla rimozione; non equivale a una pausa."] })] }), _jsx("p", { children: "Puoi continuare a usare il pannello durante l\u2019upload. Mantieni per\u00F2 la scheda aperta, il computer attivo e la connessione disponibile fino al completamento." })] }), _jsxs(Chapter, { id: "condivisione", n: "07 \u00B7 Invio", title: "Condividere il link", children: [_jsx(Shot, { name: "sharing", alt: "Transfer pronto con link cliente e pulsanti Copia il link, Copia il messaggio e Apri in WhatsApp", children: "Il riquadro del link raccoglie gli strumenti di condivisione della consegna." }), _jsxs("p", { children: [_jsx("strong", { children: "Ottieni il link" }), " prepara la condivisione. Al termine del caricamento, il pannello pu\u00F2 rendere automaticamente pronto il transfer. Il link pu\u00F2 funzionare gi\u00E0 mentre arrivano i file: chi lo apre vede lo stato della consegna. Per annunciare una consegna completa, attendi che risulti ", _jsx("strong", { children: "Pronto" }), "."] }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Copia il link:" }), " copia soltanto l\u2019indirizzo, da incollare nel canale che preferisci."] }), _jsxs("li", { children: [_jsx("strong", { children: "Copia il messaggio:" }), " prepara un testo con i dettagli, il link, l\u2019eventuale codice e la scadenza. Rileggilo prima di inviarlo."] }), _jsxs("li", { children: [_jsx("strong", { children: "Apri in WhatsApp:" }), " apre un messaggio da completare. Il pannello non sceglie il destinatario e non lo invia automaticamente."] }), _jsxs("li", { children: [_jsx("strong", { children: "Accorcia link:" }), " se disponibile, crea un indirizzo pi\u00F9 breve; il vecchio indirizzo continua a funzionare."] })] }), _jsxs("p", { children: ["Con ", _jsx("strong", { children: "Guarda come lo vede il cliente" }), " apri la pagina pubblica in un\u2019altra scheda per controllare testi, accesso e download."] })] }), _jsxs(Chapter, { id: "pagina-cliente", n: "08 \u00B7 Ricezione", title: "Che cosa vede il cliente", children: [_jsx("p", { children: "La pagina si adatta al sito: pu\u00F2 mostrare una copertina, destinatario, messaggio, download e Galleria. Con accesso protetto viene richiesto il codice. La conversione, se preparata, compare come download aggiuntivo; l\u2019archivio degli originali rimane distinto." }), _jsx("p", { children: "Il download avviene tramite il pulsante della pagina. Il contenuto viene raccolto in uno ZIP: dopo averlo scaricato, il cliente deve estrarlo sul proprio dispositivo. Anteprime e ingrandimenti sono disponibili per le immagini supportate, quando la Galleria \u00E8 stata abilitata." }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Richiesto non significa ricevuto" }), _jsx("p", { children: "Il contatore misura l\u2019avvio richiesto tramite il pulsante. Non certifica la ricezione completa, l\u2019apertura dello ZIP o la visualizzazione di tutte le foto. Se serve una conferma di consegna, chiedila al destinatario." })] })] }), _jsxs(Chapter, { id: "copertine", n: "09 \u00B7 Presentazione", title: "Copertine, recensioni e note d\u2019uso", children: [_jsx(Shot, { name: "covers", alt: "Copertine del transfer e azioni Salva modifiche, Carica un\u2019immagine e Usa quella predefinita", children: "La copertina \u00E8 separata dalla Galleria: puoi personalizzarla anche caricando un\u2019immagine dedicata." }), _jsxs("p", { children: ["Nel riquadro ", _jsx("strong", { children: "Copertina" }), ", scegli le anteprime disponibili oppure usa ", _jsx("strong", { children: "Carica un\u2019immagine" }), ". Puoi scegliere fino a otto immagini: una resta fissa, pi\u00F9 immagini compongono una sequenza. Conferma con ", _jsx("strong", { children: "Salva modifiche" }), "."] }), _jsxs("p", { children: [_jsx("strong", { children: "Usa quella predefinita" }), " rimuove la scelta specifica e ripristina la copertina del sito. Nel pannello completo, le impostazioni Transfer possono offrire anche la gestione della ", _jsx("strong", { children: "Copertina predefinita" }), "; questa superficie non \u00E8 presente in tutte le installazioni."] }), _jsxs("p", { children: ["In ", _jsx("strong", { children: "Alla fine della pagina" }), ", puoi abilitare ", _jsx("strong", { children: "Chiedi una recensione" }), " e impostare testo del pulsante e indirizzo della pagina recensioni. Le ", _jsx("strong", { children: "Note d\u2019uso" }), " accompagnano i file, per esempio con indicazioni di utilizzo concordate con il cliente."] }), _jsx("p", { children: "Se il sito lo consente, puoi anche personalizzare i testi dei pulsanti di download; lascia vuoto per mantenere quelli predefiniti." })] }), _jsxs(Chapter, { id: "gestione", n: "10 \u00B7 Dopo l\u2019invio", title: "Modificare, riutilizzare e rimuovere", children: [_jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Usa come modello" }), _jsx("dd", { children: "Crea un nuovo transfer riutilizzando i dettagli e i testi della consegna. I file non vengono duplicati: aggiungi quelli necessari e ricontrolla opzioni e scadenza prima dell\u2019invio." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Rimuovi un gruppo di file" }), _jsx("dd", { children: "Il pulsante \u201CRimuovi\u201D nel riquadro file agisce su quel caricamento e richiede conferma. Se rimuovi gli ultimi file, il transfer non risulta pi\u00F9 pronto." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Libera spazio: togli gli originali" }), _jsx("dd", { children: "Quando disponibile, avvia l\u2019archiviazione degli originali. Nell\u2019interfaccia \u00E8 indicato un periodo di recuperabilit\u00E0 di sette giorni; non fare affidamento sul download degli originali dopo questa azione. Conserva sempre la tua copia." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Elimina il transfer" }), _jsx("dd", { children: "Richiede una conferma esplicita. Il link smette subito di funzionare; file e upload residui vengono rimossi in background. L\u2019azione non \u00E8 reversibile nel pannello." })] })] }), _jsxs("aside", { className: "tg-callout tg-warning", children: [_jsx("strong", { children: "Prima di rimuovere" }), _jsx("p", { children: "Verifica il nome della consegna e conserva una copia dei file. Non eliminare un transfer per mettere in pausa un upload. Le protezioni di conservazione eventualmente presenti sul server possono impedire la rimozione di dati protetti." })] }), _jsxs("p", { children: [_jsx("strong", { children: "Pagamento" }), " e ", _jsx("strong", { children: "Selezione del cliente" }), " sono raccolti in \u201CFunzioni aggiuntive non attive\u201D quando non disponibili. La presenza della descrizione non significa che la funzione sia abilitata."] })] }), _jsxs(Chapter, { id: "spazio", n: "11 \u00B7 Consumi", title: "Controllare spazio e costi", children: [_jsxs("p", { children: [_jsx("strong", { children: "Verifica ora" }), " aggiorna l\u2019inventario, se abilitato. La lettura non scarica e non elimina i file. Controlla sempre la data dell\u2019ultima verifica: un inventario in corso o non riuscito non \u00E8 un nuovo totale affidabile."] }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Spazio totale" }), _jsx("dd", { children: "Comprende gli elementi conservati sul server rilevati dall\u2019inventario." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Versioni nascoste" }), _jsx("dd", { children: "Copie precedenti che possono continuare a occupare spazio." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Upload incompleti" }), _jsx("dd", { children: "Parti gi\u00E0 inviate per caricamenti non ancora completati." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Senza consegna associata" }), _jsx("dd", { children: "Dati per cui l\u2019inventario non trova un riferimento nei transfer. Possono includere versioni nascoste o upload incompleti: non sommare tutte le voci al totale." })] })] }), _jsx(Shot, { name: "costs", alt: "Popup Come si calcolano i costi con spazio, quota gratuita, download e limiti della stima", children: "La \u201Ci\u201D nella dashboard spiega le tariffe configurate e i limiti della proiezione." }), _jsxs("p", { children: ["Quando il sito configura una tariffa, il box mensile proietta l\u2019occupazione attuale su tutto il mese. \u00C8 una ", _jsx("strong", { children: "stima orientativa del solo spazio" }), ": non ricostruisce i consumi gi\u00E0 cancellati, non presume la disponibilit\u00E0 della quota gratuita condivisa e non aggiunge download extra, imposte o conversione valutaria. Il costo effettivo dipende dal consumo reale."] }), _jsxs("p", { children: ["Per le cifre applicabili al tuo sito, apri la ", _jsx("strong", { children: "i" }), ". Le tariffe nelle schermate di questa guida sono dimostrative; fanno fede il conteggio e le condizioni del servizio effettivamente configurato. Su alcuni siti inventario o stima non sono disponibili."] })] }), _jsxs(Chapter, { id: "problemi", n: "12 \u00B7 Risposte rapide", title: "Domande frequenti", children: [_jsxs("details", { children: [_jsx("summary", { children: "Perch\u00E9 Galleria e conversione sono disabilitate?" }), _jsx("p", { children: "Se ci sono gi\u00E0 file nel transfer, quelle scelte sono bloccate perch\u00E9 richiedono una preparazione diversa. Per cambiarle, rimuovi e ricarica i file interessati. Non sono necessarie per inviare soltanto gli originali." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Ho chiuso il browser: devo ricominciare da zero?" }), _jsx("p", { children: "Riapri il transfer e prova \u201CRiprendi\u201D con gli stessi file originali. Le parti gi\u00E0 confermate possono essere riutilizzate. Se hai modificato i file, il recupero pu\u00F2 non essere possibile: conserva la selezione originale e segui il messaggio del pannello." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Il cliente non riesce a scaricare." }), _jsx("p", { children: "Controlla che il transfer sia pronto, che i file non siano scaduti o rimossi e che il link sia valido. Se \u00E8 protetto, ricontrolla il codice. Chiedi al cliente di verificare connessione e spazio libero sul dispositivo, quindi di riprovare dal link della pagina." })] }), _jsxs("details", { children: [_jsx("summary", { children: "\u201CSenza richieste\u201D vuol dire che il cliente non ha aperto la pagina?" }), _jsx("p", { children: "No. Significa che non risulta un uso del pulsante di download per quel transfer. La consultazione della pagina o della Galleria non equivale a una richiesta di download." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Lo spazio non scende subito dopo una rimozione." }), _jsx("p", { children: "La rimozione residua pu\u00F2 avvenire in background e la dashboard mostra l\u2019ultimo inventario completo. Attendi il controllo successivo o usa \u201CVerifica ora\u201D. Se il problema continua, contatta l\u2019assistenza senza eliminare altri transfer per tentativi." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Come torno alla consegna da questa guida?" }), _jsx("p", { children: "La guida si apre in una scheda separata: il pannello originale resta aperto. Torna alla sua scheda oppure usa \u201CApri la dashboard\u201D in alto." })] })] }), _jsxs("footer", { className: "tg-footer", children: [_jsx("p", { children: "Guida alle funzioni disponibili in AdminKit \u00B7 aggiornata il 22 ottobre 2026." }), _jsx("a", { href: "#inizio", children: "Torna all\u2019inizio \u2191" })] })] })] })] });
|
|
28
|
+
return _jsxs("div", { className: "tg-guide", children: [_jsx("a", { className: "tg-skip", href: "#inizio", children: "Vai alla guida" }), _jsxs("header", { className: "tg-top", children: [_jsx("a", { href: dashboard.href, children: "\u2190 Apri la dashboard" }), _jsx("span", { children: "Manuale d\u2019uso \u00B7 Transfer" })] }), _jsxs("div", { className: "tg-layout", children: [_jsxs("nav", { className: "tg-toc", "aria-label": "Indice della guida", children: [_jsx("p", { className: "tg-kicker", children: "In questa guida" }), chapters.map(([id, title], i) => _jsxs("a", { href: `#${id}`, children: [_jsx("span", { children: String(i + 1).padStart(2, '0') }), title] }, id))] }), _jsxs("main", { className: "tg-main", children: [_jsxs("div", { className: "tg-hero", children: [_jsx("p", { className: "tg-kicker", children: "Guida ai Transfer" }), _jsxs("h1", { children: ["Dai file al cliente,", _jsx("br", {}), "un passaggio alla volta."] }), _jsx("p", { children: "Prepara una consegna, controlla il caricamento e condividi un solo link. Qui trovi le funzioni del pannello, illustrate con schermate dimostrative." }), _jsx("div", { className: "tg-hero-note", children: "Le immagini contengono solo dati di esempio. Colori, copertine e alcune funzioni possono variare in base al sito e alle abilitazioni del tuo pannello." })] }), _jsxs(Chapter, { id: "inizio", n: "01 \u00B7 Il percorso", title: "Prima di iniziare", children: [_jsxs("ol", { className: "tg-steps", children: [_jsxs("li", { children: [_jsx("strong", { children: "Crea un nuovo transfer." }), " Scegli Galleria e conversione prima di aggiungere i file."] }), _jsxs("li", { children: [_jsx("strong", { children: "Imposta destinatario, accesso e scadenza." }), " Parti da 60 giorni, poi adatta la durata al lavoro."] }), _jsxs("li", { children: [_jsx("strong", { children: "Aggiungi file o cartelle." }), " Il caricamento parte subito: puoi completare i dettagli mentre prosegue."] }), _jsxs("li", { children: [_jsx("strong", { children: "Controlla il risultato." }), " Verifica stato, messaggio, copertina e pagina del cliente."] }), _jsxs("li", { children: [_jsx("strong", { children: "Condividi il link." }), " Attendi lo stato Pronto prima di comunicare che la consegna \u00E8 completa."] })] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Prima di scegliere i file" }), _jsx("p", { children: "Lascia aperto il browser durante il caricamento e conserva gli originali sul computer. Il limite \u00E8 di 150 GB di file sorgenti per singolo invio; conversioni e anteprime possono occupare spazio aggiuntivo sul server." })] })] }), _jsxs(Chapter, { id: "dashboard", n: "02 \u00B7 Panoramica", title: "Leggere la dashboard", children: [_jsxs("p", { children: ["La dashboard riassume le consegne ancora disponibili. Il pulsante ", _jsx("strong", { children: "Dashboard" }), ", sopra ", _jsx("strong", { children: "Nuovo transfer" }), " nella colonna sinistra, ti riporta qui anche quando hai aperto una consegna."] }), _jsx(Shot, { name: "dashboard", alt: "Dashboard Transfer con navigazione, indicatori, stima costi e inventario dello spazio", children: "Vista d\u2019insieme: navigazione a sinistra, indicatori e spazio al centro." }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Transfer attivi" }), _jsx("dd", { children: "Consegne pubblicate, con file pronti, non scadute e con almeno un link valido." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Con download richiesto / Senza richieste" }), _jsx("dd", { children: "Distinguono i transfer per cui \u00E8 stato usato almeno una volta il pulsante di download. Una richiesta non prova che lo scaricamento sia terminato." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Spazio transfer attivi" }), _jsx("dd", { children: "Il valore deriva dall\u2019ultima verifica completa del server, quando disponibile. Il trattino indica un dato non ancora rilevato, non zero." })] })] }), _jsxs("p", { children: ["Nella tabella ", _jsx("strong", { children: "Transfer attivi" }), " puoi aprire una consegna e confrontare richieste, spazio e scadenza. L\u2019elenco laterale comprende anche bozze e transfer senza file."] })] }), _jsxs(Chapter, { id: "opzioni", n: "03 \u00B7 Prima dei file", title: "Scegliere le opzioni di consegna", children: [_jsxs("p", { children: ["Il box ", _jsx("strong", { children: "Opzioni di consegna" }), " precede ", _jsx("strong", { children: "File da consegnare" }), ". Galleria e conversione sono disattivate per i nuovi transfer: puoi inviare soltanto gli originali, sempre inclusi."] }), _jsx(Shot, { name: "options", alt: "Opzioni di consegna prima dei file, Galleria attivata e conversione in bassa risoluzione con formato JPG", children: "Le scelte che modificano la preparazione dei file vanno fatte prima del caricamento." }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Galleria" }), _jsx("dd", { children: "Mostra sulla pagina del transfer le anteprime delle immagini supportate e consente di ingrandirle. Non serve per inviare documenti o altri file." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("dd", { children: "Aggiunge un secondo archivio di immagini per web e social. Non sostituisce gli originali. Le foto arrivano fino a 2048 px sul lato lungo; quelle pi\u00F9 piccole non vengono ingrandite." })] }), _jsxs("div", { children: [_jsx("dt", { children: "JPG o WebP" }), _jsx("dd", { children: "JPG \u00E8 il formato iniziale, per la compatibilit\u00E0 con dispositivi e applicazioni. WebP \u00E8 l\u2019alternativa per file pi\u00F9 piccoli. La disponibilit\u00E0 di JPG dipende dall\u2019abilitazione del sito." })] })] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Opzioni bloccate dopo il caricamento" }), _jsx("p", { children: "Anteprime e conversioni si preparano insieme ai file. Per cambiare queste opzioni, devi rimuovere i file interessati e caricarli di nuovo. Nome, messaggio e scadenza si gestiscono separatamente." })] })] }), _jsxs(Chapter, { id: "dettagli", n: "04 \u00B7 Preparazione", title: "Aggiungere file e destinatario", children: [_jsxs("p", { children: ["Usa ", _jsx("strong", { children: "Aggiungi file" }), " per selezionare uno o pi\u00F9 file, ", _jsx("strong", { children: "Aggiungi una cartella" }), " per una cartella intera, oppure trascina file e cartelle nell\u2019area tratteggiata. La struttura delle cartelle viene conservata nello ZIP."] }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Nome del transfer:" }), " identifica la consegna per il cliente ed \u00E8 usato anche per il nome dello ZIP. Scegli un nome riconoscibile, per esempio \u201CTeam building \u2014 Milano\u201D."] }), _jsxs("li", { children: [_jsx("strong", { children: "Destinatario:" }), " nome del cliente o dell\u2019azienda, facoltativo. \u00C8 distinto dal campo Email del destinatario."] }), _jsxs("li", { children: [_jsx("strong", { children: "Messaggio:" }), " testo di accompagnamento facoltativo, visibile sulla pagina del cliente."] })] }), _jsxs("p", { children: ["Controlla i dettagli prima di condividere. Su un transfer gi\u00E0 inviato, conferma le modifiche con ", _jsx("strong", { children: "Salva" }), " o ", _jsx("strong", { children: "Salva modifiche" }), "."] })] }), _jsxs(Chapter, { id: "accesso", n: "05 \u00B7 Disponibilit\u00E0", title: "Accesso e scadenza", children: [_jsx(Shot, { name: "access", alt: "Impostazioni di accesso con link e codice, campo codice e selettore Scadenza a 60 giorni", children: "Accesso e scadenza regolano chi pu\u00F2 entrare e fino a quando i file restano scaricabili." }), _jsxs("p", { children: [_jsx("strong", { children: "Chiunque abbia il link" }), " consente l\u2019accesso a chi lo riceve: il destinatario pu\u00F2 inoltrarlo. Se vuoi un secondo controllo, scegli ", _jsx("strong", { children: "Link e codice di accesso" }), ". Puoi cambiare il codice o generarne un altro con ", _jsx("strong", { children: "Rigenera" }), ". Dopo dieci tentativi errati, l\u2019accesso viene sospeso per un\u2019ora."] }), _jsxs("p", { children: [_jsx("strong", { children: "Scadenza" }), " parte da ", _jsx("strong", { children: "60 giorni" }), " per un nuovo transfer. Sono disponibili anche altre durate e \u201CPer sempre\u201D. Quando riapri un transfer, la data gi\u00E0 impostata viene conservata finch\u00E9 non la cambi."] }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Alla scadenza" }), _jsx("p", { children: "Il link pu\u00F2 continuare a mostrare una pagina di stato, ma i file non sono pi\u00F9 scaricabili. La rimozione dei file segue le regole e i controlli del servizio: non considerare la scadenza un archivio di sicurezza." })] })] }), _jsxs(Chapter, { id: "caricamento", n: "06 \u00B7 Avanzamento", title: "Caricare, mettere in pausa e riprendere", children: [_jsx("p", { children: "Durante il caricamento il pannello indica fase, file elaborati e quantit\u00E0 inviata. La preparazione pu\u00F2 includere verifica dei file, originali, anteprime e controlli finali: non tutte le fasi avanzano alla stessa velocit\u00E0." }), _jsx(Shot, { name: "upload", alt: "Transfer con caricamento in pausa, avanzamento e riquadro Caricamenti con Riprendi e Annulla", children: "Il caricamento resta visibile nel riquadro in basso a destra anche se cambi sezione del pannello." }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Pausa / Riprendi:" }), " sospendono e riavviano il lavoro mantenendo aperta la scheda."] }), _jsxs("li", { children: [_jsx("strong", { children: "Se chiudi o ricarichi:" }), " il lavoro si interrompe. Riapri il transfer, premi \u201CRiprendi\u201D e riseleziona gli stessi file o la stessa cartella, senza modificarli. Le parti gi\u00E0 confermate vengono recuperate quando possibile."] }), _jsxs("li", { children: [_jsx("strong", { children: "Se manca la connessione:" }), " il pannello pu\u00F2 attendere la rete e riprovare. Se compare un errore, segui il messaggio e usa \u201CRiprova\u201D quando disponibile."] }), _jsxs("li", { children: [_jsx("strong", { children: "Annulla:" }), " richiede conferma e interrompe quel caricamento. I file gi\u00E0 inviati per quel lavoro vengono avviati alla rimozione; non equivale a una pausa."] })] }), _jsx("p", { children: "Puoi continuare a usare il pannello durante l\u2019upload. Mantieni per\u00F2 la scheda aperta, il computer attivo e la connessione disponibile fino al completamento." })] }), _jsxs(Chapter, { id: "condivisione", n: "07 \u00B7 Invio", title: "Condividere il link", children: [_jsx(Shot, { name: "sharing", alt: "Transfer pronto con link cliente e pulsanti Copia il link, Copia il messaggio e Apri in WhatsApp", children: "Il riquadro del link raccoglie gli strumenti di condivisione della consegna." }), _jsxs("p", { children: [_jsx("strong", { children: "Ottieni il link" }), " prepara la condivisione. Al termine del caricamento, il pannello pu\u00F2 rendere automaticamente pronto il transfer. Il link pu\u00F2 funzionare gi\u00E0 mentre arrivano i file: chi lo apre vede lo stato della consegna. Per annunciare una consegna completa, attendi che risulti ", _jsx("strong", { children: "Pronto" }), "."] }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Copia il link:" }), " copia soltanto l\u2019indirizzo, da incollare nel canale che preferisci."] }), _jsxs("li", { children: [_jsx("strong", { children: "Copia il messaggio:" }), " prepara un testo con i dettagli, il link, l\u2019eventuale codice e la scadenza. Rileggilo prima di inviarlo."] }), _jsxs("li", { children: [_jsx("strong", { children: "Apri in WhatsApp:" }), " apre un messaggio da completare. Il pannello non sceglie il destinatario e non lo invia automaticamente."] }), _jsxs("li", { children: [_jsx("strong", { children: "Accorcia link:" }), " se disponibile, crea un indirizzo pi\u00F9 breve; il vecchio indirizzo continua a funzionare."] })] }), _jsx("h3", { children: "Email automatiche" }), _jsxs("p", { children: ["In ", _jsx("strong", { children: "Impostazioni Transfer \u2192 Email dei Transfer" }), ", inserisci o modifica l\u2019", _jsx("strong", { children: "Email del titolare" }), " e premi ", _jsx("strong", { children: "Salva impostazioni email" }), ". Puoi anche attivare ", _jsx("strong", { children: "Avvisami quando viene avviato un download" }), ": riceverai una notifica per ogni nuova richiesta di scaricamento, senza recuperare quelle passate. Puoi salvare queste preferenze anche prima che il servizio email sia configurato."] }), _jsxs("p", { children: ["Nel riquadro ", _jsx("strong", { children: "Invio email" }), ", prima di scegliere i file, puoi abilitare ", _jsx("strong", { children: "Avvisami quando il transfer \u00E8 pronto" }), " e inserire l\u2019", _jsx("strong", { children: "Email del destinatario" }), ", scegliendo ", _jsx("strong", { children: "Invia automaticamente il link al destinatario" }), ". Le opzioni sono separate e facoltative. Quando il servizio non \u00E8 configurato, il pannello lo indica e gli invii restano disattivati."] }), _jsx("p", { children: "L\u2019email parte solo quando tutti i file e le conversioni risultano pronti. Comprende il messaggio e la scadenza salvati sul transfer; il codice di accesso va comunicato separatamente. Lo storico distingue attesa, invio, accettazione dal servizio ed errori. L\u2019accettazione non prova la consegna in posta in arrivo o la lettura." }), _jsxs("p", { children: ["Puoi usare ", _jsx("strong", { children: "Reinvia email al destinatario" }), " o ", _jsx("strong", { children: "Reinvia notifica al titolare" }), ", confermando il destinatario. Gli errori temporanei vengono ritentati; se compare \u201CDa verificare prima di riprovare\u201D, verifica l\u2019invio prima di richiederne un altro, per evitare duplicati. Gli invii sono limitati per prevenire ripetizioni accidentali."] }), _jsxs("p", { children: ["Con ", _jsx("strong", { children: "Guarda come lo vede il cliente" }), " apri la pagina pubblica in un\u2019altra scheda per controllare testi, accesso e download."] })] }), _jsxs(Chapter, { id: "pagina-cliente", n: "08 \u00B7 Ricezione", title: "Che cosa vede il cliente", children: [_jsx("p", { children: "La pagina si adatta al sito: pu\u00F2 mostrare una copertina, destinatario, messaggio, download e Galleria. Con accesso protetto viene richiesto il codice. La conversione, se preparata, compare come download aggiuntivo; l\u2019archivio degli originali rimane distinto." }), _jsx("p", { children: "Il download avviene tramite il pulsante della pagina. Il contenuto viene raccolto in uno ZIP: dopo averlo scaricato, il cliente deve estrarlo sul proprio dispositivo. Anteprime e ingrandimenti sono disponibili per le immagini supportate, quando la Galleria \u00E8 stata abilitata." }), _jsxs("aside", { className: "tg-callout", children: [_jsx("strong", { children: "Richiesto non significa ricevuto" }), _jsx("p", { children: "Il contatore misura l\u2019avvio richiesto tramite il pulsante. Non certifica la ricezione completa, l\u2019apertura dello ZIP o la visualizzazione di tutte le foto. Se serve una conferma di consegna, chiedila al destinatario." })] })] }), _jsxs(Chapter, { id: "copertine", n: "09 \u00B7 Presentazione", title: "Copertine, recensioni e note d\u2019uso", children: [_jsx(Shot, { name: "covers", alt: "Copertine del transfer e azioni Salva modifiche, Carica un\u2019immagine e Usa quella predefinita", children: "La copertina \u00E8 separata dalla Galleria: puoi personalizzarla anche caricando un\u2019immagine dedicata." }), _jsxs("p", { children: ["Nel riquadro ", _jsx("strong", { children: "Copertina" }), ", scegli le anteprime disponibili oppure usa ", _jsx("strong", { children: "Carica un\u2019immagine" }), ". Puoi scegliere fino a otto immagini: una resta fissa, pi\u00F9 immagini compongono una sequenza. Conferma con ", _jsx("strong", { children: "Salva modifiche" }), "."] }), _jsxs("p", { children: [_jsx("strong", { children: "Usa quella predefinita" }), " rimuove la scelta specifica e ripristina la copertina del sito. Nel pannello completo, le impostazioni Transfer possono offrire anche la gestione della ", _jsx("strong", { children: "Copertina predefinita" }), "; questa superficie non \u00E8 presente in tutte le installazioni."] }), _jsxs("p", { children: ["In ", _jsx("strong", { children: "Alla fine della pagina" }), ", puoi abilitare ", _jsx("strong", { children: "Chiedi una recensione" }), " e impostare testo del pulsante e indirizzo della pagina recensioni. Le ", _jsx("strong", { children: "Note d\u2019uso" }), " accompagnano i file, per esempio con indicazioni di utilizzo concordate con il cliente."] }), _jsx("p", { children: "Se il sito lo consente, puoi anche personalizzare i testi dei pulsanti di download; lascia vuoto per mantenere quelli predefiniti." })] }), _jsxs(Chapter, { id: "gestione", n: "10 \u00B7 Dopo l\u2019invio", title: "Modificare, riutilizzare e rimuovere", children: [_jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Usa come modello" }), _jsx("dd", { children: "Crea un nuovo transfer riutilizzando i dettagli e i testi della consegna. I file non vengono duplicati: aggiungi quelli necessari e ricontrolla opzioni e scadenza prima dell\u2019invio." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Rimuovi un gruppo di file" }), _jsx("dd", { children: "Il pulsante \u201CRimuovi\u201D nel riquadro file agisce su quel caricamento e richiede conferma. Se rimuovi gli ultimi file, il transfer non risulta pi\u00F9 pronto." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Libera spazio: togli gli originali" }), _jsx("dd", { children: "Quando disponibile, avvia l\u2019archiviazione degli originali. Nell\u2019interfaccia \u00E8 indicato un periodo di recuperabilit\u00E0 di sette giorni; non fare affidamento sul download degli originali dopo questa azione. Conserva sempre la tua copia." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Elimina il transfer" }), _jsx("dd", { children: "Richiede una conferma esplicita. Il link smette subito di funzionare; file e upload residui vengono rimossi in background. L\u2019azione non \u00E8 reversibile nel pannello." })] })] }), _jsxs("aside", { className: "tg-callout tg-warning", children: [_jsx("strong", { children: "Prima di rimuovere" }), _jsx("p", { children: "Verifica il nome della consegna e conserva una copia dei file. Non eliminare un transfer per mettere in pausa un upload. Le protezioni di conservazione eventualmente presenti sul server possono impedire la rimozione di dati protetti." })] }), _jsxs("p", { children: [_jsx("strong", { children: "Pagamento" }), " e ", _jsx("strong", { children: "Selezione del cliente" }), " sono raccolti in \u201CFunzioni aggiuntive non attive\u201D quando non disponibili. La presenza della descrizione non significa che la funzione sia abilitata."] })] }), _jsxs(Chapter, { id: "spazio", n: "11 \u00B7 Consumi", title: "Controllare spazio e costi", children: [_jsxs("p", { children: [_jsx("strong", { children: "Verifica ora" }), " aggiorna l\u2019inventario, se abilitato. La lettura non scarica e non elimina i file. Controlla sempre la data dell\u2019ultima verifica: un inventario in corso o non riuscito non \u00E8 un nuovo totale affidabile."] }), _jsxs("dl", { className: "tg-definitions", children: [_jsxs("div", { children: [_jsx("dt", { children: "Spazio totale" }), _jsx("dd", { children: "Comprende gli elementi conservati sul server rilevati dall\u2019inventario." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Versioni nascoste" }), _jsx("dd", { children: "Copie precedenti che possono continuare a occupare spazio." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Upload incompleti" }), _jsx("dd", { children: "Parti gi\u00E0 inviate per caricamenti non ancora completati." })] }), _jsxs("div", { children: [_jsx("dt", { children: "Senza consegna associata" }), _jsx("dd", { children: "Dati per cui l\u2019inventario non trova un riferimento nei transfer. Possono includere versioni nascoste o upload incompleti: non sommare tutte le voci al totale." })] })] }), _jsx(Shot, { name: "costs", alt: "Popup Come si calcolano i costi con spazio, quota gratuita, download e limiti della stima", children: "La \u201Ci\u201D nella dashboard spiega le tariffe configurate e i limiti della proiezione." }), _jsxs("p", { children: ["Quando il sito configura una tariffa, il box mensile proietta l\u2019occupazione attuale su tutto il mese. \u00C8 una ", _jsx("strong", { children: "stima orientativa del solo spazio" }), ": non ricostruisce i consumi gi\u00E0 cancellati, non presume la disponibilit\u00E0 della quota gratuita condivisa e non aggiunge download extra, imposte o conversione valutaria. Il costo effettivo dipende dal consumo reale."] }), _jsxs("p", { children: ["Per le cifre applicabili al tuo sito, apri la ", _jsx("strong", { children: "i" }), ". Le tariffe nelle schermate di questa guida sono dimostrative; fanno fede il conteggio e le condizioni del servizio effettivamente configurato. Su alcuni siti inventario o stima non sono disponibili."] })] }), _jsxs(Chapter, { id: "problemi", n: "12 \u00B7 Risposte rapide", title: "Domande frequenti", children: [_jsxs("details", { children: [_jsx("summary", { children: "Perch\u00E9 Galleria e conversione sono disabilitate?" }), _jsx("p", { children: "Se ci sono gi\u00E0 file nel transfer, quelle scelte sono bloccate perch\u00E9 richiedono una preparazione diversa. Per cambiarle, rimuovi e ricarica i file interessati. Non sono necessarie per inviare soltanto gli originali." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Ho chiuso il browser: devo ricominciare da zero?" }), _jsx("p", { children: "Riapri il transfer e prova \u201CRiprendi\u201D con gli stessi file originali. Le parti gi\u00E0 confermate possono essere riutilizzate. Se hai modificato i file, il recupero pu\u00F2 non essere possibile: conserva la selezione originale e segui il messaggio del pannello." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Il cliente non riesce a scaricare." }), _jsx("p", { children: "Controlla che il transfer sia pronto, che i file non siano scaduti o rimossi e che il link sia valido. Se \u00E8 protetto, ricontrolla il codice. Chiedi al cliente di verificare connessione e spazio libero sul dispositivo, quindi di riprovare dal link della pagina." })] }), _jsxs("details", { children: [_jsx("summary", { children: "\u201CSenza richieste\u201D vuol dire che il cliente non ha aperto la pagina?" }), _jsx("p", { children: "No. Significa che non risulta un uso del pulsante di download per quel transfer. La consultazione della pagina o della Galleria non equivale a una richiesta di download." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Lo spazio non scende subito dopo una rimozione." }), _jsx("p", { children: "La rimozione residua pu\u00F2 avvenire in background e la dashboard mostra l\u2019ultimo inventario completo. Attendi il controllo successivo o usa \u201CVerifica ora\u201D. Se il problema continua, contatta l\u2019assistenza senza eliminare altri transfer per tentativi." })] }), _jsxs("details", { children: [_jsx("summary", { children: "Come torno alla consegna da questa guida?" }), _jsx("p", { children: "La guida si apre in una scheda separata: il pannello originale resta aperto. Torna alla sua scheda oppure usa \u201CApri la dashboard\u201D in alto." })] })] }), _jsxs("footer", { className: "tg-footer", children: [_jsx("p", { children: "Guida alle funzioni disponibili in AdminKit \u00B7 aggiornata il 22 ottobre 2026." }), _jsx("a", { href: "#inizio", children: "Torna all\u2019inizio \u2191" })] })] })] })] });
|
|
29
29
|
}
|
|
30
30
|
export function mountTransferGuide(root) { document.title = 'Guida ai Transfer'; createRoot(root).render(_jsx(TransferGuide, {})); }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DeliveryEmailConfiguration, DeliveryEmail, saveTransferEmailPreferences } from "./DeliveryEmail";
|
|
2
3
|
/* Consegne — l'interfaccia.
|
|
3
4
|
*
|
|
4
5
|
* UNA schermata sola per un transfer, che sia nuovo o già spedito: prima c'erano due form
|
|
@@ -56,6 +57,15 @@ export function DeliveryWorkspace({ delivery: fromServer, busy, onAction, onRefr
|
|
|
56
57
|
const [heroes, setHeroes] = useState(fromServer?.heroes || []);
|
|
57
58
|
const [heroesClean, setHeroesClean] = useState(fromServer?.heroes || []);
|
|
58
59
|
const [saving, setSaving] = useState(false);
|
|
60
|
+
const [emailPreferences, setEmailPreferences] = useState({ recipientEmail: '', notifyOwner: false, sendRecipient: false });
|
|
61
|
+
const [emailClean, setEmailClean] = useState({ recipientEmail: '', notifyOwner: false, sendRecipient: false });
|
|
62
|
+
const emailDirty = JSON.stringify(emailPreferences) !== JSON.stringify(emailClean);
|
|
63
|
+
const persistEmail = async (id) => {
|
|
64
|
+
if (emailDirty || emailPreferences.recipientEmail || emailPreferences.notifyOwner || emailPreferences.sendRecipient) {
|
|
65
|
+
await saveTransferEmailPreferences(id, emailPreferences);
|
|
66
|
+
setEmailClean({ ...emailPreferences });
|
|
67
|
+
}
|
|
68
|
+
};
|
|
59
69
|
const [jpegEnabled, setJpegEnabled] = useState(false);
|
|
60
70
|
const [downloadLabelsEnabled, setDownloadLabelsEnabled] = useState(false);
|
|
61
71
|
useEffect(() => {
|
|
@@ -95,7 +105,7 @@ export function DeliveryWorkspace({ delivery: fromServer, busy, onAction, onRefr
|
|
|
95
105
|
const job = delivery ? uploadFor(delivery.id, jobs) : undefined;
|
|
96
106
|
const uploading = isBusy(job) || startingRef.current;
|
|
97
107
|
const heroesDirty = !sameHeroes(heroes, heroesClean);
|
|
98
|
-
const dirty = !same(draft, clean) || heroesDirty;
|
|
108
|
+
const dirty = !same(draft, clean) || heroesDirty || emailDirty;
|
|
99
109
|
const photos = packages.filter(pkg => pkg.state === "ready").flatMap((pkg) => [...pkg.images, ...(moreImages[pkg.id]?.images || [])].map((image) => ({ pkg, image })));
|
|
100
110
|
async function loadMoreImages() {
|
|
101
111
|
if (loadingImages || !delivery)
|
|
@@ -180,6 +190,19 @@ export function DeliveryWorkspace({ delivery: fromServer, busy, onAction, onRefr
|
|
|
180
190
|
}, { reload: false })).delivery;
|
|
181
191
|
setMade(target);
|
|
182
192
|
}
|
|
193
|
+
await persistEmail(target.id);
|
|
194
|
+
if (emailPreferences.notifyOwner || emailPreferences.sendRecipient) {
|
|
195
|
+
target = (await onAction({ action: 'update', id: target.id, version: target.version, title,
|
|
196
|
+
clientName: draft.clientName, description: draft.description, licenseNotes: draft.licenseNotes,
|
|
197
|
+
ctaEnabled: draft.ctaEnabled, ctaLabel: draft.ctaLabel, ctaUrl: draft.ctaUrl, expiresAt: target.expiresAt,
|
|
198
|
+
filesExpiresAt: draft.duration === 'keep' ? target.filesExpiresAt : expiryFrom(draft.duration),
|
|
199
|
+
}, { reload: false })).delivery;
|
|
200
|
+
const currentLink = primaryLink(target);
|
|
201
|
+
if (!currentLink)
|
|
202
|
+
await onAction({ action: 'createLink', id: target.id, label: 'Link del cliente', pin: draft.pin }, { reload: false });
|
|
203
|
+
else if ((currentLink.pin || '') !== draft.pin)
|
|
204
|
+
await onAction({ action: 'updateLink', id: target.id, linkId: currentLink.id, label: currentLink.label, pin: draft.pin, expiresAt: currentLink.expiresAt }, { reload: false });
|
|
205
|
+
}
|
|
183
206
|
if (resume) {
|
|
184
207
|
if (resume.sourceFingerprint !== fingerprint) {
|
|
185
208
|
throw new Error("Questi non sono gli stessi file di prima. Riseleziona esattamente la cartella " +
|
|
@@ -283,6 +306,7 @@ export function DeliveryWorkspace({ delivery: fromServer, busy, onAction, onRefr
|
|
|
283
306
|
action: "createLink", id: delivery.id, label: "Link del cliente", pin: draft.pin,
|
|
284
307
|
}, { reload: false });
|
|
285
308
|
}
|
|
309
|
+
await persistEmail(delivery.id);
|
|
286
310
|
if (ready && delivery.status !== "archived") {
|
|
287
311
|
await onAction({ action: "activate", id: delivery.id }, { reload: false });
|
|
288
312
|
}
|
|
@@ -385,7 +409,7 @@ export function DeliveryWorkspace({ delivery: fromServer, busy, onAction, onRefr
|
|
|
385
409
|
const state = delivery ? transferState(delivery) : null;
|
|
386
410
|
const expiry = draft.duration === "keep"
|
|
387
411
|
? delivery?.filesExpiresAt || null : expiryFrom(draft.duration);
|
|
388
|
-
return (_jsxs("div", { className: "dl-work", children: [_jsxs("header", { className: "dl-work-head", children: [_jsxs("div", { className: "dl-work-title", children: [state && _jsx("span", { className: "dl-pill is-" + state.kind, children: state.label }), _jsx("h2", { children: draft.title.trim() || (delivery ? delivery.title : "Nuovo transfer") })] }), _jsxs("div", { className: "dl-work-actions", children: [link && (_jsx("a", { className: "ak-btn", href: link.url, target: "_blank", rel: "noreferrer", children: "Guarda come lo vede il cliente" })), link && (_jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy, onClick: () => void save(), children: saving ? "Salvo…" : "Salva" }))] })] }), (failure || notice) && (_jsxs("p", { className: failure ? "ak-error dl-feedback" : "dl-feedback is-ok", children: [failure || notice, _jsx("button", { type: "button", "aria-label": "Chiudi", onClick: () => { setFailure(null); setNotice(null); }, children: "\u00D7" })] })), _jsxs("div", { className: "dl-grid", children: [_jsxs("div", { className: "dl-main", children: [_jsxs(Group, { title: "Opzioni di consegna", note: packages.length
|
|
412
|
+
return (_jsxs("div", { className: "dl-work", children: [_jsxs("header", { className: "dl-work-head", children: [_jsxs("div", { className: "dl-work-title", children: [state && _jsx("span", { className: "dl-pill is-" + state.kind, children: state.label }), _jsx("h2", { children: draft.title.trim() || (delivery ? delivery.title : "Nuovo transfer") })] }), _jsxs("div", { className: "dl-work-actions", children: [link && (_jsx("a", { className: "ak-btn", href: link.url, target: "_blank", rel: "noreferrer", children: "Guarda come lo vede il cliente" })), link && (_jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy, onClick: () => void save(), children: saving ? "Salvo…" : "Salva" }))] })] }), (failure || notice) && (_jsxs("p", { className: failure ? "ak-error dl-feedback" : "dl-feedback is-ok", children: [failure || notice, _jsx("button", { type: "button", "aria-label": "Chiudi", onClick: () => { setFailure(null); setNotice(null); }, children: "\u00D7" })] })), _jsxs("div", { className: "dl-grid", children: [_jsxs("div", { className: "dl-main", children: [_jsx(DeliveryEmail, { id: delivery?.id, value: emailPreferences, onChange: setEmailPreferences, busy: saving || uploading, unsaved: dirty, onState: p => { setEmailPreferences(p); setEmailClean(p); } }), _jsxs(Group, { title: "Opzioni di consegna", note: packages.length
|
|
389
413
|
? "Le opzioni dei file caricati sono bloccate. Per cambiarle, rimuovi e ricarica i file."
|
|
390
414
|
: "Scegli prima di aggiungere i file. Gli originali sono sempre inclusi.", children: [_jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.gallery, disabled: !!packages.length, onChange: (e) => change({ gallery: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Galleria" }), _jsx("small", { children: "Mostra le foto in anteprima sulla pagina del transfer." })] })] }), _jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.light, disabled: !!packages.length, onChange: (e) => change({ light: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("small", { children: "Aggiunge un download per web e social, fino a 2048 px sul lato lungo." })] })] }), draft.light && (_jsxs("label", { className: "dl-field", children: [_jsx("span", { children: "Formato della conversione" }), _jsxs("select", { className: "dl-select", "aria-label": "Formato della conversione", value: draft.webFormat, disabled: !!packages.length || uploading, onChange: (e) => change({ webFormat: e.target.value === "jpg" ? "jpg" : "webp" }), children: [_jsx("option", { value: "webp", children: "WebP \u2014 file pi\u00F9 piccoli" }), _jsx("option", { value: "jpg", disabled: !jpegEnabled && draft.webFormat !== "jpg", children: "JPG \u2014 massima compatibilit\u00E0" })] }), _jsxs("small", { children: ["2048 px sul lato lungo, senza ingrandire le foto pi\u00F9 piccole. Qualit\u00E0 ", draft.webFormat === "jpg" ? "82%" : "80%", "."] })] }))] }), _jsxs("section", { className: "dl-card dl-upload-card", "aria-labelledby": "dl-files-heading", children: [_jsxs("div", { className: "dl-section-head", children: [_jsx("h3", { id: "dl-files-heading", children: "File da consegnare" }), _jsx("p", { children: "Fino a 150 GB per transfer. Il caricamento inizia appena scegli i file." })] }), _jsxs("div", { className: "dl-pick", children: [_jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(filesRef.current), children: [_jsx(FileIcon, {}), "Aggiungi file"] }), _jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(folderRef.current), children: [_jsx(FolderIcon, {}), "Aggiungi una cartella"] }), _jsx("input", { ref: folderRef, type: "file", multiple: true, hidden: true, onChange: picked }), _jsx("input", { ref: filesRef, type: "file", multiple: true, hidden: true, onChange: picked })] }), _jsx(DropArea, { disabled: uploading, resuming: !!resumeRef.current, onFiles: (files) => {
|
|
391
415
|
const resume = resumeRef.current;
|
|
@@ -434,9 +458,9 @@ export function DeliverySettings({ settings, onAction, pickMedia }) {
|
|
|
434
458
|
const [covers, setCovers] = useState(settings.defaultHeroes);
|
|
435
459
|
const [notice, setNotice] = useState(null);
|
|
436
460
|
useEffect(() => setCovers(settings.defaultHeroes), [settings]);
|
|
437
|
-
return (_jsxs("div", { className: "dl-work", children: [_jsxs("header", { className: "dl-work-head", children: [_jsx("div", { className: "dl-work-title", children: _jsx("h2", { children: "
|
|
461
|
+
return (_jsxs("div", { className: "dl-work", children: [_jsxs("header", { className: "dl-work-head", children: [_jsx("div", { className: "dl-work-title", children: _jsx("h2", { children: "Impostazioni Transfer" }) }), _jsx("div", { className: "dl-work-actions", children: _jsx("button", { className: "ak-btn ak-btn-primary", onClick: () => void onAction({
|
|
438
462
|
action: "saveSettings", defaultHeroes: covers,
|
|
439
|
-
}).then(() => setNotice("Salvata")), children: "Salva" }) })] }), notice && _jsx("p", { className: "dl-feedback is-ok", children: notice }), _jsxs("section", { className: "dl-card dl-cover", children: [_jsxs("div", { className: "dl-cover-head", children: [_jsxs("div", { children: [_jsx("span", { className: "dl-step", children: "Pagina del cliente" }), _jsx("p", { children: "Queste immagini vanno in cima ai transfer per cui non scegli una copertina." })] }), _jsxs("div", { className: "dl-cover-actions", children: [_jsx("button", { className: "ak-btn", onClick: () => void pickMedia({ multiple: true })
|
|
463
|
+
}).then(() => setNotice("Salvata")), children: "Salva" }) })] }), notice && _jsx("p", { className: "dl-feedback is-ok", children: notice }), _jsx(DeliveryEmailConfiguration, {}), _jsxs("section", { className: "dl-card dl-cover", children: [_jsxs("div", { className: "dl-cover-head", children: [_jsxs("div", { children: [_jsx("span", { className: "dl-step", children: "Pagina del cliente" }), _jsx("p", { children: "Queste immagini vanno in cima ai transfer per cui non scegli una copertina." })] }), _jsxs("div", { className: "dl-cover-actions", children: [_jsx("button", { className: "ak-btn", onClick: () => void pickMedia({ multiple: true })
|
|
440
464
|
.then((chosen) => { if (chosen)
|
|
441
465
|
setCovers(chosen.slice(0, 8)); }), children: "Scegli dalla libreria" }), !!covers.length && (_jsx("button", { className: "ak-btn ak-btn-quiet", onClick: () => setCovers([]), children: "Nessuna" }))] })] }), !!covers.length && (_jsx("div", { className: "dl-cover-grid is-static", children: covers.map((url) => _jsx("img", { src: url, alt: "" }, url)) }))] })] }));
|
|
442
466
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface EmailPreferences {
|
|
2
|
+
recipientEmail: string;
|
|
3
|
+
notifyOwner: boolean;
|
|
4
|
+
sendRecipient: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface EmailState {
|
|
7
|
+
configuration: {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
ownerEnabled: boolean;
|
|
10
|
+
ownerEmail: string;
|
|
11
|
+
settingsVersion?: number;
|
|
12
|
+
settingsEditable?: boolean;
|
|
13
|
+
notifyDownloads?: boolean;
|
|
14
|
+
};
|
|
15
|
+
preferences: EmailPreferences;
|
|
16
|
+
messages: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
kind: 'owner' | 'recipient';
|
|
19
|
+
recipient: string;
|
|
20
|
+
state: string;
|
|
21
|
+
sentAt: string | null;
|
|
22
|
+
reason?: 'ready' | 'download';
|
|
23
|
+
}>;
|
|
24
|
+
migrationRequired?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function saveTransferEmailPreferences(id: string, p: EmailPreferences): Promise<EmailState>;
|
|
27
|
+
export declare function DeliveryEmail({ id, value, onChange, busy, onState, unsaved }: {
|
|
28
|
+
id?: string;
|
|
29
|
+
value: EmailPreferences;
|
|
30
|
+
onChange: (v: EmailPreferences) => void;
|
|
31
|
+
busy: boolean;
|
|
32
|
+
unsaved?: boolean;
|
|
33
|
+
onState?: (v: EmailPreferences) => void;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export declare function DeliveryEmailConfiguration(): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
const defaults = { recipientEmail: '', notifyOwner: false, sendRecipient: false };
|
|
4
|
+
async function request(url, body) { const r = await fetch(url, { credentials: 'same-origin', ...(body ? { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) } : {}) }); const value = await r.json(); if (!r.ok || !value.ok)
|
|
5
|
+
throw Error(value.error || 'Servizio email non disponibile'); return value.email; }
|
|
6
|
+
export async function saveTransferEmailPreferences(id, p) { return request('/admin/api/deliveries', { action: 'emailPreferences', id, ...p }); }
|
|
7
|
+
export function DeliveryEmail({ id, value, onChange, busy, onState, unsaved = false }) {
|
|
8
|
+
const [state, setState] = useState(null), [error, setError] = useState(''), [working, setWorking] = useState(false), [confirm, setConfirm] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let alive = true;
|
|
11
|
+
setState(null);
|
|
12
|
+
setError('');
|
|
13
|
+
// Configuration is readable without a transfer; no recipient data is returned.
|
|
14
|
+
request('/admin/api/deliveries?email=1' + (id ? '&id=' + encodeURIComponent(id) : ''))
|
|
15
|
+
.then(v => { if (alive) {
|
|
16
|
+
setState(v);
|
|
17
|
+
if (id)
|
|
18
|
+
onState?.(v.preferences);
|
|
19
|
+
} }).catch(e => { if (alive)
|
|
20
|
+
setError(e.message); });
|
|
21
|
+
return () => { alive = false; };
|
|
22
|
+
}, [id]);
|
|
23
|
+
const pending = state?.messages.some(m => m.state === 'pending' || m.state === 'sending') || false;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!id)
|
|
26
|
+
return;
|
|
27
|
+
let active = true;
|
|
28
|
+
const refresh = () => request('/admin/api/deliveries?email=1&id=' + encodeURIComponent(id)).then(v => { if (active)
|
|
29
|
+
setState(v); }).catch(() => { });
|
|
30
|
+
if (!busy)
|
|
31
|
+
void refresh();
|
|
32
|
+
const timer = busy || pending ? setInterval(refresh, 5000) : null;
|
|
33
|
+
return () => { active = false; if (timer)
|
|
34
|
+
clearInterval(timer); };
|
|
35
|
+
}, [id, busy, pending]);
|
|
36
|
+
const labels = { pending: 'In attesa di invio', sending: 'Invio in corso', sent: 'Accettata dal servizio email', failed: 'Invio non riuscito', review: 'Da verificare prima di riprovare', cancelled: 'Invio annullato' };
|
|
37
|
+
return _jsxs("section", { className: "dl-card dl-email", "aria-labelledby": "dl-email-title", children: [_jsxs("div", { className: "dl-section-head", children: [_jsx("h3", { id: "dl-email-title", children: "Invio email" }), _jsx("p", { children: "Le notifiche partono quando tutti i file e le eventuali conversioni sono pronti." })] }), error ? _jsx("p", { role: "status", children: error }) : !state ? _jsx("p", { role: "status", children: "Verifico il servizio email\u2026" }) : !state.configuration.enabled ? _jsx("p", { className: "dl-email-info", children: "Il servizio email non \u00E8 ancora configurato. Potrai attivare gli invii dopo la configurazione nelle impostazioni del sito." }) : null, _jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: value.notifyOwner, disabled: busy || (!state?.configuration.ownerEnabled && !value.notifyOwner), onChange: e => onChange({ ...value, notifyOwner: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Avvisami quando il transfer \u00E8 pronto" }), state?.configuration.ownerEmail && _jsxs("small", { children: ["Notifica a ", state.configuration.ownerEmail, "."] })] })] }), _jsxs("label", { className: "dl-field", children: [_jsx("span", { children: "Email del destinatario" }), _jsx("input", { type: "email", autoComplete: "off", maxLength: 254, value: value.recipientEmail, placeholder: "cliente@esempio.it", disabled: busy, onChange: e => onChange({ ...value, recipientEmail: e.target.value }) }), _jsx("small", { children: "Facoltativa. Usata solo per questa consegna." })] }), _jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: value.sendRecipient, disabled: busy || (!state?.configuration.enabled && !value.sendRecipient), onChange: e => onChange({ ...value, sendRecipient: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Invia automaticamente il link al destinatario" }), _jsx("small", { children: "L\u2019email include il messaggio e la scadenza. Se \u00E8 richiesto un codice, comunicalo separatamente." })] })] }), _jsx("p", { className: "dl-hint", children: "Imposta gli invii prima di scegliere i file. Dopo il caricamento, salva le modifiche per applicarle. Un\u2019email accettata dal servizio non conferma la lettura o la consegna nella posta in arrivo." }), !!state?.messages.length && _jsx("ul", { className: "dl-email-log", "aria-label": "Stato delle email", children: state.messages.slice(0, 4).map(m => _jsxs("li", { children: [_jsx("strong", { children: m.reason === 'download' ? 'Avvio download' : m.kind === 'owner' ? 'Titolare' : 'Destinatario' }), _jsx("span", { children: m.recipient }), _jsxs("span", { children: [labels[m.state] || 'Stato non disponibile', m.sentAt ? ' · ' + new Date(m.sentAt).toLocaleString('it-IT') : ''] })] }, m.id)) }), id && state?.configuration.enabled && _jsx("div", { className: "dl-link-actions", children: ['owner', 'recipient'].filter(k => k === 'owner' ? value.notifyOwner : value.sendRecipient && value.recipientEmail).map(kind => _jsxs("button", { type: "button", className: "ak-btn", disabled: busy || working || unsaved, title: unsaved ? "Salva prima le modifiche del transfer" : undefined, onClick: () => setConfirm(kind), children: ["Reinvia ", kind === 'owner' ? 'notifica al titolare' : 'email al destinatario'] }, kind)) }), confirm && _jsxs("div", { className: "dl-email-confirm", children: [_jsxs("p", { children: ["Inviare nuovamente l\u2019email ", confirm === 'owner' ? 'al titolare' : 'a ' + value.recipientEmail, "? Usa questa azione anche se un precedente invio richiede verifica."] }), _jsx("button", { type: "button", className: "ak-btn ak-btn-primary", disabled: working || busy, onClick: async () => { setWorking(true); setError(''); try {
|
|
38
|
+
await saveTransferEmailPreferences(id, value);
|
|
39
|
+
setState(await request('/admin/api/deliveries', { action: 'emailSend', id, kind: confirm }));
|
|
40
|
+
setConfirm(null);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
setError(e instanceof Error ? e.message : 'Invio non riuscito');
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
setWorking(false);
|
|
47
|
+
} }, children: "Conferma invio" }), _jsx("button", { className: "ak-btn", type: "button", disabled: working, onClick: () => setConfirm(null), children: "Annulla" })] })] });
|
|
48
|
+
}
|
|
49
|
+
export function DeliveryEmailConfiguration() {
|
|
50
|
+
const [config, setConfig] = useState(null), [owner, setOwner] = useState(''), [downloads, setDownloads] = useState(true), [busy, setBusy] = useState(false), [error, setError] = useState(''), [notice, setNotice] = useState('');
|
|
51
|
+
const load = async () => { setError(''); try {
|
|
52
|
+
const v = await request('/admin/api/deliveries?email=1');
|
|
53
|
+
setConfig(v.configuration);
|
|
54
|
+
setOwner(v.configuration.ownerEmail);
|
|
55
|
+
setDownloads(v.configuration.notifyDownloads !== false);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
setError(e instanceof Error ? e.message : 'Impostazioni non disponibili');
|
|
59
|
+
} };
|
|
60
|
+
useEffect(() => { void load(); }, []);
|
|
61
|
+
return _jsxs("section", { className: "dl-card dl-email-config", "aria-labelledby": "dl-email-settings-title", children: [_jsxs("div", { className: "dl-section-head", children: [_jsx("h3", { id: "dl-email-settings-title", children: "Email dei Transfer" }), _jsx("p", { children: "Notifiche al titolare e invio automatico del link ai destinatari." })] }), _jsx("p", { children: config?.enabled ? 'Servizio email configurato.' : 'Gli invii saranno disponibili dopo la configurazione del servizio email.' }), _jsxs("form", { onSubmit: async (e) => { e.preventDefault(); setBusy(true); setError(''); setNotice(''); try {
|
|
62
|
+
const v = await request('/admin/api/deliveries', { action: 'emailSettings', ownerEmail: owner, notifyDownloads: downloads, settingsVersion: config?.settingsVersion ?? 0 });
|
|
63
|
+
setConfig(v.configuration);
|
|
64
|
+
setOwner(v.configuration.ownerEmail);
|
|
65
|
+
setNotice('Impostazioni email salvate.');
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
setError(e instanceof Error ? e.message : 'Salvataggio non riuscito');
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
setBusy(false);
|
|
72
|
+
} }, children: [_jsxs("label", { className: "dl-field", children: [_jsx("span", { children: "Email del titolare" }), _jsx("input", { type: "email", autoComplete: "email", maxLength: 254, value: owner, disabled: busy || !config?.settingsEditable, onChange: e => { setOwner(e.target.value); setNotice(''); }, placeholder: "titolare@esempio.it" }), _jsx("small", { children: "Riceve gli avvisi dei Transfer ed \u00E8 l\u2019indirizzo a cui i destinatari possono rispondere. Lascia vuoto per disattivare gli avvisi al titolare." })] }), _jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: downloads, disabled: busy || !config?.settingsEditable, onChange: e => { setDownloads(e.target.checked); setNotice(''); } }), _jsxs("span", { children: [_jsx("strong", { children: "Avvisami quando viene avviato un download" }), _jsx("small", { children: "Un\u2019email per ogni nuova richiesta di download degli originali o della versione leggera. Non conferma che lo scaricamento sia terminato." })] })] }), _jsx("p", { className: "dl-hint", children: "L\u2019indirizzo vale per questo sito e viene condiviso con il servizio che gestisce i tentativi di invio. Le modifiche si applicano alle nuove notifiche; quelle ancora in coda verso il precedente titolare vengono annullate." }), _jsxs("div", { className: "dl-link-actions", children: [_jsx("button", { className: "ak-btn ak-btn-primary", type: "submit", disabled: busy || !config?.settingsEditable, children: busy ? 'Salvo…' : 'Salva impostazioni email' }), _jsx("button", { className: "ak-btn", type: "button", disabled: busy, onClick: () => void load(), children: "Ricarica" })] })] }), error && _jsx("p", { role: "alert", className: "ak-error", children: error }), notice && _jsx("p", { role: "status", children: notice }), _jsx("p", { children: "Il mittente e la chiave di accesso restano configurati sul server. La notifica di fine upload e l\u2019invio al destinatario si scelgono nel singolo transfer." })] });
|
|
73
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* Authenticated transfer emails. Consumers call the interceptor AFTER their usual
|
|
2
|
+
* Access/JWT/origin checks. Cron drains only explicitly queued notifications. */
|
|
3
|
+
import {seal,unseal,sha256} from './delivery-crypto.js';
|
|
4
|
+
const headers={'Content-Type':'application/json','Cache-Control':'private, no-store','X-Robots-Tag':'noindex, nofollow'};
|
|
5
|
+
const json=(body,status=200)=>new Response(JSON.stringify(body),{status,headers});
|
|
6
|
+
const fail=(text,status=400)=>Object.assign(new Error(text),{status});
|
|
7
|
+
export function validDeliveryEmail(value){return typeof value==='string'&&value.length<=254&&!/[\s\r\n<>]/.test(value)&&/^[^@]+@[^@]+\.[^@]+$/.test(value);}
|
|
8
|
+
const address=v=>String(v||'').trim();
|
|
9
|
+
export async function deliveryEmailConfiguration(env){
|
|
10
|
+
const from=address(env.DELIVERY_EMAIL_FROM);let owner=address(env.DELIVERY_EMAIL_OWNER),version=0,notifyDownloads=true;
|
|
11
|
+
const settingsEditable=!!env.DB&&!!await env.DB.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='delivery_email_settings'").first();
|
|
12
|
+
if(settingsEditable){const row=await env.DB.prepare('SELECT owner_email,version,notify_downloads FROM delivery_email_settings WHERE singleton=1').first();if(row){owner=row.owner_email;version=Number(row.version);notifyDownloads=!!row.notify_downloads;}}
|
|
13
|
+
let base;try{base=new URL(env.DELIVERY_PUBLIC_BASE);}catch{}
|
|
14
|
+
const enabled=env.DELIVERY_EMAIL_ENABLED==='true'&&!!env.RESEND_API_KEY&&validDeliveryEmail(from)&&!!env.DELIVERY_SECRET&&base?.protocol==='https:'&&!base.username&&!base.password&&!base.search&&!base.hash&&base.pathname==='/';
|
|
15
|
+
return {enabled,ownerEnabled:enabled&&validDeliveryEmail(owner),ownerEmail:validDeliveryEmail(owner)?owner:'',fromEmail:validDeliveryEmail(from)?from:'',settingsVersion:version,settingsEditable,notifyDownloads};
|
|
16
|
+
}
|
|
17
|
+
export async function saveDeliveryEmailSettings(env,body){
|
|
18
|
+
const current=await deliveryEmailConfiguration(env);if(!current.settingsEditable)throw fail('Aggiornamento delle impostazioni email necessario',503);
|
|
19
|
+
const owner=address(body.ownerEmail);if(owner&&!validDeliveryEmail(owner))throw fail('Inserisci un indirizzo email valido per il titolare');
|
|
20
|
+
const version=Number(body.settingsVersion);if(!Number.isSafeInteger(version)||version<0)throw fail('Versione delle impostazioni non valida');
|
|
21
|
+
if(version!==current.settingsVersion)throw fail('Le impostazioni sono state modificate in un’altra scheda. Ricarica e riprova.',409);
|
|
22
|
+
const out=await env.DB.batch([
|
|
23
|
+
env.DB.prepare(`INSERT INTO delivery_email_settings(singleton,owner_email,notify_downloads,last_download_event,version,updated_at) VALUES (1,?,?,(SELECT COALESCE(MAX(id),0) FROM delivery_events),1,?)
|
|
24
|
+
ON CONFLICT(singleton) DO UPDATE SET owner_email=excluded.owner_email,notify_downloads=excluded.notify_downloads,last_download_event=excluded.last_download_event,version=delivery_email_settings.version+1,updated_at=excluded.updated_at WHERE delivery_email_settings.version=?`)
|
|
25
|
+
.bind(owner,Number(body.notifyDownloads!==false),new Date().toISOString(),version),
|
|
26
|
+
env.DB.prepare(`UPDATE delivery_email_outbox SET state='cancelled',lease_token=NULL,lease_until=NULL WHERE kind='owner' AND state IN ('pending','sending') AND recipient!=(SELECT owner_email FROM delivery_email_settings WHERE singleton=1)`),
|
|
27
|
+
]);
|
|
28
|
+
if(!out[0]?.meta?.changes)throw fail('Le impostazioni sono state modificate in un’altra scheda. Ricarica e riprova.',409);
|
|
29
|
+
return deliveryEmailConfiguration(env);
|
|
30
|
+
}
|
|
31
|
+
async function installed(env){return !!env.DB&&!!await env.DB.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='delivery_email_outbox'").first();}
|
|
32
|
+
async function delivery(env,id){const d=await env.DB.prepare("SELECT * FROM deliveries WHERE id=? AND status!='deleted'").bind(id).first();if(!d)throw fail('Transfer non trovato',404);return d;}
|
|
33
|
+
async function prefs(env,id){return await env.DB.prepare('SELECT * FROM delivery_email_preferences WHERE delivery_id=?').bind(id).first()||{recipient_email:'',notify_owner:0,send_recipient:0};}
|
|
34
|
+
export async function readDeliveryEmailState(env,id){
|
|
35
|
+
const config=(await deliveryEmailConfiguration(env));if(!await installed(env))return {configuration:{...config,enabled:false,ownerEnabled:false},preferences:{recipientEmail:'',notifyOwner:false,sendRecipient:false},messages:[],migrationRequired:true};
|
|
36
|
+
await delivery(env,id);const p=await prefs(env,id);const {results}=await env.DB.prepare('SELECT id,kind,recipient,state,attempts,created_at,sent_at,error_code,generation FROM delivery_email_outbox WHERE delivery_id=? ORDER BY created_at DESC,id LIMIT 20').bind(id).all();
|
|
37
|
+
return {configuration:config,preferences:{recipientEmail:p.recipient_email,notifyOwner:!!p.notify_owner,sendRecipient:!!p.send_recipient},messages:(results||[]).map(r=>({id:r.id,kind:r.kind,recipient:r.recipient,state:r.state,attempts:r.attempts,createdAt:r.created_at,sentAt:r.sent_at,errorCode:r.error_code,reason:r.generation.startsWith('download:')?'download':'ready'}))};
|
|
38
|
+
}
|
|
39
|
+
export async function saveDeliveryEmailPreferences(env,id,body){
|
|
40
|
+
await delivery(env,id);if(!await installed(env))throw fail('Aggiornamento del servizio email necessario',503);
|
|
41
|
+
const recipient=address(body.recipientEmail);if(recipient&&!validDeliveryEmail(recipient))throw fail('Inserisci un indirizzo email valido');
|
|
42
|
+
const config=(await deliveryEmailConfiguration(env));if(body.notifyOwner&&!config.ownerEnabled||body.sendRecipient&&!config.enabled)throw fail('Il servizio email non è ancora configurato',409);
|
|
43
|
+
if(body.sendRecipient&&!recipient)throw fail('Inserisci l’email del destinatario');
|
|
44
|
+
await env.DB.prepare(`INSERT INTO delivery_email_preferences(delivery_id,recipient_email,notify_owner,send_recipient,updated_at) VALUES (?,?,?,?,?)
|
|
45
|
+
ON CONFLICT(delivery_id) DO UPDATE SET recipient_email=excluded.recipient_email,notify_owner=excluded.notify_owner,send_recipient=excluded.send_recipient,updated_at=excluded.updated_at`)
|
|
46
|
+
.bind(id,recipient,Number(body.notifyOwner===true),Number(body.sendRecipient===true),new Date().toISOString()).run();
|
|
47
|
+
// Stop pending messages whose consent/address changed, including claimed jobs.
|
|
48
|
+
await env.DB.prepare(`UPDATE delivery_email_outbox SET state='cancelled',lease_token=NULL,lease_until=NULL WHERE delivery_id=? AND state IN ('pending','sending')
|
|
49
|
+
AND ((kind='recipient' AND (?=0 OR recipient!=?)) OR (kind='owner' AND ?=0))`).bind(id,Number(body.sendRecipient===true),recipient,Number(body.notifyOwner===true)).run();
|
|
50
|
+
return readDeliveryEmailState(env,id);
|
|
51
|
+
}
|
|
52
|
+
async function snapshot(env,id){
|
|
53
|
+
let d;try{d=await delivery(env,id);}catch(e){if(e.status===404)return null;throw e;}const now=new Date().toISOString();if(d.status!=='active'||d.files_expires_at&&d.files_expires_at<=now||d.expires_at&&d.expires_at<=now)return null;
|
|
54
|
+
const {results}=await env.DB.prepare("SELECT id,state,originals_key,web_enabled,web_key FROM delivery_packages WHERE delivery_id=? AND state!='deleted' ORDER BY id").bind(id).all();
|
|
55
|
+
if(!results?.length||results.some(p=>p.state!=='ready'||!p.originals_key||p.web_enabled&&!p.web_key))return null;
|
|
56
|
+
const link=await env.DB.prepare("SELECT * FROM delivery_links WHERE delivery_id=? AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at>?) ORDER BY created_at,id LIMIT 1").bind(id,now).first();
|
|
57
|
+
if(!link?.token_ciphertext)return null;return {d,link,generation:await sha256(results.map(p=>p.id).join('\n'))};
|
|
58
|
+
}
|
|
59
|
+
async function message(env,s,kind,recipient,token,providedConfig=null){
|
|
60
|
+
const config=providedConfig||(await deliveryEmailConfiguration(env));const url=new URL('/c/'+encodeURIComponent(token),env.DELIVERY_PUBLIC_BASE).href;
|
|
61
|
+
const title=String(s.d.title||'Transfer').slice(0,200).replace(/[\r\n]/g,' '),brand=String(env.DELIVERY_EMAIL_SITE_NAME||new URL(env.DELIVERY_PUBLIC_BASE).hostname).slice(0,100).replace(/[\r\n]/g,' ');
|
|
62
|
+
const expiry=s.d.files_expires_at?'\nScadenza: '+new Date(s.d.files_expires_at).toLocaleDateString('it-IT',{timeZone:'Europe/Rome'}):'';
|
|
63
|
+
const intro=kind==='owner'?'Il caricamento del transfer è completato.':'I tuoi file sono pronti da scaricare.';
|
|
64
|
+
const text=`${intro}\n\n${title}\n${s.d.client_name||''}\n\n${kind==='recipient'?s.d.description||'':''}\n\nApri il transfer: ${url}${expiry}${s.link.pin_ciphertext?'\nQuesto transfer richiede un codice di accesso: contatta il mittente se non lo hai ricevuto.':''}\n\n${brand}`;
|
|
65
|
+
const esc=v=>String(v).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
66
|
+
return {from:`${brand.replace(/[<>]/g,'')} <${config.fromEmail}>`,to:[recipient],...(config.ownerEmail?{reply_to:config.ownerEmail}:{}),subject:`${kind==='owner'?'Caricamento completato':'I tuoi file sono pronti'} · ${title}`,text,html:`<div style="font-family:system-ui,sans-serif;max-width:600px;margin:auto;line-height:1.6"><h1 style="font-size:24px">${esc(intro)}</h1><h2 style="font-size:20px">${esc(title)}</h2><p style="white-space:pre-line">${esc(kind==='recipient'?s.d.description||'':'')}</p><p><a href="${esc(url)}" style="display:inline-block;padding:12px 20px;background:#166b57;color:white;border-radius:8px;text-decoration:none">Apri il transfer</a></p><p>${esc(expiry)}</p>${s.link.pin_ciphertext?'<p>È richiesto un codice di accesso, da chiedere al mittente.</p>':''}<p>${esc(brand)}</p></div>`};
|
|
67
|
+
}
|
|
68
|
+
export async function queueDeliveryEmails(env,id,{kind=null,resend=false}={}){
|
|
69
|
+
if(!(await deliveryEmailConfiguration(env)).enabled||!await installed(env))return [];
|
|
70
|
+
const s=await snapshot(env,id);if(!s)return [];const p=await prefs(env,id),c=(await deliveryEmailConfiguration(env)),targets=[];
|
|
71
|
+
if(p.notify_owner&&c.ownerEnabled&&(!kind||kind==='owner'))targets.push(['owner',c.ownerEmail]);
|
|
72
|
+
if(p.send_recipient&&validDeliveryEmail(p.recipient_email)&&(!kind||kind==='recipient'))targets.push(['recipient',p.recipient_email]);
|
|
73
|
+
const now=new Date().toISOString(),ids=[];
|
|
74
|
+
for(const [type,to]of targets){
|
|
75
|
+
if(resend){const recent=await env.DB.prepare('SELECT COUNT(*) n,MAX(created_at) last FROM delivery_email_outbox WHERE delivery_id=? AND kind=? AND created_at>?').bind(id,type,new Date(Date.now()-86400000).toISOString()).first();if(recent.n>=5||recent.last&&Date.now()-Date.parse(recent.last)<60000)throw fail('Attendi prima di inviare nuovamente l’email',429);}
|
|
76
|
+
const key=resend?crypto.randomUUID():await sha256(`${id}/${s.generation}/${type}/${to}`),token=await unseal(env.DELIVERY_SECRET,s.link.token_ciphertext);
|
|
77
|
+
const payload=await message(env,s,type,to,token,c),cipher=await seal(env.DELIVERY_SECRET,JSON.stringify(payload));
|
|
78
|
+
const sql=`INSERT OR IGNORE INTO delivery_email_outbox(id,delivery_id,kind,recipient,payload_ciphertext,created_at,next_attempt_at,link_id,generation) SELECT ?,?,?,?,?,?,?,?,?`;
|
|
79
|
+
const values=[key,id,type,to,cipher,now,now,s.link.id,s.generation];
|
|
80
|
+
const guard=resend?` WHERE NOT EXISTS (SELECT 1 FROM delivery_email_outbox WHERE delivery_id=? AND kind=? AND created_at>?) AND (SELECT COUNT(*) FROM delivery_email_outbox WHERE delivery_id=? AND kind=? AND created_at>?)<5`:'';
|
|
81
|
+
if(resend)values.push(id,type,new Date(Date.now()-60000).toISOString(),id,type,new Date(Date.now()-86400000).toISOString());
|
|
82
|
+
const inserted=await env.DB.prepare(sql+guard).bind(...values).run();if(resend&&!inserted.meta?.changes)throw fail('Attendi prima di inviare nuovamente l’email',429);ids.push(key);
|
|
83
|
+
}
|
|
84
|
+
return ids;
|
|
85
|
+
}
|
|
86
|
+
async function downloadSnapshot(env,id,linkId){
|
|
87
|
+
let d;try{d=await delivery(env,id);}catch(e){if(e.status===404)return null;throw e;}
|
|
88
|
+
const now=new Date().toISOString();if(!['active','archived'].includes(d.status)||d.files_expires_at&&d.files_expires_at<=now||d.expires_at&&d.expires_at<=now)return null;
|
|
89
|
+
const link=await env.DB.prepare("SELECT * FROM delivery_links WHERE id=? AND delivery_id=? AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at>?)").bind(linkId,id,now).first();return link?{d,link}:null;
|
|
90
|
+
}
|
|
91
|
+
export async function queueDownloadNotifications(env){
|
|
92
|
+
const c=await deliveryEmailConfiguration(env);if(!c.enabled||!c.ownerEnabled||!c.notifyDownloads||!c.settingsVersion||!await installed(env))return;
|
|
93
|
+
const settings=await env.DB.prepare('SELECT last_download_event FROM delivery_email_settings WHERE singleton=1').first();
|
|
94
|
+
const {results}=await env.DB.prepare("SELECT * FROM delivery_events WHERE kind='download_started' AND id>? ORDER BY id LIMIT 3").bind(settings.last_download_event).all();
|
|
95
|
+
let cursor=settings.last_download_event;
|
|
96
|
+
for(const event of results||[]){
|
|
97
|
+
const s=await downloadSnapshot(env,event.delivery_id,event.link_id);if(s){
|
|
98
|
+
const id=await sha256('download/'+event.id+'/'+c.ownerEmail),token=await unseal(env.DELIVERY_SECRET,s.link.token_ciphertext);
|
|
99
|
+
const payload=await message(env,s,'owner',c.ownerEmail,token,c),date=new Date(event.created_at).toLocaleString('it-IT',{timeZone:'Europe/Rome'});
|
|
100
|
+
payload.subject='Download richiesto · '+String(s.d.title||'Transfer').slice(0,180).replace(/[\r\n]/g,' ');
|
|
101
|
+
payload.text=`È stato richiesto il download del transfer «${s.d.title}».\nData: ${date}\nVersione: ${event.variant==='web'?'bassa risoluzione':'originali'}\nUna richiesta non conferma che lo scaricamento sia terminato.\n\n`+payload.text.replace('Il caricamento del transfer è completato.','');
|
|
102
|
+
// Text-only avoids implying upload completion in the ready template.
|
|
103
|
+
delete payload.html;
|
|
104
|
+
const now=new Date().toISOString();await env.DB.prepare(`INSERT OR IGNORE INTO delivery_email_outbox(id,delivery_id,kind,recipient,payload_ciphertext,created_at,next_attempt_at,link_id,generation)
|
|
105
|
+
SELECT ?,?,'owner',?,?,?,?,?,? WHERE EXISTS(SELECT 1 FROM delivery_email_settings WHERE singleton=1 AND version=? AND owner_email=? AND notify_downloads=1)`)
|
|
106
|
+
.bind(id,event.delivery_id,c.ownerEmail,await seal(env.DELIVERY_SECRET,JSON.stringify(payload)),now,now,event.link_id,'download:'+event.id,c.settingsVersion,c.ownerEmail).run();
|
|
107
|
+
}cursor=event.id;
|
|
108
|
+
}
|
|
109
|
+
if(cursor>settings.last_download_event)await env.DB.prepare('UPDATE delivery_email_settings SET last_download_event=? WHERE singleton=1 AND version=? AND last_download_event<?').bind(cursor,c.settingsVersion,cursor).run();
|
|
110
|
+
}
|
|
111
|
+
export async function processDeliveryEmails(env,{limit=2,fetch:send=globalThis.fetch}={}){
|
|
112
|
+
if(env.DELIVERY_EMAIL_ENABLED!=='true')return;
|
|
113
|
+
if(!(await deliveryEmailConfiguration(env)).enabled||!await installed(env))return;
|
|
114
|
+
await queueDownloadNotifications(env);
|
|
115
|
+
const now=new Date().toISOString();const {results}=await env.DB.prepare(`SELECT * FROM delivery_email_outbox WHERE (state='pending' AND next_attempt_at<=?) OR (state='sending' AND lease_until<=?) ORDER BY created_at LIMIT ?`).bind(now,now,Math.max(1,Math.min(limit,10))).all();
|
|
116
|
+
for(const job of results||[]){
|
|
117
|
+
// Resend retains idempotency keys 24h: never retry an uncertain send afterwards.
|
|
118
|
+
if(job.first_attempt_at&&Date.now()-Date.parse(job.first_attempt_at)>23*3600000){await env.DB.prepare("UPDATE delivery_email_outbox SET state='review',error_code='verify_before_retry' WHERE id=? AND state IN ('pending','sending')").bind(job.id).run();continue;}
|
|
119
|
+
const claim=crypto.randomUUID(),lease=new Date(Date.now()+120000).toISOString();const won=await env.DB.prepare(`UPDATE delivery_email_outbox SET state='sending',lease_token=?,lease_until=?,attempts=attempts+1,first_attempt_at=COALESCE(first_attempt_at,?) WHERE id=? AND ((state='pending' AND next_attempt_at<=?) OR (state='sending' AND lease_until<=?))`).bind(claim,lease,now,job.id,now,now).run();if(!won.meta?.changes)continue;
|
|
120
|
+
try{
|
|
121
|
+
const isDownload=job.generation.startsWith('download:');
|
|
122
|
+
const s=isDownload?await downloadSnapshot(env,job.delivery_id,job.link_id):await snapshot(env,job.delivery_id),p=await prefs(env,job.delivery_id),c=(await deliveryEmailConfiguration(env));
|
|
123
|
+
if(!s||s.link.id!==job.link_id||(!isDownload&&s.generation!==job.generation)||(job.kind==='owner'?((isDownload?!c.notifyDownloads:!p.notify_owner)||job.recipient!==c.ownerEmail):(!p.send_recipient||job.recipient!==p.recipient_email))){await finish('cancelled',null,'cancelled');continue;}
|
|
124
|
+
const current=await env.DB.prepare("SELECT id FROM delivery_email_outbox WHERE id=? AND state='sending' AND lease_token=?").bind(job.id,claim).first();if(!current)continue;
|
|
125
|
+
const payload=await unseal(env.DELIVERY_SECRET,job.payload_ciphertext);
|
|
126
|
+
const r=await send('https://api.resend.com/emails',{method:'POST',headers:{Authorization:'Bearer '+env.RESEND_API_KEY,'Content-Type':'application/json','Idempotency-Key':'transfer/'+job.id},body:payload,signal:AbortSignal.timeout(15000)});
|
|
127
|
+
const body=await r.json().catch(()=>({}));if(r.ok&&typeof body.id==='string'){await finish('sent',body.id,null);continue;}
|
|
128
|
+
const retry=r.status===429||r.status>=500;await finish(retry?'pending':'failed',null,retry?'temporary_error':'provider_rejected');
|
|
129
|
+
}catch{await finish('pending',null,'temporary_error');}
|
|
130
|
+
async function finish(state,providerId,code){const attempts=job.attempts+1;if(state==='pending'&&attempts>=8)state='review';await env.DB.prepare(`UPDATE delivery_email_outbox SET state=?,provider_id=?,error_code=?,sent_at=?,next_attempt_at=?,lease_until=NULL,lease_token=NULL WHERE id=? AND lease_token=? AND state='sending'`).bind(state,providerId,code,state==='sent'?new Date().toISOString():null,new Date(Date.now()+Math.min(3600000,60000*2**Math.min(attempts,6))).toISOString(),job.id,claim).run();}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export async function handleDeliveryEmailRequest(request,env){
|
|
134
|
+
const url=new URL(request.url);let body=null;if(request.method==='POST'){try{body=await request.clone().json();}catch{return null;}}
|
|
135
|
+
if(!(request.method==='GET'&&url.searchParams.get('email')==='1')&&!['emailSettings','emailPreferences','emailSend'].includes(body?.action))return null;
|
|
136
|
+
try{
|
|
137
|
+
if(body?.action==='emailSettings')return json({ok:true,email:{configuration:await saveDeliveryEmailSettings(env,body)}});
|
|
138
|
+
const id=address(body?.id||url.searchParams.get('id'));if(request.method==='GET'&&!id)return json({ok:true,email:{configuration:await installed(env)?(await deliveryEmailConfiguration(env)):{...(await deliveryEmailConfiguration(env)),enabled:false,ownerEnabled:false},preferences:{recipientEmail:'',notifyOwner:false,sendRecipient:false},messages:[]}});if(!id||id.length>100)throw fail('Transfer non valido');
|
|
139
|
+
if(request.method==='GET')return json({ok:true,email:await readDeliveryEmailState(env,id)});
|
|
140
|
+
if(body.action==='emailPreferences')return json({ok:true,email:await saveDeliveryEmailPreferences(env,id,body)});
|
|
141
|
+
if(!['owner','recipient'].includes(body.kind))throw fail('Destinatario non valido');
|
|
142
|
+
if(!(await deliveryEmailConfiguration(env)).enabled)throw fail('Il servizio email non è ancora configurato',409);
|
|
143
|
+
const queued=await queueDeliveryEmails(env,id,{kind:body.kind,resend:true});if(!queued.length)throw fail('Il transfer deve essere pronto e l’invio email abilitato',409);
|
|
144
|
+
await processDeliveryEmails(env);return json({ok:true,email:await readDeliveryEmailState(env,id)});
|
|
145
|
+
}catch(e){return json({ok:false,error:e.status?e.message:'Servizio email temporaneamente non disponibile'},e.status||503);}
|
|
146
|
+
}
|
|
147
|
+
// Call only after a successful authenticated activation. Email problems must never
|
|
148
|
+
// turn a successfully uploaded transfer into an upload error.
|
|
149
|
+
export async function completeDeliveryEmailNotifications(env,id){try{await queueDeliveryEmails(env,id);await processDeliveryEmails(env);}catch{console.error('Transfer email scheduling unavailable');}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {handleDeliveryEmailRequest, queueDeliveryEmails, processDeliveryEmails} from "../_shared/delivery-email.js";
|
|
1
2
|
import { readDeliveryDashboard, verifyDeliveryStorage } from "../_shared/delivery-storage-dashboard.js";
|
|
2
3
|
/* CRUD immediato delle consegne.
|
|
3
4
|
*
|
|
@@ -21,9 +22,11 @@ import { claimManifestWriter, manifestStatus, manifestDraftPage, saveManifestChe
|
|
|
21
22
|
const DAY = 86_400_000;
|
|
22
23
|
|
|
23
24
|
export async function onRequestGet({ request, env, waitUntil }) {
|
|
25
|
+
const emailResponse = await handleDeliveryEmailRequest(request, env); if (emailResponse) return emailResponse;
|
|
24
26
|
if (!env.DB) return json({ ok: false, error: "Il servizio dei transfer non è configurato" }, 500);
|
|
25
27
|
if (typeof waitUntil === "function" && new URL(request.url).searchParams.get("dashboard") !== "1") {
|
|
26
28
|
waitUntil(purgeDue(env).catch((error) => console.error("delivery purge:", error)));
|
|
29
|
+
waitUntil(processDeliveryEmails(env).catch(() => console.error("Transfer email retry unavailable")));
|
|
27
30
|
}
|
|
28
31
|
const id = new URL(request.url).searchParams.get("id");
|
|
29
32
|
try {
|
|
@@ -58,7 +61,8 @@ export async function onRequestGet({ request, env, waitUntil }) {
|
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
export async function onRequestPost({ request, env }) {
|
|
64
|
+
export async function onRequestPost({ request, env, waitUntil }) {
|
|
65
|
+
const emailResponse = await handleDeliveryEmailRequest(request, env); if (emailResponse) return emailResponse;
|
|
62
66
|
if (!env.DB) return json({ ok: false, error: "Il servizio dei transfer non è configurato" }, 500);
|
|
63
67
|
let body;
|
|
64
68
|
try { body = await request.json(); }
|
|
@@ -74,7 +78,12 @@ export async function onRequestPost({ request, env }) {
|
|
|
74
78
|
case "create": return json({ ok: true, delivery: await createDelivery(env, body, new URL(request.url).origin) });
|
|
75
79
|
case "quickCreate": return json({ ok: true, delivery: await createQuickDelivery(env, body, new URL(request.url).origin) });
|
|
76
80
|
case "update": return json({ ok: true, delivery: await updateDelivery(env, body, new URL(request.url).origin) });
|
|
77
|
-
case "activate":
|
|
81
|
+
case "activate": {
|
|
82
|
+
const delivery = await activateDelivery(env, body, new URL(request.url).origin);
|
|
83
|
+
try { await queueDeliveryEmails(env, body.id); const dispatch = processDeliveryEmails(env); if (typeof waitUntil === "function") waitUntil(dispatch); else await dispatch; }
|
|
84
|
+
catch { console.error("Transfer email scheduling unavailable"); }
|
|
85
|
+
return json({ ok: true, delivery });
|
|
86
|
+
}
|
|
78
87
|
case "archive": return json({ ok: true, delivery: await archiveDelivery(env, body, new URL(request.url).origin) });
|
|
79
88
|
case "extend": return json({ ok: true, delivery: await extendDelivery(env, body, new URL(request.url).origin) });
|
|
80
89
|
case "duplicate": return json({ ok: true, delivery: await duplicateDelivery(env, body, new URL(request.url).origin) });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {processDeliveryEmails} from "../_shared/delivery-email.js";
|
|
1
2
|
/* Consegna pubblica: /c/<token>.
|
|
2
3
|
*
|
|
3
4
|
* Il token casuale identifica un link D1. Il bucket B2 resta privato: gli ZIP
|
|
@@ -131,7 +132,7 @@ async function get(context) {
|
|
|
131
132
|
}, 404);
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
async function post({ request, env, params }) {
|
|
135
|
+
async function post({ request, env, params, waitUntil }) {
|
|
135
136
|
if (!env.DB || !env.DELIVERY_SECRET) return json({ ok: false, error: "Servizio non attivo" }, 503);
|
|
136
137
|
const seg = segments(params.path);
|
|
137
138
|
const token = seg[0] || "";
|
|
@@ -166,6 +167,14 @@ async function post({ request, env, params }) {
|
|
|
166
167
|
VALUES (?,?,?,'download_started',?,?)
|
|
167
168
|
`).bind(access.delivery.id, access.link.id, packageId, variant, now),
|
|
168
169
|
]);
|
|
170
|
+
if(env.DELIVERY_EMAIL_ENABLED==='true'){
|
|
171
|
+
try {
|
|
172
|
+
const task=processDeliveryEmails(env).catch(()=>console.error('Download notification temporarily unavailable'));
|
|
173
|
+
if(typeof waitUntil==='function')waitUntil(task);else await task;
|
|
174
|
+
} catch {
|
|
175
|
+
console.error('Download notification temporarily unavailable');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
169
178
|
return json({
|
|
170
179
|
ok: true,
|
|
171
180
|
url: `/c/${encodeURIComponent(token)}/download/${encodeURIComponent(packageId)}/${variant}?ticket=${encodeURIComponent(ticket)}`,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Email preferences and durable outbox; no change to existing transfer records.
|
|
2
|
+
CREATE TABLE IF NOT EXISTS delivery_email_preferences (
|
|
3
|
+
delivery_id TEXT PRIMARY KEY REFERENCES deliveries(id) ON DELETE CASCADE,
|
|
4
|
+
recipient_email TEXT NOT NULL DEFAULT '', notify_owner INTEGER NOT NULL DEFAULT 0,
|
|
5
|
+
send_recipient INTEGER NOT NULL DEFAULT 0, updated_at TEXT NOT NULL
|
|
6
|
+
);
|
|
7
|
+
CREATE TABLE IF NOT EXISTS delivery_email_outbox (
|
|
8
|
+
id TEXT PRIMARY KEY, delivery_id TEXT NOT NULL REFERENCES deliveries(id) ON DELETE CASCADE,
|
|
9
|
+
link_id TEXT NOT NULL, generation TEXT NOT NULL,
|
|
10
|
+
kind TEXT NOT NULL CHECK(kind IN ('owner','recipient')), recipient TEXT NOT NULL,
|
|
11
|
+
payload_ciphertext TEXT NOT NULL, state TEXT NOT NULL DEFAULT 'pending',
|
|
12
|
+
attempts INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL, first_attempt_at TEXT,
|
|
13
|
+
next_attempt_at TEXT NOT NULL, lease_until TEXT, lease_token TEXT, sent_at TEXT,
|
|
14
|
+
provider_id TEXT, error_code TEXT
|
|
15
|
+
);
|
|
16
|
+
CREATE INDEX IF NOT EXISTS delivery_email_due ON delivery_email_outbox(state,next_attempt_at);
|
|
17
|
+
CREATE INDEX IF NOT EXISTS delivery_email_transfer ON delivery_email_outbox(delivery_id,created_at);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Shared by admin and email retry workers through the transfer database.
|
|
2
|
+
CREATE TABLE IF NOT EXISTS delivery_email_settings (
|
|
3
|
+
singleton INTEGER PRIMARY KEY CHECK(singleton=1), owner_email TEXT NOT NULL DEFAULT '',
|
|
4
|
+
notify_downloads INTEGER NOT NULL DEFAULT 1, last_download_event INTEGER NOT NULL DEFAULT 0,
|
|
5
|
+
version INTEGER NOT NULL DEFAULT 1, updated_at TEXT NOT NULL
|
|
6
|
+
);
|
|
7
|
+
CREATE INDEX IF NOT EXISTS delivery_events_kind_id ON delivery_events(kind,id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardinali-studio/adminkit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Motore riusabile di un pannello di amministrazione per siti Hugo su Cloudflare Pages: codec del front matter guidato dallo schema, form React, libreria media su R2. NIENTE di specifico di un sito qui dentro.",
|
|
6
6
|
"license": "0BSD",
|