Skip to content

feat(paywalls): add state-driven paywalls data layer (PWENG-57)#3656

Merged
AlvaroBrey merged 8 commits into
mainfrom
alvarobrey/pweng-57-data-layer
Jul 3, 2026
Merged

feat(paywalls): add state-driven paywalls data layer (PWENG-57)#3656
AlvaroBrey merged 8 commits into
mainfrom
alvarobrey/pweng-57-data-layer

Conversation

@AlvaroBrey

@AlvaroBrey AlvaroBrey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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_updates on interactive components (tabs, carousels, buttons): write operations that fire when the component is triggered. Supports literal values and a $value payload reference for the triggering component's identity.
  • state_condition in ComponentOverride.Condition: evaluates a named variable against an expected value with EQUALS/NOT_EQUALS operators.

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_declarations on PaywallComponentsData, optional state_updates on buttons, carousels, and tabs, and a new state_condition override type.

state_declarations maps names to typed defaults (boolean / integer / double / string) via StateDeclaration and a tolerant StateDeclarationMapSerializer that drops bad entries instead of failing the whole paywall.

state_updates decode as StateUpdate.Set with literal to values or the "$value" payload reference; unknown shapes become Unsupported.

state_condition compares a named state key with = / != (scalar primitives only; null/non-scalar → Unsupported). It is marked isRule like other conditional rules.

In revenuecatui, ComponentOverride.Condition.State is 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.

AlvaroBrey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@AlvaroBrey AlvaroBrey self-assigned this Jun 25, 2026
@AlvaroBrey AlvaroBrey changed the title feat(paywalls): decode top-level state_declarations map feat(paywalls): add state-driven paywalls data layer (PWENG-57) Jun 25, 2026
@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch from 76870d3 to 6aeea5e Compare June 25, 2026 15:59
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.63636% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.58%. Comparing base (3183def) to head (cc087cd).

Files with missing lines Patch % Lines
...urchases/paywalls/components/common/StateUpdate.kt 80.00% 2 Missing and 2 partials ⚠️
...ses/paywalls/components/common/StateDeclaration.kt 86.95% 1 Missing and 2 partials ⚠️
...es/paywalls/components/common/ComponentOverride.kt 75.00% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlvaroBrey

Copy link
Copy Markdown
Contributor Author

@cursor review

@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch 2 times, most recently from f3d0360 to f1f5b18 Compare June 29, 2026 14:54
@AlvaroBrey AlvaroBrey marked this pull request as ready for review June 30, 2026 10:17
@AlvaroBrey AlvaroBrey requested review from a team as code owners June 30, 2026 10:17
@AlvaroBrey AlvaroBrey requested review from MonikaMateska and removed request for a team June 30, 2026 10:17
@AlvaroBrey AlvaroBrey requested a review from a team July 1, 2026 07:45
@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch from f1f5b18 to e7fc9f5 Compare July 1, 2026 13:14
@AlvaroBrey

Copy link
Copy Markdown
Contributor Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small things. Great work!

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch from 4b937cb to 063cf7e Compare July 3, 2026 08:55
@AlvaroBrey AlvaroBrey enabled auto-merge July 3, 2026 08:55
@AlvaroBrey AlvaroBrey added this pull request to the merge queue Jul 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2026
@AlvaroBrey AlvaroBrey added this pull request to the merge queue Jul 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 3, 2026
@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch 2 times, most recently from ca60e26 to 6936733 Compare July 3, 2026 10:14
@AlvaroBrey AlvaroBrey enabled auto-merge July 3, 2026 10:28
AlvaroBrey and others added 8 commits July 3, 2026 15:40
…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.
@AlvaroBrey AlvaroBrey force-pushed the alvarobrey/pweng-57-data-layer branch from 6936733 to cc087cd Compare July 3, 2026 13:40
@AlvaroBrey AlvaroBrey added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit fb5632d Jul 3, 2026
37 checks passed
@AlvaroBrey AlvaroBrey deleted the alvarobrey/pweng-57-data-layer branch July 3, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants