1/*! For license information please see 7034.9325e625.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkhive_postify_client||=[]).push([[7034],{7034(e,a,s){s.r(a),s.d(a,{default:()=>y});var t=s(9950),r=s(8429),l=s(6890),i=s(9318),d=s(5332),n=s(4215),c=s(9585),o=s(6958);const x=(0,s(9655).A)("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);var m=s(7737),g=s(2195),h=s(9975),u=s(2607),p=s(7232),b=s(5530),j=s(4414);const y=()=>{var e,a,s,y,v,N,f,w;const[k,A]=(0,t.useState)(null),[S,C]=(0,t.useState)(null),[T,W]=(0,t.useState)([]),[E,L]=(0,t.useState)([]),[R,I]=(0,t.useState)(!0),[P,$]=(0,t.useState)("overview"),B=(0,r.Zp)();(0,t.useEffect)(()=>{D()},[]);const D=async()=>{const e=localStorage.getItem("promotionToken");if(e)try{const a=await b.default.post("/promotion-auth/verify",{},{headers:{Authorization:`Bearer ${e}`}});a.data.success&&(A(a.data.user),await _(e))}catch(a){console.error("Auth verification failed:",a),localStorage.removeItem("promotionToken"),localStorage.removeItem("promotionUser"),B("/promotion-login")}else B("/promotion-login")},_=async e=>{try{const a={Authorization:`Bearer ${e}`},[s,t,r]=await Promise.all([b.default.get("/promotion-dashboard/stats",{headers:a}),b.default.get("/promotion-dashboard/earnings?limit=10",{headers:a}),b.default.get("/promotion-dashboard/withdrawals?limit=10",{headers:a})]);C(s.data.data),W(t.data.data.earnings),L(r.data.data.withdrawals)}catch(a){console.error("Error loading dashboard data:",a),p.oR.error("Failed to load dashboard data")}finally{I(!1)}},z=e=>`PKR ${(null===e||void 0===e?void 0:e.toLocaleString())||0}`,H=e=>{switch(e){case"completed":case"confirmed":case"paid":return"text-green-600 bg-green-100 dark:bg-green-900/30";case"pending":return"text-yellow-600 bg-yellow-100 dark:bg-yellow-900/30";case"processing":return"text-blue-600 bg-blue-100 dark:bg-blue-900/30";case"rejected":case"cancelled":return"text-red-600 bg-red-100 dark:bg-red-900/30";default:return"text-gray-600 bg-gray-100 dark:bg-gray-900/30"}};return R?(0,j.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 to-purple-100 dark:from-primary-900/20 dark:to-purple-900/20 flex items-center justify-center",children:(0,j.jsxs)("div",{className:"text-center",children:[(0,j.jsx)("div",{className:"w-16 h-16 border-4 border-primary-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400",children:"Loading dashboard..."})]})}):(0,j.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 to-purple-100 dark:from-primary-900/20 dark:to-purple-900/20",children:[(0,j.jsx)("div",{className:"bg-white dark:bg-dark-800 shadow-lg",children:(0,j.jsx)("div",{className:"max-w-7xl mx-auto px-4 py-6",children:(0,j.jsxs)("div",{className:"flex items-center justify-between",children:[(0,j.jsxs)("div",{className:"flex items-center gap-4",children:[(0,j.jsx)("div",{className:"w-12 h-12 bg-gradient-to-br from-primary-500 to-purple-600 rounded-full flex items-center justify-center",children:(0,j.jsx)(l.A,{className:"w-6 h-6 text-white"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:null===k||void 0===k?void 0:k.businessName}),(0,j.jsxs)("p",{className:"text-gray-600 dark:text-gray-400",children:["Welcome back, ",null===k||void 0===k?void 0:k.contactPerson]})]})]}),(0,j.jsxs)("div",{className:"flex items-center gap-4",children:[(0,j.jsx)("button",{onClick:()=>B("/promotion-login"),className:"px-4 py-2 text-primary-600 dark:text-primary-400 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-lg transition-colors",children:(0,j.jsx)(i.A,{className:"w-5 h-5"})}),(0,j.jsxs)("button",{onClick:()=>{localStorage.removeItem("promotionToken"),localStorage.removeItem("promotionUser"),p.oR.success("Logged out successfully"),B("/promotion-login")},className:"px-4 py-2 text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors flex items-center gap-2",children:[(0,j.jsx)(d.A,{className:"w-5 h-5"}),"Logout"]})]})]})})}),(0,j.jsxs)("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[(0,j.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[(0,j.jsxs)("div",{className:"bg-white dark:bg-dark-800 rounded-2xl p-6 shadow-lg",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,j.jsx)("div",{className:"w-12 h-12 bg-green-100 dark:bg-green-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(n.A,{className:"w-6 h-6 text-green-600 dark:text-green-400"})}),(0,j.jsx)(c.A,{className:"w-5 h-5 text-green-500"})]}),(0,j.jsx)("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-1",children:z(null===S||void 0===S?void 0:S.totalEarnings)}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Total Earnings"})]}),(0,j.jsxs)("div",{className:"bg-white dark:bg-dark-800 rounded-2xl p-6 shadow-lg",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,j.jsx)("div",{className:"w-12 h-12 bg-blue-100 dar
2k:bg-blue-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(o.A,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"})}),(0,j.jsx)(c.A,{className:"w-5 h-5 text-blue-500"})]}),(0,j.jsx)("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-1",children:z(null===S||void 0===S?void 0:S.availableBalance)}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Available Balance"})]}),(0,j.jsxs)("div",{className:"bg-white dark:bg-dark-800 rounded-2xl p-6 shadow-lg",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,j.jsx)("div",{className:"w-12 h-12 bg-purple-100 dark:bg-purple-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(x,{className:"w-6 h-6 text-purple-600 dark:text-purple-400"})}),(0,j.jsx)(m.A,{className:"w-5 h-5 text-purple-500"})]}),(0,j.jsx)("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-1",children:z(null===S||void 0===S?void 0:S.totalWithdrawn)}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Total Withdrawn"})]}),(0,j.jsxs)("div",{className:"bg-white dark:bg-dark-800 rounded-2xl p-6 shadow-lg",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,j.jsx)("div",{className:"w-12 h-12 bg-orange-100 dark:bg-orange-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(g.A,{className:"w-6 h-6 text-orange-600 dark:text-orange-400"})}),(0,j.jsx)(h.A,{className:"w-5 h-5 text-orange-500"})]}),(0,j.jsx)("h3",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-1",children:(null===S||void 0===S||null===(e=S.campaignStats)||void 0===e?void 0:e.totalCampaigns)||0}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"Total Campaigns"})]})]}),(0,j.jsxs)("div",{className:"bg-white dark:bg-dark-800 rounded-2xl shadow-lg mb-8",children:[(0,j.jsx)("div",{className:"border-b border-gray-200 dark:border-dark-600",children:(0,j.jsx)("nav",{className:"flex space-x-8 px-6",children:[{id:"overview",label:"Overview",icon:g.A},{id:"earnings",label:"Earnings",icon:n.A},{id:"withdrawals",label:"Withdrawals",icon:x}].map(e=>{const a=e.icon;return(0,j.jsxs)("button",{onClick:()=>$(e.id),className:"py-4 px-2 border-b-2 font-medium text-sm flex items-center gap-2 "+(P===e.id?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"),children:[(0,j.jsx)(a,{className:"w-4 h-4"}),e.label]},e.id)})})}),(0,j.jsxs)("div",{className:"p-6",children:["overview"===P&&(0,j.jsx)("div",{className:"space-y-6",children:(0,j.jsxs)("div",{className:"grid md:grid-cols-2 gap-6",children:[(0,j.jsxs)("div",{className:"bg-gradient-to-br from-primary-50 to-blue-50 dark:from-primary-900/20 dark:to-blue-900/20 rounded-xl p-6",children:[(0,j.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Campaign Performance"}),(0,j.jsxs)("div",{className:"space-y-3",children:[(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Total Views:"}),(0,j.jsx)("span",{className:"font-semibold",children:(null===S||void 0===S||null===(a=S.campaignStats)||void 0===a||null===(s=a.totalViews)||void 0===s?void 0:s.toLocaleString())||0})]}),(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Total Clicks:"}),(0,j.jsx)("span",{className:"font-semibold",children:(null===S||void 0===S||null===(y=S.campaignStats)||void 0===y||null===(v=y.totalClicks)||void 0===v?void 0:v.toLocaleString())||0})]}),(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Conversions:"}),(0,j.jsx)("span",{className:"font-semibold",children:(null===S||void 0===S||null===(N=S.campaignStats)||void 0===N||null===(f=N.totalConversions)||void 0===f?void 0:f.toLocaleString())||0})]})]})]}),(0,j.jsxs)("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 dark:from-green-900/20 dark:to-emerald-900/20 rounded-xl p-6",children:[(0,j.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Recent Activity"}),(0,j.jsxs)("div",{className:"space-y-3",children:[(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Recent Earnings:"}),(0,j.jsx)("span",{className:"font-semibold text-green-600",children:z(null===S||void 0===S?void 0:S.recentEarnings)})]}),(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Pending Withdrawals:"}),(0,j.jsx)("span",{className:"font-semibold text-orange-600",children:z(null===S||void 0===S?void 0:S.pendingWithdrawals)})]}),(0,j.jsxs)("div",{className:"flex justify-between",children:[(0,j.jsx)("span",{className:"text-gray-600 dark:text-gray-400",children:"Active Campaigns:"}),(0,j.jsx)("span",{className:"font-semibold",children:(null===S||void 0===S||null===(w=S.campaignStats)||void 0===w?void 0:w.activeCampaigns)||0})]})]})]})]})}),"earnings"===P&&(0,j.jsxs)("div",{children:[(0,j.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,j.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Earnings History"})}),(0,j.jsxs)("div",{className:"space-y-4",children:[T.map(e=>(0,j.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-50 dark:bg-dark-700 rounded-lg",children:[(0,j.jsxs)("div",{className:"flex items-center gap-4",children:[(0,j.jsx)("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(n.A,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),(0,j.jsxs)("div",{children:[(0,j.jsx)("h4",{className:"font-medium text-gray-900 dark:text-white",children:e.campaignName}),(0,j.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:e.paymentDescription})]})]}),(0,j.jsxs)("div",{className:"text-right",children:[(0,j.jsx)("p",{className:"font-semibold text-gray-900 dark:text-white",children:z(e.amount)}),(0,j.jsx)("span",{className:`inline-flex px-2 py-1 rounded-full text-xs font-medium ${H(e.status)}`,children:e.status})]})]},e._id)),0===T.length&&(0,j.jsxs)("div",{className:"text-center py-8",children:[(0,j.jsx)(n.A,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400",children:"No earnings yet"})]})]})]}),"withdrawals"===P&&(0,j.jsxs)("div",{children:[(0,j.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,j.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Withdrawal History"}),(0,j.jsxs)("button",{className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg flex items-center gap-2",children:[(0,j.jsx)(u.A,{className:"w-4 h-4"}),"Request Withdrawal"]})]}),(0,j.jsxs)("div",{className:"space-y-4",children:[E.map(e=>(0,j.jsxs)("div",{className:"flex items-center justify-between p-4 bg-gray-50 dark:bg-dark-700 rounded-lg",children:[(0,j.jsxs)("div",{className:"flex items-center gap-4",children:[(0,j.jsx)("div",{className:"w-10 h-10 bg-blue-100 dar
2k:bg-blue-900/30 rounded-lg flex items-center justify-center",children:(0,j.jsx)(x,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),(0,j.jsxs)("div",{children:[(0,j.jsxs)("h4",{className:"font-medium text-gray-900 dark:text-white",children:["Withdrawal #",e.withdrawalId]}),(0,j.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:new Date(e.requestedAt).toLocaleDateString()})]})]}),(0,j.jsxs)("div",{className:"text-right",children:[(0,j.jsx)("p",{className:"font-semibold text-gray-900 dark:text-white",children:z(e.amount)}),(0,j.jsx)("span",{className:`inline-flex px-2 py-1 rounded-full text-xs font-medium ${H(e.status)}`,children:e.status})]})]},e._id)),0===E.length&&(0,j.jsxs)("div",{className:"text-center py-8",children:[(0,j.jsx)(x,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,j.jsx)("p",{className:"text-gray-600 dark:text-gray-400",children:"No withdrawals yet"})]})]})]})]})]})]})]})}},9585(e,a,s){const t=(0,s(9655).A)("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);s.d(a,["A",0,t])}}]);
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.