Skip to content

Commit

Permalink
Update documentation and typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
j3k0 committed Aug 6, 2022
1 parent bdb8ed5 commit 5d52fae
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 16 deletions.
8 changes: 7 additions & 1 deletion RELEASE_NOTES.md
Expand Up @@ -66,7 +66,13 @@ export interface IPricingPhase {
export type RecurrenceMode = "NON_RECURRING" | "FINITE_RECURRING" | "INFINITE_RECURRING";
```

You can also keep the plugin in `v10` compatibility mode using `store.compatibility`, in which case the legacy "introPrice", "billingPeriod" and such will be filled using the content of the pricingPhases array. Notice that this legacy mode can only support **at most** 2 pricing phases.
You can also keep the plugin in `v11` compatibility mode using `store.compatibility = 11` (or lower), in which case the legacy "introPrice", "billingPeriod" and such will be filled using the content of the pricingPhases array. Notice that this legacy mode can only support **at most** 2 pricing phases.

When in `v11` compatibility mode:

- prices and billing periods will be set using values from the last of the pricing phases.
- intro prices and billing periods will be set with the values from the first pricing phase (if there are more than one)
- product prices and billing periods will be set using values from the first offer for that product.

### NEW: `store.compatibility` - Legacy compatibility

Expand Down
92 changes: 77 additions & 15 deletions src/js/index.d.ts
Expand Up @@ -486,14 +486,17 @@ declare namespace IapStore {
export interface ITransaction {
/** Transaction identifier */
id?: string;
// Android only
/** Payment processing platform */
type: TransactionType;
/** @deprecated */
developerPayload?: string;
/** Purchase token on Google Play */
purchaseToken?: string;
/** Receipt data on Google Play */
receipt?: string;
// iOS only
/** Receipt data on iOS >= 7 */
appStoreReceipt?: string;
/** Receipt data iOS <7 only */
transactionReceipt?: string;
}

Expand Down Expand Up @@ -534,14 +537,29 @@ declare namespace IapStore {
export interface IStoreProduct extends IRegisterRequest {
/** Additional data possibly required for product purchase */
additionalData: any;
/** Duration of the billing period for a subscription, in the units specified by the billingPeriodUnit property. (not available on iOS < 11.2) */

/** Duration of the billing period for a subscription, in the units specified by the billingPeriodUnit property. (not available on iOS < 11.2)
*
* @deprecated Use pricingPhases instead */
billingPeriod?: number;
/** Units of the billing period for a subscription. Possible values: Minute, Hour, Day, Week, Month, Year. (not available on iOS < 11.2) */
billingPeriodUnit: IPeriodUnit;
/** Units of the billing period for a subscription. Possible values: Minute, Hour, Day, Week, Month, Year. (not available on iOS < 11.2)
*
* @deprecated Use pricingPhases instead */
billingPeriodUnit?: IPeriodUnit;
/** ISO 8601 duration of the billing period (https://en.wikipedia.org/wiki/ISO_8601#Durations)
*
* @deprecated Use pricingPhases instead */
billingPeriodISO?: string;
/** Number of recurrence cycles (if recurrenceMode is FINITE_RECURRING)
*
* @deprecated Use pricingPhases instead */
billingCycles?: number;

/** Product is in a state where it can be purchased */
canPurchase: boolean;
/** Country code. Available only on iOS */
countryCode: string;

/** Currency code */
currency?: string;
/** Purchase has been initiated but is waiting for external action (for example, Ask to Buy on iOS) */
Expand All @@ -550,43 +568,86 @@ declare namespace IapStore {
description: string;
/** Array of discounts available for the product. */
discounts?: IStoreDiscount[];

/** Product is downloading non-consumable content */
downloading: boolean;
/** Non-consumable content has been successfully downloaded for this product */
downloaded: boolean;
/** Latest known expiry date for a subscription (a javascript Date) */
expiryDate?: Date;
/** Localized introductory price (if applicable), with currency symbol */

/** Localized introductory price (if applicable), with currency symbol
*
* @deprecated Use pricingPhases instead */
introPrice?: string;
/** Introductory price in micro-units, if applicable (divide by 1000000 to get numeric price) */
/** Introductory price in micro-units, if applicable (divide by 1000000 to get numeric price)
*
* @deprecated Use pricingPhases instead */
introPriceMicros?: number;
/** Duration the introductory price is available (in period-unit) */
/** Duration the introductory price is available (in period-unit)
*
* @deprecated Use pricingPhases instead */
introPricePeriod?: string;
/** Period for the introductory price ("Day", "Week", "Month" or "Year") */
/** Period for the introductory price ("Day", "Week", "Month" or "Year")
*
* @deprecated Use pricingPhases instead */
introPricePeriodUnit?: IPeriodUnit;
/** Payment mode for the introductory price ("PayAsYouGo", "UpFront", or "FreeTrial") */
/** Duration of the introductory price in ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations)
*
* @deprecated Use pricingPhases instead */
introPeriodISO?: string;
/** Payment mode for the introductory price ("PayAsYouGo", "UpFront", or "FreeTrial")
*
* @deprecated Use pricingPhases instead */
introPricePaymentMode?: IPaymentMode;
/** Number of recurrence cycles for the introductory period (if introRecurrenceMode is FINITE_RECURRING)
*
* @deprecated Use pricingPhases instead */
introCycles?: number;
/** Mode of payment for the introductory period ("PayAsYouGo", "UpFront", or "FreeTrial")
*
* @deprecated Use pricingPhases instead */
introPaymentMode?: IPaymentMode;
/** Type of recurring payment for the introductory period
*
* @deprecated Use pricingPhases instead */
introRecurrenceMode?: RecurrenceMode;

/** True when a trial or introductory price has been applied to a subscription.
* Only available after receipt validation. Only on iOS */
* Only available after receipt validation. Only on iOS. */
ineligibleForIntroPrice?: boolean;
/** Latest date a subscription was renewed (a javascript Date) */
/** Latest date a subscription was renewed (a javascript Date)
* Only available after receipt validation. Only on iOS. */
lastRenewalDate?: Date;
/** Product has been loaded from server, however it can still be either valid or not */
loaded: string | boolean;
/** Product is owned */
owned: boolean;
/** Human formatted price
*
* @deprecated Use pricingPhases instead */
price: string;
/** Price in micro-units (divide by 1000000 to get numeric price) */
/** Price in micro-units (divide by 1000000 to get numeric price)
*
* @deprecated Use pricingPhases instead */
priceMicros?: number;
/** Type of recurring payment
*
* @deprecated Use pricingPhases instead */
recurrenceMode?: RecurrenceMode;
/** Current state the product is in (see life-cycle in the API documentatin). */
state: StoreProductState;
/** Localized name or short description, as loaded from the store */
title: string;
/** Latest transaction data for this product. */
transaction: ITransaction;
/** Duration of the trial period for the subscription, in the units specified by the trialPeriodUnit property (windows only) */
/** Duration of the trial period for the subscription, in the units specified by the trialPeriodUnit property (windows only)
*
* @deprecated Use pricingPhases instead */
trialPeriod?: number;
/** Units of the trial period for a subscription (windows only) */
/** Units of the trial period for a subscription (windows only)
*
* @deprecated Use pricingPhases instead */
trialPeriodUnit?: IPeriodUnit;
/** Product has been loaded and is a valid product.
*
Expand Down Expand Up @@ -727,4 +788,5 @@ declare namespace store {
export type ITransaction = IapStore.ITransaction;
export type IRegisterRequest = IapStore.IRegisterRequest;
export type IStoreProduct = IapStore.IStoreProduct;
export type RecurrenceMode = IapStore.RecurrenceMode;
}

0 comments on commit 5d52fae

Please sign in to comment.