1import{j as e,r as l,q as s,P as ot,h as p,a_ as lt,s as ce,a as $,av as V,au as A,c as ct,aw as L,ay as X,aJ as ve,aK as be,aL as v,aM as J,aN as dt,w as Ze,aA as Ke,aq as Q,aO as pt,ad as mt,aP as ut,aQ as xt,aR as gt,aS as ft,aT as ht,aU as vt,aV as bt,aW as jt,aX as yt,aY as wt,V as Mt,ae as re,a9 as Ct,p as Et,aZ as kt,ag as $t,ah as je,a6 as It,n as _t,B as Tt}from"./index-COa8VSU9.js";import{u as St,a as ye}from"./FeatureGating.styled-DdLLHrCl.js";import{u as de,W as Bt}from"./WorkspaceDataContext-BSTuBfzi.js";import{s as Nt,t as Rt,S as Pt,a as Ft,b as At,u as pe,c as Dt,d as Vt}from"./TrendUpIcon-XrDM2Uz2.js";import{u as Wt}from"./MetricSPVIcon-DLzJ7eS5.js";import{N as Ht}from"./NotFound-COGIBTw6.js";import{F as Gt}from"./Forbidden-D_B5TdHB.js";import{S as w}from"./index-DuAHL1yl.js";import{W as Lt}from"./WebsiteAlertBanner-B1Th5k_5.js";import{u as Ot}from"./useObserverIntersecting-UjVzFWH2.js";import{S as W}from"./ClockIcon-MnpBQHNp.js";import{u as te,T as Ut,e as zt,f as Xe,g as Yt,t as qt}from"./Experiments.utils-C3u0kDg8.js";import{D as ae}from"./DataTable-CBNyTQ7b.js";import{T as Zt,a as Kt,A as Xt}from"./Tabs-lcdAni0T.js";import"./Experiments.utils-DGmUIEYt.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;
1n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="0f5edd36-869a-4573-98df-04901fb33bd8",t._sentryDebugIdIdentifier="sentry-dbid-0f5edd36-869a-4573-98df-04901fb33bd8")}catch{}})();const me=l.createContext(void 0),Jt=({children:t,value:n})=>e.jsx(me.Provider,{value:n,children:t}),N=s.section` 2 display: flex; 3 flex-direction: column; 4 gap: var(--space-md); 5`,we=s.div` 6 display: flex; 7 gap: var(--space-xl); 8 max-width: 100%; 9`,D=s(lt)` 10 border-color: var(--color-grayscale-3); 11 gap: ${({$gap:t})=>t??"8px"}; 12 max-height: ${({$maxHeight:t})=>t??"initial"}; 13 max-width: ${({$maxWidth:t})=>t??"100%"}; 14 min-width: ${({$minWidth:t})=>t??"initial"}; 15 ${({$margin:t})=>t?`margin: ${t}`:""}; 16 padding: 16px; 17 text-wrap-style: balance; 18 ${({$name:t})=>t?`grid-area: ${t}`:""}; 19`,Me=s(D)` 20 background: var(--color-grayscale-1); 21 border: none; 22 gap: var(--space-xl); 23`,q=({$size:t})=>t??"16px",G=s.div` 24 background: ${({$color:t})=>t}; 25 border-radius: 100%; 26 max-height: ${q}; 27 max-width: ${q}; 28 min-height: ${q}; 29 min-width: ${q}; 30`,Ce=s(ot)` 31 display: flex; 32 flex-direction: column; 33 gap: 40px; 34 padding: 24px; 35`,Ee=s.div` 36 display: flex; 37 flex-direction: column; 38 gap: 8px; 39 width: 100%; 40`,ke=s(p.H2)` 41 align-items: center; 42 display: inline-flex; 43 font-weight: 500; 44 justify-content: space-between; 45`,$e=s(p.Body)` 46 margin-top: var(--space-sm); 47 text-wrap: balance; 48`,Ie=s.header` 49 align-items: center; 50 display: flex; 51 justify-content: space-between; 52`,R=s.div` 53 align-items: center; 54 display: inline-flex; 55 flex-direction: row; 56 gap: var(--space-xs); 57`,_e=s.div` 58 display: flex; 59 gap: var(--space-xl); 60 width: 100%; 61`,ie=s.span` 62 align-content: center; 63 display: flex; 64 gap: var(--space-sm); 65`,Te=s.div` 66 border: 1px solid var(--color-grayscale-3); 67 border-radius: var(--space-sm); 68 color: var(--color-black); 69 display: flex; 70 flex-direction: column; 71 gap: var(--space-lg); 72 min-width: 300px; 73 padding: var(--space-lg); 74 width: fit-content; 75`,Se=s.div` 76 display: flex; 77 flex-direction: column; 78 gap: 40px 16px; 79`,Qt=s.div` 80 ${p.style.Body}; 81 display: flex; 82 flex-direction: column; 83 gap: var(--space-md); 84`,ei=s.span` 85 display: flex; 86 flex-direction: column; 87 gap: var(--space-md); 88 max-height: ${({$collapsed:t})=>t?"4.5lh":"max-content"}; 89 overflow: ${({$collapsed:t})=>t?"hidden":"auto"}; 90 91 p { 92 text-wrap-style: pretty; 93 } 94`,ti=s.div` 95 display: flex; 96 justify-content: space-between; 97`;s(ce)` 98 align-items: center; 99 display: flex; 100 flex-direction: row; 101 gap: var(--space-xs); 102`;const ne=s(p.Body)` 103 font-weight: 500; 104`,P=s.div` 105 align-items: center; 106 display: inline-flex; 107 gap: var(--space-xs); 108`,ii=()=>{const t=$();return e.jsx(L,{hint:t.formatMessage({id:"experiment.summary.conclusion.ai.beta.tooltip",description:"Experiment page - beta badge tooltip",defaultMessage:"Summary generated using AI. Might contain some inaccuracies."}),kind:"right"})},ni=t=>l.useMemo(()=>t&&Nt(t,{SeparatorParser:{separatorCharacters:[".","!","?"]}}).filter(i=>i.type==="Sentence").map((i,a)=>e.jsx("p",{dangerouslySetInnerHTML:{__html:Rt(i.raw.trim())}},a)),[t]),si=({callback:t})=>{const n=l.useRef(null);return Ot(n,t),e.jsx("div",{ref:n})},Z=({children:t})=>{const n=$(),[i,a]=l.useState(!0),[h,c]=l.useState(!0),m=l.useCallback(()=>{a(g=>!g)},[]),o=l.useCallback(g=>{const[d]=g;if(d!==void 0){if(!i){c(!0);return}c(!1)}},[i]);return e.jsxs(Qt,{children:[e.jsx(ii,{}),e.jsxs(ei,{$collapsed:i,children:[t,e.jsx(si,{callback:o})]}),e.jsxs(ti,{children:[h?e.jsx(ct,{onClick:m,children:i?n.formatMessage({id:"experiment.summary.conclusion.expand",description:"Button's text to expand the summary",defaultMessage:"Read more"}):n.formatMessage({id:"experiment.summary.conclusion.collapse",description:"Button's text to collapse the summary",defaultMessage:"Read less"})}):e.jsx("div",{}),e.jsx("span",{id:"feedback-slot"})]})]})},Be=({loading:t,status:n,data:i})=>{const a=ni(i?.analysis),h=te(),c=$(),m=l.useMemo(()=>
108i?.metric?h(i.metric):null,[i?.metric,h]),o=l.useMemo(()=>m?typeof m.label=="string"?m.label:m.label("",i?.goal?.name):null,[i?.goal?.name,m]),g=l.useMemo(()=>{if(n!==V.Finished&&(!i?.winnerVariant||typeof i.uplift!="number"))return e.jsxs(e.Fragment,{children:[e.jsxs(ie,{children:[e.jsx(W,{}),e.jsx(p.Body,{children:c.formatMessage({id:"experiment.summary.conclusion.wait",description:"Experiment page - no conclusion yet text",defaultMessage:"No winner yet."})})]}),a?e.jsx(Z,{children:a}):null]});if(m&&typeof i?.uplift=="number"&&i.winnerVariant){const d=e.jsxs(e.Fragment,{children:[e.jsx(p.BodyL,{children:o}),e.jsx(p.H2,{children:A(i.uplift,{style:"percent",signDisplay:"exceptZero"})})]});return m.isPositive(i.uplift)?e.jsxs(e.Fragment,{children:[e.jsxs(ie,{children:[e.jsx(Ut,{}),e.jsx(p.BodyL,{$fontWeight:500,children:c.formatMessage({id:"experiment.summary.winner.label",description:"Experiment page - winner label",defaultMessage:"Winner: {winnerVariant}"},{winnerVariant:i.winnerVariant})})]}),e.jsx(Te,{children:d}),a?e.jsx(Z,{children:a}):null]}):e.jsxs(e.Fragment,{children:[e.jsxs(ie,{children:[e.jsx(zt,{}),e.jsx(p.BodyL,{$fontWeight:500,children:c.formatMessage({id:"experiment.summary.loser.label",description:"Experiment page - loser label",defaultMessage:"Loser: {winnerVariant}"},{winnerVariant:i.winnerVariant})})]}),e.jsx(Te,{children:d}),a?e.jsx(Z,{children:a}):null]})}return e.jsxs(e.Fragment,{children:[e.jsx(W,{}),e.jsx(p.Body,{children:a?e.jsx(Z,{children:a}):c.formatMessage({id:"experiment.summary.conclusion.none",description:"Experiment page - not conclusive text",defaultMessage:"Not conclusive."})})]})},[a,i?.uplift,i?.winnerVariant,c,o,m,n]);return t?e.jsxs(Me,{children:[e.jsx(W,{}),e.jsx(w,{$width:"80%"}),e.jsx(w,{}),e.jsx(w,{$width:"70%"})]}):e.jsx(Me,{children:g})},Ne=({loading:t,visitors:n,status:i,duration:a,metric:h})=>{const c=$(),m=te(),o=l.useMemo(()=>{if(!a?.from)return;const x=new Date(a.from),b=a.to?new Date(a.to):void 0;return X(b).diff(X(x),"days")},[a?.to,a?.from]),g=l.useMemo(()=>i===V.Draft?c.formatMessage({id:"experiment.summary.status.draft",description:"Experiment page - summary status - draft",defaultMessage:"Draft"}):i===V.Finished?c.formatMessage({id:"experiment.summary.status.finished",description:"Experiment page - summary status - finished",defaultMessage:"Finished"}):c.formatMessage({id:"experiment.summary.status.published",description:"Experiment page - summary status - published",defaultMessage:"Published"}),[c,i]),d=l.useMemo(()=>{const x=h?m(h):null;return x?typeof x.label=="string"?x.label:x.label(""):null},[h,m]),u=l.useMemo(()=>i===V.Published?"var(--color-green-dark)":i===V.Finished?"var(--color-grayscale-5)":"var(--color-grayscale-4)",[i]);return t?e.jsxs(_e,{children:[e.jsxs(R,{children:[e.jsx(G,{$color:"var(--color-grayscale-4)",$size:"14px"}),e.jsx(P,{children:e.jsx(w,{$width:"10ch"})})]}),e.jsxs(R,{children:[e.jsx(W,{height:20,width:20}),e.jsx(P,{children:e.jsx(w,{$width:"7ch"})})]}),e.jsxs(R,{children:[e.jsx(ve,{height:20,width:20}),e.jsxs(P,{children:[e.jsx(w,{$width:"5ch"}),e.jsx(p.Caption,{children:c.formatMessage({id:"experiment.summary.visitors.label",description:"Experiments page - visitors - label",defaultMessage:"visitors"})})]})]}),e.jsxs(R,{children:[e.jsx(be,{height:20,width:20}),e.jsxs(P,{children:[e.jsx(p.Caption,{children:c.formatMessage({id:"experiment.summary.goal.label",description:"Experiments page - primary goal - label",defaultMessage:"Primary goal:"})}),e.jsx(w,{$width:"5ch"})]})]})]}):e.jsxs(_e,{children:[e.jsxs(R,{children:[e.jsx(G,{$color:u,$size:"14px"}),e.jsx(P,{children:e.jsx(p.Body,{$fontWeight:500,children:g})})]}),e.jsxs(R,{children:[e.jsx(W,{height:20,width:20}),e.jsx(P,{children:e.jsx(ne,{children:!a.from||!a.to?c.formatMessage({id:"experiment.status.duration.not_started",description:"Experiments page - duration - not started",defaultMessage:"Not started"}):c.formatMessage({id:"experiment.status.duration.timespan",description:"Experiments page - duration - experiment was running",defaultMessage:"{duration, plural, one {# day} other {# days }}"},{duration:o})})})]}),e.jsxs(R,{children:[e.jsx(ve,{height:20,width:20}),e.jsx(P,{children:e.jsxs(ne,{children:[A(n,{notation:"compact"}).replace(/[KM]/,x=>` ${x}`),c.formatMessage({id:"experiment.summary.visitors.label",description:"Experiments page - visitors - label",defaultMessage:`{visitorsCount, plural, 109 one { visitor} 110 other { visitors}}`},{visitorsCount:n})]})})]}),d?e.jsxs(R,{children:[e.jsx(be,{height:20,width:20}),e.jsxs(P,{children:[e.jsx(p.Caption,{children:c.formatMessage({id:"experiment.summary.goal.label",description:"Experiments page - primary goal - label",defaultMessage:"Primary goal:"})}),e.jsx(ne,{children:d})]})]}):null]})},ri=s.span` 111 overflow: hidden; 112 text-overflow: ellipsis; 113 white-space: nowrap; 114`,ai=s.span` 115 flex-shrink: 0; 116 white-space: nowrap; 117`,oi=s(L)` 118 max-width: 100%; 119 position: relative; 120`,Re=s.span` 121 max-width: 100%; 122 position: relative; 123`,li=s.span` 124 display: flex; 125`,ci=s.span` 126 position: absolute; 127 visibility: hidden; 128 white-space: wrap; 129`,di=({text:t,tailLength:n})=>{const[i,a]=l.useMemo(()=>[t.slice(0,-n).replace(" ","Â "),t.slice(-n)],[n,t]),h=l.useRef(null),c=l.useRef(null),[m,o]=l.useState(Re);return l.useLayoutEffect(()=>{if(c.current&&h.current){const g=c.current.getBoundingClientRect().width,d=c.current.getBoundingClientRect().height,u=h.current.getBoundingClientRect().width,x=h.current.getBoundingClientRect().height;u>g||x>d?o(oi):o(Re)}},[]),e.jsxs(m,{hint:t,kind:"bottom",children:[e.jsxs(li,{ref:c,children:[e.jsx(ri,{children:i.replaceAll(" ","Â ")}),e.jsx(ai,{children:a})]}),e.jsx(ci,{ref:h,children:t})]})},Pe=({text:t,cutoffAt:n=7,tailLength:i=3})=>
129{if(n==="auto")return e.jsx(di,{tailLength:i,text:t});if(t.length<=n+i)return t;const a=new RegExp(`^(.{${n}})(.+)(.{${i}})$`),h=t.replace(a,"$1â¦$3");return e.jsx(L,{as:"span",hint:t,kind:"bottom",children:h})},ee="16px",Je="var(--space-lg)",pi=`${ee} + ${Je}`,Qe=new Set([J.Popup,J.Embed]);var B=(t=>(t.campaign="campaign",t.revenue="revenue",t.visitor="visitor",t.custom="custom",t))(B||{});const Fe={campaign:[v.CampaignImpressions,v.CampaignEngagements,v.CampaignCtr,v.CampaignConverted,v.CampaignEmailCollected,v.CampaignSmsCollected],revenue:[v.Revenue,v.ConvertedWRevenue,v.OrderValueUsd],visitor:[v.CampaignBounced,v.Pageviews,v.Sessions],custom:[v.GoalConverted,v.GoalRevenue]},mi={metric:v.Unknown,significance:null,value:"-",value_uncertainty:"-",uplift:null,uplift_uncertainty:null,value_suffix:""},ui=s.div` 130{ 131 align-items: center; 132 display: flex; 133 height: 64px; 134 padding: 0; 135 136 ${({$hasReachedSignificance:t})=>t?"font-weight: 500;":""} 137 138 ${({$highlight:t})=>t==="winner"?` 139 background: var(--color-green-light); 140`:t==="loser"?` 141 background: var(--color-red-light); 142`:""} 143}`,xi=s(ui).attrs({role:"rowheader"})``,gi=s.span` 144 padding: 0 var(--space-md); 145`,fi=s.div.attrs({role:"gridcell"})` 146 align-items: center; 147 display: inline-flex; 148 flex: 1; 149 flex-direction: column; 150 gap: 0 var(--space-xs); 151 height: 100%; 152 padding: var(--space-sm) var(--space-lg); 153 ${({$width:t})=>t===void 0?"":`flex-grow: 0; min-width: ${t}; max-width: ${t};`}; 154`,hi=s.div` 155 align-items: flex-end; 156 align-self: flex-start; 157 display: flex; 158 flex-direction: column; 159 margin-left: auto; 160 padding: var(--space-md) 0; 161 ${({$bold:t})=>t?"font-weight: 500;":""}; 162`,vi=s(fi)` 163 flex-direction: row; 164`,et=s(p.BodyL)` 165 align-items: center; 166 display: flex; 167 flex-shrink: 0; 168 flex-wrap: wrap; 169 gap: var(--space-xs); 170 justify-content: flex-end; 171 ${({$highlight:t})=>t==="positive"?"color: var(--color-green-dark);":t==="negative"?"color: var(--color-red-dark);":t==="non-significant"?"color: var(--color-grayscale-4);":""} 172`,bi=s(et).attrs({as:p.Caption})``,ji=s(ce).attrs({kind:"light",size:"small",shape:"round"})` 173 align-items: center; 174 display: inline-flex; 175 gap: 2px; 176 padding: 1px 6px; 177`,yi=s(dt)` 178 font-weight: 400; 179 max-width: 300px; 180`,oe=s.div` 181 align-items: center; 182 display: flex; 183 flex-direction: row; 184 gap: var(--space-sm); 185 overflow-wrap: anywhere; 186 ${({$padding:t})=>t?`padding: ${t}`:""}; 187 ${({$margin:t})=>t?`margin: ${t}`:""}; 188`,tt=s(p.Caption)` 189 color: var(--color-grayscale-5); 190 display: inline-flex; 191 flex-direction: column; 192 padding-left: var(--space-xs); 193`,wi=s.iframe` 194 height: 640px; 195 pointer-events: none; 196 transform: scale(calc(90 / 1024), calc(54 / 640)); 197 transform-origin: left top; 198 width: 1024px; 199`,Mi=s.img` 200 object-fit: cover; 201 width: 100%; 202`,le=s.a` 203 background-image: linear-gradient( 204 45deg, 205 rgb(0 0 0 / 20%) 25%, 206 transparent 25%, 207 transparent 75%, 208 rgb(0 0 0 / 20%) 75%, 209 rgb(0 0 0 / 20%) 100% 210 ), 211 linear-gradient( 212 45deg, 213 rgb(0 0 0 / 20%) 25%, 214 transparent 25%, 215 transparent 75%, 216 rgb(0 0 0 / 20%) 75%, 217 rgb(0 0 0 / 20%) 100% 218 ); 219 background-position: 220 0 0, 221 15px 15px; 222 background-size: 10px 10px; 223 border: 1px solid var(--color-grayscale-opaque); 224 border-radius: var(--space-xs); 225 box-shadow: var(--shadow-level-1); 226 flex-shrink: 0; 227 height: 54px; 228 overflow: hidden; 229 width: ${({$square:t})=>t?54:90}px; 230`,Ae=s(p.BodyL)` 231 margin: 64px 0; 232`,De=s.div` 233 display: flex; 234 flex-direction: column; 235 gap: var(--space-sm); 236`,Ci=s(Xt)` 237 background-color: var(--color-grayscale-2); 238 border-radius: var(--space-sm); 239 height: calc(100% - 12px); 240 margin-left: 2px; 241 width: calc(100% / 4 - 12px); 242`,Ei=s(Kt)` 243 color: ${({$active:t})=>t?"var(--color-black)":"var(--color-grayscale-4)"}; 244 245 :hover { 246 color: var(--color-grayscale-5); 247 }
248`,Ve=s(Zt).attrs({ActiveBackgroundComponent:Ci,TabComponent:Ei})` 249 background-color: var(--color-white); 250 border: 1px solid var(--color-grayscale-3); 251 border-radius: var(--space-sm); 252 max-width: 500px; 253 padding: 6px; 254`,We=s(ae)` 255 max-width: 100%; 256 257 td, 258 th { 259 width: 180px; 260 261 &:nth-child(1) { 262 width: 300px; /* Expand first column */ 263 } 264 } 265 266 tr { 267 background-color: var(--color-white); 268 } 269`,ki=s(p.Body)` 270 display: flex; 271 font-weight: 500; 272 max-width: calc(100% - (${({$offset:t})=>t})); 273`,He=s.header` 274 display: flex; 275 flex: 1; 276 flex-direction: column; 277 gap: var(--space-sm); 278 height: 100%; 279 justify-content: space-between; 280 min-width: 0; 281 ${({$padding:t})=>t?`padding: ${t}`:""}; 282`,$i=s.div` 283 align-items: flex-start; 284 display: inline-flex; 285 gap: ${Je}; 286 height: 100%; 287 justify-content: space-between; 288`,Ii=s.div` 289 display: flex; 290 flex-direction: column; 291 gap: var(--space-xs); 292`,_i=s(le)` 293 align-items: center; 294 background-color: var(--color-grayscale-2); 295 background-image: none; 296 border: 1px solid var(--color-grayscale-2); 297 border-radius: var(--space-xs); 298 box-shadow: var(--shadow-level-1); 299 display: flex; 300 flex-shrink: 0; 301 height: 54px; 302 justify-content: center; 303 width: 54px; 304`,Ti=({channel:t,campaignId:n,thumbnail:i})=>{const a=Ze(),h=Ke();return Qe.has(t)?e.jsx(le,{href:Q("popups",`wisepops/edit/${n}`,h),target:"_blank",children:e.jsx(wi,{src:`/r/popups/frontend/preview/thumbnail-preview?wisepop_id=${n}`})}):i?e.jsx(le,{$square:!0,href:Q("notifications",`websites/_websiteId_/campaigns/${n}/edit?_websiteId=${a}`,h),target:"_blank",children:e.jsx(Mi,{src:i})}):null},Ge=s(D)` 305 flex: 1 1 0; 306 ${({$highlight:t})=>t?"outline: 2px solid var(--color-green-dark)":""}; 307 308 ${({$width:t})=>t?`min-width: ${t}; max-width: ${t}; flex-grow: 0;`:"min-width: 174px; flex-grow: 1; flex-shrink: 1;"} 309`,Si=({loading:t,color:n,name:i,description:a,badge:h,visitorsCount:c,totalVisitors:m,kind:o,campaignId:g,channel:d,thumbnail:u,highlight:x,refName:b})=>{const r=$(),M=Ze(),C=Ke(),_=l.useMemo(()=>!d||o==="control"||!g?"#":Qe.has(d)?Q("popups",`wisepops/edit/${g}`,C):Q("notifications",`websites/_websiteId_/campaigns/${g}/edit?_websiteId=${M}`,C),[g,d,o,M,C]);return t?e.jsx(Ge,{$highlight:x,children:e.jsxs(He,{children:[e.jsxs(oe,{children:[e.jsx(G,{$color:"var(--color-grayscale-4)",$size:ee}),e.jsx(w,{$height:"24px",$width:"min(18ch, 100%)"})]}),e.jsx(w,{$height:"24px",$width:"min(24ch, 100%)"}),e.jsx(w,{$height:"20px",$width:"min(18ch, 100%)"})]})}):e.jsx(Ge,{$highlight:x,children:e.jsxs($i,{children:[o==="control"||!g?null:e.jsx(Ti,{campaignId:g,channel:d,thumbnail:u}),o==="control"?e.jsx(_i,{children:e.jsx(Pt,{height:24,width:24})}):null,e.jsxs(He,{children:[e.jsxs(Ii,{children:[e.jsxs(oe,{children:[e.jsx(G,{$color:n,$size:ee}),e.jsx(p.Bold,{children:b})]}),e.jsx(ki,{$offset:pi,as:"a",href:_,children:typeof i=="string"?e.jsx(Pe,{cutoffAt:"auto",text:i}):i}),h]}),e.jsxs(tt,{children:[a&&typeof a=="string"?e.jsx(Pe,{cutoffAt:"auto",text:a}):a,Number.isNaN(c)?e.jsx(w,{}):r.formatMessage({id:"experiment.table.header.visitors",description:"Experiment table header visitors count",defaultMessage:"{count} visitors ({percentage})"},{count:A(c,{notation:"compact",compactDisplay:"short"}).replace(/[KM]/,f=>` ${f}`),percentage:A(c/m,{style:"percent",maximumFractionDigits:0})})]})]})]})})},Bi=t=>String.fromCodePoint(65+t%25),it=()=>{const t=$();return n=>{const i=Bi(n.index);return n.kind==="control"?t.formatMessage({id:"experiment.table.variant.refname.control",description:"Experiment page - control refname",defaultMessage:"Control Group ({letter})"},{letter:i}):n.kind==="baseline"?t.formatMessage({id:"experiment.table.variant.refname.baseline",description:"Experiment page - baseline refname",defaultMessage:"Baseline ({letter})"},{letter:i}):t.formatMessage({id:"experiment.table.variant.refname.variant",description:"Experiment page - variant refname",defaultMessage:"Variant ({letter})"},{letter:i})}},H=["var(--color-yellow-500)","var(--color-pink)","var(--color-main-light)","var(--color-yellow-600)"],se={id:Number.NaN,description:w,name:w,visitors:Number.NaN},nt=[{kind:"baseline",index:0,...se},{kind:"variant",index:1,...se},{kind:"variant",index:2,...se}],K=.9,Ni=({highlight:t,children:n})=>t==="non-significant"?n:e.jsx(ji,{color:t==="positive"?"green":"red",children:n}),Le=({row:t})=>{const n=$(),{title:i,values:a,isPositive:h,hideColumns:c}=t,m=c?.includes("uplift")??!1,o=c?.includes("significance")??!1;return e.jsxs(e.Fragment,{children:[e.jsx(ae.Cell.Label,{children:i}),a.map(({value:g,uplift:d,significance:u,kind:x,value_suffix:b,id:r})=>{const M=(u??0)<K?n.formatMessage({id:"experiment.table.variant.tooltip.significance_not_reached",description:"Experiment page - significance reached tooltip message",defaultMessage:"Statistical significance not reached: {value}{br}Please wait, this uplift estimate isn't reliable yet."},{value:A(u??0,{style:"percent"}),br:e.jsx("br",{})}):n.formatMessage({id:"experiment.table.variant.tooltip.significance_reached",description:"Experiment page - significance reached tooltip message",defaultMessage:"Statistical significance reached: {value}{br}You can trust this uplift estimate."},{value:A(u??0,{style:"percent"}),br:e.jsx("br",{})}
309),C=(u??0)<K||!d?"non-significant":h(d)?"positive":"negative",_=C==="positive"?Ft:C==="negative"?At:null;return e.jsx(ae.Cell.Label,{children:e.jsxs(hi,{$bold:!o&&x==="variant"&&(u??0)>=K,children:[e.jsx(et,{children:g.length>0?Xe(g,{suffix:b}):"-"}),m?null:e.jsx(L,{TooltipHintComponent:yi,hint:M,kind:"left",children:e.jsx(bi,{$highlight:C,children:typeof d=="number"&&x==="variant"?e.jsxs(Ni,{highlight:C,children:[_&&(u??0)>=K?e.jsx(_,{height:12,width:12}):null,A(d,{signDisplay:"exceptZero",style:"percent"})]}):null})})]})},r)})]})},Oe=({loading:t})=>{const n=$(),i=it(),a=Yt(),{website:{id:h},workspace:{id:c}}=de(),m=l.useContext(me),[o,g]=l.useState(B.campaign),d=l.useCallback(({value:f})=>{g(f)},[]),{data:u,isFetching:x}=pe({websiteId:h,id:+(m??0),workspaceId:c},{enabled:m!==void 0}),b=l.useMemo(()=>o===B.custom?(u?.collectedGoals?Object.values(u.collectedGoals).flatMap(f=>f.metrics.filter(y=>Fe[B.custom].includes(y)).filter(y=>y===v.GoalRevenue?u.variants.some(T=>{const S=T.flattenedGoals.find(I=>I.goalId===f.id&&I.metric===v.GoalRevenue)?.value;return S!==void 0&&S!==""&&S!=="-"&&S!=="0"}):!0).map(y=>{const E=a.find(({key:T})=>T===y);return typeof E?.label=="function"?{...E,label:E.label(u.goalCurrency,f.name),goalId:f.id}:E})):[]).filter(Boolean):(u?.variants[0]?.metrics.filter(f=>Fe[o].includes(f.metric)).map(f=>a.find(({key:y})=>y===f.metric))??[]).filter(Boolean),[o,u?.variants,u?.collectedGoals,u?.goalCurrency,a]),r=l.useMemo(()=>b.map(f=>{const y=typeof f.label=="string"?f.label:f.label(u?.goalCurrency??"");return e.jsx(xi,{children:e.jsxs(vi,{children:[f.icon??null,e.jsx(tt,{color:"var(--color-grayscale-5)",children:y}),e.jsx(L,{hint:f.tooltip,kind:"right",children:e.jsx(pt,{color:"var(--color-grayscale-4)",height:"16",width:"16"})})]})},f.key)}).filter(Boolean),[u?.goalCurrency,b]),M=l.useMemo(()=>{const f=t||x?nt:u?.variants??[];return{0:{name:e.jsx(gi,{children:n.formatMessage({id:"experiment.table.header.metrics",description:"Experiment table - Metrics column header",defaultMessage:"Metric"})})},...f.reduce((y,E,T)=>(y[`variant-${E.index}`]={name:e.jsxs(oe,{$margin:"0 0 0 auto",children:[e.jsx(G,{$color:H[T%H.length],$size:ee}),e.jsx(p.Bold,{children:i(E)})]})},y),{})}},[u?.variants,i,n,x,t]),C=l.useMemo(()=>b.map((f,y)=>{const E=`${f.key}-${f.goalId??0}`,T=(u??{variants:[]}).variants.map(F=>{const S=(o===B.custom?F.flattenedGoals.find(I=>I.metric===f.key&&f.goalId===I.goalId):F.metrics.find(I=>I.metric===f.key))??mi;return{...S,id:`${F.id}-${S.metric}-${f.goalId??0}`,kind:F.kind}});return{id:E,title:r[y],values:T,isPositive:f.isPositive,hideColumns:f.hideColumns}}),[o,u,b,r]),_=l.useMemo(()=>[{value:B.campaign,label:n.formatMessage({id:"experiment.table.category.campaign",description:"Experiment table - Campaign category",defaultMessage:"Campaign"})},{value:B.revenue,label:n.formatMessage({id:"experiment.table.category.revenue",description:"Experiment table - Revenue category",defaultMessage:"Revenue"})},{value:B.visitor,label:n.formatMessage({id:"experiment.table.category.visitor",description:"Experiment table - Visitor category",defaultMessage:"Visitor"})},{value:B.custom,label:n.formatMessage({id:"experiment.table.category.custom",description:"Experiment table - Custom category",defaultMessage:"Custom"})}],[n]);return t||x?e.jsxs(De,{children:[e.jsx(Ve,{onChange:d,options:_,value:o}),e.jsx(We,{columns:M,data:[],dataRowComponent:Le,loading:!0,noResults:e.jsx(Ae,{children:n.formatMessage({id:"experiments.table.category.empty",description:"No data in experiments table",defaultMessage:"No custom goal defined."})}),selectable:!1,selected:void 0})]}):e.jsxs(De,{children:[e.jsx(Ve,{onChange:d,options:_,value:o}),e.jsx(We,{columns:M,data:C,dataRowComponent:Le,noResults:e.jsx(Ae,{children:n.formatMessage({id:"experiments.table.category.empty",description:"No data in experiments table",defaultMessage:"No custom goal defined."})}),selectable:!1,selected:void 0})]})},Ue=.02,Ri=t=>{const n=(t[1]??1)/1e3;return[t[0]-n,t[0]+n]},Pi=(t,n)=>{const i=[t[0]-t[1],t[0]+t[1]];return n&&(n.current=[Math.min(n.current[0],i[0]),Math.max(n.current[1],i[1])]),i},ze=["254, 230, 136","248, 181, 248","234, 138, 79","181, 181, 177","227, 251, 177"],Fi=t=>{const n={current:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]};return{labels:t.map(i=>i[0]),datasets:[{data:t.map(Ri),backgroundColor:ze.map(i=>`rgb(${i})`)},{data:t.map(i=>Pi(i,n)),backgroundColor:ze.map(i=>`rgba(${i}, .2)`)}],yAxisRange:[n.current[0]*(1-Ue),n.current[1]*(1+Ue)]}},Ai=(t,n)=>({responsive:!0,maintainAspectRatio:!1,datasets:{bar:{barThickness:32,minBarLength:4}}
309,plugins:{legend:{display:!1},tooltip:{xAlign:"left",yAlign:"center",borderColor:"#EBEBEC",displayColors:!1,borderWidth:1,boxWidth:13,boxHeight:13,boxPadding:8,usePointStyle:!0,cornerRadius:4,padding:12,titleFont:{size:14,weight:"normal",family:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"},bodyColor:"#1B1B20",titleColor:"#73737C",bodyFont:{size:14,weight:"normal",family:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"},backgroundColor:"#FFF",intersect:!1,callbacks:{title:()=>"",label:i=>i.label?t(+i.label):""}}},scales:{x:{display:!1,stacked:!0},y:{ticks:{callback:i=>typeof i!="number"?i:t(i)},...n}}}),Di=(t,n,i)=>{const a=t.map(({metrics:h,flattenedGoals:c})=>{if(i&&[v.GoalConverted,v.GoalRevenue].includes(n)){const o=c.find(({goalId:g,metric:d})=>d===n&&g===i);if(o)return[+o.value,+o.value_uncertainty]}const m=h.find(({metric:o})=>o===n);return m?[+m.value,+m.value_uncertainty]:[Number.NaN,Number.NaN]});return Fi(a)};gt.register(ft,ht,vt,bt,jt,yt);X.extend(wt);const Vi=xt(p.Bold),Ye=({loading:t,mainMetric:n,goalCurrency:i})=>{const a=$(),{website:{id:h},workspace:{id:c}}=de(),m=l.useContext(me),{data:o,isFetching:g}=pe({websiteId:h,id:+(m??0),workspaceId:c},{enabled:m!==void 0}),d=l.useMemo(()=>!o||!n?{labels:[],datasets:[{data:[]}],yAxisRange:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]}:Di(o.variants,n,o.experiment.goal?.id),[o,n]),u=te(),x=l.useMemo(()=>n?u(n):null,[u,n]),b=l.useMemo(()=>x?Ai(M=>Xe(M,{suffix:o?.variants[0]?.metrics[0]?.value_suffix,unit:x.unit}),{min:Number.isFinite(d.yAxisRange[0])?Math.floor(d.yAxisRange[0]*100)/100:void 0,max:Number.isFinite(d.yAxisRange[1])?Math.ceil(d.yAxisRange[1]*100)/100:void 0}):[],[o?.variants,d.yAxisRange,x]);return t||g?e.jsx(mt,{color:"var(--color-grayscale-4)",height:"36px",style:{margin:"auto"},width:"36px"}):e.jsxs(e.Fragment,{children:[e.jsx(p.Body,{$fontWeight:500,children:typeof x?.label=="string"?x.label:x?.label(i??"",o?.experiment.goal?.name??"")}),e.jsx("div",{style:{height:"300px"},children:e.jsx(ut,{data:d,options:b})}),e.jsx(p.Caption,{children:o?.experiment.estimated_end_date&&!o.experiment.end_date?a.formatMessage({id:"experiment.chart.endDate",description:"Experiment page chart's estimated end date",defaultMessage:"Estimated end date: <Bold>{date}</Bold>"},{date:X("2024-02-25").format("MMM Do YYYY"),Bold:Vi}):null})]})},Wi=s(Mt).attrs({kind:"warning"})` 310 grid-area: banner; 311 max-width: 100%; 312`,Hi=()=>window.localStorage.getItem("experiment.revenueActivationBanner.hide")==="1",Gi=()=>{const t=$(),[n,i]=l.useState(Hi),a=l.useCallback(()=>{i(!0),window.localStorage.setItem("experiment.revenueActivationBanner.hide","1")},[]);return n?null:e.jsx(Wi,{message:e.jsx(p.Body,{$fontWeight:500,children:t.formatMessage({id:"experiment.banner.goal_activate.message",description:"Experiment - goal tracking not active banner message",defaultMessage:"You didn't activate goal tracking on your website. Goal/revenue metrics are unavailable for this experiment."})}),onClose:a,children:e.jsx(re,{href:"https://support.wisepops.com/en/articles/9898057-how-to-set-up-goal-tracking-for-wisepops",kind:"action",target:"_blank",children:t.formatMessage({id:"experiment.banner.goal_activate.cta",description:"Experiment - goal tracking not active banner cta",defaultMessage:"Learn how to activate goal tracking"})})})};let qe=!1;const Li=()=>{const t=$(),n=it(),{createToast:i}=Ct(),[a]=St.withNavigate(Et.Experiments),{triggerPageview:h}=kt(),c=l.useCallback(()=>{qe||(h(),qe=!0)},[h]),{website:{id:m},workspace:{id:o}}=de(),{id:g}=$t({from:"/_nav/workspaces/$workspace/websites/$website/experiments/$id"}),{campaignId:d,experimentId:u}=l.useMemo(()=>g?g.includes("wisepops")||g.includes("wisp")?{campaignId:g,experimentId:void 0}:{experimentId:g,campaignId:void 0}:{campaignId:void 0,experimentId:void 0},[g]),x=Wt({websiteId:m,wisebrain_campaign_ids:d?[d]:[]},{enabled:d!==void 0}),b=l.useMemo(()=>{if(u)return u;if(x.isSuccess)return x.data.pages[0]?.items[0]?.id},[x.data?.pages,x.isSuccess,u]),{data:r,isFetching:M,isError:C,isSuccess:_}=pe({websiteId:m,workspaceId:o,id:+(b??0)},{enabled:a===ye&&b!==void 0}),{mutate:f,isPending:y,reset:E}=Dt({websiteId:m,id:+g},{onSuccess:()=>{i("success",t.formatMessage({id:"pages.experiment.export.success",description:"Text displayed inside a Toast when exp
312ort is triggered successfully",defaultMessage:"We've sent you a email with the report."})),E()}}),T=l.useCallback(()=>{f()},[f]),[F,S]=l.useMemo(()=>{if(!r)return[];const j=r.variants.find(k=>k.id===r.experiment.winner_variation_id),O=r.variants.find(k=>k.id===r.experiment.baseline_variation_id);return[j,O]},[r]),I=l.useMemo(()=>r?.variants.map(({id:j})=>j),[r]),{data:ue}=Vt({websiteId:m,filter:{variation_ids:I},channel:J.Notif,perPage:99999},{enabled:!!I?.length}),xe=te(),ge=l.useMemo(()=>{if(!r?.experiment.main_metric||!r.experiment.winner_variation_id)return;const j=xe(r.experiment.main_metric),k=r.variants.find(({id:U})=>U===r.experiment.winner_variation_id)?.metrics.find(({metric:U})=>U===r.experiment.main_metric);return k?{...k,isPositive:typeof k.uplift=="number"?j?.isPositive(+k.uplift):void 0}:null},[r?.variants,r?.experiment.main_metric,r?.experiment.winner_variation_id,xe]),fe=l.useMemo(()=>(M?nt:r?.variants??[]).map((j,O)=>{const k=j.kind==="control",st=j.kind==="control"||j.kind==="baseline"?{kind:"control"}:{kind:"variant"},he=j.id===r?.experiment.winner_variation_id&&ge?.isPositive?e.jsx(ce,{as:"a",color:"green",href:k?void 0:`https://popups.wisepops.com/wisepops/edit/${j.id}`,kind:"solid",shape:"square",size:"small",children:t.formatMessage({id:"experiment.table.variant.badge.winner",description:"Experiment page - variant winner badge",defaultMessage:"Winner"})}):void 0,rt=k?"174px":void 0,at=n(j),z=j.description,Y=j.name;return e.jsx(Si,{badge:he,campaignId:j.id,channel:r?.experiment.channel??J.Popup,color:H[O%H.length]??H[0],description:!z||typeof z=="string"?z:e.jsx(z,{}),highlight:!!he,kind:rt?st.kind:"variant",name:!Y||typeof Y=="string"?Y:e.jsx(Y,{}),refName:at,thumbnail:ue?.[j.id]?.thumbnail,totalVisitors:r?.experiment.visitors??Number.POSITIVE_INFINITY,visitorsCount:j.visitors},j.id)}),[r?.experiment.channel,r?.experiment.visitors,r?.experiment.winner_variation_id,r?.variants,n,t,M,ue,ge?.isPositive]);return M?e.jsxs(Ce,{title:t.formatMessage({description:"Experiment page website title - empty state",id:"page.title.experiment.loading",defaultMessage:"Experiment - Wisepops"}),children:[e.jsxs(re,{kind:"ghost",size:"small",to:"..",children:[e.jsx(je,{height:16,width:16}),t.formatMessage({description:"Experiment page back button label",id:"experiment.back",defaultMessage:"Experiments"})]}),e.jsx(Ie,{children:e.jsxs(Ee,{children:[e.jsx(ke,{children:e.jsx(w,{$height:"36px"})}),e.jsxs($e,{children:[e.jsx(Ne,{loading:!0}),e.jsx(p.Body,{children:t.formatMessage({id:"experiment.subtitle",description:"Experiment page subtitle",defaultMessage:"Updates at 3am UTC everyday."})})]})]})}),e.jsxs(Se,{children:[e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.conclusion",description:"Experiment page - conclusion section title",defaultMessage:"Results Summary"})}),e.jsx(Be,{loading:!0})]}),e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.variants",description:"Experiment page - variants section title",defaultMessage:"What was tested"})}),e.jsx(we,{children:fe})]}),e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.metricn",description:"Experiment page - metrics section title",defaultMessage:"All metrics"})}),e.jsx(D,{children:e.jsx(Oe,{loading:!0})})]}),e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.chart",description:"Experiment page - chart section title",defaultMessage:"Success metric"})}),e.jsx(D,{$gap:"var(--space-lg)",$maxHeight:"max-content",$maxWidth:"100%",$minWidth:"100%",children:e.jsx(Ye,{loading:!0})})]})]})]}):b===void 0&&x.isPending?e.jsx(It,{}):b===void 0&&x.isSuccess?e.jsx(Ht,{ctaText:t.formatMessage({id:"experiment.not_found.cta",description:"Experiment detail not found's description after being loaded by campaign id - cta",defaultMessage:"Back to experiments"}),description:t.formatMessage({id:"experiment.not_found.description",description:"Experiment detail not found's description after being loaded by campaign id",defaultMessage:"Experiment was not found. New experiments will appear after the next daily update."}),to:".."}):C||!_?a!==ye?(c(),e.jsx(Gt,{})):e.jsx(_t,{}):e.jsx(Ce,{title:t.formatMessage({description:"Experiment page website title",id:"page.title.experiment",defaultMessage:"{name} Experiment - Wisepops"},{name:r.experiment.campaign_name}),children:e.jsxs(Jt,{value:b,children:[e.jsxs(re,{kind:"ghost",size:"small",to:"..",children:[e.jsx(je,{height:16,width:16}),t.formatMessage({description:"Experiment page back button label",id:"experiment.back",defaultMessage:"Experiments"})]}),e.jsx(Ie,{children:e.jsxs(Ee,{children:[e.jsxs(ke,{children:[e.jsx("span",{children:r.experiment.campaign_name}),e.jsx(Tt,{kind:"tertiary",loading:y,onClick:T,size:"small",children:t.formatMessage({description:"Experiment page export results button label",id:"experiment.export",defaultMessage:"Export results"})})]}),e.jsxs($e,{children:[e.jsx(Ne,{duration:{from:r.experiment.start_date,to:r.experiment.end_date},metric:r.experiment.main_metric,status:r.experiment.status,visitors:r.experiment.visitors}),e.jsx(p.Body,{children:t.formatMessage({id:"experiment.subtitle",description:"Experiment page subtitle",defaultMessage:"Updates at 3am UTC everyday."})})]})]})}),e.jsx(Lt,{}),e.jsxs(Se,{$hideBanner:r.hasGoals,children:[e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.conclusion",description:"Experiment page - conclusion section title",defaultMessage:"Results Summary"})}),e.jsx(Be,{data:{analysis:r.experiment.analysis,goal:r.experiment.goal,metric:r.experiment.main_metric,uplift:r.experiment.conclusion_percent_change,winnerVariant:F?.n
312ame,baselineVariant:qt(r.experiment.baseline_variation_id)?"Control Group":S?.name},status:r.experiment.status})]}),e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.variants",description:"Experiment page - variants section title",defaultMessage:"What was tested"})}),e.jsx(we,{children:fe})]}),e.jsxs(N,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.metricn",description:"Experiment page - metrics section title",defaultMessage:"All metrics"})}),r.hasGoals?null:e.jsx(Gi,{}),e.jsx(D,{children:e.jsx(Oe,{})})]}),e.jsx(N,{children:r.experiment.main_metric?e.jsxs(e.Fragment,{children:[e.jsx(p.H3,{children:t.formatMessage({id:"experiment.section.chart",description:"Experiment page - chart section title",defaultMessage:"Success metric"})}),e.jsx(D,{$gap:"var(--space-lg)",$maxHeight:"max-content",$maxWidth:"100%",$minWidth:"100%",children:e.jsx(Ye,{goalCurrency:r.goalCurrency,mainMetric:r.experiment.main_metric})})]}):null})]})]})})},an=()=>e.jsx(Bt,{children:e.jsx(Li,{})});export{an as component};
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.