Skip to content

feat(SDK-750): expose jsonOnly on in-app message payloads - #913

Merged
jferrao-itrbl merged 8 commits into
feature/SDK-548-feature-parityfrom
feature/SDK-750-expose-json-only
Oct 12, 2026
Merged

jferrao-itrbl merged 8 commits into
feature/SDK-548-feature-parityfrom
feature/SDK-750-expose-json-only

Conversation

@jferrao-itrbl

@jferrao-itrbl jferrao-itrbl commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

📝 Summary

Expose jsonOnly on in-app bridge payloads so handlers and fetches can tell JSON-only in-apps apart from HTML messages.

🎟️ Jira Ticket: SDK-750

📖 Description

Both pinned native SDKs already track JSON-only in-apps (isJsonOnly() / jsonOnly), but the React Native bridge did not forward that flag on dictionaries delivered to JavaScript.

This PR:

  • Adds IterableInAppMessage.jsonOnly on the JS model (fromDict defaults missing values to false).
  • iOS: includes jsonOnly in IterableInAppMessage.toDict() (Serialization.swift).
  • Android: overwrites jsonOnly with a boolean from isJsonOnly() in RNIterableInternal.getInAppMessageJson() so handler and fetch paths match and native integer 1 is not forwarded to JS.

Part of SDK-548 feature parity. Does not bridge iOS JSON-only acknowledgement APIs (markJsonOnlyMessageHandled, getUnhandledJsonOnlyMessages); Android 3.10.1 has no matching API.

No TurboModule / codegen changes.

🧪 How to test?

Automated (CI / local):

  • yarn lint
  • yarn typecheck
  • yarn test --coverage
  • yarn check:circular

Manual (device or example app):

  1. Initialize with inAppHandler configured.
  2. Trigger a JSON-only in-app → handler receives message.jsonOnly === true.
  3. Trigger an HTML in-app → handler receives message.jsonOnly === false.
  4. Call Iterable.inAppManager.getMessages() / getInboxMessages() and confirm the same jsonOnly values for those messages.

🧾 Changelog

CHANGELOG.md Unreleased — Added IterableInAppMessage.jsonOnly so inAppHandler and in-app message fetches can distinguish JSON-only messages from HTML in-apps (SDK-750).

📹 Loom recording if applicable

N/A

🐞 Github Issues solved

None

📚 Docs PR if applicable

N/A (TypeDoc/JSDoc on IterableInAppMessage.jsonOnly only; no iterable-docs change required for this additive field).

Serialize the native JSON-only flag onto bridge dictionaries so inAppHandler
and message fetches can distinguish JSON-only in-apps from HTML messages.
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Lines Statements Branches Functions
Coverage: 72%
72.77% (604/830) 62.4% (244/391) 68.04% (181/266)

@qltysh

qltysh Bot commented Oct 1, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
New file Coverage rating: A
src/inApp/classes/IterableInAppMessage.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh

qltysh Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

All good ✅

Comment thread src/inApp/classes/IterableInAppMessage.ts
Always overwrite jsonOnly with a boolean after toJSONObject() so the bridge
does not forward native integer 1 to JS.
Use put(boolean) instead of putOpt so false is always written, and propagate
JSONException to existing handlers in onNewInApp and getMessages paths.
@jferrao-itrbl
jferrao-itrbl marked this pull request as ready for review October 8, 2026 07:49
@jferrao-itrbl
jferrao-itrbl requested a review from a team as a code owner October 8, 2026 07:49

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

Approved with one minor comment. Address or merge at will.

Comment thread src/inApp/classes/IterableInAppMessage.test.ts
Add Robolectric tests for Android getInAppMessageJson boolean overwrite and
Jest coverage for inAppHandler and getMessages jsonOnly payloads.
@jferrao-itrbl
jferrao-itrbl merged commit ac86101 into feature/SDK-548-feature-parity Oct 12, 2026
11 checks passed
@jferrao-itrbl
jferrao-itrbl deleted the feature/SDK-750-expose-json-only branch October 12, 2026 16:25
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