修复 Telegram 绑定弹窗拦截:拦截时展示可点击链接供手动跳转
This commit is contained in:
@@ -166,6 +166,7 @@ export function AccountCenter() {
|
|||||||
} = usePaymentState();
|
} = usePaymentState();
|
||||||
const [showSecondarySections, setShowSecondarySections] = useState(false);
|
const [showSecondarySections, setShowSecondarySections] = useState(false);
|
||||||
const [reconcileBusy, setReconcileBusy] = useState(false);
|
const [reconcileBusy, setReconcileBusy] = useState(false);
|
||||||
|
const [telegramBindUrl, setTelegramBindUrl] = useState("");
|
||||||
|
|
||||||
const supabaseReady = hasSupabasePublicEnv();
|
const supabaseReady = hasSupabasePublicEnv();
|
||||||
const walletConnectEnabled = Boolean(WALLETCONNECT_PROJECT_ID);
|
const walletConnectEnabled = Boolean(WALLETCONNECT_PROJECT_ID);
|
||||||
@@ -1148,6 +1149,7 @@ export function AccountCenter() {
|
|||||||
const openTelegramBotBindLink = async () => {
|
const openTelegramBotBindLink = async () => {
|
||||||
setTelegramBindOpening(true);
|
setTelegramBindOpening(true);
|
||||||
setPaymentError("");
|
setPaymentError("");
|
||||||
|
setTelegramBindUrl("");
|
||||||
const popup = window.open("about:blank", "_blank", "noopener,noreferrer");
|
const popup = window.open("about:blank", "_blank", "noopener,noreferrer");
|
||||||
try {
|
try {
|
||||||
const authHeaders = await buildAuthedHeaders(true, false);
|
const authHeaders = await buildAuthedHeaders(true, false);
|
||||||
@@ -1164,12 +1166,15 @@ export function AccountCenter() {
|
|||||||
if (!botUrl) throw new Error("telegram bind link missing");
|
if (!botUrl) throw new Error("telegram bind link missing");
|
||||||
if (popup && !popup.closed) {
|
if (popup && !popup.closed) {
|
||||||
popup.location.href = botUrl;
|
popup.location.href = botUrl;
|
||||||
|
setPaymentInfo(
|
||||||
|
"已打开 Telegram Bot,请在 Bot 内点击 Start 并确认绑定;完成后刷新本页再申请入群。",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
window.open(botUrl, "_blank", "noopener,noreferrer");
|
setPaymentInfo(
|
||||||
|
"弹窗被拦截,请点击下方链接完成绑定:",
|
||||||
|
);
|
||||||
|
setTelegramBindUrl(botUrl);
|
||||||
}
|
}
|
||||||
setPaymentInfo(
|
|
||||||
"已打开 Telegram Bot,请在 Bot 内点击 Start 并确认绑定;完成后刷新本页再申请入群。",
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (popup && !popup.closed) popup.close();
|
if (popup && !popup.closed) popup.close();
|
||||||
setPaymentError(normalizePaymentError(error).message);
|
setPaymentError(normalizePaymentError(error).message);
|
||||||
@@ -2546,6 +2551,16 @@ export function AccountCenter() {
|
|||||||
{!paymentError && paymentInfo ? (
|
{!paymentError && paymentInfo ? (
|
||||||
<div className="mb-4 rounded-xl border border-cyan-400/35 bg-cyan-500/10 px-3 py-2 text-[11px] text-cyan-200">
|
<div className="mb-4 rounded-xl border border-cyan-400/35 bg-cyan-500/10 px-3 py-2 text-[11px] text-cyan-200">
|
||||||
{paymentInfo}
|
{paymentInfo}
|
||||||
|
{telegramBindUrl ? (
|
||||||
|
<a
|
||||||
|
href={telegramBindUrl}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="block mt-1 underline text-cyan-400 hover:text-cyan-300 break-all"
|
||||||
|
>
|
||||||
|
{telegramBindUrl}
|
||||||
|
</a>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
{!paymentHostAllowed ? (
|
{!paymentHostAllowed ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user