PageSourceSearch

https://app.searchpilot.com/assets/vite/DashboardApp-DGuubH43.js

js searchpilot.com collected 2026-09-24 17:41:47 UTC 26,854 bytes, 3 lines download raw bytes

1import{g as Ce,s as E,j as e,B as L,C as b,bX as f,aV as z,aW as U,aX as g,aT as _,aU as v,aM as V,v as Z,a5 as ne,bY as we,r as $,aI as se,aJ as re,aK as ae,H as ie,I as Ne,aL as le,S as oe,bp as fe,A as W,bZ as G,b_ as J,b as De,p as Ie,aA as ke,a$ as Te,bm as ce,M as q,G as ee}from"./root-C9LVyve2.js";import{u as Pe}from"./useSuspenseQuery-Cdwzuijc.js";import{u as Me,g as Y}from"./RouterProvider-BasQyeSe.js";import{Y as ge,Z as je,_ as Ae,$ as Re,a0 as $e,a1 as Oe,a2 as Fe,a3 as Ee,H as _e}from"./index-BbbtkjlU.js";import{p as Le}from"./hooks-CbSOHN_-.js";import{m as ze}from"./more-C-D7RsQv.js";import{R as be}from"./ReactHighcharts-C4G_YM4p.js";import{t as A,c as K,g as de,e as Ue,a as He,m as ue,b as he,d as me,h as xe,f as ve}from"./format-DUiBe8lm.js";import{P as qe,D as Be,C as Qe}from"./react-beautiful-dnd.esm-oVihF_e3.js";import{A as We,P as Ke}from"./PasteModal-B2LsFU1j.js";import{C as Ye}from"./CopyModal-CmyVog17.js";import"./queryOptions-BQvTFV_-.js";import"./useMutation-CBnyrxiv.js";import"./hooks-Dmcz0DDD.js";import"./index-DPxt4TBf.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"distillery-frontend"};var n=new s.Error().stack;
1n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="ed85f3bd-74a9-4400-8d1a-31bcd77268af",s._sentryDebugIdIdentifier="sentry-dbid-ed85f3bd-74a9-4400-8d1a-31bcd77268af")}catch{}})();function Ge(s,n){const r=A(s);return isNaN(n)?K(s,NaN):(n&&r.setDate(r.getDate()+n),r)}function Ve(s,n){const r=A(s);if(isNaN(n))return K(s,NaN);if(!n)return r;const i=r.getDate(),o=K(s,r.getTime());o.setMonth(r.getMonth()+n+1,0);const m=o.getDate();return i>=m?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}function Ze(s,n){const{years:r=0,months:i=0,weeks:o=0,days:m=0,hours:p=0,minutes:j=0,seconds:y=0}=n,c=A(s),u=i||r?Ve(c,i+r*12):c,t=m||o?Ge(u,m+o*7):u,a=j+p*60,h=(y+a*60)*1e3;return K(s,t.getTime()+h)}function Xe(s,n){const r=A(s),i=A(n),o=r.getTime()-i.getTime();return o<0?-1:o>0?1:o}function Je(s){return K(s,Date.now())}function et(s){return n=>{const r=Math[s],i=r(n);return i===0?0:i}}function tt(s,n,r){const o=He().locale??Ue,m=Xe(s,n);if(isNaN(m))throw new RangeError("Invalid time value");const p=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:m});let j,y;m>0?(j=A(n),y=A(s)):(j=A(s),y=A(n));const c=et("round"),u=y.getTime()-j.getTime(),t=u/xe,a=de(y)-de(j),l=(u-a)/xe,h=r?.unit;let d;if(t<1?d="second":t<60?d="minute":t<ue?d="hour":l<he?d="day":l<me?d="month":d="year",d==="second"){const x=c(u/1e3);return o.formatDistance("xSeconds",x,p)}else if(d==="minute"){const x=c(t);return o.formatDistance("xMinutes",x,p)}else if(d==="hour"){const x=c(t/60);return o.formatDistance("xHours",x,p)}else if(d==="day"){const x=c(l/ue);return o.formatDistance("xDays",x,p)}else if(d==="month"){const x=c(l/he);return x===12&&h!=="month"?o.formatDistance("xYears",1,p):o.formatDistance("xMonths",x,p)}else{const x=c(l/me);return o.formatDistance("xYears",x,p)}}function nt(s,n){return tt(s,Je(s),n)}function st(s){return+A(s)>Date.now()}var Q={exports:{}},rt=Q.exports,pe;function at(){return pe||(pe=1,(function(s,n){var r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol?"symbol":typeof i};(function(i,o){r(n)==="object"?s.exports=o():i.Humanize=o()})(rt,function(){var i=[{name:"second",value:1e3},{name:"minute",value:6e4},{name:"hour",value:36e5},{name:"day",value:864e5},{name:"week",value:6048e5}],o={P:Math.pow(2,50),T:Math.pow(2,40),G:Math.pow(2,30),M:Math.pow(2,20)},m=function(t){return typeof t<"u"&&t!==null},p=function(t){return t!==t},j=function(t){return isFinite(t)&&!p(parseFloat(t))},y=function(t){var a=Object.prototype.toString.call(t);return a==="[object Array]"},c={intword:function(t,a){var l=arguments.length<=2||arguments[2]===void 0?2:arguments[2];return c.compactInteger(t,l)},compactInteger:function(t){var a=arguments.length<=1||arguments[1]===void 0?0:arguments[1];a=Math.max(a,0);var l=parseInt(t,10),h=l<0?"-":"",d=Math.abs(l),x=String(d),T=x.length,C=[13,10,7,4],P=["T","B","M","k"];if(d<1e3)return""+h+x;if(T>C[0]+3)return l.toExponential(a).replace("e+","x10^");for(var I=void 0,D=0;D<C.length;D++){var w=C[D];if(T>=w){I=w;break}}var N=T-I+1,S=x.split(""),M=S.slice(0,N),k=S.slice(N,N+a+1),O=M.join(""),R=k.join("");R.length<a&&(R+=""+Array(a-R.length+1).join("0"));var H=void 0;if(a===0)H=""+h+O+P[C.indexOf(I)];else{var X=(+(O+"."+R)).toFixed(a);H=""+h+X+P[C.indexOf(I)]}return H},intComma:function(t){var a=arguments.length<=1||arguments[1]===void 0?0:arguments[1];return c.formatNumber(t,a)},intcomma:function(){return c.intComma.apply(c,arguments)},fileSize:function(t){var a=arguments.length<=1||arguments[1]===void 0?2:arguments[1];for(var l in o)if(o.hasOwnProperty(l)){var h=o[l];if(t>=h)return c.formatNumber(t/h,a,"")+" "+l+"B"}return t>=1024?c.formatNumber(t/1024,0)+" KB":c.formatNumber(t,0)+c.pluralize(t," byte")},filesize:function(){return c.fileSize.apply(c,arguments)},formatNumber:function(t){var a=arguments.length<=1||arguments[1]===void 0?0:arguments[1],l=arguments.length<=2||arguments[2]===void 0?",":arguments[2],h=arguments.length<=3||arguments[3]===void 0?".":arguments[3],d=function(N,S,M){return M?N.substr(0,M)+S:""},x=function(N,S,M){return N.substr(M).replace(/(\d{3})(?=\d)/g,"$1"+S)},T=function(N,S,M){return M?S+c.toFixed(Math.abs(N),M).split(".")[1]:""},C=c.normalizePrecision(a),P=t<0&&"-"||"",I=String(parseInt(c.toFixed(Math.abs(t||0),C),10)),D=I.length>3?I.length%3:0;return P+d(I,l,D)+x(I,l,D)+T(t,h,C)},toFixed:function(t,a){a=m(a)?a:c.normalizePrecision(a,0);var l=Math.pow(10,a);return(Math.round(t*l)/l).toFixed(a)},normalizePrecision:function(t,a){return t=Math.round(Math.abs(t)),p(t)?a:t},ordinal:function(t){var a=parseInt(t,10);if(a===0)return t;var l=a%100;if([11,12,13].indexOf(l)>=0)return a+"th";var h=a%10,d=void 0;switch(h){case 1:d="st";break;case 2:d="nd";break;case 3:d="rd";break;default:d="th"}return""+a+d},times:function(t){var a=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];if(j(t)&&t>=0){var l=parseFloat(t),h=["never","once","twice"];if(m(a[l]))return String(a[l]);var d=m(h[l])&&h[l].toString();return d||l.toString()+" times"}return null},pluralize:function(t,a,l){return m(t)&&m(a)?(l=m(l)?l:a+"s",parseInt(t,10)===1?a:l):null},truncate:function(t){var a=arguments.length<=1||arguments[1]===void 0?100:arguments[1],l=arguments.length<=2||arguments[2]===void 0?"...":arguments[2];return t.length>a?t.substring(0,a-l.length)+l:t},truncateWords:function(t,a){for(var l=t.split(" "),h="",d=0;d<a;)m(l[d])&&(h+=l[d]+" "),d++;return l.length>a?h+"...":null},truncatewords:function(){return c.truncateWords.apply(c,arguments)},boundedNumber:function(t){var a=arguments.length<=1||arguments[1]===void 0?100:arguments[1],l=arguments.length<=2||arguments[2]===void 0?"+":arguments[2],h=void 0;return j(t)&&j(a)&&t>a&&(h=a+l),(h||t).toString()},truncatenumber:function(){return c.boundedNumber.apply(c,arguments)},oxford:function(t,a,l){var h=t.length,d=void 0;if(h<2)return String(t);if(h===2)return t.join(" and ");if(m(a)&&h>a){var x=h-a;d=a,l=m(l)?l:", and "+x+" "+c.pluralize(x,"other")}else d=-1,l=", and "+t[h-1];return t.slice(0,d).join(", ")+l},dictionary:function(t){var a=arguments.length<=1||arguments[1]===void 0?" is ":arguments[1],l=arguments.length<=2||arguments[2]===void 0?", ":arguments[2],h="";if(m(t)&&(typeof t>"u"?"undefined":r(t))==="object"&&!y(t)){var d=[];for(var x in t)if(t.hasOwnProperty(x)){var T=t[x];
1d.push(""+x+a+T)}return d.join(l)}return h},frequency:function(t,a){if(!y(t))return null;var l=t.length,h=c.times(l);return l===0?h+" "+a:a+" "+h},pace:function(t,a){var l=arguments.length<=2||arguments[2]===void 0?"time":arguments[2];if(t===0||a===0)return"No "+c.pluralize(0,l);for(var h="Approximately",d=void 0,x=void 0,T=t/a,C=0;C<i.length;++C){var P=i[C];if(x=T*P.value,x>1){d=P.name;break}}d||(h="Less than",x=1,d=i[i.length-1].name);var I=Math.round(x);return l=c.pluralize(I,l),h+" "+I+" "+l+" per "+d},nl2br:function(t){var a=arguments.length<=1||arguments[1]===void 0?"<br/>":arguments[1];return t.replace(/\n/g,a)},br2nl:function(t){var a=arguments.length<=1||arguments[1]===void 0?`\r
2`:arguments[1];return t.replace(/\<br\s*\/?\>/g,a)},capitalize:function(t){var a=arguments.length<=1||arguments[1]===void 0?!1:arguments[1];return""+t.charAt(0).toUpperCase()+(a?t.slice(1).toLowerCase():t.slice(1))},capitalizeAll:function(t){return t.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()})},titleCase:function(t){var a=/\b(a|an|and|at|but|by|de|en|for|if|in|of|on|or|the|to|via|vs?\.?)\b/i,l=/\S+[A-Z]+\S*/,h=/\s+/,d=/-/,x=void 0;return x=function(C){for(var P=arguments.length<=1||arguments[1]===void 0?!1:arguments[1],I=arguments.length<=2||arguments[2]===void 0?!0:arguments[2],D=[],w=C.split(P?d:h),N=0;N<w.length;++N){var S=w[N];if(S.indexOf("-")!==-1){D.push(x(S,!0,N===0||N===w.length-1));continue}if(I&&(N===0||N===w.length-1)){D.push(l.test(S)?S:c.capitalize(S));continue}l.test(S)?D.push(S):a.test(S)?D.push(S.toLowerCase()):D.push(c.capitalize(S))}return D.join(P?"-":" ")},x(t)},titlecase:function(){return c.titleCase.apply(c,arguments)}};return c})})(Q,Q.exports)),Q.exports}var it=at();const B=Ce(it),lt=Y("/$accountSlug/dashboard"),ot=({canModifyPageTemplates:s})=>{const n=lt.useParams(),r=Me(),{data:i,isPending:o}=E(Le({accountSlug:n.accountSlug}));return o?e.jsxs(L,{children:[e.jsx(b,{backgroundColor:"bg-protected-gradient",children:e.jsx(b.Content,{children:e.jsx(b.Title,{children:e.jsx(f,{})})})}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsxs(U,{children:[e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})})]})}),e.jsx("tbody",{children:e.jsxs(_,{children:[e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})})]})})]})]}):e.jsxs(L,{children:[e.jsxs(b,{backgroundColor:"bg-protected-gradient",children:[e.jsx(b.Content,{children:e.jsx(b.Title,{children:"Page Templates"})}),s&&e.jsx(V,{variant:"primary",leftIcon:e.jsx(Z,{name:"FiLock",size:"sm"}),onClick:()=>r({to:"/$accountSlug/page_template/create",params:{accountSlug:n.accountSlug}}),children:"Add Page Template"}),e.jsx(V,{variant:"primary",onClick:()=>r({to:"/$accountSlug/runway",params:{accountSlug:n.accountSlug}}),children:"Enter Runway"})]}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsxs(U,{children:[e.jsx(g,{children:"Name"}),e.jsx(g,{children:"Primary Metric"})]})}),e.jsxs("tbody",{children:[i?.length===0&&e.jsx(_,{children:e.jsx(v,{colSpan:2,children:"No page templates found"})}),i?.map(m=>e.jsxs(_,{children:[e.jsx(v,{children:e.jsx(ne,{to:"/$accountSlug/page_template/$pageTemplateId",params:{accountSlug:n.accountSlug,pageTemplateId:m.id},className:"text-sp-primary cursor-pointer",children:m.name})}),e.jsx(v,{children:m.metrics.find(p=>p.is_primary)?.name??"—"})]},m.id))]})]})]})};ze(be.Highcharts);const ct=s=>{const{data:n}=s,r={chart:{type:"line",height:25,width:120,margin:[0,0,0,0],xAxis:{labels:{enabled:!1}}},legend:{enabled:!1},tooltip:{enabled:!1},title:{text:""},credits:{enabled:!1},xAxis:{type:"datetime",plotLines:[]},yAxis:{gridLineWidth:0,labels:{enabled:!1},title:{text:null}},plotOptions:{series:{animation:!1,lineWidth:1,shadow:!1,marker:{radius:0},fillOpacity:.25,states:{hover:{enabled:!1}}}},series:[{data:n}]};return e.jsx(be,{config:r})},dt=({cell:s})=>{let n=s.text;return s.type=="linked_text"?n=e.jsx("a",{href:s.link,className:"text-purple-700",children:s.text}):s.type==="sparkline"&&(n=e.jsx(ct,{data:s.data})),e.jsx(v,{children:n})},ye=({row:s})=>e.jsx(_,{children:s.map((n,r)=>e.jsx(dt,{cell:n},r))}),ut=Y("/$accountSlug/dashboard"),ht=()=>{const s=ut.useParams(),{data:n,isPending:r}=E(ge(s));return r?e.jsxs(L,{children:[e.jsx(b,{children:e.jsxs(b.Content,{children:[e.jsx(b.Title,{children:e.jsx(f,{})}),e.jsx(b.Description,{children:e.jsx(f,{})})]})}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsxs(U,{children:[e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})})]})}),e.jsx("tbody",{children:e.jsxs(_,{children:[e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})})]})})]})]}):e.jsxs(L,{children:[e.jsx(b,{children:e.jsxs(b.Content,{children:[e.jsx(b.Title,{children:"Published Updates"}),e.jsx(b.Description,{children:"last 90 days"})]})}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsx(U,{children:n?.count===0?e.jsx(g,{children:"Nothing has been published yet"}):e.jsxs(e.Fragment,{children:[e.jsx(g,{children:"Id"}),e.jsx(g,{children:"Date"}),e.jsx(g,{children:"By"}),e.jsx(g,{children:"Notes"})]})})}),e.jsx("tbody",{children:n?.results.map((i,o)=>e.jsx(ye,{row:[{type:"text",text:i.id.toString().padStart(3,"0")},{type:"linked_text",link:`/${s.accountSlug}/publish/compare/?before_publish=${i.id}&after_publish=${i.id}`,text:st(Ze(i.publishDate,{days:2}))?nt(i.publishDate)+" ago":ve(i.publishDate,"do MMM yy")+" "+we(i.publishDate)},{type:"text",text:i.user.firstName+" "+i.user.lastName},{type:"text",text:i.notes}]},o))})]})]})},mt=Y("/$accountSlug/dashboard"),xt=()=>{const s=mt.useParams(),{data:n,isPending:r}=E(je(s));return r?e.jsxs(L,{children:[e.jsx(b,{children:e.jsxs(b.Content,{children:[e.jsx(b.Title,{children:e.jsx(f,{})}),e.jsx(b.Description,{children:e.jsx(f,{})})]})}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsxs(U,{children:[e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})}),e.jsx(g,{children:e.jsx(f,{})})]})}),e.jsx("tbody",{children:e.jsxs(_,{children:[e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})})]})})]})]}):e.jsxs(L,{children:[e.jsx(b,{children:e.jsx(b.Content,{children:e.jsx(b.Title,{children:"Sections with Running Tests"})})}),e.jsxs(z,{children:[e.jsx("thead",{children:e.jsx(U,{children:n?.count===0?e.jsx(g,{children:"No tests are currently running"}):e.jsxs(e.Fragment,{children:[e.jsx(g,{children:"Section"}),e.jsx(g,{children:"Test"}),e.jsx(g,{children:"Start Date"}),e.jsx(g,{children:"Sparkline"})]})})}),e.jsx("tbody",{children:n?.results.map((i,o)=>e.jsx(ye,{row:[i.section?{type:"linked_text",text:i.section.name,link:`/${s.accountSlug}/${i.section.slug}/`}:{type:"text",text:"Deleted section"},{type:"linked_text",link:`/${s.accountSlug}/testing/results/${i.testId}/`,text:i.name},{type:"text",text:ve(i.startDatetime,"eee do MMM yy")},{type:"sparkline",data:i.sparkline}]},o))})]})]})},pt=Y("/$accountSlug/dashboard"),ft=({accountSlug:s,open:n,handleClose:r,sectionType:i,incidentId:o})=>{const m=pt.useNavigate(),[p,j]=$.useState(""),y=Ae({accountSlug:s}),c=p=="";return e.jsx(se,{open:n,onClose:r,children:e.jsxs(re,{children:[e.jsx(ae,{title:"Add Site Section",children:null}),e.jsx(ie,{children:e.jsx(Ne,{value:p,onChangeFunction:j,onChangeParameters:[],label:"Name"})}),e.jsxs(le,{classes:"flex justify-end gap-3",children:[e.jsx(V,{variant:"primary",onClick:()=>r(),children:"Cancel"}),e.jsx(oe,{variant:"primary",onClick:()=>{y.mutate({name:p,type:i},{onSuccess:u=>{fe(s,"New Site Section Saved",{accountSlug:s,sectionType:i,sectionName:p,incident_id:o}),m({to:"/$accountSlug/$sectionSlug/",params:{accountSlug:s,sectionSlug:u.slug},search:{tab:"site-section-configuration",incident_id:o}})}})}
2,loading:y.isPending,disabled:c,children:"OK"})]})]})})},gt=({modalIsOpen:s,handleClose:n,handleDelete:r,isDeleting:i,publishedToLive:o,currentExperimentIsCurrentlyPublished:m})=>m===!0?e.jsx(e.Fragment,{children:e.jsx(se,{open:s,onClose:n,children:e.jsxs(re,{children:[e.jsx(ae,{title:"Delete Section?",children:null}),e.jsx(ie,{children:e.jsx(W,{variant:"warning",message:"This section has an experiment which is currently published, therefore it cannot be deleted."})}),e.jsx(le,{classes:"flex justify-end gap-3",children:e.jsx(oe,{variant:"primary",onClick:n,children:"OK"})})]})})}):e.jsx(e.Fragment,{children:e.jsx(se,{open:s,onClose:n,children:e.jsxs(re,{children:[e.jsx(ae,{title:"Delete Section?",children:null}),e.jsxs(ie,{children:[o&&e.jsx(W,{variant:"warning",message:"This section is currently published to live, deleting it will not automatically stop the rules from being applied."}),e.jsx("p",{className:"font-2xl p-2",children:"Are you sure you want to delete this section? There is no undo."})]}),e.jsxs(le,{classes:"flex justify-end gap-3",children:[e.jsx(V,{onClick:n,variant:"primary",children:"Cancel"}),e.jsx(oe,{variant:"primary",loading:i,onClick:r,children:"OK"})]})]})})}),jt=({accountSlug:s,section:n,index:r,baseCopyModalFetchURL:i,archiveObjectPath:o,sectionType:m,handleDelete:p,showRules:j,refetch:y,hasRunwayRestrictions:c})=>{const[u,t]=$.useState(""),[a,l]=$.useState(!1);let h="-";n.lastUpdated!==null&&(h=n.lastUpdated.toDateString());let d=e.jsx("span",{children:"-"});n.currentExperiment!==null&&(d=e.jsx(ne,{to:"/$accountSlug/testing/in_section_test/test/$testId/",params:{accountSlug:s,testId:n.currentExperiment.testId},className:"text-purple-700",children:n.currentExperiment.name}));const x=async()=>{n.publishedToLive?window.location.href=`/${s}/publish/live/?${m==="request"?"request":"response"}_section_id=${n.id}`:y()},T=()=>{l(!0),p(n).then(()=>{t("")}).finally(()=>{t(""),l(!1)})};let C=null;return n.publishedToLive&&(C=e.jsx(W,{variant:"warning",message:"This section is currently published to live, archiving it will not un-publish it automatically."})),e.jsx(qe,{draggableId:`${n.id}`,index:r,children:P=>e.jsxs("tr",{className:"border-sp-neutral-200 bg-sp-white items-center border-b",ref:P.innerRef,...P.draggableProps,children:[e.jsx(v,{extraClasses:"w-1/12",...P.dragHandleProps,children:e.jsx(Z,{name:"dragDrop",size:"xl"})}),e.jsx(v,{extraClasses:"w-3/12",children:e.jsx("span",{className:"flex items-center",children:e.jsx(ne,{to:"/$accountSlug/$sectionSlug/",params:{accountSlug:s,sectionSlug:n.slug},className:"text-purple-700",children:n.name})})}),e.jsx(v,{extraClasses:"w-3/12",children:d}),j&&e.jsx(v,{extraClasses:"w-2/12",children:n.numEnabledRules}),e.jsx(v,{extraClasses:"w-2/12",children:h}),e.jsxs(v,{extraClasses:"w-1/12",children:[e.jsx(Ye,{open:u===`copy-${n.id}`,handleClose:()=>t(""),fetchURL:`${i}/${n.id}/`,targetElement:"section",accountSlug:s}),e.jsx(We,{objectID:n.id,objectType:m==="request"?"request_section":"section",objectName:n.name,objectDescription:"",open:u===`archive-${n.id}`,handleClose:()=>t(""),archiveObjectURL:o,onArchiveComplete:x,alert:C}),e.jsx(gt,{modalIsOpen:u===`delete-${n.id}`,handleClose:()=>t(""),handleDelete:T,isDeleting:a,publishedToLive:n.publishedToLive,currentExperimentIsCurrentlyPublished:n.currentExperiment?.isCurrentlyPublished}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(G,{text:void 0,iconName:"moreVertical",iconOnly:!0,children:[e.jsx(G.Item,{tabIndex:1,label:"Copy Section To Clipboard",leftIcon:"copy",disabled:c||n.isAssociatedWithPageTemplate,onClick:()=>{t(`copy-${n.id}`)}}),e.jsx(G.Item,{tabIndex:2,label:"Add to Archive",leftIcon:"storageBox",onClick:()=>{t(`archive-${n.id}`)}}),e.jsx(G.Item,{tabIndex:3,label:"Delete Section",leftIcon:"trashBin",onClick:()=>{t(`delete-${n.id}`)}})]})})]})]},r)})},bt=({accountSlug:s,sections:n,baseCopyModalFetchURL:r,archiveObjectPath:i,handleDelete:o,sectionType:m,showRules:p,refetch:j,hasRunwayRestrictions:y})=>n===null?e.jsxs(_,{children:[e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})}),e.jsx(v,{children:e.jsx(f,{})})]}):e.jsx(e.Fragment,{children:n!==void 0&&n.length!==0&&n.map((c,u)=>e.jsx(jt,{accountSlug:s,section:c,index:u,baseCopyModalFetchURL:r,archiveObjectPath:i,sectionType:m,handleDelete:o,showRules:p,refetch:j,hasRunwayRestrictions:y},`${c.id}-${u}`))}),F=({direction:s,onClickFunction:n,onClickParameters:r})=>{const i=s==="up"?"FiArrowUp":"FiArrowDown";return e.jsx("span",{onClick:()=>n(...r),className:"inline-block",children:e.jsx(Z,{name:i,size:"sm"})},`sort-${s}`)},vt=({sections:s,sortParams:n,searchText:r})=>{let i=De(s);return r!==""&&(i=i.filter(o=>o.name.toLowerCase().search(r)>-1)),n&&(i=i.sort((o,m)=>{const p=n.by==="currentExperiment"?o.currentExperiment?.name||"":o[n.by],j=n.by==="currentExperiment"?m.currentExperiment?.name||"":m[n.by];return p===j?o.id<m.id?n.direction==="down"?-1:1:n.direction==="down"?1:-1:p===null||j===null?1:p<j?n.direction==="down"?-1:1:n.direction==="down"?1:-1})),i},te=({accountSlug:s,fetchedSections:n,refetch:r,archiveObjectPath:i,sectionType:o,showRules:m,hasRunwayRestrictions:p})=>{const[j,y]=$.useState(""),[c,u]=$.useState(),[t,a]=$.useState(!1),[l,h]=$.useState(!1),[d,x]=$.useState(""),T=()=>{const k=crypto.randomUUID();x(k),a(!0),fe(s,"Add New Site Section Clicked",{accountSlug:s,sectionType:o,location:"Section List Dashboard",incident_id:k})},C=k=>{const O=`/${s}/${k.slug}/delete`;return Ie(O).then(()=>{k.publishedToLive?window.location.href=`/${s}/publish/live/?${o==="request"?"request":"response"}_section_id=${k.id}`:r()})},I=`/${s}
2/bundles/${o==="request"?"export_request_section":"export_section"}`;let D=null;switch(o){case"response":D="Sections";break;case"api":D="API Sections";break;case"request":D="Request Sections";break}const w=(k,O)=>{u({by:k,direction:O})},N=Re({accountSlug:s,sectionType:o}),S=k=>{const{draggableId:O,destination:R,source:H}=k;if(!R||R.droppableId===H.droppableId&&R.index===H.index)return;const X=parseInt(O),Se=R.index;N.mutate({id:X,toPosition:Se})},M=$.useMemo(()=>vt({sections:n,sortParams:c,searchText:j}),[n,c,j]);return e.jsxs(L,{children:[e.jsxs(b,{children:[e.jsx(b.Content,{children:e.jsx(b.Title,{children:D})}),e.jsxs(e.Fragment,{children:[!p&&e.jsx(Ke,{open:l,handleClose:()=>h(!1),fetchURL:`/${s}/bundles/import_account_bundle/`,targetElement:o==="request"?"request_section":"section",refetch:r}),e.jsxs(J,{kind:"solid",primaryActionLabel:"Add Section",onClick:T,children:[e.jsx(J.Item,{onClick:T,children:"Add New Section"}),!p&&e.jsx(J.Item,{onClick:()=>{h(!0)},children:"Paste Section From Clipboard"})]}),(o==="api"||o==="response"||o==="request")&&e.jsx(ft,{accountSlug:s,open:t,handleClose:()=>a(!1),sectionType:o,incidentId:d})]})]}),e.jsx(b,{roundedTop:!1,children:e.jsx(b.Search,{placeholder:"Search by name",leadingIcon:e.jsx(Z,{name:"search"}),onChangeFunction:y,value:j,tabIndex:1,onChangeParameters:[],"data-test":"searchInputField"})}),e.jsx(Be,{onDragEnd:S,children:e.jsxs(z,{overflow:!1,tableLayout:"fixed",children:[e.jsx("thead",{children:e.jsxs(U,{children:[e.jsx(g,{className:"w-1/12"}),e.jsxs(g,{className:"w-3/12",children:["Name",e.jsxs("span",{className:"align-middle",children:[e.jsx(F,{direction:"up",onClickFunction:w,onClickParameters:["name","up"]}),e.jsx(F,{direction:"down",onClickFunction:w,onClickParameters:["name","down"]})]})]}),e.jsxs(g,{className:"w-3/12",children:["Running Test",e.jsx(F,{direction:"up",onClickFunction:w,onClickParameters:["currentExperiment","up"]}),e.jsx(F,{direction:"down",onClickFunction:w,onClickParameters:["currentExperiment","down"]})]}),m&&e.jsxs(g,{className:"w-2/12",children:["Active Rules",e.jsx(F,{direction:"up",onClickFunction:w,onClickParameters:["numEnabledRules","up"]}),e.jsx(F,{direction:"down",onClickFunction:w,onClickParameters:["numEnabledrules","down"]})]}),e.jsxs(g,{className:"w-2/12",children:["Last Edited",e.jsx(F,{direction:"up",onClickFunction:w,onClickParameters:["lastUpdated","up"]}),e.jsx(F,{direction:"down",onClickFunction:w,onClickParameters:["lastUpdated","down"]})]}),e.jsx(g,{className:"w-1/12"})]})}),e.jsx(Qe,{droppableId:`droppable_${o}`,children:k=>e.jsxs("tbody",{className:"bg-white",role:"rowgroup",ref:k.innerRef,...k.draggableProps,children:[e.jsx(bt,{accountSlug:s,sections:M,baseCopyModalFetchURL:I,archiveObjectPath:i,handleDelete:C,sectionType:o,showRules:m,refetch:r,hasRunwayRestrictions:p}),k.placeholder]})})]})})]})},yt=Y("/$accountSlug/dashboard"),Et=()=>{const s=ke(),n=yt.useParams(),{data:r,refetch:i}=Pe($e(n)),o=["flamingo","jetstream"].includes(r.deploymentType),m=E(je(n)),p=E(ge(n)),j=E(Oe(n)),y=E(Fe(n)),c=E({...Ee(n),enabled:o});return e.jsxs(e.Fragment,{children:[e.jsx(_e,{children:e.jsxs("title",{children:[r.name," Dashboard | SearchPilot"]})}),e.jsxs(Te,{children:[e.jsx(ce,{label:r.name,href:s.buildLocation({to:"/$accountSlug/dashboard/",params:n}).href}),e.jsx(ce,{label:"Dashboard",href:"",currentCrumb:!0})]}),e.jsxs("main",{className:"ml-auto w-full grow",children:[e.jsx("div",{className:"mx-auto flex max-w-7xl flex-row items-center px-12 pt-4",children:e.jsx("h1",{className:"text-sp-neutral font-medium",children:"Site Dashboard"})}),e.jsxs("div",{className:"mx-auto mt-5 max-w-7xl px-12",children:[r.deploymentStatus==="retired"&&e.jsx("div",{className:"mt-4",children:e.jsx(W,{variant:"warning",children:"This account has been retired and should not be used."})}),r.deploymentStatus!=="deployed"&&r.deploymentStatus!=="retired"&&r.environment==="production"&&e.jsx("div",{className:"mt-4",children:e.jsx(W,{variant:"warning",children:"This site is not currently deployed."})}),e.jsxs(q.Group,{children:[e.jsx(q,{loading:m.isPending,type:"simple",title:"Running Tests",value:
2B.compactInteger(m.data?.count||0,1)}),e.jsx(q,{loading:j.isPending,type:"simple",title:"Gained Sessions",value:B.compactInteger(j.data?.gainedSessions||0,1),pill:e.jsx(ee,{colour:"green",text:"per day"})}),o&&e.jsx(q,{loading:c.isPending,type:"simple",title:"Active Rules",value:B.compactInteger(c.data?.numActiveRules||0,1)}),e.jsx(q,{loading:y.isPending,type:"simple",title:"Successful Tests",value:B.compactInteger(y.data?.numPositiveExperiments||0,1),pill:e.jsx(ee,{colour:"green",text:"last 90 days"})}),e.jsx(q,{loading:p.isPending,type:"simple",title:"Published Updates",value:B.compactInteger(p.data?.count||0,1),pill:e.jsx(ee,{colour:"green",text:"last 90 days"})})]}),r.deploymentType==="api"?e.jsx(te,{accountSlug:r.slug,fetchedSections:r.apiSections,refetch:i,archiveObjectPath:r.archiveObjectUrl,sectionType:"api",showRules:!1,hasRunwayRestrictions:r.hasRunwayRestrictions}):e.jsx(te,{accountSlug:r.slug,fetchedSections:r.responseSections,refetch:i,archiveObjectPath:r.archiveObjectUrl,sectionType:"response",showRules:!0,hasRunwayRestrictions:r.hasRunwayRestrictions}),r.reqmodEnabled&&e.jsx(te,{accountSlug:r.slug,fetchedSections:r.requestSections,refetch:i,archiveObjectPath:r.archiveObjectUrl,sectionType:"request",showRules:!0,hasRunwayRestrictions:r.hasRunwayRestrictions}),r.canSeeHodgePodge&&r.hasRunwayEnabled&&e.jsx(ot,{canModifyPageTemplates:r.canModifyPageTemplates}),e.jsxs("div",{className:"grid gap-8 sm:grid-cols-2",children:[e.jsx(ht,{}),e.jsx(xt,{})]})]})]})]})};export{Et as default};
3//# sourceMappingURL=DashboardApp-DGuubH43.js.map

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.