Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/AEPSampleApp/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Core from './extensions/Core';
import Identity from './extensions/Identity';
import Messaging from './extensions/Messaging';
import EdgeIdentity from './extensions/EdgeIdentity';
import Edge from './extensions/Edge';
import EdgeView from './extensions/EdgeView';
import Assurance from './extensions/Assurance';

function HomeScreen({ navigation }) {
Expand All @@ -29,7 +29,7 @@ function HomeScreen({ navigation }) {
onPress={() => navigation.navigate('Messaging')}
title="Messaging"/>
<Button
onPress={() => navigation.navigate('Edge')}
onPress={() => navigation.navigate('EdgeView')}
title="Edge"
/>
<Button
Expand All @@ -56,7 +56,7 @@ export default function App() {
<Drawer.Screen name="Identity" component={Identity} />
<Drawer.Screen name="Messaging" component={Messaging}/>
<Drawer.Screen name="EdgeIdentity" component={EdgeIdentity} />
<Drawer.Screen name="Edge" component={Edge} />
<Drawer.Screen name="EdgeView" component={EdgeView} />
<Drawer.Screen name="Assurance" component={Assurance} />
</Drawer.Navigator>
</NavigationContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,21 @@ public void onCreate() {
com.adobe.marketing.mobile.Identity.registerExtension();
com.adobe.marketing.mobile.edge.identity.Identity.registerExtension();
Lifecycle.registerExtension();
Signal.registerExtension();
Signal.registerExtension();
Edge.registerExtension();
Messaging.registerExtension();
Assurance.registerExtension();
MobileCore.configureWithAppID("your-app-ID");
MobileCore.start(new AdobeCallback() {
@Override
public void call(Object o) {
MobileCore.lifecycleStart(null);
}
});
} catch (InvalidInitException e) {
e.printStackTrace();
}

MobileCore.configureWithAppID("your-app-ID");
MobileCore.start(new AdobeCallback() {
@Override
public void call(Object o) {
MobileCore.lifecycleStart(null);
}
});
}

/**
Expand Down
67 changes: 0 additions & 67 deletions apps/AEPSampleApp/extensions/Edge.js

This file was deleted.

68 changes: 68 additions & 0 deletions apps/AEPSampleApp/extensions/EdgeView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright 2021 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.

@flow
@format
*/

import React, {Component, useState} from 'react';
import {Button, StyleSheet, Text, View, ScrollView} from 'react-native';
import {Edge, ExperienceEvent, EdgeEventHandle} from '@adobe/react-native-aepedge';

export default EdgeView = ({ navigation }) => {
const [version, setVersion] = useState('');
const [eventHandles, setEventHandles] = useState('');

Edge.extensionVersion().then(version => setVersion(version));

function sendEvent(datasetId: String) {
var xdmData = {"eventType" : "SampleXDMEvent"};
var data = {"free": "form", "data": "example"};
var experienceEvent = new ExperienceEvent(xdmData, data, datasetId);

Edge.sendEvent(experienceEvent).then(eventHandles => {
let eventHandlesStr = JSON.stringify(eventHandles);
console.log("AdobeExperienceSDK: EdgeEventHandles = " + eventHandlesStr);
setEventHandles(eventHandlesStr);
});
}

return (
<View style={styles.container}>
<ScrollView contentContainerStyle={{ marginTop: 75 }}>
<Button onPress={() => navigation.goBack()} title="Go to main page" />
<Text style={styles.welcome}>Edge v{version}</Text>
<Button title="sendEvent()" onPress={() => sendEvent()}/>
<Button title="sendEvent() to Dataset" onPress={() => sendEvent("datasetIdExample")}/>
<Text style={styles.text}>Response event handles: {eventHandles}</Text>
</ScrollView>
</View>
)
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 22,
textAlign: 'center',
margin: 10,
},
text: {
fontSize: 15,
textAlign: 'center',
margin: 5,
},
});
4 changes: 2 additions & 2 deletions apps/AEPSampleApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
FBReactNativeSpec: cdd6f1f8ca74a9d33e4a3727af16caa19a9fae91
FBReactNativeSpec: 1c7a65a3d96b0ee9fda1231b96c9af87471866a3
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
RCTAEPAssurance: 419c28c8d04829cdf40b802ed5227e7ab039c329
Expand Down Expand Up @@ -547,4 +547,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 2a644d6b375e7638e06413c828ae75a91d8f8598

COCOAPODS: 1.10.1
COCOAPODS: 1.11.2
121 changes: 35 additions & 86 deletions packages/edge/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# React Native AEP Edge Network
# React Native Adobe Experience Platform Edge Network extension

