@cardinali-studio/adminkit 2.2.51 → 2.2.53

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/dist/app/app.css CHANGED
@@ -2494,7 +2494,6 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
2494
2494
 
2495
2495
  /* Transfer composer. The options occupy their own column only when opened. */
2496
2496
  .dl-compose-grid { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr); }
2497
- .dl-compose-companion { display: grid; gap: 14px; min-width: 0; }
2498
2497
  .dl-compose-grid [hidden] { display: none; }
2499
2498
  .dl-options-head, .dl-compose-actions, .dl-selection { display: flex; align-items: center; gap: .75rem; }
2500
2499
  .dl-options-head { justify-content: space-between; }
@@ -2510,12 +2509,6 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
2510
2509
  .dl-selection .ak-btn { margin-left: auto; }
2511
2510
  .dl-compose-grid .dl-cover-head { flex-direction: column; align-items: start; }
2512
2511
  .dl-compose-grid .dl-cover-actions { justify-content: start; }
2513
- .dl-work:has(.dl-compose-grid) { container-type: inline-size; }
2514
- @container (max-width: 43rem) {
2515
- .dl-compose-grid { grid-template-columns: minmax(0,1fr); }
2516
- .dl-compose-companion { display: contents; }
2517
- .dl-recipient { order: -1; }
2518
- }
2519
2512
  @media (max-width: 700px) {
2520
2513
  .dl-compose-grid .dl-pick { grid-template-columns: repeat(2,minmax(0,1fr)); }
2521
2514
  }
@@ -2542,50 +2535,82 @@ body:has(.uk) .pane-body { padding-bottom: 190px; }
2542
2535
  .dl-settings-shortcut { display: grid; place-items: center; width: 42px; height: 42px; background: transparent; color: var(--ak-ink-quiet); border: 1px solid transparent; border-radius: var(--ak-radius); cursor: pointer; }
2543
2536
  .dl-settings-shortcut:hover, .dl-settings-shortcut[aria-current] { color: var(--ak-accent); border-color: var(--ak-line); }
2544
2537
  .dl-settings-shortcut svg { width: 18px; height: 18px; }
