Skip to content

feat(paywalls): add decode-only stateUpdates on interactive components#6990

Merged
MonikaMateska merged 2 commits into
mainfrom
pw-state/2-updates
Jun 16, 2026
Merged

feat(paywalls): add decode-only stateUpdates on interactive components#6990
MonikaMateska merged 2 commits into
mainfrom
pw-state/2-updates

Conversation

@MonikaMateska

@MonikaMateska MonikaMateska commented Jun 14, 2026

Copy link
Copy Markdown
Member

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Phase 0 stack (PWENG-56). Adds the stateUpdates wire format on interactive components so the SDK can carry the mutations a component will apply when its interaction fires. Decode-only this phase, nothing writes to the store yet.
Spec: https://github.com/RevenueCat/sdk-specs/tree/main/openspec/changes/add-paywall-component-state

Description

Adds StateUpdate / StateUpdateValue (the set op and the $value payload token) and an optional stateUpdates field on Button, Carousel, and Tabs.
Unknown update shapes decode as .unsupported for forward-compat. @_spi(Internal).

Stack: 2/5 → base pw-state/1-declaration.


Note

Low Risk
Internal SPI models and JSON decoding only; no paywall runtime or purchase behavior changes in this phase.

Overview
Introduces StateUpdate / StateUpdateValue so paywall JSON can describe declarative store mutations ({ "set": "<key>", "to": … }), including the "$value" payload token for interaction-driven values. Unknown operation shapes decode as .unsupported instead of failing the paywall.

Adds optional stateUpdates on Button, Carousel, and Tabs (wired through init, equality, and Button’s explicit Codable). Phase 0 is decode-only—nothing applies these updates at runtime yet. Types are @_spi(Internal).

Unit tests cover literals, $value, forward-compat, malformed array entries, and encode round-trips.

Reviewed by Cursor Bugbot for commit 39543e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@emerge-tools

emerge-tools Bot commented Jun 14, 2026

Copy link
Copy Markdown

4 builds increased size

Name Version Download Change Install Change Approval
RevenueCat
com.revenuecat.PaywallsTester
1.0 (1) 18.7 MB ⬆️ 15.9 kB (0.09%) 67.5 MB ⬆️ 58.1 kB (0.09%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.local-source
1.0 (1) 4.3 MB ⬆️ 5.7 kB (0.13%) 13.0 MB ⬆️ 17.0 kB (0.13%) N/A
BinarySizeTest
com.revenuecat.binary-size-test.cocoapods
1.0 (1) 6.5 MB ⬆️ 11.0 kB (0.17%) 28.6 MB ⬆️ 41.7 kB (0.15%) ⏳ Needs approval
BinarySizeTest
com.revenuecat.binary-size-test.spm
1.0 (1) 4.4 MB ⬆️ 7.8 kB (0.18%) 11.3 MB ⬆️ 12.9 kB (0.11%) N/A

RevenueCat 1.0 (1)
com.revenuecat.PaywallsTester

⚖️ Compare build
⏱️ Analyze build performance

Total install size change: ⬆️ 58.1 kB (0.09%)
Total download size change: ⬆️ 15.9 kB (0.09%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 20.3 kB
Code Signature ⬆️ 1.8 kB
DYLD.Exports ⬆️ 1.1 kB
RevenueCat.PaywallComponent.TabsComponent.TabsComponent ⬆️ 588 B
Other ⬆️ 34.3 kB
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 17.0 kB (0.13%)
Total download size change: ⬆️ 5.7 kB (0.13%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 1.5 kB
DYLD.Exports ⬆️ 1.1 kB
📝 RevenueCat.PaywallComponent.StateUpdate.value witness ⬆️ 984 B
📝 RevenueCat.PaywallComponent.TabsComponent.init(name,visible,size,... ⬆️ 840 B
🗑 RevenueCat.PaywallComponent.TabsComponent.init(name,visible,size,... ⬇️ -804 B
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 41.7 kB (0.15%)
Total download size change: ⬆️ 11.0 kB (0.17%)

Largest size changes

Item Install Size Change
DYLD.String Table ⬆️ 16.2 kB
RevenueCat.PaywallData.Configuration.hash(into) ⬆️ 2.1 kB
DYLD.Exports ⬆️ 1.2 kB
📝 RevenueCat.PaywallComponent.StateUpdate.value witness ⬆️ 984 B
📝 RevenueCat.PaywallComponent.TabsComponent.init(name,visible,size,... ⬆️ 840 B
View Treemap

Image of diff

BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 12.9 kB (0.11%)
Total download size change: ⬆️ 7.8 kB (0.18%)

Largest size changes

Item Install Size Change
DYLD.Exports ⬆️ 1.1 kB
📝 RevenueCat.PaywallComponent.StateUpdate.value witness ⬆️ 984 B
📝 RevenueCat.PaywallComponent.TabsComponent.init(name,visible,size,... ⬆️ 840 B
🗑 RevenueCat.PaywallComponent.TabsComponent.init(name,visible,size,... ⬇️ -804 B
📝 RevenueCat.PaywallComponent.CarouselComponent.init(name,visible,s... ⬆️ 752 B
View Treemap

Image of diff


🛸 Powered by Emerge Tools

@MonikaMateska MonikaMateska force-pushed the pw-state/1-declaration branch from 8f8b112 to 9fbd9f3 Compare June 14, 2026 15:55
@MonikaMateska MonikaMateska force-pushed the pw-state/2-updates branch 2 times, most recently from c180d51 to 440b6ed Compare June 14, 2026 17:26
@MonikaMateska MonikaMateska marked this pull request as ready for review June 15, 2026 17:26
@MonikaMateska MonikaMateska requested a review from a team as a code owner June 15, 2026 17:26
Comment thread Sources/Paywalls/Components/Common/StateUpdate.swift

@alexrepty alexrepty 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.

We don't have any tests in this one, is that by design?

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 9e1cd95. Configure here.

Comment thread Sources/Paywalls/Components/Common/StateUpdate.swift
Base automatically changed from pw-state/1-declaration to main June 16, 2026 18:50
@MonikaMateska

Copy link
Copy Markdown
Member Author

We don't have any tests in this one, is that by design?

That's a good call, I've just added couple of tests to cover the decoding cases

@MonikaMateska MonikaMateska requested a review from alexrepty June 16, 2026 18:59
@MonikaMateska MonikaMateska merged commit dc7e2fc into main Jun 16, 2026
34 of 43 checks passed
@MonikaMateska MonikaMateska deleted the pw-state/2-updates branch June 16, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants