Skip to content

Commit

Permalink
v13.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
j3k0 committed Dec 4, 2023
1 parent d5b9be9 commit 39eab03
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 115 deletions.
18 changes: 16 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# Release Notes - Cordova Plugin Purchase

## 13.9
## 13.10.0

### 13.9.0
#### (googleplay) Add "isConsumed" to consumed transactions

Local Google Play transaction now contain `isConsumed`, which is the same as `isAcknowledged`, but only set for consumable products.

#### Make it easier to debug callback calls

It's now possible to add a name to callbacks registered with "store.when()"

When callbacks are triggered, the reason is logged to the console.

#### Prevent instanciating CdvPurchase.store twice

So when ionic packages the plugin with the app code, no double instanciations of the plugin is performed.

## 13.9.0

#### (appstore) store.restorePurchases() return potential errors

Expand Down
3 changes: 2 additions & 1 deletion api/classes/CdvPurchase.GooglePlay.Transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,15 @@ ___

### toState

`Static` **toState**(`state`, `isAcknowledged`): [`TransactionState`](../enums/CdvPurchase.TransactionState.md)
`Static` **toState**(`state`, `isAcknowledged`, `isConsumed`): [`TransactionState`](../enums/CdvPurchase.TransactionState.md)

#### Parameters

| Name | Type |
| :------ | :------ |
| `state` | [`PurchaseState`](../enums/CdvPurchase.GooglePlay.Bridge.PurchaseState.md) |
| `isAcknowledged` | `boolean` |
| `isConsumed` | `boolean` |

#### Returns

Expand Down
3 changes: 2 additions & 1 deletion api/classes/CdvPurchase.Store.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ ___

### monitor

**monitor**(`transaction`, `onChange`): [`TransactionMonitor`](../interfaces/CdvPurchase.TransactionMonitor.md)
**monitor**(`transaction`, `onChange`, `callbackName`): [`TransactionMonitor`](../interfaces/CdvPurchase.TransactionMonitor.md)

Setup a function to be notified of changes to a transaction state.

