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 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-rustore-subscriptions

v0.1.3

Published

Expo module for Ru Store subscriptions integration

Readme

expo-rustore-subscriptions

Expo модуль для интеграции подписок RuStore (VK) в React Native приложения.

📦 Установка

npm install expo-rustore-subscriptions
# или
yarn add expo-rustore-subscriptions

⚙️ Конфигурация

1. Добавьте плагин в app.json или app.config.js

// app.config.js
module.exports = {
  expo: {
    plugins: ['expo-rustore-subscriptions'],
  },
};

2. Пересоберите нативный код

⚠️ Важно: После установки плагина обязательно выполните:

npx expo prebuild --clean
npx expo run:android

Это необходимо для корректного добавления Maven-репозитория RuStore в проект.

🚀 Использование

Базовый пример

import ExpoRuStore from 'expo-rustore-subscriptions';
import { useEffect } from 'react';

function App() {
  useEffect(() => {
    // 1. Инициализация
    ExpoRuStore.initialize('YOUR_PROJECT_ID')
      .then(() => console.log('✅ RuStore initialized'))
      .catch(err => console.error('❌ Init error:', err));

    // 2. Подписка на события
    const purchaseSubscription = ExpoRuStore.onPurchaseCompleted((data) => {
      console.log('Покупка успешна:', data);
      // data: { productId, purchaseToken, orderId, purchaseState }
    });

    const errorSubscription = ExpoRuStore.onPurchaseFailed((error) => {
      console.error('Ошибка покупки:', error);
    });

    return () => {
      purchaseSubscription.remove();
      errorSubscription.remove();
    };
  }, []);

  // 3. Кнопка покупки
  const handlePurchase = async () => {
    try {
      await ExpoRuStore.purchaseSubscription('premium_monthly');
      // Откроется нативное меню RuStore
    } catch (error) {
      console.error('Ошибка:', error);
    }
  };

  return (
    <Button title="Купить подписку" onPress={handlePurchase} />
  );
}

📚 API

Методы

initialize(projectId: string): Promise<void>

Инициализация RuStore Billing Client.

await ExpoRuStore.initialize('12345');

purchaseSubscription(productId: string): Promise<void>

Открывает нативное меню покупки RuStore.

await ExpoRuStore.purchaseSubscription('premium_monthly');

restorePurchases(): Promise<void>

Восстанавливает предыдущие покупки пользователя.

await ExpoRuStore.restorePurchases();

getProducts(productIds: string[]): Promise<void>

Загружает информацию о продуктах.

await ExpoRuStore.getProducts(['premium_monthly', 'premium_yearly']);

События

onPurchaseCompleted(callback)

Вызывается при успешной покупке.

ExpoRuStore.onPurchaseCompleted((data: PurchaseResult) => {
  console.log(data.productId, data.purchaseToken);
});

onPurchaseFailed(callback)

Вызывается при ошибке покупки.

ExpoRuStore.onPurchaseFailed((error: PurchaseError) => {
  console.error(error.code, error.message);
});

onPurchasesRestored(callback)

Вызывается после восстановления покупок.

ExpoRuStore.onPurchasesRestored((data) => {
  console.log('Восстановлено покупок:', data.purchases.length);
});

onProductsLoaded(callback)

Вызывается после загрузки информации о продуктах.

ExpoRuStore.onProductsLoaded((data) => {
  data.products.forEach(product => {
    console.log(product.title, product.price);
  });
});

📋 Требования

  • Expo SDK: 54+
  • React Native: 0.81+
  • Android: minSdk 24+
  • RuStore SDK: 7.0.0

🛠️ Устранение проблем

Ошибки сборки Android

Если возникают ошибки при сборке Android проекта:

  1. Очистите кеш и пересоберите проект:

    npx expo prebuild --clean
    cd android && ./gradlew clean
    cd .. && npx expo run:android
  2. Проверьте, что Maven-репозиторий добавлен:

    • Откройте android/build.gradle
    • Убедитесь, что в блоке repositories есть:
    maven { url 'https://artifactory-external.vkpartner.ru/artifactory/maven' }
  3. Проверьте версию RuStore SDK:

    • В android/app/build.gradle должна быть зависимость:
    implementation 'ru.rustore.sdk:billingclient:7.0.0'

🔧 Разработка

# Установка зависимостей
npm install

# Сборка TypeScript
npm run build

# Запуск примера
cd example
npm install
npx expo run:android

📄 Лицензия

MIT

👤 Автор

Akimov Eugeney - GitHub

🐛 Баги и предложения

GitHub Issues