2545
- @container (min-width: 43.01rem) {
2546
- .dl-compose-grid.is-expanded .dl-side { max-height: min(42rem, 80svh); overflow-y: auto; scrollbar-gutter: stable; }
2547
- }
2548
-
2549
- /* A miniature of the first recipient screen, separate from the authoring controls. */
2550
- .dl-recipient { min-width: 0; overflow: hidden; border: 1px solid var(--ak-line); border-radius: var(--ak-radius); background: var(--ak-panel); }
2551
- .dl-recipient-tools { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .65rem .85rem; }
2552
- .dl-recipient-tools h3 { margin: 0; font: 600 .9rem/1.3 var(--ak-font); color: var(--ak-ink); }
2553
- .dl-preview-devices, .dl-preview-pager { display: flex; align-items: center; gap: .2rem; }
2554
- .dl-preview-devices { padding: .15rem; border: 1px solid var(--ak-line); border-radius: .6rem; }
2555
- .dl-preview-devices button, .dl-preview-pager button { border: 0; border-radius: .4rem; background: transparent; color: var(--ak-ink-quiet); cursor: pointer; font: 500 .75rem/1 var(--ak-font); }
2556
- .dl-preview-devices button { min-height: 30px; padding: .35rem .65rem; }
2557
- .dl-preview-devices button[aria-pressed=true] { color: var(--ak-ink); background: var(--ak-bg); box-shadow: inset 0 0 0 1px var(--ak-line); }
2558
- .dl-preview-surround { padding: .7rem; background: var(--ak-bg); }
2559
- .dl-preview-page { container-type: inline-size; position: relative; width: 100%; aspect-ratio: 16/10; margin: auto; overflow: auto; border-radius: .35rem; background: #f3f2ec; color: #15140e; color-scheme: light; font-family: var(--ak-font); }
2560
- .dl-preview-page.is-phone { width: min(100%, 13rem); aspect-ratio: 390/680; }
2561
- .dl-preview-sheet { position: relative; display: grid; min-height: 100%; }
2562
- .dl-preview-page.with-covers .dl-preview-sheet { grid-template-columns: 30% minmax(0,1fr); }
2563
- .dl-preview-menu { position: absolute; z-index: 1; top: 2.2cqw; left: 50%; transform: translateX(-50%); padding: .35em .9em; border: 1px solid #d5d3c9; border-radius: 2em; background: #f3f2ece6; font-size: clamp(8px,1.3cqw,12px); }
2564
- .dl-preview-info { display: flex; flex-direction: column; align-items: flex-start; gap: 1.1cqw; min-width: 0; overflow-wrap: anywhere; padding: 8cqw 2.2cqw 3cqw; font-size: clamp(9px,1.4cqw,13px); line-height: 1.4; }
2565
- .dl-preview-page:not(.with-covers) .dl-preview-info { width: min(100%, 44ch); }
2566
- .dl-preview-kicker, .dl-preview-expiry { color: #635f54; font: 500 clamp(8px,1cqw,10px)/1.35 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .045em; }
2567
- .dl-preview-title, .dl-preview-work { line-height: 1.05; letter-spacing: -.045em; }
2568
- .dl-preview-title { font-size: clamp(17px,3.8cqw,32px); }
2569
- .dl-preview-work { font-size: 1.4em; font-weight: 600; }
2570
- .dl-preview-info p { margin: 0; white-space: pre-line; color: #514e49; }
2571
- .dl-preview-download, .dl-preview-gate { display: grid; justify-items: start; gap: .4em; }
2572
- .dl-preview-download small { font-size: .95em; color: #625e53; }
2573
- .dl-preview-button, .dl-preview-final { max-width: 100%; padding: .65em 1em; border-radius: 2em; font-weight: 600; }
2574
- .dl-preview-button { color: #fff; background: #15140e; }
2575
- .dl-preview-final { background: white; margin-top: auto; }
2576
- .dl-preview-stage { display: flex; align-self: stretch; min-width: 0; gap: 1cqw; padding: 2cqw; }
2577
- .dl-preview-stage img { flex: 1 1 0; width: 0; min-width: 0; height: 58.5cqw; object-fit: contain; align-self: center; }
2578
- .dl-preview-page.is-phone .dl-preview-sheet { display: flex; flex-direction: column; }
2579
- .dl-preview-page.is-phone .dl-preview-menu { top: 4cqw; right: 4cqw; left: auto; transform: none; }
2580
- .dl-preview-page.is-phone .dl-preview-info { gap: 2.5cqw; padding: 18cqw 5cqw 5cqw; }
2581
- .dl-preview-page.is-phone .dl-preview-title { font-size: clamp(18px,8cqw,26px); }
2582
- .dl-preview-page.is-phone .dl-preview-stage { flex: 1; padding: 2cqw 5cqw 5cqw; }
2583
- .dl-preview-page.is-phone .dl-preview-stage img { height: 86cqw; }
2584
- .dl-preview-pager { justify-content: center; gap: .6rem; padding: .2rem; font-size: .75rem; font-variant-numeric: tabular-nums; }
2585
- .dl-preview-pager button { min-width: 36px; min-height: 32px; font-size: 1.4rem; }
2586
- .dl-preview-devices button:focus-visible, .dl-preview-pager button:focus-visible { outline: 2px solid var(--ak-accent); outline-offset: 1px; }
2587
-
2588
- .dl-preview-gate > div { display: flex; align-items: center; gap: .45em; flex-wrap: wrap; }
2589
- .dl-preview-code { border: 1px solid #c9c6bb; border-radius: 2em; padding: .5em 1.2em; background: white; }
2590
- .dl-preview-gate button { border: 0; font: inherit; cursor: pointer; }
2591
- .dl-preview-relock { margin: .4rem .7rem; }
2538
+
2539
+ /* The canvas is the editor sheet. Keep scrolling on the host pane. */
2540
+ .pane:has(> .pane-body > .dl-transfer-canvas) > .pane-head:has(> .pane-spacer:only-child) {
2541
+ display: none;
2542
+ }
2543
+ :root[data-admin-interface="next"] .pane-body:has(> .dl-transfer-canvas) {
2544
+ flex: 1 0 auto;
2545
+ }
2546
+ :root .app .pane > .pane-body:has(> .dl-work.dl-transfer-canvas) {
2547
+ display: flex;
2548
+ flex-direction: column;
2549
+ padding: 0;
2550
+ }
2551
+ .dl-work.dl-transfer-canvas {
2552
+ --dl-paper: #edf2f7;
2553
+ --dl-caption: #1a2835;
2554
+ box-sizing: border-box;
2555
+ container-type: inline-size;
2556
+ background: var(--dl-paper);
2557
+ width: 100%;
2558
+ margin: 0;
2559
+ flex: 1 0 auto;
2560
+ border-radius: inherit;
2561
+ padding: clamp(14px, 1.8vw, 28px);
2562
+ align-content: start;
2563
+ }
2564
+ :root .dl-work.dl-transfer-canvas > .dl-work-head {
2565
+ position: static;
2566
+ margin: 0;
2567
+ padding: 0;
2568
+ background: transparent;
2569
+ flex-wrap: wrap;
2570
+ color: var(--dl-caption);
2571
+ }
2572
+ .dl-transfer-canvas .dl-work-actions { flex-wrap: wrap; }
2573
+ .dl-transfer-canvas .dl-work-actions .ak-btn:not(.ak-btn-primary) { background: var(--ak-panel); }
2574
+ .dl-transfer-canvas .dl-compose-grid {
2575
+ grid-template-columns: clamp(17rem, 35%, 24rem) minmax(0, 1fr);
2576
+ column-gap: clamp(16px, 3cqi, 42px);
2577
+ }
2578
+ .dl-transfer-canvas .dl-main { grid-area: 1 / 1; }
2579
+ .dl-transfer-canvas .dl-compose-card, .dl-transfer-canvas .dl-link {
2580
+ box-shadow: 0 7px 25px rgb(26 40 53 / .12);
2581
+ }
2582
+ .dl-artwork {
2583
+ grid-area: 1 / 2;
2584
+ min-width: 0;
2585
+ margin: 0;
2586
+ display: grid;
2587
+ gap: 12px;
2588
+ color: var(--dl-caption);
2589
+ }
2590
+ .dl-artwork-images { display: flex; justify-content: center; align-items: center; gap: 8px; }
2591
+ .dl-artwork-images img { flex: 1 1 0; min-width: 0; width: 100%; max-height: clamp(16rem, calc(100svh - 13rem), 52rem); object-fit: contain; }
2592
+ .dl-artwork-images img:first-child:not(:only-child) { object-position: right center; }
2593
+ .dl-artwork-images img + img { object-position: left center; }
2594
+ .dl-artwork figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; overflow-wrap: anywhere; }
2595
+ .dl-artwork figcaption:empty { display: none; }
2596
+ .dl-artwork-title { display: grid; gap: .3rem; min-width: 0; }
2597
+ .dl-artwork-title strong { font: 500 clamp(20px, 3cqi, 36px)/1.1 Georgia, serif; }
2598
+ .dl-artwork-title span, .dl-artwork figcaption p { font: 400 .875rem/1.45 var(--ak-font); }
2599
+ .dl-artwork figcaption p { margin: 0; max-width: 34ch; white-space: pre-line; }
2600
+ .dl-artwork-tools, .dl-artwork-tools [role=group] { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
2601
+ .dl-artwork-tools { justify-content: space-between; }
2602
+ .dl-artwork-tools button { background: transparent; color: inherit; border: 1px solid #acbac6; border-radius: 99px; padding: 0 .85rem; min-height: 36px; font: 500 .8rem/1 var(--ak-font); cursor: pointer; }
2603
+ .dl-artwork-tools button:hover { background: #fff; }
2604
+ .dl-artwork-tools button:disabled { opacity: .5; cursor: default; }
2605
+ .dl-artwork-tools [role=group] { font: 500 .75rem var(--ak-font); }
2606
+ .dl-artwork-tools [role=group] button { font-size: 1.2rem; }
2607
+ .dl-transfer-canvas .dl-side { grid-area: 1 / 2; z-index: 1; padding: 16px; border-radius: var(--ak-radius); background: var(--ak-panel); box-shadow: 0 6px 24px rgb(26 40 53 / .15); }
2608
+ .dl-compose-grid.is-expanded .dl-artwork { display: none; }
2609
+ @container (max-width: 688px) {
2610
+ .dl-transfer-canvas .dl-compose-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
2611
+ .dl-transfer-canvas .dl-main, .dl-transfer-canvas .dl-side { grid-area: auto; }
2612
+ .dl-artwork { grid-area: 1 / 1; margin: 0; }
2613
+ .dl-artwork-images img { max-height: 32svh; }
2614
+ .dl-artwork figcaption { flex-wrap: wrap; gap: .45rem; }
2615
+ .dl-artwork-tools button { min-height: 44px; }
2616
+ }
@@ -997,10 +997,10 @@ export function deliverySelectionName(files) {
997
997
  export async function uploadDeliveryHeroObject(deliveryId, packageId, file) {
998
998
  const variant = await makeHeroVariant(file);
999
999
  const signed = await postJson({
1000
- action: "heroPresign", id: deliveryId, packageId,
1000
+ action: "heroPresign", id: deliveryId, packageId, contentType: variant.blob.type,
1001
1001
  });
1002
1002
  const response = await fetch(signed.url, {
1003
- method: "PUT", body: variant.blob, headers: { "Content-Type": "image/webp" },
1003
+ method: "PUT", body: variant.blob, headers: { "Content-Type": variant.blob.type },
1004
1004
  });
1005
1005
  if (!response.ok)
1006
1006
  throw new Error(`Copertina non caricata (${response.status}). Riprova.`);
@@ -1015,10 +1015,24 @@ async function makeHeroVariant(file) {
1015
1015
  const bitmap = await createImageBitmap(file, { imageOrientation: "from-image" });
1016
1016
  try {
1017
1017
  const size = fit(bitmap.width, bitmap.height, 2560);
1018
- return {
1019
- blob: await drawImageBlob(bitmap, size.width, size.height, .82),
1020
- width: size.width, height: size.height,
1021
- };
1018
+ const canvas = document.createElement("canvas");
1019
+ canvas.width = size.width;
1020
+ canvas.height = size.height;
1021
+ const context = canvas.getContext("2d");
1022
+ if (!context)
1023
+ throw new Error("Impossibile preparare la copertina.");
1024
+ context.drawImage(bitmap, 0, 0, size.width, size.height);
1025
+ const encode = (type) => new Promise(resolve => canvas.toBlob(resolve, type, .82));
1026
+ // Safari can return a PNG when asked for WebP. Preserve alpha for transparent sources.
1027
+ let blob = await encode("image/webp");
1028
+ if (blob?.type !== "image/webp") {
1029
+ const fallback = /\.jpe?g$/i.test(file.name) ? "image/jpeg" : "image/png";
1030
+ if (blob?.type !== fallback)
1031
+ blob = await encode(fallback);
1032
+ if (blob?.type !== fallback)
1033
+ throw new Error("Impossibile preparare la copertina.");
1034
+ }
1035
+ return { blob, ...size };
1022
1036
  }
1023
1037
  finally {
1024
1038
  bitmap.close();
@@ -412,6 +412,7 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
412
412
  const selectCovers = (event) => {
413
413
  const input = event.currentTarget;
414
414
  const files = Array.from(input.files || []);
415
+ input.value = "";
415
416
  if (!files.length)
416
417
  return;
417
418
  if (files.length > 8 || files.some(file => !/\.(jpe?g|png|webp)$/i.test(file.name))) {
@@ -420,7 +421,7 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
420
421
  }
421
422
  setCoverFiles(files);
422
423
  setFailure(null);
423
- input.value = "";
424
+ setAdvanced(false);
424
425
  };
425
426
  /* ---- azioni di servizio ------------------------------------------------------------ */
426
427
  const run = async (payload, done) => {
@@ -475,9 +476,6 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
475
476
  const state = delivery ? transferState(delivery) : null;
476
477
  const expiry = draft.duration === "keep"
477
478
  ? delivery?.filesExpiresAt || null : expiryFrom(draft.duration);
478
- const filesExpired = !!expiry && Date.parse(expiry) < Date.now();
479
- const archived = delivery?.status === "archived";
480
- const previewFileCount = filesExpired ? 0 : selection.length + packages.reduce((sum, pkg) => sum + (pkg.state === "ready" && (!archived || pkg.webEnabled) ? pkg.fileCount : 0), 0);
481
479
  const accessEdited = !!link && (draft.pin !== (link.pin || "") || draft.duration !== clean.duration);
482
480
  const sharingPaused = accessEdited || saving;
483
481
  const shareMessage = delivery && link ? messageFor(delivery, link) : "";
@@ -492,31 +490,30 @@ export function DeliveryWorkspace({ delivery: fromServer, defaultHeroes = emptyC
492
490
  setSaving(false);
493
491
  }
494
492
  }, children: "Accorcia link" }))] }), accessEdited && _jsx("p", { className: "dl-link-stats", role: "status", children: "Salva le modifiche di accesso o scadenza prima di condividere." }), _jsx("p", { className: "dl-link-stats", children: linkStory(link) }), _jsx("div", { ref: setActivityTarget, className: "dl-link-email" }), link.pin && (_jsxs("p", { className: "dl-link-stats", children: ["Codice di accesso ", _jsx("strong", { children: link.pin }), " \u00B7 Incluso nel messaggio."] }))] })) : null;
495
- 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: "Apri pagina pubblica" })), link && (_jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva" }))] })] }), (failure || notice) && (_jsxs("p", { role: failure ? "alert" : "status", 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 dl-compose-grid" + (advanced ? " is-expanded" : ""), children: [_jsxs("div", { className: "dl-main", children: [ready && sharingCard, _jsxs("div", { className: "dl-compose-card", children: [_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 caricamento." })] }), _jsxs("div", { className: "dl-pick", children: [_jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(false), children: [_jsx(FileIcon, {}), "Aggiungi file"] }), _jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(true), children: [_jsx(FolderIcon, {}), "Aggiungi una cartella"] }), _jsx("div", { ref: fileInputs, hidden: true })] }), _jsx(DropArea, { disabled: uploading, resuming: !!resumeRef.current, onFiles: addFiles, onError: (error) => setFailure(errorText(error)) }), !!selection.length && _jsxs("div", { className: "dl-selection", "aria-live": "polite", children: [_jsx("strong", { children: selection.length === 1 ? deliveryRelativeName(selection[0]) : selection.length + " file selezionati" }), _jsx("span", { children: formatBytes(selection.reduce((sum, file) => sum + file.size, 0)) }), _jsx("button", { type: "button", className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => {
493
+ return (_jsxs("div", { className: "dl-work dl-transfer-canvas", children: [_jsx("input", { ref: coverRef, "data-transfer-cover-input": true, type: "file", accept: "image/jpeg,image/png,image/webp", multiple: true, hidden: true, onChange: selectCovers }), _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: delivery ? draft.title.trim() || 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: "Apri pagina pubblica" })), link && (_jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva" }))] })] }), (failure || notice) && (_jsxs("p", { role: failure ? "alert" : "status", 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 dl-compose-grid" + (advanced ? " is-expanded" : ""), children: [_jsxs("div", { className: "dl-main", children: [ready && sharingCard, _jsxs("div", { className: "dl-compose-card", children: [_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 caricamento." })] }), _jsxs("div", { className: "dl-pick", children: [_jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(false), children: [_jsx(FileIcon, {}), "Aggiungi file"] }), _jsxs("button", { className: "dl-pick-tile", disabled: uploading, onClick: () => choose(true), children: [_jsx(FolderIcon, {}), "Aggiungi una cartella"] }), _jsx("div", { ref: fileInputs, hidden: true })] }), _jsx(DropArea, { disabled: uploading, resuming: !!resumeRef.current, onFiles: addFiles, onError: (error) => setFailure(errorText(error)) }), !!selection.length && _jsxs("div", { className: "dl-selection", "aria-live": "polite", children: [_jsx("strong", { children: selection.length === 1 ? deliveryRelativeName(selection[0]) : selection.length + " file selezionati" }), _jsx("span", { children: formatBytes(selection.reduce((sum, file) => sum + file.size, 0)) }), _jsx("button", { type: "button", className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => {
496
494
  setSelection([]);
497
495
  fileInputs.current?.replaceChildren();
498
496
  }, children: "Svuota selezione" }), selection.length > 1 && _jsxs("details", { className: "dl-selected-list", children: [_jsx("summary", { children: "Mostra file" }), _jsx("ul", { children: selection.slice(0, filesShown).map((file, index) => _jsxs("li", { children: [_jsx("span", { children: deliveryRelativeName(file) }), _jsx("button", { className: "ak-btn", type: "button", disabled: uploading, "aria-label": `Rimuovi ${deliveryRelativeName(file)}`, onClick: () => setSelection(files => files.filter((_, i) => i !== index)), children: "\u00D7" })] }, index)) }), filesShown < selection.length && _jsx("button", { className: "ak-btn", type: "button", onClick: () => setFilesShown(count => count + 50), children: "Mostra altri file" })] })] }), job && isBusy(job) && _jsx(Progress, { job: job }), !!packages.length && (_jsx("ul", { className: "dl-files", children: packages.map((pkg) => (_jsxs("li", { className: "dl-file is-" + pkg.state + (confirmPackage === pkg.id ? " is-confirming" : ""), children: [_jsx("span", { className: "dl-file-icon", "aria-hidden": "true", children: pkg.state === "ready" ? "✓" : "…" }), _jsx(PackageContents, { pkg: pkg, confirming: confirmPackage === pkg.id, job: job?.id === pkg.id ? job : undefined, onAction: onAction }), confirmPackage === pkg.id ? (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [_jsx("button", { className: "ak-btn", onClick: () => setConfirmPackage(null), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", disabled: uploading, onClick: () => {
499
497
  setConfirmPackage(null);
500
498
  void run({ action: "deletePackage", id: delivery?.id, packageId: pkg.id }, "File rimossi");
501
- }, children: "S\u00EC, rimuovi" })] }) })) : (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [pkg.state !== "ready" && !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn", disabled: uploading, onClick: () => { resumeRef.current = pkg; setSelection([]); setNotice(resumeHint); }, children: "Riprendi" })), !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => setConfirmPackage(pkg.id), children: "Rimuovi" }))] }) }))] }, pkg.id))) }))] }), _jsxs("form", { ref: quickFields, className: "dl-card dl-about dl-quick-fields", onSubmit: event => { event.preventDefault(); void beginUpload(selection, resumeRef.current); }, children: [_jsx(DeliveryEmail, { id: delivery?.id, value: emailPreferences, onChange: setEmailPreferences, busy: saving || uploading, unsaved: dirty, activityTarget: activityTarget, canResend: ready, hydratePreferences: !!fromServer, onState: p => { setEmailPreferences(p); setEmailClean(p); } }), _jsx(Field, { label: "Titolo", children: _jsx("input", { disabled: uploading || saving, value: draft.title, placeholder: selection.length ? deliverySelectionName(selection) : "Titolo del transfer", onChange: (e) => change({ title: e.target.value }) }) }), _jsx(Field, { label: "Messaggio", wide: true, children: _jsx("textarea", { disabled: uploading || saving, rows: 3, value: draft.description, onChange: (e) => change({ description: e.target.value }) }) }), _jsxs("div", { className: "dl-compose-actions", children: [_jsx("button", { ref: toggleRef, type: "button", className: "ak-btn dl-options-toggle", "aria-label": "Opzioni del transfer", title: "Opzioni del transfer", "aria-expanded": advanced, "aria-controls": "dl-options", onClick: () => setAdvanced(open => !open), children: "\u2022\u2022\u2022" }), _jsx("button", { className: "ak-btn ak-btn-primary", type: "submit", disabled: !selection.length || uploading || saving || busy, children: preparing ? "Caricamento in corso…" : resumeRef.current ? "Riprendi caricamento" : "Trasferisci" })] })] })] }), !ready && sharingCard, !link && delivery && !uploading && (_jsx("button", { className: "ak-btn", disabled: saving || busy, onClick: () => void save(), children: "Ottieni il link" }))] }), _jsxs("div", { className: "dl-compose-companion", children: [_jsx(DeliveryRecipientPreview, { title: draft.title.trim() || (selection.length ? deliverySelectionName(selection) : delivery?.title) || "Titolo del transfer", clientName: draft.clientName.trim(), message: draft.description, covers: previewCovers, locked: !!draft.pin, fileCount: previewFileCount, downloadLabel: archived ? draft.downloadWebLabel || "Scarica versione leggera" : draft.downloadOriginalsLabel || (previewFileCount === 1 ? "Scarica il file" : "Scarica tutti i file"), expiryLabel: expiry ? `${filesExpired ? "File scaduti il" : "Scaricabili fino al"} ${formatDate(expiry)}` : "", notice: filesExpired ? "I file di questa consegna sono scaduti." : archived ? "Gli originali sono stati archiviati." : "", finalLabel: draft.ctaEnabled && draft.ctaUrl ? draft.ctaLabel || "Lascia una recensione" : "" }), _jsxs("aside", { className: "dl-side", id: "dl-options", "aria-label": "Opzioni del transfer", hidden: !advanced, children: [_jsxs("div", { className: "dl-options-head", children: [_jsx("h3", { tabIndex: -1, ref: optionsTitle, children: "Opzioni del transfer" }), _jsx("button", { type: "button", className: "ak-btn", "aria-label": "Chiudi opzioni", onClick: () => { setAdvanced(false); toggleRef.current?.focus(); }, children: "\u00D7" })] }), _jsxs("fieldset", { className: "dl-option-fields", disabled: uploading || saving, children: [_jsxs(Group, { title: "Opzioni di consegna", note: packages.length
502
- ? "Le opzioni dei file caricati sono bloccate. Per cambiarle, rimuovi e ricarica i file."
503
- : "Puoi cambiare queste opzioni prima di premere Trasferisci.", 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, webFormat: jpegEnabled ? draft.webFormat : "webp" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("small", { children: "Chi scarica pu\u00F2 scegliere foto pi\u00F9 leggere 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%", "."] })] }))] }), _jsx(Group, { title: "Cliente", children: _jsx(Field, { label: "Destinatario", hint: "Nome del cliente o dell\u2019azienda. Facoltativo.", children: _jsx("input", { value: draft.clientName, placeholder: "Es. Azienda Rossi", onChange: (e) => change({ clientName: e.target.value }) }) }) }), _jsxs(Group, { title: "Chi pu\u00F2 aprirlo", children: [_jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !draft.pin, onChange: () => change({ pin: "" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiunque abbia il link" }), _jsx("small", { children: "Chi riceve il link pu\u00F2 aprire il transfer e condividerlo." })] })] }), _jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !!draft.pin, onChange: () => change({ pin: draft.pin || makeCode() }) }), _jsxs("span", { children: [_jsx("strong", { children: "Link e codice di accesso" }), _jsx("small", { children: "Condividi il codice con il destinatario. Dopo 10 tentativi errati, l\u2019accesso \u00E8 sospeso per un\u2019ora." })] })] }), !!draft.pin && (_jsxs("div", { className: "dl-code", children: [_jsx("input", { "aria-label": "Codice di accesso", value: draft.pin, spellCheck: false, onChange: (e) => change({ pin: e.target.value.toUpperCase() }) }), _jsx("button", { className: "ak-btn", onClick: () => change({ pin: makeCode() }), children: "Rigenera" })] }))] }), downloadLabelsEnabled && (_jsxs(Group, { title: "Testi dei pulsanti di download", note: "Lascia vuoto per usare il testo predefinito. Puoi cambiarli anche dopo l\u2019invio, senza ricaricare i file.", children: [delivery?.status !== "archived" && (_jsx(Field, { label: "Pulsante degli originali", children: _jsx("input", { value: draft.downloadOriginalsLabel, maxLength: 80, placeholder: "Scarica i file", onChange: (e) => change({ downloadOriginalsLabel: e.target.value }) }) })), (packages.length ? packages.some(pkg => pkg.webEnabled) : draft.light) && (_jsx(Field, { label: "Pulsante della versione leggera", children: _jsx("input", { value: draft.downloadWebLabel, maxLength: 80, placeholder: "Versione leggera", onChange: (e) => change({ downloadWebLabel: e.target.value }) }) }))] })), _jsxs(Group, { title: "Scadenza", children: [_jsxs("select", { "aria-label": "Scadenza", className: "dl-select", value: draft.duration, onChange: (e) => change({ duration: e.target.value }), children: [delivery && _jsx("option", { value: "keep", children: delivery.filesExpiresAt
504
- ? `Fino al ${formatDate(delivery.filesExpiresAt)}`
505
- : "Per sempre" }), _jsx("option", { value: "7", children: "7 giorni" }), _jsx("option", { value: "30", children: "30 giorni" }), _jsx("option", { value: "60", children: "60 giorni" }), _jsx("option", { value: "180", children: "6 mesi" }), _jsx("option", { value: "365", children: "1 anno" }), _jsx("option", { value: "forever", children: "Per sempre" })] }), _jsx("p", { className: "dl-note", children: expiry
506
- ? `Dopo il ${formatDate(expiry)} il link continua ad aprirsi, ma i file non si scaricano più.`
507
- : "I file restano finché non li togli tu." })] }), _jsxs(Group, { title: "Alla fine della pagina", children: [_jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.ctaEnabled, onChange: (e) => change({ ctaEnabled: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiedi una recensione" }), _jsx("small", { children: "Un pulsante in fondo, dopo le fotografie." })] })] }), draft.ctaEnabled && (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Testo del pulsante", children: _jsx("input", { value: draft.ctaLabel, onChange: (e) => change({ ctaLabel: e.target.value }) }) }), _jsx(Field, { label: "Indirizzo", hint: "Il link alla tua pagina delle recensioni.", children: _jsx("input", { type: "url", value: draft.ctaUrl, placeholder: "https://\u2026", onChange: (e) => change({ ctaUrl: e.target.value }) }) })] })), _jsx(Field, { label: "Note d'uso", hint: "Cosa pu\u00F2 farci il cliente. Appaiono in fondo alla pagina.", children: _jsx("textarea", { rows: 3, value: draft.licenseNotes, onChange: (e) => change({ licenseNotes: e.target.value }) }) })] }), _jsxs("details", { className: "dl-unavailable", children: [_jsx("summary", { children: "Funzioni aggiuntive non attive" }), _jsxs("div", { children: [" ", _jsxs(Group, { title: "Richiedi pagamento", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-payment-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Sblocca gallery e download al saldo" }), _jsx("small", { id: "dl-payment-description", children: "Potrai impostare l\u2019importo da incassare per questa consegna. Il cliente pagher\u00E0 una sola volta per sbloccare la galleria e scaricare i file." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: il transfer non richiede pagamenti e segue le impostazioni di accesso qui sopra." })] }), _jsxs(Group, { title: "Selezione del cliente", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-selection-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Consenti al cliente di scegliere le foto" }), _jsx("small", { id: "dl-selection-description", children: "Il cliente potr\u00E0 indicare nella galleria quali foto entrano nella sua selezione." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: al momento il cliente pu\u00F2 consultare la galleria, se abilitata, ma non salvare una selezione." })] })] })] }), _jsxs("section", { className: "dl-card dl-cover", children: [_jsxs("div", { className: "dl-cover-head", children: [_jsxs("div", { children: [_jsx("span", { className: "dl-step", children: "Copertina" }), _jsxs("p", { children: ["Fino a otto sfondi per la pagina del destinatario.", " ", coverFiles.length ? coverFiles.map(file => file.name).join(", ") : heroes.length
508
- ? `Ne hai scelte ${heroes.length}.`
509
- : "Nessuna scelta: si userà quella predefinita."] }), _jsx("p", { role: "status", children: !delivery ? "Puoi scegliere uno sfondo per questo transfer prima di inviarlo." : heroesDirty || coverFiles.length > 0
510
- ? "Scelta non ancora salvata: premi Salva modifiche per mostrarla al cliente."
511
- : heroes.length
512
- ? "Copertine salvate. Una sola immagine resta fissa; più immagini compongono la sequenza."
513
- : "Scegli le copertine qui: la galleria sotto nella pagina del cliente è separata." })] }), _jsxs("div", { className: "dl-cover-actions", children: [!!photos.length && (_jsx("button", { className: "ak-btn", onClick: () => setPreviewAttempt(value => value + 1), title: "Riprova a caricare le miniature senza cambiare le copertine selezionate", children: "Ricarica anteprime" })), delivery && _jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva modifiche" }), _jsx("button", { className: "ak-btn", disabled: saving || uploading, onClick: () => { if (coverRef.current)
514
- coverRef.current.value = ""; coverRef.current?.click(); }, children: "Carica un'immagine" }), (!!heroes.length || !!coverFiles.length) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: saving, onClick: () => { setHeroes([]); setCoverFiles([]); }, children: "Usa quella predefinita" })), _jsx("input", { ref: coverRef, type: "file", accept: "image/jpeg,image/png,image/webp", multiple: true, hidden: true, onChange: selectCovers })] })] }), packages.some(pkg => (moreImages[pkg.id] ? moreImages[pkg.id].nextCursor : pkg.nextCursor) != null) && (_jsx("button", { className: "ak-btn", disabled: loadingImages, onClick: () => void loadMoreImages(), children: loadingImages ? "Caricamento…" : "Mostra altre foto" })), photos.length ? (_jsx("div", { className: "dl-cover-grid", children: photos.map(({ pkg, image }) => {
515
- const chosen = heroes.some((item) => item.type === "package" && item.packageId === pkg.id && item.index === image.index);
516
- return (_jsxs("button", { type: "button", className: chosen ? "is-chosen" : "", disabled: saving, "aria-pressed": chosen, onClick: () => toggleCover(pkg.id, image.index, image.previewUrl), children: [_jsx("img", { src: previewAttempt ? `${image.previewUrl}&previewRetry=${previewAttempt}` : image.previewUrl, alt: image.name, width: image.width, height: image.height, loading: "lazy" }), chosen && _jsx("em", { "aria-hidden": "true", children: "\u2713" })] }, `${pkg.id}-${image.index}`));
517
- }) })) : ready ? (_jsx("p", { className: "dl-note dl-cover-empty", children: heroes.some((item) => item.type === "object")
518
- ? `${heroes.length} immagini caricate a mano.`
519
- : "Questo transfer non ha anteprime da cui scegliere: carica un'immagine, oppure resta quella predefinita." })) : null] }), !!delivery && (_jsxs("section", { className: "dl-danger", children: [_jsxs("div", { children: [_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void duplicate(), children: "Usa come modello" }), delivery.status === "active" && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void run({ action: "archive", id: delivery.id }, "Originali tolti: recuperabili per sette giorni"), children: "Libera spazio: togli gli originali" }))] }), confirmDelete ? (_jsxs("div", { className: "dl-confirm", children: [_jsxs("p", { children: ["Elimino ", _jsx("strong", { children: delivery.title }), photos.length ? ` (${countPhotos(packages)} file, ${formatBytes(delivery.storedBytes)})` : "", "? Il link smette subito di funzionare. La rimozione dei file e degli upload residui viene completata in background. Non si torna indietro."] }), _jsx("button", { className: "ak-btn", onClick: () => setConfirmDelete(false), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", onClick: () => void remove(), children: "S\u00EC, elimina" })] })) : (_jsx("button", { className: "ak-btn ak-btn-quiet", onClick: () => setConfirmDelete(true), children: "Elimina il transfer" }))] }))] })] })] })] })] }));
499
+ }, children: "S\u00EC, rimuovi" })] }) })) : (_jsx(_Fragment, { children: _jsxs("span", { className: "dl-file-actions", children: [pkg.state !== "ready" && !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn", disabled: uploading, onClick: () => { resumeRef.current = pkg; setSelection([]); setNotice(resumeHint); }, children: "Riprendi" })), !(job?.id === pkg.id && isBusy(job)) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: uploading, onClick: () => setConfirmPackage(pkg.id), children: "Rimuovi" }))] }) }))] }, pkg.id))) }))] }), _jsxs("form", { ref: quickFields, className: "dl-card dl-about dl-quick-fields", onSubmit: event => { event.preventDefault(); void beginUpload(selection, resumeRef.current); }, children: [_jsx(DeliveryEmail, { id: delivery?.id, value: emailPreferences, onChange: setEmailPreferences, busy: saving || uploading, unsaved: dirty, activityTarget: activityTarget, canResend: ready, hydratePreferences: !!fromServer, onState: p => { setEmailPreferences(p); setEmailClean(p); } }), _jsx(Field, { label: "Titolo", children: _jsx("input", { disabled: uploading || saving, value: draft.title, placeholder: selection.length ? deliverySelectionName(selection) : "Titolo del transfer", onChange: (e) => change({ title: e.target.value }) }) }), _jsx(Field, { label: "Messaggio", wide: true, children: _jsx("textarea", { disabled: uploading || saving, rows: 3, value: draft.description, onChange: (e) => change({ description: e.target.value }) }) }), _jsxs("div", { className: "dl-compose-actions", children: [_jsx("button", { ref: toggleRef, type: "button", className: "ak-btn dl-options-toggle", "aria-label": "Opzioni del transfer", title: "Opzioni del transfer", "aria-expanded": advanced, "aria-controls": "dl-options", onClick: () => setAdvanced(open => !open), children: "\u2022\u2022\u2022" }), _jsx("button", { className: "ak-btn ak-btn-primary", type: "submit", disabled: !selection.length || uploading || saving || busy, children: preparing ? "Caricamento in corso…" : resumeRef.current ? "Riprendi caricamento" : "Trasferisci" })] })] })] }), !ready && sharingCard, !link && delivery && !uploading && (_jsx("button", { className: "ak-btn", disabled: saving || busy, onClick: () => void save(), children: "Ottieni il link" }))] }), _jsx(DeliveryRecipientPreview, { title: draft.title.trim() || (selection.length ? deliverySelectionName(selection) : delivery?.title) || "", clientName: draft.clientName.trim(), message: draft.description, covers: previewCovers, disabled: saving || uploading || preparing, onChoose: () => coverRef.current?.click() }), _jsxs("aside", { className: "dl-side", id: "dl-options", "aria-label": "Opzioni del transfer", hidden: !advanced, children: [_jsxs("div", { className: "dl-options-head", children: [_jsx("h3", { tabIndex: -1, ref: optionsTitle, children: "Opzioni del transfer" }), _jsx("button", { type: "button", className: "ak-btn", "aria-label": "Chiudi opzioni", onClick: () => { setAdvanced(false); toggleRef.current?.focus(); }, children: "\u00D7" })] }), _jsxs("fieldset", { className: "dl-option-fields", disabled: uploading || saving, children: [_jsxs(Group, { title: "Opzioni di consegna", note: packages.length
500
+ ? "Le opzioni dei file caricati sono bloccate. Per cambiarle, rimuovi e ricarica i file."
501
+ : "Puoi cambiare queste opzioni prima di premere Trasferisci.", 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, webFormat: jpegEnabled ? draft.webFormat : "webp" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Aggiungi conversione in bassa risoluzione" }), _jsx("small", { children: "Chi scarica pu\u00F2 scegliere foto pi\u00F9 leggere 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%", "."] })] }))] }), _jsx(Group, { title: "Cliente", children: _jsx(Field, { label: "Destinatario", hint: "Nome del cliente o dell\u2019azienda. Facoltativo.", children: _jsx("input", { value: draft.clientName, placeholder: "Es. Azienda Rossi", onChange: (e) => change({ clientName: e.target.value }) }) }) }), _jsxs(Group, { title: "Chi pu\u00F2 aprirlo", children: [_jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !draft.pin, onChange: () => change({ pin: "" }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiunque abbia il link" }), _jsx("small", { children: "Chi riceve il link pu\u00F2 aprire il transfer e condividerlo." })] })] }), _jsxs("label", { className: "dl-radio", children: [_jsx("input", { type: "radio", name: "dl-access", checked: !!draft.pin, onChange: () => change({ pin: draft.pin || makeCode() }) }), _jsxs("span", { children: [_jsx("strong", { children: "Link e codice di accesso" }), _jsx("small", { children: "Condividi il codice con il destinatario. Dopo 10 tentativi errati, l\u2019accesso \u00E8 sospeso per un\u2019ora." })] })] }), !!draft.pin && (_jsxs("div", { className: "dl-code", children: [_jsx("input", { "aria-label": "Codice di accesso", value: draft.pin, spellCheck: false, onChange: (e) => change({ pin: e.target.value.toUpperCase() }) }), _jsx("button", { className: "ak-btn", onClick: () => change({ pin: makeCode() }), children: "Rigenera" })] }))] }), downloadLabelsEnabled && (_jsxs(Group, { title: "Testi dei pulsanti di download", note: "Lascia vuoto per usare il testo predefinito. Puoi cambiarli anche dopo l\u2019invio, senza ricaricare i file.", children: [delivery?.status !== "archived" && (_jsx(Field, { label: "Pulsante degli originali", children: _jsx("input", { value: draft.downloadOriginalsLabel, maxLength: 80, placeholder: "Scarica i file", onChange: (e) => change({ downloadOriginalsLabel: e.target.value }) }) })), (packages.length ? packages.some(pkg => pkg.webEnabled) : draft.light) && (_jsx(Field, { label: "Pulsante della versione leggera", children: _jsx("input", { value: draft.downloadWebLabel, maxLength: 80, placeholder: "Versione leggera", onChange: (e) => change({ downloadWebLabel: e.target.value }) }) }))] })), _jsxs(Group, { title: "Scadenza", children: [_jsxs("select", { "aria-label": "Scadenza", className: "dl-select", value: draft.duration, onChange: (e) => change({ duration: e.target.value }), children: [delivery && _jsx("option", { value: "keep", children: delivery.filesExpiresAt
502
+ ? `Fino al ${formatDate(delivery.filesExpiresAt)}`
503
+ : "Per sempre" }), _jsx("option", { value: "7", children: "7 giorni" }), _jsx("option", { value: "30", children: "30 giorni" }), _jsx("option", { value: "60", children: "60 giorni" }), _jsx("option", { value: "180", children: "6 mesi" }), _jsx("option", { value: "365", children: "1 anno" }), _jsx("option", { value: "forever", children: "Per sempre" })] }), _jsx("p", { className: "dl-note", children: expiry
504
+ ? `Dopo il ${formatDate(expiry)} il link continua ad aprirsi, ma i file non si scaricano più.`
505
+ : "I file restano finché non li togli tu." })] }), _jsxs(Group, { title: "Alla fine della pagina", children: [_jsxs("label", { className: "dl-check", children: [_jsx("input", { type: "checkbox", checked: draft.ctaEnabled, onChange: (e) => change({ ctaEnabled: e.target.checked }) }), _jsxs("span", { children: [_jsx("strong", { children: "Chiedi una recensione" }), _jsx("small", { children: "Un pulsante in fondo, dopo le fotografie." })] })] }), draft.ctaEnabled && (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Testo del pulsante", children: _jsx("input", { value: draft.ctaLabel, onChange: (e) => change({ ctaLabel: e.target.value }) }) }), _jsx(Field, { label: "Indirizzo", hint: "Il link alla tua pagina delle recensioni.", children: _jsx("input", { type: "url", value: draft.ctaUrl, placeholder: "https://\u2026", onChange: (e) => change({ ctaUrl: e.target.value }) }) })] })), _jsx(Field, { label: "Note d'uso", hint: "Cosa pu\u00F2 farci il cliente. Appaiono in fondo alla pagina.", children: _jsx("textarea", { rows: 3, value: draft.licenseNotes, onChange: (e) => change({ licenseNotes: e.target.value }) }) })] }), _jsxs("details", { className: "dl-unavailable", children: [_jsx("summary", { children: "Funzioni aggiuntive non attive" }), _jsxs("div", { children: [" ", _jsxs(Group, { title: "Richiedi pagamento", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-payment-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Sblocca gallery e download al saldo" }), _jsx("small", { id: "dl-payment-description", children: "Potrai impostare l\u2019importo da incassare per questa consegna. Il cliente pagher\u00E0 una sola volta per sbloccare la galleria e scaricare i file." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: il transfer non richiede pagamenti e segue le impostazioni di accesso qui sopra." })] }), _jsxs(Group, { title: "Selezione del cliente", children: [_jsx("span", { className: "dl-payment-status", children: "Chiedi di attivare la funzione" }), _jsxs("label", { className: "dl-check dl-payment-disabled", children: [_jsx("input", { type: "checkbox", checked: false, disabled: true, "aria-describedby": "dl-selection-description" }), _jsxs("span", { children: [_jsx("strong", { children: "Consenti al cliente di scegliere le foto" }), _jsx("small", { id: "dl-selection-description", children: "Il cliente potr\u00E0 indicare nella galleria quali foto entrano nella sua selezione." })] })] }), _jsx("p", { className: "dl-note", children: "Questa opzione non \u00E8 ancora disponibile: al momento il cliente pu\u00F2 consultare la galleria, se abilitata, ma non salvare una selezione." })] })] })] }), _jsxs("section", { className: "dl-card dl-cover", children: [_jsxs("div", { className: "dl-cover-head", children: [_jsxs("div", { children: [_jsx("span", { className: "dl-step", children: "Copertina" }), _jsxs("p", { children: ["Fino a otto sfondi per la pagina del destinatario.", " ", coverFiles.length ? coverFiles.map(file => file.name).join(", ") : heroes.length
506
+ ? `Ne hai scelte ${heroes.length}.`
507
+ : "Nessuna scelta: si userà quella predefinita."] }), _jsx("p", { role: "status", children: !delivery ? "Puoi scegliere uno sfondo per questo transfer prima di inviarlo." : heroesDirty || coverFiles.length > 0
508
+ ? "Scelta non ancora salvata: premi Salva modifiche per mostrarla al cliente."
509
+ : heroes.length
510
+ ? "Copertine salvate. Una sola immagine resta fissa; più immagini compongono la sequenza."
511
+ : "Scegli le copertine qui: la galleria sotto nella pagina del cliente è separata." })] }), _jsxs("div", { className: "dl-cover-actions", children: [!!photos.length && (_jsx("button", { className: "ak-btn", onClick: () => setPreviewAttempt(value => value + 1), title: "Riprova a caricare le miniature senza cambiare le copertine selezionate", children: "Ricarica anteprime" })), delivery && _jsx("button", { className: "ak-btn ak-btn-primary", disabled: !dirty || saving || busy || uploading, onClick: () => void save(), children: saving ? "Salvo…" : "Salva modifiche" }), _jsx("button", { className: "ak-btn", disabled: saving || uploading, onClick: () => coverRef.current?.click(), children: "Carica un'immagine" }), (!!heroes.length || !!coverFiles.length) && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: saving, onClick: () => { setHeroes([]); setCoverFiles([]); }, children: "Usa quella predefinita" }))] })] }), packages.some(pkg => (moreImages[pkg.id] ? moreImages[pkg.id].nextCursor : pkg.nextCursor) != null) && (_jsx("button", { className: "ak-btn", disabled: loadingImages, onClick: () => void loadMoreImages(), children: loadingImages ? "Caricamento…" : "Mostra altre foto" })), photos.length ? (_jsx("div", { className: "dl-cover-grid", children: photos.map(({ pkg, image }) => {
512
+ const chosen = heroes.some((item) => item.type === "package" && item.packageId === pkg.id && item.index === image.index);
513
+ return (_jsxs("button", { type: "button", className: chosen ? "is-chosen" : "", disabled: saving, "aria-pressed": chosen, onClick: () => toggleCover(pkg.id, image.index, image.previewUrl), children: [_jsx("img", { src: previewAttempt ? `${image.previewUrl}&previewRetry=${previewAttempt}` : image.previewUrl, alt: image.name, width: image.width, height: image.height, loading: "lazy" }), chosen && _jsx("em", { "aria-hidden": "true", children: "\u2713" })] }, `${pkg.id}-${image.index}`));
514
+ }) })) : ready ? (_jsx("p", { className: "dl-note dl-cover-empty", children: heroes.some((item) => item.type === "object")
515
+ ? `${heroes.length} immagini caricate a mano.`
516
+ : "Questo transfer non ha anteprime da cui scegliere: carica un'immagine, oppure resta quella predefinita." })) : null] }), !!delivery && (_jsxs("section", { className: "dl-danger", children: [_jsxs("div", { children: [_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void duplicate(), children: "Usa come modello" }), delivery.status === "active" && (_jsx("button", { className: "ak-btn ak-btn-quiet", disabled: busy, onClick: () => void run({ action: "archive", id: delivery.id }, "Originali tolti: recuperabili per sette giorni"), children: "Libera spazio: togli gli originali" }))] }), confirmDelete ? (_jsxs("div", { className: "dl-confirm", children: [_jsxs("p", { children: ["Elimino ", _jsx("strong", { children: delivery.title }), photos.length ? ` (${countPhotos(packages)} file, ${formatBytes(delivery.storedBytes)})` : "", "? Il link smette subito di funzionare. La rimozione dei file e degli upload residui viene completata in background. Non si torna indietro."] }), _jsx("button", { className: "ak-btn", onClick: () => setConfirmDelete(false), children: "Annulla" }), _jsx("button", { className: "ak-btn dl-danger-btn", onClick: () => void remove(), children: "S\u00EC, elimina" })] })) : (_jsx("button", { className: "ak-btn ak-btn-quiet", onClick: () => setConfirmDelete(true), children: "Elimina il transfer" }))] }))] })] })] })] }));
520
517
  }
