npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@anagog/jedai

v1.22.0

Published

Anagog SDK ReactNative plugin. Use our ReactNative plugin to integrate our SDK in your ReactNative apps.

Downloads

170

Readme

IMPORTANT NOTE: This readme provides the minimal required steps for integration. For more detailed and explained documentation, you can find it on our website

  1. Integration
  2. Usage
  3. License

Integration

ReactNative

Requirements

  • ReactNative 0.63 and above

Install the SDK

npm install @anagog/jedai

iOS

Requirements

  • Xcode version 13.0 or newer.
  • iOS version 11.0 or newer.

Note: Xcode/Swift version depends on the SDK version. SDKs are always built with the latest Xcode version at the time of the release. If you need the SDK built to a specific version, please contact Anagog Customer Support, and we will provide it.

Xcode project

  1. Go to Signing & Capabilities tab and add the following capablities:
    • Background Modes: Background fetch and Remote notifications.
    • Access WiFi Information.
  2. Add the following entries to the Info.plist:
    • Permitted background task scheduler identifiers, and then add new item with the value com.anagog.jedai.sdk.refresh.
    • ANAGOG_API_KEY, and put API KEY that you received from Anagog.

AppDelegate.m

// TODO: Change JemaReactNativeSampleApp by your project name
#import "JemaReactNativeSampleApp-Swift.h"

@import JedAIReactNative;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [JedAIAppWrapper.shared start];
    return YES;
}

// For iOS 11 and iOS 12 only
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
    [JedAIAppWrapper.shared refresh];
    completionHandler(UIBackgroundFetchResultNewData);
}

// ...

@end

anagog_config.json

In cross-platform frameworks, Anagog SDK can be configured with the anagog_config.json file located in:

Android - In your android project assets folder android/src/main/assets/anagog_config.json iOS - In your root iOS project folder ios/anagog_config.json

More information you can find here

Android

Requirements

  • compileSdkVersion: 31
  • targetSdkVersion: 30
  • minSdkVersion: 21

project level build.gradle

buildscript {
    ext {
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 30
    }

	repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
  1. SDK Configuration in AndroidManifest.xml
    • Set SDK License Key
    • Foregraound service notification title string resourse
    • Foreground service notification message setring resourse
    • Foreground service notification icon resourse

AndroidManifest.xml


<application
        android:name=...
        android:theme="@style/AppTheme">

        <meta-data android:name="ANAGOG_API_KEY"
            android:value="api key as received from Anagog"/>

        <meta-data android:name="ANAGOG_NOTIFICATION_ICON"
            android:resource="@mipmap/ic_launcher_round"/>
    </application>
  1. Define foreground service string resources

strings.xml

<resources>
    ...
    <string name="anagog_foreground_title">notification title</string>
    <string name="anagog_foreground_message">notification body</string>

</resources>
  1. SDK Config json file
    • Create anagog_config.json file in project android/app/src/main directory
    • Add the following content with SDK configuration

anagog_config.json

{
    "userDefinedStats": {
      "Age" : "INTEGER",
      "Gender" : "STRING",
      "Score" : "DECIMAL",
      "AppLaunchCount": "INTEGER",
      "OnBoardingCompleted": "STRING"
    },
    "notificationChannelId": "AwesomeApp",
    "foregroundChannelId": "AwesomeApp_FG",
    "enableAudienceAnalytics" : true,
    "foregroundAlwaysOn" : false,
    "enableLatestMs": true,
    "enableCrashReports": true,
    "enableInternalLog" : true,
    "jedaiAutoEnabled" : true 
  }

Usage

Import

import { AnagogReactNative, ApplicationEvent, JEMAUserInteractionEvent, JEMAUserInteractionEventTriggerType, AnagogEventType, JedAIStatus } from '@anagog/jedai';

SDK Notifications

AnagogReactNative.obtainEventStream((action, payload) => {
	switch (action) {
		case AnagogEventType.onCampaignTriggered: {
			break;
		}
		case AnagogEventType.onNotificationClick: {
			var identifier = payload["campaign_identifier"];
			console.log('onNotificationClick Campaign Identifier:', identifier);
			var event = new JEMAUserInteractionEvent(identifier, JEMAUserInteractionEventTriggerType.conversion);
			AnagogReactNative.sendUserInteractionEvent(event);
			break;
		}
		case AnagogEventType.onSnapshotReport: {
			break;
		}
		case AnagogEventType.onJedAIStatusChange: {
			if (payload == JedAIStatus.active)
				console.log('JedAI is active');
			else if (payload == JedAIStatus.passive)
				console.log('JedAI is not running');
			break;
		}
	}
});

Campaigns

Note: Please do not use those APIs in production

// Download
AnagogReactNative.syncCampaigns()

// Simulate
AnagogReactNative.simulateCampaign() // - all
AnagogReactNative.simulateCampaign('campaignId') // - specific

// Get all available campaigns
let campaigns = await AnagogReactNative.getCampaigns();

Microsegments

// Fetch values
let name = await AnagogReactNative.getUserDefinedString('name');
let age = await AnagogReactNative.getUserDefinedInteger('age');
let score = await AnagogReactNative.getUserDefinedDecimal('score');

// Set values
AnagogReactNative.setUserDefinedString('name', 'Alesander');
AnagogReactNative.setUserDefinedInteger('age', 67);
AnagogReactNative.setUserDefinedDecimal('score', 97.5);

Micromoments

let micromoment = new ApplicationEvent('Registration');
micromoment.addTextParameter('Status', 'Completed');
AnagogReactNative.fireMicromoment(micromoment);

You can fire micromoment also this way:

let micromoment = new ApplicationEvent('Registration');
micromoment.addTextParameter('Status', 'Completed');
micromoment.fire();

Interaction events

let event = new JEMAUserInteractionEvent("campaignId", JEMAUserInteractionEventTriggerType.conversion);                            AnagogReactNative.sendUserInteractionEvent(event);

You can send user interaction event also this way:

let event = new JEMAUserInteractionEvent("campaignId", JEMAUserInteractionEventTriggerType.conversion);                            event.send();

Reports

// Force schedule reports
AnagogReactNative.forceScheduleReports();

//Request microsegments snapshot report
AnagogReactNative.requestMicrosegmentsSnapshotReport();

JedAI

// Start JedAI
// NOTICE: After calling thing method, JedAI will start automatically on each app start in foreground and background modes.
await AnagogReactNative.enableJedAI();

// Stop JedAI
// NOTICE: JedAI will not start even after app restart until you won't call 'startupJedAI' method.
await AnagogReactNative.disableJedAI();

// Get JedAI status
let status = await AnagogReactNative.getJedAIStatus();

// Share feedback
AnagogReactNative.share();

// Get JedAI SDK Version
let jedaiVersion = await AnagogReactNative.getVersion();

License

Anagog SDK is not open source software or public software. It is the proprietary software of Anagog Ltd. and, unless otherwise agreed in writing with Anagog Ltd., no rights are granted to you in respect of the SDK. This SDK is subject to, and may only be used in accordance with the terms of (and obligations imposed by) a separate commercial license agreement with Anagog Ltd.

You may not copy or use this SDK in any manner without first entering into an agreement with and obtaining a license from Anagog Ltd.

In order to request a license to use this SDK and an activation key from Anagog Ltd., please contact Anagog Ltd. directly at [email protected].

Anagog Ltd. reserves the right, in its sole discretion, to grant or reject requests for licenses to this SDK.