Expand All @@ -500,6 +500,7 @@ const monitor = store.monitor(transaction, state => {
| :------ | :------ | :------ |
| `transaction` | [`Transaction`](CdvPurchase.Transaction.md) | The transaction to monitor. |
| `onChange` | [`Callback`](../modules/CdvPurchase.md#callback)<[`TransactionState`](../enums/CdvPurchase.TransactionState.md)\> | Function to be called when the transaction status changes. |
| `callbackName` | `string` | - |

#### Returns

Expand Down
9 changes: 9 additions & 0 deletions api/interfaces/CdvPurchase.GooglePlay.Bridge.Purchase.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [accountId](CdvPurchase.GooglePlay.Bridge.Purchase.md#accountid)
- [acknowledged](CdvPurchase.GooglePlay.Bridge.Purchase.md#acknowledged)
- [autoRenewing](CdvPurchase.GooglePlay.Bridge.Purchase.md#autorenewing)
- [consumed](CdvPurchase.GooglePlay.Bridge.Purchase.md#consumed)
- [developerPayload](CdvPurchase.GooglePlay.Bridge.Purchase.md#developerpayload)
- [getPurchaseState](CdvPurchase.GooglePlay.Bridge.Purchase.md#getpurchasestate)
- [orderId](CdvPurchase.GooglePlay.Bridge.Purchase.md#orderid)
Expand Down Expand Up @@ -49,6 +50,14 @@ Whether the subscription renews automatically.

___

### consumed

`Optional` **consumed**: `boolean`

Whether the purchase has been consumed

___

### developerPayload

**developerPayload**: `string`
Expand Down
30 changes: 20 additions & 10 deletions api/interfaces/CdvPurchase.When.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Store events listener

### approved

**approved**(`cb`): [`When`](CdvPurchase.When.md)
**approved**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when transaction is approved.

Expand All @@ -32,6 +32,7 @@ Register a function called when transaction is approved.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Transaction`](../classes/CdvPurchase.Transaction.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -41,7 +42,7 @@ ___

### finished

**finished**(`cb`): [`When`](CdvPurchase.When.md)
**finished**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a transaction is finished.

Expand All @@ -50,6 +51,7 @@ Register a function called when a transaction is finished.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Transaction`](../classes/CdvPurchase.Transaction.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -59,7 +61,7 @@ ___

### pending

**pending**(`cb`): [`When`](CdvPurchase.When.md)
**pending**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when transaction is pending.

Expand All @@ -68,6 +70,7 @@ Register a function called when transaction is pending.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Transaction`](../classes/CdvPurchase.Transaction.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -77,7 +80,7 @@ ___

### productUpdated

**productUpdated**(`cb`): [`When`](CdvPurchase.When.md)
**productUpdated**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a product is updated.

Expand All @@ -86,6 +89,7 @@ Register a function called when a product is updated.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Product`](../classes/CdvPurchase.Product.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -95,7 +99,7 @@ ___

### receiptUpdated

**receiptUpdated**(`cb`): [`When`](CdvPurchase.When.md)
**receiptUpdated**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a receipt is updated.

Expand All @@ -104,6 +108,7 @@ Register a function called when a receipt is updated.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Receipt`](../classes/CdvPurchase.Receipt.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -113,7 +118,7 @@ ___

### receiptsReady

**receiptsReady**(`cb`): [`When`](CdvPurchase.When.md)
**receiptsReady**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when all receipts have been loaded.

Expand All @@ -129,6 +134,7 @@ If no platforms have any receipts (the user made no purchase), this will also ge
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<`void`\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -138,7 +144,7 @@ ___

### receiptsVerified

**receiptsVerified**(`cb`): [`When`](CdvPurchase.When.md)
**receiptsVerified**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when all receipts have been verified.

Expand All @@ -149,6 +155,7 @@ If no platforms have any receipts (user made no purchase), this will also get ca
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<`void`\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -158,7 +165,7 @@ ___

### unverified

**unverified**(`cb`): [`When`](CdvPurchase.When.md)
**unverified**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a receipt failed validation.

Expand All @@ -167,6 +174,7 @@ Register a function called when a receipt failed validation.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`UnverifiedReceipt`](CdvPurchase.UnverifiedReceipt.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -176,7 +184,7 @@ ___

### updated

**updated**(`cb`): [`When`](CdvPurchase.When.md)
**updated**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a product or receipt is updated.

Expand All @@ -189,6 +197,7 @@ Register a function called when a product or receipt is updated.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`Product`](../classes/CdvPurchase.Product.md) \| [`Receipt`](../classes/CdvPurchase.Receipt.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand All @@ -198,7 +207,7 @@ ___

### verified

**verified**(`cb`): [`When`](CdvPurchase.When.md)
**verified**(`cb`, `callbackName?`): [`When`](CdvPurchase.When.md)

Register a function called when a receipt is verified.

Expand All @@ -207,6 +216,7 @@ Register a function called when a receipt is verified.
| Name | Type |
| :------ | :------ |
| `cb` | [`Callback`](../modules/CdvPurchase.md#callback)<[`VerifiedReceipt`](../classes/CdvPurchase.VerifiedReceipt.md)\> |
| `callbackName?` | `string` |

#### Returns

Expand Down
8 changes: 6 additions & 2 deletions api/modules/CdvPurchase.Utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ ___

### safeCall

**safeCall**<`T`\>(`logger`, `className`, `callback`, `value`): `void`
**safeCall**<`T`\>(`logger`, `className`, `callback`, `value`, `callbackName`, `reason`): `void`

Run a callback inside a try/catch block.

Expand All @@ -248,6 +248,8 @@ Run a callback inside a try/catch block.
| `className` | `string` | Type of callback, helps debugging when a function failed. |
| `callback` | [`Callback`](CdvPurchase.md#callback)<`T`\> | The callback function is turn into a safer version. |
| `value` | `T` | Value passed to the callback. |
| `callbackName` | `undefined` \| `string` | - |
| `reason` | `string` | - |

#### Returns

Expand All @@ -257,7 +259,7 @@ ___

### safeCallback

**safeCallback**<`T`\>(`logger`, `className`, `callback`): [`Callback`](CdvPurchase.md#callback)<`T`\>
**safeCallback**<`T`\>(`logger`, `className`, `callback`, `callbackName`, `reason`): [`Callback`](CdvPurchase.md#callback)<`T`\>

Return a safer version of a callback that runs inside a try/catch block.

Expand All @@ -274,6 +276,8 @@ Return a safer version of a callback that runs inside a try/catch block.
| `logger` | [`Logger`](../classes/CdvPurchase.Logger.md) | Used to log errors. |
| `className` | `string` | Type of callback, helps debugging when a function failed. |
| `callback` | [`Callback`](CdvPurchase.md#callback)<`T`\> | The callback function is turn into a safer version. |
| `callbackName` | `undefined` \| `string` | - |
| `reason` | `string` | - |

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion api/modules/CdvPurchase.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ ___

### PLUGIN\_VERSION

`Const` **PLUGIN\_VERSION**: ``"13.9.0"``
`Const` **PLUGIN\_VERSION**: ``"13.10.0"``

Current release number of the plugin.

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-purchase",
"version": "13.9.0",
"version": "13.10.0",
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)",
"cordova": {
"id": "cordova-plugin-purchase",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SOFTWARE.
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-purchase"
xmlns:android="http://schemas.android.com/apk/res/android"
version="13.9.0">
version="13.10.0">

<name>Purchase</name>
<description>Cordova Purchase plugin for iOS (AppStore), Android (PlayStore) and Windows</description>
Expand Down
2 changes: 1 addition & 1 deletion src/ts/platforms/apple-appstore/appstore-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace CdvPurchase {
this.pseudoReceipt.transactions = this.pseudoReceipt.transactions.filter(t => t.transactionId !== transactionId);
}

/** Insert or update a transaction in the pseudo receipt */
/** Insert or update a transaction in the pseudo receipt, based on data collected from the native side */
private async upsertTransaction(productId: string, transactionId: string, state: TransactionState): Promise<SKTransaction> {
return new Promise(resolve => {
this.initializeAppReceipt(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/ts/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace CdvPurchase {
/**
* Current release number of the plugin.
*/
export const PLUGIN_VERSION = '13.9.0';
export const PLUGIN_VERSION = '13.10.0';

/**
* Entry class of the plugin.
Expand Down
Loading

0 comments on commit 39eab03

Please sign in to comment.