Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-purchase

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-purchase - npm Package Compare versions

Comparing version 10.1.1 to 10.1.2

28

doc/api.md

@@ -919,3 +919,3 @@ # API Documentation

## <a name="update"></a> *store.update*
## <a name="update"></a> *store.update()*

@@ -954,3 +954,14 @@ Refresh the historical state of purchases and price of items.

##### return value
This method returns a promise-like object with the following functions:
- `.completed(fn)` - Calls `fn` when the queue of previous purchases have been processed.
At this point, all previously owned products should be in the approved state.
- `.finished(fn)` - Calls `fn` when all purchased in the approved state have been finished
or expired.
In the case of the restore purchases call, you will want to hide any progress bar when the
`finished` callback is called.
##### example usage

@@ -971,7 +982,16 @@

`<button onclick="store.refresh()">Restore Purchases</button>`
```html
<button onclick="restorePurchases()">Restore Purchases</button>
```
```js
function restorePurchases() {
showProgress();
store.refresh().finished(hideProgress);
}
```
To make the restore purchases work as expected, please make sure that
the "approved" event listener had be registered properly,
and in the callback `product.finish()` should be called.
the "approved" event listener had be registered properly
and, in the callback, `product.finish()` is called after handling.

@@ -978,0 +998,0 @@

2

package.json
{
"name": "cordova-plugin-purchase",
"version": "10.1.1",
"version": "10.1.2",
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)",

@@ -5,0 +5,0 @@ "cordova": {

@@ -21,3 +21,4 @@ (function() {

store.iabGetPurchases(function() {
successCb();
if (successCb)
successCb();
});

@@ -24,0 +25,0 @@ };

@@ -25,3 +25,14 @@ (function() {

///
/// ##### return value
///
/// This method returns a promise-like object with the following functions:
///
/// - `.completed(fn)` - Calls `fn` when the queue of previous purchases have been processed.
/// At this point, all previously owned products should be in the approved state.
/// - `.finished(fn)` - Calls `fn` when all purchased in the approved state have been finished
/// or expired.
///
/// In the case of the restore purchases call, you will want to hide any progress bar when the
/// `finished` callback is called.
///
/// ##### example usage

@@ -42,7 +53,16 @@ ///

///
/// `<button onclick="store.refresh()">Restore Purchases</button>`
/// ```html
/// <button onclick="restorePurchases()">Restore Purchases</button>
/// ```
///
/// ```js
/// function restorePurchases() {
/// showProgress();
/// store.refresh().finished(hideProgress);
/// }
/// ```
///
/// To make the restore purchases work as expected, please make sure that
/// the "approved" event listener had be registered properly,
/// and in the callback `product.finish()` should be called.
/// the "approved" event listener had be registered properly
/// and, in the callback, `product.finish()` is called after handling.
///

@@ -52,8 +72,55 @@

function createPromise() {
var events = {};
// refresh-completed is called when all owned products have been
// sent to the approved state.
store.once("", "refresh-completed", function() {
if (events["refresh-completed"]) return;
events["refresh-completed"] = true;
store.when().updated(checkFinished);
checkFinished(); // make sure this is called at least once
});
// trigger the refresh-finished event when no more products are in the
// approved state.
function checkFinished() {
if (events["refresh-finished"]) return;
function isApproved(p) { return p.state === store.APPROVED; }
if (store.products.filter(isApproved).length === 0) {
// done processing
store.off(checkFinished);
events["refresh-finished"] = true;
setTimeout(function() {
// if "completed" triggers "finished",
// the setTimeout guarantees calling order
store.trigger("refresh-finished");
}, 100);
}
}
return {
completed: genPromise("refresh-completed"),
finished: genPromise("refresh-finished"),
};
function genPromise(eventName) {
return function(cb) {
if (events[eventName])
cb();
else
store.once("", eventName, cb);
return this;
};
}
}
store.refresh = function() {
var promise = createPromise();
store.trigger("refreshed");
if (initialRefresh) {
initialRefresh = false;
return;
return promise;
}

@@ -81,5 +148,5 @@

store.trigger("re-refreshed");
return promise;
};
})();

@@ -364,2 +364,2 @@ /// ### Philosophy

store.version = '10.1.1';
store.version = '10.1.2';

@@ -381,3 +381,3 @@ (function() {

///
/// ## <a name="update"></a> *store.update*
/// ## <a name="update"></a> *store.update()*
///

@@ -384,0 +384,0 @@ /// Refresh the historical state of purchases and price of items.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc