feat(wallet): update ChargeCreditWallet component for improved magic ceiling consent handling
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m1s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m1s
- 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.
This commit is contained in:
@@ -86,11 +86,28 @@
|
||||
else if (_authLoaded && _needsMagicCeilingConsent && !_allowNormalDespiteMagic && !_redirectingToMagic)
|
||||
{
|
||||
<MudAlert Severity="MudBlazor.Severity.Warning" Class="rounded-lg" Variant="Variant.Outlined">
|
||||
<MudStack Spacing="2" AlignItems="AlignItems.Center">
|
||||
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Warning" />
|
||||
<MudText>
|
||||
سقف شارژ جادویی پر است. برای شارژ بدون ضریب باید تأیید کنید...
|
||||
<MudStack Spacing="3">
|
||||
<MudText Typo="Typo.subtitle1">
|
||||
سقف شارژ کیف پول جادویی در این دور پر شده است.
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
شارژ از این صفحه بدون ضریب (۱:۱) به موجودی اضافه میشود و ضریب جادویی اعمال نمیشود.
|
||||
برای ادامه، تأیید کنید.
|
||||
</MudText>
|
||||
<MudStack Row="true" Spacing="1" Class="flex-wrap">
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Check"
|
||||
OnClick="AcceptMagicCeilingConsent">
|
||||
ادامه شارژ بدون ضریب
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined"
|
||||
Color="Color.Secondary"
|
||||
StartIcon="@Icons.Material.Filled.AutoAwesome"
|
||||
OnClick="DeclineMagicCeilingConsent">
|
||||
بازگشت به کیف جادویی
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Magic با ظرفیت باقیمانده → ریدایرکت به MagicWallet.
|
||||
/// Magic با سقف پر → نیاز به رضایت برای شارژ ۱:۱.
|
||||
/// Magic با سقف پر → نمایش تأیید روی صفحه برای شارژ ۱:۱.
|
||||
/// true یعنی مسیر شارژ فعلی باید متوقف شود.
|
||||
/// </summary>
|
||||
private async Task<bool> EvaluateMagicWalletGateAsync(bool promptConsent)
|
||||
private async Task<bool> 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);
|
||||
|
||||
Reference in New Issue
Block a user