feat(paywalls): add state-driven paywalls data layer (PWENG-57)#3656
Conversation
76870d3 to
6aeea5e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3656 +/- ##
==========================================
+ Coverage 80.57% 80.58% +0.01%
==========================================
Files 395 397 +2
Lines 16316 16371 +55
Branches 2322 2332 +10
==========================================
+ Hits 13146 13192 +46
- Misses 2243 2247 +4
- Partials 927 932 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@cursor review |
f3d0360 to
f1f5b18
Compare
f1f5b18 to
e7fc9f5
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e7fc9f5. Configure here.
tonidero
left a comment
There was a problem hiding this comment.
Just some small things. Great work!
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d9f7342. Configure here.
4b937cb to
063cf7e
Compare
ca60e26 to
6936733
Compare
…e types Opting into the outer StateUpdate/StateUpdateValue interfaces already covers their nested members, matching the ComponentOverride.Condition convention.
Model StateDeclaration.type as a ValueType enum decoded via EnumDeserializerWithDefault (unknown wire types fall back to UNKNOWN) instead of a raw String. Also add state_updates decode coverage for carousel and tabs.
…-object entries Hardens the documented per-entry-drop contract: kotlinx SerializationException extends IllegalArgumentException, so the map serializer's catch already covers these shapes; this pins that behavior.
6936733 to
cc087cd
Compare


Decodes the new server-driven state schema from
PaywallComponentsData:state_declarations: a top-level map of named, typed (string/bool/int/double) variables with declared defaults.state_updateson interactive components (tabs, carousels, buttons): write operations that fire when the component is triggered. Supports literal values and a$valuepayload reference for the triggering component's identity.state_conditioninComponentOverride.Condition: evaluates a named variable against an expected value withEQUALS/NOT_EQUALSoperators.Pure data model — no runtime behavior.
Note
Low Risk
Changes are additive JSON models and resilient decoders with no purchase/auth logic; the UI stub means state-based overrides are inert until a later runtime phase.
Overview
Adds decode-only support for server-driven paywall state: top-level
state_declarationsonPaywallComponentsData, optionalstate_updateson buttons, carousels, and tabs, and a newstate_conditionoverride type.state_declarationsmaps names to typed defaults (boolean/integer/double/string) viaStateDeclarationand a tolerantStateDeclarationMapSerializerthat drops bad entries instead of failing the whole paywall.state_updatesdecode asStateUpdate.Setwith literaltovalues or the"$value"payload reference; unknown shapes becomeUnsupported.state_conditioncompares a named state key with=/!=(scalar primitives only; null/non-scalar →Unsupported). It is markedisRulelike other conditional rules.In revenuecatui,
ComponentOverride.Condition.Stateis wired to always evaluate false until runtime state exists—overrides gated only on state will not apply yet.Tests cover deserialization for declarations, updates, conditions, and component wiring.
Reviewed by Cursor Bugbot for commit cc087cd. Bugbot is set up for automated code reviews on this repo. Configure here.