feat(ads): VK post-move interstitial + retire deprecated hint_balance/paid_account
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 23s
CI / ui (pull_request) Successful in 1m12s
CI / conformance (pull_request) Successful in 9s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m53s

Interstitial video after a confirmed play or a hint, VK-only, offline
banner-only. The gate is client-mirrored: the backend puts the config
cooldowns (global 5m / vs_ai 30m / hint 1m) and a suppressed flag (the
no-ads / no_banner gate, same as the banner) on Profile.ads via adsFor;
the client self-gates on a per-kind last-shown time in localStorage, with
the VITE_ADS_STUB contour "ad fired" toast. Never fires after a pass,
exchange or resign. maybeShowInterstitial + vkShowInterstitial; the codec
and gateway transcode carry the ads block.

Also retires the deprecated accounts.hint_balance / paid_account domain
usage (expand-contract, code only — the columns stay for a later DROP so
image rollback stays DB-safe): drop the Account fields and their scan, the
dead account.SpendHint, account.GrantHints and the admin grant-hints
action; the in-game hint display now comes wholly from the payments hint
benefit. Banner eligibility and account merge no longer read the legacy
flags.

Tests: ads.test.ts (the client-mirrored gate), the codec ads round-trip,
the gateway ads transcode test, and a profile ads-config integration test
(cooldowns + suppressed under no-ads / no_banner). Docs: PAYMENTS §10 (+ru)
interstitial, the decision amends, backend README, the plan.
This commit is contained in:
Ilia Denisov
2026-07-10 02:48:10 +02:00
parent e08d3301bd
commit 13be7c3d9a
33 changed files with 805 additions and 220 deletions
+12
View File
@@ -264,6 +264,18 @@ table Profile {
// preload the right dictionary and pin a new local game without a separate request (added
// trailing — backward-compatible).
dict_versions:[DictVersion];
// ads carries the post-move interstitial config (cooldowns + suppressed) for the client-mirrored
// gate (added trailing — backward-compatible).
ads:AdsInfo;
}
// AdsInfo is the post-move interstitial config: the client-mirrored cooldowns (seconds) and whether
// ads are suppressed in the caller's context (a no-ads benefit here, or the no_banner role).
table AdsInfo {
cooldown_global_s:int;
cooldown_vs_ai_s:int;
cooldown_hint_s:int;
suppressed:bool;
}
// BlockStatus reports the caller's current manual block. The UI fetches it after any operation
+109
View File
@@ -0,0 +1,109 @@
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package scrabblefb
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type AdsInfo struct {
_tab flatbuffers.Table
}
func GetRootAsAdsInfo(buf []byte, offset flatbuffers.UOffsetT) *AdsInfo {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &AdsInfo{}
x.Init(buf, n+offset)
return x
}
func FinishAdsInfoBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
builder.Finish(offset)
}
func GetSizePrefixedRootAsAdsInfo(buf []byte, offset flatbuffers.UOffsetT) *AdsInfo {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &AdsInfo{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func FinishSizePrefixedAdsInfoBuffer(builder *flatbuffers.Builder, offset flatbuffers.UOffsetT) {
builder.FinishSizePrefixed(offset)
}
func (rcv *AdsInfo) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *AdsInfo) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *AdsInfo) CooldownGlobalS() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *AdsInfo) MutateCooldownGlobalS(n int32) bool {
return rcv._tab.MutateInt32Slot(4, n)
}
func (rcv *AdsInfo) CooldownVsAiS() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *AdsInfo) MutateCooldownVsAiS(n int32) bool {
return rcv._tab.MutateInt32Slot(6, n)
}
func (rcv *AdsInfo) CooldownHintS() int32 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return rcv._tab.GetInt32(o + rcv._tab.Pos)
}
return 0
}
func (rcv *AdsInfo) MutateCooldownHintS(n int32) bool {
return rcv._tab.MutateInt32Slot(8, n)
}
func (rcv *AdsInfo) Suppressed() bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.GetBool(o + rcv._tab.Pos)
}
return false
}
func (rcv *AdsInfo) MutateSuppressed(n bool) bool {
return rcv._tab.MutateBoolSlot(10, n)
}
func AdsInfoStart(builder *flatbuffers.Builder) {
builder.StartObject(4)
}
func AdsInfoAddCooldownGlobalS(builder *flatbuffers.Builder, cooldownGlobalS int32) {
builder.PrependInt32Slot(0, cooldownGlobalS, 0)
}
func AdsInfoAddCooldownVsAiS(builder *flatbuffers.Builder, cooldownVsAiS int32) {
builder.PrependInt32Slot(1, cooldownVsAiS, 0)
}
func AdsInfoAddCooldownHintS(builder *flatbuffers.Builder, cooldownHintS int32) {
builder.PrependInt32Slot(2, cooldownHintS, 0)
}
func AdsInfoAddSuppressed(builder *flatbuffers.Builder, suppressed bool) {
builder.PrependBoolSlot(3, suppressed, false)
}
func AdsInfoEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}
+17 -1
View File
@@ -231,8 +231,21 @@ func (rcv *Profile) DictVersionsLength() int {
return 0
}
func (rcv *Profile) Ads(obj *AdsInfo) *AdsInfo {
o := flatbuffers.UOffsetT(rcv._tab.Offset(38))
if o != 0 {
x := rcv._tab.Indirect(o + rcv._tab.Pos)
if obj == nil {
obj = new(AdsInfo)
}
obj.Init(rcv._tab.Bytes, x)
return obj
}
return nil
}
func ProfileStart(builder *flatbuffers.Builder) {
builder.StartObject(17)
builder.StartObject(18)
}
func ProfileAddUserId(builder *flatbuffers.Builder, userId flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(userId), 0)
@@ -291,6 +304,9 @@ func ProfileAddDictVersions(builder *flatbuffers.Builder, dictVersions flatbuffe
func ProfileStartDictVersionsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func ProfileAddAds(builder *flatbuffers.Builder, ads flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(17, flatbuffers.UOffsetT(ads), 0)
}
func ProfileEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}