1var te=Object.defineProperty,oe=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var A=(e,o,t)=>o in e?te(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,u=(e,o)=>{for(var t in o||(o={}))M.call(o,t)&&A(e,t,o[t]);if(C)for(var t of C(o))O.call(o,t)&&A(e,t,o[t]);return e},y=(e,o)=>oe(e,ne(o));var F=(e,o)=>{var t={};for(var a in e)M.call(e,a)&&o.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&C)for(var a of C(e))o.indexOf(a)<0&&O.call(e,a)&&(t[a]=e[a]);return t};var E=(e,o,t)=>new Promise((a,r)=>{var i=l=>{try{d(t.next(l))}catch(c){r(c)}},s=l=>{try{d(t.throw(l))}catch(c){r(c)}},d=l=>l.done?a(l.value):Promise.resolve(l.value).then(i,s);d((t=t.apply(e,o)).next())});import{G as ae,j as n,P as g,f as ie,g as se,n as k,M as re,N as le,i as de,aW as ce,a6 as ue,a0 as me,I as w,B as $,aq as pe,b as be}from"./npm.sellpy-design-system.DdsWMDHW.bundle.js";import{u as R,d as P,r as _,C as fe,c as ye,F as xe}from"./npm.react-hook-form.HNw-giVQ.bundle.js";import{l as U,b as ge,N as he}from"./npm.react-router.BDfxye5A.bundle.js";import{m as h,J as S,a_ as Ie,b$ as ve,gX as je,gZ as Ce,c0 as Se,u as Re,ag as N,ah as B,y as H,z,g_ as Ee,b6 as _e,a4 as qe}from"./index.DWkcZ-_z.bundle.js";import{q as Q,i as Le}from"./npm.apollo-client.CXJpJPbe.bundle.js";import"./npm.lodash.DxN61Y-S.bundle.js";import{p as Te}from"./tools.DUKVunGT.bundle.js";import{u as Ae}from"./usePricingModelFromSale.60sdLVit.bundle.js";import{N as Me}from"./NotFound.CkQBkqUE.bundle.js";import{s as Oe}from"./salesControl.C-eWCKIC.bundle.js";import{h as Fe}from"./errors.dMazk1gb.bundle.js";import{s as Ne,c as Be}from"./reevaluationRequest.mutation.CqCkRkuf.bundle.js";import{b as De}from"./utils.D1f6k3MF.bundle.js";import{g as p}from"./npm.styled-components.CzYR6Qdp.bundle.js";import{b0 as ke,bC as we,b6 as $e,az as Pe,J as G}from"./npm.sellpy-commons.B413ARrd.bundle.js";import{u as I}from"./npm.react-i18next.BwOa93YU.bundle.js";import"./npm.react-dom.DlIYrMBD.bundle.js";import"./npm.luxon.3NOFZn7k.bundle.js";import"./npm.zod.DEnjmUYT.bundle.js";import"./npm.parse.BcWrqAIh.bundle.js";import"./npm.sentry-react.Z7tY98T1.bundle.js";import"./npm.swr.CiJqMJM6.bundle.js";import"./npm.algolia.BDObKZ-5.bundle.js";import"./npm.i18next.B74d65Th.bundle.js";import"./translations.B5c9TvV-.bundle.js";import"./npm.graphql.ClDiDpi3.bundle.js";import"./npm.immutable.DTQZtUT4.bundle.js";import"./utils.DGZXBK23.bundle.js";import"./itemStatus.BI0rbHvu.bundle.js";import"./MetaTagPlacer.RJbhKlsg.bundle.js";import"./utils.DutWSyoJ.bundle.js";import"./LayoutCenteredColumn.DciXWKum.bundle.js";import"./RejectedSection.fragment.B7JBX3Ah.bundle.js";import"./SectionItemCard.fragment.DiUnUq-r.bundle.js";import"./ProcessingSection.fragment.DqmCw1G1.bundle.js";import"./LostItemStatusLabel.fragment.DBdyeWvP.bundle.js";try{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a1d7155f-80de-4f31-a7ea-35ebdb351d0e",e._sentryDebugIdIdentifier="sentry-dbid-a1d7155f-80de-4f31-a7ea-35ebdb351d0e")}catch(e){}{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:sellpy-market":!0})}const Ue=p.div` 2 grid-column: span 12; 3 display: flex; 4 gap: 10px; 5 padding: 8px 32px; 6 background-color: ${({theme:e})=>e.colour.bg.static.nr100}; 7 ${h.desktop} { 8 padding: 8px 8px 0 8px; 9 } 10`,He=p(ae)` 11 padding-bottom: 56px; 12`,ze=p.div` 13 grid-column: 5 / span 4; 14 min-width: 600px; 15 16 ${h.desktop} { 17 grid-column: span 12; 18 min-width: auto; 19 } 20`,Qe=p.div` 21 background-color: ${({theme:e})=>e.colour.bg.static.nr100}; 22 padding: 32px 0px; 23 border-radius: ${({theme:e})=>
23e.radius.soft}px; 24 display: flex; 25 flex-direction: column; 26 gap: 24px; 27 28 ${h.largerThanDesktop} { 29 margin: 0 16px; 30 padding: 24px 16px; 31 } 32`,Ge=se,D=ke({fieldName:"condition"}).restrictedTo,V=e=>{const o=D.indexOf(e);return D.slice(o+1)},Ve=e=>we({fromLocale:"sv",toLocale:S})({fieldName:"condition",value:e}),We={Nytt:{headline:"field.condition.info.Nytt.headline",body:"field.condition.info.Nytt.body"},"Mycket bra":{headline:"field.condition.info.Mycket bra.headline",body:"field.condition.info.Mycket bra.body"},Bra:{headline:"field.condition.info.Bra.headline",body:"field.condition.info.Bra.body"},Acceptabelt:{headline:"field.condition.info.Acceptabelt.headline",body:"field.condition.info.Acceptabelt.body"},DÃ¥ligt:{headline:"field.condition.info.DÃ¥ligt.headline",body:"field.condition.info.DÃ¥ligt.body"}},Ke=p.div` 33 display: flex; 34 justify-content: space-between; 35 ${h.tablet} { 36 flex-direction: column-reverse; 37 } 38`,Ye=p(k)` 39 margin: 16px 0; 40 ${h.largerThanTablet} { 41 width: 50%; 42 } 43`,Je=({currentCondition:e,required:o})=>{const{t}=I("item"),{register:a,control:r}=R(),i=P({control:r,name:"customerMotivations.selectedCondition"}),s=V(e);if(s.length===0)return null;const d=a("customerMotivations.selectedCondition",{validate:c=>!o||!!c||t("reason.error.empty")}),l=We[i];return n.jsxs("div",{style:{marginTop:"16px"},children:[n.jsx(g,{design:"body3",children:t("field.condition.selectPrompt")}),n.jsxs(Ke,{children:[n.jsx("div",{children:s.map(c=>{var b;return _.createElement(ie,y(u({},d),{key:c,labelComponent:n.jsx(Ge,{label:(b=Ve(c))!=null?b:""}),value:c}))})}),l&&n.jsx(Ye,{title:t(l.headline),text:t(l.body)})]})]})},{SALE_REQUEST_MOTIVATION:x}=$e,W=[`customerMotivations.${x.CONDITION}`,`customerMotivations.${x.DESCRIPTION}`,`customerMotivations.${x.PURCHASE_PRICE}`,`customerMotivations.${x.OTHER}`],Ze=W.map(e=>e.split(".")[1]),K="customerMotivations._atLeastOne",Xe=p.div` 44 display: flex; 45 flex-direction: column; 46 gap: 8px; 47 align-items: flex-start; 48`,et=p.div` 49 display: ${({$shouldBeVisible:e})=>e?"block":"none"}; 50 width: 100%; 51 padding-left: 32px; 52 box-sizing: border-box; 53`,tt=p.div` 54 display: flex; 55 gap: 8px; 56 flex-direction: column; 57`,ot=({fieldName:e="",item:o})=>{var v;const{t}=I("item"),{register:a,formState:{errors:r},control:i}=R(),s=e.split(".")[1],d=P({control:i,name:s}),l=o[Ie]||o.localizedMetadata,c=s===x.CONDITION,b=o.metadata.condition;return!e||c&&V(b).length===0?null:n.jsxs(Xe,{children:[n.jsx(fe,{name:s,control:i,rules:{deps:[K]},render:({field:m})=>n.jsx(re,{checked:m.value||!1,onChange:m.onChange,onBlur:m.onBlur,labelComponent:n.jsx(le,{label:t(`field.${s}.checkBoxLabel`,{currentCondition:l.condition})})})}),n.jsxs(et,{$shouldBeVisible:d,children:[s===x.PURCHASE_PRICE?n.jsx(de,u({type:"number",label:t(`field.${s}.description`),errors:r},a(`${e}`,{validate:m=>d&&(!/^\d+$/.test(m)||m.length===0)?t("reason.error.onlyNumbers"):!0}))):n.jsx(ce,y(u({},a(`${e}`,{validate:{tooLong:m=>d&&m.length>300?t("reason.error.300chars"):!0,empty:m=>!(d&&m.length===0)||t("reason.error.empty")}})),{errors:r,label:t(`field.${s}.description`,{currentCondition:l.condition})})),c&&n.jsxs(n.Fragment,{children:[n.jsx(Je,{currentCondition:b,required:d}),((v=r.customerMotivations)==null?void 0:v.selectedCondition)&&n.jsx(g,{design:"body3",color:"red",children:r.customerMotivations.selectedCondition.message})]})]})]})},nt=({item:e})=>{var i;const{t:o}=I("reevaluation"),{register:t,getValues:a,formState:{errors:r}}=R();return n.jsxs(tt,{children:[W.map(s=>n.jsx(ot,{fieldName:s,item:e},s)),n.jsx("input",u({type:"hidden"},t(K,{validate:()=>Ze.some(s=>a(s))||o("reevaluation.request.detailedForm.atLeastOne")}))),((i=r.customerMotivations)==null?void 0:i._atLeastOne)&&n.jsx(g,{design:"body3",color:"red",children:r.customerMotivations._atLeastOne.message})]})},Qt=t=>E(null,[t],function*({request:e,params:o}){return yield ve({url:new URL(e.url)}),je(qe),yield Ce(),Se(Ne,{variables:{itemId:o.itemId,locale:S}}).toPromise()}),at=t=>{var a=t,{ref:e}=a,o=F(a,["ref"]);return n.jsx("div",{ref:e,children:n.jsx($,u({},o))})},it=({triggerRef:e,popoverOpen:o,setPopoverOpen:t})=>{const{t:a}=I("reevaluation"),{control:r}=R();return n.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[n.jsx(_e,{name:"returnIfRejected",label:a("reevaluation.request.unsellable.sellAnyway"),options:[{value:"false",label:a("reevaluation.request.unsellable.donate")},{value:"true",label:a("reevaluation.request.sellAnyway.return")}],control:r}),n.jsx(pe,{body:a("reevaluation.request.sellAnyway.tooltip.body"),direction:"top",type:"subtle",triggerRef:e,isOpen:o,onOpenChange:()=>t(!1),buttonLabel:a("reevaluation.request.unsellable.tooltip.buttonLabel")}),n.jsx(at,{type:"button",ref:e,size:z.SMALL,color:"black",variant:"text",onClick:()=>t(!0),centerIcon:n.jsx(be,{name:w.INFORMATION_CIRCLE})})]})},st=({description:e,condition:o,purchasePrice:t,other:a,customerMotivations:r})=>{if(!e&&!o&&!t&&!a)return null;const i=G[H()];return u(u(u(u({},e&&{description:r.description}),o&&{condition:r.condition,selectedCondition:r.selectedCondition}),t&&{purchasePrice:{amount:Number(r.purchasePrice),currency:i}}),a&&{other:r.other})},rt=()=>{var q,L;const e=U(),{data:o}=Q(e),{item:t}=o||{},{isTablet:a}
57=Re(),r=ge(),{t:i}=I("requestSale"),s=Ae({saleId:t.bag.objectId}),d=ye({defaultValues:{itemId:t.objectId,bagId:t.bag.objectId,returnIfRejected:"false"},mode:"onChange"}),{handleSubmit:l}=d,[c,b]=_.useState(!1),v=_.useRef(null),m={itemId:t.objectId,metadata:t.localizedMetadata,itemStatus:t.itemStatus},[Y,{loading:J}]=Le(Be,{refetchQueries:[{query:Oe,variables:{saleId:t.bag.objectId,locale:S}}],onCompleted:()=>{N({header:i("toast.success.header"),body:i("toast.success.body"),type:B.SUCCESS}),Te({itemId:t.objectId}),r(`/my-item/${t.objectId}`,{replace:!0})},onError:j=>{const f=Fe(j,"itemAlreadyHasActiveSaleRequest");N({header:i(f?"reevaluation:reevaluationRequest.toast.itemAlreadyHasActiveSaleRequest.header":"common:errorToast.header"),body:i(f?"reevaluation:reevaluationRequest.toast.itemAlreadyHasActiveSaleRequest.body":"common:errorToast.body"),type:B.ERROR})}});return(q=o==null?void 0:o.getSaleRequestForItem)!=null&&q.objectId||(L=o==null?void 0:o.getSendBackRequestForItem)!=null&&L.objectId?n.jsx(he,{to:`/my-item/${t.objectId}`,replace:!0}):n.jsxs(n.Fragment,{children:[n.jsx(Ue,{children:n.jsx(ue,{variant:a?"collapsed":"full",options:De({t:i,itemId:t.objectId,saleId:t.bag.objectId,lastCrumbLabelKey:"breadCrumbs.requestSale"})})}),n.jsx(xe,y(u({},d),{children:n.jsx(He,{children:n.jsx(ze,{children:n.jsx("form",{onSubmit:l(j=>E(null,null,function*(){const f=y(u({},j),{customerMotivations:st(j)}),{itemId:Z,motivation:X}=f,T=f.returnIfRejected==="true",ee={itemId:Z,saleId:t.bag.objectId,returnIfRejected:T,motivation:X,clickSource:"seller_pdp",itemData:m};Ee(ee),yield Y({variables:y(u({},f),{returnIfRejected:T,locale:S,skipPayment:!0})})})),children:n.jsxs(Qe,{children:[n.jsxs("div",{children:[n.jsx(me,{children:i("requestSale.title")}),n.jsx(g,{design:"body3",children:i("requestSale.description")})]}),n.jsx(k,{variant:"subtle",type:"informative",iconName:w.LIGHTBULB,text:i("requestSale.infoBox",{adFee:(s==null?void 0:s.adFee)&&Pe({amount:s==null?void 0:s.adFee,currency:G[H()]})}),fullWidth:!0}),n.jsxs("div",{children:[n.jsx(g,{design:"body3",children:i("requestSale.chooseReason")}),n.jsx(nt,{item:t})]}),n.jsx(it,{triggerRef:v,popoverOpen:c,setPopoverOpen:b}),n.jsx($,{size:z.SMALL,loading:J,label:i("requestSale.submit"),fullWidth:!0,type:"submit"})]})})})})}))]})},Gt=()=>{const e=U(),{data:o}=Q(e);return o!=null&&o.item?n.jsx(rt,{}):n.jsx(Me,{})};export{Gt as default,Qt as requestSaleLoader}; 58//# sourceMappingURL=RequestSale.1164DoBz.bundle.js.map
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.