Skip to content

Commit

Permalink
v13.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
j3k0 committed May 30, 2024
1 parent c9dd12f commit 75abeb0
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 14 deletions.
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## 13.11

### 13.11.1

#### Fix running from browser with Capacitor

Add `Utils.platformId()` helper function to get rid of an error when running a Capacitor app in a browser.

Ref issue #1566

### 13.11.0

#### Upgrade to Google Play Billing library 7.0.0
Expand Down
23 changes: 23 additions & 0 deletions api/modules/CdvPurchase.Utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

- [Ajax](CdvPurchase.Utils.Ajax.md)

### Type Aliases

- [PlatformID](CdvPurchase.Utils.md#platformid)

### Functions

- [ajax](CdvPurchase.Utils.md#ajax)
Expand All @@ -17,11 +21,18 @@
- [md5](CdvPurchase.Utils.md#md5)
- [nonEnumerable](CdvPurchase.Utils.md#nonenumerable)
- [objectValues](CdvPurchase.Utils.md#objectvalues)
- [platformId](CdvPurchase.Utils.md#platformid-1)
- [platformName](CdvPurchase.Utils.md#platformname)
- [safeCall](CdvPurchase.Utils.md#safecall)
- [safeCallback](CdvPurchase.Utils.md#safecallback)
- [uuidv4](CdvPurchase.Utils.md#uuidv4)

## Type Aliases

### PlatformID

Ƭ **PlatformID**: ``"ios"`` \| ``"android"`` \| ``"web"``

## Functions

### ajax
Expand Down Expand Up @@ -210,6 +221,18 @@ Object.values() for ES6

___

### platformId

**platformId**(): [`PlatformID`](CdvPurchase.Utils.md#platformid)

Returns an UUID v4. Uses `window.crypto` internally to generate random values.

#### Returns

[`PlatformID`](CdvPurchase.Utils.md#platformid)

___

### platformName

**platformName**(`platform`): `string`
Expand Down
2 changes: 1 addition & 1 deletion api/modules/CdvPurchase.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ___

### PLUGIN\_VERSION

`Const` **PLUGIN\_VERSION**: ``"13.11.0"``
`Const` **PLUGIN\_VERSION**: ``"13.11.1"``

Current release number of the plugin.

Expand Down
4 changes: 2 additions & 2 deletions 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.11.0",
"version": "13.11.1",
"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.10.4">
version="13.11.1">

<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/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.11.0';
export const PLUGIN_VERSION = '13.11.1';

/**
* Entry class of the plugin.
Expand Down
9 changes: 8 additions & 1 deletion www/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ declare namespace CdvPurchase {
/**
* Current release number of the plugin.
*/
const PLUGIN_VERSION = "13.11.0";
const PLUGIN_VERSION = "13.11.1";
/**
* Entry class of the plugin.
*/
Expand Down Expand Up @@ -5383,6 +5383,13 @@ declare namespace CdvPurchase {
function md5(str: string): string;
}
}
declare namespace CdvPurchase {
namespace Utils {
type PlatformID = 'ios' | 'android' | 'web';
/** Returns an UUID v4. Uses `window.crypto` internally to generate random values. */
function platformId(): PlatformID;
}
}
declare namespace CdvPurchase {
namespace Utils {
/**
Expand Down
30 changes: 23 additions & 7 deletions www/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ var CdvPurchase;
/**
* Current release number of the plugin.
*/
CdvPurchase.PLUGIN_VERSION = '13.11.0';
CdvPurchase.PLUGIN_VERSION = '13.11.1';
/**
* Entry class of the plugin.
*/
Expand Down Expand Up @@ -1906,7 +1906,7 @@ var CdvPurchase;
* - on Android: `GOOGLE_PLAY`
*/
defaultPlatform() {
switch (window.cordova.platformId) {
switch (CdvPurchase.Utils.platformId()) {
case 'android': return CdvPurchase.Platform.GOOGLE_PLAY;
case 'ios': return CdvPurchase.Platform.APPLE_APPSTORE;
default: return CdvPurchase.Platform.TEST;
Expand Down Expand Up @@ -2699,7 +2699,7 @@ var CdvPurchase;
}
/** Returns true on iOS, the only platform supported by this adapter */
get isSupported() {
return window.cordova.platformId === 'ios';
return CdvPurchase.Utils.platformId() === 'ios';
}
upsertTransactionInProgress(productId, state) {
const transactionId = virtualTransactionId(productId);
Expand Down Expand Up @@ -4300,7 +4300,7 @@ var CdvPurchase;
}
/** Returns true on Android, the only platform supported by this Braintree bridge */
static isSupported() {
return window.cordova.platformId === 'android';
return CdvPurchase.Utils.platformId() === 'android';
}
isApplePaySupported() {
return __awaiter(this, void 0, void 0, function* () {
Expand Down Expand Up @@ -4466,7 +4466,7 @@ var CdvPurchase;
static isSupported(log) {
return new Promise(resolve => {
var _a;
if (window.cordova.platformId !== 'ios') {
if (CdvPurchase.Utils.platformId() !== 'ios') {
log.info('BraintreeApplePayPlugin is only available for ios.');
return resolve(false);
}
Expand Down Expand Up @@ -4589,7 +4589,7 @@ var CdvPurchase;
return window.CdvPurchaseBraintree;
}
static isSupported() {
return window.cordova.platformId === 'ios';
return CdvPurchase.Utils.platformId() === 'ios';
}
}
IosBridge.Bridge = Bridge;
Expand Down Expand Up @@ -4834,7 +4834,7 @@ var CdvPurchase;
get receipts() { return this._receipts; }
/** Returns true on Android, the only platform supported by this adapter */
get isSupported() {
return window.cordova.platformId === 'android';
return CdvPurchase.Utils.platformId() === 'android';
}
initialize() {
return __awaiter(this, void 0, void 0, function* () {
Expand Down Expand Up @@ -6746,6 +6746,22 @@ var CdvPurchase;
})(Utils = CdvPurchase.Utils || (CdvPurchase.Utils = {}));
})(CdvPurchase || (CdvPurchase = {}));
var CdvPurchase;
(function (CdvPurchase) {
let Utils;
(function (Utils) {
/** Returns an UUID v4. Uses `window.crypto` internally to generate random values. */
function platformId() {
var _a, _b, _c;
if ((_a = window.cordova) === null || _a === void 0 ? void 0 : _a.platformId)
return (_b = window.cordova) === null || _b === void 0 ? void 0 : _b.platformId;
if ((_c = window.Capacitor) === null || _c === void 0 ? void 0 : _c.getPlatform)
return window.Capacitor.getPlatform();
return 'web';
}
Utils.platformId = platformId;
})(Utils = CdvPurchase.Utils || (CdvPurchase.Utils = {}));
})(CdvPurchase || (CdvPurchase = {}));
var CdvPurchase;
(function (CdvPurchase) {
let Utils;
(function (Utils) {
Expand Down

0 comments on commit 75abeb0

Please sign in to comment.