Skip to content

feat(SDK-804): IterableConfig.unknownUserHandler - #930

Merged
jferrao-itrbl merged 3 commits into
feature/SDK-548-uua-feature-parityfrom
feature/SDK-804-unknown-user-handler
Oct 22, 2026
Merged

jferrao-itrbl merged 3 commits into
feature/SDK-548-uua-feature-parityfrom
feature/SDK-804-unknown-user-handler

Conversation

@jferrao-itrbl

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

Copy link
Copy Markdown
Collaborator

📝 Summary

Expose IterableConfig.unknownUserHandler so JWT apps receive the native unknown user id before authHandler runs.

🎟️ Jira Ticket: SDK-804

📖 Description

Adds IterableConfig.unknownUserHandler and unknownUserHandlerPresent in toDict(), matching the native onUnknownUserCreated contract on iOS 6.7.5 and Android 3.10.1.

When the handler is set at Iterable.initialize, the iOS and Android bridges register an IterableUnknownUserHandler and emit handleUnknownUserCreatedCalled with { userId }. The JS layer invokes the config callback synchronously so integrators can stash the generated id before native requests a JWT via the existing authHandler (no TurboModule or authHandler signature changes).

TSDoc and tests document JWT pairing, omit logging the userId on handler errors, and leave onCriteriaReceived / onCriteriaFetchFailed unimplemented per ticket scope.

🧪 How to test?

  • yarn typecheck
  • yarn lint
  • yarn check:circular
  • yarn test (includes unknownUserHandler cases in Iterable.test.ts)
  • Manual JWT UUA: enable UUA + consent, set unknownUserHandler to store userId, return a token for that id from authHandler (example harness: SDK-811)

🧾 Changelog

Added Unreleased entry in CHANGELOG.md for IterableConfig.unknownUserHandler (SDK-804).

📹 Loom recording if applicable

N/A

🐞 Github Issues solved

N/A

📚 Docs PR if applicable

N/A

Emit handleUnknownUserCreatedCalled so apps store the generated id before authHandler.
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Lines Statements Branches Functions
Coverage: 72%
72.84% (609/836) 62.37% (242/388) 68.16% (182/267)

@qltysh

qltysh Bot commented Oct 22, 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/core/classes/Iterable.ts88.9%1317
Total88.9%
🤖 Increase coverage with AI coding...
In the `feature/SDK-804-unknown-user-handler` branch, add test coverage for this new code:

- `src/core/classes/Iterable.ts` -- Line 1317

🚦 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.

Use shared mock EventEmitter listenerCount instead of emit-not-throwing.
@jferrao-itrbl
jferrao-itrbl marked this pull request as ready for review October 22, 2026 10:55
@jferrao-itrbl
jferrao-itrbl requested a review from a team as a code owner October 22, 2026 10:55

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

Approving with one non-blocking suggestion.
Depending on the likelihood of adoption of verbatim guidance, it could be upgraded to blocking instead.

Comment thread src/core/classes/IterableConfig.ts
Consume the cached id on each auth call so later JWT minting uses getUserId().
@jferrao-itrbl
jferrao-itrbl merged commit 1402287 into feature/SDK-548-uua-feature-parity Oct 22, 2026
11 checks passed
@jferrao-itrbl
jferrao-itrbl deleted the feature/SDK-804-unknown-user-handler branch October 22, 2026 19:22
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