WIP 1.51.11: money on v2 via v1 handlers (viaV1 adapter)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
2026-10-29 13:43:36 +02:00
co-authored by Claude Opus 5.5
parent a45417948d
commit 6ee1438e23
36 changed files with 10334 additions and 154 deletions
@@ -2,10 +2,11 @@
import React, { useState } from "react";
import { ListPlus, X } from "lucide-react";
import { apiFetch, ApiError } from "@/lib/api";
import { ApiError } from "@/lib/api";
import { useAuth } from "@/hooks/useAuth";
import type { WaitlistLine } from "@/lib/waitlist";
import { ModalOverlay } from "@/components/shared/ModalOverlay";
import { apiV2Data } from "@/lib/apiV2";
export type { WaitlistLine };
@@ -40,9 +41,8 @@ export function JoinWaitlistButton({ eventId, lines, guestsAllowed, initialLine,
setBusy(true);
setError(null);
try {
const res = await apiFetch<{ message: string }>("/api/waitlist", {
method: "POST",
authToken: token || undefined,
const res = await (apiV2Data("post", "/waitlist", {
authToken: token,
body: {
eventId,
eventOptionId: line.eventOptionId,
@@ -51,7 +51,7 @@ export function JoinWaitlistButton({ eventId, lines, guestsAllowed, initialLine,
quantity: qty,
...(!loggedIn ? { guestName: guest.name.trim(), guestEmail: guest.email.trim(), guestPhone: guest.phone.trim() || undefined } : {}),
},
});
}) as Promise<{ message: string }>);
setDone(res.message);
} catch (err) {
setError(err instanceof ApiError ? err.message : "Couldn't join the waitlist. Please try again.");
@@ -2,11 +2,11 @@
import React, { useEffect, useState } from "react";
import { HeartHandshake, X } from "lucide-react";
import { apiFetch } from "@/lib/api";
import { useAuth } from "@/hooks/useAuth";
import { errorMessage } from "@/lib/utils";
import { useOnlinePayments } from "@/lib/onlinePayments";
import { ModalOverlay } from "@/components/shared/ModalOverlay";
import { apiV2Data } from "@/lib/apiV2";
type Sponsorship = { enabled: boolean; open?: boolean; spotPrice?: number | null; showProgress?: boolean; goalSpots?: number | null; spotsFunded?: number | null; sponsors?: number | null };
@@ -35,7 +35,7 @@ export function SponsorSpot({ eventId, eventTitle }: { eventId: string; eventTit
const online = useOnlinePayments();
useEffect(() => {
apiFetch<Sponsorship>(`/api/sponsorships/event/${encodeURIComponent(eventId)}`).then(setData).catch(() => setData(null));
(apiV2Data("get", "/events/{id}/sponsorship", { params: { id: eventId } }) as Promise<Sponsorship>).then(setData).catch(() => setData(null));
try {
const s = new URLSearchParams(window.location.search).get("sponsored");
if (s) setReturned(s);
@@ -55,8 +55,7 @@ export function SponsorSpot({ eventId, eventTitle }: { eventId: string; eventTit
setBusy(true);
setError(null);
try {
const res = await apiFetch<{ redirectUrl: string }>("/api/sponsorships/checkout", {
method: "POST",
const res = await (apiV2Data("post", "/sponsorships/checkout", {
...(loggedIn ? { authToken: token! } : {}),
body: {
eventId,
@@ -66,7 +65,7 @@ export function SponsorSpot({ eventId, eventTitle }: { eventId: string; eventTit
...(message.trim() ? { message: message.trim() } : {}),
...(!loggedIn ? { name: guest.name, email: guest.email } : {}),
},
});
}) as Promise<{ redirectUrl: string }>);
window.location.href = res.redirectUrl;
} catch (err) {
setError(errorMessage(err) || "Couldn't start the payment");