521
518
  /* ============================================================================================
522
519
  Impostazioni
@@ -3,12 +3,8 @@ interface Props {
3
3
  clientName: string;
4
4
  message: string;
5
5
  covers: (string | File)[];
6
- locked: boolean;
7
- fileCount: number;
8
- downloadLabel: string;
9
- expiryLabel: string;
10
- notice: string;
11
- finalLabel: string;
6
+ onChoose: () => void;
7
+ disabled: boolean;
12
8
  }
13
9
  export declare function DeliveryRecipientPreview(props: Props): import("react").JSX.Element;
14
10
  export {};
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
3
  // Keep file previews local to the editor, including covers awaiting their first save.
4
4
  function usePreviewCovers(sources) {
5
5
  const [images, setImages] = useState([]);
@@ -29,21 +29,28 @@ function usePreviewCovers(sources) {
29
29
  return images.filter((image) => image !== null);
30
30
  }
31
31
  export function DeliveryRecipientPreview(props) {
32
- const [phone, setPhone] = useState(() => window.matchMedia("(max-width: 760px)").matches);
32
+ const figure = useRef(null);
33
+ const [pairPortraits, setPairPortraits] = useState(false);
33
34
  const [page, setPage] = useState(0);
34
- const [showUnlocked, setShowUnlocked] = useState(false);
35
- const locked = props.locked && !showUnlocked;
36
- useEffect(() => { setShowUnlocked(false); }, [props.locked]);
37
35
  const covers = usePreviewCovers(props.covers);
38
- useEffect(() => { setPage(0); }, [phone, props.covers]);
36
+ useEffect(() => {
37
+ const canvas = figure.current?.closest(".dl-transfer-canvas");
38
+ if (!canvas)
39
+ return;
40
+ const observer = new ResizeObserver(([entry]) => setPairPortraits(entry.contentRect.width > 688));
41
+ observer.observe(canvas);
42
+ return () => observer.disconnect();
43
+ }, []);
44
+ useEffect(() => { setPage(0); }, [pairPortraits, props.covers]);
39
45
  const groups = [];
40
46
  for (let i = 0; i < covers.length; i++) {
41
47
  const group = [covers[i]];
42
- if (!phone && covers[i].portrait && covers[i + 1]?.portrait)
48
+ if (pairPortraits && covers[i].portrait && covers[i + 1]?.portrait)
43
49
  group.push(covers[++i]);
44
50
  groups.push(group);
45
51
  }
46
52
  const current = Math.min(page, Math.max(0, groups.length - 1));
47
- const group = locked ? [] : groups[current] ?? [];
48
- return _jsxs("section", { className: "dl-recipient", "aria-label": "Anteprima destinatario", children: [_jsxs("header", { className: "dl-recipient-tools", children: [_jsx("h3", { children: "Anteprima destinatario" }), _jsxs("div", { className: "dl-preview-devices", role: "group", "aria-label": "Formato anteprima", children: [_jsx("button", { type: "button", "aria-pressed": !phone, onClick: () => setPhone(false), children: "Desktop" }), _jsx("button", { type: "button", "aria-pressed": phone, onClick: () => setPhone(true), children: "Mobile" })] })] }), _jsx("div", { className: "dl-preview-surround", children: _jsx("div", { className: "dl-preview-page" + (phone ? " is-phone" : "") + (group.length ? " with-covers" : ""), children: _jsxs("div", { className: "dl-preview-sheet", children: [_jsx("span", { className: "dl-preview-menu", "aria-hidden": "true", children: "menu" }), _jsxs("div", { className: "dl-preview-info", children: [_jsx("span", { className: "dl-preview-kicker", children: "Consegna file" }), _jsx("strong", { className: "dl-preview-title", children: props.clientName || props.title }), props.clientName && _jsx("span", { className: "dl-preview-work", children: props.title }), locked ? _jsxs("div", { className: "dl-preview-gate", children: [_jsx("span", { children: "Codice di accesso" }), _jsxs("div", { children: [_jsx("span", { className: "dl-preview-code", "aria-hidden": "true", children: "\u2022\u2022\u2022\u2022" }), _jsx("button", { type: "button", className: "dl-preview-button", "aria-label": "Simula lo sblocco nell\u2019anteprima", onClick: () => setShowUnlocked(true), children: "Entra" })] })] }) : _jsxs(_Fragment, { children: [props.message && _jsx("p", { className: "dl-preview-message", children: props.message }), props.notice && _jsx("p", { children: props.notice }), props.fileCount > 0 && _jsxs("div", { className: "dl-preview-download", children: [_jsxs("small", { children: [props.fileCount, " file \u00B7 ZIP"] }), _jsx("span", { className: "dl-preview-button", children: props.downloadLabel })] })] }), props.expiryLabel && _jsx("small", { className: "dl-preview-expiry", children: props.expiryLabel }), !locked && props.finalLabel && _jsx("span", { className: "dl-preview-final", children: props.finalLabel })] }), group.length > 0 && _jsx("div", { className: "dl-preview-stage", children: group.map((cover, i) => _jsx("img", { src: cover.src, alt: "" }, i)) })] }) }) }), props.locked && showUnlocked && _jsx("button", { className: "ak-btn dl-preview-relock", type: "button", onClick: () => setShowUnlocked(false), children: "Rivedi la richiesta del codice" }), !locked && groups.length > 1 && _jsxs("div", { className: "dl-preview-pager", role: "group", "aria-label": "Sequenza delle copertine", children: [_jsx("button", { type: "button", "aria-label": "Vista precedente", onClick: () => setPage((current + groups.length - 1) % groups.length), children: "\u2039" }), _jsxs("span", { "aria-live": "polite", children: [current + 1, " / ", groups.length] }), _jsx("button", { type: "button", "aria-label": "Vista successiva", onClick: () => setPage((current + 1) % groups.length), children: "\u203A" })] })] });
53
+ const group = groups[current] ?? [];
54
+ const chooseLabel = group.length ? "Cambia copertina" : "Scegli una copertina";
55
+ return _jsxs("figure", { className: "dl-artwork", ref: figure, "aria-label": "Copertina del transfer", children: [group.length > 0 && _jsx("div", { className: "dl-artwork-images", children: group.map(cover => _jsx("img", { src: cover.src, alt: "" }, cover.src)) }), _jsxs("figcaption", { children: [(props.clientName || props.title) && _jsxs("div", { className: "dl-artwork-title", children: [_jsx("strong", { children: props.clientName || props.title }), props.clientName && props.title && _jsx("span", { children: props.title })] }), props.message && _jsx("p", { children: props.message })] }), _jsxs("div", { className: "dl-artwork-tools", children: [_jsx("button", { type: "button", disabled: props.disabled, onClick: props.onChoose, children: chooseLabel }), groups.length > 1 && _jsxs("div", { role: "group", "aria-label": "Sequenza delle copertine", children: [_jsx("button", { type: "button", "aria-label": "Vista precedente", onClick: () => setPage((current + groups.length - 1) % groups.length), children: "\u2039" }), _jsxs("span", { "aria-live": "polite", children: [current + 1, " / ", groups.length] }), _jsx("button", { type: "button", "aria-label": "Vista successiva", onClick: () => setPage((current + 1) % groups.length), children: "\u203A" })] })] })] });
49
56
  }
@@ -0,0 +1,15 @@
1
+ // Covers created by earlier clients always have a WebP key.
2
+ export function heroExtension(contentType = "image/webp") {
3
+ switch (contentType) {
4
+ case "image/webp": return "webp";
5
+ case "image/jpeg": return "jpg";
6
+ case "image/png": return "png";
7
+ default: throw Object.assign(new Error("Scegli una copertina JPEG, PNG o WebP."), { status: 400, retryable: false });
8
+ }
9
+ }
10
+
11
+ export function heroContentType(key) {
12
+ if (key.endsWith(".png")) return "image/png";
13
+ if (key.endsWith(".jpg")) return "image/jpeg";
14
+ return "image/webp";
15
+ }
@@ -1,3 +1,4 @@
1
+ import { heroContentType } from "../../_shared/delivery-hero-format.js";
1
2
  /* Derivata hero dedicata: oggetto piccolo B2, mai l'originale fotografico. */
2
3
  import { b2Get } from "../../_shared/b2.js";
3
4
 
@@ -11,7 +12,7 @@ export async function onRequestGet({ request, env }) {
11
12
  const upstream = await b2Get(env, hero.object_key);
12
13
  if (!upstream.ok) return new Response("Not found", { status: upstream.status });
13
14
  const headers = new Headers({
14
- "Content-Type": "image/webp",
15
+ "Content-Type": heroContentType(hero.object_key),
15
16
  "Cache-Control": "private, max-age=3600",
16
17
  "X-Content-Type-Options": "nosniff",
17
18
  });
@@ -1,3 +1,4 @@
1
+ import { heroExtension } from "../../_shared/delivery-hero-format.js";
1
2
  import { requestDiagnostics, technicalDiagnostic } from "../../_shared/diagnostics.js";
2
3
  import packageInfo from "../../../../package.json" with { type: "json" };
3
4
  /* Controllo multipart Backblaze B2.
@@ -75,7 +76,7 @@ async function heroPresign(env, body) {
75
76
  if (!pkg) throw invalid("pacchetto per la hero non trovato o scaduto");
76
77
  assertUploadSessionInvocation(env, pkg);
77
78
  const heroId = crypto.randomUUID();
78
- const key = b2ObjectKey(pkg.storage_prefix, `heroes/${heroId}.webp`);
79
+ const key = b2ObjectKey(pkg.storage_prefix, `heroes/${heroId}.${heroExtension(body.contentType)}`);
79
80
  const now = new Date().toISOString();
80
81
  await env.DB.prepare(`
81
82
  INSERT INTO delivery_hero_objects
@@ -1,3 +1,4 @@
1
+ import { heroContentType } from "../_shared/delivery-hero-format.js";
1
2
  import { bundleIdentity, bundleResponse, downloadSources } from "../_shared/delivery-download-bundle.js";
2
3
  import {processDeliveryEmails} from "../_shared/delivery-email.js";
3
4
  /* Consegna pubblica: /c/<token>.
@@ -528,7 +529,7 @@ async function hero(env, access, id) {
528
529
  const upstream = await b2Get(env, selected.objectKey);
529
530
  if (!upstream.ok) return new Response("Not found", { status: upstream.status });
530
531
  const headers = new Headers({
531
- "Content-Type": "image/webp",
532
+ "Content-Type": heroContentType(selected.objectKey),
532
533
  "Cache-Control": "private, max-age=86400",
533
534
  "X-Content-Type-Options": "nosniff",
534
535
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardinali-studio/adminkit",
3
- "version": "2.2.51",
3
+ "version": "2.2.53",
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",