PageSourceSearch

https://getvoltr.com/app/assets/ImportListModal-V4xbxX4r.js

js getvoltr.com collected 2026-10-02 05:04:03 UTC 6,696 bytes, 9 lines download raw bytes

1import{r as u,j as r}from"./react-BJCrwb27.js";import{bU as $}from"./index-Cok8iJMB.js";import{M as O,a as V,b as J}from"./route-support-BEJAjkqU.js";import{b1 as I,b2 as P,ab as H,h as W}from"./vendor-DIeMxnSD.js";import"./tanstack-BOscu_PA.js";const L=["#ff6b9d,#c84b8c","#4facfe,#00f2fe","#fa709a,#fee140","#43e97b,#38f9d7","#fee140,#fa709a","#a8edea,#fed6e3"],B=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,G=`handle,email,name
2@mayajohnson,[email protected],Maya Johnson
3@marcuseats,[email protected],Marcus Eats
4@sweatwithjer,,Jer
5`;function Q(l){const c=[];let i=[],s="",p=!1;for(let a=0;a<l.length;a+=1){const n=l[a];p?n==='"'?l[a+1]==='"'?(s+='"',a+=1):p=!1:s+=n:n==='"'?p=!0:n===","?(i.push(s),s=""):n===`
6`?(i.push(s),c.push(i),i=[],s=""):n!=="\r"&&(s+=n)}return(s.length||i.length)&&(i.push(s),c.push(i)),c.filter(a=>a.some(n=>n.trim()))}function q(l){if(!l.length)return[];const c=l[0].map(a=>a.trim().toLowerCase()),i=c.findIndex(a=>["handle","username","creator","creator_username","tiktok","tiktok handle"].includes(a)),s=c.findIndex(a=>["email","e-mail","email address","contact"].includes(a)),p=i>=0;return(p?l.slice(1):l).map(a=>{const n=String(a[p?i:0]||"").trim().replace(/^@/,""),f=String(a[p&&s>=0?s:1]||"").trim();return n?f&&B.test(f)?`@${n}, ${f}`:`@${n}`:""}).filter(Boolean)}function re({onClose:l,onImported:c}){const{showToast:i}=$(),[s,p]=u.useState("csv"),[a,n]=u.useState(""),[f,C]=u.useState(""),[k,h]=u.useState(""),[d,v]=u.useState(!1),S=u.useRef(null),T=u.useRef(null);u.useEffect(()=>{if(s!=="paste")return;const t=window.setTimeout(()=>{var e;return(e=T.current)==null?void 0:e.focus()},50);return()=>window.clearTimeout(t)},[s]);const A=t=>{h("");const e=new FileReader;e.onload=()=>{try{const o=q(Q(String(e.result||"")));if(!o.length){h("No creators found. Make sure there is a handle or username column."),n(""),C("");return}n(o.join(`
7`)),C(t.name)}catch{h("Could not read that file. Is it a CSV?")}},e.onerror=()=>h("Could not read that file."),e.readAsText(t)},N=()=>{const t=new Blob([G],{type:"text/csv"}),e=URL.createObjectURL(t),o=document.createElement("a");o.href=e,o.download="voltr-outreach-creators.csv",document.body.appendChild(o),o.click(),o.remove(),window.setTimeout(()=>URL.revokeObjectURL(e),1e3)},U=async()=>{if(d)return;const t=a.split(/\n+/).map(e=>e.trim()).filter(Boolean);if(!t.length){i("No new creators to add","yellow");return}v(!0);try{const e=await V("/api/creators"),o=Array.isArray(e.disc_creators)?e.disc_creators:[],z=Array.isArray(e.dismissed_creators)?e.dismissed_creators:[],x=e.crm_pipeline||{},w=Array.isArray(e.outreach_creators)?[...e.outreach_creators]:[];let y=0;if(t.forEach((M,F)=>{const _=M.split(/[,;\t]+/).map(m=>m.trim()).filter(Boolean),b=_.find(m=>B.test(m))||"",g=(_.find(m=>m!==b)||(b?b.split("@")[0]:"")).replace(/^@/,"").trim();if(!g)return;const E="@"+g;if(w.some(m=>(m.handle||"").toLowerCase()===E.toLowerCase()))return;const R={name:g.replace(/[._-]/g," ").replace(/\b\w/g,m=>m.toUpperCase()),handle:E,initials:g.slice(0,2).toUpperCase(),grad:L[F%L.length],niche:"Imported"};b&&(R.email=b),w.push(R),y++}),!y){i("No new creators to add","yellow"),v(!1);return}const j=await J("/api/creators",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({disc_creators:o,crm_pipeline:{discovered:x.discovered||[],contacted:x.contacted||[],negotiating:x.negotiating||[],active:x.active||[]},outreach_creators:w,dismissed_creators:z})}),D=await j.json().catch(()=>({}));if(!j.ok)throw new Error(D.error||`Import failed (${j.status})`);i(`Added ${y} creator${y===1?"":"s"} to outreach`,"green"),c==null||c(),l()}catch(e){i(e instanceof Error?e.message:"Import failed","red"),v(!1)}};return r.jsxs(O,{onClose:()=>d?void 0:l(),title:"Import a creator list",width:"500px",footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"tb-btn",disabled:d,onClick:l,type:"button",children:"Cancel"}),r.jsx("button",{className:"tb-btn primary",disabled:d||!a.trim(),onClick:U,type:"button",children:d?"Adding...":"Add to outreach"})]}),children:[r.jsx("div",{style:{display:"flex",gap:4,borderBottom:"1px solid var(--border)",marginBottom:14},children:[{key:"csv",label:"Upload CSV",icon:I},{key:"paste",label:"Paste handles",icon:P}].map(t=>{const e=s===t.key,o=t.icon;return r.jsxs("button",{type:"button",onClick:()=>{d||(p(t.key),h(""))},style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 12px",fontSize:"0.8rem",fontWeight:600,color:e?"var(--text1)":"var(--text3)",background:"none",border:"none",cursor:d?"default":"pointer",borderBottom:e?"2px solid var(--btn-volt)":"2px solid transparent",marginBottom:-1},children:[r.jsx(o,{size:14})," ",t.label]},t.key)})}),s==="csv"?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",disabled:d,onClick:()=>{var t;return(t=S.current)==null?void 0:t.click()},onDragOver:t=>t.preventDefault(),onDrop:t=>{var o;if(t.preventDefault(),d)return;const e=(o=t.dataTransfer.files)==null?void 0:o[0];e&&A(e)},style:{width:"100%",background:"none",font:"inherit",border:"1.5px dashed var(--border)",borderRadius:10,padding:"26px 16px",textAlign:"center",cursor:"pointer",color:"var(--text3)"},children:[r.jsx(I,{size:26,style:{opacity:.6}}),r.jsx("span",{style:{display:"block",marginTop:8,fontWeight:600,color:"var(--text2)"},children:"Drop a CSV here, or click to choose"}),r.jsx("span",{style:{display:"block",marginTop:4,fontSize:"0.76rem"},children:"Use handle or username, plus optional email."})]}),r.jsx("input",{ref:S,disabled:d,type:"file",accept:".csv,text/csv,text/plain",style:{display:"none"},onChange:t=>{var o;const e=(o=t.target.files)==null?void 0:o[0];e&&A(e)}}),r.jsxs("button",{type:"button",onClick:N,style:{marginTop:12,display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",color:"var(--text3)",fontSize:"0.78rem",cursor:"pointer",padding:0},children:[r.jsx(H,{size:13})," Download a sample CSV"]}),f&&a.trim()?r.jsxs("div",{style:{marginTop:10,color:"var(--text2)",fontSize:"0.8rem"}
7,children:[a.split(/\n+/).filter(Boolean).length," creators ready from ",f]}):null,k?r.jsxs("div",{style:{marginTop:10,display:"flex",alignItems:"center",gap:6,color:"var(--red)",fontSize:"0.8rem"},children:[r.jsx(W,{size:14})," ",k]}):null]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"oi-import-hint",children:["Paste creators, one per line. Handle only, or ",r.jsx("b",{children:"handle, email"})," to reach them by email right away."]}),r.jsx("textarea",{autoComplete:"off",ref:T,"aria-label":"Creators to import",className:"oi-import-input",onChange:t=>n(t.target.value),placeholder:`@mayajohnson
8@marcuseats, [email protected]
9@sweatwithjer`,rows:7,value:a})]})]})}export{re as ImportListModal};

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.