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

insert-affiliate-react-native-sdk

v1.0.0

Published

A package that will give context having implementation of react-native-branch and react-native-iap and iaptic validate api.

Downloads

9

Readme

InsertAffiliateReactNative SDK

Overview

The InsertAffiliateReactNative SDK is designed for React Native applications, providing seamless integration with the Insert Affiliate platform. This SDK enables functionalities such as managing affiliate links, handling in-app purchases (IAP), and utilising deep links. For more details and to access the Insert Affiliate dashboard, visit app.insertaffiliate.com.

Features

  • Unique Device Identification: Generates and stores a short unique device ID to identify users effectively.
  • Affiliate Identifier Management: Set and retrieve the affiliate identifier based on user-specific links.
  • In-App Purchase (IAP) Initialisation: Easily reinitialise in-app purchases with validation options using the affiliate identifier.
  • Offer Code Handling: Fetch offer codes from the Insert Affiliate API and open redeem URLs directly in the App Store.

Peer Dependencies

Before using this package, ensure you have the following dependencies installed:

Installation

To integrate the InsertAffiliateReactNative SDK into your project, run:

npm install insert-affiliate-react-native-sdk

Usage

Importing the SDK

Import the provider from the package:

import { DeepLinkIapProvider } from 'insert-affiliate-react-native-sdk';

1. Integrating the Provider in Your Application (App.tsx)

Step 1: Wrap Your Application with the Iaptic Provider and Pass Context Properties

  • Replace {{ your_iaptic_app_id }} with your Iaptic App ID. You can find this here.
  • Replace {{ your_iaptic_app_name }} with your Iaptic App Name. You can find this here.
  • Replace {{ your_iaptic_secret_key }} with your Iaptic Secret Key. You can find this here.

Here's the code with placeholders for you to swap out:

const App = () => {
  return (
    <DeepLinkIapProvider
      iapSkus={IAP_SKUS}
      iapticAppId="{{ your_iaptic_app_id }}"
      iapticAppName="{{ your_iaptic_app_name }}"
      iapticAppSecret="{{ your_iaptic_app_id }}">
      <Child />
    </DeepLinkIapProvider>
  );
};

2. When the User Makes a Purchase, Call Our SDK's "handleBuySubscription"

Here’s a complete example of how to use the SDK:

In the code below, please remember to update your IAP_SKUS with the comma separated list of your in app purchase SKU's.

import React from 'react';
import { ActivityIndicator, Button, StyleSheet, Text, View } from 'react-native';
import { DeepLinkIapProvider, useDeepLinkIapProvider } from 'insert-affiliate-react-native-sdk';

const Child = () => {
  const {
    referrerLink,
    subscriptions,
    iapLoading,
    handleBuySubscription,
    userId,
    userPurchase,
    isIapticValidated,
  } = useDeepLinkIapProvider();

  export const IAP_SKUS = Platform.select({
    android: [''], // Here, put a comma separated list of the In App Purchase SKU's
    ios: [''], // Here, put a comma separated list of the In App Purchase SKU's
  }) as string[];


  return (
    <View>
      {subscriptions.length ? (
        <Button
          disabled={iapLoading}
          title={
            userPurchase
              ? `Successfully Purchased`
              : `Click to Buy (${subscriptions[0].localizedPrice} / ${subscriptions[0].subscriptionPeriodUnitIOS})`
          }
          onPress={() => {
            if (iapLoading) return;
            if (!userPurchase) handleBuySubscription(subscriptions[0].productId); //
          }}
        />
      ) : null}
      {iapLoading && <ActivityIndicator size={'small'} color={'black'} />}
    </View>
  );
};

const App = () => {
  return (
    // Wrapped application code from the previous step...
    <DeepLinkIapProvider
      iapSkus={IAP_SKUS}
      iapticAppId="IAPTIC_APP_BUNDLE_IDENTIFIER"
      iapticAppName="IAPTIC_APP_NAME"
      iapticAppSecret="IAPTIC_APP_SECRET_KEY">
      <Child />
    </DeepLinkIapProvider>
  );
};

export default App;