PageSourceSearch

https://www.sociallift.ai/assets/BrandSettings-BY4a_a2F.js

js sociallift.ai collected 2026-10-05 15:08:03 UTC 13,796 bytes, 1 lines download raw bytes

1import{j as e,X as H,I as z,J,u as K,f as q,g as Y,D as X,r as g,s as G,m as M,K as i,B as E,b as T,T as S,N as D,Q as F,R as $,L as ee,U as ae,V as se,W as te,S as ne,Y as re,Z as oe,_ as ie,$ as le,a0 as ce}from"./index-DL0d_lAK.js";import{u as L}from"./useMutation-D_ZYaUMO.js";import{B as de}from"./BrandSetupDialog-Dyzu0QnK.js";import{I as ue}from"./InstagramConnect-B0_E5wPE.js";import{S as me,A as pe,M as xe,P as ge,D as he}from"./DeleteBrandDialog-96KNa9Zq.js";import{C as Q}from"./card-DnGeKDac.js";import{I as w}from"./input-BZVgYfh9.js";import{S as k}from"./select-DCy2S0v2.js";import{F as be}from"./font-picker-gaR7P3mg.js";import{F as je}from"./file-upload-BLNZQkWD.js";import{P as fe}from"./PageHeader-C6rx3uss.js";import{u as ve}from"./useCalendar-BBK-uIN_.js";import{F as ye}from"./facebook-BbOQPb3V.js";import{Y as Ce,L as Se}from"./youtube-Dvd_w6L2.js";import{M as _e}from"./map-pin-BQAhSVir.js";import"./compose-DOjjQ7ye.js";import"./SetupShow-dJezh6pB.js";import"./Competitors-BU_oaQVZ.js";import"./AssetManager-1guXkkVJ.js";import"./upload-DGmusEJv.js";import"./star-wjux-bxy.js";import"./upload-CRc1gxYv.js";import"./checkbox-CfDdTcFe.js";import"./filter-select-BrIOUJFK.js";import"./chip-BlU4hIu0.js";import"./SectionLayout-C49x_sxr.js";import"./list-filter-CGqFwn1t.js";import"./EmptyState-BWePa1hl.js";import"./chevron-down-CIYFcfTQ.js";import"./search-BDZPLI7M.js";import"./list-BpKExd-V.js";import"./layout-grid-Bk1IDLDF.js";import"./pencil-C2hosQyU.js";import"./trash-2-DHhGh4SX.js";import"./globe-EvdRHgaC.js";import"./ring-DOI_kVyQ.js";import"./package-BxsBUoPB.js";import"./igOauth-BKYGYQLv.js";import"./useBrandAssets-BgjUMr2B.js";import"./useSaveIgTemplate-DUbgoWdk.js";import"./image-plus-C46YF3W0.js";function Ne({src:r,href:t,onRemove:u}){const c=e.jsx(z,{src:r,alt:"",className:"w-16 h-16 rounded-md object-cover border border-border"+(t?" hover:opacity-80":"")});return e.jsxs("div",{className:"relative group",children:[t?e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",title:"Open image in a new tab",children:c}):c,e.jsx("button",{type:"button","aria-label":"Remove image",onClick:u,className:"absolute -top-1.5 -right-1.5 bg-card border border-border rounded-full p-0.5 text-muted-foreground hover:text-foreground opacity-100 sm:opacity-0 sm:group-hover:opacity-100",children:e.jsx(H,{size:12})})]})}const B={name:"",description:"",domain:"",primary_cta:"",ctas:[],logo_url:null,brand_values:"",tone:"",pain_points:"",target_audience:"",audience:{},product_type:"",industry:"",currency:"USD",language:"English",country:"",region:"",colors:{primary:"#1e3a5f",secondary:"#64748b",accent:"#E1306C",text:"#0f172a"},keywords:[],negative_keywords:[],fonts:[],social_links:[],contact_info:[],brand_images:[]},W=Object.keys(B),ke=[{key:"instagram",label:"Instagram",icon:te,cls:"text-[#E1306C]",placeholder:"instagram.com/yourbrand or @yourbrand",normalize:se},{key:"facebook",label:"Facebook",icon:ye,cls:"text-[#1877F2]",placeholder:"https://facebook.com/yourbrand"},{key:"youtube",label:"YouTube",icon:Ce,cls:"text-[#FF0000]",placeholder:"https://youtube.com/yourbrand"},{key:"linkedin",label:"LinkedIn",icon:Se,cls:"text-[#0A66C2]",placeholder:"https://linkedin.com/yourbrand"}],we=[{key:"email",label:"Email",icon:xe,placeholder:"[email protected]"},{key:"phone",label:"Phone",icon:ge,placeholder:"+1 555 123 4567"},{key:"address",label:"Address",icon:_e,placeholder:"Street, city, country"}];function Ie({brand:r}){return r?e.jsxs("span",{className:"flex items-center gap-3",children:[r.logo_url&&e.jsx(z,{src:r.logo_url,alt:"",className:"h-9 w-9 shrink-0 rounded-md object-cover"}),r.name]}):null}function ja(){const{user:r}=J(),{activeBrand:t,setActiveBrandId:u,readOnly:c}=K(),j=q(),f=Y(),[h,v]=X(),[s,o]=g.useState(B);g.useEffect(()=>{o({...B,...Fe(t??{})})},[t==null?void 0:t.id]);const n=(a,l)=>o(m=>({...m,[a]:l})),d=L({mutationFn:async a=>{const l={};for(const P of W)l[P]=a[P];const{error:m}=await G.from("brands").update(l).eq("id",t.id);if(m)throw m;return t.id},onSuccess:async a=>{await j.invalidateQueries({queryKey:["brands"]}),u(a)}}),[b,_]=g.useState(null);g.useEffect(()=>{h.get("setup")==="ig"&&t&&!b&&(_(t.id),v(a=>(a.delete("setup"),a),{replace:!0}))},[h,t,b]);const I=ve(),[y,N]=g.useState(!1),[A,V]=g.useState(""),p=L({mutationFn:a=>M("scan-brand",{brand_id:t.id,...a}
1),onSuccess:({fields:a})=>{o(l=>({...l,...a})),N(!1),j.invalidateQueries({queryKey:["brands"]})}}),[O,R]=g.useState(null);async function Z(a){R(a);try{const{value:l}=await M("generate-brand-field",{brand_id:(t==null?void 0:t.id)??null,field:a,context:s});l&&a==="primary_cta"?o(m=>({...m,primary_cta:l,ctas:(m.ctas??[]).includes(l)?m.ctas:[...m.ctas??[],l]})):l&&n(a,l)}catch{}finally{R(null)}}const C=({field:a})=>e.jsx("button",{type:"button",onClick:()=>Z(a),disabled:O!=null,title:"Generate with AI",className:"inline-flex items-center justify-center w-6 h-6 rounded-md text-brand hover:bg-brand/10 disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",children:O===a?e.jsx(ne,{className:"w-3 h-3"}):e.jsx(T,{size:14})});return t?e.jsxs("div",{className:"max-w-2xl",children:[e.jsx(fe,{title:e.jsx(Ie,{brand:t}),subtitle:"Brand settings",actions:t&&!c&&e.jsx(ue,{brandId:t.id})}),t&&!c&&e.jsx("div",{className:"mb-6",children:e.jsx(me,{brandId:t.id})}),e.jsx(Q,{className:"p-4 sm:p-6",children:e.jsx("form",{onSubmit:a=>{a.preventDefault(),c||d.mutate(s)},children:e.jsxs("fieldset",{disabled:c,className:"min-w-0 space-y-8",children:[e.jsxs(x,{title:"Basics",children:[e.jsxs(i,{label:"Website domain",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(w,{value:s.domain??"",onChange:a=>n("domain",a.target.value),placeholder:"example.com"}),e.jsxs(E,{type:"button",variant:"outline",disabled:p.isPending||!s.domain,onClick:()=>p.mutate({url:s.domain}),children:[e.jsx(T,{size:16})," ",p.isPending?"Scanning…":"Scan"]})]}),p.isSuccess&&e.jsx("p",{className:"text-xs text-green-600 mt-1",children:"Extracted — review the filled fields, then Save."}),!p.isError&&!p.isSuccess&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Optional: auto-fill the brand from its website, or"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>N(a=>!a),children:"paste your Instagram bio + captions"}),"."]}),y&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsx(S,{rows:6,value:A,onChange:a=>V(a.target.value),placeholder:"Paste your Instagram bio and a few of your best captions here…"}),e.jsxs(E,{type:"button",variant:"outline",size:"sm",disabled:p.isPending||!A.trim(),onClick:()=>p.mutate({text:A}),children:[e.jsx(T,{size:14})," ",p.isPending?"Extracting…":"Extract brand info"]})]})]}),e.jsx(i,{label:"Logo",children:e.jsx(je,{value:s.logo_url,onChange:a=>n("logo_url",a),bucket:"brand-assets",brandId:(t==null?void 0:t.id)??(r==null?void 0:r.id),accept:"image/*",image:!0})}),(s.brand_images??[]).length>0&&e.jsx(i,{label:"Reference images",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:s.brand_images.map((a,l)=>e.jsx(Ne,{src:a,onRemove:()=>n("brand_images",s.brand_images.filter((m,P)=>P!==l))},l))})}),e.jsx(i,{label:"Name",children:e.jsx(w,{value:s.name,onChange:a=>n("name",a.target.value),required:!0})}),e.jsx(i,{label:"Description",action:e.jsx(C,{field:"description"}),children:e.jsx(S,{value:s.description??"",onChange:a=>n("description",a.target.value)})}),e.jsx(i,{label:"Call to action options",action:e.jsx(C,{field:"primary_cta"}),children:e.jsx(D,{value:s.ctas??[],onChange:a=>o(l=>({...l,ctas:a,primary_cta:a[0]??""})),placeholder:"Shop now"})})]}),e.jsxs(x,{title:"Identity",children:[e.jsx(i,{label:"Brand values",action:e.jsx(C,{field:"brand_values"}),children:e.jsx(S,{value:s.brand_values??"",onChange:a=>n("brand_values",a.target.value)})}),e.jsx(i,{label:"Brand tone",action:e.jsx(C,{field:"tone"}),children:e.jsx(S,{value:s.tone??"",onChange:a=>n("tone",a.target.value)})}),e.jsx(i,{label:"Pain points",action:e.jsx(C,{field:"pain_points"}),children:e.jsx(S,{value:s.pain_points??"",onChange:a=>n("pain_points",a.target.value)})})]}),e.jsxs(x,{title:"Audience",children:[e.jsx(pe,{value:s.audience??{},onChange:a=>n("audience",a)}),e.jsx(i,{label:"In their own words",action:e.jsx(C,{field:"target_audience"}),children:e.jsx(S,{value:s.target_audience??"",onChange:a=>n("target_audience",a.target.value),placeholder:"What motivates them, what they object to, how they talk"})})]}),e.jsx(x,{title:"Classification",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(i,{label:"Product type",children:e.jsx(k,{options:F(oe),value:s.product_type??"",onChange:a=>n("product_type",a.target.value)})}),e.jsx(i,{label:"Industry",children:e.jsx(k,{options:F(ie),value:s.industry??"",onChange:a=>n("industry",a.target.value)})}),e.jsx(i,{label:"Currency",children:e.jsx(k,{options:F(le),placeholder:null,value:s.currency??"USD",onChange:a=>n("currency",a.target.value)})}),e.jsx(i,{label:"Language",children:e.jsx(k,{options:F(ce),placeholder:null,value:$(s.language),onChange:a=>n("language",a.target.value)})})]})}),e.jsxs(x,{title:"Location",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(i,{label:"Country",children:e.jsxs(k,{value:s.country??"",onChange:a=>
1n("country",a.target.value),children:[e.jsx("option",{value:"",children:"— pick a country —"}),I.map(a=>e.jsx("option",{value:a.code,children:a.name},a.code))]})}),e.jsx(i,{label:"State / region (optional)",children:e.jsx(w,{value:s.region??"",onChange:a=>n("region",a.target.value),placeholder:"e.g. California, Tel Aviv"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sets the public holidays on your ",e.jsx(ee,{to:"/calendar",className:"underline",children:"Calendar"})," and keeps trend research local."]})]}),e.jsx(x,{title:"Colors",children:e.jsx(ae,{value:s.colors??{},onChange:a=>n("colors",a),swatches:["primary","secondary","accent","text"]})}),e.jsxs(x,{title:"Keywords & fonts",children:[e.jsx(i,{label:"Keywords",children:e.jsx(D,{value:s.keywords??[],onChange:a=>n("keywords",a),placeholder:"Add a keyword"})}),e.jsx(i,{label:e.jsxs(e.Fragment,{children:["Never say ",e.jsx("span",{className:"text-muted-foreground font-normal",children:"(words, claims or topics to keep out of every post)"})]}),children:e.jsx(D,{value:s.negative_keywords??[],onChange:a=>n("negative_keywords",a),placeholder:"cheap, competitor name, medical claims…"})}),e.jsx(i,{label:"Fonts",children:e.jsx(be,{value:s.fonts??[],onChange:a=>n("fonts",a)})})]}),e.jsx(x,{title:"Social links",children:e.jsx(U,{fields:ke,matchKey:"platform",valueKey:"url",value:s.social_links??[],onChange:a=>n("social_links",a)})}),e.jsx(x,{title:"Contact info",children:e.jsx(U,{fields:we,matchKey:"type",valueKey:"value",value:s.contact_info??[],onChange:a=>n("contact_info",a)})}),!c&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{variant:"brand",disabled:d.isPending,children:d.isPending?"Saving…":"Save"}),d.isError&&e.jsx("p",{className:"text-sm text-red-600",children:d.error.message}),d.isSuccess&&e.jsx("p",{className:"text-sm text-green-600",children:"Saved."})]})]})})}),t&&!c&&e.jsx(Pe,{brand:t}),b&&e.jsx(de,{mode:"onboard",brandId:b,userId:r.id,onFinished:()=>{_(null),f("/brand")},onManual:()=>_(null)})]}):e.jsx("p",{className:"text-muted-foreground",children:"Create a brand first."})}function Pe({brand:r}){const t=q(),u=Y(),{setActiveBrandId:c}=K(),[j,f]=g.useState(""),[h,v]=g.useState(!1),s=L({mutationFn:async()=>{const{error:o}=await G.rpc("soft_delete_brand",{target_id:r.id});if(o)throw o},onSuccess:()=>{localStorage.removeItem("activeBrandId"),c(null),t.clear(),u("/")}});return e.jsxs(Q,{className:"mt-8 p-4 sm:p-6 border-red-500/40 space-y-3",children:[e.jsx("h2",{className:"text-xs uppercase tracking-[0.12em] font-bold text-red-600",children:"Danger zone"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Deleting this brand removes your access to it and everything inside — voices, products, competitors, Sources, posts, automations. This cannot be undone."}),e.jsxs(re,{children:["Type ",e.jsx("span",{className:"font-semibold text-foreground",children:r.name})," to confirm"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(w,{value:j,onChange:o=>f(o.target.value),placeholder:r.name}),e.jsx(E,{type:"button",variant:"destructive",className:"shrink-0",disabled:j!==r.name||s.isPending,onClick:()=>v(!0),children:s.isPending?"Deleting…":"Delete brand"})]}),s.isError&&!h&&e.jsx("p",{className:"text-sm text-red-600",children:s.error.message}),h&&e.jsx(he,{brand:r,busy:s.isPending,error:s.isError?s.error.message:null,onClose:()=>v(!1),onConfirm:()=>s.mutate()})]})}function Fe(r){const t={};for(const u of W)r[u]!=null&&(t[u]=r[u]);return t}function x({title:r,children:t}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-xs uppercase tracking-[0.12em] font-bold text-muted-foreground",children:r}),t]})}function U({fields:r,matchKey:t,valueKey:u,value:c,onChange:j}){const f=Array.isArray(c)?c:[],h=(o,n)=>String(o[t]??"").toLowerCase().includes(n),v=o=>{var n;return((n=f.find(d=>h(d,o)))==null?void 0:n[u])??""},s=(o,n)=>{const d=f.filter(b=>!h(b,o));j(n.trim()?[...d,{[t]:o,[u]:n.trim()}]:d)};return e.jsx("div",{className:"space-y-2",children:r.map(({key:o,label:n,icon:d,cls:b,placeholder:_,normalize:I})=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{size:18,className:"shrink-0 "+(b??"text-muted-foreground"),title:n}),e.jsx(w,{value:v(o),onChange:y=>s(o,y.target.value),placeholder:_,onBlur:I?y=>{const N=I(y.target.value);N!==y.target.value&&s(o,N)}:void 0})]},o))})}export{ja as default};

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.