PageSourceSearch

https://www.offbrand.ai/_next/static/chunks/pages/connect/slack/channels-c3fda7b41747dbef.js

js offbrand.ai collected 2026-10-05 12:20:22 UTC 12,423 bytes, 1 lines download raw bytes

1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b9fc2845-affb-46d2-9849-a13b97ba83e8",e._sentryDebugIdIdentifier="sentry-dbid-b9fc2845-affb-46d2-9849-a13b97ba83e8")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3162],{5294:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>v});var a=t(37876),s=t(89099),l=t(14232),c=t(77328),r=t.n(c),i=t(54587),o=t.n(i),d=t(90900),h=t.n(d);function u(e){let{channelSearch:n,channels:t,primaryChannel:s,selectedIds:l,suggestedIds:c,channelsLoading:r,error:i,submitting:o,ctaDisabled:d,onChannelSearchChange:u,onToggleChannel:w,onClearSelected:k,onSubmit:b,onBack:x}=e,j=l.size,y=Array.from(l).filter(e=>c.has(e)).length,v=function(e){let n=(null!=e?e:"").trim();return n?n.startsWith("#")?n:"#".concat(n):null}(null==s?void 0:s.name),C=+!!v+j,S="channel".concat(1===C?"":"s"),N=C?"".concat(C," ").concat(S," selected"):"No channels selected",I=j?"Invite Brandy to ".concat(C," ").concat(S):v?"Continue with ".concat(C," ").concat(S):"Continue without channels context";return(0,a.jsxs)(m,{children:[(0,a.jsx)("p",{className:h().description,children:"We selected the public channels most likely to help Brandy understand your brand, campaigns, and team context."}),(0,a.jsxs)("div",{className:h().summaryRow,children:[(0,a.jsxs)("div",{className:"".concat(h().suggestionPill," ").concat(C?h().suggestionPillActive:""),children:[(0,a.jsx)("span",{className:h().pillCheck,"aria-hidden":"true",children:C?(0,a.jsx)(g,{}):null}),(0,a.jsx)("span",{children:N})]}),(0,a.jsx)("button",{className:h().deselectLink,disabled:!j,onClick:k,type:"button",children:"Deselect all"})]}),(0,a.jsxs)("label",{className:h().searchBox,children:[(0,a.jsx)(p,{}),(0,a.jsx)("input",{value:n,onChange:e=>u(e.target.value),placeholder:"search public channels"})]}),(0,a.jsxs)("div",{className:h().channelList,children:[(0,a.jsxs)("div",{className:h().channelListHeader,children:[(0,a.jsxs)("span",{children:[C," selected"]}),(0,a.jsx)("button",{"aria-label":"Deselect all channels",className:h().clearButton,disabled:!j,onClick:k,type:"button",children:(0,a.jsx)(_,{})})]}),(0,a.jsx)("div",{className:h().channelRows,children:r?(0,a.jsx)("div",{className:h().channelState,children:"Loading channels..."}):v||t.length?(0,a.jsxs)(a.Fragment,{children:[v?(0,a.jsxs)("div",{className:"".concat(h().channelRow," ").concat(h().primaryChannelRow),children:[(0,a.jsxs)("span",{children:[v,(0,a.jsx)("span",{className:h().homePill,children:"Home"})]}),(0,a.jsx)("span",{className:"".concat(h().channelCheck," ").concat(h().channelCheckSelected),children:(0,a.jsx)(g,{})})]}):null,t.map(e=>{let n=l.has(e.id);return(0,a.jsxs)("button",{"aria-pressed":n,className:h().channelRow,onClick:()=>w(e),type:"button",children:[(0,a.jsxs)("span",{children:["#",e.name]}),(0,a.jsx)("span",{className:"".concat(h().channelCheck," ").concat(n?h().channelCheckSelected:""),children:n?(0,a.jsx)(g,{}):null})]},e.id)})]}):(0,a.jsx)("div",{className:h().channelState,children:"No public channels found."})})]}),i?(0,a.jsx)("div",{className:h().inlineError,children:i}):null,(0,a.jsxs)("button",{className:h().cta,disabled:d,onClick:()=>{b()},type:"button",children:[(0,a.jsx)("span",{children:o?"Updating Slack...":I}),(0,a.jsx)(f,{})]}),(0,a.jsx)("p",{className:h().changeNote,children:"You can remove Brandy from any channel anytime."}),(0,a.jsx)("button",{className:h().backLink,onClick:x,type:"button",children:"Go back"}),(0,a.jsxs)("span",{className:h().visuallyHidden,children:[y," suggested channels remain selected"]})]})}function m(e){let{children:n}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(r(),{children:[(0,a.jsx)("title",{children:"Review channels for Brand Memory | Offbrand.ai"}),(0,a.jsx)("meta",{name:"description",content:"Review which Slack channels Brandy can use for Brand Memory context."})]}),(0,a.jsxs)("main",{className:h().page,children:[(0,a.jsx)("header",{className:h().topbar,children:(0,a.jsx)("a",{"aria-label":"Offbrand.ai home",className:h().logo,href:"/",children:(0,a.jsx)(o(),{src:"/images/offbrand logo.svg",alt:"Offbrand.ai",width:120,height:32,priority:!0})})}),(0,a.jsxs)("section",{className:h().content,children:[(0,a.jsx)("h1",{children:"Review channels for Brand Memory"}),n]})]})]})}function p(){return(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",height:"24",viewBox:"0 0 24 24",width:"24",children:[(0,a.jsx)("circle",{cx:"11",cy:"11",r:"6.25",stroke:"currentColor",strokeWidth:"2"}),(0,a.jsx)("path",{d:"M16 16L20 20",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})]})}function g(){return(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",children:(0,a.jsx)("path",{d:"M3.4 8.2l3 3 6.2-6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function _(){return(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",children:(0,a.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2"})})}function f(){return(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",children:[(0,a.jsx)("path",{d:"M4 10h11",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"}),(0,a.jsx)("path",{d:"M11 6l4 4-4 4",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})]})}var w=t(40424),k=t(44918);let b=()=>{let e=(0,s.useRouter)(),{attemptedSignIn:n,authUser:t}=(0,k.Z)(),[c,r]=(0,l.useState)(!1),[i,o]=(0,l.useState)(""),[d,p]=(0,l.useState)([]),[g,_]=(0,l.useState)({}),[f,b]=(0,l.useState)(()=>new Set),[v,C]=(0,l.useState)(()=>new Set),[S,N]=(0,l.useState)(!1),[I,R]=(0,l.useState)(!1),[L,B]=(0,l.useState)(null),[P,E]=(0,l.useState)(!1);(0,l.useEffect)(()=>{e.isReady&&r(!0)},[e.isReady]);let M=c?y(e.query.brandId):null,T=c?y(e.query.teamId):null,A=c?y(e.query.slackAppId):null,O=c?y(e.query.primaryChannelId):null,W=c?y(e.query.slackChannel):null;(0,l.useEffect)(()=>
1{M&&n&&!t&&window.location.assign(x({brandId:M,teamId:T,returnTo:e.asPath}))},[n,t,M,e.asPath,T]),(0,l.useEffect)(()=>{if(!M||!n||!t)return;let e=!1,a=async()=>{R(!0),B(null);try{var n,a;let s=await t.getIdToken(!0),l=new URLSearchParams({limit:"300"});T&&l.set("teamId",T),i.trim()&&l.set("q",i.trim());let c=await fetch("/api/knowledge/".concat(encodeURIComponent(M),"/slack/channels?").concat(l.toString()),{headers:{fbtkn:s}}),r=await c.json();if(!c.ok)throw Error(null!=(n=r.error)?n:"Could not load Slack channels.");if(e)return;let o=(null!=(a=r.channels)?a:[]).filter(e=>!function(e,n,t){if(n&&e.id===n)return!0;let a=j(t);return!!(a&&j(e.name)===a)}(e,O,W));if(p(o),_(e=>{let n={...e};for(let e of o)n[e.id]=e;return n}),!S&&!i.trim()){let e=o.map(e=>{var n;return{id:e.id,score:function(e){var n;let t=(n=e.name,(null!=n?n:"").trim().replace(/^#/,"").toLowerCase().replace(/_/g,"-"));if(!t||e.isGeneral||["general","random","joke","jokes","fun","training","test","testing","sandbox","dev","engineering","support","it","hr","legal"].some(e=>t===e||t.includes("-".concat(e))||t.includes("".concat(e,"-"))))return 0;let a=0;return["brand","branding","marketing","campaign","campaigns","content","creative","design","studio","copy","copywriting","messaging","social","comms","communications","pr","public-relations","growth","gtm","go-to-market","product-marketing"].some(e=>t===e||t.includes(e))&&(a+=4),["sales","biz-dev","business-development","partnerships","customer","customers","community","events","launch","website","web","seo","paid","ads","advertising","editorial","lifecycle","demand-gen","revenue"].some(e=>t===e||t.includes(e))&&(a+=2),e.isMember&&(a+=1),a}(e),members:null!=(n=e.numMembers)?n:0}}).filter(e=>e.score>=4).sort((e,n)=>n.score-e.score||n.members-e.members||e.id.localeCompare(n.id)).slice(0,25).map(e=>e.id);C(new Set(e)),b(new Set(e)),N(!0)}}catch(n){e||B(n.message)}finally{e||R(!1)}},s=window.setTimeout(()=>{a()},220);return()=>{e=!0,window.clearTimeout(s)}},[n,t,M,i,O,W,S,T]);let H=(0,l.useMemo)(()=>Array.from(f).map(e=>g[e]).filter(e=>!!e),[g,f]),D=f.size,q=P||!M||D>0&&H.length!==D,U=async()=>{if(M&&!q){if(!t)return void window.location.assign(x({brandId:M,teamId:T,returnTo:e.asPath}));E(!0),B(null);try{let l=0;if(H.length){var n,a,s;let e=await t.getIdToken(!0),c=await fetch("/api/knowledge/".concat(encodeURIComponent(M),"/slack"),{method:"POST",headers:{"Content-Type":"application/json",fbtkn:e},body:JSON.stringify({intent:"provision_reviewed_channels",teamId:T,channels:H.map(e=>({channelId:e.id,channelName:e.name}))})}),r=await c.json();if(!c.ok)throw Error(null!=(a=r.error)?a:"Could not invite Brandy to those channels.");l=null!=(s=null==(n=r.review)?void 0:n.invitedCount)?s:H.length}await e.push((0,w.gi)("teammates",{brandId:M,teamId:T,slackAppId:A,mode:"channel",channelId:O,channelName:W,reviewedCount:l}))}catch(e){B(e.message),E(!1)}}};return c&&n?(0,a.jsx)(u,{channelSearch:i,channels:d,primaryChannel:W?{id:O,name:W}:null,selectedIds:f,suggestedIds:v,channelsLoading:I,error:L,submitting:P,ctaDisabled:q,onCh
1annelSearchChange:o,onToggleChannel:e=>{_(n=>({...n,[e.id]:e})),b(n=>{let t=new Set(n);return t.has(e.id)?t.delete(e.id):t.add(e.id),t})},onClearSelected:()=>{b(new Set)},onSubmit:U,onBack:()=>e.back()}):(0,a.jsx)(m,{children:(0,a.jsx)("div",{className:h().loadingState,children:"Loading Slack channels..."})})};function x(e){let n=new URLSearchParams({redirect:"1",returnTo:e.returnTo,brandId:e.brandId});return e.teamId&&n.set("team",e.teamId),"/api/auth/slack/start?".concat(n.toString())}function j(e){return(null!=e?e:"").trim().replace(/^#/,"").toLowerCase().replace(/_/g,"-")}function y(e){return"string"==typeof e&&e.trim()?e.trim():Array.isArray(e)?y(e[0]):null}b.hideAppShell=!0;let v=b},40424:(e,n,t)=>{"use strict";t.d(n,{M6:()=>i,ZE:()=>d,gi:()=>l,lI:()=>c,le:()=>o});let a=["teammates","brand","tools"];function s(e){let n=new URLSearchParams({brandId:e.brandId});return e.teamId&&n.set("teamId",e.teamId),e.slackAppId&&n.set("slackAppId",e.slackAppId),e.channelId&&n.set("channelId",e.channelId),e.channelName&&n.set("slackChannel",e.channelName),e.mode&&n.set("mode",e.mode),e.reviewedCount&&e.reviewedCount>0&&n.set("slackReviewedChannels",String(e.reviewedCount)),n}function l(e,n){return"/connect/slack/".concat(e,"?").concat(s(n).toString())}function c(e,n){let t=a.indexOf(e),c=t>=0?a[t+1]:void 0;return c?l(c,n):function(e){let n=s(e);return n.get("mode")||n.set("mode","channel"),"/connect/slack/ready?".concat(n.toString())}(n)}function r(e,n,t){return 1===e?n:null!=t?t:"".concat(n,"s")}function i(e){return e<=0?"Continue without introductions":"Introduce Brandy to ".concat(e," ").concat(r(e,"teammate"))}function o(e){return e<=0?"Add a document, URL, or link to continue":"Build Brand Memory with these sources"}function d(e){return e<=0?"Continue without connections":"Continue with ".concat(e," ").concat(r(e,"connection"))}},73815:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/connect/slack/channels",function(){return t(5294)}])},90900:e=>{e.exports={page:"channels_page__j_7WM",topbar:"channels_topbar__RSmX6",logo:"channels_logo___1E6s",content:"channels_content__hps2k",description:"channels_description__aREWz",summaryRow:"channels_summaryRow__kFyR7",suggestionPill:"channels_suggestionPill__P7g7U",suggestionPillActive:"channels_suggestionPillActive__qILfQ",pillCheck:"channels_pillCheck__HJMaZ",deselectLink:"channels_deselectLink__diTnH",backLink:"channels_backLink__Q6gDw",clearButton:"channels_clearButton__Y1vvV",searchBox:"channels_searchBox__fuMli",channelList:"channels_channelList__eKOsO",channelListHeader:"channels_channelListHeader__B6xe1",channelRows:"channels_channelRows__w2eV9",channelRow:"channels_channelRow__jCNOD",primaryChannelRow:"channels_primaryChannelRow__pZZ2y",homePill:"channels_homePill__OThqR",channelCheck:"channels_channelCheck__sho1P",channelCheckSelected:"channels_channelCheckSelected__ZFFNw",channelState:"channels_channelState__jXy1Q",cta:"channels_cta__jbSiM",changeNote:"channels_changeNote__m8n7R",inlineError:"channels_inlineError__EeSHd",loadingState:"channels_loadingState__c_Ws0",visuallyHidden:"channels_visuallyHidden__vtwYV"}}},e=>{e.O(0,[636,6593,8792],()=>e(e.s=73815)),_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.