From 13091849cf2ba97bdcb9f6f8b326d8529dc42cb0 Mon Sep 17 00:00:00 2001 From: masoodafar-web Date: Sun, 9 Aug 2026 00:11:49 +0330 Subject: [PATCH] feat(wallet): update ChargeCreditWallet component for improved magic ceiling consent handling - Enhanced the user interface to provide clearer instructions and options for charging without a magic multiplier when the magic wallet ceiling is full. - Removed the previous consent prompting logic and replaced it with direct buttons for user actions. - Updated methods to streamline the consent process and improve navigation based on user choices. These changes enhance user experience by simplifying the consent flow and providing immediate options for wallet charging. --- .../Pages/Profile/ChargeCreditWallet.razor | 25 ++++++-- .../Pages/Profile/ChargeCreditWallet.razor.cs | 58 ++++++------------- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor b/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor index 34a492a..e5da011 100644 --- a/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor +++ b/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor @@ -86,11 +86,28 @@ else if (_authLoaded && _needsMagicCeilingConsent && !_allowNormalDespiteMagic && !_redirectingToMagic) { - - - - سقف شارژ جادویی پر است. برای شارژ بدون ضریب باید تأیید کنید... + + + سقف شارژ کیف پول جادویی در این دور پر شده است. + + شارژ از این صفحه بدون ضریب (۱:۱) به موجودی اضافه می‌شود و ضریب جادویی اعمال نمی‌شود. + برای ادامه، تأیید کنید. + + + + ادامه شارژ بدون ضریب + + + بازگشت به کیف جادویی + + } diff --git a/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor.cs b/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor.cs index 8b7ffff..fe0fc00 100644 --- a/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor.cs +++ b/src/FrontOffice.Main/Pages/Profile/ChargeCreditWallet.razor.cs @@ -19,7 +19,6 @@ public partial class ChargeCreditWallet : ComponentBase private bool _redirectingToMagic; private bool _allowNormalDespiteMagic; private bool _needsMagicCeilingConsent; - private bool _magicConsentPrompted; private readonly long[] _presetAmounts = { 500_000, 1_000_000, 5_000_000, 10_000_000, 20_000_000, 50_000_000 }; @@ -65,7 +64,7 @@ public partial class ChargeCreditWallet : ComponentBase } if (_isClubMemberActive) - await EvaluateMagicWalletGateAsync(promptConsent: false); + await EvaluateMagicWalletGateAsync(); } protected override async Task OnAfterRenderAsync(bool firstRender) @@ -73,16 +72,21 @@ public partial class ChargeCreditWallet : ComponentBase if (firstRender && !string.IsNullOrEmpty(_pendingReturnUrl) && _isClubMemberActive && !_redirectingToMagic) await CreditChargeNavigation.SaveReturnUrlAsync(JSRuntime, _pendingReturnUrl); - if (firstRender && _needsMagicCeilingConsent && !_allowNormalDespiteMagic && !_magicConsentPrompted) - { - _magicConsentPrompted = true; - await PromptMagicCeilingConsentAsync(); - StateHasChanged(); - } - await base.OnAfterRenderAsync(firstRender); } + private void AcceptMagicCeilingConsent() + { + _allowNormalDespiteMagic = true; + _redirectingToMagic = false; + } + + private void DeclineMagicCeilingConsent() + { + _redirectingToMagic = true; + Navigation.NavigateTo(RouteConstants.Profile.MagicWallet); + } + private async Task StartCreditCharge() { if (!_isClubMemberActive) @@ -93,10 +97,10 @@ public partial class ChargeCreditWallet : ComponentBase return; } - if (await EvaluateMagicWalletGateAsync(promptConsent: true)) + if (await EvaluateMagicWalletGateAsync()) return; - if (!_allowNormalDespiteMagic && _needsMagicCeilingConsent) + if (_needsMagicCeilingConsent && !_allowNormalDespiteMagic) return; if (_chargeAmount <= 0 || _isProcessing) return; @@ -139,10 +143,10 @@ public partial class ChargeCreditWallet : ComponentBase /// /// Magic با ظرفیت باقی‌مانده → ریدایرکت به MagicWallet. - /// Magic با سقف پر → نیاز به رضایت برای شارژ ۱:۱. + /// Magic با سقف پر → نمایش تأیید روی صفحه برای شارژ ۱:۱. /// true یعنی مسیر شارژ فعلی باید متوقف شود. /// - private async Task EvaluateMagicWalletGateAsync(bool promptConsent) + private async Task EvaluateMagicWalletGateAsync() { if (_allowNormalDespiteMagic) return false; @@ -172,14 +176,7 @@ public partial class ChargeCreditWallet : ComponentBase } _needsMagicCeilingConsent = true; - - if (promptConsent) - { - await PromptMagicCeilingConsentAsync(); - return !_allowNormalDespiteMagic; - } - - return true; + return !_allowNormalDespiteMagic; } catch { @@ -188,25 +185,6 @@ public partial class ChargeCreditWallet : ComponentBase } } - private async Task PromptMagicCeilingConsentAsync() - { - var confirmed = await DialogService.ShowMessageBox( - "شارژ بدون ضریب جادویی", - "سقف شارژ کیف پول جادویی شما در این دور پر شده است. شارژ از این صفحه بدون ضریب (۱:۱) به موجودی اضافه می‌شود و ضریب جادویی اعمال نمی‌شود. آیا مایلید ادامه دهید؟", - yesText: "ادامه شارژ بدون ضریب", - cancelText: "انصراف"); - - if (confirmed == true) - { - _allowNormalDespiteMagic = true; - _redirectingToMagic = false; - return; - } - - _redirectingToMagic = true; - Navigation.NavigateTo(RouteConstants.Profile.MagicWallet); - } - private async Task ContinueShoppingAsync() { var returnUrl = await CreditChargeNavigation.GetReturnUrlAsync(JSRuntime);