Skip to content

AddsPurchases.getCurrentOfferingForPlacement(placementID) and Purchases.syncAttributesAndOfferingsIfNeeded()#925

Merged
joshdholtz merged 12 commits into
bump-phc/10.1.0from
targeting-v2
Mar 13, 2024
Merged

AddsPurchases.getCurrentOfferingForPlacement(placementID) and Purchases.syncAttributesAndOfferingsIfNeeded()#925
joshdholtz merged 12 commits into
bump-phc/10.1.0from
targeting-v2

Conversation

@joshdholtz

@joshdholtz joshdholtz commented Mar 1, 2024

Copy link
Copy Markdown
Member

Motivation

Bump to PHC 10.1.0 and add support for new Targeting methods

Description

Get Current Offering for Placement

Get an offering specific to the place of your paywall (eg: onboarding, settings, feature gate, etc). This is determined by Targeting.

let offering = await Purchases.getCurrentOfferingForPlacement("your-placement-identifier")
if (offering) {
    // Navigate to paywall
} else {
    // Do nothing or continue to another screen
}

Sync Attributes and Offerings

A blocking call to sync attributes and fetch new offerings to to be used with Targeting that uses Custom Attributes.

// Using this result is optional - offerings will be cached for next Purchases.getOfferings() call
let offerings = await Purchases.syncAttributesAndOfferingsIfNeeded()

@joshdholtz joshdholtz added the pr:feat A new feature label Mar 1, 2024
@joshdholtz joshdholtz changed the title Targeting V2 [WIP] Targeting V2 Mar 1, 2024
@joshdholtz joshdholtz changed the base branch from main to bump-phc/10.0.0 March 7, 2024 14:42
@joshdholtz joshdholtz changed the base branch from bump-phc/10.0.0 to bump-phc/10.1.0 March 11, 2024 19:50
@joshdholtz joshdholtz changed the title [WIP] Targeting V2 AddsPurchases.getCurrentOfferingForPlacement(placementID) and Purchases.syncAttributesAndOfferingsIfNeeded() Mar 12, 2024
@joshdholtz joshdholtz requested review from a team March 12, 2024 13:36
@joshdholtz joshdholtz marked this pull request as ready for review March 12, 2024 13:36
Comment thread examples/purchaseTesterTypescript/app/APIKeys.tsx Outdated
Comment thread yarn.lock
languageName: node
linkType: hard

"@revenuecat/purchases-typescript-internal@npm:8.10.1":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it's a bit weird this is removed and not updated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I will... undo because I agree

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OHHHHHH... it was because it was high level being required but I fixed the react-native-purchases-ui/package.json and its a dependency in there as well so it got moved under that one

I think this rooted because it was messed up in the parent bump branch 🤷‍♂️

@joshdholtz joshdholtz merged commit 957d23a into bump-phc/10.1.0 Mar 13, 2024
@joshdholtz joshdholtz deleted the targeting-v2 branch March 13, 2024 12:43
joshdholtz added a commit that referenced this pull request Mar 13, 2024
**This is an automatic bump.**

Updates purchases-hybrid-common to 10.1.0

- Includes #925

---------

Co-authored-by: RevenueCat CI <dev+ci@revenuecat.com>
Co-authored-by: Josh Holtz <me@joshholtz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants