PageSourceSearch

https://app.stoqui.com.br/assets/CheckoutSettingsPage-nHTlb2gV.js

js stoqui.com.br collected 2026-09-24 11:58:49 UTC 23,548 bytes, 1 lines download raw bytes

1import{j as e,ab as h,T as l,S as je,N as ye,a7 as x,a9 as A,aa as U,F as R,aB as D,n as O,ar as ne,ac as te,ae as q,am as N,q as V,ad as ve,aN as Pe,aO as se,a6 as Ie}from"./mui-CRsYZxVY.js";import{aK as Y,u as ce,m as Ce,w as k,bc as _e,C as Te,F as we,D as j,bN as ae,Q as W,y as M,bx as L,by as I,z as Fe,ds as re,cg as Ee,T as Ve}from"./index-TALscxEc.js";import{r as $,b as ie}from"./vendor-Dwao9eNC.js";import{M as B,a as K,b as Me}from"./installmentLimits-BZg-h5D7.js";import{O as Se,t as G,ax as Re}from"./icons-D8aatgQ4.js";import{a as De,b as Oe,u as qe}from"./query-8ViTdhdk.js";import{r as Ne,a as oe}from"./resolveEffectiveProviders-CiAyVzdl.js";import{m as We}from"./mercado-pago-color-B_n0DTpx.js";import{L as Le}from"./lab-DSem1Osk.js";import{u as ke}from"./usePaymentConfig-wna7msVS.js";import{u as $e}from"./useAsaasDirectStatus-Dsf5IQ01.js";import{u as Be}from"./useMercadoPagoAccount-B4jrpfm_.js";import{u as ze}from"./usePixKeys-CKz2VBnr.js";import"./datePickers-BIJXYOKG.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="4d21155e-9020-45e0-9a9a-d374c9e32b39",n._sentryDebugIdIdentifier="sentry-dbid-4d21155e-9020-45e0-9a9a-d374c9e32b39")})()}catch{}function Ae({isSaved:n}){const t=$.useRef(!1),[r,u]=$.useState(null);$.useEffect(()=>{!n||t.current||(t.current=!0,Y.get("/mercadopago/installment-config").then(({data:m})=>{m.maxInstallments&&u(m)}).catch(()=>{}))},[n]);const d=r?Math.min(r.maxInstallments,B):0,p=r?Math.min(r.interestFreeInstallments,d):0,c=!!r&&r.maxInstallments>B;return e.jsxs(h,{spacing:2.5,sx:{pt:1,borderTop:"1px solid",borderColor:"divider"},children:[r&&e.jsxs(e.Fragment,{children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(l,{variant:"body2",color:"text.secondary",children:"Parcelamento:"}),e.jsxs(l,{variant:"body2",fontWeight:600,children:["até ",d,"x (com juros)"]})]}),p>1&&e.jsxs(h,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(l,{variant:"body2",color:"text.secondary",children:"Sem juros:"}),e.jsx(je,{label:`até ${p}x sem juros`,size:"small",color:"success",variant:"outlined"})]})]}),c&&e.jsxs(l,{variant:"body2",color:"text.secondary",children:["O Mercado Pago aceita até ",r.maxInstallments,"x, mas o Stoqui exibe no máximo ",B,"x."]}),e.jsx(l,{variant:"body2",color:"text.secondary",children:"As configurações de parcelamento e juros são gerenciadas diretamente na sua conta do Mercado Pago."}),e.jsx(ye,{size:"small",variant:"contained",endIcon:e.jsx(Se,{sx:{fontSize:16}}),href:"https://www.mercadopago.com.br/costs-section/merchant-svcs/financing/psj/installments",target:"_blank",rel:"noopener noreferrer",sx:{textTransform:"none",bgcolor:"#009EE3","&:hover":{bgcolor:"#007EB5"},alignSelf:"flex-start"},children:"Configurar no Mercado Pago"})]})}const Ue=(n,t)=>({user_id:t,cartao_credito_habilitado:n.creditCard.enabled,parcelamento_habilitado:n.installments.enabled,parcelamento_max_parcelas:n.installments.maxInstallments,parcelamento_sem_juros_habilitado:n.installments.interestFreeEnabled,parcelamento_sem_juros_max_parcelas:n.installments.interestFreeInstallments,parcelamento_valor_minimo_parcela:n.installments.minInstallmentValue,parcelamento_taxa_juros_mensal:n.installments.monthlyInterestRate,pix_desconto_habilitado:n.pixDiscount.enabled,pix_desconto_tipo:n.pixDiscount.type,pix_desconto_valor:n.pixDiscount.value,pix_desconto_valor_minimo_compra:n.pixDiscount.minPurchaseValue,provedor_pix:n.providerPreferences.pixProvider,provedor_cartao_credito:n.providerPreferences.creditCardProvider,chave_pix_checkout_id:n.providerPreferences.chavePixCheckoutId}),Ke=()=>{const{user:n}=ce(),t=De(),{triggerRevalidation:r}=Ce();return Oe({mutationFn:async u=>{if(!(n!=null&&n.id))throw new Error("User not authenticated");const d=Ue(u,n.id),{data:p}=await k.from("configuracao_pagamento").select("id").eq("user_id",n.id).single();let c;if(p?c=await k.from("configuracao_pagamento").update(d).eq("user_id",n.id).select().single():c=await k.from("configuracao_pagamento").insert(d).select().single(),c.error)throw c.error;return u},onSuccess:()=>{t.invalidateQueries({queryKey:["payment-config"]}),r()},onError:u=>{console.error("Error saving payment config:",u)}})},Qe=()=>qe({queryKey:["account-fees"],staleTime:10*60*60*1e3,queryFn:()=>Y.get("/stoqui-pay/conta/fees").then(n=>n.data)}),Q=200;function Ge(n,t,r,u=!0){const{creditCard:d}=t.payment,{anticipation:p}=t;let c=d.oneInstallmentPercentage,m=p.creditCard.detachedMonthlyFeeValue;r.installments.enabled&&r.installments.interestFreeEnabled&&(r.installments.interestFreeInstallments<=6?c=Math.max(c,d.upToSixInstallmentsPercentage):r.installments.interestFreeInstallments<=12?(c=Math.max(c,d.upToTwelveInstallmentsPercentage),m=p.creditCard.installmentMonthlyFeeValue):(c=Math.max(c,d.upToTwentyOneInstallmentsPercentage),m=p.creditCard.installmentMonthlyFeeValue));const y=n*c/100+d.operationValue;let v=0;if(u){const f=m/100;if(r.installments.enabled&&r.installments.interestFreeEnabled){const b=r.installments.interestFreeInstallments,C=n/b;for(let _=1;_<=b;_++){const o=_,T=C*f*o;v+=T}}else{const b=d.daysToReceive/30;v=n*f*b}}return y+v}function He(n,t){const{pix:r}=t.payment;return r.fixedFeeValue||0}function Xe(n,t){const r=He(Q,n);let p=(Ge(Q,n,t,!0)-r)/Q*100,c="";if(!t.installments.enabled)p*=1,c="Para incentivar pagamentos via Pix, um desconto moderado é suficie
1nte. O Pix oferece recebimento imediato e elimina o risco de inadimplência.";else if(t.installments.interestFreeEnabled){const y=t.installments.interestFreeInstallments;y>=10?(p*=1,c=`Para incentivar Pix competindo com ${y}x sem juros, recomenda-se desconto maior. O Pix garante recebimento imediato e sem risco de inadimplência.`):y>=6?(p*=.9,c=`Para incentivar Pix frente ao ${y}x sem juros, um desconto competitivo é recomendado. O Pix garante recebimento imediato e sem risco de inadimplência.`):(p*=.9,c=`Para incentivar Pix mesmo com ${y}x sem juros disponível, um desconto moderado é adequado. O Pix garante recebimento imediato e sem risco de inadimplência.`)}else p*=1,c="Para incentivar Pix frente ao cartão de crédito, um desconto moderado é atrativo. O Pix garante recebimento imediato e sem risco de inadimplência.";return{suggestedPercentage:Math.max(3,Math.min(15,Math.round(p))),reasoning:c}}function Ye(n){return`${n}%`}function Je(n){const{data:t,isLoading:r,error:u}=Qe();return{suggestion:$.useMemo(()=>{if(!(t!=null&&t.fees)||r||u)return null;const p={payment:{pix:{fixedFeeValue:t.fees.payment.pix.fixedFeeValue,fixedFeeValueWithDiscount:t.fees.payment.pix.fixedFeeValueWithDiscount},creditCard:{operationValue:t.fees.payment.creditCard.operationValue,oneInstallmentPercentage:t.fees.payment.creditCard.oneInstallmentPercentage,upToSixInstallmentsPercentage:t.fees.payment.creditCard.upToSixInstallmentsPercentage,upToTwelveInstallmentsPercentage:t.fees.payment.creditCard.upToTwelveInstallmentsPercentage,upToTwentyOneInstallmentsPercentage:t.fees.payment.creditCard.upToTwentyOneInstallmentsPercentage,discountOneInstallmentPercentage:t.fees.payment.creditCard.discountOneInstallmentPercentage,discountUpToSixInstallmentsPercentage:t.fees.payment.creditCard.discountUpToSixInstallmentsPercentage,discountUpToTwelveInstallmentsPercentage:t.fees.payment.creditCard.discountUpToTwelveInstallmentsPercentage,discountUpToTwentyOneInstallmentsPercentage:t.fees.payment.creditCard.discountUpToTwentyOneInstallmentsPercentage,daysToReceive:t.fees.payment.creditCard.daysToReceive}},anticipation:{creditCard:{detachedMonthlyFeeValue:t.fees.anticipation.creditCard.detachedMonthlyFeeValue,installmentMonthlyFeeValue:t.fees.anticipation.creditCard.installmentMonthlyFeeValue}}};return Xe(p,n)},[t,n,r,u]),isLoading:r,error:u}}const Ze=M({creditCard:M({enabled:L().required()}),installments:M({enabled:L().required(),maxInstallments:I().min(2).max(12).required(),interestFreeEnabled:L().required(),interestFreeInstallments:I().min(2).max(12).required(),minInstallmentValue:I().transform((n,t)=>t===""||t===null||t===void 0?void 0:n).when(["enabled","$creditCard.enabled"],{is:(n,t)=>t&&n,then:n=>n.min(10,"Valor mínimo deve ser pelo menos R$ 10,00").required("Valor mínimo da parcela é obrigatório"),otherwise:n=>n.optional()}),monthlyInterestRate:I().transform((n,t)=>t===""||t===null||t===void 0?void 0:n).when(["enabled","$creditCard.enabled"],{is:(n,t)=>t&&n,then:n=>n.min(.01,"Taxa deve ser maior que 0%").max(5,"Taxa deve ser menor que 5%").required("Taxa de juros é obrigatória"),otherwise:n=>n.optional()})}),pixDiscount:M({enabled:L().required(),type:Fe().oneOf(["percentage","fixed"]).required(),value:I().transform((n,t)=>t===""||t===null||t===void 0?void 0:n).when(["type","enabled"],{is:(n,t)=>t,then:n=>n.when("type",{is:"percentage",then:t=>t.min(0,"Desconto não pode ser negativo").max(99,"Desconto não pode ser maior que 99%").required("Valor do desconto é obrigatório"),otherwise:t=>t.min(0,"Desconto não pode ser negativo").required("Valor do desconto é obrigatório")}),otherwise:n=>n.optional()}),minPurchaseValue:I().transform((n,t)=>t===""||t===null||t===void 0?void 0:n).when("enabled",{is:!0,then:n=>n.min(0,"Valor mínimo não pode ser negativo").max(1e7,"Valor mínimo não pode ser maior que R$ 10.000.000,00").required("Valor mínimo da compra é obrigatório"),otherwise:n=>n.optional()})}),providerPreferences:M({pixProvider:re().nullable(),creditCardProvider:re().nullable(),chavePixCheckoutId:I().nullable()})}),H={asaas:e.jsx("img",{src:Ee,alt:"Asaas",style:{width:20,height:20,objectFit:"contain"}}),mercadopago:e.jsx("img",{src:We,alt:"Mercado Pago",style:{width:20,height:20,objectFit:"contain"}}),pix:e.jsx(G,{sx:{fontSize:20,color:"#32BCAD"}}
1)},X={asaas:"Asaas",mercadopago:"Mercado Pago",pix:"Chave Pix"};function le({provider:n}){return e.jsxs(h,{direction:"row",alignItems:"center",spacing:1.5,children:[e.jsx(x,{sx:{width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:H[n]}),e.jsx(l,{variant:"body1",children:X[n]})]})}function en({configData:n,providerAvailability:t}){const{user:r}=ce(),u=Ke(),{isDesktop:d,drawerWidth:p}=_e(),c=ie.useMemo(()=>({...n,installments:{...n.installments,monthlyInterestRate:String(n.installments.monthlyInterestRate),minInstallmentValue:String(n.installments.minInstallmentValue)},pixDiscount:{...n.pixDiscount,value:String(n.pixDiscount.value),minPurchaseValue:String(n.pixDiscount.minPurchaseValue)}}),[n]),{control:m,watch:y,handleSubmit:v,setValue:f,formState:{errors:b,isDirty:C,isSubmitting:_}}=Te({resolver:we(Ze),defaultValues:c,context:{creditCard:{enabled:n.creditCard.enabled}}}),o=y(),{suggestion:T}=Je(o),de=async s=>{const a=s.providerPreferences.pixProvider==="pix"&&!s.providerPreferences.chavePixCheckoutId&&(t==null?void 0:t.firstPixKeyId),i={...s,pixDiscount:{...s.pixDiscount,value:s.pixDiscount.enabled&&s.pixDiscount.value||0,minPurchaseValue:s.pixDiscount.enabled&&s.pixDiscount.minPurchaseValue||0},installments:{...s.installments,enabled:s.creditCard.enabled?s.installments.enabled:!1,minInstallmentValue:s.creditCard.enabled&&s.installments.enabled?Math.max(s.installments.minInstallmentValue||10,10):10,monthlyInterestRate:s.creditCard.enabled&&s.installments.enabled&&s.installments.monthlyInterestRate||2.5},providerPreferences:{...s.providerPreferences,...a&&{chavePixCheckoutId:t.firstPixKeyId}}};await u.mutateAsync(i)},me=!!t,w=t==null?void 0:t.asaasEnabled,F=t==null?void 0:t.mpConnected,J=t==null?void 0:t.hasPixKeys,ue=[{value:"asaas",disabled:!w,disabledLabel:"Não conectado"},{value:"mercadopago",disabled:!F,disabledLabel:"Não conectado"},{value:"pix",disabled:!J,disabledLabel:"Não configurado"}],xe=[{value:"asaas",disabled:!w,disabledLabel:"Não conectado"},{value:"mercadopago",disabled:!F,disabledLabel:"Não conectado"}],pe=Ne(o.providerPreferences,{asaasEnabled:!!w,mpConnected:!!F,hasPixKeys:!!J}),Z=oe(o.providerPreferences,{asaasEnabled:!!w,mpConnected:!!F}),he=Z==="mercadopago",z=oe(n.providerPreferences,{asaasEnabled:!!w,mpConnected:!!F})==="mercadopago";ie.useEffect(()=>{if(!z||C||!(r!=null&&r.id))return;let s=!1;return(async()=>{try{const{data:i}=await Y.get("/mercadopago/installment-config");if(!i.maxInstallments||i.maxInstallments<2||s)return;const g=Math.min(i.maxInstallments,B),P=i.interestFreeInstallments>1?Math.min(i.interestFreeInstallments,g):0,S={parcelamento_habilitado:!0,parcelamento_max_parcelas:g,parcelamento_sem_juros_habilitado:P>1,parcelamento_sem_juros_max_parcelas:P>1?P:2,parcelamento_valor_minimo_parcela:K};i.estimatedMonthlyRate>0&&i.estimatedMonthlyRate<=Me&&(S.parcelamento_taxa_juros_mensal=i.estimatedMonthlyRate);const E=n.installments,be=E.interestFreeEnabled?E.interestFreeInstallments:0;if(!(E.enabled&&E.maxInstallments===g&&be===P&&Number(E.minInstallmentValue)===K)&&!s){const{error:ee}=await k.from("configuracao_pagamento").update(S).eq("user_id",r.id);if(ee){console.error("Error syncing MP installment config:",ee);return}f("installments.enabled",!0),f("installments.maxInstallments",g),f("installments.interestFreeEnabled",P>1),f("installments.interestFreeInstallments",P>1?P:2),f("installments.minInstallmentValue",String(K)),S.parcelamento_taxa_juros_mensal!==void 0&&f("installments.monthlyInterestRate",String(S.parcelamento_taxa_juros_mensal))}}catch(i){console.error("Error syncing MP installment config:",i)}})(),()=>{s=!0}},[z,C]);const ge=s=>{const i=s||pe;return i?e.jsx(le,{provider:i}):e.jsx(l,{color:"text.secondary",children:"Nenhum provedor configurado"})},fe=s=>{if(!o.creditCard.enabled)return e.jsx(l,{color:"text.secondary",children:"Desabilitado"});const i=s||Z;return i?e.jsx(le,{provider:i}):e.jsx(l,{color:"text.secondary",children:"Nenhum provedor configurado"})};return e.jsxs(x,{component:"form",onSubmit:v(de),children:[e.jsxs(h,{spacing:3,children:[me&&e.jsx(A,{children:e.jsx(U,{children:e.jsxs(h,{spacing:3,children:[e.jsxs(x,{children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:1,sx:{mb:1},children:[e.jsx(G,{sx:{fontSize:20,color:"text.secondary"}}),e.jsx(l,{variant:"subtitle2",color:"text.secondary",fontWeight:500,children:"Provedor de checkout com Pix"})]}),e.jsx(j,{name:"providerPreferences.pixProvider",control:m,render:({field:s})=>e.jsx(R,{fullWidth:!0,children:e.jsx(D,{...s,value:s.value??"",onChange:a=>s.onChange(a.target.value||null),displayEmpty:!0,renderValue:ge,children:ue.map(a=>e.jsxs(O,{value:a.value,disabled:a.disabled,children:[e.jsx(ne,{sx:{minWidth:32},children:H[a.value]}),e.jsx(te,{primary:X[a.value],...a.disabled&&{secondary:a.disabledLabel,secondaryTypographyProps:{sx:{fontSize:"0.75rem"}}}})]},a.value))})})})]}),e.jsxs(x,{children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:1,sx:{mb:1},children:[e.jsx(ae,{size:20}),e.jsx(l,{variant:"subtitle2",color:"text.secondary",fontWeight:500,children:"Provedor de checkout com cartão"})]}),e.jsx(j,{name:"providerPreferences.creditCardProvider",control:m,render:({field:s})=>e.jsx(R,{fullWidth:!0,children:e.jsx(D,{...s,value:o.creditCard.enabled?s.value??"":"",onChange:a=>{s.onChange(a.target.value||null),!o.creditCard.enabled&&a.target.value&&f("creditCard.enabled",!0,{shouldDirty:!0})},displayEmpty:!0,renderValue:fe,children:xe.map(a=>e.jsxs(O,{value:a.value,disabled:a.disabled,children:[e.jsx(ne,{sx:{minWidth:32},children:H[a.value]}),e.jsx(te,{primary:X[a.value],...a.disabled&&{secondary:a.disabledLabel,secondaryTypographyProps:{sx:{fontSize:"0.75rem"}}}})]},a.value))})})})]})]})})}),e.jsx(A,{children:e.jsx(U,{children:e.jsxs(h,{spacing:3,children:[e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(x,{sx:{p:1.5,borderRadius:2,bgcolor:o.creditCard.enabled?"#ECFDF5":"grey.100",color:o.creditCard.enabled?"#059669":"text.disabled",display:"flex"},children:e.jsx(ae,{size:24})}),e.jsxs(x,{children:[e.jsx(l,{variant:"h6",fontWeight:600,children:"Cartão de crédito"}),e.jsx(l,{variant:"body2",color:"text.secondary",children:"Permitir pagamento via cartão de crédito"})]})]}),e.jsx(j,{name:"creditCard.enabled",control:m,render:({field:s})=>e.jsx(q,{...s,checked:s.value,color:"primary",size:"medium"})})]}),e.jsx(N,{in:o.creditCard.enabled,children:he?e.jsx(Ae,{isSaved:z}):e.jsxs(h,{spacing:3,children:[e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{pt:1,borderTop:"1px solid",borderColor:"divider"},children:[e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"Parcelamento"}),e.jsx(l,{variant:"body2",color:"text.secondary",children:"Permitir parcelamento no cartão de crédito"})]}),e.jsx(j,{name:"installments.enabled",control:m,render:({field:s})=>e.jsx(q,{...s,checked:s.value,disabled:!o.creditCard.enabled})})]}),e.jsx(N,{in:o.installments.enabled,children:e.jsxs(h,{spacing:3,children:[e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Número máximo de parcelas (com juros)"}),e.jsx(j,{name:"installments.maxInstallments",control:m,render:({field:s})=>e.jsx(R,{fullWidth:!0,children:e.jsx(D,{...s,disabled:!o.installments.enabled,children:Array.from({length:11}
1,(a,i)=>i+2).map(a=>e.jsxs(O,{value:a,children:[a,"x parcelas"]},a))})})})]}),e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Taxa de juros mensal (para repasse ao cliente)"}),e.jsx(j,{name:"installments.monthlyInterestRate",control:m,render:({field:s})=>{var a,i,g;return e.jsx(W,{...s,fullWidth:!0,disabled:!o.installments.enabled,placeholder:"2,49",error:!!((a=b.installments)!=null&&a.monthlyInterestRate),helperText:(g=(i=b.installments)==null?void 0:i.monthlyInterestRate)==null?void 0:g.message,InputProps:{endAdornment:e.jsx(V,{position:"end",children:"%"})}})}})]}),e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle1",fontWeight:600,children:"Oferecer parcelamento sem juros"}),e.jsx(l,{variant:"body2",color:"text.secondary",children:"Você arca com as taxas do parcelamento sem juros"})]}),e.jsx(j,{name:"installments.interestFreeEnabled",control:m,render:({field:s})=>e.jsx(q,{...s,checked:s.value,disabled:!o.installments.enabled})})]}),e.jsx(N,{in:o.installments.interestFreeEnabled&&o.installments.enabled,children:e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Número máximo de parcelas"}),e.jsx(j,{name:"installments.interestFreeInstallments",control:m,render:({field:s})=>e.jsx(R,{fullWidth:!0,children:e.jsx(D,{...s,disabled:!o.installments.interestFreeEnabled,children:Array.from({length:Math.min(o.installments.maxInstallments-1,11)},(a,i)=>i+2).map(a=>e.jsxs(O,{value:a,children:["Até ",a,"x sem juros"]},a))})})})]})}),e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Valor mínimo da parcela"}),e.jsx(j,{name:"installments.minInstallmentValue",control:m,render:({field:s})=>{var a,i,g;return e.jsx(W,{...s,fullWidth:!0,disabled:!o.installments.enabled,placeholder:"10,00",error:!!((a=b.installments)!=null&&a.minInstallmentValue),helperText:(g=(i=b.installments)==null?void 0:i.minInstallmentValue)==null?void 0:g.message,InputProps:{startAdornment:e.jsx(V,{position:"start",children:"R$"})}})}})]})]})})]})})]})})}),e.jsx(A,{children:e.jsx(U,{children:e.jsxs(h,{spacing:3,children:[e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(h,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(x,{sx:{p:1.5,borderRadius:2,bgcolor:o.pixDiscount.enabled?"#ECFDF5":"grey.100",color:o.pixDiscount.enabled?"#059669":"text.disabled",display:"flex"},children:e.jsx(G,{})}),e.jsxs(x,{children:[e.jsx(l,{variant:"h6",fontWeight:600,children:"Desconto Pix"}),e.jsx(l,{variant:"body2",color:"text.secondary",children:"Ofereça desconto para pagamento via Pix"})]})]}),e.jsx(j,{name:"pixDiscount.enabled",control:m,render:({field:s})=>e.jsx(q,{...s,checked:s.value,color:"primary",size:"medium"})})]}),T&&o.pixDiscount.enabled&&e.jsxs(ve,{severity:"info",icon:e.jsx(Re,{}),children:[e.jsx(l,{variant:"body2",gutterBottom:!0,children:e.jsxs("strong",{children:["Nossa sugestão:"," ",Ye(T.suggestedPercentage)]})}),e.jsx(l,{variant:"body2",color:"text.secondary",children:T.reasoning})]}),e.jsx(N,{in:o.pixDiscount.enabled,children:e.jsxs(h,{spacing:3,children:[e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,fontWeight:500,children:"Tipo de desconto"}),e.jsx(j,{name:"pixDiscount.type",control:m,render:({field:s})=>e.jsxs(Pe,{...s,exclusive:!0,fullWidth:!0,color:"primary",size:"small",disabled:!o.pixDiscount.enabled,sx:{"& .MuiToggleButton-root":{textTransform:"none",fontWeight:500,py:1}},children:[e.jsx(se,{value:"percentage",children:"Porcentagem (%)"}),e.jsx(se,{value:"fixed",children:"Valor fixo (R$)"})]})})]}),e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Valor do desconto"}),e.jsx(j,{name:"pixDiscount.value",control:m,render:({field:s})=>{var a,i,g;return e.jsx(W,{...s,error:!!((a=b.pixDiscount)!=null&&a.value),helperText:(g=(i=b.pixDiscount)==null?void 0:i.value)==null?void 0:g.message,disabled:!o.pixDiscount.enabled,fullWidth:!0,InputProps:{...o.pixDiscount.type==="percentage"?{endAdornment:e.jsx(V,{position:"end",children:"%"})}:{startAdornment:e.jsx(V,{position:"start",children:"R$"})}}})}})]}),e.jsxs(x,{children:[e.jsx(l,{variant:"subtitle2",color:"text.secondary",gutterBottom:!0,children:"Valor mínimo da compra"}),e.jsx(j,{name:"pixDiscount.minPurchaseValue",control:m,render:({field:s})=>{var a,i,g;return e.jsx(W,{...s,fullWidth:!0,error:!!((a=b.pixDiscount)!=null&&a.minPurchaseValue),helperText:(g=(i=b.pixDiscount)==null?void 0:i.minPurchaseValue)==null?void 0:g.message,disabled:!o.pixDiscount.enabled,placeholder:"0,00",InputProps:{startAdornment:e.jsx(V,{position:"start",children:"R$"})}})}})]})]})})]})})})]}),e.jsx(x,{sx:{position:"fixed",bottom:0,left:d?`${p}px`:0,right:0,p:2,pb:"calc(1rem + var(--safe-area-inset-bottom, 0px))",bgcolor:"white",borderTop:"1px solid",borderColor:"divider",zIndex:1300},children:e.jsx(Le,{type:"submit",variant:"contained",color:"primary",loading:_||u.isPending,disabled:!C,size:"large",fullWidth:!0,sx:{py:1.5,textTransform:"none",fontWeight:600,fontSize:"1rem"},children:C?"Salvar":"Salvo"})})]})}function fn(){var f;const{data:n,isLoading:t}=ke(),{data:r}=$e(),{data:u}=Be(),{data:d}=ze(),c=(r==null?void 0:r.connected)&&r.status!=="invalido"&&((r==null?void 0:r.habilitado)??!0),m=(u==null?void 0:u.status)==="ativo",y=((d==null?void 0:d.length)??0)>0,v=((f=d==null?void 0:d[0])==null?void 0:f.id)??null;return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Ve,{title:"Configurações do checkout",navigateBack:!0}),e.jsx(x,{sx:{flex:1,p:2,pb:"120px"},children:t||!n?e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",py:4},children:e.jsx(Ie,{})}):e.jsx(en,{configData:n,providerAvailability:{asaasEnabled:c,mpConnected:m,hasPixKeys:y,firstPixKeyId:v}},JSON.stringify(n))})]})}export{fn as default};

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.