feat(mp): add Mercado Pago reauthorization notice and status card components
- Implemented MpReauthNotice component to notify users when reauthorization is needed. - Created MpStatusCard component to display the current status of the Mercado Pago account. - Added utility functions and constants for handling Mercado Pago status and messages. - Introduced hooks for managing the connection and disconnection of Mercado Pago accounts. - Developed a disconnect confirmation modal for user actions. - Added tests for the new functionality and utility functions. - Defined schemas for Mercado Pago account status and callback reasons in shared package.
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import type { OnboardingGroupDto } from '@gruperly/shared'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import { ArrowRight, CheckCircle2, CreditCard } from 'lucide-react'
|
||||
import { useAuth } from '../../context/AuthProvider'
|
||||
import { Badge, Button } from '../../components/ui'
|
||||
import { useAuth } from '../../context/AuthProvider'
|
||||
import { MP_PROVIDER_NAME, useMpStatus } from '../mp'
|
||||
import { BILLING_LABELS, formatPrice, formatSchedule } from './constants'
|
||||
|
||||
type ConfirmationStepProps = {
|
||||
group: OnboardingGroupDto
|
||||
providerName?: string
|
||||
}
|
||||
|
||||
export function ConfirmationStep({ group, providerName }: ConfirmationStepProps) {
|
||||
export function ConfirmationStep({ group }: ConfirmationStepProps) {
|
||||
const navigate = useNavigate()
|
||||
const queryClient = useQueryClient()
|
||||
const { refresh } = useAuth()
|
||||
const statusQuery = useMpStatus()
|
||||
const isMpConnected = statusQuery.data?.status === 'active'
|
||||
|
||||
const goToDashboard = () => {
|
||||
// Revalidates the cache (onboarding state, session, groups) before redirecting.
|
||||
@@ -31,7 +33,7 @@ export function ConfirmationStep({ group, providerName }: ConfirmationStepProps)
|
||||
</span>
|
||||
<h2 className="text-2xl font-bold text-primary">¡Todo listo!</h2>
|
||||
<p className="text-sm text-foreground/60">
|
||||
Tu grupo se creó y ya podés empezar a cobrar a tus miembros.
|
||||
Tu grupo se creó. Ya podés invitar miembros y pasar lista.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
@@ -65,15 +67,24 @@ export function ConfirmationStep({ group, providerName }: ConfirmationStepProps)
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{providerName ? (
|
||||
<div className="flex items-center gap-2 rounded-xl bg-primary-soft px-4 py-3">
|
||||
<CreditCard className="size-4 shrink-0 text-accent" />
|
||||
<p className="text-xs text-primary">
|
||||
Vas a cobrar con <span className="font-semibold">{providerName}</span> en modo
|
||||
prueba.
|
||||
</p>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex items-center gap-2 rounded-xl bg-primary-soft px-4 py-3">
|
||||
<CreditCard className="size-4 shrink-0 text-accent" />
|
||||
<p className="text-xs text-primary">
|
||||
{isMpConnected ? (
|
||||
<>
|
||||
Vas a cobrar con <span className="font-semibold">{MP_PROVIDER_NAME}</span>. Los
|
||||
pagos entran directo en tu cuenta.
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Cuando quieras cobrar, vinculá <span className="font-semibold">
|
||||
{MP_PROVIDER_NAME}
|
||||
</span>{' '}
|
||||
desde Ajustes. Tu grupo ya quedó creado.
|
||||
</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Button variant="primary" className="w-full" onClick={goToDashboard}>
|
||||
Ir a mi Panel
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import type { CreateFirstGroup, OnboardingGroupDto } from '@gruperly/shared'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { createFirstGroup } from '../../lib/api'
|
||||
import { GroupForm } from '../groups/GroupForm'
|
||||
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
import { createContext, useContext, useEffect, useState } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import type { ConnectPaymentResult, OnboardingGroupDto, OnboardingStatusDto } from '@gruperly/shared'
|
||||
import type { OnboardingGroupDto, OnboardingStatusDto } from '@gruperly/shared'
|
||||
import type { UseQueryResult } from '@tanstack/react-query'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useNavigate, useSearch } from '@tanstack/react-router'
|
||||
import type { ReactNode } from 'react'
|
||||
import { createContext, useContext, useEffect, useMemo, useState } from 'react'
|
||||
import { useAuth } from '../../context/AuthProvider'
|
||||
import { getOnboardingStatus } from '../../lib/api'
|
||||
import { PAYMENT_PROVIDERS } from './constants'
|
||||
import type { MpCallbackFeedback } from '../mp'
|
||||
import { mpStatusQueryKey, readMpCallbackFeedback } from '../mp'
|
||||
|
||||
const WELCOME_STEP = 0
|
||||
const PAYMENT_STEP = 1
|
||||
const FIRST_GROUP_STEP = 2
|
||||
|
||||
type OnboardingContextValue = {
|
||||
step: number
|
||||
setStep: (step: number) => void
|
||||
paymentResult: ConnectPaymentResult | null
|
||||
setPaymentResult: (result: ConnectPaymentResult) => void
|
||||
/** Lo que volvió de Mercado Pago en `?mp=`, ya traducido a feedback. */
|
||||
mpFeedback: MpCallbackFeedback | null
|
||||
createdGroup: OnboardingGroupDto | null
|
||||
setCreatedGroup: (group: OnboardingGroupDto) => void
|
||||
providerName: string | undefined
|
||||
statusQuery: UseQueryResult<OnboardingStatusDto>
|
||||
}
|
||||
|
||||
@@ -22,8 +27,11 @@ const OnboardingContext = createContext<OnboardingContextValue | null>(null)
|
||||
|
||||
export function OnboardingProvider({ children }: { children: ReactNode }) {
|
||||
const { user } = useAuth()
|
||||
const [step, setStep] = useState(0)
|
||||
const [paymentResult, setPaymentResult] = useState<ConnectPaymentResult | null>(null)
|
||||
const navigate = useNavigate()
|
||||
const queryClient = useQueryClient()
|
||||
const search = useSearch({ from: '/onboarding' })
|
||||
const [step, setStep] = useState(WELCOME_STEP)
|
||||
const [mpFeedback, setMpFeedback] = useState<MpCallbackFeedback | null>(null)
|
||||
const [createdGroup, setCreatedGroup] = useState<OnboardingGroupDto | null>(null)
|
||||
|
||||
const statusQuery = useQuery({
|
||||
@@ -32,29 +40,48 @@ export function OnboardingProvider({ children }: { children: ReactNode }) {
|
||||
enabled: !!user,
|
||||
})
|
||||
|
||||
const callbackFeedback = useMemo(
|
||||
() => readMpCallbackFeedback(search.mp, search.reason),
|
||||
[search.mp, search.reason],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (!callbackFeedback) return
|
||||
|
||||
setMpFeedback(callbackFeedback)
|
||||
// La vinculación cambió el estado del servidor: el paso muestra el botón de
|
||||
// "cambiar de cuenta" y el resumen final ya sabe que hay cuenta.
|
||||
void queryClient.invalidateQueries({ queryKey: mpStatusQueryKey })
|
||||
void queryClient.invalidateQueries({ queryKey: ['onboarding', 'status'] })
|
||||
// Vuelve al paso de Cobros, que es de donde salió el flujo. Setearlo siempre
|
||||
// (y no solo desde el primer paso) evita que un `?mp=` que llega con el
|
||||
// proveedor recién montado salte al resumen sin mostrar la confirmación.
|
||||
setStep(PAYMENT_STEP)
|
||||
|
||||
// Se limpian los parámetros de la URL: si no, recargar la página volvería a
|
||||
// mostrar el aviso de la vinculación vieja.
|
||||
void navigate({ to: '/onboarding', search: {}, replace: true })
|
||||
}, [callbackFeedback, navigate, queryClient])
|
||||
|
||||
useEffect(() => {
|
||||
const status = statusQuery.data
|
||||
if (!status) return
|
||||
// If they dropped out after connecting payments, we resume at the group step.
|
||||
// Si dejó el onboarding después de vincular los cobros, se retoma en el
|
||||
// grupo. Con la cuenta ya activa el paso 1 ya muestra "Cambiar de cuenta",
|
||||
// así que solo se salta desde la bienvenida.
|
||||
if (status.step === 'PAYMENT_CONNECTED') {
|
||||
setStep((current) => (current === 0 ? 2 : current))
|
||||
setStep((current) => (current === WELCOME_STEP ? FIRST_GROUP_STEP : current))
|
||||
}
|
||||
}, [statusQuery.data])
|
||||
|
||||
const providerName = paymentResult
|
||||
? PAYMENT_PROVIDERS.find((p) => p.value === paymentResult.provider)?.name
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<OnboardingContext.Provider
|
||||
value={{
|
||||
step,
|
||||
setStep,
|
||||
paymentResult,
|
||||
setPaymentResult,
|
||||
mpFeedback,
|
||||
createdGroup,
|
||||
setCreatedGroup,
|
||||
providerName,
|
||||
statusQuery,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { useEffect } from 'react'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { useEffect } from 'react'
|
||||
import { Logo, LogoIcon } from '../../components/brand'
|
||||
import { Button } from '../../components/ui'
|
||||
import { useAuth } from '../../context/AuthProvider'
|
||||
import { ConfirmationStep } from './ConfirmationStep'
|
||||
import { FirstGroupStep } from './FirstGroupStep'
|
||||
import { useOnboarding } from './OnboardingProvider'
|
||||
import { PaymentStep } from './PaymentStep'
|
||||
import { Stepper } from './Stepper'
|
||||
import { WelcomeStep } from './WelcomeStep'
|
||||
import { PaymentStep } from './PaymentStep'
|
||||
import { FirstGroupStep } from './FirstGroupStep'
|
||||
import { ConfirmationStep } from './ConfirmationStep'
|
||||
|
||||
const STEPS = [
|
||||
{ label: 'Bienvenida' },
|
||||
@@ -21,16 +21,7 @@ const STEPS = [
|
||||
export function OnboardingView() {
|
||||
const { user, isPending: authPending } = useAuth()
|
||||
const navigate = useNavigate()
|
||||
const {
|
||||
step,
|
||||
setStep,
|
||||
paymentResult,
|
||||
setPaymentResult,
|
||||
createdGroup,
|
||||
setCreatedGroup,
|
||||
providerName,
|
||||
statusQuery,
|
||||
} = useOnboarding()
|
||||
const { step, setStep, mpFeedback, createdGroup, setCreatedGroup, statusQuery } = useOnboarding()
|
||||
|
||||
useEffect(() => {
|
||||
if (statusQuery.data?.completed) {
|
||||
@@ -90,14 +81,7 @@ export function OnboardingView() {
|
||||
<div key={step} className="mt-8 animate-step-enter">
|
||||
{step === 0 ? <WelcomeStep name={firstName} onNext={() => setStep(1)} /> : null}
|
||||
{step === 1 ? (
|
||||
<PaymentStep
|
||||
initialResult={paymentResult}
|
||||
onConnected={(result) => {
|
||||
setPaymentResult(result)
|
||||
setStep(2)
|
||||
}}
|
||||
onBack={() => setStep(0)}
|
||||
/>
|
||||
<PaymentStep feedback={mpFeedback} onNext={() => setStep(2)} onBack={() => setStep(0)} />
|
||||
) : null}
|
||||
{step === 2 ? (
|
||||
<FirstGroupStep
|
||||
@@ -108,9 +92,7 @@ export function OnboardingView() {
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
{step === 3 && createdGroup ? (
|
||||
<ConfirmationStep group={createdGroup} providerName={providerName} />
|
||||
) : null}
|
||||
{step === 3 && createdGroup ? <ConfirmationStep group={createdGroup} /> : null}
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
|
||||
@@ -1,169 +1,120 @@
|
||||
import { useState } from 'react'
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import type { ConnectPaymentResult, PaymentProvider } from '@gruperly/shared'
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
BadgeCheck,
|
||||
Check,
|
||||
CheckCircle2,
|
||||
CreditCard,
|
||||
Loader2,
|
||||
ShieldCheck,
|
||||
} from 'lucide-react'
|
||||
import { connectPayment } from '../../lib/api'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { ArrowLeft, ArrowRight, BadgeCheck, CheckCircle2, Loader2 } from 'lucide-react'
|
||||
import { Badge, Button } from '../../components/ui'
|
||||
import { PAYMENT_PROVIDERS } from './constants'
|
||||
import type { MpCallbackFeedback } from '../mp'
|
||||
import {
|
||||
formatMpConnectionDate,
|
||||
MP_PROVIDER_NAME,
|
||||
mpCallbackErrorMessage,
|
||||
mpStatusBadgeVariant,
|
||||
mpStatusLabel,
|
||||
useMpStatus,
|
||||
useStartMpAuthorization,
|
||||
} from '../mp'
|
||||
|
||||
type PaymentStepProps = {
|
||||
initialResult: ConnectPaymentResult | null
|
||||
onConnected: (result: ConnectPaymentResult) => void
|
||||
/** Resultado de la vinculación, leído de `?mp=` al volver de Mercado Pago. */
|
||||
feedback: MpCallbackFeedback | null
|
||||
onNext: () => void
|
||||
onBack: () => void
|
||||
}
|
||||
|
||||
export function PaymentStep({ initialResult, onConnected, onBack }: PaymentStepProps) {
|
||||
const [selected, setSelected] = useState<PaymentProvider>('MERCADO_PAGO')
|
||||
const [connected, setConnected] = useState<ConnectPaymentResult | null>(initialResult)
|
||||
/**
|
||||
* Paso "Cobros" del onboarding.
|
||||
*
|
||||
* Es salteable a propósito: el profesor puede crear su grupo y empezar a usar
|
||||
* Gruperly sin vincular Mercado Pago, y hacerlo después desde Ajustes. Por eso no
|
||||
* es un radiogroup con proveedores sino una sola acción: vincular la cuenta.
|
||||
*/
|
||||
export function PaymentStep({ feedback, onNext, onBack }: PaymentStepProps) {
|
||||
const statusQuery = useMpStatus()
|
||||
const startAuthorization = useStartMpAuthorization()
|
||||
|
||||
const connect = useMutation({
|
||||
mutationFn: () => connectPayment({ provider: selected, sandbox: true }),
|
||||
onSuccess: (result) => {
|
||||
setConnected(result)
|
||||
onConnected(result)
|
||||
},
|
||||
})
|
||||
|
||||
if (connected) {
|
||||
return (
|
||||
<section className="space-y-6">
|
||||
<header className="space-y-1">
|
||||
<h2 className="text-2xl font-bold text-primary">Tu cobro está conectado</h2>
|
||||
<p className="text-sm text-foreground/60">
|
||||
Ya podés dejar listo tu primer grupo para cobrar con{' '}
|
||||
{PAYMENT_PROVIDERS.find((p) => p.value === connected.provider)?.name ?? ''}.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div className="rounded-xl border border-success/30 bg-success-soft p-5 text-center">
|
||||
<span className="mx-auto flex size-12 items-center justify-center rounded-full bg-surface">
|
||||
<CheckCircle2 className="size-6 text-success" />
|
||||
</span>
|
||||
<p className="mt-3 text-sm font-semibold text-success">Cuenta conectada</p>
|
||||
<div className="mt-1 flex items-center justify-center gap-2">
|
||||
<span className="text-sm font-medium text-primary">
|
||||
{PAYMENT_PROVIDERS.find((p) => p.value === connected.provider)?.name}
|
||||
</span>
|
||||
<Badge variant="success">Modo prueba</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="outline" onClick={() => setConnected(null)}>
|
||||
<ArrowLeft className="size-4" />
|
||||
Cambiar
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
className="flex-1"
|
||||
onClick={() => onConnected(connected)}
|
||||
>
|
||||
Continuar
|
||||
<ArrowRight className="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
const status = statusQuery.data?.status ?? 'none'
|
||||
const isConnected = status === 'active'
|
||||
const connectedAt = formatMpConnectionDate(statusQuery.data?.connectedAt ?? null)
|
||||
|
||||
return (
|
||||
<section className="space-y-5">
|
||||
<header className="space-y-1">
|
||||
<h2 className="text-2xl font-bold text-primary">Elegí tu procesador de cobro</h2>
|
||||
<h2 className="text-2xl font-bold text-primary">Conectá tus cobros</h2>
|
||||
<p className="text-sm text-foreground/60">
|
||||
Los pagos de tus miembros van a llegar por esta plataforma.
|
||||
Vinculá tu cuenta de {MP_PROVIDER_NAME} y cobrale a tus miembros desde el grupo.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div role="radiogroup" aria-label="Procesador de pago" className="space-y-3">
|
||||
{PAYMENT_PROVIDERS.map((provider) => {
|
||||
const isSelected = selected === provider.value
|
||||
return (
|
||||
<button
|
||||
key={provider.value}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={isSelected}
|
||||
onClick={() => setSelected(provider.value)}
|
||||
className={cn(
|
||||
'flex w-full items-center gap-3 rounded-xl border bg-surface p-4 text-left transition-colors',
|
||||
isSelected
|
||||
? 'border-accent ring-2 ring-accent/20'
|
||||
: 'border-border hover:bg-primary-soft',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'rounded-lg p-2',
|
||||
isSelected ? 'bg-accent-soft' : 'bg-primary-soft',
|
||||
)}
|
||||
>
|
||||
<CreditCard
|
||||
className={cn('size-5', isSelected ? 'text-accent' : 'text-primary/40')}
|
||||
/>
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block text-sm font-semibold text-primary">
|
||||
{provider.name}
|
||||
</span>
|
||||
<span className="block text-xs text-foreground/60">
|
||||
{provider.description}
|
||||
</span>
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
'flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors',
|
||||
isSelected ? 'border-accent bg-accent text-on-accent' : 'border-border',
|
||||
)}
|
||||
>
|
||||
{isSelected ? <Check className="size-3" strokeWidth={3} /> : null}
|
||||
</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="flex items-start gap-2 rounded-xl bg-warning-soft px-4 py-3">
|
||||
<ShieldCheck className="mt-0.5 size-4 shrink-0 text-warning" />
|
||||
<p className="text-xs text-warning">
|
||||
Por ahora la conexión se hace en modo prueba (sandbox). Más adelante vas a poder
|
||||
vincular tu cuenta real de {selected === 'STRIPE' ? 'Stripe' : 'Mercado Pago'}.
|
||||
{feedback?.kind === 'success' ? (
|
||||
<p className="flex items-start gap-2 rounded-xl bg-success-soft px-4 py-3 text-sm text-success">
|
||||
<CheckCircle2 className="mt-0.5 size-4 shrink-0" />
|
||||
Tu cuenta de {MP_PROVIDER_NAME} quedó vinculada.
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{feedback?.kind === 'error' ? (
|
||||
<p className="rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger">
|
||||
{mpCallbackErrorMessage(feedback.reason)}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<div className="divide-y divide-border rounded-xl border border-border bg-surface">
|
||||
<div className="flex items-center justify-between gap-3 px-4 py-3">
|
||||
<p className="text-sm font-medium text-primary">{MP_PROVIDER_NAME}</p>
|
||||
<Badge variant={mpStatusBadgeVariant(status)}>{mpStatusLabel(status)}</Badge>
|
||||
</div>
|
||||
|
||||
<div className="px-4 py-3">
|
||||
{statusQuery.isPending ? (
|
||||
<p className="flex items-center gap-2 text-sm text-foreground/50">
|
||||
<Loader2 className="size-4 animate-spin" />
|
||||
Consultando tu cuenta…
|
||||
</p>
|
||||
) : isConnected ? (
|
||||
<p className="text-sm text-foreground/60">
|
||||
{connectedAt ? `Vinculada el ${connectedAt}. ` : ''}
|
||||
Los pagos de tus grupos van a entrar a esta cuenta.
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-sm text-foreground/60">
|
||||
Te llevamos a {MP_PROVIDER_NAME} para autorizar los cobros. Los pagos entran
|
||||
directo en tu cuenta, sin intermediarios.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="px-4 py-3">
|
||||
<Button
|
||||
variant="primary"
|
||||
className="w-full"
|
||||
disabled={startAuthorization.isStarting}
|
||||
onClick={() => void startAuthorization.start('onboarding')}
|
||||
>
|
||||
{startAuthorization.isStarting ? (
|
||||
<Loader2 className="size-4 animate-spin" />
|
||||
) : (
|
||||
<BadgeCheck className="size-4" />
|
||||
)}
|
||||
{startAuthorization.isStarting
|
||||
? 'Abriendo Mercado Pago…'
|
||||
: isConnected
|
||||
? 'Cambiar de cuenta'
|
||||
: 'Vincular cuenta'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{connect.isError ? (
|
||||
{startAuthorization.error ? (
|
||||
<p className="rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger">
|
||||
No pudimos conectar la cuenta. Intentalo de nuevo.
|
||||
{startAuthorization.error}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<Button variant="outline" onClick={onBack}>
|
||||
<Button variant="outline" onClick={onBack} className="hidden lg:inline-flex">
|
||||
<ArrowLeft className="size-4" />
|
||||
Volver
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
className="flex-1"
|
||||
disabled={connect.isPending}
|
||||
onClick={() => connect.mutate()}
|
||||
>
|
||||
{connect.isPending ? (
|
||||
<Loader2 className="size-4 animate-spin" />
|
||||
) : (
|
||||
<BadgeCheck className="size-4" />
|
||||
)}
|
||||
{connect.isPending ? 'Conectando…' : 'Conectar cuenta'}
|
||||
<Button variant="outline" className="flex-1 lg:flex-none" onClick={onNext}>
|
||||
{isConnected ? 'Continuar' : 'Lo hago después'}
|
||||
<ArrowRight className="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -10,7 +10,7 @@ const STEPS_TO_SETUP = [
|
||||
{
|
||||
icon: Wallet,
|
||||
title: 'Conectá tu cuenta de cobro',
|
||||
description: 'Mercado Pago o Stripe, en modo prueba por ahora.',
|
||||
description: 'Vinculá Mercado Pago y cobrale a tus miembros desde el grupo.',
|
||||
},
|
||||
{
|
||||
icon: Users,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { BillingType, PaymentProvider, WeekDay } from '@gruperly/shared'
|
||||
export { BILLING_LABELS, WEEK_DAY_FULL_LABELS, formatPrice, formatSchedule } from '../../lib/format'
|
||||
import type { BillingType, WeekDay } from '@gruperly/shared'
|
||||
|
||||
export { BILLING_LABELS, formatPrice, formatSchedule, WEEK_DAY_FULL_LABELS } from '../../lib/format'
|
||||
|
||||
export const WEEK_DAYS: readonly WeekDay[] = [
|
||||
'MONDAY',
|
||||
@@ -21,23 +22,6 @@ export const WEEK_DAY_CHIPS: readonly { value: WeekDay; label: string }[] = [
|
||||
{ value: 'SUNDAY', label: 'Dom' },
|
||||
]
|
||||
|
||||
export const PAYMENT_PROVIDERS: readonly {
|
||||
value: PaymentProvider
|
||||
name: string
|
||||
description: string
|
||||
}[] = [
|
||||
{
|
||||
value: 'MERCADO_PAGO',
|
||||
name: 'Mercado Pago',
|
||||
description: 'El procesador más usado en Latinoamérica',
|
||||
},
|
||||
{
|
||||
value: 'STRIPE',
|
||||
name: 'Stripe',
|
||||
description: 'Cobrá con tarjetas e internacionalmente',
|
||||
},
|
||||
]
|
||||
|
||||
export const BILLING_TYPES: readonly { value: BillingType; label: string; hint: string }[] = [
|
||||
{ value: 'MONTHLY', label: 'Mensual', hint: 'Un cobro por mes' },
|
||||
{ value: 'PER_CLASS', label: 'Por clase', hint: 'Cada clase que asista' },
|
||||
|
||||
Reference in New Issue
Block a user