1import{o as R,x as y,c as u,b as t,n as m,z as o,G as g,F as O,y as j,A as d,L as H,t as r,v as A,I as z,h as M,M as x,r as c,B as L,m as J,s as v}from"./index-DreUROko.js";import{_ as q}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Q={class:"p-3 md:p-6"},X={key:0,class:"text-center py-12 text-gray-400"},Z={key:1,class:"space-y-3 max-w-2xl"},ee={class:"accord"},te={class:"accord-body"},se={class:"space-y-4"},le={class:"label"},ae={class:"flex gap-2"},oe=["onUpdate:modelValue","type","placeholder"],ie=["onClick"],ne=["onClick"],pe={class:"text-xs text-gray-400 mt-1"},de={class:"accord"},re={class:"accord-body"},ue={class:"space-y-4"},ce={class:"flex gap-2"},ve={class:"flex items-center gap-3 cursor-pointer"},me={class:"accord"},_e={class:"accord-body"},be={class:"space-y-4"},ye={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},ge={class:"label"},xe={class:"flex gap-2"},fe=["onUpdate:modelValue","type","placeholder"],ke=["onClick"],Se={class:"text-xs text-gray-400 mt-1"},we={class:"pt-2 flex items-center gap-3"},Ce=["disabled"],Ve={key:0,class:"text-green-600 text-sm font-semibold"},Pe={class:"accord"},Ue={class:"accord-body"},Ae={class:"space-y-4"},Me={class:"border-t border-gray-100 pt-4"},Te={class:"space-y-3"},he={class:"flex gap-2"},ze=["type","placeholder"],Le={class:"border-t border-gray-100 pt-4"},Ie={class:"space-y-3"},Ke={class:"flex gap-2"},$e=["type","placeholder"],Ee={class:"pt-2 flex items-center gap-3"},Oe=["disabled"],je={key:0,class:"text-green-600 text-sm font-semibold"},Fe={class:"accord"},We={class:"accord-body"},Ye={class:"space-y-4"},Be={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},De={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},Ge={class:"flex gap-2"},Ne=["type"],Re={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},He={class:"pt-2 flex items-center gap-3"},Je=["disabled"],qe={key:0,class:"text-green-600 text-sm font-semibold"},Qe={class:"accord"},Xe={class:"accord-body"},Ze={class:"flex gap-2"},et={key:0,class:"bg-green-50 border border-green-200 text-green-700 text-sm px-4 py-3 rounded-xl"},tt={__name:"AdminSettings",setup(st){const i=c({}),I=c(!0),l=L({}),n=L({}),f=c(""),k=c(!1),S=c(!1),w=c(!1),C=c(!1),V=c(!1),P=c(!1),p=L({apikeys:!1,mappa:!1,stripe:!1,paypal:!1,smtp:!1,security:!1});function _(a){p[a]=!p[a]}const U=new Set(["claude_api_key","openai_api_key","gemini_api_key","flux_api_key","jwt_secret","stripe_live_secret_key","stripe_live_webhook_secret","stripe_test_secret_key","stripe_test_webhook_secret","smtp_pass","paypal_sandbox_client_secret","paypal_live_client_secret"]),F=[{k:"claude_api_key",label:"Claude (Anthropic) API Key",hint:"Step 1 â generazione POI, storia e giochi. Ottienila su console.anthropic.com."},{k:"openai_api_key",label:"OpenAI API Key",hint:"Step 5 â mappa cartoon con gpt-image-1. Ottienila su platform.openai.com."},{k:"gemini_api_key",label:"Google Gemini API Key",hint:"Alternativa per testo e immagini. Ottienila su aistudio.google.com."},{k:"google_places_api_key",label:"Google Places / Maps API Key",hint:"Step 4 â mappa Google Maps e autocomplete destinazioni. Ottienila su console.cloud.google.com."},{k:"flux_api_key",label:"Flux (BFL) API Key",hint:"Legacy â Step 5 con flux-pro-1.1 (opzionale). Ottienila su api.bfl.ai."}],T=J({get:()=>i.value.free_mode_enabled==="1",set:a=>{i.value.free_mode_enabled=a?"1":"0"}}),W=[{k:"stripe_test_secret_key",label:"Test Secret Key",hint:"sk_test_⦠â chiave segreta test da dashboard Stripe."},{k:"stripe_test_publishable_key",label:"Test Publishable Key",hint:"pk_test_⦠â chiave pubblica test."},{k:"stripe_test_webhook_secret",label:"Test Webhook Secret",hint:"whsec_⦠â segreto webhook test."},{k:"stripe_live_secret_key",label:"Live Secret Key",hint:"sk_live_⦠â chiave segreta live da dashboard Stripe."},{k:"stripe_live_publishable_key",label:"Live Publishable Key",hint:"pk_live_⦠â chiave pubblica live."},{k:"stripe_live_webhook_secret",label:"Live Webhook Secret",hint:"whsec_⦠â segreto webhook live."}];R(async()=>{const{data:a}=await y.get("/admin/settings");
1i.value=a.data,Object.keys(a.data).forEach(e=>{l[e]=a.data[e]==="***"?"":a.data[e]}),l.paypal_mode||(l.paypal_mode="sandbox"),l.stripe_mode||(l.stripe_mode="test"),I.value=!1});async function h(a){!l[a]&&l[a]!=="0"||(await y.put(`/admin/settings/${a}`,{value:l[a]}),i.value[a]=U.has(a)?"***":l[a],f.value=a,setTimeout(()=>f.value="",3e3))}async function Y(){const a=T.value?"1":"0";l.free_mode_enabled=a,await y.put("/admin/settings/free_mode_enabled",{value:a}),i.value.free_mode_enabled=a}const K=["stripe_mode","stripe_currency","stripe_product_name","app_url","stripe_test_secret_key","stripe_test_publishable_key","stripe_test_webhook_secret","stripe_live_secret_key","stripe_live_publishable_key","stripe_live_webhook_secret"];async function B(){k.value=!0,S.value=!1;try{const a={};for(const e of K)(l[e]||l[e]==="0")&&(a[e]=l[e]);await y.post("/admin/settings/bulk",a);for(const e of K)a[e]!==void 0&&(i.value[e]=U.has(e)?"***":a[e]);S.value=!0,setTimeout(()=>S.value=!1,3e3)}finally{k.value=!1}}const $=["smtp_host","smtp_port","smtp_encryption","smtp_user","smtp_pass","smtp_from_email","smtp_from_name"];async function D(){w.value=!0,C.value=!1;try{const a={};for(const e of $)(l[e]||l[e]==="0")&&(a[e]=l[e]);await y.post("/admin/settings/bulk",a);for(const e of $)a[e]!==void 0&&(i.value[e]=U.has(e)?"***":a[e]);C.value=!0,setTimeout(()=>C.value=!1,3e3)}finally{w.value=!1}}const E=["paypal_mode","paypal_sandbox_client_id","paypal_sandbox_client_secret","paypal_live_client_id","paypal_live_client_secret"];async function G(){V.value=!0,P.value=!1;try{const a={};for(const e of E)(l[e]||l[e]==="0")&&(a[e]=l[e]);await y.post("/admin/settings/bulk",a);for(const e of E)a[e]!==void 0&&(i.value[e]=U.has(e)?"***":a[e]);P.value=!0,setTimeout(()=>P.value=!1,3e3)}finally{V.value=!1}}function N(){const a=new Uint8Array(32);crypto.getRandomValues(a),l.jwt_secret=Array.from(a).map(e=>e.toString(16).padStart(2,"0")).join("")}return(a,e)=>(v(),u("div",Q,[e[68]||(e[68]=t("h1",{class:"text-xl font-bold text-gray-800 mb-6"},"Impostazioni",-1)),I.value?(v(),u("div",X,"Caricamentoâ¦")):(v(),u("div",Z,[t("div",ee,[t("button",{class:"accord-hd",onClick:e[0]||(e[0]=s=>_("apikeys"))},[e[30]||(e[30]=t("span",null,"ð Chiavi API",-1)),t("span",{class:m(["accord-chev",{open:p.apikeys}])},"âº",2)]),o(t("div",te,[t("div",se,[(v(),u(O,null,j(F,s=>t("div",{key:s.k},[t("label",le,r(s.label),1),t("div",ae,[o(t("input",{"onUpdate:modelValue":b=>l[s.k]=b,type:n[s.k]?"text":"password",class:"input flex-1",placeholder:i.value[s.k]==="***"?"(già configurata)":"Inserisci chiaveâ¦"},null,8,oe),[[x,l[s.k]]]),t("button",{onClick:b=>n[s.k]=!n[s.k],class:"btn-secondary px-3 py-2 text-sm"},"ð",8,ie),t("button",{onClick:b=>h(s.k),class:"btn-primary px-3 py-2 text-sm"},"Salva",8,ne)]),t("p",pe,r(s.hint),1)])),64))])],512),[[g,p.apikeys]])]),t("div",de,[t("button",{class:"accord-hd",onClick:e[1]||(e[1]=s=>_("mappa"))},[e[31]||(e[31]=t("span",null,"âï¸ Configurazione mappa",-1)),t("span",{class:m(["accord-chev",{open:p.mappa}])},"âº",2)]),o(t("div",re,[t("div",ue,[t("div",null,[e[32]||(e[32]=t("label",{class:"label"},"Prezzo mappa (centesimi)",-1)),t("div",ce,[o(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>l.map_price_cents=s),type:"number",class:"input w-40"},null,512),[[d,l.map_price_cents]]),t("button",{onClick:e[3]||(e[3]=s=>h("map_price_cents")),class:"btn-primary px-4"},"Salva")]),e[33]||(e[33]=t("p",{class:"text-xs text-gray-400 mt-1"},"Es. 499 = ⬠4,99",-1))]),t("div",null,[t("label",ve,[o(t("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=s=>T.value=s),onChange:Y,class:"w-5 h-5 accent-wonder-gold"},null,544),[[H,T.value]]),e[34]||(e[34]=t("div",null,[t("div",{class:"font-semibold text-gray-700"},"Modalità gratuita"),t("div",{class:"text-xs text-gray-400"},"Bypassa Stripe, tutte le mappe sono gratuite")],-1))])])])],512),[[g,p.mappa]])]),t("div",me,[t("button",{class:"accord-hd",onClick:e[5]||(e[5]=s=>_("stripe"))},[e[35]||(e[35]=t("span",null,"ð³ Stripe",-1)),t("span",{class:m(["text-xs font-semibold px-2 py-0.5 rounded-full mr-2",i.value.stripe_mode==="live"?"bg-green-50 text-green-700 border border-green-200":"bg-blue-50 text-blue-700 border border-blue-200"])},r(i.value.stripe_mode==="live"?"ð¢ Live":"ðµ Test"),3),t("span",{class:m(["accord-chev",{open:p.stripe}])},"âº",2)]),o(t("div",_e,[e[43]||(e[43]=t("p",{class:"text-xs text-gray-400 mb-4"}
1,[A("Webhook da registrare su Stripe: "),t("code",{class:"bg-gray-100 px-1 rounded"},"/api/v1/payment/webhook")],-1)),t("div",be,[t("div",ye,[t("div",null,[e[37]||(e[37]=t("label",{class:"label"},"Modalità ",-1)),o(t("select",{"onUpdate:modelValue":e[6]||(e[6]=s=>l.stripe_mode=s),class:"input w-full"},[...e[36]||(e[36]=[t("option",{value:"test"},"Test (Sandbox)",-1),t("option",{value:"live"},"Live (Produzione)",-1)])],512),[[z,l.stripe_mode]])]),t("div",null,[e[38]||(e[38]=t("label",{class:"label"},"Valuta",-1)),o(t("input",{"onUpdate:modelValue":e[7]||(e[7]=s=>l.stripe_currency=s),type:"text",class:"input w-full",placeholder:"eur"},null,512),[[d,l.stripe_currency]])])]),t("div",null,[e[39]||(e[39]=t("label",{class:"label"},"Nome prodotto (visibile su Stripe)",-1)),o(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>l.stripe_product_name=s),type:"text",class:"input w-full",placeholder:"Mappa WonderMap"},null,512),[[d,l.stripe_product_name]])]),t("div",null,[e[40]||(e[40]=t("label",{class:"label"},"URL app",-1)),o(t("input",{"onUpdate:modelValue":e[9]||(e[9]=s=>l.app_url=s),type:"text",class:"input w-full",placeholder:"https://tuosito.it"},null,512),[[d,l.app_url]]),e[41]||(e[41]=t("p",{class:"text-xs text-gray-400 mt-1"},"Usato per success_url e cancel_url.",-1))]),e[42]||(e[42]=t("hr",{class:"border-gray-100"},null,-1)),(v(),u(O,null,j(W,s=>t("div",{key:s.k},[t("label",ge,r(s.label),1),t("div",xe,[o(t("input",{"onUpdate:modelValue":b=>l[s.k]=b,type:n[s.k]?"text":"password",class:"input flex-1",placeholder:i.value[s.k]==="***"?"(già configurata)":"Inserisciâ¦"},null,8,fe),[[x,l[s.k]]]),t("button",{onClick:b=>n[s.k]=!n[s.k],class:"btn-secondary px-3 py-2 text-sm"},"ð",8,ke)]),t("p",Se,r(s.hint),1)])),64)),t("div",we,[t("button",{onClick:B,disabled:k.value,class:"btn-primary px-6"},r(k.value?"Salvataggioâ¦":"ð¾ Salva impostazioni Stripe"),9,Ce),S.value?(v(),u("span",Ve,"â Salvato")):M("",!0)])])],512),[[g,p.stripe]])]),t("div",Pe,[t("button",{class:"accord-hd",onClick:e[10]||(e[10]=s=>_("paypal"))},[e[44]||(e[44]=t("span",null,"ð
¿ PayPal",-1)),t("span",{class:m(["text-xs font-semibold px-2 py-0.5 rounded-full mr-2",i.value.paypal_mode==="live"?"bg-green-50 text-green-700 border border-green-200":"bg-yellow-50 text-yellow-700 border border-yellow-200"])},r(i.value.paypal_mode==="live"?"ð¢ Live":"ð¡ Sandbox"),3),t("span",{class:m(["accord-chev",{open:p.paypal}])},"âº",2)]),o(t("div",Ue,[e[54]||(e[54]=t("p",{class:"text-xs text-gray-400 mb-4"},[A("Webhook da registrare su PayPal: "),t("code",{class:"bg-gray-100 px-1 rounded"},"/api/v1/payment/paypal/webhook")],-1)),t("div",Ae,[t("div",null,[e[46]||(e[46]=t("label",{class:"label"},"Modalità ",-1)),o(t("select",{"onUpdate:modelValue":e[11]||(e[11]=s=>l.paypal_mode=s),class:"input w-full"},[...e[45]||(e[45]=[t("option",{value:"sandbox"},"Sandbox (test)",-1),t("option",{value:"live"},"Live (produzione)",-1)])],512),[[z,l.paypal_mode]])]),t("div",Me,[e[50]||(e[50]=t("p",{class:"text-xs font-semibold text-gray-500 mb-3"},"𧪠Credenziali Sandbox",-1)),t("div",Te,[t("div",null,[e[47]||(e[47]=t("label",{class:"label"},"Sandbox Client ID",-1)),o(t("input",{"onUpdate:modelValue":e[12]||(e[12]=s=>l.paypal_sandbox_client_id=s),class:"input w-full",placeholder:"AYâ¦"},null,512),[[d,l.paypal_sandbox_client_id]]),e[48]||(e[48]=t("p",{class:"text-xs text-gray-400 mt-1"},"Ottenibile su developer.paypal.com â My Apps & Credentials.",-1))]),t("div",null,[e[49]||(e[49]=t("label",{class:"label"},"Sandbox Client Secret",-1)),t("div",he,[o(t("input",{"onUpdate:modelValue":e[13]||(e[13]=s=>l.paypal_sandbox_client_secret=s),type:n.paypal_sandbox_client_secret?"text":"password",class:"input flex-1",placeholder:i.value.paypal_sandbox_client_secret==="***"?"(già configurato)":"Inserisciâ¦"},null,8,ze),[[x,l.paypal_sandbox_client_secret]]),t("button",{onClick:e[14]||(e[14]=s=>n.paypal_sandbox_client_secret=!n.paypal_sandbox_client_secret),class:"btn-secondary px-3 py-2 text-sm"},"ð")])])])]),t("div",Le,[e[53]||(e[53]=t("p",{class:"text-xs font-semibold text-gray-500 mb-3"},"ð´ Credenziali Live",-1)),t("div",Ie,[t("div",null,[e[51]||(e[51]=t("label",{class:"label"},"Live Client ID",-1)),o(t("input",{"onUpdate:modelValue":e[15]||(e[15]=s=>l.paypal_live_client_id=s),class:"input w-full",placeholder:"AYâ¦"},null,512),[[d,l.paypal_live_client_id]])]),t("div",null,[e[52]||(e[52]=t("label",{class:"label"},"Live Client Secret",-1)),t("div",Ke,[o(t("input",{"onUpdate:modelValue":e[16]||(e[16]=s=>l.paypal_live_client_secret=s),type:n.paypal_live_client_secret?"text":"password",class:"input flex-1",placeholder:i.value.paypal_live_client_secret==="***"?"(già configurato)":"Inserisciâ¦"},null,8,$e),[[x,l.paypal_live_client_secret]]),t("button",{onClick:e[17]||(e[17]=s=>n.paypal_live_client_secret=!n.paypal_live_client_secret),class:"btn-secondary px-3 py-2 text-sm"},"ð")])])])]),t("div",Ee,[t("button",{onClick:G,disabled:V.value,class:"btn-primary px-6"},r(V.value?"Salvataggioâ¦":"ð¾ Salva impostazioni PayPal"),9,Oe),P.value?(v(),u("span",je,"â Salvato")):M("",!0)])])],512),[[g,p.paypal]])]),t("div",Fe,[t("button",{class:"accord-hd",onClick:e[18]||(e[18]=s=>_("smtp"))},[e[55]||(e[55]=t("span",null,"ð¬ Email (SMTP)",-1)),t("span",{class:m(["accord-chev",{open:p.smtp}])},"âº",2)]),o(t("div",We,[e[64]||(e[64]=t("p",{class:"text-xs text-gray-400 mb-4"},[A("Per email transazionali (reset password, notifiche). Se non configurato usa il "),t("code",{class:"bg-gray-100 px-1 rounded"},"mail()"),A(" di sistema.")],-1)),t("div",Ye,[t("div",Be,[t("div",null,[e[56]||(e[56]=t("label",{class:"label"},"Host SMTP",-1)),o(t("input",{"onUpdate:modelValue":e[19]||(e[19]=s=>l.smtp_host=s),class:"input w-full",placeholder:"smtp.gmail.com"},null,512),[[d,l.smtp_host]])]),t("div",null,[e[57]||(e[57]=t("label",{class:"label"},"Porta",-1)),o(t("input",{"onUpdate:modelValue":e[20]||(e[20]=s=>l.smtp_port=s),type:"number",class:"input w-full",placeholder:"587"},null,512),[[d,l.smtp_port]])])]),t("div",null,[e[59]||(e[59]=t("label",{class:"label"},"Cifratura",-1)),o(t("select",{"onUpdate:modelValue":e[21]||(e[21]=s=>l.smtp_encryption=s),class:"input w-full"},[...e[58]||(e[58]=[t("option",{value:"tls"},"STARTTLS (porta 587)",-1),t("option",{value:"ssl"},"SSL/TLS (porta 465)",-1),t("option",{value:"none"},"Nessuna (porta 25)",-1)])],512),[[z,l.smtp_encryption]])]),t("div",De,[t("div",null,[e[60]||(e[60]=t("label",{class:"label"},"Utente",-1)),o(t("input",{"onUpdate:modelValue":e[22]||(e[22]=s=>
1l.smtp_user=s),class:"input w-full",placeholder:"[email protected]"},null,512),[[d,l.smtp_user]])]),t("div",null,[e[61]||(e[61]=t("label",{class:"label"},"Password",-1)),t("div",Ge,[o(t("input",{"onUpdate:modelValue":e[23]||(e[23]=s=>l.smtp_pass=s),type:n.smtp_pass?"text":"password",class:"input flex-1",placeholder:"(già configurata)"},null,8,Ne),[[x,l.smtp_pass]]),t("button",{onClick:e[24]||(e[24]=s=>n.smtp_pass=!n.smtp_pass),class:"btn-secondary px-3 py-2 text-sm"},"ð")])])]),t("div",Re,[t("div",null,[e[62]||(e[62]=t("label",{class:"label"},"Email mittente",-1)),o(t("input",{"onUpdate:modelValue":e[25]||(e[25]=s=>l.smtp_from_email=s),class:"input w-full",placeholder:"[email protected]"},null,512),[[d,l.smtp_from_email]])]),t("div",null,[e[63]||(e[63]=t("label",{class:"label"},"Nome mittente",-1)),o(t("input",{"onUpdate:modelValue":e[26]||(e[26]=s=>l.smtp_from_name=s),class:"input w-full",placeholder:"WonderMap"},null,512),[[d,l.smtp_from_name]])])]),t("div",He,[t("button",{onClick:D,disabled:w.value,class:"btn-primary px-6"},r(w.value?"Salvataggioâ¦":"ð¾ Salva configurazione email"),9,Je),C.value?(v(),u("span",qe,"â Salvato")):M("",!0)])])],512),[[g,p.smtp]])]),t("div",Qe,[t("button",{class:"accord-hd",onClick:e[27]||(e[27]=s=>_("security"))},[e[65]||(e[65]=t("span",null,"ð Sicurezza",-1)),t("span",{class:m(["accord-chev",{open:p.security}])},"âº",2)]),o(t("div",Xe,[t("div",null,[e[66]||(e[66]=t("label",{class:"label"},"JWT Secret",-1)),t("div",Ze,[o(t("input",{"onUpdate:modelValue":e[28]||(e[28]=s=>l.jwt_secret=s),type:"password",class:"input flex-1",placeholder:"(già configurato)"},null,512),[[d,l.jwt_secret]]),t("button",{onClick:N,class:"btn-secondary px-3 py-2 text-xs"},"Genera"),t("button",{onClick:e[29]||(e[29]=s=>h("jwt_secret")),class:"btn-primary px-3 py-2 text-sm"},"Salva")]),e[67]||(e[67]=t("p",{class:"text-xs text-red-400 mt-1"},"â ï¸ Cambiare il secret invalida tutte le sessioni attive.",-1))])],512),[[g,p.security]])]),f.value?(v(),u("div",et,' â "'+r(f.value)+'" aggiornata. ',1)):M("",!0)]))]))}},ot=q(tt,[["__scopeId","data-v-12097ef2"]]);export{ot 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.