PageSourceSearch

https://www.graodireto.com.br/_next/static/chunks/pages/web-app/ma…/purchase-offers/create-d6779dd597e054ac.js

js graodireto.com.br collected 2026-09-24 10:16:08 UTC 13,416 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5405],{39311:(e,a,i)=>{"use strict";i.r(a),i.d(a,{__N_SSP:()=>ea,default:()=>ei});var n=i(23798),t=i(92191),r=i(12954),s=i(91755),o=i(37642),d=i(2531),l=i(64106),c=i(83440),u=i(24296),m=i(78722),p=i(76159),h=i(76460),y=i(89509),f=i(14948),x=i(532),g=i(64004),I=i(5303),j=i(73586),P=i(12030),E=i(21462);function C(e){let{userCityId:a}=e,[i,t]=(0,E.useState)(""),{getValues:r,trigger:s}=(0,x.xW)(),{setEventOccurrence:o}=(0,m.X)(),{setPreviousStep:l}=(0,u.sd)(),{data:c}=(0,d.lh)({name:i}),h=async()=>{let e=await s("city");o(p.F.PurchasePMCEditCity,{cityId:r("city.id")}),e&&l()},y=async e=>{"Enter"===e.key&&(e.preventDefault(),await h())};return(0,E.useEffect)(()=>{o(p.F.PurchaseReducedCity)},[o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j.a,{children:[(0,n.jsx)(j.a.Title,{children:"Cidade"}),(0,n.jsx)(j.a.Subheading,{children:"Selecione a cidade"})]}),(0,n.jsx)(P.j,{name:"city",placeholder:"Cidade",listLikeButton:!0,onChange:t,onKeyDown:y,trigger:h,options:(null!=c?c:[]).map(e=>({id:e.id,label:"".concat(e.name," - ").concat(e.state),value:{id:e.id,region:{id:e.region.id,name:e.region.name}},tag:"".concat(e.id===a?"Minha cidade":""),suggestion:e.id===a}))})]})}var T=i(76800),b=i(32607),N=i(6247);function D(){let{setValue:e,trigger:a}=(0,x.xW)(),{setEventOccurrence:i}=(0,m.X)(),{setNextStep:t}=(0,u.sd)(),r=async n=>{let r=await a("freightTypeId");i(p.F.PurchaseReducedSelectFreight,{freightTypeId:n}),r&&(n!==b.Ph.NEGOTIABLE&&e("priceReferenceIsFob",n===b.Ph.FOB),t())};return(0,E.useEffect)(()=>{e("freightTypeId",null),e("priceReferenceIsFob",null)},[e]),(0,E.useEffect)(()=>{i(p.F.PurchaseReducedFreight)},[i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j.a,{children:[(0,n.jsx)(j.a.Title,{children:"Frete"}),(0,n.jsx)(j.a.Subheading,{children:"Informe a modalidade de frete."})]}),(0,n.jsx)(N.Y,{name:"freightTypeId",options:T.ib,onChange:r,grid:!0})]})}var F=i(92121),w=i(54492);function M(){let{getValues:e,trigger:a}=(0,x.xW)(),{setEventOccurrence:i}=(0,m.X)(),{setNextStep:t}=(0,u.sd)(),r=async()=>{let n=await a("minQuantity");i(p.F.PurchaseReducedInsertQuantity,{minQuantity:e("minQuantity")}),n&&t()},s=async e=>{"Enter"===e.key&&(e.preventDefault(),await r())};return(0,E.useEffect)(()=>{i(p.F.PurchaseReducedQuantity)},[i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j.a,{children:[(0,n.jsx)(j.a.Title,{children:"Quantidade"}),(0,n.jsx)(j.a.Subheading,{children:"Informe a quantidade m\xednima de negocia\xe7\xe3o."})]}),(0,n.jsxs)(w.p.Field,{children:[(0,n.jsx)(w.p.Entry,{name:"minQuantity",placeholder:"Quantidade m\xednima",inputMode:"numeric",mask:[{mask:Number,scale:0,thousandsSeparator:"."}],maxLength:8,onKeyDown:s}),(0,n.jsx)(w.p.Errors,{field:"minQuantity"})]}),(0,n.jsx)(F.$,{fill:!0,size:"sm",type:"button",onClick:r,className:"max-md:mt-auto",children:"Pr\xf3ximo"})]})}var _=i(64648),v=i(14804),A=i(6648),S=i(10210),R=i(47835),k=i(21299),Y=function(e){return e.MODALITY="MODALITY",e.CITY="CITY",e.MIN_QUANTITY="MIN_QUANTITY",e.FREIGHT_TYPE="FREIGHT_TYPE",e.PAYMENT_CONDITION="PAYMENT_CONDITION",e.PAYMENT_DEADLINE="PAYMENT_DEADLINE",e.PRICE="PRICE",e.DOCUMENT="DOCUMENT",e}({});function O(e){let{enabledProducts:a}=e,[i,t]=(0,E.useState)(!1),{setValue:r,watch:s}=(0,x.xW)(),{setEventOccurrence:o}=(0,m.X)(),{setStepByKey:d}=(0,u.sd)(),l=(0,k.useSearchParams)(),c=s("city");return(0,E.useEffect)(()=>{r("modality",null),r("futureModalityDate",null),r("minQuantity",""),r("price","")},[r]),(0,E.useEffect)(()=>{(null==l?void 0:l.get("source"))===S.X.WHATSAPP&&o(p.F.WppPurchasePMC),o(p.F.PurchasePMC)},[l,o]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.a,{children:(0,n.jsx)(j.a.Subheading,{children:"Procurar ofertas em:"})}),(0,n.jsx)(F.$,{size:"sm",intent:"secondary",leftIcon:R.A,onClick:()=>{d(Y.CITY)},children:c.label}),(0,n.jsx)("h2",{className:"mt-4 text-mobile-subheading-2 font-semibold",children:"Qual gr\xe3o voc\xea quer comprar?"}),(0,n.jsx)(v.i,{enabledProducts:a,offerType:"purchase",onSelectModality:(e,a,i)=>{let{transactionTypeId:n,isFuture:s}=e;r("modality",{isFuture:s,productId:a,productName:i,transactionTypeId:n}),o(p.F.PurchasePMCSelectModality,{transactionTypeId:n,cityId:c.id}),s?t(!0):d(Y.MIN_QUANTITY)}}),(0,n.jsx)(_.w,{offerType:A.p.PURCHASE,open:i,onClose:()=>t(!1),onSelect:()=>d(Y.MIN_QUANTITY)})]})}function Q(e){let{paymentConditions:a}=e,{setValue:i,trigger:t}=(0,x.xW)(),{setEventOccurrence:r}=(0,m.X)(),{setStepByKey:s}=(0,u.sd)(),o=a.map(L),d=async e=>{let a=await t("paymentConditionId");r(p.F.PurchaseReducedSelectPayment,{paymentConditionId:e}),a&&(e===b.Gn.WITH_DEADLINE?s(Y.PAYMENT_DEADLINE):s(Y.PRICE))};return(0,E.useEffect)(()=>{i("paymentConditionId",null),i("paymentDeadline","")},[i]),(0,E.useEffect)(()=>{r(p.F.PurchaseReducedPayment)},[r]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.a,{children:"Forma de pagamento"}),(0,n.jsx)(N.Y,{name:"paymentConditionId",options:o,onChange:d,grid:!0})]})}function L(e){return{id:e.id,label:{title:e.description},value:e.id}}function W(){let{getValues:e,trigger:a}=(0,x.xW)(),{setEventOccurrence:i}=(0,m.X)(),{setNextStep:t}=(0,u.sd)(),r=async()=>{let n=await a(["paymentConditionId","paymentDeadline"]);i(p.F.PurchaseReducedInsertDeferredPayment,{paymentDeadline:e("paymentDeadline")}),n&&t()},s=async e=>{"Enter"===e.key&&(e.preventDefault(),await r())};return(0,E.useEffect)(()=>{i(p.F.PurchaseReducedDeferredPayment)},[i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j.a,{children:[(0,n.jsx)(j.a.Title,{children:"Prazo"}),(0,n.jsx)(j.a.Subheading,{children:"Informe o prazo de pagamento"})]}),(0,n.jsxs)(w.p.Field,{children:[(0,n.jsx)(w.p.Entry,{inputMode:"numeric",mask:[{mask:Number,scale:0}],name:"paymentDeadline",placeholder:"N\xfamero de dias",onKeyDown:s,maxLength:3}),(0,n.jsx)(w.p.Errors,{field:"paymentDeadline"})]}),(0,n.jsx)(F.$,{size:"sm",type:"button",onClick:r,className:"max-md:mt-auto",children:"Pr\xf3ximo"})]})}var X=i(39863),z=i(88661),U=i(29032);function H(e){var a,i;let{isLoading:t,quotationsData:r,userHasDocument:s}=e,{getValues:o,trigger:d}=(0,x.xW)(),{setEventOccurrence:l}=(0,m.X)(),{setNextStep:c}=(0,u.sd)(),{city:h,freightTypeId:y,modality:f}=o(),g=()=>l(p.F.PurchaseReducedInsertPrice,{price:o("price")}),I=async()=>{let e=await d("price");g(),e&&c()},P=async e=>{"Enter"!==e.key||s||(e.preventDefault(),await I())};return(0,E.useEffect)(()=>
1{l(p.F.PurchaseReducedPrice)},[l]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(j.a,{children:[(0,n.jsx)(j.a.Title,{children:"Pre\xe7o"}),(0,n.jsx)(j.a.Subheading,{children:"Informe o pre\xe7o inicial por saca."})]}),(0,n.jsxs)(w.p.Field,{children:[(0,n.jsx)(w.p.Entry,{name:"price",placeholder:"Pre\xe7o inicial por saca",inputMode:"decimal",mask:[{mask:"R$ num",blocks:{num:{mask:Number,thousandsSeparator:".",radix:",",scale:2,mapToRadix:[",","."]}},lazy:!0,placeholderChar:"0",autofix:!0,prefix:"R$ "}],onKeyDown:P}),(0,n.jsx)(w.p.Errors,{field:"price"})]}),y===b.Ph.NEGOTIABLE&&(0,n.jsx)(N.Y,{name:"priceReferenceIsFob",options:T.qC,horizontal:!0,compactMode:!0,optionClassName:"flex h-12 items-center bg-white px-4 shadow-gd-medium outline-2 outline-primary-600"}),(null==f?void 0:f.productName)&&(null==h||null==(i=h.value)||null==(a=i.region)?void 0:a.name)&&r&&(0,n.jsx)(X.k,{productName:f.productName,regionName:h.value.region.name,quotationsData:r}),(0,n.jsxs)("div",{className:"flex flex-col gap-6 max-md:mt-auto",children:[(0,n.jsx)(z.J,{}),s?(0,n.jsx)(F.$,{fill:!0,size:"sm",type:"submit",disabled:t,onClick:g,children:t?(0,n.jsx)(U.A,{color:"gray"}):"Negociar"}):(0,n.jsx)(F.$,{fill:!0,size:"sm",type:"button",onClick:I,children:"Pr\xf3ximo"})]})]})}var q=i(77109),B=i(42488);let G=B.Ik({modality:B.Ik({isFuture:B.zM(),productId:B.ai(),productName:B.Yj(),transactionTypeId:B.ai()}).nullable().refine(e=>null!==e,{message:"\xc9 obrigat\xf3rio selecionar uma modalidade"}),minQuantity:B.Yj().transform(e=>Number(e.replace(/\./g,""))).refine(e=>e>=200,{message:"Quantidade m\xednima: 200 sacas"}),city:B.Ik({id:B.ai(),label:B.Yj(),value:B.Ik({region:B.Ik({id:B.ai(),name:B.Yj()})})},{errorMap:()=>({message:"\xc9 obrigat\xf3rio selecionar uma cidade"})}),price:B.Yj().transform(e=>Number(e.replace("R$","").trim().replace(/\./g,"").replace(",","."))).refine(e=>e>0,{message:"\xc9 obrigat\xf3rio informar um pre\xe7o"}),futureModalityDate:B.p6().nullable(),freightTypeId:B.fc(b.Ph).nullable().refine(e=>null!==e,{message:"\xc9 obrigat\xf3rio selecionar uma modalidade de frete"}),priceReferenceIsFob:B.zM().nullable().refine(e=>null!==e,{message:"\xc9 obrigat\xf3rio selecionar uma modalidade de frete"}),paymentConditionId:B.fc(b.Gn).nullable().refine(e=>null!==e,{message:"\xc9 obrigat\xf3rio selecionar uma forma de pagamento"}),paymentDeadline:B.Yj().nullable().transform(e=>e?Number(e):null),document:B.Yj().regex(/([0-9]{3}[\.]?[0-9]{3}[\.]?[0-9]{3}[-]?[0-9]{2})/,"Insira um CPF v\xe1lido").length(14,"Insira um CPF v\xe1lido").refine(e=>q.A.isValid(e),{message:"Insira um CPF v\xe1lido"}).optional()}).refine(e=>{var a;return null==(a=e.modality)||!a.isFuture||null!==e.futureModalityDate},{path:["futureModalityDate"],message:"\xc9 obrigat\xf3rio informar a data da modalidade futura"}).refine(e=>e.paymentConditionId!==b.Gn.WITH_DEADLINE||null!==e.paymentDeadline&&e.paymentDeadline>0,{path:["paymentDeadline"],message:"\xc9 obrigat\xf3rio informar um prazo de pagamento"});function $(e){let{enabledProducts:a,paymentConditions:i,hasActivePurchaseOffer:t,userProfile:j}=e,{step:P,setPreviousStep:E}=(0,u.sd)(),{setEventOccurrence:T}=(0,m.X)(),b=(0,f.useRouter)(),N=(0,x.mN)({resolver:(0,y.u)(G),defaultValues:{modality:null,city:{id:j.city.id,label:"".concat(j.city.name," - ").concat(j.city.state),value:{region:{id:j.city.region.id,name:j.city.region.name}}},futureModalityDate:null,minQuantity:"",freightTypeId:null,paymentConditionId:null,paymentDeadline:"",price:"",priceReferenceIsFob:null}}),[F,w]=N.watch(["city.value.region.id","modality.transactionTypeId"]),{quotationsData:_}=(0,o.B)({regionId:F,transactionTypeId:w}),{mutateAsync:v,isLoading:A}=(0,l.JV)(),{mutateAsync:S,isLoading:R}=(0,d.H6)(),k=(0,h.Z)(j),L=async()=>{let e="gd-vip"===b.query.from;return P===Y.MODALITY?e?b.push("/web-app/gd-vip?activePanel=".concat(s.w.OFFERS,"&activeTab=quero-comprar")):t?b.push("/web-app/marketplace/purchase-offers"):b.push("/web-app"):P!==Y.CITY||await N.trigger("city")?E():void 0},X=async e=>{try{e.document&&await S(e.document);let a={productId:e.modality.productId,transactionTypeId:e.modality.transactionTypeId,freightType:e.freightTypeId,minQuantity:e.minQuantity,cityId:e.city.id,price:e.price,paymentConditions:e.paymentConditionId,paymentDeadline:e.paymentDeadline,futureModalityDate:e.futureModalityDate,priceReferenceIsFob:e.priceReferenceIsFob},i=await v(a);i&&b.push("/web-app/marketplace/purchase-matchmaking/".concat(i.id))}catch(e){g.Ay.error("Erro ao criar oferta de compra!",{id:"create-purchase-offer-error"}),t?b.push("/web-app/marketplace/purchase-offers"):b.push("/web-app")}},z=R||A;return(0,n.jsxs)(x.Op,{...N,children:[(0,n.jsx)(I.r,{titlePage:"Quero comprar",backAction:L}),(0,n.jsxs)("form",{onSubmit:N.handleSubmit(X),className:"flex w-full max-w-3xl grow flex-col gap-4 self-center p-6",children:[(0,n.jsx)(c.C.Step,{step:Y.MODALITY,children:(0,n.jsx)(O,{enabledProducts:a})}),(0,n.jsx)(c.C.Step,{step:Y.CITY,children:(0,n.jsx)(C,{userCityId:j.city.id})}),(0,n.jsx)(c.C.Step,{step:Y.MIN_QUANTITY,children:(0,n.jsx)(M,{})}),(0,n.jsx)(c.C.Step,{step:Y.FREIGHT_TYPE,children:(0,n.jsx)(D,{})}),(0,n.jsx)(c.C.Step,{step:Y.PAYMENT_CONDITION,children:(0,n.jsx)(Q,{paymentConditions:i})}),(0,n.jsx)(c.C.Step,{step:Y.PAYMENT_DEADLINE,children:(0,n.jsx)(W,{})}),(0,n.jsx)(c.C.Step,{step:Y.PRICE,children:(0,n.jsx)(H,{isLoading:z,quotationsData:_,userHasDocument:k})}),(0,n.jsx)(c.C.Step,{step:Y.DOCUMENT,children:(0,n.jsx)(r.d.Form,{isLoading:z,handleSubmitButtonClick:()=>{T(p.F.PurchaseReducedSubmitCpf)},pageViewEvent:p.F.PurchaseReducedCpf})})]})]})}var J=i(41074),K=i(80055),V=i(54741),Z=i(95975),ee=i.n(Z),ea=!0;function ei(e){let{offers:a,isFromGdVip:i,userProfile:r}=e,[s,o]=(0,E.useState)(i),{setEventOccurrence:d}=(0,m.X)(),{getRemoteConfigObject:l}=(0,J.Cm)(),c=(0,V.O)(),h=(0,f.useRouter)(),y=l(K.ai.WEB_APP_REDUCED_JOURNEY_ENABLED_PRODUCTS),x=l("app_new_purchase_payment_method_options"),g=r.admin?y:null==y?void 0:y.filter(e=>!e.onlyAdmin),I=void 0!==g&&void 0!==x;return(0,E.useEffect)(()=>{h.query.source===S.X.WHATSAPP&&d(p.F.WppBuyerJourneyCity),c("graodiretoapp://www.graodireto.com.br/home/load-purchase",()=>{})},[c,h.query.source,d]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(ee(),{children:[(0,n.jsx)("title",{children:"Gr\xe3o Direto | Pre\xe7os m\xe9dios, cota\xe7\xf5es, compra e venda de Milho, Soja, Sorgo e outros gr\xe3os!"}),(0,n.jsx)("link",{rel:"shortcut icon",type:"image/x-icon",href:"/assets/favicon.ico"})]}),I?(0,n.jsxs)(u.Pm,{steps:Y,children:[(0,n.jsx)($,{enabledProducts:g,paymentConditions:x,hasActivePurchaseOffer:a.length>0,userProfile:r}),(0,n.jsx)(t.I,{isOpen:s,toggleIsModalOpen:()=>o(!s),offerTypeToSee:"sale"})]}):(0,n.jsx)(U.A,{containerClassName:"grow"})]})}},54449:(e,a,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/web-app/marketplace/purchase-offers/create",function(){return i(39311)}])}},e=>{e.O(0,[4343,2064,532,4690,4478,1100,9323,1299,4350,2576,9145,7214,6299,5303,1725,8545,5963,86,1671,636,6593,8792],()=>e(e.s=54449)),_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.