MOEN-44005 Personalize#107
Merged
Merged
Conversation
Contributor
msoumya-engg-sdk
left a comment
There was a problem hiding this comment.
Verification Review
This PR was verified against:
- Contract: mobile-sdk-contracts#29
- Tech doc: Personalize Experience - Hybrid SDK Implementation
- Existing module coding standards (
cards,inbox,core)
Contract Alignment — mostly correct
- Public API signatures, JSON payload shapes (singular vs plural), Promise-vs-fire-and-forget patterns, and error handling paths all align with the tech doc and contract PR.
- 2 model-level deviations flagged inline:
ExperienceCampaign.experienceContexttyped asRecord<string, any>instead ofRecord<string, string>(contract violation).ExperienceCampaignFailure.messagefield is not in the contract/tech doc.
Coding Standards — significant gaps vs cards module
- No
MoEngageLoggerusage anywhere — parser uses rawconsole.warn; handler and public API have zero logging. Thecardsmodule demonstrates the established pattern (verbose at entry, debug for init, error on failure). - No
MODULE_TAGconstant and no per-classTAGstrings for log prefixes. - Handler is standalone functions — cards uses a class with private TAG/appId.
- Constants naming diverges (UPPER_CASE vs the
key-prefixed camelCase in cards). package.jsonfilesfield contains phantom entries and is missing key exclusions.
Test Coverage — gaps identified
- Parser:
Array.isArray(...)else-branches, missingdatakey, malformed JSON forparseExperiencesResult, unknown source per-experience. - Public API:
fetchExperiences(keys, attrs)with explicit attrs not tested; resolved Promise values never asserted. - Handler: parsed-field round-trip not verified (only array lengths).
- PayloadBuilder: empty-input edge cases untested.
Missing Component
- No Android native bridge code present. Please confirm whether this is a separate follow-up PR.
Inline comments on specific lines/files provide concrete suggested fixes for each item.
Generated by Claude Code
Contributor
msoumya-engg-sdk
left a comment
There was a problem hiding this comment.
Follow-up Review: Coding Standards & Logging Gaps
This is a follow-up to the prior verification review, adding inline comments for issues 2–10 from the earlier "not added" list, plus additional logging gaps identified across the module.
Coding standards deviations (vs. cards reference module)
- Public API uses
classinstead of the repo-standardnamespace— flagged for team discussion - Internal filenames are prefixed with
MoEPersonalize*(redundant insideinternal/) - No
internal/utils/subdirectory for utility helpers - Native bridge registered as
'MoEReactPersonalize'(older pattern) vs. cards''MoEngageCardsBridge' - Parser file combines extraction + mapping — cards splits these into two files
- Models have no JSDoc (
@author/@since) tags - Type style uses
Record<string, any>instead of the codebase-standard{ [k: string]: any } - Extra
babel-jestdevDependency not present in other modules ExperienceCampaignFailure.reasontyped asstring— loses compile-time safety over known failure reasons; suggested string-literal union
Logging gaps (additional to the previous review)
- iOS native handler (
MoEReactNativePersonalizeHandler.m) — zero logging. No entry traces, no error logging on the rejection path, no logging onNSJSONSerializationfailure, duplicated resolve/reject code betweenfetchExperiencesMetaandfetchExperiencesthat should be extracted into a helper with centralized logging. - Parser — doesn't log entry traces, malformed-payload warnings, or missing-field warnings. Silent defaults hide server/bridge issues.
- PayloadBuilder → Handler — the outgoing JSON payload and native response are not logged anywhere on the JS side, making the bridge flow entirely opaque in debug traces. At minimum, the handler should log payload-in / response-out at
verbose. serializeCampaign— no warning whenpayloadorexperienceContextisnull/undefined; malformed inputs produce silently-broken wire payloads.
Inline comments contain concrete suggested fixes for each item.
Generated by Claude Code
msoumya-engg-sdk
requested changes
Apr 15, 2026
cleaned code
Contract alignment: - experienceContext: Record<string, any> to Record<string, string> (matches proto) - Remove message field from ExperienceCampaignFailure (not in contract) - Add ExperienceFailureReason string literal union (8 server reasons) - Parser validates unknown reasons with fallback to PERSONALIZATION_FAILED Cards-pattern alignment: - MoEngageLogger replaces console.warn across parser, handler, builder - MODULE_TAG + keyXxx constants (keyData, keyExperienceKey, etc.) - Handler refactored from standalone functions to class with try/catch + error logging - Public API: verbose entry trace on every method, debug in constructor Naming conventions: - TS renames: Constants.ts, MoEngagePersonalizeHandler.ts, utils/PayloadParser.ts, utils/PayloadBuilder.ts - iOS bridge: MoEReactPersonalize to MoEngagePersonalizeBridge (class + files) - TurboModule registration updated to match iOS handler improvements: - NSLog entry traces on all methods - resolveResponse helper extracted (removes fetch duplication) - parsePayload helper with nil guard + logging Package hygiene: - files field cleaned (remove phantom lib/cpp, add __tests__ exclusion) - babel-jest removed (unused with ts-jest preset) Test coverage: - Parser: missing data key, non-array branches, unknown source/reason, malformed JSON, missing fields - Handler: deep field round-trip assertions - Public API: return-value plumbing, explicit attrs forwarding - PayloadBuilder: empty-input edge cases JSDoc: @author MoEngage + @SInCE 1.0.0 on all model classes and fields
1f660e6 to
99e3f4d
Compare
msoumya-engg-sdk
approved these changes
Apr 16, 2026
* MOEN-44095: Support for personalize API in React-Native Android
cdaf891 to
d7388fa
Compare
d7388fa to
87f461f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Ticket
https://moengagetrial.atlassian.net/browse/MOEN-44005
Description
Added personalize feature module and support