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

cordova-plugin-inapppurchase-new

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-inapppurchase-new - npm Package Compare versions

Comparing version 1.3.2 to 1.4.2

.envrc

0

gulpfile.babel.js

@@ -0,0 +0,0 @@ import concat from 'gulp-concat';

4

package.json
{
"name": "cordova-plugin-inapppurchase-new",
"version": "1.3.2",
"version": "1.4.2",
"description": "A lightweight cordova plugin for in app purchases on iOS and Android with a simple promise based API.",

@@ -54,2 +54,2 @@ "main": "www/index-ios.js",

}
}
}

@@ -27,11 +27,2 @@ /*!

const chunkedGetSkuDetails = (productIds) => {
// We need to chunk the getSkuDetails call cause it is only allowed to provide a maximum of 20 items per call
return utils.chunk(productIds, 19).reduce((promise, productIds) => {
return promise.then((result) => {
return nativeCall('getSkuDetails', productIds).then((items) => result.concat(items));
});
}, Promise.resolve([]));
};
inAppPurchase.getProducts = (productIds) => {

@@ -43,3 +34,3 @@ return new Promise((resolve, reject) => {

nativeCall('init', []).then(() => {
return chunkedGetSkuDetails(productIds);
return nativeCall('getSkuDetails', productIds);
})

@@ -53,4 +44,2 @@ .then((items) => {

price : val.price,
currency : val.currency,
priceAsDecimal : val.priceAsDecimal,
};

@@ -130,2 +119,23 @@ });

inAppPurchase.getPurchaseHistory = () => {
return nativeCall('init', [])
.then(() => {
return nativeCall('getPurchaseHistory', []);
})
.then((purchaseHistory) => {
let arr = [];
if (purchaseHistory) {
arr = purchaseHistory.map((val) => {
return {
productId: val.productId,
purchaseTime: val.purchaseTime,
developerPayload: val.developerPayload,
purchaseToken: val.purchaseToken
};
});
}
return Promise.resolve(arr);
});
};
inAppPurchase.getReceipt = () => {

@@ -132,0 +142,0 @@ return Promise.resolve('');

@@ -36,5 +36,3 @@ /*!

description : val.description,
priceAsDecimal : val.priceAsDecimal,
price : val.price,
currency : val.currency,
};

@@ -82,4 +80,4 @@ });

inAppPurchase.getReceipt = () => {
return nativeCall('getReceipt').then((res) => {
inAppPurchase.loadReceipt = () => {
return nativeCall('loadReceipt').then((res) => {
let receipt = '';

@@ -91,4 +89,20 @@ if (res && res.receipt) {

});
}
inAppPurchase.refreshReceipt = () => {
return nativeCall('refreshReceipt').then((res) => {
let receipt = '';
if (res && res.receipt) {
receipt = res.receipt;
}
return receipt;
});
};
inAppPurchase.getReceipt = () => {
console.warn('This method is deprecated in favor of refreshReceipt().');
inAppPurchase.refreshReceipt();
};
inAppPurchase.restorePurchases = () => {

@@ -95,0 +109,0 @@ return nativeCall('restorePurchases').then((res) => {

@@ -0,0 +0,0 @@ /*!

@@ -27,18 +27,1 @@ /*!

};
utils.chunk = (array, size) => {
if (!Array.isArray(array)) {
throw new Error('Invalid array');
}
if (typeof size !== 'number' || size < 1) {
throw new Error('Invalid size');
}
const times = Math.ceil(array.length / size);
return Array
.apply(null, Array(times))
.reduce((result, val, i) => {
return result.concat([array.slice(i * size, (i + 1) * size)]);
}, []);
};

@@ -91,4 +91,4 @@ import inAppPurchase from '../www/index-android';

const products = [
{ productId: 'com.test.prod1', title: 'prod1 title', description: 'prod1 description', price: '$0.99', currency: 'USD', priceAsDecimal: 0.99 },
{ productId: 'com.test.prod2', title: 'prod2 title', description: 'prod2 description', price: '$1.99', currency: 'USD', priceAsDecimal: 1.99 }
{ productId: 'com.test.prod1', title: 'prod1 title', description: 'prod1 description', price: '$0.99' },
{ productId: 'com.test.prod2', title: 'prod2 title', description: 'prod2 description', price: '$1.99' },
];

@@ -95,0 +95,0 @@ const productIds = products.map(i => i.productId );

@@ -36,4 +36,4 @@ import inAppPurchase from '../www/index-ios';

const products = [
{ productId: 'com.test.prod1', title: 'prod1 title', description: 'prod1 description', price: '$0.99', currency: 'USD', priceAsDecimal: 0.99 },
{ productId: 'com.test.prod2', title: 'prod2 title', description: 'prod2 description', price: '$1.99', currency: 'USD', priceAsDecimal: 1.99 }
{ productId: 'com.test.prod1', title: 'prod1 title', description: 'prod1 description', price: '$0.99' },
{ productId: 'com.test.prod2', title: 'prod2 title', description: 'prod2 description', price: '$1.99' },
];

@@ -40,0 +40,0 @@ const productIds = products.map(i => i.productId );

@@ -0,0 +0,0 @@ import { utils } from '../www/index-ios';

@@ -69,17 +69,2 @@ /*!

};
utils.chunk = function (array, size) {
if (!Array.isArray(array)) {
throw new Error('Invalid array');
}
if (typeof size !== 'number' || size < 1) {
throw new Error('Invalid size');
}
var times = Math.ceil(array.length / size);
return Array.apply(null, Array(times)).reduce(function (result, val, i) {
return result.concat([array.slice(i * size, (i + 1) * size)]);
}, []);
};
'use strict';

@@ -117,13 +102,2 @@

var chunkedGetSkuDetails = function chunkedGetSkuDetails(productIds) {
// We need to chunk the getSkuDetails call cause it is only allowed to provide a maximum of 20 items per call
return utils.chunk(productIds, 19).reduce(function (promise, productIds) {
return promise.then(function (result) {
return nativeCall('getSkuDetails', productIds).then(function (items) {
return result.concat(items);
});
});
}, Promise.resolve([]));
};
inAppPurchase.getProducts = function (productIds) {

@@ -135,3 +109,3 @@ return new Promise(function (resolve, reject) {

nativeCall('init', []).then(function () {
return chunkedGetSkuDetails(productIds);
return nativeCall('getSkuDetails', productIds);
}).then(function (items) {

@@ -143,5 +117,3 @@ var arr = items.map(function (val) {

description: val.description,
price: val.price,
currency: val.currency,
priceAsDecimal: val.priceAsDecimal,
price: val.price
};

@@ -219,2 +191,21 @@ });

inAppPurchase.getPurchaseHistory = function () {
return nativeCall('init', []).then(function () {
return nativeCall('getPurchaseHistory', []);
}).then(function (purchaseHistory) {
var arr = [];
if (purchaseHistory) {
arr = purchaseHistory.map(function (val) {
return {
productId: val.productId,
purchaseTime: val.purchaseTime,
developerPayload: val.developerPayload,
purchaseToken: val.purchaseToken
};
});
}
return Promise.resolve(arr);
});
};
inAppPurchase.getReceipt = function () {

@@ -221,0 +212,0 @@ return Promise.resolve('');

@@ -31,17 +31,2 @@ 'use strict';

};
utils.chunk = function (array, size) {
if (!Array.isArray(array)) {
throw new Error('Invalid array');
}
if (typeof size !== 'number' || size < 1) {
throw new Error('Invalid size');
}
var times = Math.ceil(array.length / size);
return Array.apply(null, Array(times)).reduce(function (result, val, i) {
return result.concat([array.slice(i * size, (i + 1) * size)]);
}, []);
};
'use strict';

@@ -86,5 +71,3 @@

description: val.description,
price: val.price,
currency: val.currency,
priceAsDecimal: val.priceAsDecimal,
price: val.price
};

@@ -132,4 +115,4 @@ });

inAppPurchase.getReceipt = function () {
return nativeCall('getReceipt').then(function (res) {
inAppPurchase.loadReceipt = function () {
return nativeCall('loadReceipt').then(function (res) {
var receipt = '';

@@ -143,2 +126,18 @@ if (res && res.receipt) {

inAppPurchase.refreshReceipt = function () {
return nativeCall('refreshReceipt').then(function (res) {
var receipt = '';
if (res && res.receipt) {
receipt = res.receipt;
}
return receipt;
});
};
inAppPurchase.getReceipt = function () {
console.warn('This method is deprecated in favor of refreshReceipt().');
inAppPurchase.refreshReceipt();
};
inAppPurchase.restorePurchases = function () {

@@ -145,0 +144,0 @@ return nativeCall('restorePurchases').then(function (res) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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