1import{r as e,j as s,t as a,B as t,R as n,I as i,J as r,a as o,u as l,C as c,e as d,N as m,v as p,b as u,h as b,g as h,o as x,K as j,y as v,n as g,M as _,q as S,m as w,p as f,A as k,l as N}from"./index-r-KClxtY.js";import{P as y}from"./Popup-CflKBRd8.js";/* empty css */import{I as C}from"./ItemCard-BVeSgVy6.js";/* empty css */import{F as P}from"./Faq-IKrRPNMT.js";/* empty css */import{S as A}from"./SlaveForm-DHMoGTOm.js";import{B as R}from"./BannerCdp-BW7qItCs.js";import{A as z}from"./ActivateSubscriptionCard-ChLeEtdS.js";import{D as F}from"./DevicesList-CgTx_pbr.js";import"./SpoilerCard-BPSzUAeY.js";import"./Grid-DKkSbsMs.js";import"./BannerCta-DUfs0O4K.js";import"./Paginator-Bi6ARBma.js";import"./Toast-DuPXoAKZ.js";const T=({closePopup:i,showNextStep:r,kAbbonamento:o})=>{const[l,c]=e.useState(!1);return e.useEffect((()=>{r(!l)}),[l]),s.jsxs("div",{className:"PopupStepOne-wrapper unset-chat",children:[s.jsx("h4",{children:l?a.user.subscriptions.unset_renew_title_recall:a.user.subscriptions.unset_renew_title}),!l&&s.jsx(t,{className:"button-ccare",label:a.user.subscriptions.unset_renew_recall,onClick:()=>c(!0),trackingId:"open_recall_form_".concat(o),popupId:"manage_renew"}),l&&s.jsx(n,{closePopup:i,kAbbonamento:o})]})},I=({kAbbonamento:e})=>s.jsxs("div",{className:"PopupStepTwo-wrapper unset-chat",children:[s.jsx("h4",{children:a.user.subscriptions.unset_renew_title}),s.jsx(t,{className:"button-ccare",label:"Chiama il numero 0662289716",onClick:()=>{window.open("tel:+390662289716","_blank")},trackingId:"call_customer_care_".concat(e),popupId:"manage_renew"})]}),O=({kAbbonamento:n,close:o})=>{const l=i(),{showRenewChat:c,openTawkChat:d}=r(),[m,p]=e.useState(1),[u,b]=e.useState(!0);return s.jsx(y,{className:"UnsetRenew-popup",closePopup:o,children:s.jsxs("div",{className:"unset-options ".concat(u?"with-next-step":""),children:[1==m&&s.jsx(T,{closePopup:o,showNextStep:b,kAbbonamento:n}),2==m&&s.jsx(I,{chatAvailable:l,onOpenTawk:()=>{o(),d()},kAbbonamento:n}),u&&s.jsx("div",{className:"unset-online",children:s.jsx(t,{label:1==m?a.user.subscriptions.unset_renew_online:a.user.subscriptions.unset_renew_continue_online,onClick:()=>{1!=m?2==m&&(c({subscriptionId:n}),o()):p(2)},trackingId:1==m?"manage_renew_".concat(n):"open_unset_renew_widget_".concat(n),popupId:"manage_renew"},m)})]})})},D=({kAbbonamento:n,close:i})=>{const{addNotice:r}=o();let p=l();const[u,b]=e.useState(!1);return s.jsxs(s.Fragment,{children:[u&&s.jsx(c,{}),s.jsxs(y,{className:"SetRenew-popup",closePopup:i,children:[s.jsx("h4",{children:a.user.subscriptions.set_renew_title}),s.jsx(t,{label:a.user.subscriptions.set_renew,color:"warning",onClick:()=>{b(!0),d("/api/user/abbonamento/renew/set/".concat(n),{}).then((e=>{const s=null==e?void 0:e.data;!1===(null==s?void 0:s.success)?r({title:a.notices.unset_renew_error,type:m.error,timeout:5e3}):(p.revalidate(),i())})).catch((e=>{r({title:a.notices.unset_renew_error,type:m.error,timeout:5e3}),Promise.reject(e||null)})).finally((()=>{b(!1)}))},trackingId:"activate_renew",popupId:"manage_renew"})]})]})};function G(n){const[i,r]=e.useState(!1),[o,l]=e.useState(!1),[c,d]=e.useState(!1),m=a.user.subscriptions,_=a.common,S=n.data,{device:w}=p(),f={year:"numeric",month:"2-digit",day:"2-digit"},{testata:k}=u();b();const{companySubscribed:N}=h();let C=!1;const P=new Date,A=new Date(P.getFullYear(),P.getMonth(),P.getDate()),R=new Date(S.dataRinnovo),z=new Date(S.dataInizio),F=new Date(z.getFullYear(),z.getMonth(),z.getDate()),T=Math.abs(R.getTime()-P.getTime());Math.ceil(T/864e5)<10&&(C=!0);const I=S.kUserAbbonato&&S.kUserCliente&&S.kUserAbbonato!==S.kUserCliente;e.useEffect((()=>{const e=0===Number(S.nRinnovi)&&!N&&!I&&"OMAGGI"!==S.kTipoPagamento&&!Number.isNaN(z.getTime())&&F.getTime()<=A.getTime()&&A.getTime()-F.getTime()<=12096e5;d(e)}),[N]);const G=["ITUNES","GOOPLA","GOOPAY"].includes(String(S.kTipoPagamento||"").toUpperCase()),L=x(S.dataInizio,f)||S.dataInizio,E=m.withdrawal_issue.replace("$$0","".concat(S.numeroOrdine)),M=m.withdrawal_message.replace("$$0","".concat(S.abbonamentoDescrizioneProdotto," | ").concat(j(S.kTestataProdotto))).replace("$$1","".concat(S.numeroOrdine)).replace("$$2","".concat(L)),U="/recesso?".concat(new
1URLSearchParams({topic:"withdrawal",issue:E,message:M,forceForm:"true"}).toString());return s.jsxs(s.Fragment,{children:[i&&1==S.flagRicorrente&&s.jsx(O,{close:()=>r(!1),kAbbonamento:S.kAbbonamento}),i&&(0==S.flagRicorrente||2==S.flagRicorrente)&&s.jsx(D,{close:()=>r(!1),kAbbonamento:S.kAbbonamento}),o&&s.jsxs(y,{className:"StoreWithdrawal-popup",closePopup:l,children:[s.jsx("h4",{children:m.withdrawal_store_popup_title}),s.jsx("p",{children:m.withdrawal_store_popup_message})]}),S&&-1==["S","P"].indexOf(S.kStato)&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"SubscriptionCard-wrapper Grid-card ".concat(n.style||""," ").concat(S.kAbbonamento," stato-").concat(S.kStato),children:s.jsxs("div",{className:"SubscriptionCard-details",children:[S.abbonamentoDescrizioneProdotto&&s.jsx("div",{className:"SubscriptionCard-title",children:S.abbonamentoDescrizioneProdotto}),s.jsxs("div",{className:"SubscriptionCard-renew",children:[s.jsxs("div",{className:"SubscriptionCard-renew-details",children:[(1==S.flagRicorrente||2==S.flagRicorrente)&&s.jsxs("span",{children:["Prossimo rinnovo il ",x(S.dataFine,f),1==S.flagVincolo&&s.jsxs("span",{children:[s.jsx("br",{}),s.jsx("br",{}),"Termine vincolo contrattuale il ",x(S.dataFineVincolo,f)]}),2==S.flagRicorrente&&s.jsxs("span",{className:"SubscriptionCard-alert",children:[s.jsx("br",{}),"Rinnovo automatico disattivo. L'abbonamento termina alla scadenza contrattuale il ",x(S.dataFineVincolo,f)]})]}),1==S.flagGestioneRinnovoAutomatico&&s.jsxs("div",{className:"manage-renew",children:[1==S.flagRicorrente&&s.jsx(t,{className:"title uppercase unset-renew plain-btn",label:-1!==["lap","desk"].indexOf(w)?m.unset_renew:m.unset_renew_short,onClick:()=>{r(!0)},trackingId:"start_manage_renew_deactivate"}),(0==S.flagRicorrente||2==S.flagRicorrente)&&s.jsx(t,{className:"title uppercase set-renew plain-btn",onClick:()=>{r(!0)},label:-1!==["lap","desk"].indexOf(w)?m.set_renew_long:m.set_renew_short,trackingId:"start_manage_renew_activate"})]}),0==S.flagRicorrente&&s.jsxs("span",{children:["Scade il ",x(S.dataFine,f)]}),s.jsx("br",{})]}),c&&s.jsx(v,{className:"SubscriptionCard-withdraw-btn",url:U,label:_.forms.options.withdrawal,onClick:G?()=>l(!0):void 0})]}),s.jsx("br",{}),!I&&s.jsxs("div",{className:"payment-details",children:[s.jsxs("div",{className:"next-payment payment-detail",children:[s.jsx("h5",{className:"title uppercase",children:1==S.flagRicorrente||2==S.flagRicorrente?m.next_payment:m.expire_date}),0==S.flagRicorrente&&s.jsxs("span",{children:[s.jsx("strong",{children:m.desubscribed})," ",S.dataRinnovo&&s.jsxs("div",{children:[m.ends_on," ",x(S.dataFine,f)]})]}),(1==S.flagRicorrente||2==S.flagRicorrente)&&null!==S.importoProssimoRinnovo&&null!==S.prezzoPieno&&s.jsxs("strong",{children:[S.importoProssimoRinnovo!==S.prezzoPieno?s.jsxs("span",{children:[s.jsxs("span",{className:"currentPrice",children:[S.importoProssimoRinnovo," â¬"]})," ",s.jsxs("span",{className:"fullPrice",children:["anzichè ",S.prezzoPieno," â¬"]})]}):s.jsxs("span",{children:[S.importoProssimoRinnovo,"â¬"]}),null!==S.dataRinnovo&&s.jsxs("span",{className:"toPayOn",children:[" ",m.to_pay_on," ",x(S.dataRinnovo,f)]})]})]}),s.jsxs("div",{className:"payment-method payment-detail",children:[s.jsx("h5",{className:"title uppercase",children:m.payment_method_default}),s.jsx("strong",{children:S.tipiPagamentoDescrizione}),C&&s.jsx("span",{className:"alert",children:"In scadenza"})]}),s.jsx("div",{className:"change-payment-method payment-detail",children:s.jsx(g,{className:"title uppercase",to:"/user/payments/methods",children:-1!==["lap","desk"].indexOf(w)?m.payment_method_change:m.payment_method_change_short})})]})]})})}),S&&-1!==["S","P"].indexOf(S.kStato)&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"SubscriptionCard-wrapper Grid-card ".concat(n.style||""," ").concat(S.kAbbonamento," stato-").concat(S.kStato),children:s.jsxs("div",{className:"SubscriptionCard-details",children:[s.jsx("span",{className:"Subscription-status",children:_.subscription_expired}),S.abbonamentoDescrizioneProdotto&&s.jsx("div",{className:"SubscriptionCard-title",children:S.abbonamentoDescrizioneProdotto}),s.jsx("br",{}),s.jsxs("span",{children:[s.jsx("strong",{children:"Abbonamento attivo dal:"})," ",x(S.dataInizio,f)," ",s.jsx("strong",{children:"al: "})," ",x(S.dataFine,f),s.jsx("br",{})]}),c&&s.jsx(v,{className:"SubscriptionCard-withdraw-btn",url:U,label:_.forms.options.withdrawal,onClick:G?()=>l(!0):void 0}),"S"==S.kStato&&s.jsx(v,{className:"SubscriptionCard-subscribe-btn",url:"".concat("https://shop.placeholder.it".replace("placeholder",k),"/vetrina"),label:a.user.subscriptions.subscribe_again})]})})})]})}const L=n=>{const i=n.data,{addNotice:r}=o();let p=l();const u=a.user.subscriptions,b=a.common,[h,j]=e.useState(""),[v,g]=e.useState(!1),w={year:"numeric",month:"2-digit",day:"2-digit"};e.useEffect((()=>{j(_(i.kStato))}
1),[i.kStato]);return s.jsx(s.Fragment,{children:i&&s.jsxs("div",{className:"SlaveCard-wrapper Grid-card ".concat(null!==i.dataAttivazione?"active":""," kAbbonamento-").concat(i.kAbbonamento," kSlave-").concat(i.kSlave),children:[v&&s.jsx(c,{}),s.jsxs("div",{className:"SlaveCard-details",children:[s.jsxs("div",{className:"SlaveCard-title",children:[s.jsx("i",{className:"icon icon-testata ".concat(null==i?void 0:i.testata)}),s.jsxs("span",{children:[" ",null==i?void 0:i.prodotto]})]}),s.jsxs("div",{className:"SlaveCard-user",children:[s.jsx(s.Fragment,{children:-1!==["A"].indexOf(i.kStato)&&i.email&&i.email.length>1?i.email:""}),s.jsx(s.Fragment,{children:-1!==["M"].indexOf(i.kStato)&&i.email&&i.email.length>1?i.email:""}),s.jsx(s.Fragment,{children:-1!==["N"].indexOf(i.kStato)?u.order_to_pay:""})]}),s.jsx("div",{className:"SlaveCard-status ".concat(_(i.kStato).toLowerCase()),children:h}),-1!==["S"].indexOf(i.kStato)&&(null==i?void 0:i.dataScadenza)&&s.jsxs("div",{className:"SlaveCard-expire",children:[b.expired_on," ",x(i.dataScadenza,w)]}),-1!==["A"].indexOf(i.kStato)&&(null==i?void 0:i.dataScadenza)&&(null==i?void 0:i.dataAttivazione)&&s.jsxs("div",{className:"SlaveCard-expire",children:[b.validity,": ",x(i.dataAttivazione,w)," - ",x(i.dataScadenza,w)]}),-1!==["P"].indexOf(i.kStato)&&(null==i?void 0:i.dataScadenza)&&(null==i?void 0:i.dataAttivazione)&&s.jsxs("div",{className:"SlaveCard-expire",children:[b.validity,": ",x(i.dataAttivazione,w)," - ",x(i.dataScadenza,w)]})]}),-1!==["D"].indexOf(i.kStato)&&s.jsx(A,{kAbbonamento:i.kAbbonamento}),-1!==["M"].indexOf(i.kStato)&&s.jsx("div",{className:"SlaveCard-btns send-mail",children:s.jsx(t,{onClick:()=>{g(!0),d("api/user/orders/slaves/subscriptions/".concat(i.kAbbonamento),{email:i.email,nomeDestinatario:i.email}).then((e=>{r({title:a.user.subscriptions.invite_sent,type:m.success,timeout:5e3})})).catch((e=>{})).finally((()=>{g(!1)}))},label:b.resend_code})}),-1!==["A"].indexOf(i.kStato)&&s.jsx("div",{className:"SlaveCard-btns remove-slave",children:"family"==n.slaveType&&s.jsx(t,{onClick:()=>{g(!0),S("api/user/orders/slaves/subscriptions/".concat(i.kAbbonamento)).then((e=>{const s=null==e?void 0:e.data;!1===(null==s?void 0:s.success)?r({title:a.notices.generic_error,type:m.error,timeout:5e3}):(r({title:a.notices.generic_success,type:m.success,timeout:5e3}),p.revalidate())})).catch((e=>{console.warn(e)})).finally((()=>{g(!1)}))},label:b.remove_user})})]})})},E=()=>{const[t,n]=e.useState(null),[i,r]=e.useState(null),[l,d]=e.useState(null),[m,p]=e.useState(null),[x,j]=e.useState(null),[g,_]=e.useState([]),[S,y]=e.useState([]),[A,T]=e.useState(!1),[I,O]=e.useState(null),[D,E]=e.useState(null),{domain:M,testata:U}=u(),$=a.user.subscriptions,B=w(),{user:q}=b(),{subscribed:H,companySubscribed:V,familySubscribed:Y}=h(),{addNotice:J}=o(),[W,K]=e.useState(null),[Q,X]=e.useState(null);return e.useEffect((()=>{Promise.resolve(B.subscriptions).then(O),Promise.resolve(B.browsers).then((e=>{n(e),d("".concat(e.length," browser"))})),Promise.resolve(B.devices).then((e=>{r(e),p("".concat(e.length," ").concat(1!==e.length?a.common.devices:a.common.device))})),Promise.resolve(B.offers).then(E),Promise.resolve(B.slaves).then(_),Promise.resolve(B.devicesConfig).then(j)}),[B]),e.useEffect((()=>{if(M){const e={description:f($.disconnect_browsers_message,[M]),cta:$.disconnect_browsers};K(e);const s={description:f($.disconnect_devices_message,[M]),cta:$.disconnect_devices};X(s)}}),[M]),e.useEffect((()=>{if(I){const e=null==I?void 0:I.filter((e=>"A"===e.kStato));e&&e.length>0?y(e.sort(((e,s)=>new Date(s.dataFine).getTime()-new Date(e.dataFine).getTime()))):y(I.sort(((e,s)=>new Date(s.dataFine).getTime()-new Date(e.dataFine).getTime())).slice(0,3))}}),[I]),s.jsxs("div",{className:"MySubscriptions-wrapper route-wrapper",children:[s.jsx("h2",{className:"page-title",children:a.user.titles.subscriptions}),s.jsx("div",{className:"page-desc",children:I&&I.length>0?a.user.manage_subscriptions:a.user.no_subscriptions_to_manage}),s.jsx("div",{className:"Subscriptions",children:s.jsx(e.Suspense,{fallback:s.jsx(c,{spinner:!0,labelPrimary:"",labelSecondary:"",minHeight:100}),children:s.jsxs(k,{resolve:B.subscriptions,errorElement:s.jsx(N,{labelPrimary:a.notices.no_data,labelSecondary:"",bgColor:"warning",type:"warning",index:0}),children:[S&&S.length>0&&S.map(((e,a)=>s.jsx(G,{data:e},a))),s.jsx(z,{cta:a.common.forms.send_request_cta,activationCode:B.activationCode})]})})}),q&&H&&s.jsxs(s.Fragment,{children:[s.jsx(C,{routerLink:!0,title:$.all_payments,iconLeft:"icon-list",url:"/user/payments"}),s.jsx(C,{routerLink:!0,title:$.need_billing,iconLeft:"icon-invoice",url:"/user/profile"})]}),D&&D.length>0&&s.jsx(R,{title:$.reserved_promo,texts:{cta:D[0].cta}
1,url:D[0].url,image:D[0][1140255]}),q&&t&&i&&l&&m&&s.jsx(F,{browsers:t,devices:i,browsersCount:l,devicesCount:m,browserBannerTexts:W,devicesBannerTexts:Q}),s.jsx(e.Suspense,{fallback:s.jsx(c,{spinner:!0,labelPrimary:"",labelSecondary:"",minHeight:150}),children:s.jsx(k,{resolve:B.slaves,errorElement:s.jsx(N,{labelPrimary:a.notices.no_data,labelSecondary:"",bgColor:"warning",type:"warning",index:0}),children:(V||Y)&&s.jsxs("div",{className:"CompanyWrapper",children:[V&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"page-title",children:a.user.titles.manage_slaves}),s.jsx("div",{className:"page-desc",children:a.user.manage_slaves_desc}),s.jsx("div",{className:"SlavesCards-wrapper",children:g&&g.length>0&&g.slice(0,4).map(((e,a)=>s.jsx(L,{data:e,slaveIndex:a,slaveType:"company"},"order-".concat(a))))}),g&&g.length>4&&s.jsx(v,{className:"see-all-users",url:"/user/subscriptions/manage",label:a.user.subscriptions.see_all_users})]}),Y&&s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"page-title",children:a.user.titles.manage_slaves_family}),s.jsx("div",{className:"page-desc",children:f(a.user.manage_slaves_family_desc)}),s.jsx("div",{className:"SlavesCards-wrapper",children:g&&g.length>0&&g.map(((e,a)=>"N"==e.kStato?null:s.jsx(L,{data:e,slaveIndex:a,slaveType:"family"},"order-".concat(a))))})]})]})})}),s.jsx(P,{category:"il mio abbonamento",textLength:5})]})};export{E 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.