Skip to content

feat(paywalls): web_view schema component, not yet registered (4/7)#7230

Merged
ajpallares merged 12 commits into
mainfrom
webview/4-schema
Jul 21, 2026
Merged

feat(paywalls): web_view schema component, not yet registered (4/7)#7230
ajpallares merged 12 commits into
mainfrom
webview/4-schema

Conversation

@JZDesign

@JZDesign JZDesign commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Checklist

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

Motivation

Part 4 of 7 splitting #7183; inert until Part 7. Lands the schema type so later PRs can build view models against a real decoded shape without activating web_view in the paywall component enum.

Description

Adds PaywallComponent.WebViewComponent without touching PaywallComponentBase (ComponentType.webView / case webView stay for Part 7). Direct decode of WebViewComponent.self works; PaywallComponent.self still treats web_view as an unknown type (fallback path unchanged from main).

Adaptation vs #7183: type is stored as the wire String "web_view" until Part 7 registers ComponentType.webView (required so recognizing the raw value early would skip the unknown-type fallback and change runtime). Trimmed tests cover defaults / unknown keys only; full PaywallComponent decode and view-model tests move to Parts 6–7.

PR Plan

PWENG-99

Part PR Branch Base
1/7 #7227 webview/1-public-api main
2/7 #7228 webview/2-envelope webview/1-public-api (retarget to main after I1)
3/7 #7229 webview/3-isolation-navigation main
4/7 #7230 webview/4-schema main
5/7 #7231 webview/5-session webview/deps-123 (retarget after I1–I3)
6/7 #7232 webview/6-view webview/deps-45 (retarget after I4–I5)
7/7 #7233 webview/7-activate webview/deps-6 (retarget after I6)
Open in Web Open in Cursor 

Add PaywallComponent.WebViewComponent as dead code without registering
ComponentType.webView or PaywallComponent.webView, so paywall JSON is
unchanged until the activation PR.

Co-authored-by: Jacob Rakidzich <Jacob@JacobZivanDesign.com>
ajpallares and others added 3 commits July 20, 2026 11:07
…to webview/4-schema

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj
…eak, add coverage

Add the missing PBXBuildFile/Sources entries so WebViewComponentTests
compiles and runs in the UnitTests target (previously only a dangling
file reference). Fix `.fit` -> `.fit(nil)` in the component and test to
match the SizeConstraint.fit(UInt?) API, which was a pre-existing build
break. Add tests for the PaywallComponent fallback guarantee, encode
round-trip wire keys, the type guard, and missing url.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares ajpallares added pr:other and removed pr:feat A new feature labels Jul 20, 2026
Rely on synthesized Codable for encoding (identical output for the class)
and remove the decoded-type guard to match the other components, which
don't validate type. Keep the custom init(from:) only for the
protocolVersion/size decode defaults, plus the mandatory hash/== a class
needs. Remove the now-obsolete wrong-type test.

Co-authored-by: Cursor <cursoragent@cursor.com>

@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 792a1e9. Configure here.

Comment thread Sources/Paywalls/Components/PaywallWebViewComponent.swift Outdated
ajpallares and others added 5 commits July 20, 2026 20:16
Adds capabilities-ignored and templated-URL decode tests to match the
Android web_view schema PR coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
Both fields are mandatory in the Khepri schema (id: str, protocol_version:
Literal[1]) and always present in server payloads, so decode them strictly
instead of defaulting. Updates tests accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
…to webview/4-schema

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj
Drop the activation-PR reference on `type` (keeping only why it's a String)
and remove the redundant protocolVersion doc.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the hand-rolled init(from:) and redundant CodingKeys so decoding
matches VideoComponent. This makes size a required decode field, aligning
with the Khepri schema alongside the already-required id and protocol_version.

Co-authored-by: Cursor <cursoragent@cursor.com>
/// The static HTTPS URL of the web bundle entry point.
public let url: String

public let size: Size

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since size is a required field always sent by the backend (see https://github.com/RevenueCat/khepri/blob/main/khepri/services/paywalls/domain/template_schemas/v2/components/web_view.py#L33), I've removed in 5a57be9 the custom init(from decoder) that was only used to assign a default value to the size property

@ajpallares
ajpallares requested a review from AlvaroBrey July 21, 2026 08:04
@ajpallares ajpallares self-assigned this Jul 21, 2026
ajpallares and others added 2 commits July 21, 2026 10:10
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj
Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares

Copy link
Copy Markdown
Member

@RCGitBot please test

@ajpallares
ajpallares merged commit 0086241 into main Jul 21, 2026
45 checks passed
@ajpallares
ajpallares deleted the webview/4-schema branch July 21, 2026 09:34
This was referenced Jul 22, 2026
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.

4 participants