PageSourceSearch

https://account.ilmessaggero.it/assets/SavedNews-CABUIWrF.js

js ilmessaggero.it collected 2026-09-24 08:33:27 UTC 3,205 bytes, 1 lines download raw bytes

1import{r as e,k as a,E as s,a as t,b as r,c as i,H as n,j as o,L as l,o as d,q as c,N as u,t as v}from"./index-r-KClxtY.js";import{Grid as p}from"./Grid-DKkSbsMs.js";const m=()=>{const[t,r]=e.useState([]),[i,n]=e.useState(""),[o,l]=e.useState(!0);return e.useEffect((()=>{(async()=>{var e;try{const s=await a("/api/user/saved-items/full",null,!0);if(200===(null==s?void 0:s.status)){const a=null==(e=null==s?void 0:s.data)?void 0:e.data;return Array.isArray(a)?a:[]}return[]}catch(t){const e=s(t,1,1);return n(e),[]}finally{l(!1)}})().then(r)}),[]),{savedNews:t,isLoading:o,status:i,setSavedNews:r}},N=(e,a=4)=>{const s=e.trim().split(/\s+/).filter(Boolean);return s.length<=a?e:"".concat(s.slice(0,a).join(" "),"...")},w=({article:a,onUnsave:s})=>{var p;const{addNotice:m}=t(),{domain:w}=r(),h=(null==(p=i[w])?void 0:p.id)||0,[j,f]=e.useState(!1),x=h?"https://statics.cedscdn.it/utils/img/loghi/".concat(h,"/nofoto.png"):"/images/nofoto.png",g=a.urlImmagine||x,S=N(n(a.titolo||"Articolo Salvato")),y=N(n(a.sottotitolo||""),6),C=(e=>{if(!e)return"";const a=e.replace(" ","T");return d(a)||e})(a.creazione),b=!!a.url;return o.jsxs("div",{className:"SavedNewsCard-wrapper grid-card",role:b?"link":void 0,tabIndex:b?0:void 0,onClick:b?()=>{window.open(a.url,"_blank","noopener,noreferrer")}:void 0,onKeyDown:e=>{!b||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),window.open(a.url,"_blank","noopener,noreferrer"))},children:[j&&o.jsx(l,{}),o.jsx("div",{className:"SavedNewsCard-image",style:{backgroundImage:"url(".concat(g,")")}}),o.jsxs("div",{className:"SavedNewsCard-details",children:[C&&o.jsx("p",{className:"SavedNewsCard-date",children:C}),o.jsx("h5",{className:"SavedNewsCard-title",children:S}),o.jsx("p",{className:"SavedNewsCard-subtitle",children:y}),a.descrizione&&o.jsx("p",{className:"SavedNewsCard-description",children:n(a.descrizione)})]}),o.jsx("button",{type:"button",className:"SavedNewsCard-unsaveButton","aria-label":"Rimuovi notizia salvata",onClick:e=>{e.stopPropagation(),f(!0),c("/api/user/saved-items/".concat(encodeURIComponent(a.articolo))).then((()=>{"function"==typeof s&&s(a.articolo)})).catch((e=>{var a,s,t;console.error(e),m({title:(null==(t=null==(s=null==(a=null==e?void 0:e.response)?void 0:a.data)?void 0:s.status)?void 0:t.message)||v.notices.generic_error,type:u.error,timeout:5e3})})).finally((()=>{f(!1)}))},disabled:j,children:o.jsx("span",{className:"icon icon-save-fill","aria-hidden":"true"})})]})},h=()=>{const{addNotice:a}=t(),{savedNews:s,isLoading:r,status:i,setSavedNews:n}=m();e.useEffect((()=>{i&&a({title:i,type:u.error,timeout:3e3})}),[a,i]);const d=e=>{n((a=>a.filter((a=>a.articolo!==e))))};return o.jsxs("div",{className:"SavedNewsComp-wrapper",children:[r&&o.jsx(l,{}),!r&&s.length>0&&o.jsx(p,{cols:3,className:"SavedNews-results",children:s.map((e=>o.jsx(w,{article:e,onUnsave:d},e.articolo)))}),!r&&0===s.length&&o.jsx("p",{children:"Nessuna notizia salvata."})]})},j=()=>{const e=v.user;return o.jsxs("div",{className:"SavedNews-wrapper route-wrapper",children:[o.jsx("h2",{className:"page-title",children:e.titles.saved_news}),o.jsx("p",{children:"Scorri le notizie salvate e leggi i tuoi articoli"}),o.jsx(h,{})]})};export{j as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.