Socket
Socket
Sign inDemoInstall

@adobe/react-native-aepuserprofile

Package Overview
Dependencies
0
Maintainers
23
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @adobe/react-native-aepuserprofile

Adobe Experience Platform support for React Native apps.


Version published
Weekly downloads
2.1K
decreased by-50.16%
Maintainers
23
Created
Weekly downloads
 

Readme

Source

React Native Adobe Experience Platform User Profile Extension

npm version npm downloads

@adobe/react-native-aepcore is a wrapper around the iOS and Android Adobe Experience Platform User Profile Extension to allow for integration with React Native applications.

Prerequisites

The UserProfile extension has the following peer dependency, which must be installed prior to installing the UserProfile extension:

  • Core

Installation

See Requirements and Installation instructions on the main page

Install the @adobe/react-native-aepuserprofile package:

npm install @adobe/react-native-aepuserprofile

Usage

Initializing and registering the extension

Initializing the SDK should be done in native code, documentation on how to initialize the SDK can be found here.

Initialization Example

iOS

// AppDelegate.h
@import AEPCore;
@import AEPUserProfile;
...
@implementation AppDelegate

// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [AEPMobileCore setLogLevel: AEPLogLevelDebug];
    // register UserProfile extension
    [AEPMobileCore registerExtensions:@[AEPMobileUserProfile.class] completion:^{
        [AEPMobileCore configureWithAppId:@"yourAppID"];
    ...
   }];
   return YES;
 }

@end

Android

import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.UserProfile;

...
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.configureWithAppID("yourAppID");

    // register UserProfile extension
    MobileCore.registerExtensions(
        Arrays.asList(UserProfile.EXTENSION),
        o -> Log.d("MainApp", "Adobe UserProfile Mobile SDK was initialized.")
    )
  }
}
Importing the extension:

In your React Native application, import the UserProfile extension as follows:

import { UserProfile } from "@adobe/react-native-aepuserprofile";

API reference

extensionVersion

Returns the version of the User Profile extension

Syntax

extensionVersion(): Promise<string>

Example

UserProfile.extensionVersion().then((version) =>
  console.log("AdobeExperienceSDK: UserProfile version: " + version)
);

getUserAttributes

Gets the user profile attributes with the given keys.

Syntax

getUserAttributes(attributeNames: Array<string>): Promise<Record<string, any>>

Example

UserProfile.getUserAttributes(["mapKey", "mapKey1"]).then((map) =>
  console.log("AdobeExperienceSDK: UserProfile getUserAttributes: " + map)
);

removeUserAttributes

Removes the user profile attributes for the given keys.

Syntax

removeUserAttributes(attributeNames: Array<string>)

Example

UserProfile.removeUserAttributes(["mapKey1"]);

updateUserAttributes

Sets the user profile attributes key and value. It allows to create/update a batch of user profile attributes.

Syntax

updateUserAttributes(attributeMap: Record<string, any>)

Example

let attrMap = { mapKey: "mapValue", mapKey1: "mapValue1" };
UserProfile.updateUserAttributes(attrMap);

Keywords

FAQs

Last updated on 23 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc