-
Notifications
You must be signed in to change notification settings - Fork 35
Optimize - Update Proposition with callback support #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize - Update Proposition with callback support #496
Conversation
undefined, | ||
(response) => { | ||
console.log('Callback received:', response); | ||
setCallbackLog(JSON.stringify(response, null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace the hardcoded number literal with a constant that has a meaningful name? This will help improve code readability and make it easier for everyone to understand its purpose.
SDK Version:: {version} | ||
</Text> | ||
<Text style={styles.welcome}>Callback Log:</Text> | ||
<Text style={{...styles.text, fontFamily: 'monospace', backgroundColor: '#f0f0f0', padding: 10}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's extract these inline styles into a new codeText style object inside the styles file.
codeText: { fontFamily: 'monospace', backgroundColor: '#f0f0f0', padding: 10, },
packages/optimize/src/Optimize.ts
Outdated
for (const [key, value] of Object.entries(response.propositions)) { | ||
convertedPropositions[key] = new Proposition(value); | ||
} | ||
response.propositions = convertedPropositions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of mutating response.propositions directly, consider creating a new object using an immutable pattern. This helps avoid potential side effects from modifying native responses.
const finalResponse: UpdatePropositionsResponse = {
...response,
propositions: response.propositions
? Object.fromEntries(
Object.entries(response.propositions).map(
([key, value]) => [key, new Proposition(value)]
)
)
: undefined
};
callback(finalResponse);
undefined, | ||
(response) => { | ||
console.log('Callback received:', response); | ||
setCallbackLog(JSON.stringify(response, null, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there’s a possibility of null or undefined values, JSON.stringify might throw an error. You could consider wrapping it in a try-catch block for safety. But if you're certain the data will always be valid, it should be fine as is.
|
||
@ReactMethod | ||
public void updatePropositions(final ReadableArray decisionScopesArray, ReadableMap xdm, ReadableMap data) { | ||
public void updatePropositions(final ReadableArray decisionScopesArray, ReadableMap xdm, ReadableMap data, final Callback callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Annotate Callback as @nullable parameter here.
- Callback is now a mandatory parameter here, it needs to be passed as null if no usage is needed to user. Can this be refactored like this, if the API is being changed.
public void updatePropositions(final ReadableArray decisionScopesArray, ReadableMap xdm, ReadableMap data) { updatePropositions(decisionScopesArray, xdm, data, null) }
So both the APIs are available one with callback, and one without callback ?
…dk calls success and failure separately.
'eyJ4ZG06YWN0aXZpdHlJZCI6Inhjb3JlOm9mZmVyLWFjdGl2aXR5OjE0MWM4NTg2MmRiMDQ4YzkiLCJ4ZG06cGxhY2VtZW50SWQiOiJ4Y29yZTpvZmZlci1wbGFjZW1lbnQ6MTQxYzZkN2VjOTZmOTg2ZCJ9', | ||
); | ||
const decisionScopeTargetMbox = new DecisionScope('demoLoc3'); | ||
const decisionScopeTargetMbox = new DecisionScope('akhil-test-mbox'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this before merging to staging
…allback with AEPoptimize error response
response.putMap("propositions", propositionsWritableMap); | ||
} | ||
|
||
return response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we handling the case, where map is null or empty ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case it will return empty map.
…sdk-react-native into feat/updateProposition
public void removeListeners(Integer count) {} | ||
|
||
// Helper method to create callback response | ||
private WritableMap createCallbackResponse(final Map<DecisionScope, OptimizeProposition> propositionsMap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this to RCTAEPOptimizeUtil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the JS and Android sections. LGTM
[nit] Please move the helper functions to util classes.
…ns instead of objects
…ey in successCallback
getPropositions: (decisionScopes: Array<DecisionScope>) => Promise<Map<string, Proposition>> | ||
updatePropositions: (decisionScopes: Array<DecisionScope>, xdm?: Map<string, any>, data?: Map<string, any>) => void | ||
getPropositions: (decisionScopes: Array<DecisionScope>) => Promise<Map<string, Proposition>>; | ||
updatePropositions: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, it's better to return a Promise here. I also asked Copilot to share some thoughts.
Returning a Promise vs. Using Callbacks
Returning a Promise is generally better for modern JavaScript/TypeScript code because:
- It allows use of async/await, making code easier to read and maintain.
- It integrates more naturally with promise-based workflows and error handling (try/catch).
- It enables chaining and composition with other asynchronous operations.
Callback-based Approach is more traditional:
- It works well if you need to support environments where Promises aren’t available.
- However, it can lead to "callback hell" and less readable code when chaining multiple async operations.
Callback Style (current selection):
updatePropositions(scopes, xdm, data, (result) => {
// handle result
}, (error) => {
// handle error
});
Promise Style (recommended):
updatePropositions(scopes, xdm, data)
.then(result => { /* handle result */ })
.catch(error => { /* handle error */ });
Conclusion:
Yes, returning a Promise is typically better for usability, readability, and consistency with modern async patterns. You could refactor updatePropositions to return a Promise that resolves to the response or rejects with an error, instead of using callbacks. This would make the API more intuitive for developers using async/await.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed offline about the limitations that @akhiljain1907 mentioned around using Promise based approach here because of the requirement to invoke both the call
and fail
method asynchronously for the same single request. @yangyansong-adbe bought up a very good point that it would be hard for customers to manage this with callbacks on single-threaded javascript applications. How do you feel about using Promise and providing an array as a response, where you can have individual result or error for each decision scope in the request?
Hi @yangyansong-adbe and @spoorthipujariadobe, thanks a lot for reviewing. I also wanted to use a promise-based approach and I completely agree that, in general, returning a promise is cleaner than providing callbacks. However, after discussing with Spoorthi, here’s the limitation we ran into: in this API’s case, both the “call” and “fail” responses can occur asynchronously and independently. That means we might receive:
If we used a single promise, we could only resolve or reject once, which doesn’t work for scenarios where both outcomes can be present. The alternative would be to wait for both to complete and then resolve with an object containing both results — but that would require holding the API response until a timeout is reached, which: isn’t efficient (especially if one result arrives early) doesn’t work well here since React Native doesn’t currently expose a timeout configuration for this API (default is ~10s, which is too long to delay returning results) Because of these constraints, I went with two separate callbacks for success and error to ensure the caller gets results as soon as they’re available without unnecessary waiting. |
A single Promise can’t represent that because it can only resolve or reject once. So, I don't think there are any straightforward approaches to return a Promise in this case. I agree that the dual-callbacks is the simplest approach. |
2bce1fc
into
adobe:feat/Optimize_Enhancements
* Optimize - Update Proposition with callback support (#496) * initial commit for update proposition api enhancement * fixed error on clicking update proposition due to null or undefined callback. * removed redundant code from RCTAEPOptimize.m * fixed callback signature in api call in Optimize.ts and updated tests * used separate callback for success and error case as native android sdk calls success and failure separately. * tests fix and removed callbacklog from testapp * fixed iOS bridge code to call both success and error callbacks and test update * fixed android bridge to use AdobeCallbackWithError to provide error callback with AEPoptimize error response * removed error parameter from createCallBackResponse * changed public api signature to pass onSuccess and onError as functions instead of objects * moved createCallbackResponse method from RCTAEPOptimizeModule to RCTAEPOptimizeUtil * sending propositions map directly instead of sending under response key in successCallback * added type for AEPOptimizeError and returned AEpOptimizeError type in errorCallback * fixed index.js * add displayed and generateDisplayInteractionXDM APIs for multiple offers (#508) * add displayed API for multiple offers * add proposition id to Offer class * add ios impl for displayed api * add generateDisplayInteractionXDM and UTs * fix android build errors * use activity id as unique id for caching * update cache populate and clear logic * fix typos * add exception handling for android data reader util * fix ios bridge * add activity and placement fields to util methods * clean up test app * update documentation --------- Co-authored-by: Ishita Gambhir <igambhir@adobe.com>
* Down merge main into staging (#486) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * Down merge main to staging (#489) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * sync (#493) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> Co-authored-by: Ishita Gambhir <igambhir@adobe.com> * [MOB-23595] Upgraded lerna version from 4.0.0 to 8.2.2 (#492) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc * upgraded lerna version from 4.0.0 to 8.2.2 to fix vulnerabilities in package. * updated lerna.json to include app/* in packages. --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> Co-authored-by: Ishita Gambhir <igambhir@adobe.com> * Optimize: add APIs for displayed and generateDisplayInteractionXdm for multiple offers (#491) * add support for multiple display proposition in Optimize * android api call fix * update api usage, tests, docs * fix UTs * add support for generate display interaction xdm for multiple offers * preserve proposition weak reference * address PR comments * add constants in android * add handleJavascriptMessage in AEPMessaging (#497) * add handleJavascriptMessage in AEPMessaging * fix UTs * fix UTs * clear cache when message lifecycle ends * update docs * add constants * update docs * Revert "add handleJavascriptMessage in AEPMessaging (#497)" (#501) This reverts commit 5cc7329. * Revert "Optimize: add APIs for displayed and generateDisplayInteractionXdm fo…" (#502) This reverts commit e9890d3. * Main to staging (#515) * lerna version upgrade * Down merge main into staging (#486) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * Down merge main to staging (#489) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * sync (#493) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> Co-authored-by: Ishita Gambhir <igambhir@adobe.com> * [MOB-23595] Upgraded lerna version from 4.0.0 to 8.2.2 (#492) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- Co-authored-by: Naman Arora <namarora+adobe@adobe.com> * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- Co-authored-by: akhiljain1907 <akhiljain@adobe.com> --------- Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) * Down merge main into staging (#486) (#488) * expo CNG update (#480) * build error optimize read me updated * optimize note added * enable TVOS platform for Edge Bridge enable TVOS platform for Edge Bridge * update app podfile to the latest versions update app podfile to the latest versions * updated optimize read me for build errors * location services updates (#475) * location services updates * places version bump * Expo 52 sample app updated (#471) * expo 52 upgrade android build working * expo 52 ios fixes along with splash screen freeze issue fixes * pod file and yarn lock fixes * updated yarn lock and other copyright comment * added plugin for jetifier configuration * Remove android and ios folders from Git tracking for AEPSampleAppNewArchEnabled * ios and android folder added to git ignore * Revert "added plugin for jetifier configuration" This reverts commit de0ffb2. * added expo prebuild command * read me expo sample app updated --------- * expo simplification doc update (#473) * removed registeration of sdks * Update expo.md with expo to support CNG with static frameworks configuration * addressed review comments and made relevant changes in read me * Added a note for Expo support in Installation Guide. --------- --------- * Content cards tutorial (#482) * docs: 📝 adds content cards tutorial * diff * Content cards tutorial (#483) * docs: 📝 adds content cards tutorial * docs: 📝 adds docs for content card tracking * docs: update ContentCards tutorial to use trackContentCardInteraction methods from PR #477 (#485) --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * update node-version for npm publish workflow (#490) * update node-version for npm publish workflow * update nvmrc * upgraded lerna version from 4.0.0 to 8.2.2 to fix vulnerabilities in package. * updated lerna.json to include app/* in packages. --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> Co-authored-by: Ishita Gambhir <igambhir@adobe.com> --------- Co-authored-by: Ishita Gambhir <igambhir@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: akhiljain1907 <akhiljain@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * remove tutorial doc Tracking info will need to be updated. --------- Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Ishita Gambhir <igambhir@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com> * Feat- Optimize Enhancements (Callback and Batch Tracking) (#513) * Optimize - Update Proposition with callback support (#496) * initial commit for update proposition api enhancement * fixed error on clicking update proposition due to null or undefined callback. * removed redundant code from RCTAEPOptimize.m * fixed callback signature in api call in Optimize.ts and updated tests * used separate callback for success and error case as native android sdk calls success and failure separately. * tests fix and removed callbacklog from testapp * fixed iOS bridge code to call both success and error callbacks and test update * fixed android bridge to use AdobeCallbackWithError to provide error callback with AEPoptimize error response * removed error parameter from createCallBackResponse * changed public api signature to pass onSuccess and onError as functions instead of objects * moved createCallbackResponse method from RCTAEPOptimizeModule to RCTAEPOptimizeUtil * sending propositions map directly instead of sending under response key in successCallback * added type for AEPOptimizeError and returned AEpOptimizeError type in errorCallback * fixed index.js * add displayed and generateDisplayInteractionXDM APIs for multiple offers (#508) * add displayed API for multiple offers * add proposition id to Offer class * add ios impl for displayed api * add generateDisplayInteractionXDM and UTs * fix android build errors * use activity id as unique id for caching * update cache populate and clear logic * fix typos * add exception handling for android data reader util * fix ios bridge * add activity and placement fields to util methods * clean up test app * update documentation --------- Co-authored-by: Ishita Gambhir <igambhir@adobe.com> * Read Me update for update proposition api with callback (#514) * initial commit for update proposition api enhancement * fixed error on clicking update proposition due to null or undefined callback. * removed redundant code from RCTAEPOptimize.m * fixed callback signature in api call in Optimize.ts and updated tests * used separate callback for success and error case as native android sdk calls success and failure separately. * tests fix and removed callbacklog from testapp * fixed iOS bridge code to call both success and error callbacks and test update * fixed android bridge to use AdobeCallbackWithError to provide error callback with AEPoptimize error response * removed error parameter from createCallBackResponse * changed public api signature to pass onSuccess and onError as functions instead of objects * moved createCallbackResponse method from RCTAEPOptimizeModule to RCTAEPOptimizeUtil * sending propositions map directly instead of sending under response key in successCallback * added type for AEPOptimizeError and returned AEpOptimizeError type in errorCallback * fixed index.js * read me update * Version Update for 7.1.0 release (#517) * initial commit for update proposition api enhancement * fixed error on clicking update proposition due to null or undefined callback. * removed redundant code from RCTAEPOptimize.m * fixed callback signature in api call in Optimize.ts and updated tests * used separate callback for success and error case as native android sdk calls success and failure separately. * tests fix and removed callbacklog from testapp * fixed iOS bridge code to call both success and error callbacks and test update * fixed android bridge to use AdobeCallbackWithError to provide error callback with AEPoptimize error response * removed error parameter from createCallBackResponse * changed public api signature to pass onSuccess and onError as functions instead of objects * moved createCallbackResponse method from RCTAEPOptimizeModule to RCTAEPOptimizeUtil * sending propositions map directly instead of sending under response key in successCallback * added type for AEPOptimizeError and returned AEpOptimizeError type in errorCallback * fixed index.js * read me update * bumped optimize package version for 7.1.0 release --------- Co-authored-by: Ishita Gambhir <igambhir@adobe.com> Co-authored-by: namArora3112 <namarora@adobe.com> Co-authored-by: Calise Cheung <cacheung@adobe.com> Co-authored-by: Naman Arora <namarora+adobe@adobe.com> Co-authored-by: Daniel Soffiantini <dsoffiantini@gmail.com>
Added optional callback in update proposition api with onSuccess and onError to provide propositions as well as error(if any). Public Interface looks like-
updatePropositions: (
decisionScopes: Array,
xdm?: Map<string, any>,
data?: Map<string, any>,
onSuccess?: (response: Map<string, Proposition>) => void,
onError?: (error: AEPOptimizeError) => void
) => void;
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: