Files
boc/backups/2026-07-12-1023/landvex-prod/assets/ROICalculator-DVEYTdny.js
T

7 lines
8.8 KiB
JavaScript
Raw Normal View History

import{o as Y,r as n,b6 as v,M as U,T as V,S as _,j as e,x as Z,ag as ee,ah as se,ak as ae,v as C,q as R,y as te,s as m,al as M}from"./index-oAPVDf-r.js";import{B as y}from"./badge-Qwi4CUXx.js";import{C as ie,S as P,a as E,b as A,c as B,d as I}from"./select-Bi-TzF3J.js";import{T as D}from"./trending-up-Be0ZnpBQ.js";import{C as re}from"./chevron-down-QDDHZwZg.js";import{A as ne}from"./index-B-MEeiYV.js";import{E as le}from"./eye-G89nJUb2.js";import{M as ce}from"./megaphone-CztbyYca.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const de=Y("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]),L=[{id:"stockholm",name:"Stockholm",population:975e3,baseReach:85e4},{id:"gothenburg",name:"Göteborg",population:58e4,baseReach:49e4},{id:"malmo",name:"Malmö",population:35e4,baseReach:295e3},{id:"uppsala",name:"Uppsala",population:18e4,baseReach:15e4},{id:"vasteras",name:"Västerås",population:13e4,baseReach:105e3},{id:"orebro",name:"Örebro",population:125e3,baseReach:1e5},{id:"linkoping",name:"Linköping",population:115e3,baseReach:92e3},{id:"helsingborg",name:"Helsingborg",population:11e4,baseReach:88e3},{id:"national",name:"Hela Sverige",population:105e5,baseReach:82e5}],F=[{id:"all",name:"Alla målgrupper",multiplier:1,icon:v},{id:"commuters",name:"Pendlare",multiplier:.35,icon:U},{id:"shoppers",name:"Shoppare",multiplier:.28,icon:V},{id:"nightlife",name:"Nattliv",multiplier:.15,icon:_},{id:"families",name:"Familjer",multiplier:.22,icon:v},{id:"business",name:"Affärsresenärer",multiplier:.12,icon:D}],T=[{id:"mission_banner",name:"Uppdragsbanderoll",cpm:45,visibility:.85},{id:"photo_watermark",name:"Fotovattenstämpel",cpm:25,visibility:.95},{id:"app_splash",name:"App-splash",cpm:120,visibility:.7},{id:"completion_screen",name:"Slutförandeskärm",cpm:65,visibility:.9},{id:"map_pin",name:"Kartmarkör",cpm:35,visibility:.6}],fe=()=>{const[p,K]=n.useState(!0),[u,O]=n.useState("stockholm"),[g,z]=n.useState("all"),[c,G]=n.useState([5e3]),[d,H]=n.useState([7]),[j,$]=n.useState(["mission_banner","photo_watermark"]),i=n.useMemo(()=>{const s=L.find(a=>a.id===u),o=F.find(a=>a.id===g),t=Math.floor(s.baseReach*o.multiplier),l=T.filter(a=>j.includes(a.id)),k=l.length>0?l.reduce((a,b)=>a+b.cpm,0)/l.length:50,w=l.length>0?l.reduce((a,b)=>a+b.visibility,0)/l.length:.75,S=Math.floor(c[0]/k*1e3),J=1+Math.min(d[0],30)/100,r=Math.min(Math.floor(S*w*J),t),Q=(r/t*100).toFixed(1),W=r>0?(c[0]/r).toFixed(3):"0",X=(w*100).toFixed(0),N={excellent:r>t*.3,good:r>t*.15,moderate:r>t*.05};let x="Låg",h="text-muted-foreground";return N.excellent?(x="Utmärkt",h="text-green-500"):N.good?(x="Bra",h="text-primary"):N.moderate&&(x="Moderat",h="text-amber-500"),{audienceReach:t,totalReach:r,reachPercentage:Q,costPerReach:W,effectiveRate:X,estimatedImpressions:S,avgCpm:k,roiLabel:x,roiColor:h}},[u,g,c,d,j]),q=s=>{$(o=>o.includes(s)?o.filter(t=>t!==s):[...o,s])},f=s=>s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString();return e.jsxs(Z,{className:"glass-card overflow-hidden",children:[e.jsx(ee,{className:"cursor-pointer hover:bg-secondary/20 transition-colors",onClick:()=>K(!p),children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(de,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsxs(se,{className:"text-lg flex items-center gap-2",children:["ROI-kalkylator",e.jsx(y,{variant:"secondary",className:"text-xs",children:"Beta"})]}),e.jsx(ae,{children:"Beräkna förväntad synlighet och kostnad"})]})]}),e.jsx(C,{variant:"ghost",size:"icon",children:p?e.jsx(ie,{className:"w-5 h-5"}):e.jsx(re,{className:"w-5 h-5"})})]})}),e.jsx(ne,{children:p&&e.jsx(R.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3},children:e.jsxs(te,{className:"space-y-6 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4 text-muted-foreground"}),"Geografiskt område"]}),