fix(ui): VK-iOS shows the pack CTA disabled with a toast, not a failed buy
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 22s
CI / ui (pull_request) Successful in 1m9s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m55s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 22s
CI / ui (pull_request) Successful in 1m9s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m55s
Money purchases are not permitted in the VK iOS app (Apple ToS), and the backend
already refuses them (the CreateOrder VK-iOS freeze). Show the pack "Buy" muted
there and explain on tap ("purchases are not available on this platform"),
instead of letting the tap hit a 403 and a generic error toast. The storefront
still lists the packs.
This commit is contained in:
@@ -243,6 +243,7 @@ export const en = {
|
||||
'wallet.empty': 'The store is empty for now',
|
||||
'wallet.buy': 'Buy',
|
||||
'wallet.offer': 'Public offer',
|
||||
'wallet.platformNoBuy': 'Purchases are not available on this platform',
|
||||
'wallet.gpStub': 'To buy chips, install the RuStore build.',
|
||||
'wallet.cur.RUB': '₽',
|
||||
'wallet.cur.VOTE': 'votes',
|
||||
|
||||
@@ -243,6 +243,7 @@ export const ru: Record<MessageKey, string> = {
|
||||
'wallet.empty': 'Магазин пока пуст',
|
||||
'wallet.buy': 'Купить',
|
||||
'wallet.offer': 'Публичная оферта',
|
||||
'wallet.platformNoBuy': 'На данной платформе покупки невозможны',
|
||||
'wallet.gpStub': 'Чтобы покупать фишки, установите версию из RuStore.',
|
||||
'wallet.cur.RUB': '₽',
|
||||
'wallet.cur.VOTE': 'голосов',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import Modal from '../components/Modal.svelte';
|
||||
import { app, handleError } from '../lib/app.svelte';
|
||||
import { app, handleError, showToast } from '../lib/app.svelte';
|
||||
import { gateway } from '../lib/gateway';
|
||||
import { platformSubtype } from '../lib/platform';
|
||||
import { t, i18n, type MessageKey } from '../lib/i18n/index.svelte';
|
||||
import { executionContext, formatAmount, needsWebSpendWarning, type SpendContext } from '../lib/wallet';
|
||||
import { isGooglePlayBuild } from '../lib/distribution';
|
||||
@@ -25,6 +26,9 @@
|
||||
|
||||
const context: SpendContext = executionContext();
|
||||
const gpBuild = isGooglePlayBuild();
|
||||
// Money purchases are not permitted inside the VK iOS app (Apple ToS); the pack CTA is shown
|
||||
// muted and taps explain why, rather than hiding the storefront.
|
||||
const purchaseBlocked = context === 'vk' && platformSubtype() === 'ios';
|
||||
|
||||
const values = $derived(catalog?.products.filter((p) => p.kind === 'value') ?? []);
|
||||
const packs = $derived(catalog?.products.filter((p) => p.kind === 'pack') ?? []);
|
||||
@@ -162,7 +166,16 @@
|
||||
<div class="row product" data-testid="product" data-kind="pack" data-pid={p.productId}>
|
||||
<span class="name">{p.title}</span>
|
||||
<span class="price">{formatAmount(p.moneyAmount, p.moneyCurrency)} {currencyLabel(p.moneyCurrency)}</span>
|
||||
<button class="buy" data-testid="buy-pack" disabled={busy} onclick={() => onOrder(p)}>{t('wallet.buy')}</button>
|
||||
<button
|
||||
class="buy"
|
||||
class:blocked={purchaseBlocked}
|
||||
data-testid="buy-pack"
|
||||
disabled={busy}
|
||||
onclick={() => {
|
||||
if (purchaseBlocked) showToast(t('wallet.platformNoBuy'));
|
||||
else void onOrder(p);
|
||||
}}>{t('wallet.buy')}</button
|
||||
>
|
||||
</div>
|
||||
{/each}
|
||||
{#if packs.length > 0}
|
||||
@@ -244,6 +257,9 @@
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
.buy.blocked {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.empty,
|
||||
.stub {
|
||||
margin: 0;
|
||||
|
||||
Reference in New Issue
Block a user