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

@getmageio/react-native-mage

v1.1.0

Published

Automatically and simultaneously test and optimize in-app purchase prices in 170+ app store countries. You do not need to hire data scientists to take your pricing to the next level. Just use the Mage SDK. Sign up for free!

Downloads

19

Readme

Mage React Native SDK

Distributing products globally should not be a one price fits all strategy. Get started with Mage to scale your products worldwide!

Before implementing the SDK please read and complete the integration guide on our website.

Requirements

Please note that our SDK currently just works on iOS 11 and up.

Getting started

$ npm install @getmageio/react-native-mage --save

On iOS run $ cd ios && pod install && cd .. to install the native dependencies

Usage

1) Import the React Native Mage SDK

import {Mage} from '@getmageio/react-native-mage'

2) Set the API Key

Mage.setOptions({
  // Set your API key
  apiKey: "YOUR_API_KEY",
  // Indicate if your app is running on a consumer device.
  // Please not that production should not be set to true if your app runs on real testing devices!
  // Default: false
  production: true,
  // Optional: strict mode. The SDK will crash when errors occur.
  // This way you can test if you set up the SDK correctly!
  // Default: false
  strict: false
})

3) Get your in app purchase IDs

Wherever you show in app purchases, call getIdFromProductName to get the correct in app purchase ID. This could be, for example, somewhere in your ViewController for your store view / popup.

Mage.getIdFromProductName("myProduct", "com.myapp.myFallBackID", (inAppPurchaseId) => {
  // work with inAppPurchaseId 
})

4) Know what you sold

In some cases, you might want to know what the user bought so you can send it to a CRM, your own backend or for some custom logic inside your app. getProductNameFromId will help you out!

Mage.getProductNameFromId("com.myapp.someIapID", (err, productName) => {
  if(!err){
    // work with productName 
  }
})

5) Identify the user for our Subscription Lifetime Value Tracking (optional)

Subscription status tracking is usually done on your backend or by some third party service. Apple or Google sends real-time subscription status updates that you interpret and take action on. This is why we provide a simple Web API to enable subscription lifetime value tracking for Mage. Apple or Google contacts your backend, your backend contacts Mage.

This way, we can adequately track the durations of your subscriptions and identify free trial and introductory price offer conversion rates. To make this feature work, you need to implement the setUserIdentifier method so that we can identify the calls from your backend. Learn more about our Subscription Lifetime Value Tracking Feature.

Mage.setUserIdentifier("myUserIdentifier")

6) Report purchases (Android only)

On iOS there is no need to report a purchase since that is handled automatically. However auto-purchase tracking is not yet implemented in our Android Java SDK. Whenever a user makes a purchase you need to report it.

if (Platform.OS === 'android'){
  Mage.userPurchased("com.myapp.someIapID")
}