[![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedge.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedge)
[![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedge)](https://www.npmjs.com/package/@adobe/react-native-aepedge)
Expand All @@ -24,126 +24,75 @@ npm install @adobe/react-native-aepedge
```
## Usage

### [Adobe Experience Platform Edge Network](https://aep-sdks.gitbook.io/docs/foundation-extensions/experience-platform-extension)
### Installing and registering the extension with the AEP Mobile Core

### Initializing:
Install the Adobe Experience Platform Edge Network extension in your mobile property and configure the default Datastream ID by following the steps in the [Edge Network extension documentation](https://aep-sdks.gitbook.io/docs/foundation-extensions/experience-platform-extension).

Initializing the SDK should be done in native code, documentation on how to initialize the SDK can be found [here](https://github.com/adobe/aepsdk-react-native#initializing).
Then follow the same document for registering the Edge 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).

Example:

iOS
```objectivec
@import AEPCore;
@import AEPLifecycle;
@import AEPEdge;
@import AEPEdgeIdentity;
...
@implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AEPMobileCore setLogLevel: AEPLogLevelDebug];
[AEPMobileCore configureWithAppId:@"yourAppID"];
[AEPMobileCore registerExtensions: @[AEPMobileLifecycle.class, AEPMobileEdge.class, AEPMobileEdgeIdentity.class
] completion:^{
[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];
}
];
### Importing the extension
In your React Native application, import the Edge extension as follows:
```javascript
import {Edge, ExperienceEvent} from '@adobe/react-native-aepedge';
```

return YES;
}
## API reference
### extensionVersion

@end
```javascript
Edge.extensionVersion().then(version => console.log("AdobeExperienceSDK: Edge version: " + version));
```

Android
```java
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.InvalidInitException;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Edge;
import com.adobe.marketing.mobile.edge.identity;

...
import android.app.Application;
...
public class MainApplication extends Application implements ReactApplication {
...
@Override
public void on Create(){
super.onCreate();
...
MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
MobileCore.setWrapperType(WrapperType.REACT_NATIVE);

try {
Edge.registerExtension();
Identity.registerExtension();
Lifecycle.registerExtension();
MobileCore.configureWithAppID("yourAppID");
MobileCore.start(new AdobeCallback() {
@Override
public void call(Object o) {
MobileCore.lifecycleStart(null);
}
});
} catch (InvalidInitException e) {
...
}
}
}
```
### sendEvent

#### Importing the extension:
**Syntax**
```javascript
import {AEPEdge, AEPExperienceEvent} from '@adobe/react-native-aepedge';
static sendEvent(experienceEvent: ExperienceEvent): Promise<EdgeEventHandle>;
```

##### Getting the extension version:

**Example**
```javascript
AEPEdge.extensionVersion().then(version => console.log("AdobeExperienceSDK: AEPEdge version: " + version));
var xdmData = {"eventType" : "SampleXDMEvent"};
var data = {"free": "form", "data": "example"};
let experienceEvent = new ExperienceEvent(xdmData, data);

// send ExperienceEvent ignoring the promise
Edge.sendEvent(experienceEvent);

// send ExperienceEvent with promise
Edge.sendEvent(experienceEvent).then(eventHandles => console.log("Edge.sentEvent returned EdgeEventHandles = " + JSON.stringify(eventHandles)));
```

### Public classes
#### ExperienceEvent

##### Create Experience Event from Dictionary:

```javascript
var xdmData = {"eventType" : "SampleXDMEvent"};
let experienceEvent = new AEPExperienceEvent(xdmData);
let experienceEvent = new ExperienceEvent(xdmData);
```

##### Add free form data to the Experience event:

```javascript
var xdmData = {"eventType" : "SampleXDMEvent"};
var data = {"free": "form", "data": "example"};
let experienceEvent = new AEPExperienceEvent(xdmData, data);
let experienceEvent = new ExperienceEvent(xdmData, data);
```

##### Set the destination Dataset identifier to the current Experience event:

```javascript
var xdmData = {"eventType" : "SampleXDMEvent"};
let experienceEvent = new AEPExperienceEvent(xdmData, null, "datasetIdExample")
let experienceEvent = new ExperienceEvent(xdmData, null, "datasetIdExample")
```

##### Create Experience Event with xdmdata, free form data and the destination Dataset identifier:

```javascript
var xdmData = {"eventType" : "SampleXDMEvent"};
var data = {"dataKey" : "dataValue"};
let experienceEvent = new AEPExperienceEvent(xdmData, data, "datasetIdExample")
```

#### Send an Experience Event:

```javascript
AEPEdge.sendEvent(experienceEvent)
```

#### Send an Experience Event with Event Handle Promise:

```javascript
AEPEdge.sendEvent(experienceEvent).then(eventHandle => console.log("AdobeExperienceSDK: AEPEdgeEventHandle = " + JSON.stringify(eventHandle)));
let experienceEvent = new ExperienceEvent(xdmData, data, "datasetIdExample")
```
Loading