PageSourceSearch

https://www.couponpe.com/assets/AdminCountries-DPShzC26.js

js couponpe.com collected 2026-09-25 13:24:08 UTC 16,886 bytes, 1 lines download raw bytes

1import{r as i,bE as P,v as te,w as ae,x as O,bW as B,bX as h,bF as le,bG as K,j as e,L as oe,G as re,s as q,Z as G,aD as ne,bK as ie,a0 as X,aV as ce,bL as de}from"./index-CXPLBStd.js";import{A as ue,a as xe,b as me,c as C,G as $,g as pe,h as k,S,i as he}from"./Admin-Nejt8Id8.js";import{A as ge,a as fe}from"./AdminSeoPreview-Dk_nvB5w.js";import{A as be,n as je}from"./AdminCapabilityEditor-Cln0UQmU.js";import{I as we}from"./info-M8oVI3s4.js";import{m as D}from"./proxy-rHqiwz23.js";import{P as ye}from"./pen-BV816EIK.js";import{T as ve}from"./trash-2-DfvAvHgi.js";import{A as Ne}from"./index-C067ZWk_.js";import"./sliders-horizontal-Dq0omJbm.js";import"./check-DAY_O1Dr.js";import"./ticket-5OKlFvj1.js";import"./database-CwQVYln5.js";import"./activity-BWcn5pOy.js";import"./file-text-Cnc4lytZ.js";import"./list-kluezkb5.js";import"./users-vfw1-Iup.js";import"./badge-check-CdgG-3HQ.js";import"./settings-58OxyV8t.js";import"./refresh-ccw-CYkgcomr.js";import"./chart-column-C4fB8HiU.js";import"./AdminFieldGuidance-Df5nh6xG.js";import"./circle-alert-0_rgoHQe.js";import"./calendar-days-DhIQmYEa.js";import"./lightbulb-DLsCRZCU.js";import"./share-2-C_5KVtN2.js";import"./sparkles-hIEjZJVC.js";import"./settings-2-B9Jzev1T.js";function Ye(){const[o,A]=i.useState({}),[W,H]=i.useState(!0),[Q,F]=i.useState(!1),[E,L]=i.useState(null),[a,c]=i.useState({}),[U,g]=i.useState(P()),[r,u]=i.useState({deals:"",coupons:"",discounts:""}),[d,f]=i.useState(""),[b,V]=i.useState("");i.useEffect(()=>{Z()},[]);const Z=async()=>{try{const s=await te(ae(O,"countries")),t={};s.forEach(l=>{t[l.id]=B(l.data(),l.id)}),A(t)}catch(s){console.error("Error fetching countries:",s)}finally{H(!1)}},M=s=>
1{var t,l,n;s&&o[s]?(L(s),c(o[s]),g(ie(o[s].seo)),u({deals:((t=o[s].keywords)==null?void 0:t.deals)||"",coupons:((l=o[s].keywords)==null?void 0:l.coupons)||"",discounts:((n=o[s].keywords)==null?void 0:n.discounts)||""}),f(s)):(L(null),c({}),g(P()),u({deals:"",coupons:"",discounts:""}),f("")),F(!0)},j=()=>{F(!1),L(null),c({}),g(P()),u({deals:"",coupons:"",discounts:""}),f("")},R=async s=>{s.preventDefault();const t=d.toUpperCase();if(!(!t||!a.name))try{const l=X(O,"countries",t),n=(a.path||h(t)).trim(),v=n==="/"?"/":`/${n.replace(/^\/+/,"").replace(/\/+$/,"")}`,p={...a,code:t,path:v,name:a.name.trim(),flag:(a.flag||"").trim()||"🌍",flagLogoUrl:(a.flagLogoUrl||"").trim()||void 0,currency:(a.currency||"").trim(),keywords:{deals:r.deals||`${a.name||t} deals`,coupons:r.coupons||`${a.name||t} coupons`,discounts:r.discounts||`${a.name||t} discounts`},seo:K(U,{siteOrigin:typeof window<"u"?window.location.origin:void 0}),adminCapabilities:je(a.adminCapabilities)};await ce(l,p),A(N=>({...N,[t]:B(p,t)})),j()}catch(l){console.error("Error saving country:",l),alert("Failed to save country.")}},J=async s=>{if(window.confirm(`Are you sure you want to delete ${o[s].name}?`))try{await de(X(O,"countries",s));const t={...o};delete t[s],A(t)}catch(t){console.error("Error deleting country:",t),alert("Failed to delete country.")}},I=i.useMemo(()=>Object.entries(o).filter(([s,t])=>t.name.toLowerCase().includes(b.toLowerCase())||s.toLowerCase().includes(b.toLowerCase())),[o,b]),w=Object.values(o),Y=w.filter(s=>{var t,l;return((t=s.seo)==null?void 0:t.title)||((l=s.seo)==null?void 0:l.description)}).length,_=w.filter(s=>{var t,l,n;return((t=s.keywords)==null?void 0:t.deals)||((l=s.keywords)==null?void 0:l.coupons)||((n=s.keywords)==null?void 0:n.discounts)}).length,ee=w.filter(s=>(s.path||"/")==="/").length,m=(d||a.code||"US").toUpperCase(),T=(a.path||h(m||"US")).trim()||"/",y=T==="/"?"/":`/${T.replace(/^\/+/,"").replace(/\/+$/,"")}`,x=typeof window<"u"?window.location.origin:"https://www.couponpe.com",se=le({manual:K(U,{siteOrigin:x}),fallback:{title:`Best coupons and deals in ${a.name||m} | CouponPe`,description:`Discover live coupon codes, store pages, and deals tailored for ${a.name||m}.`,keywords:r.coupons||r.deals||`${a.name||m} coupons`,canonicalUrl:`${x}${y==="/"?"":y}`,robots:"index, follow, max-image-preview:large",ogImage:`${x}/brand/couponpe-social-card.jpg`},siteOrigin:x,schemaTypes:["Organization","WebSite","WebPage","BreadcrumbList"],alternates:[{hrefLang:m==="IN"?"en-in":"en-us",href:`${x}${y==="/"?"":y}`},{hrefLang:"x-default",href:`${x}/`}]});return W?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(oe,{className:"h-8 w-8 animate-spin text-[#0052cc]"})}):e.jsxs(ue,{children:[e.jsx(xe,{eyebrow:"Configuration",title:"Countries",subtitle:"Manage market routing, regional SEO defaults, keyword intent, and storefront geography.",onAddClick:()=>M(),addButtonText:"Add Country",searchValue:b,onSearchChange:V,searchPlaceholder:"Search countries..."}),e.jsxs(me,{children:[e.jsx(C,{label:"Markets",value:w.length,hint:"Configured country records",icon:$,tone:"info"}),e.jsx(C,{label:"SEO Ready",value:Y,hint:"Countries with manual SEO overrides",icon:re,tone:"success"}),e.jsx(C,{label:"Keyword Sets",value:_,hint:"Markets with search-intent phrases",icon:q,tone:"warning"}),e.jsx(C,{label:"Root Routes",value:ee,hint:"Markets using the site root path",icon:we,tone:"default"})]}),e.jsx(pe,{children:e.jsxs("table",{className:"w-full min-w-[920px] text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(k,{children:"Country"}),e.jsx(k,{children:"Routing"}),e.jsx(k,{children:"Coverage"}),e.jsx(k,{align:"right",children:"Actions"})]})}),e.jsxs("tbody",{className:"divide-y divide-slate-100",children:[I.map(([s,t])=>{var l,n,v,p,N,z;return e.jsxs(D.tr,{layout:!0,className:"group transition-colors hover:bg-slate-50/70",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 flex items-center justify-center rounded-2xl bg-slate-50 text-3xl border border-slate-100 group-hover:scale-110 transition-transform",children:e.jsx(G,{country:t,imageClassName:"h-10 w-10 rounded-full object-cover",emojiClassName:"text-3xl"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-black text-slate-900 group-hover:text-[#0052cc]",children:t.name}),e.jsxs("p",{className:"mt-1 text-xs font-semibold uppercase tracking-[0.16em] text-slate-400",children:["Code: ",s]})]})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{tone:"muted",children:t.currency}),e.jsx(S,{tone:"info",children:t.path})]}),e.jsx("p",{className:"text-xs font-medium text-slate-500",children:((l=t.keywords)==null?void 0:l.coupons)||((n=t.keywords)==null?void 0:n.deals)||"No regional keywords"})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{tone:(v=t.seo)!=null&&v.title||(p=t.seo)!=null&&p.description?"success":"warning",children:(N=t.seo)!=null&&N.title||(z=t.seo)!=null&&z.description?"SEO configured":"Missing SEO"}),e.jsx(S,{tone:t.flagLogoUrl?"info":"muted",children:t.flagLogoUrl?"Image flag":"Emoji flag"})]})}),e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>M(s),className:"h-9 w-9 flex items-center justify-center rounded-xl text-slate-400 hover:bg-[#0052cc] hover:text-white transition-all active:scale-90",children:e.jsx(ye,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>J(s),className:"h-9 w-9 flex items-center justify-center rounded-xl text-slate-400 hover:bg-red-500 hover:text-white transition-all active:scale-90",children:e.jsx(ve,{className:"h-4 w-4"})})]})})]},s)}),I.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-6 py-8",children:e.jsx(he,{icon:$,title:"No countries found",description:"Add a market to manage new regional routes, keywords, and SEO defaults."})})}):null]})]})}),e.jsx(Ne,{children:Q&&e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 sm:p-6",children:[e.jsx(D.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},onClick:j,className:"absolute inset-0 bg-slate-950/60 backdrop-blur-md"}),e.jsxs(D.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative bg-white rounded-[40px] shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col border border-slate-100",children:[e.jsxs("div",{className:"p-8 border-b border-slate-50 flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("h3",{className:"text-2xl font-black text-slate-900 uppercase tracking-tight",children:[E?"Edit":"Add"," ",e.jsx("span",{className:"text-[#0052cc]",children:"Country"})]}),e.jsx("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-widest",children:"Configure country details and SEO settings."})]}),e.jsx("button",{onClick:j,className:"h-12 w-12 flex items-center justify-center rounded-2xl text-slate-400 hover:bg-slate-50 hover:text-slate-900 transition-all active:scale-90",children:e.jsx(ne,{className:"h-6 w-6"})})]}),e.jsxs("form",{onSubmit:R,className:"flex-1 overflow-y-auto p-8 space-y-10 hide-scrollbar",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"h-6 w-6 rounded-lg bg-[#0052cc]/10 flex items-center justify-center text-[#0052cc]",children:e.jsx($,{className:"h-3.5 w-3.5"})}),e.jsx("h4",{className:"text-xs font-black text-slate-900 uppercase tracking-widest",children:"Basic Information"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Country Code (ISO)"}),e.jsx("input",{required:!0,type:"text",value:d,onChange:s=>{const t=s.target.value.toUpperCase();f(t),(!a.path||a.path===h(d))&&c({...a,path:h(t)})},placeholder:"e.g. US",maxLength:2,disabled:!!E,className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5 disabled:opacity-50 uppercase"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Country Name"}),e.jsx("input",{required:!0,type:"text",value:a.name||"",onChange:s=>c({...a,name:s.target.value}),placeholder:"e.g. United States",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Flag Emoji"}),e.jsx("input",{required:!0,type:"text",value:a.flag||"",onChange:s=>c({...a,flag:s.target.value}),placeholder:"e.g. 🇺🇸",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Flag Logo URL"}),e.jsx("input",{type:"url",value:a.flagLogoUrl||"",onChange:s=>c({...a,flagLogoUrl:s.target.value}),placeholder:"https://example.com/flags/us.png",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Currency Symbol"}),e.jsx("input",{required:!0,type:"text",value:a.currency||"",onChange:s=>c({...a,currency:s.target.value}),placeholder:"e.g. $",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"URL Path"}),e.jsx("input",{required:!0,type:"text",value:a.path||"",onChange:s=>c({...a,path:s.target.value}),placeholder:"e.g. /us",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"md:col-span-2 rounded-[28px] border border-slate-100 bg-slate-50/60 p-5",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-slate-400",children:"Preview"}),e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-2xl border border-slate-100 bg-white shadow-sm",children:e.jsx(G,{country:a,imageClassName:"h-10 w-10 rounded-full object-cover",emojiClassName:"text-3xl"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-black text-slate-900",children:a.name||"Country name"}),e.jsxs("p",{className:"text-[11px] font-bold uppercase tracking-[0.16em] text-slate-400",children:[(d||"XX").toUpperCase()," • ",a.path||h(d||"US")]})]})]})]})]})]}),e.jsx(be,{scope:"country",value:a.adminCapabilities,onChange:s=>c(t=>({...t,adminCapabilities:s}))}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"h-6 w-6 rounded-lg bg-amber-500/10 flex items-center justify-center text-amber-600",children:e.jsx(q,{className:"h-3.5 w-3.5"})}),e.jsx("h4",{className:"text-xs font-black text-slate-900 uppercase tracking-widest",children:"Country Intent Keywords"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Deals Phrase"}
1),e.jsx("input",{type:"text",value:r.deals,onChange:s=>u({...r,deals:s.target.value}),placeholder:"Best US deals",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Coupons Phrase"}),e.jsx("input",{type:"text",value:r.coupons,onChange:s=>u({...r,coupons:s.target.value}),placeholder:"Coupons Canada",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Discounts Phrase"}),e.jsx("input",{type:"text",value:r.discounts,onChange:s=>u({...r,discounts:s.target.value}),placeholder:"UK shopping discounts",className:"w-full h-14 px-6 rounded-2xl border border-slate-100 bg-slate-50/50 text-sm font-bold text-slate-900 outline-none transition-all focus:border-[#0052cc]/30 focus:bg-white focus:ring-4 focus:ring-[#0052cc]/5"})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(ge,{value:U,onChange:s=>g(t=>({...t,...s})),sectionDescription:"Manage regional SEO overrides while keeping hreflang and schema computed from country routing.",placeholders:{seoTitle:"Leave blank to auto-generate the country page title",seoDescription:"Leave blank to auto-generate the country page description",seoCanonicalUrl:"/in or /us"}}),e.jsx(fe,{preview:se})]})]}),e.jsxs("div",{className:"p-8 border-t border-slate-50 bg-slate-50/30 flex items-center justify-end gap-4 shrink-0",children:[e.jsx("button",{type:"button",onClick:j,className:"px-8 py-4 rounded-2xl text-xs font-black uppercase tracking-widest text-slate-500 hover:bg-slate-100 transition-all active:scale-95",children:"Cancel"}),e.jsx("button",{onClick:R,disabled:!d||!a.name,className:"px-10 py-4 rounded-2xl bg-slate-900 text-white text-xs font-black uppercase tracking-widest transition-all hover:bg-slate-800 active:scale-95 shadow-xl shadow-slate-200 disabled:opacity-50",children:E?"Save Changes":"Add Country"})]})]})]})})]})}export{Ye 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.