PageSourceSearch

https://quest-x.ai/_next/static/chunks/app/(admin)/admin/brand-deals/page-4a268fe9667e0931.js

js quest-x.ai collected 2026-10-05 12:31:05 UTC 31,234 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23375],{60519:function(e,a,t){Promise.resolve().then(t.bind(t,49712))},49712:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return D}});var r=t(27573),s=t(7653),i=t(88146),n=t(62441),l=t(10269),d=t(48716),c=t(38333),o=t(66701),m=t(75721),u=t(76251),x=t(58410),h=t(2966),b=t(24875),g=t(66350),p=t(82041),f=t(16273),y=t(98521),j=t(29759),v=t(24012),k=t(62560);let N=[{id:"all",label:"All"},{id:"active",label:"Live"},{id:"scheduled",label:"Scheduled"},{id:"paused",label:"Paused"},{id:"draft",label:"Draft"},{id:"expired",label:"Expired"},{id:"disabled",label:"Disabled"}],w=[{key:"all",label:"Total",hint:"All brand deals",icon:"/figma-admin/ic-bd-kpi-total.svg",tone:"total"},{key:"active",label:"Live",hint:"Consumer visible",icon:"/figma-admin/ic-bd-kpi-live.svg",tone:"live"},{key:"scheduled",label:"Scheduled",hint:"Future start",icon:"/figma-admin/ic-bd-kpi-scheduled.svg",tone:"scheduled"},{key:"disabled",label:"Disabled",hint:"Moderated off",icon:"/figma-admin/ic-bd-kpi-disabled.svg",tone:"disabled"},{key:"expired",label:"Expired",hint:"Past end time",icon:"/figma-admin/ic-bd-kpi-expired.svg",tone:"expired"}];function C(e){let{deal:a}=e,t=(0,k.MF)(a);return(0,r.jsxs)("div",{className:"overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-sm dark:border-white/10 dark:bg-gray-950",children:[(0,r.jsx)("div",{className:"border-b border-gray-100 bg-gray-50/80 px-3 py-2 text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:border-white/[0.06] dark:bg-white/[0.03]",children:"Consumer preview \xb7 Quest-X → Deals → Brands"}),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsxs)("div",{className:"flex gap-4",children:[a.imageUrl?(0,r.jsx)("img",{src:a.imageUrl,alt:"",className:"h-28 w-28 shrink-0 rounded-xl object-cover"}):(0,r.jsx)("div",{className:"flex h-28 w-28 shrink-0 items-center justify-center rounded-xl bg-gray-100 text-xs text-gray-400 dark:bg-white/5",children:"No image"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(p.C,{variant:(0,k.QU)(a.status),children:(0,k.Cf)(a.status)}),(0,r.jsx)(p.C,{variant:"brand",children:"Brand offer"}),a.category?(0,r.jsx)(p.C,{variant:"neutral",children:a.category}):null]}),(0,r.jsx)("h3",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:a.title}),(0,r.jsx)("p",{className:"text-sm font-medium text-primary-700 dark:text-primary-300",children:(0,k.eH)(a)}),(0,r.jsx)("p",{className:"line-clamp-3 text-sm text-gray-600 dark:text-gray-300",children:a.description||"No description provided."}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[(a.brandName||a.storeName)&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(n.Z,{className:"h-3.5 w-3.5"}),a.brandName??a.storeName]}),a.couponCode?(0,r.jsxs)("span",{children:["Code: ",a.couponCode]}):null]})]})]}),(0,r.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 p-3 dark:bg-white/[0.04]",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Validity"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-700 dark:text-gray-200",children:(0,k.ej)(a.startsAt,a.timezone)}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["→ ",(0,k.ej)(a.expiresAt,a.timezone)]})]}),(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 p-3 dark:bg-white/[0.04]",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Claims"}),(0,r.jsxs)("p",{className:"mt-1 text-sm font-semibold tabular-nums text-gray-900 dark:text-white",children:[a.claimCount,null!=a.maxClaims?` / ${a.maxClaims}`:""]}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:null==t?"Unlimited remaining":`${t} remaining`})]}),(0,r.jsxs)("div",{className:"rounded-xl bg-gray-50 p-3 dark:bg-white/[0.04]",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Engagement"}),(0,r.jsxs)("p",{className:"mt-1 text-sm font-semibold tabular-nums text-gray-900 dark:text-white",children:[a.clickCount," clicks"]}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:(0,k.wu)(a)})]})]}),a.termsAndConditions?(0,r.jsx)("p",{className:"mt-3 line-clamp-3 text-xs text-gray-500",children:a.termsAndConditions}):null]})]})}
1function D(){let[e,a]=(0,s.useState)([]),[t,n]=(0,s.useState)({total:0,active:0,scheduled:0,disabled:0,expired:0}),[D,S]=(0,s.useState)(!0),[P,q]=(0,s.useState)(null),[A,T]=(0,s.useState)(""),[z,E]=(0,s.useState)(""),[U,R]=(0,s.useState)("all"),[Z,$]=(0,s.useState)(1),[F,L]=(0,s.useState)(0),[M,O]=(0,s.useState)(1),[B,I]=(0,s.useState)(null),[_,H]=(0,s.useState)(null),[Q,W]=(0,s.useState)(!1),[K,V]=(0,s.useState)(null),[G,X]=(0,s.useState)(""),[J,Y]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=window.setTimeout(()=>{E(A.trim()),$(1)},350);return()=>window.clearTimeout(e)},[A]);let ee=(0,s.useCallback)(async()=>{try{let e=await Promise.all(["all","active","scheduled","disabled","expired"].map(e=>(0,v.hi)("/brand-portal/admin/deals",{params:{status:e,page:"1",limit:"1"},skipAuthRedirect:!0})));n({total:e[0]?.total??0,active:e[1]?.total??0,scheduled:e[2]?.total??0,disabled:e[3]?.total??0,expired:e[4]?.total??0})}catch{}},[]),ea=(0,s.useCallback)(async()=>{S(!0),q(null);try{let e=await (0,v.hi)("/brand-portal/admin/deals",{params:{status:U,q:z||void 0,page:String(Z),limit:String(20)},skipAuthRedirect:!0});a(e.data??[]),L(e.total??0),O(e.totalPages??1)}catch(e){a([]),q(e instanceof Error?e.message:"Failed to load brand deals")}finally{S(!1)}},[U,z,Z]);(0,s.useEffect)(()=>{ea()},[ea]),(0,s.useEffect)(()=>{ee()},[ee]);let et=async e=>{I(e),W(!0),H(null);try{let a=await (0,v.hi)(`/brand-portal/admin/deals/${e}`,{skipAuthRedirect:!0});H(a)}catch(e){g.Am.error(e instanceof Error?e.message:"Failed to load deal preview"),I(null)}finally{W(!1)}},er=()=>{I(null),H(null)},es=async()=>{if(K){if(G.trim().length<3){g.Am.error("A moderation reason is required (min 3 characters)");return}Y(K.id);try{await (0,v.hi)(`/brand-portal/admin/deals/${K.id}/disable`,{method:"POST",body:{reason:G.trim()},skipAuthRedirect:!0}),g.Am.success("Deal disabled"),V(null),X(""),B===K.id&&await et(K.id),await Promise.all([ea(),ee()])}catch(e){g.Am.error(e instanceof Error?e.message:"Disable failed")}finally{Y(null)}}},ei=async e=>{Y(e);try{await (0,v.hi)(`/brand-portal/admin/deals/${e}/re-enable`,{method:"POST",skipAuthRedirect:!0}),g.Am.success("Deal re-enabled"),B===e&&await et(e),await Promise.all([ea(),ee()])}catch(e){g.Am.error(e instanceof Error?e.message:"Re-enable failed")}finally{Y(null)}},en=(0,s.useMemo)(()=>z||"all"!==U?{title:"No matching brand deals",description:"Try a different status filter or search term."}:{title:"No brand deals yet",description:"Auto-published offers and moderation requests will appear here once brands submit them."},[z,U]),el=e=>"all"===e?t.total:"active"===e?t.active:"scheduled"===e?t.scheduled:"disabled"===e?t.disabled:t.expired;return(0,r.jsxs)("div",{"data-qx-admin-bd":!0,"data-qa":"admin-brand-deals",children:[(0,r.jsxs)("nav",{className:"qx-admin-bc","aria-label":"Breadcrumb",children:[(0,r.jsxs)(i.default,{href:"/admin",children:[(0,r.jsx)("img",{src:"/figma-admin/ic-home.svg",alt:"",width:14,height:14}),"Admin"]}),(0,r.jsx)("span",{className:"qx-admin-bc-sep","aria-hidden":!0,children:">"}),(0,r.jsx)("span",{"aria-current":"page",children:"Brand Deals"})]}),(0,r.jsxs)("div",{className:"qx-bd-title",children:[(0,r.jsx)("span",{className:"qx-bd-title-icon",children:(0,r.jsx)("img",{src:"/figma-admin/ic-bd-title.svg",alt:"",width:24,height:24})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{children:"Brand Deals"}),(0,r.jsx)("p",{children:"SUPER ADMIN moderation for auto-published brand offers. Preview deals as consumers see them, then disable or re-enable."})]})]}),(0,r.jsx)("div",{className:"qx-bd-kpis",children:w.map(e=>{let a=U===e.key;return(0,r.jsxs)("button",{type:"button","data-tone":e.tone,"data-active":a?"true":"false",className:"qx-bd-kpi",onClick:()=>{R(e.key),$(1)},children:[(0,r.jsx)("span",{className:"qx-bd-kpi-icon",children:(0,r.jsx)("img",{src:e.icon,alt:"",width:21,height:21})}),(0,r.jsxs)("div",{className:"qx-bd-kpi-body",children:[(0,r.jsxs)("div",{className:"qx-bd-kpi-top",children:[(0,r.jsx)("span",{className:"qx-bd-kpi-label",children:e.label}),(0,r.jsx)("strong",{className:"qx-bd-kpi-value",children:el(e.key).toLocaleStr
1ing()})]}),(0,r.jsx)("span",{className:"qx-bd-kpi-hint",children:e.hint})]})]},e.key)})}),(0,r.jsxs)("section",{className:"qx-bd-queue",children:[(0,r.jsxs)("div",{className:"qx-bd-queue-head",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{children:"Moderation queue"}),(0,r.jsx)("p",{children:"Search, filter, preview, and take action"})]}),(0,r.jsxs)("div",{className:"qx-bd-search",children:[(0,r.jsx)("img",{src:"/figma-admin/ic-search.svg",alt:"",width:16,height:16}),(0,r.jsx)("input",{value:A,onChange:e=>T(e.target.value),placeholder:"Search by deal title or brand name...","aria-label":"Search brand deals"}),A?(0,r.jsx)("button",{type:"button","aria-label":"Clear search",className:"qx-bd-search-clear",onClick:()=>{T(""),E(""),$(1)},children:(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5"})}):null]})]}),(0,r.jsx)("div",{className:"qx-bd-tabs",role:"tablist","aria-label":"Deal status",children:N.map(e=>(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":U===e.id,"data-active":U===e.id?"true":"false",onClick:()=>{R(e.id),$(1)},children:e.label},e.id))}),D?(0,r.jsx)("div",{className:"qx-bd-canvas qx-bd-skel","aria-busy":"true"}):P?(0,r.jsx)("div",{className:"qx-bd-canvas",children:(0,r.jsx)(j.T,{title:"Couldn't load brand deals",message:P,onRetry:()=>void ea()})}):0===e.length?(0,r.jsxs)("div",{className:"qx-bd-empty",children:[(0,r.jsx)("span",{className:"qx-bd-empty-icon",children:(0,r.jsx)("img",{src:"/figma-admin/ic-bd-empty.svg",alt:"",width:32,height:32})}),(0,r.jsx)("h3",{children:en.title}),(0,r.jsx)("p",{children:en.description})]}):(0,r.jsxs)("div",{className:"qx-bd-results",children:[(0,r.jsxs)("div",{className:"qx-bd-results-meta",children:[(0,r.jsx)("p",{children:(0,r.jsxs)("strong",{children:[F.toLocaleString()," deal",1===F?"":"s"]})}),(0,r.jsxs)("p",{children:["Page ",Z," of ",M]})]}),(0,r.jsx)("div",{className:"qx-bd-table-wrap",children:(0,r.jsxs)("table",{className:"qx-bd-table",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Deal"}),(0,r.jsx)("th",{children:"Brand"}),(0,r.jsx)("th",{children:"Status"}),(0,r.jsx)("th",{children:"Schedule"}),(0,r.jsx)("th",{children:"Claims"}),(0,r.jsx)("th",{children:"Clicks"}),(0,r.jsx)("th",{children:"Actions"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:(0,r.jsxs)("button",{type:"button",className:"qx-bd-deal-cell",onClick:()=>void et(e.id),children:[e.imageUrl?(0,r.jsx)("img",{src:e.imageUrl,alt:"",width:44,height:44}):(0,r.jsx)("span",{className:"qx-bd-deal-ph",children:(0,r.jsx)(d.Z,{className:"h-4 w-4"})}),(0,r.jsxs)("span",{children:[(0,r.jsx)("strong",{children:e.title}),(0,r.jsxs)("em",{children:[(0,k.eH)(e),e.category?` \xb7 ${e.category}`:""]})]})]})}),(0,r.jsx)("td",{children:e.brandName??e.storeName??"—"}),(0,r.jsxs)("td",{children:[(0,r.jsx)(p.C,{variant:(0,k.QU)(e.status),children:(0,k.Cf)(e.status)}),e.disableReason?(0,r.jsx)("p",{className:"qx-bd-disable-reason",children:e.disableReason}):null]}),(0,r.jsxs)("td",{className:"qx-bd-schedule",children:[(0,r.jsx)("div",{children:(0,k.ej)(e.startsAt,e.timezone)}),(0,r.jsxs)("div",{children:["→ ",(0,k.ej)(e.expiresAt,e.timezone)]})]}),(0,r.jsx)("td",{className:"tabular-nums",children:e.claimCount}),(0,r.jsx)("td",{className:"tabular-nums",children:e.clickCount}),(0,r.jsx)("td",{children:(0,r.jsxs)("div",{className:"qx-bd-actions",children:[(0,r.jsxs)(f.z,{type:"button",size:"sm",variant:"outline",className:"gap-1",onClick:()=>void et(e.id),children:[(0,r.jsx)(c.Z,{className:"h-3.5 w-3.5"}),"Preview"]}),"disabled"!==e.status?(0,r.jsxs)(f.z,{type:"button",size:"sm",variant:"outline",className:"gap-1 text-rose-600",disabled:J===e.id,onClick:()=>{V(e),X("")},children:[(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5"}),"Disable"]}):(0,r.jsxs)(f.z,{type:"button",size:"sm",className:"gap-1",disabled:J===e.id,onClick:()=>void ei(e.id),children:[J===e.id?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5"}),"Re-enable"]})]})})]},e.id))})]})}),(0,r.jsxs)("div",{className:"qx-bd-pager",children:[(0,r.jsxs)("p",{children:[F," deal",1===F?"":"s"," \xb7 Page ",Z," of ",M]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(f.z,{type:"button",variant:"outline",size:"sm",disabled:Z<=1||D,onClick:()=>$(e=>Math.max(1,e-1)),className:"gap-1",children:[(0,r.jsx)(x.Z,{className:"h-3.5 w-3.5"}),"Previous"]}),(0,r.jsxs)(f.z,{type:"button",variant:"outline",size:"sm",disabled:Z>=M||D,onClick:()=>$(e=>e+1),className:"gap-1",children:["Next",(0,r.jsx)(h.Z,{className:"h-3.5 w-3.5"})]})]})]})]})]}),(0,r.jsxs)(y.Vq,{open:!!B,onClose:J?()=>{}:er,dismissible:!J,className:"max-w-3xl",children:[(0,r.jsx)(y.fK,{title:"Deal preview",description:"Review how this brand offer appears and take moderation action.",onClose:J?void 0:er}),(0,r.jsx)(y.a7,{className:"max-h-[70vh] space-y-4 overflow-y-auto",children:Q||!_?(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 py-16 text-sm text-gray-500",children:[(0,r.jsx)(m.Z,{className:"h-4 w-4 animate-spin"}),"Loading preview…"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C,{deal:_}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 p-3 dark:border-white/10",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Moderation"}),(0,r.jsxs)("p",{className:"mt-1 text-sm text-gray-800 dark:text-gray-200",children:["Status: ",(0,k.Cf)(_.status)]}),_.disableReason?(0,r.jsxs)("p",{className:"mt-1 text-sm text-rose-600 dar
1k:text-rose-300",children:["Reason: ",_.disableReason]}):(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"No disable reason on file."}),_.disabledAt?(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:["Disabled at ",(0,k.ej)(_.disabledAt)]}):null]}),(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 p-3 dark:border-white/10",children:[(0,r.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-400",children:"Destination"}),(0,r.jsxs)("a",{href:_.dealUrl,target:"_blank",rel:"noreferrer",className:"mt-1 inline-flex items-center gap-1 break-all text-sm text-primary-600 hover:underline dark:text-primary-300",children:[_.dealUrl,(0,r.jsx)(b.Z,{className:"h-3.5 w-3.5 shrink-0"})]}),(0,r.jsxs)("p",{className:"mt-2 text-xs text-gray-500",children:["Brand ID: ",_.brandPartnerId??"—"]})]})]})]})}),(0,r.jsxs)(y.cN,{className:"flex-wrap gap-2",children:[_?.dealUrl?(0,r.jsxs)("a",{href:_.dealUrl,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-[32px] items-center justify-center gap-1.5 rounded-lg border-2 border-gray-300 bg-transparent px-3 py-1.5 text-sm font-medium transition-colors hover:bg-gray-100 dark:border-gray-600 dark:hover:bg-gray-800",children:[(0,r.jsx)(b.Z,{className:"h-3.5 w-3.5"}),"Open deal URL"]}):null,_&&"disabled"!==_.status?(0,r.jsxs)(f.z,{type:"button",variant:"outline",className:"gap-1.5 text-rose-600",disabled:!!J,onClick:()=>{V(_),X("")},children:[(0,r.jsx)(o.Z,{className:"h-3.5 w-3.5"}),"Disable deal"]}):null,_?.status==="disabled"?(0,r.jsxs)(f.z,{type:"button",className:"gap-1.5",disabled:!!J,onClick:()=>void ei(_.id),children:[J===_.id?(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5"}),"Re-enable deal"]}):null]})]}),(0,r.jsxs)(y.Vq,{open:!!K,onClose:()=>{J||V(null)},dismissible:!J,children:[(0,r.jsx)(y.fK,{title:"Disable brand deal",description:K?`Disable “${K.title}”. Brands cannot edit a disabled deal until re-enabled.`:"",onClose:J?void 0:()=>V(null)}),(0,r.jsx)(y.a7,{className:"space-y-3",children:(0,r.jsxs)("label",{className:"block text-xs font-medium text-gray-600 dark:text-gray-400",children:["Moderation reason",(0,r.jsx)("textarea",{className:"mt-1 w-full rounded-xl border border-gray-200 px-3 py-2 text-sm outline-none focus:border-primary-400 focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-gray-950",rows:3,value:G,onChange:e=>X(e.target.value),placeholder:"Explain why this deal is being disabled…"})]})}),(0,r.jsxs)(y.cN,{children:[(0,r.jsx)(f.z,{type:"button",variant:"outline",disabled:!!J,onClick:()=>V(null),children:"Cancel"}),(0,r.jsxs)(f.z,{type:"button",disabled:!!J,className:"gap-1.5 bg-rose-600 text-white hover:bg-rose-700",onClick:()=>void es(),children:[J?(0,r.jsx)(m.Z,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(o.Z,{className:"h-4 w-4"}),"Confirm disable"]})]})]})]})}},82041:function(e,a,t){"use strict";t.d(a,{C:function(){return l}});var r=t(27573),s=t(10607),i=t(25579);let n={default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",success:"bg-emerald-100 text-emerald-700 ring-1 ring-inset ring-emerald-600/10 dark:bg-emerald-500/15 dark:text-emerald-400 dark:ring-emerald-400/20",warning:"bg-amber-100 text-amber-700 ring-1 ring-inset ring-amber-600/10 dark:bg-amber-500/15 dark:text-amber-400 dark:ring-amber-400/20",error:"bg-danger-100 text-danger-700 ring-1 ring-inset ring-danger-600/10 dark:bg-danger-500/15 dark:text-danger-400 dark:ring-danger-400/20",info:"bg-sky-100 text-sky-700 ring-1 ring-inset ring-sky-600/10 dark:bg-sky-500/15 dark:text-sky-400 dark:ring-sky-400/20",brand:"bg-primary-100 text-primary-700 ring-1 ring-inset ring-primary-600/10 dark:bg-primary-500/15 dark:text-primary-300 dark:ring-primary-400/20",neutral:"bg-gray-100 text-gray-600 ring-1 ring-inset ring-gray-500/10 dark:bg-white/5 dark:text-gray-300 dark:ring-white/10",outline:"bg-transparent text-gray-600 ring-1 ring-inset ring-gray-300 dark:text-gray-300 dark:ring-white/15"};function l(e){let{className:a,variant:t="default",...l}=e;return(0,r.jsx)("span",{className:(0,i.m6)((0,s.W)("inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-xs font-medium",n[t]),a),...l})}},16273:function(e,a,t){"use strict";t.d(a,{z:function(){return o}});var r=t(27573),s=t(7653),i=t(10607),n=t(25579),l=t(75721);let d={primary:"bg-primary-600 text-white hover:bg-primary-700 active:bg-primary-800 dark:bg-primary-500 dark:hover:bg-primary-600 dark:active:bg-primary-700",secondary:"bg-secondary-700 text-white hover:bg-secondary-800 active:bg-secondary-900 dark:bg-secondary-500 dark:hover:bg-secondary-600 dark:active:bg-secondary-700",outline:"border border-gray-300 bg-transparent text-gray-900 hover:bg-gray-100 hover:border-gray-400 active:bg-gray-200 dark:border-white/15 dark:text-gray-100 dark:hover:bg-white/[0.06] dark:hover:border-white/25 dark:active:bg-white/[0.1]",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 active:bg-gray-200 dark:text-gray-300 dark:hover:bg-white/[0.06] dark:active:bg-white/[0.1]",destructive:"bg-danger-600 text-white hover:bg-danger-700 active:bg-danger-800 dark:bg-danger-600 dar
1k:hover:bg-danger-700 dark:active:bg-danger-800"},c={sm:"min-h-[36px] gap-1.5 px-3 py-1.5 text-sm sm:min-h-[32px]",md:"min-h-[44px] gap-2 px-4 py-2.5 text-sm sm:text-base sm:min-h-[40px]",lg:"min-h-[48px] gap-2 px-6 py-3 text-base sm:text-lg sm:min-h-[44px]",icon:"min-h-[44px] min-w-[44px] p-0 sm:min-h-[40px] sm:min-w-[40px]"},o=(0,s.forwardRef)((e,a)=>{let{className:t,variant:s="primary",size:o="md",disabled:m,isLoading:u=!1,ariaLabel:x,ariaDescribedBy:h,children:b,...g}=e;return(0,r.jsxs)("button",{ref:a,className:(0,n.m6)((0,i.W)("inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-ring select-none","active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50",d[s],c[o]),t),disabled:m||u,"aria-label":x,"aria-describedby":h,"aria-busy":u||void 0,...g,children:[u&&(0,r.jsx)(l.Z,{className:"h-4 w-4 shrink-0 animate-spin","aria-hidden":"true"}),b]})});o.displayName="Button"},98521:function(e,a,t){"use strict";t.d(a,{QH:function(){return f},Vq:function(){return h},a7:function(){return g},cN:function(){return p},fK:function(){return b}});var r=t(27573),s=t(7653),i=t(3458),n=t(98882),l=t(92936),d=t(10269),c=t(20054),o=t(19369),m=t(16273);let u={hidden:{opacity:0},visible:{opacity:1}},x={hidden:{opacity:0,scale:.96,y:12},visible:{opacity:1,scale:1,y:0}};function h(e){let{open:a,onClose:t,children:d,className:c,dismissible:m=!0,labelledBy:h}=e,[b,g]=s.useState(!1);return(s.useEffect(()=>g(!0),[]),s.useEffect(()=>{if(!a)return;let e=e=>{"Escape"===e.key&&m&&t()};document.addEventListener("keydown",e);let r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=r}},[a,m,t]),b)?(0,i.createPortal)((0,r.jsx)(n.M,{children:a&&(0,r.jsxs)("div",{className:"admin-scope fixed inset-0 z-[200] flex items-end justify-center overflow-hidden overscroll-none p-3 sm:items-center sm:p-4",children:[(0,r.jsx)(l.E.div,{variants:u,initial:"hidden",animate:"visible",exit:"hidden",transition:{duration:.18},className:"absolute inset-0 bg-gray-950/60 backdrop-blur-sm",onClick:()=>m&&t(),"aria-hidden":!0}),(0,r.jsx)(l.E.div,{role:"dialog","aria-modal":"true","aria-labelledby":h,variants:x,initial:"hidden",animate:"visible",exit:"hidden",transition:{duration:.22,ease:[.22,1,.36,1]},className:(0,o.cn)("relative z-10 flex max-h-[min(92dvh,100%)] w-full max-w-md flex-col overflow-y-auto rounded-2xl border border-gray-200 bg-white shadow-elevated dark:border-white/10 dark:bg-[#141621]",c),children:d})]})}),document.body):null}function b(e){let{title:a,description:t,onClose:s,icon:i}=e;return(0,r.jsxs)("div",{className:"flex items-start gap-4 px-6 pb-2 pt-6",children:[i,(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:a}),t&&(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:t})]}),s&&(0,r.jsx)("button",{type:"button",onClick:s,className:"flex min-h-[44px] min-w-[44px] items-center justify-center rounded-lg text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 sm:min-h-[40px] sm:min-w-[40px] dark:hover:bg-white/5 dark:hover:text-gray-200","aria-label":"Close",children:(0,r.jsx)(d.Z,{className:"h-4 w-4"})})]})}function g(e){let{children:a,className:t}=e;return(0,r.jsx)("div",{className:(0,o.cn)("px-6 py-4",t),children:a})}function p(e){let{children:a,className:t}=e;return(0,r.jsx)("div",{className:(0,o.cn)("flex flex-wrap items-center justify-end gap-2 border-t border-gray-100 bg-gray-50/60 px-4 py-4 sm:px-6 dark:border-white/5 dark:bg-white/[0.02] [&>button]:max-[420px]:w-full",t),children:a})}function f(e){let{open:a,title:t,description:s,confirmText:i="Confirm",cancelText:n="Cancel",tone:l="default",loading:d=!1,onConfirm:u,onCancel:x}=e;return(0,r.jsxs)(h,{open:a,onClose:d?()=>{}:x,dismissible:!d,children:[(0,r.jsx)(b,{title:t,description:s,icon:(0,r.jsx)("div",{className:(0,o.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-xl","danger"===l?"bg-danger-100 text-danger-600 dar
1k:bg-danger-500/15 dark:text-danger-400":"bg-primary-100 text-primary-600 dark:bg-primary-500/15 dark:text-primary-300"),children:(0,r.jsx)(c.Z,{className:"h-5 w-5"})})}),(0,r.jsxs)(p,{className:"mt-2",children:[(0,r.jsx)(m.z,{variant:"outline",onClick:x,disabled:d,children:n}),(0,r.jsx)(m.z,{onClick:u,disabled:d,isLoading:d,variant:"danger"===l?"destructive":"primary",children:i})]})]})}},29759:function(e,a,t){"use strict";t.d(a,{T:function(){return u}});var r=t(27573),s=t(88623),i=t(16273),n=t(10607),l=t(25579),d=t(7653);let c=0;function o(e){let{className:a}=e,t=d.useMemo(()=>`err-${c++}`,["err"]);return(0,r.jsxs)("svg",{viewBox:"0 0 160 120",className:a,width:"160",height:"120",role:"img","aria-label":"Error",children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:`${t}-a`,x1:"0",y1:"0",x2:"1",y2:"1",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:"#ffb39a"}),(0,r.jsx)("stop",{offset:"100%",stopColor:"#fd562d"})]})}),(0,r.jsx)("ellipse",{cx:"80",cy:"104",rx:"50",ry:"8",fill:"currentColor",opacity:"0.06"}),(0,r.jsx)("path",{d:"M80 34 L118 96 H42 Z",fill:"none",stroke:"currentColor",strokeOpacity:"0.18",strokeWidth:"4",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M80 46 L108 92 H52 Z",fill:`url(#${t}-a)`,opacity:"0.16"}),(0,r.jsx)("rect",{x:"77",y:"58",width:"6",height:"20",rx:"3",fill:"#fd562d"}),(0,r.jsx)("circle",{cx:"80",cy:"85",r:"3.4",fill:"#fd562d"})]})}var m=t(90107);function u(e){let{className:a,title:t,message:d,onRetry:c,action:u,...x}=e,{t:h}=(0,m.useI18n)();return(0,r.jsxs)("div",{className:(0,l.m6)((0,n.W)("flex flex-col items-center justify-center rounded-2xl border border-[color:var(--fh-border,#e8e8e8)] bg-[color:var(--fh-soft,#ffefea)]/60 px-6 py-14 text-center"),a),role:"alert",...x,children:[(0,r.jsx)(o,{className:"mb-3 text-[color:var(--brand-primary,#fd562d)]"}),(0,r.jsx)("h3",{className:"text-base font-semibold",style:{color:"var(--fh-title, #0e0c0e)"},children:t??h("common.error")}),(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-sm",style:{color:"var(--fh-muted, #717171)"},children:d??h("common.errorRetry")}),c?(0,r.jsxs)(i.z,{variant:"primary",size:"sm",className:"mt-5",onClick:c,children:[(0,r.jsx)(s.Z,{className:"h-4 w-4","aria-hidden":"true"}),h("common.retry")]}):u&&(0,r.jsx)("div",{className:"mt-5",children:u})]})}},62560:function(e,a,t){"use strict";t.d(a,{Cf:function(){return n},Em:function(){return s},MF:function(){return b},MZ:function(){return g},QU:function(){return l},Rj:function(){return i},eH:function(){return c},ej:function(){return m},qX:function(){return h},r_:function(){return x},wu:function(){return d}});var r=t(24012);let s=["Electronics","Computers","Phones","Home","Fashion","Beauty","Toys & Kids","Sports","Automotive","Travel","Food & Grocery","Entertainment","Finance","Health","Office","Pets","Other"],i={title:"",description:"",category:"Other",dealUrl:"",imageUrl:"",couponCode:"",cashbackRate:"",discountPercent:"",termsAndConditions:"",minPurchaseCents:"",maxClaims:"",startDate:"",startTime:"10:00",endDate:"",endTime:"23:59",timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"};function n(e){switch(e){case"active":return"Live";case"scheduled":return"Scheduled";case"draft":return"Draft";case"paused":return"Paused";case"expired":return"Expired";case"disabled":return"Disabled";default:return e}}function l(e){switch(e){case"active":return"success";case"scheduled":return"info";case"draft":default:return"neutral";case"paused":return"warning";case"expired":return"default";case"disabled":return"error"}}function d(e){let a=e.timezone||"UTC";return"active"===e.status?"Live now":"scheduled"===e.status&&e.startsAt?`Scheduled for ${m(e.startsAt,a)}`:"expired"===e.status?"Expired":"disabled"===e.status?e.disableReason?`Disabled by Super Admin — ${e.disableReason}`:"Disabled by Super Admin":"paused"===e.status?"Paused by brand — hidden from consumers":"draft"===e.status?"Draft — not visible to consumers":""}function c(e){if(null!=e.discountPercent&&e.discountPercent>0)return`${e.discountPercent}% OFF`;if(e.cashbackRate?.trim())return`${e.cashbackRate.trim()} cashback`;if(null!=e.originalPrice&&null!=e.salePrice&&e.originalPrice>e.salePrice){let a=e.originalPrice-e.salePrice;return`${a.toFixed(0)} OFF`}return e.couponCode?.trim()?`Code: ${e.couponCode.trim()}`:"Brand offer"}function o(e,a){if(!e)return null;let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let r=new Intl.DateTimeFormat("en-CA",{timeZone:a||"UTC",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(t),s=e=>r.find(a=>a.type===e)?.value??"";return{date:`${s("year")}-${s("month")}-${s("day")}`,time:`${s("hour")}:${s("minute")}`}}function m(e,a){if(!e)return"—";try{return new Intl.DateTimeFormat(void 0,{timeZone:a||"UTC",dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}
1catch{return new Date(e).toLocaleString()}}function u(e,a,t){let[r,s,i]=e.split("-").map(Number),[n,l]=a.split(":").map(Number),d=e=>{let a=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(e),r=e=>Number(a.find(a=>a.type===e)?.value??"0");return Date.UTC(r("year"),r("month")-1,r("day"),r("hour"),r("minute"),r("second"))-e.getTime()},c=new Date(Date.UTC(r,s-1,i,n,l,0));return c=new Date(c.getTime()-d(c)),(c=new Date(Date.UTC(r,s-1,i,n,l,0)-d(c))).toISOString()}function x(e,a){let t=!!(e.startDate&&e.endDate&&e.startTime&&e.endTime);if("draft"!==a&&!t)throw Error("Start and end date/time are required");let r=t?u(e.startDate,e.startTime,e.timezone):null,s=t?u(e.endDate,e.endTime,e.timezone):null;if("schedule"===a&&r&&new Date(r).getTime()<=Date.now())throw Error("Scheduled start must be in the future");if(r&&s&&new Date(s).getTime()<=new Date(r).getTime())throw Error("End must be after start");return{title:e.title.trim(),description:e.description.trim()||null,category:e.category,dealUrl:e.dealUrl.trim(),imageUrl:e.imageUrl.trim()||null,couponCode:e.couponCode.trim()||null,cashbackRate:e.cashbackRate.trim()||null,discountPercent:e.discountPercent?Number(e.discountPercent):null,termsAndConditions:e.termsAndConditions.trim()||null,minPurchaseCents:e.minPurchaseCents?Number(e.minPurchaseCents):null,maxClaims:e.maxClaims?Number(e.maxClaims):null,startsAt:r,expiresAt:s,timezone:t?e.timezone:e.timezone||null,saveAsDraft:"draft"===a,publishNow:"publish"===a}}function h(e){let a=e.timezone||i.timezone,t=o(e.startsAt,a),r=o(e.expiresAt,a);return{...i,title:e.title,description:e.description??"",category:e.category||"Other",dealUrl:e.dealUrl,imageUrl:e.imageUrl??"",couponCode:e.couponCode??"",cashbackRate:e.cashbackRate??"",discountPercent:null!=e.discountPercent?String(e.discountPercent):"",termsAndConditions:e.termsAndConditions??"",minPurchaseCents:null!=e.minPurchaseCents?String(e.minPurchaseCents):"",maxClaims:null!=e.maxClaims?String(e.maxClaims):"",startDate:t?.date??"",startTime:t?.time??"10:00",endDate:r?.date??"",endTime:r?.time??"23:59",timezone:a}}function b(e){return null==e.maxClaims?null:Math.max(0,e.maxClaims-(e.claimCount??0))}function g(e){return(0,r.Dd)(`/brand-portal/deals/${e}`,{skipGeoQueryDefaults:!0})}},19369:function(e,a,t){"use strict";t.d(a,{cn:function(){return i}});var r=t(10607),s=t(25579);function i(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return(0,s.m6)((0,r.W)(a))}},66350:function(e,a,t){"use strict";t.d(a,{Am:function(){return r.Am}});var r=t(17787)}},function(e){e.O(0,[11547,16340,17787,76930,82493,90107,24012,81293,23892,1744],function(){return e(e.s=60519)}),_N_E=e.O()}]);

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.