1"use strict";(self.webpackChunk_vndr_ship_client=self.webpackChunk_vndr_ship_client||[]).push([[9176],{89176(e,t,a){a.r(t),a.d(t,{default:()=>_});var l=a(71288),r=a(33949),s=a(98477),n=a(37643),i=a(84489),d=a(45851),c=a(26600),o=a(47876),w=a(39698),m=a(46685),u=a(67252),x=a(14618),h=a(28872);const v=e=>{let t=e.show,a=e.handleClose,l=e.referredUsers;return(0,h.jsx)(i.aF,{maxWidth:"xs",open:!!t,title:"Referred Companies",handleClose:a,actions:[{isClose:!0}],children:(0,h.jsxs)("div",{children:[(0,h.jsxs)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:[(0,h.jsx)("div",{className:"tw-font-semibold",children:"Company"}),(0,h.jsx)("div",{className:"tw-font-semibold tw-text-center",children:"Paid Amount"})]}),null===l||void 0===l?void 0:l.map(e=>{const t=(null===e||void 0===e?void 0:e.companyName)||(null===e||void 0===e?void 0:e.name)||(null===e||void 0===e?void 0:e.companyEmail)||(null===e||void 0===e?void 0:e.email);return(0,h.jsxs)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4 tw-my-1",children:[(0,h.jsx)("div",{children:t}),(0,h.jsx)("div",{className:"tw-text-center",children:(0,m.centsToCurrencyFormat)((null===e||void 0===e?void 0:e.rewardAmount)||0)})]},t)})]})})};var f=a(91028);const g=()=>{var e,t,a;const l=(0,u.useState)({}),r=(0,w.A)(l,2),s=r[0],n=r[1],d=(0,u.useState)(!1),c=(0,w.A)(d,2),o=c[0],g=c[1];(0,u.useEffect)(()=>{(async()=>{try{const e=await x.Km.get("/referral/stats");n(e.data)}catch(e){console.error(e)}})()},[]);const p=[{title:"Referrals",description:"People who have signed up using your link.",value:(0,h.jsx)("div",{className:(0,f.cn)((null===s||void 0===s||null===(e=s.totals)||void 0===e?void 0:e.totalReferrals)&&"tw-text-secondary tw-cursor-pointer tw-underline"),onClick:()=>{var e;return(null===s||void 0===s||null===(e=s.totals)||void 0===e?void 0:e.totalReferrals)&&g(!0)},children:(null===s||void 0===s||null===(t=s.totals)||void 0===t?void 0:t.totalReferrals)||0})},{title:"Paid",description:"Amount that has already been applied to your account.",currency:!0,value:(0,m.centsToCurrencyFormat)((null===s||void 0===s||null===(a=s.totals)||void 0===a?void 0:a.totalRewarded)||0)}];return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(v,{show:o,handleClose:()=>g(!1),referredUsers:null===s||void 0===s?void 0:s.referredUsers}),(0,h.jsx)(i.Zp,{title:"Referral Stats",className:"!tw-max-w-none",children:(0,h.jsx)("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4",children:p.map((e,t)=>(0,h.jsxs)(u.Fragment,{children:[(0,h.jsxs)("div",{className:"tw-flex tw-gap-4 tw-w-full tw-justify-between tw-items-center tw-pr-4",children:[(0,h.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,h.jsx)("div",{className:"tw-text-gray-700 tw-text-base tw-font-semibold",children:e.title}),(0,h.jsx)("div",{className:"tw-text-sm tw-text-gray-700",children:e.description})]}),(0,h.jsx)("div",{className:"tw-text-base tw-text-gray-700 tw-font-semibold",children:e.value})]}),t!==p.length-1&&(0,h.jsx)(i.cG,{})]},e.title))})})]})},p=["className"],j=e=>{let t=e.className,a=(0,n.A)(e,p);return(0,h.jsx)("svg",(0,s.A)((0,s.A)({className:t,g:!0,viewBox:"0 0 1200 1227",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a),{},{children:(0,h.jsx)("path",{d:"M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z",fill:"white"})}))},y=e=>{let t=e.handleCopyReferralUrl;return(0,h.jsx)(i.m_,{title:"Copy to clipboard",children:(0,h.jsx)("span",{tabIndex:0,className:"tw-flex tw-items-center",children:(0,h.jsx)(d.PMT,{onClick:t,className:"!tw-cursor-pointer !tw-text-black"})})})},b=e=>{let t=e.referralKey;const a=(0,l.useDispatch)(),r=t?"".concat(c.GG,"/register?").concat(c.Qj.params.code,"=").concat(t,"&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=CopyPaste"):"",s=()=>{r&&(0,o.lW)(r,a,"Referral Link")};return(0,h.jsxs)("div",{className:"tw-grid tw-grid-cols-1 lg:tw-grid-cols-3 tw-gap-4 tw-mt-4",children:[(0,h.jsxs)(i.Zp,{className:"!tw-max-w-none",title:"Give $".concat(c.Qj.creditAmount,", Get $").concat(c.Qj.rewardAmount),children:["Everyone you refer will get $",c.Qj.creditAmount," added to their balance. Once they've spent $",c.Qj.minSpendAmount," with us, you'll get $",c.Qj.rewardAmount,"! There is no limit to the referral credit you can earn."]}),(0,h.jsxs)(i.Zp,{title:"Share Your Unique URL",className:"!tw-max-w-none",children:[(0,h.jsx)("div",{className:"tw-flex-1",children:"Copy your unique link and share it with your friends and followers."}),(0,h.jsxs)("div",{className:"tw-flex-1 tw-flex tw-flex-col tw-gap-4",children:[(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"tw-text-sm tw-font-medium tw-mb-2 tw-text-gray-700",children:"Referral Link"}),(0,h.jsx)("div",{className:"tw-flex tw-gap-2",children:(0,h.jsx)(i.A_,{value:r,readOnly:!0,className:"tw-flex-1",onClick:s,adornmentClasses:"!tw-pr-10",endAdornment:(0,h.jsx)(y,{handleCopyReferralUrl:s})})})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"tw-text-sm tw-font-medium tw-mb-2 tw-text-gray-700",children:"Share Via"}),(0,h.jsx)("a",{href:"https://x.com/intent/post?text=".concat(encodeURIComponent("Join me on ShipFare and save on shipping!"),"&url=").concat(encodeURIComponent(r)),target:"_blank",rel:"noopener noreferrer",children:(0,h.jsx)(i.$n,{variant:"contained",className:"!tw-bg-black hover:!tw-bg-gray-800 !tw-text-white tw-flex tw-items-center tw-gap-2",children:(0,h.jsx)(j,{className:"tw-w-4 tw-h-4"})})})]})]})]}),(0,h.jsx)(g,{referralKey:t})]})},N=e=>{let t=e.selected,a=e.children,l=e.onClick;return(0,h.jsxs)("div",{className:"tw-relative !tw-w-fit tw-items-center tw-flex tw-border tw-border-solid tw-rounded-lg tw-p-4 tw-cursor-pointer tw-transition-colors ".concat(t?"tw-border-primary":"tw-border-gray-200"),onClick:l,children:[(0,h.jsx)(i.pO,{checked:t,className:"tw-absolute tw-top-10 tw-left-4"}),(0,h.jsx)("div",{className:"tw-ml-8",children:a})]})},C=e=>{let t=e.referralKey;const a=(0,l.useDispatch)(),r=[{url:"referral-badge/SF_Referral_Badge_Gradient.svg",alt:"Referral Badge Gradient",value:"gradient"},{url:"referral-badge/SF_Referral_Badge_Black_White.svg",alt:"Referral Badge Solid",value:"solid"},{url:"referral-badge/SF_Referral_Badge_White.svg",alt:"Referral Badge White",value:"white"}],s=(0,u.useState)(r[0].value),n=(0,w.A)(s,2),d=n[0],m=n[1],x=(0,u.useState)("html"),v=(0,w.A)(x,2),f=v[0],g=v[1],p=r.find(e=>e.value===d),j=t?"".concat(c.GG,"/register?").concat(c.Qj.params.code,"=").concat(t,"&utm_campaign=").concat(c.Qj.params.utmCampaign,"&utm_medium=").concat(c.Qj.params.utmMedium,"&utm_source=badge"):"",b="".concat(c.nv,"/Assets/").concat(p.url),C={markdown:"[](").concat(j,")"),html:'<a href="'.concat(j,'"><img src="').concat(b,'" width="200" height="70" alt="ShipFare Referral Badge" /></a>')},R=()=>{f&&(0,o.lW)(C[f],a,"Referral badge")};return(0,h.jsxs)(i.Zp,{title:"Add a Referral Badge",className:"tw-mt-4 !tw-max-w-none",children:[(0,h.jsx)("span",{children:"Embed a visual badge on your website or content to link users directly to your referral url"}),(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"tw-text-sm tw-font-medium tw-mb-2 tw-text-gray-700",children:"Select style"}),(0,h.jsx)(i.z6,{value:d,className:"!tw-flex !tw-gap-4 !tw-flex-col lg:!tw-flex-row",onChange:e=>{m(e.target.value)},children:r.map((e,t)=>(0,h.jsx)(N,{selected:d===e.value,onClick:()=>m(e.value),children:(0,h.jsx)("img",{width:200,height:70,src:"".concat(c.nv,"/Assets/").concat(e.url),alt:e.alt,className:"tw-object-contain"})},t))})]}),(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{className:"tw-text-sm tw-font-medium tw-mb-2 tw-text-gray-700",children:"Embed code as:"}),(0,h.jsxs)(i.z6,{value:f,className:"!tw-flex !tw-gap-4 !tw-flex-col lg:!tw-flex-row",onChange:e=>{g(e)},children:[(0,h.jsx)(i.pO,{fullWidth:!1,labelPlacement:"end",label:"HTML",value:"html"}),(0,h.jsx)(i.pO,{fullWidth:!1,labelPlacement:"end",label:"Markdown",value:"markdown"})]}),(0,h.jsx)(i.A_,{value:C[f],readOnly:!0,multiline:!0,rows:4,className:"tw-flex-1",containerClasses:"tw-mt-4",onClick:R,adornmentClasses:"!tw-pr-10",endAdornment:(0,h.jsx)(y,{handleCopyReferralUrl:R})})]})]})};var R=a(57863);const _=()=>{const e=(0,l.useSelector)(e=>{var t;return null===e||void 0===e||null===(t=e.auth)||void 0===t?void 0:t.user}),t=(0,R.useHistory)(),a=(0,r.e)(null===e||void 0===e?void 0:e._id);return(0,u.useEffect)(()=>{document.title="Referrals - ShipFare",null!==c.Qj&&void 0!==c.Qj&&c.Qj.active(e)||t.push("/dashboard")},[]),(0,h.jsxs)("div",{className:"tw-max-w-6xl tw-mx-auto",children:[(0,h.jsx)("h2",{className:"tw-text-xl tw-m-0 lg:tw-text-3xl tw-font-semibold tw-text-secondary tw-leading-none tw-tracking-tight",children:"Referrals"}),(0,h.jsx)(b,{referralKey:a}),(0,h.jsx)(C,{referralKey:a})]})}}}]);
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.