PageSourceSearch

https://quest-x.ai/_next/static/chunks/app/(admin)/admin/coalition/page-cfd8ffb5678cfc12.js

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

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[19922],{48414:function(e,a,t){Promise.resolve().then(t.bind(t,95777))},95777:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return o}});var r=t(27573),s=t(7653),n=t(66350),i=t(24012);let d=["draft","active","paused","archived"];function l(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)&&"data"in e?e.data:e}function o(){let[e,a]=(0,s.useState)([]),[t,o]=(0,s.useState)([]),[c,m]=(0,s.useState)(!0),[x,p]=(0,s.useState)(null),u=(0,s.useCallback)(async()=>{m(!0);try{let[e,t]=await Promise.all([(0,i.hi)("/coalition/programs",{skipGeoQueryDefaults:!0}),(0,i.hi)("/coalition/admin/pending-requests",{skipGeoQueryDefaults:!0})]),r=l(e),s=l(t);a(Array.isArray(r)?r:[]),o(Array.isArray(s)?s:[])}catch{n.Am.error("Failed to load coalition programs")}finally{m(!1)}},[]);(0,s.useEffect)(()=>{u()},[u]);let h=(e,t)=>a(a=>a.map(a=>a.id===e?{...a,...t}:a)),b=async e=>{let a=Number(e.base_earn_rate);if(!Number.isFinite(a)||a<0||a>5){n.Am.error("Base earn rate must be between 0 and 5");return}p(e.id);try{await (0,i.hi)(`/coalition/programs/${e.id}`,{method:"PATCH",body:{status:e.status,base_earn_rate:a}}),n.Am.success(`Saved ${e.name}`)}catch{n.Am.error(`Failed to save ${e.name}`)}finally{p(null)}},y=async(e,a)=>{p(`${e.program_id}:${e.brand_id}`);try{await (0,i.hi)(`/coalition/programs/${e.program_id}/brands/${e.brand_id}/${a}`,{method:"POST"}),n.Am.success(`${"approve"===a?"Approved":"Rejected"} ${e.brand_name}`),await u()}catch{n.Am.error(`Failed to ${a} ${e.brand_name}`)}finally{p(null)}},g=a=>e.find(e=>e.id===a)?.name??a;return(0,r.jsxs)("div",{className:"p-6","data-qa":"page-admin-coalition",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Coalition programs"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Approve brands that asked to join a coalition, and set each program's status and base earn rate."}),c?(0,r.jsx)("p",{className:"mt-6 text-sm text-gray-400",children:"Loading..."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h2",{className:"mt-8 text-sm font-semibold text-gray-900 dark:text-white",children:"Join requests"}),0===t.length?(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-400",children:"No pending requests."}):(0,r.jsx)("ul",{className:"mt-2 divide-y divide-gray-100 rounded-lg border border-gray-100 dark:divide-white/10 dark:border-white/10",children:t.map(e=>{let a=`${e.program_id}:${e.brand_id}`;return(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-medium",children:e.brand_name}),(0,r.jsxs)("span",{className:"text-gray-500",children:[" wants to join ",g(e.program_id)]})]}),(0,r.jsxs)("span",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",disabled:x===a,onClick:()=>void y(e,"approve"),className:"rounded-md bg-gray-900 px-3 py-1 text-xs font-medium text-white disabled:opacity-50",children:"Approve"}),(0,r.jsx)("button",{type:"button",disabled:x===a,onClick:()=>void y(e,"reject"),className:"rounded-md border border-gray-200 px-3 py-1 text-xs font-medium disabled:opacity-50",children:"Reject"})]})]},a)})}),(0,r.jsx)("h2",{className:"mt-8 text-sm font-semibold text-gray-900 dark:text-white",children:"Programs"}),(0,r.jsx)("div",{className:"mt-2 overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"text-left text-xs text-gray-500",children:[(0,r.jsx)("th",{className:"px-2 py-2",children:"Program"}),(0,r.jsx)("th",{className:"px-2 py-2",children:"Partners"}),(0,r.jsx)("th",{className:"px-2 py-2",children:"Status"}),(0,r.jsx)("th",{className:"px-2 py-2",children:"Base earn rate"}),(0,r.jsx)("th",{className:"px-2 py-2"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>(0,r.jsxs)("tr",{className:"border-t border-gray-100 dark:border-white/10",children:[(0,r.jsxs)("td",{className:"px-2 py-2 font-medium",children:[e.name,(0,r.jsx)("span",{className:"block text-xs font-normal text-gray-400",children:e.points_currency_name})]}),(0,r.jsx)("td",{className:"px-2 py-2 text-gray-500",children:(e.brand_names??[]).join(", ")||"-"}),(0,r.jsx)("td",{className:"px-2 py-2",children:(0,r.jsx)("select",{"aria-label":`Status for ${e.name}`,value:e.status,onChange:a=>h(e.id,{status:a.target.value}),className:"rounded border border-gray-200 px-2 py-1 dark:border-white/10 dark:bg-transparent",children:d.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})}),(0,r.jsx)("td",{className:"px-2 py-2",children:(0,r.jsx)("input",{"aria-label":`Base earn rate for ${e.name}`,type:"number",step:"0.1",min:0,max:5,value:e.base_earn_rate,onChange:a=>h(e.id,{base_earn_rate:a.target.value}),className:"w-24 rounded border border-gray-200 px-2 py-1 dark:border-white/10 dark:bg-transparent"})}),(0,r.jsx)("td",{className:"px-2 py-2 text-right",children:(0,r.jsx)("button",{type:"button",disabled:x===e.id,onClick:()=>void b(e),className:"rounded-md bg-gray-900 px-3 py-1 text-xs font-medium text-white disabled:opacity-50",children:x===e.id?"Saving...":"Save"})})]},e.id))})]})})]})]})}},66350:function(e,a,t){"use strict";t.d(a,{Am:function(){return r.Am}});var r=t(17787)}},function(e){e.O(0,[17787,24012,81293,23892,1744],function(){return e(e.s=48414)}),_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.