PageSourceSearch

https://ylnk.app/_nuxt/O3kbtRnW.js

js ylnk.app collected 2026-10-09 21:28:46 UTC 18,267 bytes, 1 lines download raw bytes

1import{d as pt,g as ft,e as _,U as xt,r as x,i as z,h as H,o as bt,n,v as t,t as b,s as j,G as l,p as o,L as B,y as g,a9 as E,C as $,H as k,I as D,x as I,z as C,J as gt,F as ht,q as r,D as M,E as yt,K as vt}from"#entry";import{u as _t}from"./etuXduY-.js";const wt={class:"min-h-screen bg-default"},kt={class:"mb-6 overflow-hidden rounded-[2rem] border border-default bg-default shadow-sm"},Dt={class:"relative isolate overflow-hidden p-5 sm:p-7"},It={class:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between"},Ct={class:"min-w-0"},Lt={class:"mt-6 flex flex-wrap items-center gap-2"},St={class:"rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-xs font-black uppercase tracking-[0.18em] text-primary"},At={class:"rounded-full border border-default bg-muted/40 px-3 py-1 text-xs font-black uppercase tracking-[0.18em] text-muted"},Ot={class:"mt-4 max-w-5xl text-5xl font-black leading-[0.9] tracking-[-0.07em] text-highlighted sm:text-6xl"},Rt={class:"mt-5 max-w-3xl text-sm leading-6 text-muted sm:text-base"},Tt={class:"w-full rounded-3xl border border-default bg-default/80 p-4 shadow-sm backdrop-blur lg:w-80"},Ft={class:"mt-3 flex gap-2"},Nt={class:"mt-4 grid grid-cols-2 gap-2"},Ut={class:"rounded-2xl border border-default bg-muted/30 p-3"},Vt={class:"mt-1 text-2xl font-black text-highlighted"},Pt={class:"rounded-2xl border border-default bg-muted/30 p-3"},jt={class:"mt-1 text-2xl font-black text-highlighted"},Bt={class:"mt-7 grid gap-3 md:grid-cols-5"},Mt={class:"flex items-center justify-between gap-3"},Kt={class:"text-xs font-semibold text-muted"},zt={class:"mt-2 text-3xl font-black tracking-tight text-highlighted"},Ht={class:"flex h-10 w-10 items-center justify-center rounded-2xl bg-primary/10 text-primary"},Et={class:"mb-6 grid gap-6 xl:grid-cols-[minmax(0,1fr)_420px]"},$t={class:"space-y-6"},qt={class:"rounded-2xl border border-default bg-default p-5 shadow-sm"},Gt={class:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between"},Qt={class:"text-sm text-muted"},Jt={class:"flex flex-wrap items-center gap-2"},Wt=["onClick"],Xt={key:0,class:"mt-4 flex items-center gap-2"},Yt={key:1,class:"mt-4 flex flex-wrap items-center gap-2"},Zt={class:"grid gap-6 lg:grid-cols-[320px_minmax(0,1fr)]"},te={class:"rounded-2xl border border-default bg-default p-5 shadow-sm"},ee={class:"mt-5 space-y-4"},se={class:"mb-2 flex items-center justify-between text-sm"},oe={class:"font-medium text-default"},ae={class:"text-muted"},le={class:"h-2 overflow-hidden rounded-full bg-muted"},de={class:"rounded-2xl border border-default bg-default p-5 shadow-sm"},ne={class:"flex items-start justify-between gap-3"},re={class:"rounded-full bg-muted/50 px-3 py-1 text-xs font-semibold text-muted"},ie={class:"mt-5 grid gap-3 md:grid-cols-2"},ue={key:0,class:"md:col-span-2 rounded-2xl border border-dashed border-default p-8 text-center"},ce={class:"flex items-start justify-between gap-3"},me={class:"flex min-w-0 items-start gap-3"},pe={class:"flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary"},fe={class:"min-w-0"},xe={class:"truncate font-semibold text-highlighted"},be={class:"mt-1 truncate text-xs text-muted"},ge=["onClick"],he={class:"rounded-2xl border border-default bg-default p-5 shadow-sm"},ye={class:"flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between"},ve={class:"text-sm text-muted"},_e={class:"mt-4 overflow-x-auto"},we={class:"min-w-full text-sm"},ke={class:"py-3 font-medium text-highlighted"},De={class:"py-3 text-muted"},Ie={class:"py-3 text-right text-default"},Ce={class:"py-3 text-right text-default"},Le={class:"py-3 text-right text-default"},Se={class:"py-3 text-right text-default"},Ae={key:0},Oe={class:"rounded-2xl border border-default bg-default p-6 shadow-sm xl:sticky xl:top-20 xl:self-start"},Re={class:"flex items-start justify-between gap-3"},Te={class:"flex h-11 w-11 items-center justify-center rounded-2xl bg-primary/10 text-primary"},Fe={class:"mt-5 space-y-4"},Ne={class:"block"},Ue={class:"block"},Ve={class:"max-h-72 space-y-2 overflow-y-auto pr-1"},Pe=["onClick"],je={class:"text-sm font-semibold text-highlighted"},Be={class:"mt-1 line-clamp-1 text-xs text-muted"},Me={key:0,class:"rounded-xl border border-dashed border-default p-3 text-xs text-muted"},Ke={class:"rounded-xl border border-default p-3"},ze={class:"mt-3 block"},He={class:"block"},Ee={key:0,class:"rounded-xl bg-red-50 p-3 text-sm text-red-700 dark:bg-red-500/10 dark:text-red-300"},Qe=pt({__name:"[id]",setup($e){const q=ft(),L=_(()=>String(q.params.id||"")),{colorScheme:h}=xt(),{getCampaign:G,updateCampaign:Q,addAsset:J,removeAsset:W,getAnalytics:X,searchAssets:Y}=_t(),c=x(null),f=x(null),y=x("DRAFT"),S=x(""),O=x(!1),T=x(!1),A=x(""),F=x([]),w=x(null),i=z({type:"SHORT_LINK",assetId:"",label:""}),d=z({mode:"7d",startDate:"",endDate:"",month:new Date().toISOString().slice(0,7)}),Z=[{key:"today",label:"Today"},{key:"yesterday",label:"Last day"},{key:"7d",label:"Last 7 days"},{key:"15d",label:"Last 15 days"},{key:"1m",label:"Last 1 month"},{key:"month",label:"Month/year"},{key:"custom",label:"Custom range"}],tt=_(()=>[{label:"Interactions",value:f.value?.totals?.interactions||0,icon:"i-heroicons-bolt"},{label:"Clicks",value:f.value?.totals?.clicks||0,icon:"i-heroicons-cursor-arrow-rays"},{label:"Profile views",value:f.value?.totals?.profileViews||0,icon:"i-heroicons-user-circle"},{label:"Form submissions",value:f.value?.totals?.formSubmissions||0,icon:"i-heroicons-inbox-arrow-down"},{label:"Blog views",value:f.value?.totals?.blogViews||0,icon:"i-heroicons-newspaper"}]),et=_(()=>{const a=c.value?.assets||[],e=Math.max(a.length,1);return["SHORT_LINK","LINK_FOLIO","FORM","BLOG_POST"].map(m=>{const u=a.filter(p=>p.type===m).length;return{type:m,count:u,percent:Math.round(u/e*100)}})}),N=_(()=>w.value?.assetId||i.assetId.trim()),st=_(()=>i.label.trim()||w.value?.label||void 0),U=_(()=>{const a=new Date,e=u=>u.toISOString().slice(0,10),m=u=>{const p=new Date(a);return p.setUTCDate(p.getUTCDate()-u),p};if(d.mode==="today")return{startDate:e(a),endDate:e(a),label:"Today"};if(d.mode==="yesterday"){const u=m(1);return{startDate:e(u),endDate:e(u),label:"Last day"}}if(d.mode==="7d")return{startDate:e(m(6)),endDate:e(a),label:"Last 7 days"};if(d.mode==="15d")return{startDate:e(m(14)),endDate:e(a),label:"Last 15 days"};if(d.mode==="1m")return{startDate:e(m(29)),endDate:e(a),label:"Last 1 month"};
1if(d.mode==="month"){const[u,p]=d.month.split("-").map(Number),s=new Date(Date.UTC(u,p-1,1)),R=new Date(Date.UTC(u,p,0));return{startDate:e(s),endDate:e(R),label:s.toLocaleDateString(void 0,{month:"long",year:"numeric"})}}return{startDate:d.startDate||void 0,endDate:d.endDate||void 0,label:[d.startDate,d.endDate].filter(Boolean).join(" to ")||"Custom range"}}),K=_(()=>`Showing: ${U.value.label}`),ot=async()=>{c.value=await G(L.value),y.value=c.value.status},v=async()=>{const a=U.value;f.value=await X(L.value,{startDate:a.startDate,endDate:a.endDate})},at=async()=>{await ot();try{await v()}catch{f.value=null}await V()},lt=async()=>{c.value=await Q(L.value,{status:y.value})},V=async()=>{T.value=!0;try{F.value=await Y(i.type,A.value,20)}finally{T.value=!1}},dt=async()=>{if(S.value="",!N.value){S.value="Select an asset or enter an asset ID";return}O.value=!0;try{c.value=await J(L.value,{type:i.type,assetId:N.value,label:st.value}),i.assetId="",i.label="",w.value=null,await v()}catch(a){S.value=a?.message||"Failed to add asset"}finally{O.value=!1}},nt=async a=>{c.value=await W(L.value,a),await v()},rt=async a=>{d.mode=a,await v()},it=a=>({backgroundColor:d.mode===a?h.value.accent:h.value.background,borderColor:d.mode===a?h.value.accent:h.value.border,color:d.mode===a?"#fff":h.value.textPrimary}),ut=a=>a==="ACTIVE"?{backgroundColor:"rgba(16, 185, 129, 0.14)",color:"#059669"}:a==="ARCHIVED"?{backgroundColor:h.value.surface,color:h.value.textSecondary}:{backgroundColor:"rgba(245, 158, 11, 0.14)",color:"#d97706"},P=a=>a==="SHORT_LINK"?"Short Link / QR":a==="LINK_FOLIO"?"LinkFolio":a==="FORM"?"Form":a==="BLOG_POST"?"Blog Post":a||"-",ct=a=>a==="SHORT_LINK"?"i-heroicons-qr-code":a==="LINK_FOLIO"?"i-heroicons-window":a==="FORM"?"i-heroicons-clipboard-document-check":a==="BLOG_POST"?"i-heroicons-newspaper":"i-heroicons-squares-2x2",mt=a=>a?a.replaceAll("_"," ").toLowerCase().replace(/(^|\s)\S/g,e=>e.toUpperCase()):"-";return H(()=>i.type,async()=>{w.value=null,i.assetId="",await V()}),H(A,async()=>{await V()}),bt(at),(a,e)=>{const m=yt,u=gt,p=ht;return r(),n("div",wt,[t("section",kt,[t("div",Dt,[e[14]||(e[14]=t("div",{class:"absolute inset-0 -z-10 bg-[radial-gradient(circle_at_top_left,rgba(238,97,35,0.20),transparent_34%),radial-gradient(circle_at_bottom_right,rgba(34,197,94,0.14),transparent_30%)]"},null,-1)),e[15]||(e[15]=t("div",{class:"absolute right-6 top-6 -z-10 hidden h-44 w-44 rounded-full border border-primary/20 bg-primary/5 lg:block"},null,-1)),e[16]||(e[16]=t("div",{class:"absolute right-24 top-20 -z-10 hidden h-24 w-24 rounded-full border border-default bg-muted/30 lg:block"},null,-1)),t("div",It,[t("div",Ct,[b(u,{to:"/app/campaigns",class:"inline-flex items-center gap-2 text-sm font-medium text-muted hover:text-default"},{default:j(()=>[b(m,{name:"i-heroicons-arrow-left",class:"h-4 w-4"}),e[8]||(e[8]=M(" Campaigns ",-1))]),_:1}),t("div",Lt,[t("span",St,l(mt(o(c)?.goal||"TRAFFIC")),1),t("span",{class:"rounded-full border px-3 py-1 text-xs font-black uppercase tracking-[0.18em]",style:B(ut(o(y)))},l(o(y)),5),t("span",At,l(o(U).label),1)]),t("h1",Ot,l(o(c)?.name||"Loading campaign..."),1),t("p",Rt,l(o(c)?.description||"No description added. Use this workspace to measure QR links, LinkFolio profiles, forms, and blog content together."),1)]),t("div",Tt,[e[13]||(e[13]=t("p",{class:"text-xs font-black uppercase tracking-[0.18em] text-muted"},"Campaign status",-1)),t("div",Ft,[g(t("select",{"onUpdate:modelValue":e[0]||(e[0]=s=>$(y)?y.value=s:null),class:"h-11 min-w-0 flex-1 rounded-xl border border-default bg-muted/40 px-4 text-sm text-default focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20"},[...e[9]||(e[9]=[t("option",{value:"DRAFT"},"Draft",-1),t("option",{value:"ACTIVE"},"Active",-1),t("option",{value:"ARCHIVED"},"Archived",-1)])],512),[[E,o(y)]]),b(p,{class:"rounded-xl px-4 font-medium",color:"primary",size:"md",onClick:lt},{default:j(()=>[...e[10]||(e[10]=[M(" Save ",-1)])]),_:1})]),t("div",Nt,[t("div",Ut,[e[11]||(e[11]=t("p",{class:"text-[11px] font-semibold text-muted"},"Assets",-1)),t("p",Vt,l(o(c)?.assets?.length||0),1)]),t("div",Pt,[e[12]||(e[12]=t("p",{class:"text-[11px] font-semibold text-muted"},"Activity",-1)),t("p",jt,l(o(f)?.totals?.interactions||0),1)])])])]),t("div",Bt,[(r(!0),n(k,null,D(o(tt),s=>(r(),n("div",{key:s.label,class:"rounded-3xl border border-default bg-default/80 p-4 shadow-sm backdrop-blur"},[t("div",Mt,[t("div",null,[t("p",Kt,l(s.label),1),t("p",zt,l(s.value),1)]),t("div",Ht,[b(m,{name:s.icon,class:"h-5 w-5"},null,8,["name"])])])]))),128))])])]),t("section",Et,[t("div",$t,[t("div",qt,[t("div",Gt,[t("div",null,[e[17]||(e[17]=t("h2",{class:"text-lg font-semibold text-highlighted"},"Performance window",-1)),t("p",Qt,l(o(K)),1)]),t("div",Jt,[(r(),n(k,null,D(Z,s=>t("button",{key:s.key,class:"rounded-xl border px-3 py-2 text-xs font-semibold",style:B(it(s.key)),onClick:R=>rt(s.key)},l(s.label),13,Wt)),64))])]),o(d).mode==="month"?(r(),n("div",Xt,[g(t
1("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>o(d).month=s),type:"month",class:"rounded-xl border border-default bg-muted/40 px-3 py-2 text-sm text-default focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",onChange:v},null,544),[[C,o(d).month]])])):I("",!0),o(d).mode==="custom"?(r(),n("div",Yt,[g(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>o(d).startDate=s),type:"date",class:"rounded-xl border border-default bg-muted/40 px-3 py-2 text-sm text-default focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",onChange:v},null,544),[[C,o(d).startDate]]),e[18]||(e[18]=t("span",{class:"text-sm text-muted"},"to",-1)),g(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>o(d).endDate=s),type:"date",class:"rounded-xl border border-default bg-muted/40 px-3 py-2 text-sm text-default focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",onChange:v},null,544),[[C,o(d).endDate]])])):I("",!0)]),t("div",Zt,[t("div",te,[e[19]||(e[19]=t("h2",{class:"text-lg font-semibold text-highlighted"},"Channel mix",-1)),e[20]||(e[20]=t("p",{class:"text-sm text-muted"},"Assets attached to this campaign.",-1)),t("div",ee,[(r(!0),n(k,null,D(o(et),s=>(r(),n("div",{key:s.type},[t("div",se,[t("span",oe,l(P(s.type)),1),t("span",ae,l(s.count),1)]),t("div",le,[t("div",{class:"h-full rounded-full bg-primary",style:B({width:`${s.percent}%`})},null,4)])]))),128))])]),t("div",de,[t("div",ne,[e[21]||(e[21]=t("div",null,[t("h2",{class:"text-lg font-semibold text-highlighted"},"Campaign assets"),t("p",{class:"text-sm text-muted"},"QR links, LinkFolio, forms, and blogs only. yShop is intentionally excluded.")],-1)),t("span",re,l(o(c)?.assets?.length||0)+" assets",1)]),t("div",ie,[o(c)?.assets?.length?I("",!0):(r(),n("div",ue,[b(m,{name:"i-heroicons-squares-plus",class:"mx-auto h-10 w-10 text-primary"}),e[22]||(e[22]=t("p",{class:"mt-3 text-sm font-semibold text-highlighted"},"No assets added yet",-1)),e[23]||(e[23]=t("p",{class:"mt-1 text-sm text-muted"},"Search and attach existing brand assets from the right panel.",-1))])),(r(!0),n(k,null,D(o(c)?.assets||[],s=>(r(),n("div",{key:s.id,class:"group rounded-2xl border border-default bg-muted/20 p-4 transition hover:bg-muted/40"},[t("div",ce,[t("div",me,[t("div",pe,[b(m,{name:ct(s.type),class:"h-5 w-5"},null,8,["name"])]),t("div",fe,[t("p",xe,l(s.label||s.assetId),1),t("p",be,l(P(s.type))+" · "+l(s.publicPath||s.assetId),1)])]),t("button",{class:"rounded-xl px-2 py-1 text-xs font-medium text-red-600 opacity-100 hover:bg-red-50 dark:text-red-300 dark:hover:bg-red-500/10 lg:opacity-0 lg:group-hover:opacity-100",onClick:R=>nt(s.id)}," Remove ",8,ge)])]))),128))])])]),t("div",he,[t("div",ye,[t("div",null,[e[24]||(e[24]=t("h2",{class:"text-lg font-semibold text-highlighted"},"Asset performance",-1)),t("p",ve,l(o(K)),1)])]),t("div",_e,[t("table",we,[e[26]||(e[26]=t("thead",{class:"text-left text-muted"},[t("tr",null,[t("th",{class:"py-3"},"Asset"),t("th",{class:"py-3"},"Type"),t("th",{class:"py-3 text-right"},"Interactions"),t("th",{class:"py-3 text-right"},"Views"),t("th",{class:"py-3 text-right"},"Clicks"),t("th",{class:"py-3 text-right"},"Submissions")])],-1)),t("tbody",null,[(r(!0),n(k,null,D(o(f)?.assets||[],s=>(r(),n("tr",{key:s.campaignAssetId,class:"border-t border-default"},[t("td",ke,l(s.label||s.assetId),1),t("td",De,l(P(s.type)),1),t("td",Ie,l(s.interactions),1),t("td",Ce,l(s.views),1),t("td",Le,l(s.clicks),1),t("td",Se,l(s.submissions),1)]))),128)),o(f)?.assets?.length?I("",!0):(r(),n("tr",Ae,[...e[25]||(e[25]=[t("td",{colspan:"6",class:"border-t border-default py-8 text-center text-sm text-muted"},"No performance data for this window.",-1)])]))])])])])]),t("aside",Oe,[t("div",Re,[e[27]||(e[27]=t("div",null,[t("h2",{class:"text-lg font-semibold text-highlighted"},"Attach asset"),t("p",{class:"text-sm text-muted"},"Search existing campaign assets.")],-1)),t("div",Te,[b(m,{name:"i-heroicons-squares-plus",class:"h-5 w-5"})])]),t("div",Fe,[t("label",Ne,[e[29]||(e[29]=t("span",{class:"text-sm font-medium text-default"},"Type",-1)),g(t("select",{"onUpdate:modelValue":e[4]||(e[4]=s=>o(i).type=s),class:"mt-2 w-full rounded-xl border border-default bg-muted/40 px-4 py-3 text-default focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20"},[...e[28]||(e[28]=[t("option",{value:"SHORT_LINK"},"Short Link / QR",-1),t("option",{value:"LINK_FOLIO"},"LinkFolio",-1),t("option",{value:"FORM"},"Form",-1),t("option",{value:"BLOG_POST"},"Blog Post",-1)])],512),[[E,o(i).type]])]),t("label",Ue,[e[30]||(e[30]=t("span",{class:"text-sm font-medium text-default"},"Search assets",-1)),g(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>$(A)?A.value=s:null),class:"mt-2 w-full rounded-xl border border-default bg-muted/40 px-4 py-3 text-default placeholder:text-muted focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",placeholder:"Search by title, short URL, username, form code, blog slug..."},null,512),[[C,o(A),void 0,{trim:!0}]])]),t("div",Ve,[(r(!0),n(k,null,D(o(F),s=>(r(),n("button",{key:s.assetId,class:vt(["w-full rounded-xl border p-3 text-left transition",o(w)?.assetId===s.assetId?"border-primary bg-muted/70":"border-default bg-default hover:bg-muted/40"]),onClick:R=>w.value=s},[t("p",je,l(s.label),1),t("p",Be,l(s.publicPath||s.description||s.assetId),1)],10,Pe))),128)),!o(T)&&o(F).length===0?(r(),n("p",Me," No asset found. Use the manual ID fallback below if needed. ")):I("",!0)]),t("details",Ke,[e[32]||(e[32]=t("summary",{class:"cursor-pointer text-sm font-medium text-default"},"Manual ID fallback",-1)),t("label",ze,[e[31]||(e[31]=t("span",{class:"text-xs text-muted"},"Asset ID",-1)),g(t("input",{"onUpdate:modelValue":e[6]||(e[6]=s=>o(i).assetId=s),class:"mt-2 w-full rounded-xl border border-default bg-muted/40 px-4 py-3 text-default placeholder:text-muted focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",placeholder:"Paste existing asset ID"},null,512),[[C,o(i).assetId,void 0,{trim:!0}]])])]),t("label",He,[e[33]||(e[33]=t("span",{class:"text-sm font-medium text-default"}
1,"Custom label",-1)),g(t("input",{"onUpdate:modelValue":e[7]||(e[7]=s=>o(i).label=s),class:"mt-2 w-full rounded-xl border border-default bg-muted/40 px-4 py-3 text-default placeholder:text-muted focus:border-primary focus:bg-default focus:outline-none focus:ring-2 focus:ring-primary/20",placeholder:"Optional"},null,512),[[C,o(i).label,void 0,{trim:!0}]])]),b(p,{class:"w-full justify-center rounded-xl font-medium",color:"primary",size:"md",disabled:o(O)||!o(N),onClick:dt},{default:j(()=>[M(l(o(O)?"Adding...":"Add asset"),1)]),_:1},8,["disabled"]),o(S)?(r(),n("p",Ee,l(o(S)),1)):I("",!0)])])])])}}});export{Qe 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.