Skip to content

4.14.2 - #458

Merged
yusuftor merged 17 commits into
masterfrom
develop
Apr 5, 2026
Merged

4.14.2#458
yusuftor merged 17 commits into
masterfrom
develop

Conversation

@yusuftor

@yusuftor yusuftor commented Apr 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds multipage paywall navigation tracking via a new paywall_page_view event that carries page view information.

Test plan

  • All unit tests pass.
  • All UI tests pass.
  • Demo project builds and runs on iOS.
  • Demo project builds and runs on Mac Catalyst.
  • Demo project builds and runs on visionOS.
  • I added/updated tests or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have run swiftlint in the main directory and fixed any issues.
  • I have updated the SDK documentation as well as the online docs.
  • I have reviewed the contributing guide

🤖 Generated with Claude Code

Greptile Summary

Adds a paywall_page_view event that fires whenever a user navigates to a page in a multi-page paywall, carrying PageViewData (page node ID, flow position, navigation type, time on previous page, etc.). Also introduces a presentationId on Paywall/PaywallInfo — assigned as UUID().uuidString at fetch time in getRawPaywall — to correlate all events (open, page views, close) within a single paywall presentation lifecycle.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 style suggestions with no correctness or data-integrity impact

Implementation is clean and consistent with every existing event-tracking pattern. All files align, tests are comprehensive, and the presentationId lifecycle is well-modelled. The only finding (navigationType as String vs enum) is a style improvement that does not affect runtime behaviour.

No files require special attention

Important Files Changed

Filename Overview
Sources/SuperwallKit/Paywall/View Controller/Web View/Message Handling/PageViewData.swift New Decodable/Equatable struct for page navigation metadata; custom CodingKeys maps navigationType to JSON key "type"
Sources/SuperwallKit/Paywall/View Controller/Web View/Message Handling/PaywallMessage.swift Adds pageView(PageViewData) case; decodes PageViewData from root decoder using same pattern as all other message types
Sources/SuperwallKit/Paywall/View Controller/Web View/Message Handling/PaywallMessageHandler.swift Handles .pageView by capturing delegate.info before Task closure and tracking PaywallPageView; consistent with stripe event handler pattern
Sources/SuperwallKit/Analytics/Internal Tracking/Trackable Events/TrackableSuperwallEvent.swift Adds PaywallPageView struct mapping all page navigation fields into analytics params including presentation_id via placementParams()
Sources/SuperwallKit/Analytics/Superwall Placement/SuperwallEvent.swift Adds paywallPageView(paywallInfo:data:) case with correct backingData wiring to SuperwallEventObjc.paywallPageView
Sources/SuperwallKit/Analytics/Superwall Placement/SuperwallEventObjc.swift Adds paywallPageView ObjC enum case with description "paywall_page_view"
Sources/SuperwallKit/Paywall/Request/Operators/RawPaywallResponse.swift Assigns presentationId = UUID().uuidString immediately after paywall fetch, before the first getInfo call
Sources/SuperwallKit/Models/Paywall/Paywall.swift Adds presentationId: String? var; correctly propagated in update(from:) for cached paywall re-presentation
Sources/SuperwallKit/Paywall/Presentation/PaywallInfo.swift Threads presentationId through to public let, initializer, and placementParams() as "presentation_id" key
Sources/SuperwallKit/Misc/Constants.swift Version bumped to 4.14.2
Tests/SuperwallKitTests/Paywall/View Controller/Web View/Message Handling/PageViewMessageTests.swift Comprehensive tests covering all four navigation types, full/sparse field decoding, parameter mapping, and presentation_id consistency
Tests/SuperwallKitTests/Paywall/Presentation/PresentationIdTests.swift Thorough lifecycle tests for presentationId nil-default, set/persist, update(from:) propagation, cross-event consistency, and multi-presentation isolation

Sequence Diagram

sequenceDiagram
    participant JS as JS Paywall
    participant WV as SWWebView
    participant MH as PaywallMessageHandler
    participant SW as Superwall.shared
    participant AN as Analytics

    JS->>WV: page_view JSON message
    WV->>MH: handle(.pageView(data))
    MH->>MH: guard delegate, capture delegate.info
    MH->>SW: Task { track(PaywallPageView) }
    SW->>AN: paywall_page_view event
    Note over AN: params include page_node_id,<br/>flow_position, navigation_type,<br/>presentation_id, paywall_identifier
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Sources/SuperwallKit/Paywall/View Controller/Web View/Message Handling/PageViewData.swift
Line: 30-34

Comment:
**`navigationType` untyped string field**

The valid values (`"entry"`, `"forward"`, `"back"`, `"auto_transition"`) are documented only in a comment. An invalid value coming from the JS layer (e.g. a typo) would be silently stored and forwarded to analytics without any Swift-level type check. Consider introducing a `NavigationType` enum conforming to `RawRepresentable & Decodable` to enforce the contract at the Swift boundary.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Merge pull request #448 from superwall/c..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

chroxify and others added 17 commits March 6, 2026 15:13
When a user swipes to dismiss the Stripe checkout sheet before the JS
stripe_checkout_abandon message fires, the fallback abandon path now
uses the product ID from stripeCheckoutStart instead of an empty string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…attern

Add PaywallPageViewInfo struct to expose pageNodeId, pageIndex, pageName,
and navigationType to SDK consumers. Align pageView message decoding with
the try?/if-let pattern used by all other PaywallMessage cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace PaywallPageViewInfo with public PageViewData, used for decoding,
internal tracking, and the public delegate event. Removes redundant
field-by-field passing throughout the chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add CodingKeys to map from JSON "type" to navigationType property.
Document all possible values: entry, forward, back, auto_transition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yusuftor yusuftor changed the title Release 4.14.2 4.14.2 Apr 5, 2026
@yusuftor
yusuftor merged commit 7468306 into master Apr 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants