Skip to content

feat(inbox): add the iOS Mobile Inbox bridge (MAGE-1140) - #513

Open
belleklaviyo wants to merge 7 commits into
isobellelim/mage-1140-react-native-expose-mobile-inboxfrom
bl/MAGE-1140/inbox-ios-bridge
Open

belleklaviyo wants to merge 7 commits into
isobellelim/mage-1140-react-native-expose-mobile-inboxfrom
bl/MAGE-1140/inbox-ios-bridge

Conversation

@belleklaviyo

@belleklaviyo belleklaviyo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the iOS bridge for the Mobile Inbox (MAGE-1140): forwards the TypeScript API from #502 to MobileInbox and maps native failures to the stable INBOX_* codes.

Stack (each PR is based on the one before it; review and merge in order):

  1. feat(inbox): add the Mobile Inbox TypeScript API (MAGE-1140) #502 TypeScript API
  2. feat(inbox): add the iOS Mobile Inbox bridge (MAGE-1140) #513 iOS bridge (this PR)
  3. feat(inbox): add the Android Mobile Inbox bridge (MAGE-1140) #514 Android bridge
  4. docs(inbox): document the Mobile Inbox opt-in (MAGE-1140) #515 configure-sdk.sh --inbox
  5. feat(inbox): add updateMessageStates, InboxFilter and clearAll (MAGE-1140) #516 Bulk state change and clearAll

PR 2 of 5, based on #502. Retarget to feat/mobile-inbox once the PR below it merges.

Due Diligence

  • I have tested this on a simulator/emulator or a physical device, on iOS and Android (if applicable). (Not run on a device. The Swift file passed a parse check and was not compiled against the native inbox.)
  • I have added sufficient unit/integration tests of my changes. (The JS contract is covered in feat(inbox): add the Mobile Inbox TypeScript API (MAGE-1140) #502 and the last PR.)
  • I have adjusted or added new test cases to team test docs, if applicable.
  • I am confident these changes are implemented with feature parity across iOS and Android (if applicable). (Android is the next PR.)

Release/Versioning Considerations

  • Minor Contains changes to the public API.
  • This is planned work for an upcoming release.

Changelog / Code Overview

  • ios/KlaviyoBridge+Inbox.swift: fetchInboxPage with read and archive filters, fetchInboxUnreadCount, updateInboxMessageState and the change signal, all behind #if canImport(KlaviyoInbox). sentAt and receivedAt always cross as epoch milliseconds.
  • ios/KlaviyoReactNativeSdk.mm: the matching RCT_EXPORT_METHODs and the INBOX_AVAILABLE constant. invalidate() removes the native subscription on a reload.
  • Opt-in: Inbox is off by default and is left out unless KLAVIYO_INCLUDE_INBOX is exactly 'true'. This is the reverse of Forms and Location, which are included unless set to 'false'. The dependencies the podspec resolves are unchanged for every value of the flag.
  • Capture is separate: on iOS the pod alone captures nothing. The host's Notification Service Extension has to link KlaviyoInboxExtension and call KlaviyoInboxExtensionSDK.capture. That is host code, not part of this module.

Test Plan

  • Swift parses; the TypeScript suite is unaffected.
  • To try it: KLAVIYO_INCLUDE_INBOX=true pod install against a feat/mobile-inbox build of klaviyo-swift-sdk. configure-sdk.sh --inbox (PR 4) does this, but does not add KlaviyoFoundation or KlaviyoInboxCore, which the Podfile needs today.
  • Not run: an Xcode build, the example app, a device.

Related Issues/Tickets

MAGE-1140. Parent: MAGE-1138.

🤖 Generated with Claude Code

Risk Score: Medium, because the change adds iOS bridge methods and an event to the module's public surface, though it is opt-in and a revert removes it.

  • Adds Inbox fetch, unread-count, state-update, and change-handler methods, the klaviyo:inboxChanged event, and the INBOX_AVAILABLE constant to KlaviyoReactNativeSdk.mm, backed by KlaviyoBridge+Inbox.swift.
  • Adds the KlaviyoInbox podspec dependency only when KLAVIYO_INCLUDE_INBOX is exactly 'true'.
  • Swift passed only a parse check. No compile against KlaviyoInbox, Xcode build, example-app run, or TypeScript test run is reported.

@belleklaviyo

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d443aa0 and 89ebd20.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The iOS SDK now conditionally links KlaviyoInbox and exposes Inbox availability, page fetching, unread counts, message-state updates, and inbox-change events through the React Native module.

Changes: iOS Mobile Inbox

Layer / File(s) Summary
Inbox dependency and availability
klaviyo-react-native-sdk.podspec, ios/KlaviyoBridge+Inbox.swift
The podspec includes KlaviyoInbox only when KLAVIYO_INCLUDE_INBOX is 'true'. The bridge exposes availability and stores the change-subscription task.
Native Inbox operations
ios/KlaviyoBridge+Inbox.swift
The bridge adds page and unread-count fetching, message-state updates, and change subscriptions. It maps errors and converts Inbox messages and destinations to bridge payloads.
React Native Inbox methods and events
ios/KlaviyoReactNativeSdk.mm
The module exports Inbox availability, promise-based methods, and the klaviyo:inboxChanged event. It forwards operations to the bridge and dispatches change events on the main queue.

Sequence Diagram(s)

sequenceDiagram
  participant ReactNativeClient
  participant KlaviyoReactNativeSdk
  participant KlaviyoBridge
  participant KlaviyoInbox
  ReactNativeClient->>KlaviyoReactNativeSdk: fetchInboxPage(options)
  KlaviyoReactNativeSdk->>KlaviyoBridge: fetchInboxPage(options)
  KlaviyoBridge->>KlaviyoInbox: query Inbox page
  KlaviyoInbox-->>KlaviyoBridge: page data
  KlaviyoBridge-->>KlaviyoReactNativeSdk: mapped page
  KlaviyoReactNativeSdk-->>ReactNativeClient: resolve page
Loading

Change: Feature

Merge Risk: Minimal · previous review 2e87f

This change adds an opt-in iOS Mobile Inbox bridge that is off by default, so existing apps are unaffected unless they enable it at pod install time. No merge-blocking issue was found. It has not been compiled or run on a device, so a native build check is worthwhile before relying on it.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'feat(inbox): add the iOS Mobile Inbox bridge (MAGE-1140)' matches the main change. The changeset adds the iOS bridge for the Mobile Inbox (fetch, unread count, state updates, change registr…
Description check Passed The description covers the purpose (iOS bridge for Mobile Inbox, MAGE-1140), a changelog/code overview of both native files and the podspec opt-in gate, a test plan, and related tickets. It is well fi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title 'feat(inbox): add the iOS Mobile Inbox bridge (MAGE-1140)' matches the main change. The changeset adds the iOS bridge for the Mobile Inbox (fetch, unread count, state updates, change registration) in KlaviyoBridge+Inbox.swift and KlaviyoReactNativeSdk.mm, and the podspec gate. It is specific and concise, and follows a conventional commit style. The ticket ID is a minor addition but does not reduce clarity.

Full details: Description check

Explanation

The description covers the purpose (iOS bridge for Mobile Inbox, MAGE-1140), a changelog/code overview of both native files and the podspec opt-in gate, a test plan, and related tickets. It is well filled in and states what was and was not tested. The Due Diligence and Release sections are partly checked and include clear notes. Remaining gaps are minor: the 'team test docs' item is unchecked without explanation, and the Release section has no stated milestone label, though the template asks for one. The 'Changelog' section does not mention the Android counterpart beyond the stack list, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 02d487b and 2e87f1b.

Files selected for processing: 3

  • ios/KlaviyoBridge+Inbox.swift
  • ios/KlaviyoReactNativeSdk.mm
  • klaviyo-react-native-sdk.podspec

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Recent review details

Context from checks skipped due to timeout: 1

  • GitHub Check: CodeRabbit
Additional context used

Path-based instructions: 2

This is public SDK source code (TypeScript with Kotlin/Swift native modules).

CodeRabbit configuration file

Files:

  • ios/KlaviyoBridge+Inbox.swift
  • ios/KlaviyoReactNativeSdk.mm
Comment only on defects: correctness bugs, security risks, secret or PII exposure, data loss, or outage risk.

CodeRabbit configuration file

Files:

  • ios/KlaviyoBridge+Inbox.swift
  • ios/KlaviyoReactNativeSdk.mm
  • klaviyo-react-native-sdk.podspec

@belleklaviyo
belleklaviyo marked this pull request as ready for review November 25, 2026 17:41
@belleklaviyo
belleklaviyo requested a review from a team as a code owner November 25, 2026 17:41
@belleklaviyo

Copy link
Copy Markdown
Contributor Author

this only includes the first batch of functions on the API surface we agreed on. the later ones (clearAll, setMessageState (bulk)) come in the later PR

@belleklaviyo
belleklaviyo force-pushed the bl/MAGE-1140/inbox-ios-bridge branch from 2e87f1b to 0d01ccd Compare November 25, 2026 23:08
@belleklaviyo
belleklaviyo force-pushed the bl/MAGE-1140/inbox-ios-bridge branch from 0d01ccd to d443aa0 Compare November 25, 2026 23:13
belleklaviyo and others added 7 commits November 25, 2026 15:15
Forward fetchPage with read and archive filters, the unread count, message
state changes and the change signal from the React Native module to
MobileInbox, mapping a native failure to the stable INBOX_* codes the
TypeScript layer switches on.

The inbox is opt-in: the podspec only depends on KlaviyoInbox when
KLAVIYO_INCLUDE_INBOX=true, every call is guarded by canImport, and the
module exports INBOX_AVAILABLE so a build without it rejects with
INBOX_UNAVAILABLE.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Name the opt-in as include_inbox and say it is the reverse of Forms and
Location, which are included unless set to 'false'. The dependencies the
podspec resolves are unchanged for every value of KLAVIYO_INCLUDE_INBOX.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Native InboxMessage.sentAt is no longer optional, so the bridge sends it as an
epoch-millisecond number instead of falling back to NSNull.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (MAGE-1140)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s and Location (MAGE-1140)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…on do not have (MAGE-1140)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@belleklaviyo
belleklaviyo force-pushed the bl/MAGE-1140/inbox-ios-bridge branch from d443aa0 to 89ebd20 Compare November 25, 2026 23:16

This branch has not been deployed

No deployments
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.

1 participant