PageSourceSearch

https://postbold.com/_next/static/chunks/196-8bf09b916b05cfba.js

js postbold.com collected 2026-09-24 14:02:14 UTC 12,016 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[196],{40196:function(e,r,t){t.r(r),t.d(r,{MY_STYLE_OPTION:function(){return s},default:function(){return u},resolveInfluencerId:function(){return o},resolveInfluencerMeta:function(){return i}});var l=t(85893),a=t(67294),n=t(78773);let s={_id:"my-style",name:"My Style",isMyStyle:!0};function o(e){return!e||e.isMyStyle||e._id===s._id?null:e._id}function i(e){return o(e)&&e?{_id:e._id,name:e.name||"Influencer",imageUrl:e.imageUrl||"/default-avatar.png",niches:Array.isArray(e.niches)?e.niches:[]}:null}let c={purple:{focus:"focus:border-purple-500 focus:ring-purple-200",addBtn:"bg-purple-500 hover:bg-purple-600",selected:"border-purple-500 bg-purple-50",hover:"hover:border-purple-300 hover:bg-gray-50",bookmark:"text-purple-500 hover:text-purple-600",more:"border-purple-300 text-purple-700 hover:bg-purple-50"},blue:{focus:"focus:border-blue-500 focus:ring-blue-200",addBtn:"bg-blue-500 hover:bg-blue-600",selected:"border-blue-500 bg-blue-50",hover:"hover:border-blue-300 hover:bg-gray-50",bookmark:"text-blue-500 hover:text-blue-600",more:"border-blue-300 text-blue-700 hover:bg-blue-50"}
1,green:{focus:"focus:border-green-500 focus:ring-green-200",addBtn:"bg-green-500 hover:bg-green-600",selected:"border-green-500 bg-green-50",hover:"hover:border-green-300 hover:bg-gray-50",bookmark:"text-green-500 hover:text-green-600",more:"border-green-300 text-green-700 hover:bg-green-50"},orange:{focus:"focus:border-orange-500 focus:ring-orange-200",addBtn:"bg-orange-500 hover:bg-orange-600",selected:"border-orange-500 bg-orange-50",hover:"hover:border-orange-300 hover:bg-gray-50",bookmark:"text-orange-500 hover:text-orange-600",more:"border-orange-300 text-orange-700 hover:bg-orange-50"}};function d(e){var r;let{option:t,isSelected:a,isBookmarked:s,isMyStyle:o,imageUrl:i,itemPadding:c,styles:d,togglingId:u,onSelect:g,onToggleBookmark:m,showBookmark:b=!0}=e;return(0,l.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>null==g?void 0:g(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),null==g||g(t))},className:"relative flex items-center gap-3 ".concat(c," rounded-lg border-2 transition-all text-left cursor-pointer ").concat(a?d.selected:"border-gray-200 ".concat(d.hover)),children:[(0,l.jsx)("img",{src:i,alt:t.name,className:"w-12 h-12 rounded-full object-cover flex-shrink-0",onError:e=>{e.target.src="/default-avatar.png"}}),(0,l.jsxs)("div",{className:"flex-1 min-w-0 pr-6",children:[(0,l.jsx)("span",{className:"text-base font-medium text-gray-900 block truncate",children:t.name}),!o&&(null===(r=t.niches)||void 0===r?void 0:r.length)>0&&(0,l.jsx)("span",{className:"text-xs text-gray-500 block truncate",children:t.niches.slice(0,2).join(" \xb7 ")})]}),!o&&b&&(0,l.jsx)("button",{type:"button",title:s?"Remove bookmark":"Bookmark writing style","aria-label":s?"Remove bookmark":"Bookmark writing style",onClick:e=>m(e,t),disabled:String(u)===String(t._id),className:"absolute top-2 right-2 p-1 rounded ".concat(d.bookmark," disabled:opacity-50"),children:s?(0,l.jsx)(n.VF9,{className:"w-4 h-4"}):(0,l.jsx)(n.mCg,{className:"w-4 h-4"})})]})}function u(e){let{selected:r,onSelect:t,onAddClick:o,accent:i="purple",layout:u="row",userImage:g,compact:m=!1,variant:b="full",disabled:f=!1}=e,h=c[i]||c.purple,p="grid"===u?"p-3":m?"px-3 py-1.5":"px-4 py-2",x="avatar"===b,[y,v]=(0,a.useState)([]),[k,j]=(0,a.useState)(!0),[S,N]=(0,a.useState)([]),[w,_]=(0,a.useState)(!0),[M,B]=(0,a.useState)(null),[E,C]=(0,a.useState)(!1),[I,T]=(0,a.useState)(""),[U,P]=(0,a.useState)(""),[A,L]=(0,a.useState)([]),[R,F]=(0,a.useState)(0),[O,D]=(0,a.useState)(!0),[Y,W]=(0,a.useState)(!1),[H,z]=(0,a.useState)(!1),J=(0,a.useRef)(null),K=(0,a.useRef)(null),V=(0,a.useRef)(!1);(0,a.useEffect)(()=>{let e=!1;return(async()=>{_(!0);try{let r=await fetch("/api/user/bookmarked-influencers"),t=await r.json();!e&&t.success&&N(t.bookmarkedInfluencers||[])}catch(e){console.error("Error fetching bookmarked influencers:",e)}finally{e||_(!1)}})(),()=>{e=!0}},[]),(0,a.useEffect)(()=>{if(x){j(!1);return}let e=!1;return(async()=>{j(!0);try{let r=await fetch("/api/linkedin-influencers?limit=".concat(12,"&skip=0")),t=await r.json();!e&&t.success&&v(t.data||[])}catch(r){console.error("Error fetching influencers:",r),e||v([])}finally{e||j(!1)}})(),()=>{e=!0}},[x]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{P(I.trim())},300);return()=>clearTimeout(e)},[I]);let q=(0,a.useCallback)(async e=>{let{search:r,skip:t,append:l}=e;if(!l||!V.current){V.current=!0,l?z(!0):W(!0);try{let e=new URLSearchParams({limit:String(20),skip:String(t)});r&&e.set("search",r);let a=await fetch("/api/linkedin-influencers?".concat(e.toString())),n=await a.json();if(n.success){let e=n.data||[];L(r=>l?[...r,...e]:e),F(t+e.length),D(!!n.hasMore)}}catch(e){console.error("Error loading influencers modal page:",e),l||L([]),D(!1)}finally{V.current=!1,W(!1),z(!1)}}},[]);(0,a.useEffect)(()=>{E&&(L([]),F(0),D(!0),q({search:U,skip:0,append:!1}))},[E,U,q]),(0,a.useEffect)(()=>{if(!E||!O||Y||H)return;let e=K.current,r=J.current;if(!e||!r)return;let t=new IntersectionObserver(e=>{var r;(null===(r=e[0])||void 0===r?void 0:r.isIntersecting)&&q({search:U,skip:R,append:!0})},{root:r,rootMargin:"120px",threshold:0});return t.observe(e),()=>t.disconnect()},[E,O,Y,H,R,U,q]);let G=(0,a.useCallback)(e=>(e||[]).filter(e=>"string"==typeof(null==e?void 0:e.writingStyle)&&e.writingStyle.trim().length>0),[]),Q=(0,a.useMemo)(()=>G(S),[S,G]),X=(0,a.useMemo)(()=>new Set(S.map(e=>String(e._id))),[S]),Z=(0,a.useMemo)(()=>[s,...Q,...G(y).filter(e=>!X.has(String(e._id)))],[Q,X,y,G]),$=async(e,r)=>{e.stopPropagation(),e.preventDefault();let t=r._id;if(!t||M)return;let l=X.has(String(t));B(t),l?N(e=>e.filter(e=>String(e._id)!==String(t))):N(e=>[...e,r]);try{let e=await fetch("/api/user/bookmarked-influencers",{method:l?"DELETE":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({influencerId:t})}),a=await e.json();a.success&&Array.isArray(a.bookmarkedInfluencers)?N(a.bookmarkedInfluencers):a.success||(l?N(e=>[...e,r]):N(e=>e.filter(e=>String(e._id)!==String(t))),console.error("Failed to toggle bookmark:",a.error))}catch(e){l?N(e=>[...e,r]):N(e=>e.filter(e=>String(e._id)!==String(t))),console.error("Error toggling bookmark:",e)}finally{B(null)}},ee=e=>{null==t||t(e),C(!1)},er=!r||r.isMyStyle||r._id===s._id,et=er?g||
1"/default-avatar.png":(null==r?void 0:r.imageUrl)
1||"/default-avatar.png",el=er?"My Style — click to choose an influencer":"".concat((null==r?void 0:r.name)||"Influencer"," — click to change writing style"),ea=()=>{f||(T(""),P(""),C(!0))},en=E?(0,l.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:(0,l.jsxs)("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-xl font-bold text-gray-900",children:"Browse Writing Styles"}),(0,l.jsx)("p",{className:"text-sm text-gray-500",children:"Search and pick an influencer style"})]}),(0,l.jsx)("button",{type:"button",onClick:()=>C(!1),className:"p-2 rounded-lg text-gray-500 hover:bg-gray-100 hover:text-gray-800","aria-label":"Close",children:(0,l.jsx)(n.aHS,{className:"w-5 h-5"})})]}),(0,l.jsx)("div",{className:"px-5 py-3 border-b border-gray-100",children:(0,l.jsx)("input",{type:"text",value:I,onChange:e=>T(e.target.value),placeholder:"Filter by name, niche, or industry...",className:"w-full px-4 py-2.5 border-2 border-gray-200 rounded-lg focus:ring-2 outline-none transition-all ".concat(h.focus),autoFocus:!0})}),(0,l.jsxs)("div",{ref:J,className:"flex-1 overflow-y-auto px-5 py-4",children:[x&&!U&&(0,l.jsxs)("div",{className:"mb-5",children:[(0,l.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"Your style"}),(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:(0,l.jsx)(d,{option:s,isSelected:er,isBookmarked:!1,isMyStyle:!0,imageUrl:g||"/default-avatar.png",itemPadding:"p-3",styles:h,togglingId:M,onSelect:ee,onToggleBookmark:$,showBookmark:!1})})]}),Q.length>0&&!U&&(0,l.jsxs)("div",{className:"mb-5",children:[(0,l.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"Bookmarked"}),(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Q.map(e=>(0,l.jsx)(d,{option:e,isSelected:(null==r?void 0:r._id)===e._id,isBookmarked:!0,isMyStyle:!1,imageUrl:e.imageUrl||"/default-avatar.png",itemPadding:"p-3",styles:h,togglingId:M,onSelect:ee,onToggleBookmark:$},"bm-".concat(e._id)))})]}),(0,l.jsx)("div",{className:"mb-2",children:(0,l.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 mb-2",children:"All influencers"})}),Y?(0,l.jsx)("div",{className:"text-center py-10 text-gray-500",children:"Loading influencers..."}):0===A.length?(0,l.jsx)("div",{className:"text-center py-10 text-gray-500",children:U?"No influencers found. Try a different search.":"No influencers available."}):(0,l.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:A.map(e=>(0,l.jsx)(d,{option:e,isSelected:(null==r?void 0:r._id)===e._id,isBookmarked:X.has(String(e._id)),isMyStyle:!1,imageUrl:e.imageUrl||"/default-avatar.png",itemPadding:"p-3",styles:h,togglingId:M,onSelect:ee,onToggleBookmark:$},e._id))}),(0,l.jsxs)("div",{ref:K,className:"h-8 flex items-center justify-center mt-3",children:[H&&(0,l.jsx)("span",{className:"text-sm text-gray-500",children:"Loading more..."}),!O&&A.length>0&&(0,l.jsx)("span",{className:"text-sm text-gray-400",children:"You've reached the end"})]})]})]})}):null;return x?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{type:"button",onClick:ea,disabled:f,title:el,"aria-label":el,className:"relative flex-shrink-0 h-10 w-10 rounded-full overflow-hidden border-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed ".concat(er?"border-gray-300 hover:border-blue-400":"border-blue-500 ring-2 ring-blue-100 hover:border-blue-600"),children:(0,l.jsx)("img",{src:et,alt:er?"My Style":(null==r?void 0:r.name)||"Writing style",className:"h-full w-full object-cover",onError:e=>{e.target.src="/default-avatar.png"}})}),en]}):(0,l.jsxs)("div",{className:m?"mb-0 pt-2":"mb-6",children:[(0,l.jsxs)("div",{className:m?"mb-2":"mb-4",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,l.jsx)("h3",{className:"font-semibold text-gray-900 ".concat(m?"text-base":"text-lg"),children:"Choose Writing Style"}),"function"==typeof o&&(0,l.jsxs)("button",{type:"button",onClick:o,className:"px-3 py-1.5 ".concat(h.addBtn," text-white rounded-lg transition-all flex items-center gap-2 text-sm font-medium flex-shrink-0"),title:"Add new influencer",children:[(0,l.jsx)(n.wEH,{className:"w-3.5 h-3.5"}),"Add"]})]}),!m&&(0,l.jsx)("p",{className:"text-md text-gray-600",children:"My Style uses your default writing style. Bookmark influencers you like to keep them next to you."})]}),k||w?(0,l.jsx)("div",{className:"text-center py-4 text-gray-500",children:"Loading influencers..."}):(0,l.jsxs)("div",{className:"grid"===u?"grid grid-cols-1 gap-3":"flex justify-center gap-3 flex-wrap",children:[Z.map(e=>{let a=e.isMyStyle||e._id===s._id,n=(null==r?void 0:r._id)===e._id,o=!a&&X.has(String(e._id)),i=a?g||"/default-avatar.png":e.imageUrl||"/default-avatar.png";return(0,l.jsx)(d,{option:e,isSelected:n,isBookmarked:o,isMyStyle:a,imageUrl:i,itemPadding:p,styles:h,togglingId:M,onSelect:t,onToggleBookmark:$},e._id)}),(0,l.jsxs)("button",{type:"button",onClick:ea,className:"flex items-center justify-center gap-2 ".concat(p," rounded-lg border-2 border-dashed transition-all ").concat(h.more),children:[(0,l.jsx)(n.LCi,{className:"w-4 h-4"}),(0,l.jsx)("span",{className:"text-base font-semibold",children:"More"})]})]}),en]})}}}]);

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.