PageSourceSearch

https://bcard.qa/build/assets/Analytics-CWiO8UPp.js

js bcard.qa collected 2026-10-06 17:11:00 UTC 12,617 bytes, 1 lines download raw bytes

1import{d as D,C as T,c as r,a as v,u,h as E,b as e,F as n,B as P,w as O,g as H,l as F,f as c,j as x,e as b,m as I,n as m,p as g,t as l,y as f,E as M,o as a}from"./app-DyV-_0Vp.js";import{_ as Q}from"./DashboardLayout.vue_vue_type_script_setup_true_lang-BsgSWxKf.js";import{C as $,a as q,L as U,P as W,b as Z,A as G,B as J,f as K,p as X,c as Y,i as ee,d as te,D as se,e as ae}from"./index-NgHoaTKW.js";import"./WhatsAppSupport-DEmMbMdH.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./useDarkMode-BiH1Tb9I.js";import"./BrandLogo-g8RR2pmr.js";const oe={class:"px-4 py-6 lg:px-6 lg:py-8 space-y-6"},re={class:"rounded-2xl bg-gradient-to-br from-indigo-600 to-purple-600 p-8 text-white"},ie={class:"max-w-xl"},le={class:"grid grid-cols-2 md:grid-cols-4 gap-3 opacity-50 pointer-events-none select-none"},ne={class:"text-xs text-gray-500"},de={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},ce={class:"flex items-center gap-2 flex-wrap"},ue=["value"],ge=["value"],pe={class:"flex rounded-lg border border-gray-200 overflow-hidden"},ye=["onClick"],xe={key:0,class:"rounded-[var(--radius-card)] border-2 border-dashed border-gray-200 p-16 text-center"},be={class:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3"},ve={class:"flex items-center justify-between mb-2"},me={class:"text-[10px] font-semibold uppercase tracking-wider text-gray-500"},fe={class:"font-display text-2xl font-extrabold text-gray-900"},he={class:"rounded-[var(--radius-card)] border border-gray-200 bg-white p-5"},ke={class:"h-72"},_e={key:1,class:"h-full flex items-center justify-center text-sm text-gray-400"},we={class:"grid lg:grid-cols-3 gap-4"},Ce={class:"lg:col-span-2 rounded-[var(--radius-card)] border border-gray-200 bg-white p-5"},Se={key:0,class:"py-8 text-center text-sm text-gray-400"},Re={key:1,class:"space-y-2"},ze={class:"text-xs font-bold text-gray-400 w-5 shrink-0"},Ae={class:"flex-1 min-w-0"},Le={class:"text-sm font-medium text-gray-900 truncate"},Ne={class:"text-[10px] text-gray-400 truncate"},Ve={class:"text-right shrink-0"},je={class:"text-sm font-semibold text-gray-900"},Be={class:"text-[10px] text-gray-400"},De={class:"w-16 h-1.5 rounded-full bg-gray-100 overflow-hidden shrink-0"},Te={class:"rounded-[var(--radius-card)] border border-gray-200 bg-white p-5"},Ee={class:"h-48"},Pe={key:1,class:"h-full flex items-center justify-center text-sm text-gray-400"},Oe={key:0,class:"mt-4 space-y-1.5"},He={class:"text-gray-700"},Fe={class:"font-semibold text-gray-900"},Ie={class:"grid lg:grid-cols-2 gap-4"},Me={class:"rounded-[var(--radius-card)] border border-gray-200 bg-white p-5"},Qe={class:"h-40"},$e={key:1,class:"h-full flex items-center justify-center text-sm text-gray-400"},qe={class:"rounded-[var(--radius-card)] border border-gray-200 bg-white p-5"},Ue={class:"grid grid-cols-2 gap-4"},We={key:0,class:"text-xs text-gray-400"},Ze={key:1,class:"space-y-1.5"},Ge={class:"text-gray-700"},Je={class:"font-semibold text-gray-900"},Ke={key:0,class:"text-xs text-gray-400"},Xe={key:1,class:"space-y-1.5"},Ye={class:"text-gray-700 truncate mr-2"},et={class:"font-semibold text-gray-900 shrink-0"},nt=D({layout:Q,__name:"Analytics",props:{cards:{},selectedCardId:{},period:{},maxPeriod:{},locked:{type:Boolean},analytics:{}},setup(i){$.register(q,U,W,Z,G,J,K,X,Y,ee);const d=i,h=[{value:"today",label:"Today"},{value:"7d",label:"7 Days"},{value:"30d",label:"30 Days"},{value:"90d",label:"90 Days"}],k=I(!1);T(()=>{k.value=!0});function _(o){m.get("/dashboard/analytics",{card:d.selectedCardId,period:o},{preserveState:!0,preserveScroll:!0})}function w(o){m.get("/dashboard/analytics",{card:o,period:d.period},{preserveState:!0,preserveScroll:!0})}function C(){window.location.href=`/dashboard/analytics/export?card=${d.selectedCardId}&period=${d.period}`}function y(o,s){return s===0?o>0?100:0:Math.round((o-s)/s*100)}const S=g(()=>d.analytics?.stats),R=g(()=>{const o=S.value;return o?[{label:"Views",value:o.views,prev:o.prev_views,color:"#6831f5"},{label:"QR Scans",value:o.qr_scans,color:"#f59e0b"},{label:"Link Clicks",value:o.link_clicks,prev:o.prev_link_clicks,color:"#10b981"},{label:"vCard Downloads",value:o.vcard_downloads,color:"#0ea5e9"},{label:"Shares",value:o.shares,color:"#f43f5e"}]:[]}),z=g(()=>{const o=d.analytics?.timeline??[];return{labels:o.map(s=>s.date),datasets:[{label:"Views",data:o.map(s=>s.views),borderColor:"#6831f5",backgroundColor:"rgba(104, 49, 245, 0.08)",fill:!0,tension:.4,pointRadius:3,pointHoverRadius:6},{label:"QR Scans",data:o.map(s=>s.qr_scans),borderColor:"#f59e0b",backgroundColor:"transparent",tension:.4,pointRadius:2,pointHoverRadius:5},{label:"Link Clicks",data:o.map(s=>s.link_clicks),borderColor:"#10b981",backgroundColor:"transparent",tension:.4,pointRadius:2,pointHoverRadius:5}]}}),A={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"top",labels:{usePointStyle:!0,pointStyle:"circle",padding:16,font:{size:11}}}
1,tooltip:{backgroundColor:"#160537",titleFont:{size:12},bodyFont:{size:11},padding:10,cornerRadius:8}},scales:{x:{grid:{display:!1},ticks:{font:{size:10},maxRotation:0}},y:{beginAtZero:!0,grid:{color:"rgba(104,49,245,0.06)"},ticks:{font:{size:10}}}}},L=g(()=>{const o=d.analytics?.devices.devices??[],s={desktop:"#6831f5",mobile:"#f59e0b",tablet:"#10b981"};return{labels:o.map(t=>t.label.charAt(0).toUpperCase()+t.label.slice(1)),datasets:[{data:o.map(t=>t.count),backgroundColor:o.map(t=>s[t.label]??"#94a3b8"),borderWidth:0,hoverOffset:4}]}}),N={responsive:!0,maintainAspectRatio:!1,cutout:"70%",plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,pointStyle:"circle",padding:12,font:{size:11}}}}},V=g(()=>{const o=d.analytics?.referrers??[],s={Direct:"#6831f5",Social:"#f59e0b",Search:"#10b981",Other:"#94a3b8"};return{labels:o.map(t=>t.source),datasets:[{data:o.map(t=>t.count),backgroundColor:o.map(t=>s[t.source]??"#94a3b8"),borderRadius:6,barThickness:32}]}}),j={responsive:!0,maintainAspectRatio:!1,indexAxis:"y",plugins:{legend:{display:!1}},scales:{x:{beginAtZero:!0,grid:{color:"rgba(104,49,245,0.06)"},ticks:{font:{size:10}}},y:{grid:{display:!1},ticks:{font:{size:11,weight:500}}}}};function B(o){return o>=1e4?(o/1e3).toFixed(1)+"k":o.toLocaleString()}return(o,s)=>(a(),r(n,null,[v(u(E),{title:"Analytics"}),e("div",oe,[i.locked?(a(),r(n,{key:0}
1,[e("div",re,[e("div",ie,[s[2]||(s[2]=P('<div class="flex items-center gap-2 mb-2"><svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg><span class="text-xs font-bold uppercase tracking-widest text-white/80">Locked feature</span></div><h1 class="font-display text-2xl font-extrabold">Analytics is a Pro feature</h1><p class="mt-2 text-sm text-white/90"> Track views, QR scans, link clicks, wallet installs, device breakdown, locations, and referrers across every card. Upgrade to unlock detailed engagement insights. </p>',3)),v(u(F),{href:"/dashboard/upgrade?reason=analytics",class:"mt-5 inline-flex items-center gap-2 rounded-lg bg-white px-5 py-2.5 text-sm font-semibold text-indigo-700 hover:bg-white/90 transition"},{default:O(()=>[...s[1]||(s[1]=[H(" View plans & upgrade ",-1),e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","stroke-width":"2"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})],-1)])]),_:1})])]),e("div",le,[(a(),r(n,null,c(["Views","QR Scans","Link Clicks","Wallet Installs"],(t,p)=>e("div",{key:p,class:"rounded-xl border border-gray-200 bg-white p-4 blur-[2px]"},[e("p",ne,l(t),1),s[3]||(s[3]=e("p",{class:"font-display text-2xl font-extrabold text-gray-900 mt-1"},"—",-1))])),64))])],64)):(a(),r(n,{key:1},[e("div",de,[s[4]||(s[4]=e("div",null,[e("h1",{class:"font-display text-2xl font-extrabold text-gray-900"},"Analytics"),e("p",{class:"text-sm text-gray-600"},"Track engagement across your digital cards.")],-1)),e("div",ce,[i.cards.length>1?(a(),r("select",{key:0,value:i.selectedCardId??"",onChange:s[0]||(s[0]=t=>w(Number(t.target.value))),class:"rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm outline-none focus:border-gray-900"},[(a(!0),r(n,null,c(i.cards,t=>(a(),r("option",{key:t.id,value:t.id},l(t.name),9,ge))),128))],40,ue)):x("",!0),e("div",pe,[(a(),r(n,null,c(h,t=>e("button",{key:t.value,onClick:p=>_(t.value),class:f(["px-3 py-1.5 text-xs font-medium transition-colors",i.period===t.value?"bg-gray-900 text-white":"text-gray-600 hover:bg-gray-50"])},l(t.label),11,ye)),64))]),e("button",{onClick:C,class:"rounded-lg border border-gray-200 px-3 py-1.5 text-xs font-medium text-gray-600 hover:bg-gray-50 transition"}," Export CSV ")])]),!i.analytics||i.cards.length===0?(a(),r("div",xe,[...s[5]||(s[5]=[e("svg",{class:"mx-auto h-12 w-12 text-gray-500 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})],-1),e("p",{class:"text-gray-600"},"Publish a card and share it to start seeing analytics data.",-1)])])):(a(),r(n,{key:1},[e("div",be,[(a(!0),r(n,null,c(R.value,t=>(a(),r("div",{key:t.label,class:"rounded-[var(--radius-card)] border border-gray-200 bg-white p-4"},[e("div",ve,[e("span",me,l(t.label),1),t.prev!==void 0?(a(),r("div",{key:0,class:f(["text-[10px] font-semibold",y(t.value,t.prev)>=0?"text-success-500":"text-error-500"])},l(y(t.value,t.prev)>=0?"+":"")+l(y(t.value,t.prev))+"% ",3)):x("",!0)]),e("p",fe,l(B(t.value)),1)]))),128))]),e("div",he,[s[6]||(s[6]=e("h3",{class:"font-display text-sm font-bold text-gray-900 mb-4"},"Engagement Over Time",-1)),e("div",ke,[i.analytics.timeline.length>0?(a(),b(u(te),{key:0,data:z.value,options:A},null,8,["data"])):(a(),r("div",_e,"No data for this period"))])]),e("div",we,[e("div",Ce,[s[7]||(s[7]=e("h3",{class:"font-display text-sm font-bold text-gray-900 mb-4"},"Top Links",-1)),i.analytics.topLinks.length===0?(a(),r("div",Se,"No link clicks yet")):(a(),r("div",Re,[(a(!0),r(n,null,c(i.analytics.topLinks,(t,p)=>(a(),r("div",{key:t.id,class:"flex items-center gap-3 rounded-lg px-3 py-2 hover:bg-gray-50/50 transition"},[e("span",ze,l(p+1),1),e("div",Ae,[e("p",Le,l(t.label),1),e("p",Ne,l(t.url),1)]),e("div",Ve,[e("p",je,l(t.clicks),1),e("p",Be,l(t.pct)+"%",1)]),e("div",De,[e
1("div",{class:"h-full rounded-full bg-gray-900 transition-all",style:M({width:t.pct+"%"})},null,4)])]))),128))]))]),e("div",Te,[s[9]||(s[9]=e("h3",{class:"font-display text-sm font-bold text-gray-900 mb-4"},"Devices",-1)),e("div",Ee,[i.analytics.devices.devices.length>0?(a(),b(u(se),{key:0,data:L.value,options:N},null,8,["data"])):(a(),r("div",Pe,"No data"))]),i.analytics.devices.os.length>0?(a(),r("div",Oe,[s[8]||(s[8]=e("p",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-2"},"Operating Systems",-1)),(a(!0),r(n,null,c(i.analytics.devices.os,t=>(a(),r("div",{key:t.label,class:"flex items-center justify-between text-xs"},[e("span",He,l(t.label),1),e("span",Fe,l(t.count),1)]))),128))])):x("",!0)])]),e("div",Ie,[e("div",Me,[s[10]||(s[10]=e("h3",{class:"font-display text-sm font-bold text-gray-900 mb-4"},"Traffic Sources",-1)),e("div",Qe,[i.analytics.referrers.length>0?(a(),b(u(ae),{key:0,data:V.value,options:j},null,8,["data"])):(a(),r("div",$e,"No data"))])]),e("div",qe,[s[13]||(s[13]=e("h3",{class:"font-display text-sm font-bold text-gray-900 mb-4"},"Geography",-1)),e("div",Ue,[e("div",null,[s[11]||(s[11]=e("p",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-2"},"Top Countries",-1)),i.analytics.locations.countries.length===0?(a(),r("div",We,"No data")):(a(),r("div",Ze,[(a(!0),r(n,null,c(i.analytics.locations.countries,t=>(a(),r("div",{key:t.code,class:"flex items-center justify-between text-xs"},[e("span",Ge,l(t.code),1),e("span",Je,l(t.count),1)]))),128))]))]),e("div",null,[s[12]||(s[12]=e("p",{class:"text-[10px] font-semibold uppercase tracking-wider text-gray-400 mb-2"},"Top Cities",-1)),i.analytics.locations.cities.length===0?(a(),r("div",Ke,"No data")):(a(),r("div",Xe,[(a(!0),r(n,null,c(i.analytics.locations.cities,t=>(a(),r("div",{key:t.name,class:"flex items-center justify-between text-xs"},[e("span",Ye,l(t.name),1),e("span",et,l(t.count),1)]))),128))]))])])])])],64))],64))])],64))}});export{nt 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.