-
Notifications
You must be signed in to change notification settings - Fork 38
Added APIs for Consent extension #80
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0a54039
Consent - add Android + JS APIs, update sample app
emdobrin 5595213
Consent - sample app styling
emdobrin 4921d3a
Consent - iOS API updates, update examples on sample app
emdobrin 9e91beb
Consent - update typescript def and tests
emdobrin 7cb26cd
Consent - update documentation
emdobrin 4ec1adc
Consent - docs updates
emdobrin 1f1a359
Consent - reject with AEPError
emdobrin da7d876
Consent - add to main readme
emdobrin f886116
Consent - review update sample app
emdobrin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,85 @@ | ||
|
|
||
| # React Native AEP Consent for Edge Network Extension | ||
| # React Native Consent for Edge Network Extension | ||
|
|
||
| // todo | ||
| [](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) | ||
| [](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) | ||
|
|
||
| `@adobe/react-native-aepedgeconsent` is a wrapper for the iOS and Android [Consent for Edge Network extension](https://aep-sdks.gitbook.io/docs/foundation-extensions/consent-for-edge-network) to allow for integration with React Native applications. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| The Consent for Edge Network extension has the following peer dependency, which must be installed prior to installing the Consent extension: | ||
| - [Core](../core/README.md) | ||
|
|
||
| ## Installation | ||
|
|
||
| See [Requirements and Installation](https://github.com/adobe/aepsdk-react-native#requirements) instructions on the main page. | ||
|
|
||
| Install the `@adobe/react-native-aepedgeconsent` package: | ||
|
|
||
| ```bash | ||
| cd MyReactApp | ||
| npm install @adobe/react-native-aepedgeconsent | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Installing and registering the extension with the AEP Mobile Core | ||
| Install the Consent extension in your mobile property and configure the default consent preferences by following the steps in the [Consent for Edge Network extension documentation](https://aep-sdks.gitbook.io/docs/foundation-extensions/consent-for-edge-network). | ||
|
|
||
| Then follow the same document for registering the Consent extension with the Mobile Core. | ||
| Note that initializing the SDK should be done in native code, additional documentation on how to initialize the SDK can be found [here](https://github.com/adobe/aepsdk-react-native#initializing). | ||
|
|
||
| ### Importing the extension | ||
| In your React Native application, import the AEPConsent extension as follows: | ||
| ```javascript | ||
| import {AEPConsent} from '@adobe/react-native-aepedgeconsent'; | ||
| ``` | ||
|
|
||
| ## API reference | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also let me know what you think about having a separate API reference section/page. This example follows the GitBook doc format with syntax + example. |
||
|
|
||
| ### extensionVersion | ||
| Returns the version of the AEPConsent extension | ||
|
|
||
| **Syntax** | ||
| ```javascript | ||
| static extensionVersion(): Promise<string> | ||
| ``` | ||
|
|
||
| **Example** | ||
| ```javascript | ||
| AEPConsent.extensionVersion().then(version => console.log("AEPConsent.extensionVersion: " + version)); | ||
| ``` | ||
|
|
||
| ### getConsents | ||
| Retrieves the current consent preferences stored in the Consent extension and resolves the promise with the current consent preferences or rejects it if an unexpected error occurs or the request timed out. | ||
| Output example: {"consents": {"collect": {"val": "y"}}} | ||
|
|
||
| **Syntax** | ||
| ```javascript | ||
| static getConsents(): Promise<{string: any}> | ||
| ``` | ||
|
|
||
| **Example** | ||
| ```javascript | ||
| AEPConsent.getConsents().then(consents => { | ||
| console.log("AEPConsent.getConsents returned current consent preferences: " + JSON.stringify(consents)); | ||
| }).catch((error) => { | ||
| console.warn("AEPConsent.getConsents returned error: ", error.message); | ||
| }); | ||
| ``` | ||
|
|
||
| ### update | ||
| Merges the existing consents with the given consents. Duplicate keys will take the value of those passed in the API. | ||
| Input example: {"consents": {"collect": {"val": "y"}}} | ||
|
|
||
| **Syntax** | ||
| ```javascript | ||
| static update(consents: {string: any}) | ||
| ``` | ||
|
|
||
| **Example** | ||
| ```javascript | ||
| var consents: {[keys: string]: any} = {"consents" : {"collect" : {"val": "y"}}}; | ||
| AEPConsent.update(consents); | ||
| ``` | ||
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
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
Oops, something went wrong.
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.
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.
When we point the user to this doc, react user might not know they should use the Objective C setup instead of swift. We should point that out to use the Objective-C setup.
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.
👍 Good point, we will clarify that in the GitBook page soon.