1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7895],{49041:function(e,l,t){t.d(l,{L:function(){return GSIAuthModal}});var o=t(85893),n=t(5379),r=t.n(n),s=t(2031),i=t(6589),a=t(26955),u=t(18449),d=t(28350);let GSIAuthModal=e=>{let{onClose:l,onSuccess:t,onError:n,title:c,variant:f="login",showEmailPasswordForm:m=!0,passwordReset:w,initialActiveForm:v,onSetActiveForm:g,loginBottomText:p,signUpBottomText:U,verificationEmailContinueUrl:y,verificationEmailOptionalTemplateData:_,signupSource:F}=e,{t:b}=(0,s.$)(),{mediaQueries:O}=(0,i.F)(),h=v||("signup"===f?"signUp":"login");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(a.u,{"aria-label":b("signUp"===h?"Sign_up":"Log_in"),onClose:l,size:"sm",children:["string"==typeof c&&(0,o.jsx)(u.H3,{align:"center",children:c}),(0,o.jsx)("div",{className:r().dynamic([["7c4564d8467ef886",[O.mediumUp]]]),children:(0,o.jsx)(d._,{initialActiveForm:h,loginBottomText:p,onError:n,onSetActiveForm:g,onSuccess:t,passwordReset:w,showEmailPasswordForm:m,signUpBottomText:U,signupSource:F,variant:f,verificationEmailContinueUrl:y,verificationEmailOptionalTemplateData:_})})]}),(0,o.jsx)(r(),{id:"7c4564d8467ef886",dynamic:[O.mediumUp],children:"@media ".concat(O.mediumUp,"{div.__jsx-style-dynamic-selector{padding:15px 10px 0 10px}}")})]})}},7895:function(e,l,t){t.d(l,{q:function(){return StoreFollowButton}});var o=t(85893),n=t(67294),r=t(63246),s=t(70082),i=t(49041),a=t(14226),u=t(71477);let usePublicProfileSignupCookies=(e,l)=>{let{setReferralCookies:t,cleanUpReferralCookies:o}=(0,u.C)("public_profile_signup");return{setPublicProfileSignupCookies:()=>{t({isOnCommissionsProgram:e,refId:l})},cleanUpPublicProfileSignupCookies:()=>{o()}}};var d=t(82729),c=t(68806),f=t(6812),m=t(50319),w=t(2031),v=t(36225),g=t(59348),p=t(50977),U=t(26749),y=t(42589),_=t(48553);function _templateObject(){let e=(0,d._)(["\n mutation FOLLOW_USER_MUTATION($followedUserId: ID!) {\n users {\n follow(followedUserId: $followedUserId)\n }\n }\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,d._)(["\n mutation UNFOLLOW_USER_MUTATION($followedUserId: ID!) {\n users {\n unfollow(followedUserId: $followedUserId)\n }\n }\n"]);return _templateObject1=function(){return e},e}function _templateObject2(){let e=(0,d._)(["\n query IS_PROFILE_FOLLOWED_QUERY($vanityName: String!) {\n userProfile(vanityName: $vanityName) {\n vanityName\n isFollowed\n }\n }\n"]);return _templateObject2=function(){return e},e}let F=(0,c.Ps)(_templateObject()),b=(0,c.Ps)(_templateObject1()),O=(0,c.Ps)(_templateObject2()),useUserFollow=e=>{var l,t;let{userId:o,vanityName:s}=e,{addToast:i}=(0,g.e1)(),{t:a}=(0,w.$)(),{data:u}=(0,r.kP)(),d=(0,_.z$)(),c=null==u?void 0:null===(l=u.user)||void 0===l?void 0:l.vanityName,{data:h,loading:C}=(0,f.a)(O,{variables:{vanityName:s},context:{clientName:v.Nk}}),[N,{loading:S}]=(0,m.D)(F,{context:{clientName:v.bd}}),[j,{loading:I}]=(0,m.D)(b,{context:{clientName:v.bd}}),x=(null==h?void 0:null===(t=h.userProfile)||void 0===t?void 0:t.isFollowed)||!1,P=(0,n.useCallback)(e=>{d&&d.track("[Stores] Followed Store",{storeName:e})},[d]),updateCachedQueries=e=>{let{cache:l,isUnfollowed:t}=e;y.zZ.forEach(e=>l.updateQuery({query:y.Uv,variables:{limit:y.gK,offset:0,sortOrder:e,vanityName:c}},e=>{if(e)return{...e,followedUsers:{...e.followedUsers,users:e.followedUsers.users.map(e=>e.spreeId===String(o)||e.firebaseUid===String(o)?{...e,isUnfollowed:t}:e)}}})),l.updateQuery({query:U.w,variables:{vanityName:c}},e=>{if(e)return{...e,followedUsers:{...e.followedUsers,totalCount:t?e.followedUsers.totalCount-1:e.followedUsers.totalCount+1}}}),l.updateQuery({query:U.w,variables:{vanityName:s}},e=>{if(e)return{...e,userFollowers:{...e.userFollowers,totalCount:t?e.userFollowers.totalCount-1:e.userFollowers.totalCount+1}}}),l.updateQuery({query:O,variables:{vanityName:s}},e=>{if(e)return{...e,userProfile:{...e.userProfile,isFollowed:!t}}})},toggleFollow=async()=>{if(!x){try{let{errors:e}=await N({variables:{followedUserId:o},update:e=>updateCachedQueries({cache:e,isUnfollowed:!1})});if((null==e?void 0:e.length)>0)throw e[0];P(s)}catch(e){(0,p.e)("Failed to follow user: ".concat(e.message)),i({type:"danger",message:a("errors.generic_try_again"),title:a("Error")})}return}try{let{errors:e}=await j({variables:{followedUserId:o},update:e=>updateCachedQueries({cache:e,isUnfollowed:!0})});if((null==e?void 0:e.length)>0)throw e[0]}catch(e){(0,p.e)("Failed to unfollow user: ".concat(e.message)),i({type:"danger",message:a("errors.generic_try_again"),title:a("Error")})}};return{toggleFollow,isFollowed:x,isLoadingFollow:S,isLoadingUnfollow:I,isFollowedLoading:C}};var h=t(53292),C=t(44771),N=t(72407);let FollowButton=e=>{let{isFollowed:l,isLoading:t,onClick:n,className:r,size:s="sm"}=e,{t:i}=(0,w.$)();return(0,o.jsx)(N.z,{className:r,loading:t,onClick:n,size:s,variant:l?"neutral":"uiAccent",children:i(l?"Following":"Follow")})},ReloadOverlay=()=>(0,o.jsx)(h.a,{children:(0,o.jsx)(C.LoadingSpinner,{color:"white",size:50})}),StoreFollowButton=e=>{var l,t;let{spreeId:u,firebaseUid:d,vanityName:c,isOnCommissionsProgram:f,refId:m,onToggleFollow:w,size:v,className:g}=e,{data:p,loading:U}=(0,r.kP)(),{setPublicProfileSignupCookies:y,cleanUpPublicProfileSignupCookies:_}=usePublicProfileSignupCookies(f,m),{toggleFollow:F,isLoadingFollow:b,isLoadingUnfollow:O,isFollowedLoading:h,isFollowed:C}=useUserFollow({userId:d||u,vanityName:c}),handleToggleFollow=async()=>{await F(),null==w||w()}
1,[N,S]=(0,n.useState)(!1),{isOpen:j,open:I,close:x}=(0,a.f)(),P=(0,s.m9)(null==p?void 0:p.user);return d&&d===(null==p?void 0:null===(l=p.user)||void 0===l?void 0:l.firebaseUid)||u===(null==p?void 0:null===(t=p.user)||void 0===t?void 0:t.id)?null:P?(0,o.jsxs)(o.Fragment,{children:[N&&(0,o.jsx)(ReloadOverlay,{}),(0,o.jsx)(FollowButton,{className:g,isFollowed:C,isLoading:b||O||U||h,onClick:handleToggleFollow,size:v})]}):(0,o.jsxs)(o.Fragment,{children:[N&&(0,o.jsx)(ReloadOverlay,{}),j&&(0,o.jsx)(i.L,{onClose:()=>{x(),_()},onSuccess:()=>{S(!0),x(),window.location.reload()},signupSource:"stores"}),(0,o.jsx)(FollowButton,{className:g,isFollowed:!1,isLoading:U,onClick:()=>{y(),I()},size:v})]})}},14226:function(e,l,t){t.d(l,{f:function(){return useAuthModal}});var o=t(67294);let useAuthModal=()=>{let[e,l]=(0,o.useState)(!1),t=(0,o.useCallback)(()=>l(!0),[]),n=(0,o.useCallback)(()=>l(!1),[]);return{isOpen:e,open:t,close:n}}},42589:function(e,l,t){t.d(l,{Hl:function(){return useFollowedUsers},Uv:function(){return m},gK:function(){return c},zZ:function(){return f}});var o=t(82729),n=t(68806),r=t(66252),s=t(6812),i=t(1644),a=t(67294),u=t(36225),d=t(26749);function _templateObject(){let e=(0,o._)(["\n query FOLLOWED_USERS_QUERY(\n $offset: Int\n $limit: Int\n $sortOrder: SortOrder\n $vanityName: String!\n ) {\n followedUsers(vanityName: $vanityName) {\n users(offset: $offset, limit: $limit, sortOrder: $sortOrder) {\n firebaseUid\n spreeId\n vanityName\n name\n avatarUrl\n isTeam\n isOnCommissionsProgram\n isIdentityVerified\n isMilitaryVerified\n recentProfileItems {\n imageUrl\n itemId\n type\n }\n teams {\n id\n name\n avatar\n }\n isUnfollowed @client\n }\n }\n }\n"]);return _templateObject=function(){return e},e}let c=12,f=["asc","desc",void 0],m=(0,n.Ps)(_templateObject()),useFollowedUsers=e=>{var l;let{sortOrder:t,vanityName:o}=e,{data:{followedUsersCount:n},loading:f,error:w}=(0,d.z)({vanityName:o}),v=(0,a.useRef)(!1),[g,p]=(0,a.useState)(1),[U,y]=(0,a.useState)(null),_=(0,r.x)(),{fetchMore:F,data:b,networkStatus:O,error:h,...C}=(0,s.a)(m,{context:{clientName:u.bd},variables:{limit:c,offset:0,sortOrder:t,vanityName:o},skip:!o,notifyOnNetworkStatusChange:!0,onCompleted(e){v.current||(v.current=!0,_.writeQuery({query:m,variables:{limit:c,offset:0,sortOrder:t,vanityName:o},data:{...e,followedUsers:{...e.followedUsers,users:e.followedUsers.users.map(e=>({...e,isUnfollowed:!1}))}}}))}}),N=(null==b?void 0:null===(l=b.followedUsers)||void 0===l?void 0:l.users.filter(e=>!e.isUnfollowed).length)||0;(0,a.useEffect)(()=>{O===i.Ie.setVariables&&(v.current=!1)},[O]);let loadMore=async()=>{try{await F({variables:{offset:N,limit:c,sortOrder:t},updateQuery:(e,l)=>{let{fetchMoreResult:t}=l;if(0===t.followedUsers.users.length)return e;let o=[...e.followedUsers.users,...t.followedUsers.users.map(e=>({...e,isUnfollowed:!1}))];return{...e,followedUsers:{...e.followedUsers,users:o}}}}),p(g+1)}catch(e){y(e)}};return{...C,error:h||w,loading:f||O===i.Ie.loading||O===i.Ie.setVariables,isLoadingMore:O===i.Ie.fetchMore,data:b,loadMore,loadMoreError:U,hasMore:n>N,totalCount:n}}},26749:function(e,l,t){t.d(l,{w:function(){return i},z:function(){return useFollowersAndFollowingCounts}});var o=t(82729),n=t(68806),r=t(6812),s=t(36225);function _templateObject(){let e=(0,o._)(["\n query FOLLOWERS_AND_FOLLOWING_COUNTS_QUERY($vanityName: String!) {\n followedUsers(vanityName: $vanityName) {\n totalCount\n }\n userFollowers(vanityName: $vanityName) {\n totalCount\n }\n }\n"]);return _templateObject=function(){return e},e}let i=(0,n.Ps)(_templateObject()),useFollowersAndFollowingCounts=e=>{var l,t;let{vanityName:o,skip:n=!1,fetchPolicy:a}=e,{data:u,loading:d,error:c,refetch:f}=(0,r.a)(i,{context:{clientName:s.bd},variables:{vanityName:o},fetchPolicy:a,skip:n||!o}),m=(null==u?void 0:null===(l=u.followedUsers)||void 0===l?void 0:l.totalCount)||0,w=(null==u?void 0:null===(t=u.userFollowers)||void 0===t?void 0:t.totalCount)||0;return{data:{followedUsersCount:m,userFollowersCount:w},loading:d,error:c,refetch:f}}}}]);
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.