mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
@@ -207,7 +207,10 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
|
|||||||
setError(t('balance.errors.noPaymentLink'));
|
setError(t('balance.errors.noPaymentLink'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!webApp?.openInvoice) {
|
// openInvoice requires WebApp version 6.1+
|
||||||
|
const supportsInvoice =
|
||||||
|
webApp?.openInvoice && webApp?.isVersionAtLeast && webApp.isVersionAtLeast('6.1');
|
||||||
|
if (!supportsInvoice) {
|
||||||
setError(t('balance.errors.starsOnlyInTelegram'));
|
setError(t('balance.errors.starsOnlyInTelegram'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,8 +207,12 @@ export default function Wheel() {
|
|||||||
const starsInvoiceMutation = useMutation({
|
const starsInvoiceMutation = useMutation({
|
||||||
mutationFn: wheelApi.createStarsInvoice,
|
mutationFn: wheelApi.createStarsInvoice,
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
if (window.Telegram?.WebApp?.openInvoice) {
|
const webApp = window.Telegram?.WebApp;
|
||||||
window.Telegram.WebApp.openInvoice(data.invoice_url, async (status) => {
|
// openInvoice requires WebApp version 6.1+
|
||||||
|
const supportsInvoice =
|
||||||
|
webApp?.openInvoice && webApp?.isVersionAtLeast && webApp.isVersionAtLeast('6.1');
|
||||||
|
if (supportsInvoice) {
|
||||||
|
webApp.openInvoice(data.invoice_url, async (status) => {
|
||||||
if (status === 'paid') {
|
if (status === 'paid') {
|
||||||
// Mark this as a Stars spin so handleSpinComplete knows to use the pending result
|
// Mark this as a Stars spin so handleSpinComplete knows to use the pending result
|
||||||
isStarsSpinRef.current = true;
|
isStarsSpinRef.current = true;
|
||||||
|
|||||||
2
src/vite-env.d.ts
vendored
2
src/vite-env.d.ts
vendored
@@ -85,6 +85,8 @@ interface TelegramWebApp {
|
|||||||
button_color?: string;
|
button_color?: string;
|
||||||
button_text_color?: string;
|
button_text_color?: string;
|
||||||
};
|
};
|
||||||
|
// Version check helper
|
||||||
|
isVersionAtLeast: (version: string) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
|
|||||||
Reference in New Issue
Block a user