PageSourceSearch

https://aryk.fr/build/assets/OurOffers-DVC6O5t2.js

js aryk.fr collected 2026-10-08 18:33:23 UTC 7,869 bytes, 1 lines download raw bytes

1import{u as B,r as a,j as e}from"./app-D7bY3VIr.js";import{u as O}from"./useTranslation-tvhqZ2qh.js";function G({initialTab:d="web"}){const{t:i,locale:_}=O(),{auth:x}=B().props,[g,h]=a.useState(d),[p,E]=a.useState([]),[F,b]=a.useState(!0),[c,f]=a.useState(!1),[j,m]=a.useState(null),[y,o]=a.useState(null),[D,n]=a.useState(!1),[N,v]=a.useState(null),[u,w]=a.useState(""),[M,q]=a.useState({web:[],games:[],vps:[]});a.useEffect(()=>{h(d)},[d]),a.useEffect(()=>{(async()=>{try{b(!0);const r=(await window.axios.get("/api/pricing",{params:{locale:_}})).data,S={};r.categories.forEach(C=>{const I=(C.plans||[]).map(t=>{const T=parseFloat(t.original_total_price??t.total_price)||0,L=parseFloat(t.current_total_price??t.total_price)||0;return{id:t.id,planId:t.plan_id,name:t.name,description:t.description||"",originalPrice:parseFloat(t.base_price),currentPrice:parseFloat(t.current_price),discount:t.discount||0,popular:t.popular||!1,features:t.features||[],totalMonths:t.total_months,totalPrice:L||T,originalTotalPrice:T}});S[C.slug]=I}),q(S),E(r.categories)}catch(l){console.error("Erreur lors du chargement des tarifs:",l)}finally{b(!1)}})()},[]);const $=p.length>0?p.map(s=>({id:s.slug,label:s.name||s.slug})):[{id:"web",label:i("common.offers.tabs.web")},{id:"games",label:i("common.offers.tabs.games")},{id:"vps",label:i("common.offers.tabs.vps")}],k=M[g]??[],z=async s=>{if(o(null),m(null),v(s),!x.user){n(!0);return}await P(s)},P=async(s,l=null)=>{try{f(!0),o(null);const r=await window.axios.post("/api/tickets/create",{plan_id:s,email:l||x.user?.email});r.data.success?(m({message:r.data.message||"Ticket créé avec succès sur Discord. Ticket Tool va créer le channel automatiquement."}),n(!1)):o(r.data.message||"Une erreur est survenue.")}catch(r){console.error("Erreur lors de la création du ticket:",r),r.response?.data?.requires_email?n(!0):o(r.response?.data?.message||"Impossible de créer le ticket Discord. Veuillez réessayer plus tard.")}finally{f(!1)}},A=s=>{s.preventDefault(),u&&N&&P(N,u)};return F?e.jsx("div",{className:"bg-indigo-50",children:e.jsxs("div",{className:"container mx-auto p-6 py-12",children:[e.jsx("h2",{className:"text-4xl font-bold text-center mb-8",children:i("common.offers.title")}),e.jsx("div",{className:"flex justify-center items-center py-12",children:e.jsx("div",{className:"text-gray-600",children:"Chargement..."})})]})}):e.jsx("div",{className:"bg-indigo-50",children:e.jsxs("div",{className:"container mx-auto p-6 py-12",children:[e.jsx("h2",{className:"text-4xl font-bold text-center mb-8",children:i("common.offers.title")}),j&&e.jsx("div",{className:"max-w-7xl mx-auto mb-6 p-4 bg-green-100 border border-green-400 text-green-700 rounded-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:j.message}),e.jsx("p",{className:"mt-2 text-sm text-green-600",children:"Le ticket sera créé automatiquement par Ticket Tool sur votre serveur Discord."})]}),e.jsx("button",{onClick:()=>m(null),className:"text-green-700 hover:text-green-900",children:"✕"})]})}),y&&e.jsx("div",{className:"max-w-7xl mx-auto mb-6 p-4 bg-red-100 border border-red-400 text-red-700 rounded-lg",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{children:y}),e.jsx("button",{onClick:()=>o(null),className:"text-red-700 hover:text-red-900",children:"✕"})]})}),D&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full mx-4",children:[e.jsx("h3",{className:"text-xl font-bold mb-4",children:"Créer un ticket Discord"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Veuillez entrer votre adresse email pour créer un ticket sur notre serveur Discord."}),e.jsxs("form",{onSubmit:A,children:[e.jsx("input",{type:"email",value:u,onChange:s=>w(s.target.value),placeholder:"[email protected]",required:!0,className:"w-full px-4 py-2 border border-gray-300 rounded-lg mb-4 focus:outline-none focus:ring-2 focus:ring-indigo-500"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",disabled:c,
1className:"flex-1 bg-indigo-600 text-white py-2 px-4 rounded-lg hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed",children:c?"Création...":"Créer le ticket"}),e.jsx("button",{type:"button",onClick:()=>{n(!1),w(""),v(null)},className:"px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50",children:"Annuler"})]})]})]})}),e.jsx("div",{className:"flex justify-center mb-8 border-b border-gray-200",children:e.jsx("div",{className:"flex gap-4",children:$.map(s=>e.jsx("button",{onClick:()=>{h(s.id);const l=new URL(window.location);l.searchParams.set("tab",s.id),window.history.pushState({},"",l)},className:`px-6 py-3 font-medium transition-colors ${g===s.id?"text-indigo-600 border-b-2 border-indigo-600":"text-gray-600 hover:text-gray-900"}`,children:s.label},s.id))})}),k.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-7xl mx-auto",children:k.map(s=>e.jsxs("div",{className:`bg-white rounded-lg shadow-lg p-6 relative ${s.popular?"ring-2 ring-indigo-500":""}`,children:[s.popular&&e.jsx("div",{className:"absolute -top-4 left-1/2 transform -translate-x-1/2",children:e.jsx("span",{className:"bg-indigo-500 text-white px-4 py-1 rounded-full text-sm font-bold uppercase whitespace-nowrap",children:i("common.offers.most_popular")})}),s.discount>0&&e.jsx("div",{className:"absolute top-4 right-4",children:e.jsxs("span",{className:"bg-red-500 text-white px-3 py-1 rounded-full text-sm font-bold",children:["-",s.discount,"%"]})}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-2xl font-bold mb-2",children:s.name}),e.jsx("p",{className:"text-gray-600 text-sm mb-4",children:s.description}),e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex items-baseline gap-2",children:[s.discount>0&&e.jsxs("span",{className:"text-gray-400 line-through text-lg",children:[s.originalPrice.toFixed(2)," €"]}),e.jsxs("span",{className:"text-3xl font-bold",children:[s.currentPrice.toFixed(2)," €"]}),e.jsx("span",{className:"text-gray-600",children:"/mois"})]})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsx("button",{className:"w-full bg-purple-100 text-purple-700 py-2 rounded-lg font-medium text-sm",children:i("common.offers.limited_offer")}),e.jsx("button",{onClick:()=>z(s.id),disabled:c,className:`w-full py-2 rounded-lg font-medium disabled:opacity-50 disabled:cursor-not-allowed ${s.popular?"bg-gray-800 text-white hover:bg-gray-900":"bg-white border-2 border-gray-800 text-gray-800 hover:bg-gray-50"}`,children:c?"Création du ticket...":i("common.offers.select")})]}),e.jsxs("p",{className:"text-xs text-gray-600 mb-4",children:[s.totalMonths," mois • ",s.totalPrice.toFixed(2)," € total",s.discount>0&&Number.isFinite(s.originalTotalPrice)&&s.originalTotalPrice>0&&` (au lieu de ${s.originalTotalPrice.toFixed(2)} €)`]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-semibold mb-3",children:s.popular?i("common.offers.all_features"):i("common.offers.premium_features")}),e.jsx("ul",{className:"space-y-2",children:s.features.map((l,r)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-xl",children:l.icon||"✓"}),e.jsx("span",{className:"text-gray-700",children:l.text||l})]},r))})]})]})]},s.id))}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-gray-600",children:"Aucun plan disponible pour cette catégorie."})}),e.jsx("div",{className:"flex justify-center mt-8",children:e.jsx("button",{className:"bg-indigo-500 text-white px-4 py-2 rounded-lg font-medium text-sm",children:i("common.offers.view_all")})})]})})}export{G 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.