From b5f7f952df06828a07f4ab013ce52fddc8ccafdf Mon Sep 17 00:00:00 2001 From: aboedo Date: Fri, 16 Oct 2020 14:13:20 -0300 Subject: [PATCH] feat(purchases): update to plugin version 1.3.0 (#3547) --- src/@ionic-native/plugins/purchases/index.ts | 145 +++++++++++++++++-- 1 file changed, 134 insertions(+), 11 deletions(-) diff --git a/src/@ionic-native/plugins/purchases/index.ts b/src/@ionic-native/plugins/purchases/index.ts index b923c2233c..03c8c9a199 100644 --- a/src/@ionic-native/plugins/purchases/index.ts +++ b/src/@ionic-native/plugins/purchases/index.ts @@ -203,11 +203,11 @@ export enum INTRO_ELIGIBILITY_STATUS { * PurchaserInfo * PurchasesEntitlementInfos * PurchasesEntitlementInfo - * + * PurchasesTransaction */ @Plugin({ pluginName: 'Purchases', - plugin: 'cordova-plugin-purchases@1.2.0', + plugin: 'cordova-plugin-purchases@1.3.0', pluginRef: 'Purchases', // the variable reference to call the plugin, example: navigator.geolocation repo: 'https://github.com/RevenueCat/cordova-plugin-purchases', // the github repository URL for the plugin platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] @@ -259,8 +259,8 @@ export class Purchases extends IonicNativePlugin { * @param {boolean} observerMode An optional boolean. Set this to TRUE if you have your own IAP implementation and * want to use only RevenueCat's backend. Default is FALSE. If you are on Android and setting this to ON, you will have * to acknowledge the purchases yourself. - * @param {string?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android. - * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults + * @param {string?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android. + * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults * suite, otherwise it will use standardUserDefaults. Default is null, which will make the SDK use standardUserDefaults. */ @Cordova({ sync: true }) @@ -277,6 +277,9 @@ export class Purchases extends IonicNativePlugin { /** * Add a dict of attribution information + * + * @deprecated Use the set functions instead. + * * @param {object} data Attribution data from any of the attribution networks in Purchases.ATTRIBUTION_NETWORKS * @param {ATTRIBUTION_NETWORK} network Which network, see Purchases.ATTRIBUTION_NETWORK * @param {string?} networkUserId An optional unique id for identifying the user. Needs to be a string. @@ -542,11 +545,11 @@ export class Purchases extends IonicNativePlugin { /** * Invalidates the cache for purchaser information. - * + * * Most apps will not need to use this method; invalidating the cache can leave your app in an invalid state. * Refer to https://docs.revenuecat.com/docs/purchaserinfo#section-get-user-information for more information on * using the cache properly. - * + * * This is useful for cases where purchaser information might have been updated outside of the * app, like if a promotional subscription is granted through the RevenueCat dashboard. */ @@ -573,37 +576,137 @@ export class Purchases extends IonicNativePlugin { */ @Cordova({ sync: true }) setEmail(email: string | null): void {} + /** * Subscriber attribute associated with the phone number for the user * * @param phoneNumber Empty String or null will delete the subscriber attribute. */ - @Cordova({ sync: true }) setPhoneNumber(phoneNumber: string | null): void {} + /** * Subscriber attribute associated with the display name for the user * * @param displayName Empty String or null will delete the subscriber attribute. */ - @Cordova({ sync: true }) setDisplayName(displayName: string | null): void {} + /** * Subscriber attribute associated with the push token for the user * - * @param pushToken null will delete the subscriber attribute. + * @param pushToken Empty String or null will delete the subscriber attribute. */ - @Cordova({ sync: true }) setPushToken(pushToken: string | null): void {} + + /** + * Subscriber attribute associated with the install media source for the user + * + * @param mediaSource Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setMediaSource(mediaSource: string | null): void {} + + /** + * Subscriber attribute associated with the install campaign for the user + * + * @param campaign Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setCampaign(campaign: string | null): void {} + + /** + * Subscriber attribute associated with the install ad group for the user + * + * @param adGroup Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setAdGroup(adGroup: string | null): void {} + + /** + * Subscriber attribute associated with the install ad for the user + * + * @param ad Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setAd(ad: string | null): void {} + + /** + * Subscriber attribute associated with the install keyword for the user + * + * @param keyword Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setKeyword(keyword: string | null): void {} + + /** + * Subscriber attribute associated with the install ad creative for the user + * + * @param creative Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setCreative(creative: string | null): void {} + + /** + * Subscriber attribute associated with the Adjust Id for the user + * Required for the RevenueCat Adjust integration + * + * @param adjustID Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setAdjustId(adjustId: string | null): void {} + + /** + * Subscriber attribute associated with the AppsFlyer Id for the user + * Required for the RevenueCat AppsFlyer integration + * @param appsflyerID Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setAppsflyerId(appsflyerId: string | null): void {} + + /** + * Subscriber attribute associated with the Facebook SDK Anonymous Id for the user + * Recommended for the RevenueCat Facebook integration + * + * @param fbAnonymousID Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setFbAnonymousId(fbAnonymousId: string | null): void {} + + /** + * Subscriber attribute associated with the mParticle Id for the user + * Recommended for the RevenueCat mParticle integration + * + * @param mparticleID Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setMparticleId(mparticleId: string | null): void {} + + /** + * Subscriber attribute associated with the OneSignal Player Id for the user + * Required for the RevenueCat OneSignal integration + * + * @param onesignalID Empty String or null will delete the subscriber attribute. + */ + @Cordova({ sync: true }) + setOnesignalId(onesignalId: string | null): void {} + + /** + * Automatically collect subscriber attributes associated with the device identifiers. + * $idfa, $idfv, $ip on iOS + * $gpsAdId, $androidId, $ip on Android + */ + @Cordova({ sync: true }) + collectDeviceIdentifiers(): void {} + /** * Set this property to your proxy URL before configuring Purchases *only* if you've received a proxy key value from your RevenueCat contact. * @param url Proxy URL as a string. */ @Cordova({ sync: true }) setProxyURL(url: string): void {} - } /** @@ -708,6 +811,11 @@ export interface PurchaserInfo { * Set of purchased skus, active and inactive */ readonly allPurchasedProductIdentifiers: [string]; + /** + * Returns all the non-subscription purchases a user has made. + * The purchases are ordered by purchase date in ascending order. + */ + readonly nonSubscriptionTransactions: [PurchasesTransaction]; /** * The latest expiration date of all purchased skus */ @@ -756,6 +864,21 @@ export interface PurchaserInfo { readonly managementURL: string | null; } +export interface PurchasesTransaction { + /** + * RevenueCat Id associated to the transaction. + */ + readonly revenueCatId: string; + /** + * Product Id associated with the transaction. + */ + readonly productId: string; + /** + * Purchase date of the transaction in ISO 8601 format. + */ + readonly purchaseDate: string; +} + export interface PurchasesProduct { /** * Product Id.