Skip to content

Add trackRevenue bridge for the native revenue API - #14

Open
ahsanalidotme wants to merge 1 commit into
mainfrom
feat/revenue-api
Open

ahsanalidotme wants to merge 1 commit into
mainfrom
feat/revenue-api

Conversation

@ahsanalidotme

@ahsanalidotme ahsanalidotme commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes linktrail-io/linktrail-backend#111

Blocked on release (native compile)

The iOS/Android bridge calls LinkTrail.trackRevenue / trackRevenueAsync, which exist only in unreleased native SDK PRs. The wrapper compiles against the published pins (LinkTrailSDK ~> 0.0.11, io.linktrail:sdk:0.0.5), so native builds will fail until the native SDKs are released and the pins in LinktrailReactNative.podspec / android/build.gradle are bumped (not done here: no version numbers invented). Do not merge/release before then.

Deploy order: backend -> native SDK releases -> wrappers (this PR, plus pin bump).

What

  • LinkTrail.trackRevenue({ transactionId, value, currency, productId? }) -> Promise<{ id?, attributed, duplicate }>.
  • TS-side validation/normalisation matching native rules (id trimmed, 1-255 chars; value finite >= 0; currency 3 letters, uppercased; blank productId dropped). Invalid input rejects with typed LinkTrailRevenueError (invalid_transaction_id / invalid_value / invalid_currency) without calling native.
  • TurboModule spec + iOS (Swift/ObjC++) and Android (Kotlin) bridge via the async throwing native variants; native revenue errors map to the same codes.
  • README section (react-native-iap / expo-iap / RevenueCat mapping; transactionId = StoreKit transaction id / Play orderId; dedupe makes retries safe), CHANGELOG Unreleased.
  • First jest unit tests (native module mocked); adds jest devDependencies and npm test. CI workflow untouched (no .github/workflows changes), so CI does not run npm test yet.

Verified

  • tsc clean, npm run lint 0 errors (3 pre-existing warnings), jest 16/16 passing.

Unverified

  • iOS and Android native compile of the bridge code (needs the unreleased SDKs; not tried against local branch checkouts).
  • Purchase-library snippets in the README are illustrative (field names of react-native-iap/expo-iap/RevenueCat not checked against their current typings).

Backend PR (deploy first): https://github.com/linktrail-io/linktrail-backend/pull/138
Dashboard PR: https://github.com/linktrail-io/linktrail-client-dashboard/pull/103

🤖 Generated with Claude Code

JS/TS LinkTrail.trackRevenue({ transactionId, value, currency, productId? })
with TS-side validation/normalisation matching the native rules, a typed
LinkTrailRevenueError, TurboModule spec + iOS/Android bridge, README,
CHANGELOG and jest unit tests.

Native compile is blocked on the iOS/Android SDK releases that contain the
revenue API; pins are intentionally not bumped here.
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.

1 participant