1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8065],{34984:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/segments/[segmentId]",function(){return s(90783)}])},45188:(e,t,s)=>{"use strict";s.d(t,{y:()=>i});var n=s(16932),a=s(19117);let i=(e,t)=>{let s=(0,a.MI)({needsAuthentication:!0});return(0,n.n)({mutationFn:t=>{let{brand_id:n,is_tracked:a=!0,name:i}=t;return s(e,{method:"PUT",body:JSON.stringify({is_tracked:a,brand_id:n,name:i})})},onSuccess:null==t?void 0:t.onSuccess,onError:null==t?void 0:t.onError})}},54524:(e,t,s)=>{"use strict";s.d(t,{m:()=>r});var n=s(6029),a=s(42042),i=s(95577);let r=e=>{let{row:t,header:s}=e,r=(0,a.LJ)(t,s.key);return(0,n.jsx)(i.f,{value:r})}},59993:(e,t,s)=>{"use strict";s.d(t,{l:()=>p});var n=s(6029),a=s(55729),i=function(e){return e.Custom="custom",e.BrandPost="brand_post",e.UGCPost="ugc_post",e.PaidPost="paid_post",e}({}),r=s(42042),l=s(20300),o=s(99476),d=s(73789),c=s(25880),u=s(17911),m=s(49956);let p=e=>{let{chartEventPerDateData:t,organizationId:s,brandId:p,brandIds:h,segmentId:g,...y}=e,[x,f]=(0,a.useState)(!1),[v,j]=(0,a.useState)(o.C),[S,b]=(0,a.useState)(!1),[C,I]=(0,a.useState)(),[_,w]=(0,a.useState)([]),A=(0,a.useMemo)(()=>h||(p?[p]:[]),[p,h]),k=(e,t)=>{j({...e.metadata,segment_id:e.metadata.segment_id||g,date:t}),f(!0)},N=e=>{let t=e.map(e=>e.metadata);w(t),I(t[0]),b(!0)},T=null==t?void 0:t.filter(e=>e.events.length).map(e=>{let t=e.events.filter(e=>e.event_type===i.Custom),s=e.events.filter(e=>e.event_type===i.BrandPost),a=e.events.filter(e=>e.event_type===i.UGCPost),l=e.events.filter(e=>e.event_type===i.PaidPost),o=e.date,d=[s.length>0&&{key:"artist-post",label:"".concat(s.length," Artist Post").concat(1!==s.length?"s":""," with > 250k Views"),posts:s},a.length>0&&{key:"fan-post",label:"".concat(a.length," Fan Post").concat(1!==a.length?"s":""," with > 250k Views"),posts:a},l.length>0&&{key:"paid-post",label:"".concat(l.length," Paid Post").concat(1!==l.length?"s":""),posts:l}].filter(Boolean),c=t[0];return{date:o,markerColor:l.length>0?"#EAB308":(null==c?void 0:c.metadata.marker_color)||"#2563eb",tooltipContent:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.E,{typography:m.o.Caption2,bold:!0,children:"".concat((0,r.Yq)(o)," ⢠").concat(e.events.length," Event").concat(1===e.events.length?"":"s")}),(0,n.jsxs)("div",{className:"space-y-1",children:[t.map((e,t)=>(0,n.jsx)("button",{type:"button",onClick:()=>k(e,o),className:"block w-full text-left transition hover:opacity-70",children:(0,n.jsx)(m.E,{typography:m.o.Caption2,bold:!0,className:"text-primary-600",children:e.metadata.name})},e.metadata.id||"custom-event-".concat(t))),d.map(e=>(0,n.jsx)("button",{type:"button",onClick:()=>N(e.posts),className:"block w-full text-left transition hover:opacity-70",children:(0,n.jsx)(m.E,{typography:m.o.Caption2,bold:!0,className:"text-primary-600",children:e.label})},e.key))]})]}),onClick:()=>{if(1===t.length&&0===d.length)return void k(t[0],o);0===t.length&&1===d.length&&N(d[0].posts)}}}),E=_.findIndex(e=>e.id===(null==C?void 0:C.id)),P=g?{segmentId:g}:{brandIds:A};return(0,n.jsxs)(n.Fragment,{children:[x&&(0,n.jsx)(d.A,{customChartEvent:v,setCustomChartEvent:j,isOpen:x,onClose:()=>f(!1),editing:!!v.id,organizationId:s,...P}),S&&C&&(0,n.jsx)(c.V,{video:(0,l.sU)(C),organizationId:s,onClose:()=>{b(!1),I(void 0),w([])},onClickNext:()=>{I(_[E+1])},onClickBack:()=>{I(_[E-1])},isNextButtonDisabled:E===_.length-1,isBackButtonDisabled:0===E}),(0,n.jsx)(u.T,{annotations:T,...y})]})}},71745:(e,t,s)=>{"use strict";s.d(t,{v:()=>d});var n=s(6029),a=s(55729),i=s(83409),r=s(82558),l=s(85693),o=s(49956);let d=e=>{let{value:t,validators:s,onChange:d,typography:c=o.o.Title1}=e,u=(0,a.useRef)(null),[m,p]=(0,a.useState)(t),[h,g]=(0,a.useState)(!1),[y,x]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{h&&setTimeout(()=>{var e;null==(e=u.current)||e.focus()},200)},[h]),h)?(0,n.jsxs)("div",{className:"w-f flex w-full max-w-[680px] items-center gap-2",children:[(0,n.jsx)(l.p,{ref:u,className:"w-full max-w-[680px] flex-1",value:m,validators:s,onChange:e=>{p(e.target.value)}}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(i.$n,{type:i.VQ.Tertiary,size:i.Mp.Small,text:"Cancel",onClick:()=>{g(!1)}}),(0,n.jsx)(i.$n,{type:i.VQ.Primary,size:i.Mp.Small,text:"Confirm",loading:y,onClick:()=>{x(!0),d(m).then(()=>{g(!1),x(!1)}).catch(()=>{x(!1)})}})]})]}):(0,n.jsxs)("div",{className:"group flex w-full cursor-pointer items-center",onClick:()=>{g(!0)},children:[(0,n.jsx)(o.E,{typography:c,bold:!0,children:t}),(0,n.jsx)(r.I,{className:"inline-block translate-x-2 transform fill-slate-800 transition-transform group-hover:translate-x-4",type:r.A.Edit,size:16})]})}},90783:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>W});var n=s(6029),a=s(25126),i=s(69612),r=s(10486),l=s(1420),o=s(11708),d=s(93251),c=s(37713),u=s(59295),m=s(45188),p=s(92191),h=s(69316),g=s(63752),y=s(60588),x=s(82558),f=s(71745),v=s(43584),j=s(49956);let S=e=>{let{organizationId:t,segmentId:s,hideCreatedBadge:i,defaultName:r,brandId:l}=e,{segmentEmailSubscriptionOverlord:o}=(0,c.D0)(),S=(0,d.jE)(),{data:b,isLoading:C}=(0,a.H)({segmentId:s}),I=(0,m.y)("/api/".concat(t,"/segments/").concat(s),{onSuccess:()=>{S.invalidateQueries({queryKey:[p.n1,{segmentId:s}]}),S.invalidateQueries({queryKey:[p.a0]})}}),_=(null==b?void 0:b.name)||r;return(0,n.jsxs)("div",{className:"flex flex-row flex-wrap justify-between gap-6 pt-8",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[_&&!C?(0,n.jsx)(n.Fragment,{children:l?(0,n.jsx)(f.v,{value:_,onCh
1ange:e=>I.mutateAsync({brand_id:l,name:e})}):(0,n.jsx)(j.E,{className:"w-full",typography:j.o.Title1,bold:!0,children:_||""})}):(0,n.jsx)(j.E,{className:"w-full",typography:j.o.Title1,bold:!0,children:"Loading..."}),!i&&(null==b?void 0:b.created_at)?(0,n.jsx)(h.E,{type:h._.White,iconType:x.A.Calendar,title:(0,u.A)(null==b?void 0:b.created_at).format("[Created] MMM DD, YYYY")}):null]}),(0,n.jsxs)(g.e,{children:[(0,n.jsx)(v.A,{segmentId:s}),o?(0,n.jsx)(y.A,{organizationId:t,segmentId:s}):null]})]})};var b=s(84340),C=s(35787),I=s(81278),_=s(55729),w=s(3896),A=s(83409),k=s(17989),N=s(72152),T=s(12482),E=s(19117),P=s(16932),q=s(35430),M=s(79895),z=s(74369),O=s(92237),D=s(38718),Q=s(93486);let F=e=>{let{segmentId:t,isOpen:s,onClose:a}=e,{addToast:i}=(0,Q.Xm)(),[r,l]=(0,_.useState)([]),[o,c]=(0,_.useState)(!1),u=(()=>{let e=(0,E.MI)({needsAuthentication:!0}),t=(0,d.jE)();return(0,P.n)({mutationFn:t=>{let{segment_id:s,tiktok_queries:n}=t;return e("/v1/segments/".concat(s,"/add_queries"),{method:"POST",body:JSON.stringify({tiktok_queries:n})})},onSuccess:(e,s)=>{let{segment_id:n}=s;t.invalidateQueries({queryKey:[p.mL,n]})}})})();return(0,n.jsxs)(q.a,{isOpen:s,onClose:a,className:"w-full max-w-[800px]",children:[(0,n.jsx)(z.r,{title:"Add Search Terms"}),(0,n.jsx)("div",{className:"px-6",children:(0,n.jsx)(O.A,{searchQueries:r,setSearchQueries:l})}),(0,n.jsx)(M.j,{className:"flex flex-row justify-end",children:(0,n.jsx)(A.$n,{type:A.VQ.Primary,size:A.Mp.Small,iconType:x.A.Plus,text:"Add",onClick:()=>{t&&(c(!0),u.mutateAsync({segment_id:t,tiktok_queries:r}).then(()=>{i(D.K.Success,"Successfully added search terms"),a()}).catch(()=>{i(D.K.Error,"Failed to add search terms")}).finally(()=>{c(!1)}))},loading:o,disabled:!r.length})})]})};var K=s(24447),L=s(21815);let B=[{key:"query",title:"Search Query",colspan:2,sortable:!0,cell:s(54524).m}],V=e=>{let{segmentId:t,segmentQuery:s}=e,{addToast:a}=(0,Q.Xm)(),[i,r]=(0,_.useState)(!1),l=(()=>{let e=(0,E.MI)({needsAuthentication:!0}),t=(0,d.jE)();return(0,P.n)({mutationFn:t=>{let{segment_id:s,tiktok_queries:n}=t;return e("/v1/segments/".concat(s,"/remove_queries"),{method:"POST",body:JSON.stringify({tiktok_queries:n})})},onSuccess:(e,s)=>{let{segment_id:n}=s;t.invalidateQueries({queryKey:[p.mL,n]})}})})();return(0,n.jsx)(A.$n,{type:A.VQ.IconOnly,size:A.Mp.Small,onClick:()=>{r(!0),l.mutateAsync({segment_id:t,tiktok_queries:[s.query]}).then(()=>{a(D.K.Success,"Successfully removed search term")}).catch(()=>{a(D.K.Error,"Failed to remove search term")}).finally(()=>{r(!1)})},iconType:x.A.Trash,tooltipTitle:"Remove",disabled:i})},R=e=>{let{showTitle:t=!0,isAddSearchTermModalOpen:s,setIsAddSearchTermModalOpen:a}=e,{segmentId:i}=(0,I.useRouter)().query,[r,l]=(0,_.useState)(10),[o,d]=(0,_.useState)(0),[c,u]=(0,_.useState)("video_count"),[m,h]=(0,_.useState)(N.m.Desc),{data:g,isLoading:y}=((e,t)=>{let s=(0,E.MI)({needsAuthentication:!0}),n=new URLSearchParams;return t&&(n.append("limit",String(t.limit)),n.append("offset",String(t.offset)),n.append("order_by",t.order),n.append("order_direction",t.orderDirection)),(0,T.I)({queryKey:[p.mL,e,null==t?void 0:t.limit,null==t?void 0:t.offset,null==t?void 0:t.order,null==t?void 0:t.orderDirection],queryFn:()=>s("/v1/segments/".concat(e,"/queries?").concat(n)),enabled:!!e})})(i,{limit:r,offset:o,order:c,orderDirection:m}),f=null==g?void 0:g.items.map(e=>({...e,id:e.query}));return(0,n.jsxs)(n.Fragment,{children:[s&&(0,n.jsx)(F,{segmentId:i,isOpen:s,onClose:()=>a(!1)}),(0,n.jsxs)("div",{className:"w-full",children:[t?(0,n.jsxs)("div",{className:"sticky top-0 z-20 flex flex-row items-center justify-between space-x-3 bg-white py-5",children:[(0,n.jsx)(j.E,{typography:j.o.Body,bold:!0,children:"Search Queries"}),(0,n.jsx)(A.$n,{type:A.VQ.Tertiary,size:A.Mp.Small,iconType:x.A.Plus,text:"Add Search Term",onClick:()=>a(!0)})]}):null,(0,n.jsx)(K.XI,{headers:B,data:f||[],isLoading:y,sort:c,sortDirection:m,pageSize:r,resetTableData:()=>{l(r),d(0)},footer:(0,n.jsx)(L.A,{totalNumberOfItems:(null==g?void 0:g.count)||0,limit:r,offset:o,onPageChange:(e,t)=>
1{l(e),d(t)}}),onSortChange:(e,t)=>{u(e),h(t)},renderActionCell:e=>(0,n.jsx)(V,{segmentId:i,segmentQuery:e})})]})]})};var U=s(10582),$=s(61409),X=s(80589),Y=s(199);let J=e=>{let{segmentId:t}=e,{activeOrganizationId:s}=(0,X.A)(),[a,i]=(0,_.useState)(0),[r,l]=(0,_.useState)(!1),[o,d]=(0,_.useState)(5),[c,u]=(0,_.useState)(0),[m,p]=(0,_.useState)("spend"),[h,g]=(0,_.useState)(N.m.Desc),{data:y,isLoading:f}=(e=>{let{segmentId:t,limit:s,offset:n,orderBy:a,orderDirection:i}=e,r=(0,E.MI)({needsAuthentication:!0}),l=new URLSearchParams;return s&&l.append("limit",s.toString()),n&&l.append("offset",n.toString()),a&&l.append("order_by",a),i&&l.append("order_by_direction",i.toString().toLowerCase()),(0,T.I)({queryKey:["TRACK_PROMOTIONS",{segmentId:t,limit:s,offset:n,orderBy:a,orderDirection:i}],queryFn:()=>r("/v1/segments/".concat(t,"/activations?").concat(l.toString())),enabled:!!t})})({segmentId:t,limit:o,offset:c,orderBy:m,orderDirection:h});return(0,n.jsxs)("div",{className:"space-y-4 py-10",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 bg-white",children:[(0,n.jsx)(k.V,{tabs:[{title:"Sounds"},{title:"Search Terms"}],index:a,onTabChange:e=>i(e)}),0===a&&(0,n.jsx)(U.A,{organizationId:s,segmentId:t,segmentType:$.MI.Segment}),1===a&&(0,n.jsx)(A.$n,{type:A.VQ.Tertiary,size:A.Mp.Small,iconType:x.A.Plus,text:"Add Search Term",onClick:()=>l(!0)})]}),0===a&&(0,n.jsx)(Y.A,{segmentId:t,segmentType:$.MI.Segment}),1===a&&(0,n.jsx)(R,{showTitle:!1,isAddSearchTermModalOpen:r,setIsAddSearchTermModalOpen:l})]})};var G=s(10607);let H=()=>{let{segmentId:e}=(0,I.useRouter)().query,{activeOrganizationId:t}=(0,X.A)(),{data:s}=(0,a.H)({segmentId:e}),{setBreadcrumbs:d}=(0,G.Cq)();return(0,_.useEffect)(()=>{d([{title:"Discovery",href:"/discovery"},{title:"Segment Detail"}])},[s,d]),(0,n.jsxs)("div",{className:"relative w-full px-8 pb-8",children:[(0,n.jsx)(S,{organizationId:t,segmentId:e,brandId:null==s?void 0:s.brand_id}),(0,n.jsxs)("div",{className:"divide-y-[1px] divide-slate-200 [&>*]:py-12",children:[(0,n.jsx)(i.e,{organizationId:t,segmentId:e}),(0,n.jsx)(J,{segmentId:e}),(0,n.jsx)(C.A,{sectionSubtitle:"Impactful posts featuring sounds, search terms and #hashtags used in this segment.",segmentId:e,organizationId:t,forceContentAnalytics:!1}),(0,n.jsx)(r.A,{segmentId:e,organizationId:t,forceContentAnalytics:!1}),(0,n.jsxs)("div",{className:"space-y-6 py-10",children:[(0,n.jsx)(l._,{title:"Top Creators",subtitle:"Impactful creators with content featuring sounds, search queries and #hashtags used in this segment."}),(0,n.jsx)(o.i,{segmentId:e,organizationId:t})]}),t?(0,n.jsx)(b._,{organizationId:t,segmentId:e,sectionSubtitle:"Countries with content featuring sounds, search terms and #hashtags used in this segment."}):null]})]})};H.getLayout=function(e){return(0,n.jsx)(w.A,{noPadding:!0,children:e})};let W=H}},e=>{e.O(0,[8435,7280,5121,813,9880,4540,2824,2359,4204,7225,113,6985,9432,1518,5340,3896,6956,5253,9088,5428,636,6593,8792],()=>e(e.s=34984)),_N_E=e.O()}]);
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.