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

@joinflux/capacitor-subscriptions

v1.2.1

Published

Subscriptions via Revenue Cat

Downloads

29

Readme

@joinflux/capacitor-subscriptions

Subscriptions via Revenue Cat

Versioning

  • Use version 1.x.x for Capacitor 5 support
  • Use version 0.x.x for Capacitor 4 support

Install

npm install @joinflux/capacitor-subscriptions
npx cap sync

API

configure(...)

configure(options: { apiKey: string; appUserID?: string; }) => void

configure initializes the plugin

| Param | Type | | ------------- | ---------------------------------------------------- | | options | { apiKey: string; appUserID?: string; } |


logIn(...)

logIn(options: { userId: string; email?: string; displayName?: string; }) => Promise<void>

logIn identifies the app user (a user is initially 'anonymous' user on app startup). The user's ID is required but email and display name are optional (just for convenience - saves us from having to look up these details in other systems). NOTE: The email and display name are only updated after the user ID is successfully set and empty strings are ignored/treated the same as undefined.

| Param | Type | | ------------- | ---------------------------------------------------------------------- | | options | { userId: string; email?: string; displayName?: string; } |


logOut()

logOut() => Promise<void>

logOut logs out the currently logged in user


getProduct(...)

getProduct(options: { id: string; }) => Promise<Product | undefined>

getProduct retrives the product with the specified id

| Param | Type | | ------------- | ---------------------------- | | options | { id: string; } |

Returns: Promise<Product>


getEligibleOffer(...)

getEligibleOffer(options: { productId: string; offerId: string; }) => Promise<Offer | undefined>

getEligibleOffer returns the offer with the specified ID, for the specified product that the user is eligible for

  • In IOS, searches through Promotional Offers
  • In Android, searches through Offers with a discounted price (excludes free trial)

| Param | Type | | ------------- | ---------------------------------------------------- | | options | { productId: string; offerId: string; } |

Returns: Promise<Offer>


purchaseProduct(...)

purchaseProduct(options: { productId: string; offerId?: string; }) => Promise<void>

purchaseProduct initiates the native store purchase (i.e. triggers the native pop-up).

| Param | Type | | ------------- | ----------------------------------------------------- | | options | { productId: string; offerId?: string; } |


checkIntroOfferEligibility(...)

checkIntroOfferEligibility(options: { productId: string; }) => Promise<IntroEligibility>

checkIntroOfferEligibility computes whether or not a user is eligible for the introductory pricing period of a given product. IOS: You should use this method to determine whether or not you show the user the normal product price or the introductory price. This also applies to trials (trials are considered a type of introductory pricing).

| Param | Type | | ------------- | ----------------------------------- | | options | { productId: string; } |

Returns: Promise<IntroEligibility>


syncPurchases()

syncPurchases() => Promise<void>

syncPurchases synchronizes the current App Store/Play Store account's purchases/transactions to RevenueCat. This is particularly useful for purchases/transactions done outside the app. For example: redeeming an IOS Offer code in the App Store. See https://www.revenuecat.com/docs/migrating-existing-subscriptions#client-side-migration for more info.

NOTE that syncPurchases should only be called when necessary due to potential pit falls such as unintentionally aliasing accounts. See https://www.revenuecat.com/docs/restoring-purchases#syncpurchases-considerations for more info.


setDeviceIdentifiers()

setDeviceIdentifiers() => Promise<void>

setDeviceIdentifiers automatically collects then sets the user's device identifiers (such as Google Ad ID, IOS IDFA/IDFV, etc.) in their Subscriber attributes. This is primarily for ad/marketing attribution purposes. Note that for IOS 14.5+, if the user allows the App Tracking, this method should be called again to update the user's IDFA in RevenueCat.


setAdvertisementAttribution(...)

setAdvertisementAttribution(data: AdvertisementAttribution) => Promise<void>

setAdvertisementAttribution sets the advertisement-related attribution data in the user's Subscriber attributes. Note that if a property is not included (or undefined) or is an empty string, it is not updated in RevenueCat.

| Param | Type | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | data | Partial<{ appsFlyerId: string; mediaSource: string; campaign: string; adGroup: string; ad: string; keyword: string; creative: string; }> |


Interfaces

Product

| Prop | Type | Description | | ----------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | identifier | string | Product Id. | | price | number | Price of the product in the local currency. | | priceString | string | Formatted price of the item, including its currency sign, such as €3.99. | | introPrice | IntroPrice | null | Introductory price. - IOS: corresponds to the introductory offer (if it exists) - Android: corresponds to the first free trial offer |

IntroPrice

| Prop | Type | Description | | ------------------------- | ------------------- | ------------------------------------------------------------------------------------------------ | | price | number | Price in the local currency. | | priceString | string | Formatted price, including its currency sign, such as €3.99. | | cycles | number | Number of subscription billing periods for which the user will be given the discount, such as 3. | | period | string | Billing period of the discount, specified in ISO 8601 format. | | periodUnit | string | Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR. | | periodNumberOfUnits | number | Number of units for the billing period of the discount. |

Offer

| Prop | Type | Description | | ------------------------- | ------------------- | ------------------------------------------------------------------------------------------------ | | identifier | string | Identifier of the discount. | | price | number | Price in the local currency. | | priceString | string | Formatted price, including its currency sign, such as €3.99. | | cycles | number | Number of subscription billing periods for which the user will be given the discount, such as 3. | | period | string | Billing period of the discount, specified in ISO 8601 format. | | periodUnit | string | Unit for the billing period of the discount, can be DAY, WEEK, MONTH or YEAR. | | periodNumberOfUnits | number | Number of units for the billing period of the discount. |

IntroEligibility

Holds the introductory price status

| Prop | Type | Description | | ----------------- | ----------------------------------------------------------------------------- | ----------------------------------------- | | status | INTRO_ELIGIBILITY_STATUS | The introductory price eligibility status | | description | string | Description of the status |

Type Aliases

AdvertisementAttribution

AdvertisementAttribution represents various ad properties for conversion attribution.

Partial<{ appsFlyerId: string; mediaSource: string; campaign: string; adGroup: string; ad: string; keyword: string; creative: string; }>

Partial

Make all properties in T optional

{ [P in keyof T]?: T[P]; }

Enums

INTRO_ELIGIBILITY_STATUS

| Members | Value | Description | | ---------------------------------------------------- | -------------- | ---------------------------------------------------------------------------- | | INTRO_ELIGIBILITY_STATUS_UNKNOWN | 0 | RevenueCat doesn't have enough information to determine eligibility. | | INTRO_ELIGIBILITY_STATUS_INELIGIBLE | | The user is not eligible for a free trial or intro pricing for this product. | | INTRO_ELIGIBILITY_STATUS_ELIGIBLE | | The user is eligible for a free trial or intro pricing for this product. | | INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS | | There is no free trial or intro pricing for this product. |