PageSourceSearch

https://v3.quickbox.io/_next/static/chunks/32713-821c7b5a4683af7a.js

js quickbox.io collected 2026-10-01 12:30:47 UTC 18,495 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[32713],{32713:(e,t,s)=>{s.r(t),s.d(t,{default:()=>u});var r=s(95155),a=s(52619),o=s.n(a),n=s(96199),i=s(20063),d=s(58261),l=s(12115),c=s(15927),x=s(34513),m=s(1559);let h={BRONZE:{from:"#5a3b1a",to:"#8c6239",border:"#b18046",text:"#f5d0a1"},SILVER:{from:"#4b5563",to:"#9ca3af",border:"#d1d5db",text:"#e5e7eb"},GOLD:{from:"#a16207",to:"#f59e0b",border:"#fbbf24",text:"#fef3c7"},PLATINUM:{from:"#475569",to:"#c7d2fe",border:"#e0e7ff",text:"#f8fafc"}};function u(){let{data:e,status:t}=(0,n.wV)(),s=(0,i.useRouter)(),a=(0,m.d)(),[u,b]=(0,l.useState)(null),[p,g]=(0,l.useState)({balanceCents:0,ledger:[]}),[f,y]=(0,l.useState)([]),[j,N]=(0,l.useState)(null),[v,w]=(0,l.useState)(!0),[E,A]=(0,l.useState)(!1),[F,k]=(0,l.useState)(!1),[C,S]=(0,l.useState)(!1),[D,P]=(0,l.useState)(!1),[R,T]=(0,l.useState)(500),[L,U]=(0,l.useState)(500);(0,l.useEffect)(()=>{"unauthenticated"===t&&(0,d.j)(s)},[t,s]),(0,l.useEffect)(()=>{"authenticated"===t&&M()},[t]);let M=async()=>{w(!0),await Promise.all([$(),V(),O()]),w(!1)},$=async()=>{A(!0);try{let e=await fetch("/api/user/loyalty/summary");if(e.ok){let t=await e.json();b(t)}}catch(e){console.error("Error fetching loyalty summary:",e),a.error("Unable to load loyalty summary right now.")}finally{A(!1)}},V=async()=>{k(!0);try{let e=await fetch("/api/user/credits/summary");if(!e.ok)throw Error("Failed to load credits");let t=await e.json();g(t)}catch(e){console.error("Credit summary error:",e),a.error("Unable to load site credits right now.")}finally{k(!1)}},O=async()=>{try{let e=await fetch("/api/user/coupons");if(!e.ok)throw Error("Failed to load coupons");let t=await e.json();y(t.coupons||[])}catch(e){console.error("User coupons error:",e),a.error("Unable to load your coupons right now.")}},B=async()=>{if(!u)return;let e=Math.max(1,Math.floor(R));if(e>u.pointsBalance)return void a.error("You do not have that many points to redeem.");if(!u.goodStanding.ok)return void a.error("Resolve account holds before redeeming points.");S(!0);try{let t=await fetch("/api/user/loyalty/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({points:e})});if(!t.ok){let e=await t.json();throw Error(e.error||"Could not redeem points")}let s=await t.json();a.success("Coupon ".concat(s.couponCode," created for $").concat(s.discountValue,". See below to copy it!")),T(500),await Promise.all([$(),O()])}catch(e){console.error("Redeem error:",e),a.error(e.message||"Could not redeem points")}finally{S(!1)}},I=async()=>{if(!u)return;let e=Math.max(1,Math.floor(L));if(e>(u.pointsBalance||0))return void a.error("You do not have that many points to redeem.");if(!u.goodStanding.ok)return void a.error("Resolve account holds before redeeming points.");P(!0);try{let t=await fetch("/api/user/credits/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({points:e})});if(!t.ok){let e=await t.json();throw Error(e.error||"Could not redeem to credits")}let s=((await t.json()).creditAddedCents/100).toFixed(2);a.success("Converted ".concat(e," pts into $").concat(s," site credits.")),U(500),await Promise.all([$(),V()])}catch(e){console.error("Redeem to credits error:",e),a.error(e.message||"Could not redeem to credits")}finally{P(!1)}},Y=async e=>{try{await navigator.clipboard.writeText(e),N(e),a.success("Coupon code copied to clipboard!"),setTimeout(()=>N(null),2e3)}catch(e){a.error("Failed to copy coupon code")}},G=e=>e.charAt(0)+e.slice(1).toLowerCase(),H=u&&h[u.tier]||h.BRONZE,_=(0,l.useMemo)(()=>(null==u?void 0:u.nextTier)?Math.min(100,Math.round(u.pointsTotal/u.nextTier.required*100)):100,[u]),W=(null==u?void 0:u.goodStanding.ok)&&((null==u?void 0:u.pointsBalance)||0)>0,J=(p.balanceCents||0)/100;return"loading"===t||v||E?(0,r.jsx)(x.N,{children:(0,r.jsx)("div",{className:"min-h-[60vh] flex items-center justify-center",children:(0,r.jsxs)(c.P.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"text-center",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-[#26AE7F] mx-auto mb-4"}),(0,r.jsx)("p",{className:"text-gray-400",children:"Loading loyalty..."})]})})}):e?(0,r.jsxs)(x.N,{children:[(0,r.jsxs)("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-3xl font-bold",children:"Rewards Center"}),(0,r.jsx)("p",{className:"text-gray-400",children:"Track your points, convert them to coupons or site credits, and stay in good standing."})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(o(),{href:"/dashboard/plans",className:"px-4 py-2 rounded-lg border border-white/10 text-sm text-gray-200 hover:border-[#26AE7F]/50 hover:text-white",children:"View plans"}),(0,r.jsx)("button",{onClick:M,className:"px-4 py-2 rounded-lg bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] text-sm font-semibold text-black/80 hover:opacity-90",children:"Refresh"})]})]}),u&&(0,r.jsxs)("div",{className:"mb-8 grid lg:grid-cols-3 gap-6",children:[(0,r.jsxs)("div",{className:"lg:col-span-2 p-6 rounded-xl border",style:{background:"linear-gradient(135deg, ".concat(H.from,"33, ").concat(H.to,"22)"),borderColor:"".concat(H.border,"5
15")},children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-gray-400",children:"Current Tier"}),(0,r.jsx)("div",{className:"text-2xl font-bold mt-1",style:{color:H.text},children:G(u.tier)}),(0,r.jsxs)("p",{className:"text-sm text-gray-400 mt-2",children:[u.pointsTotal," lifetime points"]})]}),(0,r.jsx)("span",{className:"px-3 py-1 text-xs font-semibold rounded-full border ".concat(u.goodStanding.ok?"bg-[#26AE7F]/20 text-[#26AE7F] border-[#26AE7F]/30":"bg-[#e7515a]/20 text-[#e7515a] border-[#e7515a]/30"),children:u.goodStanding.ok?"Good standing":"Action needed"})]}),(0,r.jsxs)("div",{className:"grid md:grid-cols-3 gap-4 mt-6",children:[(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/5",children:[(0,r.jsx)("p",{className:"text-xs text-gray-400",children:"Points balance"}),(0,r.jsx)("div",{className:"text-3xl font-bold mt-1",children:u.pointsBalance}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Redeemable now"})]}),(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/5",children:[(0,r.jsx)("p",{className:"text-xs text-gray-400",children:"Next tier"}),u.nextTier?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-lg font-semibold mt-1",children:G(u.nextTier.tier)}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[u.nextTier.remaining," pts to go"]}),(0,r.jsx)("div",{className:"mt-3 h-2 rounded-full bg-gray-800 overflow-hidden",children:(0,r.jsx)("div",{className:"h-full",style:{width:"".concat(_,"%"),background:"linear-gradient(90deg, ".concat(H.from,", ").concat(H.to,")")}})})]}):(0,r.jsx)("p",{className:"text-sm text-gray-300 mt-2",children:"You are at the top tier."})]}),(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/5 space-y-2",children:[(0,r.jsx)("p",{className:"text-xs text-gray-400",children:"Account checks"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,r.jsxs)("span",{className:"px-2 py-1 rounded border ".concat(u.goodStanding.hasDispute?"text-[#e7515a] border-[#e7515a]/40 bg-[#e7515a]/10":"text-[#26AE7F] border-[#26AE7F]/40 bg-[#26AE7F]/10"),children:["Disputes ",u.goodStanding.hasDispute?"open":"clear"]}),(0,r.jsxs)("span",{className:"px-2 py-1 rounded border ".concat(u.goodStanding.fraudHold?"text-[#e7515a] border-[#e7515a]/40 bg-[#e7515a]/10":"text-[#26AE7F] border-[#26AE7F]/40 bg-[#26AE7F]/10"),children:["Fraud ",u.goodStanding.fraudHold?"hold":"clear"]}),(0,r.jsxs)("span",{className:"px-2 py-1 rounded border ".concat(u.goodStanding.suspended?"text-[#e7515a] border-[#e7515a]/40 bg-[#e7515a]/10":"text-[#26AE7F] border-[#26AE7F]/40 bg-[#26AE7F]/10"),children:["Account ",u.goodStanding.suspended?"suspended":"active"]}),(0,r.jsxs)("span",{className:"px-2 py-1 rounded border ".concat(u.goodStanding.paymentValid?"text-[#26AE7F] border-[#26AE7F]/40 bg-[#26AE7F]/10":"text-[#e7515a] border-[#e7515a]/40 bg-[#e7515a]/10"),children:["Payment ",u.goodStanding.paymentValid?"valid":"invalid"]})]})]})]})]}),(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-white/10 bg-gradient-to-br from-[#0f172a]/40 to-[#0b2533]/20",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-gray-400",children:"Site credits"}),(0,r.jsxs)("h3",{className:"text-3xl font-bold text-white mt-1",children:["$",J.toFixed(2)]})]}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Applies to billing offsets"})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-3",children:"Credits can offset payments or extend access; safer for PayPal users."}),(0,r.jsx)("div",{className:"mt-4 space-y-2 max-h-48 overflow-y-auto text-xs text-gray-300",children:F?(0,r.jsx)("p",{className:"text-gray-500",children:"Loading credit history…"}):0===p.ledger.length?(0,r.jsx)("p",{className:"text-gray-500",children:"No credit history yet."}):p.ledger.slice(0,8).map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between py-1 border-b border-white/5 last:border-0",children:[(0,r.jsxs)("span",{className:e.amountCents>=0?"text-[#26AE7F]":"text-[#e7515a]",children:[e.amountCents>=0?"+":"-","$",Math.abs(e.amountCents/100).toFixed(2)]}),(0,r.jsx)("span",{className:"text-gray-400",children:e.reason}),(0,r.jsx)("span",{className:"text-gray-500",children:new Date(e.createdAt).toLocaleDateString()})]},e.id))})]})]}),f.length>0&&(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:"Your Coupons"}),(0,r.jsxs)("p",{className:"text-gray-400 text-sm",children:["Single-use coupons: use them yourself or share with friends!",(0,r.jsx)("span",{className:"text-[#26AE7F] ml-1",children:"Earn 50 points when someone else uses your coupon instead of you \uD83E\uDD1D"})]})]}),(0,r.jsx)(o(),{href:"/dashboard/plans",className:"px-4 py-2 rounded-lg bg-[#26AE7F]/20 text-[#26AE7F] hover:bg-[#26AE7F]/30 text-sm font-semibold border border-[#26AE7F]/30",children:"Go to Plans →"})]}),(0,r.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.map(e=>(0,r.jsxs)("div",{className:"p-5 rounded-xl border ".concat(e.isActive?"border-[#26AE7F]/30 bg-gradient-to-br from-[#26AE7F]/10 to-[#26AE7F]/5":"border-white/10 bg-white/5 opacity-60"),children:[(0,r.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,r.jsx)("div",{children:(0,r.jsx)("span",{className:"inline-block px-2 py-1 text-xs font-semibold rounded ".concat(e.isActive?"bg-[#26AE7F]/20 text-[#26AE7F] border border-[#26AE7F]/30":(e.isExpired,"bg-gray-700 text-gray-400 border border-gray-600")),children:e.isExpired?"Expired":e.isUsed?"Used":"Active"})}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("div",{className:"text-lg font-bold text-white",children:"PERCENTAGE"===e.discountType?"".concat(e.discountValue,"%"):"$".concat(e.discountValue)}),(0,r.jsx)("div",{className:"text-xs text-gray-400",children:"OFF"})]})]}),(0,r.jsxs)("button",{onClick:()=>Y(e.code),disabled:!e.isActive,className:"w-full p-3 rounded-lg font-mono text-sm font-bold flex items-center justify-between transition-all ".concat(e.isActive?"bg-black/40 hover:bg-black/60 text-white border-2 border-[#26AE7F]/40 hover:border-[#26AE7F] curs
1or-pointer":"bg-black/20 text-gray-500 border border-gray-700 cursor-not-allowed"),children:[(0,r.jsx)("span",{children:e.code}),(0,r.jsx)("svg",{className:"w-4 h-4 ".concat(j===e.code?"text-[#26AE7F]":"text-gray-400"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:j===e.code?(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"}):(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]}),(0,r.jsxs)("div",{className:"mt-3 text-xs text-gray-400 space-y-1",children:[e.expiresAt&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Expires:"}),(0,r.jsx)("span",{className:e.isExpired?"text-red-400":"",children:new Date(e.expiresAt).toLocaleDateString()})]}),e.maxUsesPerUser&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Uses:"}),(0,r.jsxs)("span",{children:[e.usageCount," / ",e.maxUsesPerUser]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{children:"Created:"}),(0,r.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]})]})]},e.id))})]}),u&&(0,r.jsxs)("div",{className:"mb-10 grid lg:grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-white/10 bg-gradient-to-br from-white/5 to-white/0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-gray-400",children:"Redeem points"}),(0,r.jsx)("h3",{className:"text-xl font-bold text-white mt-1",children:"Convert to coupon"})]}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Coupons valid 30 days"})]}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("label",{className:"text-xs text-gray-400",children:"Points to spend"}),(0,r.jsx)("input",{type:"number",min:1,value:R,onChange:e=>T(parseInt(e.target.value||"0",10)),className:"mt-2 w-full rounded-lg bg-black/40 border border-white/10 p-3 text-white focus:outline-none focus:ring-2 focus:ring-[#26AE7F]"}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 mt-2",children:["Creates a single-use $",(.01*(R||0)).toFixed(2)," coupon you can apply at checkout. (1 point = $0.01)"]})]}),(0,r.jsx)("button",{onClick:B,disabled:!W||C,className:"mt-4 w-full py-3 rounded-lg font-semibold bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] hover:opacity-90 transition disabled:opacity-40 disabled:cursor-not-allowed",children:C?"Redeeming...":"Create coupon"}),!u.goodStanding.ok&&(0,r.jsx)("p",{className:"text-xs text-[#e7515a] mt-3",children:"Resolve account holds to redeem points."})]}),(0,r.jsxs)("div",{className:"p-6 rounded-xl border border-white/10 bg-gradient-to-br from-white/5 to-white/0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm text-gray-400",children:"Redeem points"}),(0,r.jsx)("h3",{className:"text-xl font-bold text-white mt-1",children:"Convert to site credits"})]}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"1 pt = $0.01 credit"})]}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("label",{className:"text-xs text-gray-400",children:"Points to spend"}),(0,r.jsx)("input",{type:"number",min:1,value:L,onChange:e=>U(parseInt(e.target.value||"0",10)),className:"mt-2 w-full rounded-lg bg-black/40 border border-white/10 p-3 text-white focus:outline-none focus:ring-2 focus:ring-[#26AE7F]"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:"Credits can offset payments or extend access; safer for PayPal users."})]}),(0,r.jsx)("button",{onClick:I,disabled:!W||D,className:"mt-4 w-full py-3 rounded-lg font-semibold bg-gradient-to-r from-[#26AE7F] to-[#2aebcb] hover:opacity-90 transition disabled:opacity-40 disabled:cursor-not-allowed",children:D?"Converting...":"Convert to site credits"}),!u.goodStanding.ok&&(0,r.jsx)("p",{className:"text-xs text-[#e7515a] mt-3",children:"Resolve account holds to redeem points."})]})]}),(0,r.jsxs)("div",{className:"rounded-xl border border-white/10 bg-white/5 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xl font-bold text-white",children:"How points convert"}),(0,r.jsx)("p",{className:"text-gray-400 text-sm",children:"Earn points through purchases and promotions, then convert to coupons or site credits."})]}),(0,r.jsx)(o(),{href:"/docs/v3-portal/loyalty",className:"text-sm text-[#26AE7F] hover:text-[#2aebcb]",children:"View loyalty docs →"})]}),(0,r.jsxs)("div",{className:"grid md:grid-cols-3 gap-4 text-sm text-gray-300",children:[(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/10",children:[(0,r.jsx)("h4",{className:"font-semibold text-white mb-2",children:"Earning"}),(0,r.jsx)("p",{children:"1 point per $1 spent on subscriptions or lifetime bundles."})]}),(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/10",children:[(0,r.jsx)("h4",{className:"font-semibold text-white mb-2",children:"Coupon path"}),(0,r.jsx)("p",{children:"Redeem points into single-use shareable coupons (1 point = $0.01). Use it yourself OR share with someone else to earn 50 bonus points! \uD83E\uDD1D"})]}),(0,r.jsxs)("div",{className:"p-4 rounded-lg bg-black/30 border border-white/10",children:[(0,r.jsx)("h4",{className:"font-semibold text-white mb-2",children:"Credits path"}),(0,r.jsx)("p",{children:"Convert points to site credits (1 point = $0.01) to offset invoices automatically."})]})]}),(0,r.jsx)("div",{className:"mt-4 p-4 rounded-lg bg-gradient-to-r from-[#26AE7F]/10 to-[#2aebcb]/10 border border-[#26AE7F]/30",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"text-2xl",children:"\uD83E\uDD1D"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h4",{className:"font-semibold text-white mb-1",children:"Community Spirit Bonus"}),(0,r.jsxs)("p",{className:"text-sm text-gray-300",children:["When you redeem points for coupons, they're ",(0,r.jsx)("strong",{children:"single-use but shareable"}),"! You can either use the coupon yourself at checkout, or share the code with a friend. If you choose to share it and someone else uses it instead of you, you'll automatically earn ",(0,r.jsx)("strong",{className:"text-[#26AE7F]",children:"50 bonus points"})," as a thank you for being community-spirited. It's a generous way to help others while still earning rewards!"]})]})]})})]})]}):null}}}]);

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.