Skip to content

Conversation

@namArora3112
Copy link
Collaborator

@namArora3112 namArora3112 commented Aug 7, 2025

Description

https://jira.corp.adobe.com/browse/MOB-23860

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@namArora3112 namArora3112 marked this pull request as draft August 7, 2025 09:21
@namArora3112 namArora3112 force-pushed the proposition-item-class branch 2 times, most recently from db46fb6 to 45eb54a Compare August 19, 2025 09:50
@namArora3112 namArora3112 force-pushed the proposition-item-class branch from 45eb54a to 8e5f825 Compare August 19, 2025 09:54
@namArora3112 namArora3112 force-pushed the proposition-item-class branch from a166752 to 1ef7a89 Compare August 20, 2025 04:17
@namArora3112 namArora3112 marked this pull request as ready for review August 20, 2025 05:21
import { useRouter } from 'expo-router';

const SURFACES = ['android-cbe-preview', 'cbe/json', 'android-cc'];
const SURFACES = ['android-cbe-preview', 'android-cc', 'android-cc-naman'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these surfaces to be kept in the main branch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

// For class components, call initializeWithAppId inside componentDidMount.
MobileCore.setLogLevel(LogLevel.DEBUG);
MobileCore.initializeWithAppId("YOUR-APP-ID")
MobileCore.initializeWithAppId("3149c49c3910/4f6b2fbf2986/launch-7d78a5fd1de3-development")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the hardcoded appId

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@namArora3112 namArora3112 force-pushed the proposition-item-class branch from f6708a6 to 77a0b2d Compare August 25, 2025 07:03
}
// Resolve PropositionItem by UUID
if (uuid == null) {
Log.d(TAG, "[MessagingBridge] Null uuid provided; no-op.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write better log message, Remove no-op

for (Map.Entry<Surface, List<Proposition>> entry : propositionsMap.entrySet()) {
List<Proposition> propositions = entry.getValue();
if (propositions == null) continue;
for (Proposition p : propositions) {
Copy link
Contributor

@navratan-soni navratan-soni Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename p please

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


private final Map<String, Proposition> propositionItemByUuid = new ConcurrentHashMap<>();

private String extractActivityId(Proposition proposition) {
Copy link
Contributor

@navratan-soni navratan-soni Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Write a comment (doc) over method. Like : Parsing proposition and extracting activity ID from it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Map<String, Object> eventData = proposition.toEventData();
if (eventData == null) return null;
Object scopeDetailsObj = eventData.get("scopeDetails");
if (!(scopeDetailsObj instanceof Map)) return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add one more log here, like we did at bottom, in case of null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

try {
String key = extractActivityId(p);
if (key != null) {
propositionItemByUuid.put(key, p);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we put, proposition here, instead of proposition item, and put that in comment in code also.
(When we are declaring this object)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comments for the same

Copy link
Contributor

@ishita-gambhir-adobe ishita-gambhir-adobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the base branch of the PR from main. You can use this branch feat/messagingEnhancements-7.2.0
Please update the PR title as well.

Copy link
Contributor

@cacheung cacheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we marked deprecated to the old content card tracking API?
Make them deprecated or just remove that section in the Readme.


### Unified track

A unified tracking API is available for any proposition item (e.g., Content Cards, HTML, JSON, code-based items). Prefer calling `track` directly on the item.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too clear about "Prefer calling track directly on the item." what are you comparing this to?
Are we going to deprecated the
Messaging.trackContentCardDisplay(proposition, contentCard);
Messaging.trackContentCardInteraction(proposition, contentCard);

How about Start with the API

PropositionItem.track

A unified tracking API is available for any proposition item (Content Cards, HTML, JSON, code-based items). You can use the same track() method regardless of content type, making your code more consistent and maintainable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

propositionItem.track(MessagingEdgeEventType.DISPLAY);

// Overload 2: interaction + event + optional tokens
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Overload 2: international +...

// Track interaction with custom data
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
// Track with tokens for sub-item tracking
propositionItem.track('button_click', MessagingEdgeEventType.INTERACT, ['token-1', 'token-2']);
}
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (msgProp.items.length > 0) {
const propositionItem = msgProp.items[0];

// Overload 1: event only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove // Overload 1: event only

Use
// Track display event

(We have mentioned Overload 1 in the syntax, we can skip it in the example)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for (const surface of SURFACES_WITH_CONTENT_CARDS) {
const propositions = messages[surface] || [];

for (const proposition of propositions) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you plan to deprecate this method trackContentCardDisplay
let's just mark it and the we might also have to update the documentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes have added in the typescript and also in documentation too

*
* This mirrors the native Android PropositionItem class functionality.
*/
export class PropositionItem {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, can we add few test cases on the rn side for the new API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added tests

@namArora3112 namArora3112 changed the base branch from main to feat/messagingEnhancements-7.2.0 August 31, 2025 21:30
@namArora3112 namArora3112 changed the title proposition item classes, track funcitonality etc PropositionItem class added along with track functionality Aug 31, 2025
@namArora3112 namArora3112 changed the title PropositionItem class added along with track functionality PropositionItem class added along with unified track functionality Aug 31, 2025
Copy link
Contributor

@cacheung cacheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a minor format issue.

const propositionItem = msgProp.items[0];

// Track interaction with custom data
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there is an extra space before
// Track ....
"propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);"

They are not align with the next // Track ....

@namArora3112 namArora3112 merged commit 30ffaaf into feat/messagingEnhancements-7.2.0 Sep 2, 2025
5 checks passed
namArora3112 added a commit that referenced this pull request Sep 3, 2025
* PropositionItem class added along with unified track functionality  (#507)

* proposition item classes, track funcitonality etc

* proposition item uuid added

* json proposition item removed

* removed unused guide

* added htmlProposition , jsonPropositon item class

* removed unused apis of content card

* generatePropositionInteractionXdm removed

* ios implementation of track functionality

* uuid vs proposition  map added

* MessagingProposition class fixes

* get proposition for surfaces android fixes

* ios get proposition for surface fixes

* getproposition for surface updates

* MessagingView commented code removed

* removed proposition cache with parent

* clear cache in update proposition

* message util clean up

* proposition Item tracking usage refactored

* activityID extraction function reusable

* white space fixes

* added read me for track api usage

* removed unnecessary checks before calling track api for android native

* refactored extra null checks before calling track api at ios native side

* Addeed ios and android logs for null cases

* added comments and logs for android native code

* marked the trackContentCardInteraction and trackContentCardDisplay as deprecated

* added tests for propositionItem.track

* read me updated for proposition Item track usage

---------

Co-authored-by: Naman Arora <[email protected]>

* add handleJavascriptMessage in AEPMessaging (#519)

* Messaging - handle javascript message

* add js event listener and ios

* typecaste Message object

* address PR comments

* refactor log statements

* address PR comments

* revert env file id changes

* clear js handler when onDismiss is called

* messaging version bump for 7.2.0 release (#526)

* typecaste to Message object (#527)

* read me updates regarding deprecated apis

---------

Co-authored-by: namArora3112 <[email protected]>
Co-authored-by: Naman Arora <[email protected]>
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.

8 participants