1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},a=(new e.Error).stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="8fca9181-a3b9-4ad2-8f92-cb5bcb2ca721",e._sentryDebugIdIdentifier="sentry-dbid-8fca9181-a3b9-4ad2-8f92-cb5bcb2ca721")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[332],{47547:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/sell-giftcard",function(){return t(54403)}])},40520:function(e,a,t){"use strict";t.d(a,{MS:function(){return reviewTrade},Zq:function(){return handleSellGiftCard},eg:function(){return uploadImages},xR:function(){return getDashboardTrades}});var s=t(33803),r=t(65774);let getDashboardTrades=async e=>{let{data:a}=await s.Z.get("".concat(r.F,"/gcp/purchases/user/").concat(e,"?currentPage=1&limit=5")),t=a.giftCardPurchases,{data:l}=await s.Z.get("".concat(r.F,"/trades/user/").concat(e,"?currentPage=1&limit=5")),n=null==l?void 0:l.trades,c=[...t,...n];return c.sort((e,a)=>new Date(a.createdAt)-new Date(e.createdAt))},reviewTrade=async(e,a,t,l)=>{let{data:n}=await s.Z.post("".concat(r.F,"/trades/").concat(a,"/user/").concat(e,"/review"),{comment:l,rating:t});return n},handleSellGiftCard=async(e,a,t,l)=>{let{data:n}=await s.Z.post("".concat(r.F,"/trades/user/").concat(a,"&").concat(t,"&").concat(l),e);return n},uploadImages=async(e,a)=>{let{data:t}=await s.Z.post("".concat(r.F,"/uploads/").concat(e),{files:[...a]});return null==t?void 0:t.URLs}},41428:function(e,a,t){"use strict";var s=t(85893),r=t(53270),l=t(34606);a.Z=e=>{let{className:a}=e,t=(0,r.v)();return(0,s.jsx)("div",{className:"".concat(a," grid h-full place-items-center"),children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-6",children:[(0,s.jsx)("div",{className:"grid w-20 h-20 overflow-hidden p-2 pl-2.5 place-items-center rounded-full bg-[#F5F5F5] dark:bg-[#242424]",children:t?l.C2R:l._Mw}),(0,s.jsx)("p",{className:"text-md font-medium text-primary dark:text-white",children:"Can't find item."})]})})}},39793:function(e,a,t){"use strict";t.d(a,{_g:function(){return useCardsCategories},nf:function(){return useCategorySubcategories},tw:function(){return useHottestCards}});var s=t(78551),r=t(33803),l=t(65774);let getCardCategories=async()=>{let{data:e}=await r.Z.get("".concat(l.F,"/card/categories"));return null==e?void 0:e.cardCategories},getCategorySubCategories=async e=>{let{data:a}=await r.Z.get("".concat(l.F,"/card/sub-categories/").concat(e));return null==a?void 0:a.cardSubCategories},cards_api_getSubcategories=async()=>{let{data:e}=await r.Z.get("".concat(l.F,"/card/sub-categories"));return null==e?void 0:e.cardSubCategories},useHottestCards=()=>(0,s.a)({queryKey:["hottestCards"],queryFn:()=>cards_api_getSubcategories(),refetchInterval:59e3}),useCardsCategories=()=>(0,s.a)({queryKey:["categories"],queryFn:()=>getCardCategories()}),useCategorySubcategories=e=>(0,s.a)({queryKey:["subcategories",e],queryFn:()=>getCategorySubCategories(e),enabled:!!e})},51460:function(e,a,t){"use strict";var s=t(67294);a.Z=(e,a)=>{let t=(0,s.useRef)([]),[r,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{t.current[r]&&t.current[r].focus()},[r]),{itemRefs:t,handleKeyDown:(t,s,r)=>{"ArrowDown"===t.key&&r<e.length-1?(l(r+1),t.preventDefault()):"ArrowUp"===t.key&&r>0?(l(r-1),t.preventDefault()):("Enter"===t.key||" "===t.key)&&a(s,r)},selectedIndex:r}}},74191:function(e,a,t){"use strict";t.d(a,{M:function(){return useReferrals},p:function(){return useFetchSettings}});var s=t(78551),r=t(33803),l=t(65774);let getSettings=async()=>{let{data:e}=await r.Z.get("".concat(l.F,"/settings"));return null==e?void 0:e.settings},getUserReferrals=async(e,a)=>{let{data:t}=await r.Z.get("".concat(l.F,"/referrals/user/").concat(e,"?currentPage=").concat(a,"&limit=50"));return t},useFetchSettings=()=>(0,s.a)({queryKey:["settings"],queryFn:()=>getSettings()}),useReferrals=(e,a)=>(0,s.a)({queryKey:["userReferrals",a],queryFn:()=>getUserReferrals(e,a)})},54403:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return sell_giftcard}});var s=t(85893),r=t(27812),sell_giftcard_Stepper=e=>{let{step:a}=e;return(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"h-fit",children:[(0,s.jsxs)("div",{className:"stepper-item",children:[(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"stepper-circle bg-[#D4EFFF] dark:bg-[#D4EFFF]",children:[(0,s.jsx)("div",{className:"stepper-small-circle bg-[#7FD0FF] dark:bg-[#7FD0FF]"}),(0,s.jsx)("div",{className:"stepper-line ".concat(a>1&&"bg-[#7FD0FF] dark:bg-[#7FD0FF]")})]})}),(0,s.jsx)("p",{className:"stepper-text ".concat(1===a&&"text-primary dark:text-white"," ").concat(a>1&&"text-[#6C6C72] dark:text-secondary-dark"),children:"Select Gift Card Category"})]}),(0,s.jsxs)("div",{className:"stepper-item",children:[(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"stepper-circle ".concat(a>1&&"bg-[#D4EFFF] dark:bg-[#D4EFFF]"," "),children:[(0,s.jsx)("div",{className:"stepper-small-circle ".concat(a>1&&"bg-[#7FD0FF] dark:bg-[#7FD0FF]")}),(0,s.jsx)("div",{className:"stepper-line ".concat(a>2&&"bg-[#7FD0FF] dark:bg-[#7FD0FF]")})]})}),(0,s.jsx)("p",{className:"stepper-text ".concat(2===a&&"text-primary dark:text-white"," ").concat(a>2&&"text-[#6C6C72] dark:text-secondary-dark"),children:"Upload Gift Card Images"})]}),(0,s.jsxs)("div",{className:"stepper-item",children:[(0,s.jsx)("div",{children:(0,s.jsx)("div",{className:"stepper-circle ".concat(a>2&&"bg-[#D4EFFF] dark:bg-[#D4EFFF]"),children:(0,s.jsx)("div",{className:"stepper-small-circle ".concat(a>2&&"bg-[#7FD0FF] dark:bg-[#7FD0FF]")})})}),(0,s.jsx)("p",{className:"stepper-text ".concat(3===a&&"text-primary dark:text-white"," ").concat(a>3&&"text-[#6C6C72] dark:text-secondary-dark"),children:"Review"})]})]})})},l=t(67294),n=t(34606),c=t(89517),i=t(17106),d=t(55634);let o=(0,l.createContext)(),SellGiftCardContextProvider=e=>{let{children:a}=e,[t,r]=(0,l.useState)(d.QT[0]),[n,c]=(0,l.useState)({}),[i,x]=(0,l.useState)({}),[m,u]=(0,l.useState)("0.00"),[p,h]=(0,l.useState)([]),[g,j]=(0,l.useState)(null),[v,f]=(0,l.useState)(""),[N,b]=(0,l.useState)("NGN");return(0,s.jsx)(o.Provider,{value:{previewImageURLs:p,handleImageUpload:e=>{let a=[...e.target.files],t=a.filter(e=>"image/jpeg"===e.type||"image/jpg"===e.type||"image/png"===e.type),s=t.map(e=>URL.createObjectURL(e));h(s),j(t)},handleDeleteImage:e=>{let a=[...p],t=[...g];a.splice(e,1),t.splice(e,1),h(a),j(t)},setPreviewImageURLs:h,selectedImages:g,setSelectedImages:j,comment:v,setComment:f,category:n,subCategory:i,quantity:m,setCategory:c,setSubCategory:x,setQuantity:u,wallet:N,setWallet:b,selectedCurrency:t,handleSelectedCurrency:e=>{r(e),b(e.currency)}},children:a})},useSellGiftCardContext=()=>(0,l.useContext)(o);var x=t(53270),m=t(39793),u=t(87536),p=t(74191),h=t(36005),g=t(51460),j=t(58766),v=t(41428);
1let f=[{name:"Nigerian Naira",currency:"NGN",symbol:"â¦",wallet:"Naira"},{name:"Ghanaian Cedis",currency:"GHS",symbol:"âµ",wallet:"Cedis"},{name:"United States Dollars",currency:"USD",symbol:"$",wallet:"USD"}],N=(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,s.jsx)("path",{d:"M5.83301 10.4167L9.16634 13.75L14.1663 6.25",stroke:"#7FD0FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});var sell_giftcard_Category=e=>{var a,t,r,o,b,y,F;let k,w,{step:C,setStep:S}=e,{data:D}=(0,p.p)(),_=(0,j.Y)(),[G,A]=(0,l.useState)({}),[E,T]=(0,l.useState)(""),[Z,R]=(0,l.useState)(null),U=(0,x.v)(),I=(0,u.cI)({mode:"onChange"}),{formState:{errors:q},register:M,watch:O}=I,{setCategory:P,setQuantity:H,category:L,setSubCategory:B,subCategory:K,quantity:z,selectedCurrency:Y,handleSelectedCurrency:Q}=useSellGiftCardContext(),V=null==D?void 0:null===(a=D.conversionRates)||void 0===a?void 0:a.NGNToGHS,W=null==D?void 0:null===(t=D.conversionRates)||void 0===t?void 0:t.NGNToUSD;z&&K&&(k=(null==Y?void 0:Y.currency)==="NGN"?z*K.rate:(null==Y?void 0:Y.currency)==="GHS"?z*K.rate/V:z*K.rate/W);let{data:X,isLoading:$}=(0,m._g)(),J=null==X?void 0:X.filter(e=>e.name.toLowerCase().includes(E.toLowerCase())),{data:ee,isLoading:ea}=(0,m.nf)(null==L?void 0:L.id),handleSelectGiftCard=(e,a)=>{P(e),R(a),B({}),A({})},{itemRefs:et,handleKeyDown:es}=(0,g.Z)(J,handleSelectGiftCard),er=(null===(r=Object.keys(L))||void 0===r?void 0:r.length)>0,el=(null===(o=Object.keys(K))||void 0===o?void 0:o.length)>0,en=O("amount"),ec=!(null==L?void 0:L.name)||!(null==K?void 0:K.name)||!en||(null==q?void 0:q.amount);return(null==K?void 0:K.name)&&(w=(null==Y?void 0:Y.currency)==="NGN"?null==K?void 0:K.rate:(null==Y?void 0:Y.currency)==="GHS"?(null==K?void 0:K.rate)/V:(null==K?void 0:K.rate)/W),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("p",{className:"step-count",children:["Step ",C,"/3"]}),(0,s.jsx)("h2",{className:"step-label",children:"Select Gift Card Category"})]}),(0,s.jsxs)("div",{className:"mt-6 lg:mt-12",children:[(0,s.jsx)("div",{className:"search",children:(0,s.jsxs)("div",{className:"search-input-wrapper custom-focus",children:[(0,s.jsx)("span",{className:"fill-secondary dark:fill-secondary-dark",children:n.W1M}),(0,s.jsx)("input",{value:E,onChange:e=>T(e.target.value),className:"search-input",placeholder:(null==L?void 0:L.name)||"Search gift card",autoComplete:!0,type:"text"})]})}),$&&(0,s.jsx)("div",{className:"search-results flex h-fit animate-pulse flex-col gap-2",children:Array.from({length:3}).map((e,a)=>(0,s.jsx)("div",{className:"rounded-[12px] bg-[#F9FAFB] px-3 py-5 dark:bg-black/70"},a))}),!$&&(0,s.jsxs)("div",{className:"search-results h-[136px] lg:h-[120px] xl:h-[140px]",children:[!J.length&&!!E&&(0,s.jsx)(v.Z,{}),!!J.length&&(null==J?void 0:J.map((e,a)=>(0,s.jsxs)("div",{role:"menu",ref:e=>et.current[a]=e,onKeyDown:t=>es(t,e,a),tabIndex:0,onClick:()=>handleSelectGiftCard(e,a),className:"search-result group justify-between",children:[(0,s.jsxs)("div",{role:"menuitem",className:"flex-center gap-2",children:[(0,s.jsx)("img",{className:"h-5 w-10 rounded-full object-contain",src:e.avatar,alt:""}),(0,s.jsx)("p",{className:"country-name",children:e.name})]}),(0,s.jsx)("span",{className:"".concat(Z===a?"opacity-100":"opacity-0"),children:N})]},null==e?void 0:e.id)))]})]}),(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(c.R,{value:G,onChange:e=>{A(e),B(e)},children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)(c.R.Button,{className:"edit-category-btn group/dropdown data-[headlessui-state=open]:border-[#7FD0FF] border-[#F3F4F6]",children:[(0,s.jsxs)("p",{className:"space-y-[1.5px]",children:[(0,s.jsx)("span",{className:"block text-secondary transition-all dark:text-secondary-dark ".concat(G.name?"text-xs":"text-sm"),children:"Select Subcategory"}),(0,s.jsx)("span",{className:"block h-auto text-sm text-primary transition-all dark:text-white ".concat(G.name||(null==K?void 0:K.name)?"opacity-100":"opacity-0"),children:G.name||(null==K?void 0:K.name)})]}),(0,s.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-4 flex items-center rotate-0 group-data-[headlessui-state=open]/dropdown:rotate-180 transition-all group-data-[headlessui-state=open]/dropdown:[&_path]:stroke-[#7FD0FF]",children:n.n2Z})]}),(0,s.jsx)(i.u,{as:l.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsxs)(c.R.Options,{className:"select-dropdown-box left-0 z-10 max-h-[200px]",children:[ea&&(0,s.jsx)("div",{className:"search-results flex h-fit animate-pulse flex-col gap-2",children:Array.from({length:3}).map((e,a)=>(0,s.jsx)("div",{className:"rounded-[12px] bg-[#F9FAFB] px-3 py-5 dark:bg-black/70"},a))}),!ea&&(0,s.jsx)("div",{className:"",children:null==ee?void 0:null===(b=ee.filter(e=>null==e?void 0:e.isActive))||void 0===b?void 0:b.map(e=>(0,s.jsx)(c.R.Option,{className:e=>{let{active:a}=e;return"relative cursor-default rounded-lg py-2 text-primary ".concat(a?"bg-[#F9FAFB] dark:bg-[#323232]":"")},value:e,children:a=>{let{selected:t}=a;return(0,s.jsxs)("p",{className:"flex-center gap-2 ".concat(t?"px-3":"px-10"),children:[t&&(0,s.jsx)("span",{children:n.cvi}),(0,s.jsx)("span",{className:"block text-sm font-medium text-primary dark:text-white",children:e.name})]})}},null==e?void 0:e.id))})]})})]})}),(0,s.jsxs)("p",{className:"mt-2 text-sm text-right text-secondary dark:text-secondary-dark",children:["Rate: ",(0,s.jsx)("span",{className:"text-[#7FD0FF]",children:(0,h.DE)(w,2)||"0"})]})]}),(0,s.jsxs)("div",{className:"input-container mt-6 h-14",children:[(0,s.jsx)("label",{className:"".concat(en&&"filled"," text-sm text-secondary dark:text-secondary-dark"),htmlFor:"",children:"Enter Total Gift Card Amount"}),(0,s.jsx)("input",{disabled:!el,onWheel:h.v3,...M("amount",{onChange:e=>H(e.target.value),max:{value:d.FU,message:"Maximum limit exceeded."},validate:e=>e>
1=K.minimumAcceptableAmount||"Amount cannot be less than ".concat(K.minimumAcceptableAmount)}),className:"".concat((null==q?void 0:q.amount)&&"is-error"," bg-[#F5F5F5] text-sm text-primary disabled:cursor-not-allowed dark:bg-[#242424] dark:text-white")})]}),(!el&&er||(null==q?void 0:q.amount))&&(0,s.jsx)("span",{className:"text-error",children:(null==q?void 0:null===(y=q.amount)||void 0===y?void 0:y.message)||"Please select a sub-category."}),el&&(0,s.jsxs)("p",{className:"mt-2 text-sm text-right text-secondary dark:text-secondary-dark",children:["Min amount: ",(0,s.jsx)("span",{className:"text-[#7FD0FF]",children:K.minimumAcceptableAmount})]}),(0,s.jsxs)("div",{className:"flex-center mt-6 gap-2",children:[(0,s.jsx)("div",{className:"bills-phone-input h-14 flex-1 rounded-2xl border border-[#EAEAEA] bg-[#F6F6F6] px-4 dark:border-[#323232] dark:bg-[#242424]",children:(0,s.jsxs)("div",{className:"flex-center gap-1 text-[#9CA3AF] dark:text-secondary-dark",children:[(0,s.jsx)("p",{children:null==Y?void 0:Y.symbol}),(0,s.jsx)("p",{children:(0,h.DE)(k||0)})]})}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)(c.R,{value:Y,onChange:Q,children:(0,s.jsxs)("div",{children:[(0,s.jsxs)(c.R.Button,{className:"edit-category-btn h-14 w-24 flex-center relative justify-center gap-1 text-left group/dropdown data-[headlessui-state=open]:border-[#7FD0FF] border-[#F3F4F6]",children:[(0,s.jsx)("p",{className:"text-sm text-secondary dark:text-secondary-dark",children:null!==(F=Y.currency)&&void 0!==F?F:"NGN"}),(0,s.jsx)("span",{className:"pointer-events-none flex items-center rotate-0 group-data-[headlessui-state=open]/dropdown:rotate-180 transition-all group-data-[headlessui-state=open]/dropdown:[&_path]:stroke-[#7FD0FF]",children:n.n2Z})]}),(0,s.jsx)(i.u,{as:l.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(c.R.Options,{className:"select-dropdown-box right-0 top-12 h-fit w-[300px]",children:(0,s.jsx)("div",{children:f.map(e=>(0,s.jsx)(c.R.Option,{className:e=>{let{active:a}=e;return"relative cursor-default rounded-lg py-2 text-primary ".concat(a?"bg-[#F9FAFB] dark:bg-[#323232]":"")},value:e,children:a=>{let{selected:t}=a;return(0,s.jsxs)("p",{className:"flex-center gap-2 ".concat(t?"px-3":"pl-10 pr-3"),children:[t&&(0,s.jsx)("span",{children:n.cvi}),(0,s.jsxs)("div",{className:"flex-center w-full justify-between",children:[(0,s.jsx)("span",{className:"font-medium text-primary dark:text-white",children:e.name}),(0,s.jsx)("span",{className:"text-secondary dark:text-secondary-dark",children:e.currency})]})]})}},null==e?void 0:e.name))})})})]})})})]}),(0,s.jsxs)("div",{className:"flex-between mt-8 lg:mt-16",children:[(0,s.jsxs)("button",{onClick:_,className:"step-prev-btn",children:[(0,s.jsx)("span",{className:"".concat(U&&"dark-prev-icon"),children:n.xCe}),"Back"]}),(0,s.jsxs)("button",{disabled:ec,onClick:()=>S(2),className:"step-proceed-btn",children:["Proceed ",(0,s.jsx)("span",{className:"".concat(U&&"dark-next-icon"),children:n.hpM})]})]})]})},b=t(89378),sell_giftcard_UploadImages=e=>{let{step:a,setStep:t}=e,{previewImageURLs:r,handleImageUpload:l,setComment:c,comment:i,handleDeleteImage:d}=useSellGiftCardContext(),o=(0,x.v)(),m=0===r.length&&!i;return(0,s.jsx)("div",{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("p",{className:"step-count",children:["Step ",a,"/3"]}),(0,s.jsx)("h2",{className:"step-label",children:"Upload Images"})]}),0===r.length?(0,s.jsx)("label",{htmlFor:"images",className:"mt-16 block cursor-pointer rounded-2xl border border-dashed border-[#EAEAEA] py-4 dark:border-[#323232] dark:bg-[#242424]",children:(0,s.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,s.jsxs)("button",{className:"cursor-pointer",children:[(0,s.jsx)("span",{children:o?n.QUm:n.c22}),(0,s.jsx)("input",{accept:".jpeg, .jpg, .png",multiple:!0,onChange:e=>l(e),id:"images",type:"file",hidden:!0})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm font-medium",children:[(0,s.jsx)("p",{className:"text-[#7FD0FF]",children:"Click to upload"}),(0,s.jsx)("p",{className:"mt-1 text-secondary dark:text-secondary-dark",children:"You can upload multiple images at once"})]})]})}):(0,s.jsx)("div",{className:"mt-6 rounded-2xl border border-dashed border-[#
1EAEAEA] p-6 dark:border-[#323232]",children:(0,s.jsx)("div",{className:"flex-center gap-2",children:r.map((e,a)=>(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{onClick:()=>d(a),className:"absolute -right-1 -top-1 z-10",children:n.Sa4}),(0,s.jsx)(b.Z,{classDialog:"custom-zoom",children:(0,s.jsx)("img",{className:"w-10 h-10 rounded-lg border border-[#F4F4F3] dark:border-[#323232]",src:e,alt:""})})]},e))})}),(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsxs)("p",{className:"search-label text-sm font-medium text-primary",children:["Add Comment"," ",(0,s.jsx)("span",{className:"font-normal text-[#9CA3AF] dark:text-secondary-dark",children:"(Optional)"})]}),(0,s.jsx)("textarea",{value:i,onChange:e=>c(e.target.value),className:"comment-box",placeholder:"Enter ecode here",maxLength:1e3})]}),(0,s.jsxs)("div",{className:"flex-between mt-16",children:[(0,s.jsxs)("button",{onClick:()=>t(1),className:"step-prev-btn",children:[(0,s.jsx)("span",{className:"".concat(o&&"dark-prev-icon"),children:n.xCe}),"Back"]}),(0,s.jsxs)("button",{disabled:m,onClick:()=>t(3),className:"step-proceed-btn",children:["Proceed ",(0,s.jsx)("span",{className:"".concat(o&&"dark-next-icon"),children:n.hpM})]})]})]})})},y=t(83606),F=t(79042),k=t(30202),w=t(98029),C=t(12868),S=t(87066),D=t(40520),_=t(86501),G=t(83198),Trade=e=>{let{closeTradeModal:a,setOpenCompleteOrderSuccessModal:t}=e,r=(0,F.xJ)(),c=(0,x.v)(),i=(0,k.NL)(),[d,o]=(0,l.useState)(null),{comment:m,quantity:u,category:p,subCategory:g,wallet:j,selectedImages:v}=useSellGiftCardContext();(0,l.useEffect)(()=>{if((null==d?void 0:d.length)>0){let uploadFiles=async()=>{let e=null==d?void 0:d.map((e,a)=>S.Z.put(e.url,v[a],{headers:{"x-amz-acl":"public-read","Content-Type":e.type}}));try{await Promise.all(e)}catch(e){_.ZP.error("File upload failed"),console.error("File upload failed:",e)}};uploadFiles()}},[d,v]);let tradeGiftCard=async()=>{if(v){let e=v.map(e=>({name:e.name,type:e.type})),a=await (0,D.eg)(null==r?void 0:r.id,e);if(a){o(a);let e=a.map(e=>e.imageUrl);return await (0,D.Zq)({comment:m||"",cardTotalAmount:+u,wallet:j,tradeFiles:e},p.id,g.id,null==r?void 0:r.id)}}if(!v)return await (0,D.Zq)({comment:m||"",cardTotalAmount:+u,wallet:j},p.id,g.id,null==r?void 0:r.id)},{mutate:f,isPending:N}=(0,w.D)({mutationFn:()=>tradeGiftCard(),onSuccess:async()=>{G.Z.track("Sell gift card"),await i.invalidateQueries({queryKey:["dashboardTrades",r.id]}),await i.invalidateQueries({queryKey:["subcategories",g.id]}),a(),t(!0)},onError:e=>(0,h.x2)(e)});return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{className:"close-modal ".concat(c&&"light-close-icon"),onClick:a,dangerouslySetInnerHTML:{__html:n.Two}}),(0,s.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,s.jsx)("p",{children:c?n.F4:n.RV_}),(0,s.jsxs)("div",{className:"my-10 text-center",children:[(0,s.jsx)("h2",{className:"text-[18px] font-medium text-primary dark:text-white",children:"Important Notice!"}),(0,s.jsx)("p",{className:"mt-2 text-sm text-secondary dark:text-secondary-dark",children:g.termsOfTransaction})]}),(0,s.jsxs)("div",{className:"flex-center w-full gap-2",children:[(0,s.jsx)("button",{onClick:a,className:"cancel-btn",children:"Cancel!"}),(0,s.jsx)("button",{disabled:N,onClick:()=>f(),className:"complete-order-btn flex justify-center",children:N?(0,s.jsx)(C.Z,{}):"Submit Trade"})]})]})]})},A=t(41664),E=t.n(A),T=t(64960),Z=t(70211),Success=e=>{let{closeModal:a}=e,t=(0,x.v)(),r=(0,T.g)();return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(E(),{href:"/giftcards",children:(0,s.jsx)("button",{className:"close-modal ".concat(t&&"light-close-icon"),onClick:a,dangerouslySetInnerHTML:{__html:n.Two}})}),(0,s.jsxs)("div",{className:"flex w-full flex-col items-center",children:[(0,s.jsx)("div",{className:"w-24 h-24 min-w-24 min-h-24 bg-[#F6F6F6] dark:bg-[#242424] rounded-full overflow-hidden",children:(0,s.jsx)("img",{className:"w-20 h-20",src:"/assets/images/purchase-success.webp",alt:""})}),(0,s.jsxs)("div",{className:"my-8 text-center",children:[(0,s.jsx)("h2",{className:"text-[18px] font-medium text-primary dark:text-white",children:"Trade Submitted Successfully!"}),(0,s.jsx)("p",{className:"mt-2 text-sm text-secondary dark:text-secondary-dark",children:"Your transaction has been submitted sucessfully. Click âView Historyâ below to see your transaction details."})]}),(0,s.jsx)(Z.Z,{closeModal:a,id:"sell-giftcard"}),(0,s.jsxs)("div",{className:"flex-center w-full gap-2",children:[(0,s.jsx)(E(),{className:"cancel-btn flex-center justify-center",href:"/giftcards",children:(0,s.jsx)("button",{children:"Done!"})}),(0,s.jsx)(E(),{onClick:()=>r("sold"),className:"complete-order-btn flex-center justify-center",href:"/transaction-history",children:(0,s.jsx)("button",{children:"View History"})})]})]})]})},R=t(68583),U=t(97644),Reviews=e=>{var a,t;let{setStep:r,step:c}=e,{data:i}=(0,p.p)(),{previewImageURLs:d,comment:o,quantity:m,category:u,subCategory:g,wallet:j}=useSellGiftCardContext(),[v,f]=(0,l.useState)(!1),[N,F]=(0,l.useState)(!1),k=(0,x.v)(),{width:w,height:C}=(0,U.Z)(),S=null==i?void 0:null===(a=i.conversionRates)||void 0===a?void 0:a.NGNToGHS,D=null==i?void 0:null===(t=i.conversionRates)||void 0===t?void 0:t.NGNToUSD,_="NGN"===j?m*g.rate:"GHS"===j?m*g.rate/S:m*g.rate/D;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("p",{className:"step-count",children:["Step ",c,"/3"]}),(0,s.jsx)("h2",{className:"step-label",children:"Review Transaction Details"})]}),(0,s.jsx)("div",{className:"mt-6 border-t border-[#F3F4F6] py-4 dark:border-[#323232] lg:mt-12"}),(0,s.jsxs)("div",{className:"flex flex-col gap-[45px]",children:[(0,s.jsxs)("div",{className:"flex-center justify-between",children:[(0,s.jsxs)("div",{className:"flex-center gap-5",children:[(0,s.jsx)("img",{className:"h-12 w-[55px] object-contain",src:"/assets/images/amex.png",alt:""}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"summary-primary-text",children:u.name}),(0,s.jsx)("p",{className:"summary-secondary-text -mt-1",children:g.name})]})]}),(0,s.jsxs)("button",{className:"flex-center cursor-pointer gap-2",onClick:()=>r(1),children:[(0,s.jsx)("span",{children:n.dY8}),(0,s.jsx)("span",{className:"text-sm font-medium text-[#7FD0FF]",children:"Edit"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex-center justify-between",children:[(0,s.jsx)("p",{className:"summary-detail-label",children:"Total Amount"}),(0,s.jsx)("p",{className:"summary-detail-text",children:m})]}
1),(0,s.jsxs)("div",{className:"flex-center mt-6 justify-between",children:[(0,s.jsxs)("p",{className:"summary-detail-label",children:["NGN"===j?"Naira":"GHS"===j?"Cedis":"USD"," Equivalent"]}),(0,s.jsxs)("p",{className:"summary-detail-text text-[#7FD0FF] dark:text-[#7FD0FF]",children:["NGN"===j?"â¦":"GHS"===j?"âµ":"$"," ",(0,h.DE)(_)]})]})]}),(null==d?void 0:d.length)>0&&(0,s.jsxs)("div",{className:"flex-center justify-between gap-4 rounded-2xl bg-[#F5F5F5] p-4 dark:bg-[#242424]",children:[(0,s.jsx)("div",{className:"flex-center gap-2",children:d.map(e=>(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)(b.Z,{classDialog:"custom-zoom",children:(0,s.jsx)("img",{className:"w-10 h-10 rounded-lg border border-[#F4F4F3] dark:border-[#323232]",src:e,alt:""})})},e))}),(0,s.jsxs)("button",{className:"flex cursor-pointer flex-col",onClick:()=>r(2),children:[(0,s.jsxs)("span",{className:"text-sm text-primary dark:text-white",children:[d.length," images uploaded"]}),(0,s.jsx)("span",{className:"font-medium text-[#7FD0FF] underline",children:"edit"})]})]}),o&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex-center mb-2 justify-between",children:[(0,s.jsx)("p",{className:"font-medium text-primary dark:text-white",children:"Added Comment"}),(0,s.jsxs)("button",{className:"flex-center cursor-pointer gap-2",onClick:()=>r(2),children:[(0,s.jsx)("span",{children:n.dY8}),(0,s.jsx)("span",{className:"text-sm font-medium text-[#7FD0FF]",children:"Edit"})]})]}),(0,s.jsx)("div",{className:"min-h-[65px] rounded-[12px] border border-[#E5E7EB] px-4 py-3 dark:border-[#323232]",children:(0,s.jsx)("p",{className:"text-md text-primary dark:text-secondary-dark",children:o})})]})]}),(0,s.jsxs)("div",{className:"flex-between mt-11",children:[(0,s.jsxs)("button",{onClick:()=>r(2),className:"step-prev-btn",children:[(0,s.jsx)("span",{className:"".concat(k&&"dark-prev-icon"),children:n.xCe}),"Back"]}),(0,s.jsxs)("button",{onClick:()=>f(!0),className:"step-proceed-btn",children:["Proceed ",(0,s.jsx)("span",{className:"".concat(k&&"dark-next-icon"),children:n.hpM})]})]})]}),N&&(0,s.jsx)(R.Z,{width:w,height:C}),(0,s.jsx)(y.Z,{isOpen:v,style:"lg:w-[500px] rounded-[24px] mb-[25px] lg:mb-0",children:(0,s.jsx)(Trade,{setOpenCompleteOrderSuccessModal:F,closeTradeModal:()=>f(!1)})}),(0,s.jsx)(y.Z,{isOpen:N,style:"lg:w-[500px] rounded-[24px] mb-[25px] lg:mb-0",children:(0,s.jsx)(Success,{closeModal:()=>F(!1)})})]})};t(45397);var sell_giftcard=()=>{let[e,a]=(0,l.useState)(1);return(0,s.jsx)(r.Z,{title:"Sell Gift Cards",children:(0,s.jsxs)("div",{className:"flex gap-28",children:[(0,s.jsx)("div",{className:"sticky top-0 hidden h-fit w-[218px] min-w-[19%] lg:block",children:(0,s.jsx)(sell_giftcard_Stepper,{step:e})}),(0,s.jsx)(SellGiftCardContextProvider,{children:(0,s.jsxs)("div",{className:"w-full min-w-[36%] lg:w-[400px]",children:[1===e&&(0,s.jsx)(sell_giftcard_Category,{step:e,setStep:a}),2===e&&(0,s.jsx)(sell_giftcard_UploadImages,{step:e,setStep:a}),3===e&&(0,s.jsx)(Reviews,{step:e,setStep:a})]})})]})})}}},function(e){e.O(0,[2196,5675,1664,6153,7906,9954,8511,8559,5804,7536,8583,8572,143,7812,9416,9774,2888,179],function(){return e(e.s=47547)}),_N_E=e.O()}]);
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.