react-native-iap 10.0.6 → 10.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ios/RNIapIos.swift
CHANGED
|
@@ -311,6 +311,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
if let prod = product {
|
|
314
|
+
addPromise(forKey: prod.productIdentifier, resolve: resolve, reject: reject)
|
|
314
315
|
let payment = SKMutablePayment(product: prod)
|
|
315
316
|
payment.quantity = quantity
|
|
316
317
|
SKPaymentQueue.default().add(payment)
|
|
@@ -11,12 +11,11 @@ var _iap = require("./iap");
|
|
|
11
11
|
|
|
12
12
|
var _internal = require("./internal");
|
|
13
13
|
|
|
14
|
-
const eventEmitter = new _reactNative.NativeEventEmitter((0, _iap.getNativeModule)());
|
|
15
14
|
/**
|
|
16
15
|
* Add IAP purchase event
|
|
17
16
|
*/
|
|
18
|
-
|
|
19
17
|
const purchaseUpdatedListener = listener => {
|
|
18
|
+
const eventEmitter = new _reactNative.NativeEventEmitter((0, _iap.getNativeModule)());
|
|
20
19
|
const emitterSubscription = eventEmitter.addListener('purchase-updated', listener);
|
|
21
20
|
|
|
22
21
|
if (_internal.isAndroid) {
|
|
@@ -32,7 +31,10 @@ const purchaseUpdatedListener = listener => {
|
|
|
32
31
|
|
|
33
32
|
exports.purchaseUpdatedListener = purchaseUpdatedListener;
|
|
34
33
|
|
|
35
|
-
const purchaseErrorListener = listener =>
|
|
34
|
+
const purchaseErrorListener = listener => {
|
|
35
|
+
const eventEmitter = new _reactNative.NativeEventEmitter((0, _iap.getNativeModule)());
|
|
36
|
+
return eventEmitter.addListener('purchase-error', listener);
|
|
37
|
+
};
|
|
36
38
|
/**
|
|
37
39
|
* Add IAP promoted subscription event
|
|
38
40
|
*
|
|
@@ -44,7 +46,8 @@ exports.purchaseErrorListener = purchaseErrorListener;
|
|
|
44
46
|
|
|
45
47
|
const promotedProductListener = listener => {
|
|
46
48
|
if (_internal.isIos) {
|
|
47
|
-
|
|
49
|
+
const eventEmitter = new _reactNative.NativeEventEmitter((0, _iap.getIosModule)());
|
|
50
|
+
return eventEmitter.addListener('iap-promoted-product', listener);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["purchaseUpdatedListener","listener","eventEmitter","NativeEventEmitter","getNativeModule","emitterSubscription","addListener","isAndroid","getAndroidModule","startListening","purchaseErrorListener","promotedProductListener","isIos","getIosModule"],"sources":["eventEmitter.ts"],"sourcesContent":["import {EmitterSubscription, NativeEventEmitter} from 'react-native';\n\nimport {getAndroidModule, getIosModule, getNativeModule} from './iap';\nimport {isAndroid, isIos} from './internal';\nimport type {PurchaseError} from './purchaseError';\nimport type {Purchase} from './types';\n\n/**\n * Add IAP purchase event\n */\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const eventEmitter = new NativeEventEmitter(getNativeModule());\n const emitterSubscription = eventEmitter.addListener(\n 'purchase-updated',\n listener,\n );\n\n if (isAndroid) {\n getAndroidModule().startListening();\n }\n\n return emitterSubscription;\n};\n\n/**\n * Add IAP purchase error event\n */\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n): EmitterSubscription => {\n const eventEmitter = new NativeEventEmitter(getNativeModule());\n return eventEmitter.addListener('purchase-error', listener);\n};\n\n/**\n * Add IAP promoted subscription event\n *\n * @platform iOS\n */\nexport const promotedProductListener = (listener: () => void) => {\n if (isIos) {\n const eventEmitter = new NativeEventEmitter(getIosModule());\n return eventEmitter.addListener('iap-promoted-product', listener);\n }\n\n return null;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAIA;AACA;AACA;AACO,MAAMA,uBAAuB,GAClCC,QADqC,IAElC;EACH,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuB,IAAAC,oBAAA,GAAvB,CAArB;EACA,MAAMC,mBAAmB,GAAGH,YAAY,CAACI,WAAb,CAC1B,kBAD0B,EAE1BL,QAF0B,CAA5B;;EAKA,IAAIM,mBAAJ,EAAe;IACb,IAAAC,qBAAA,IAAmBC,cAAnB;EACD;;EAED,OAAOJ,mBAAP;AACD,CAdM;AAgBP;AACA;AACA;;;;;AACO,MAAMK,qBAAqB,GAChCT,QADmC,IAEX;EACxB,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuB,IAAAC,oBAAA,GAAvB,CAArB;EACA,OAAOF,YAAY,CAACI,WAAb,CAAyB,gBAAzB,EAA2CL,QAA3C,CAAP;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMU,uBAAuB,GAAIV,QAAD,IAA0B;EAC/D,IAAIW,eAAJ,EAAW;IACT,MAAMV,YAAY,GAAG,IAAIC,+BAAJ,CAAuB,IAAAU,iBAAA,GAAvB,CAArB;IACA,OAAOX,YAAY,CAACI,WAAb,CAAyB,sBAAzB,EAAiDL,QAAjD,CAAP;EACD;;EAED,OAAO,IAAP;AACD,CAPM"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NativeEventEmitter } from 'react-native';
|
|
2
2
|
import { getAndroidModule, getIosModule, getNativeModule } from './iap';
|
|
3
3
|
import { isAndroid, isIos } from './internal';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
/**
|
|
6
6
|
* Add IAP purchase event
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
export const purchaseUpdatedListener = listener => {
|
|
9
|
+
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
10
10
|
const emitterSubscription = eventEmitter.addListener('purchase-updated', listener);
|
|
11
11
|
|
|
12
12
|
if (isAndroid) {
|
|
@@ -19,7 +19,10 @@ export const purchaseUpdatedListener = listener => {
|
|
|
19
19
|
* Add IAP purchase error event
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
export const purchaseErrorListener = listener =>
|
|
22
|
+
export const purchaseErrorListener = listener => {
|
|
23
|
+
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
24
|
+
return eventEmitter.addListener('purchase-error', listener);
|
|
25
|
+
};
|
|
23
26
|
/**
|
|
24
27
|
* Add IAP promoted subscription event
|
|
25
28
|
*
|
|
@@ -28,7 +31,8 @@ export const purchaseErrorListener = listener => eventEmitter.addListener('purch
|
|
|
28
31
|
|
|
29
32
|
export const promotedProductListener = listener => {
|
|
30
33
|
if (isIos) {
|
|
31
|
-
|
|
34
|
+
const eventEmitter = new NativeEventEmitter(getIosModule());
|
|
35
|
+
return eventEmitter.addListener('iap-promoted-product', listener);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","getAndroidModule","getIosModule","getNativeModule","isAndroid","isIos","
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","getAndroidModule","getIosModule","getNativeModule","isAndroid","isIos","purchaseUpdatedListener","listener","eventEmitter","emitterSubscription","addListener","startListening","purchaseErrorListener","promotedProductListener"],"sources":["eventEmitter.ts"],"sourcesContent":["import {EmitterSubscription, NativeEventEmitter} from 'react-native';\n\nimport {getAndroidModule, getIosModule, getNativeModule} from './iap';\nimport {isAndroid, isIos} from './internal';\nimport type {PurchaseError} from './purchaseError';\nimport type {Purchase} from './types';\n\n/**\n * Add IAP purchase event\n */\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const eventEmitter = new NativeEventEmitter(getNativeModule());\n const emitterSubscription = eventEmitter.addListener(\n 'purchase-updated',\n listener,\n );\n\n if (isAndroid) {\n getAndroidModule().startListening();\n }\n\n return emitterSubscription;\n};\n\n/**\n * Add IAP purchase error event\n */\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n): EmitterSubscription => {\n const eventEmitter = new NativeEventEmitter(getNativeModule());\n return eventEmitter.addListener('purchase-error', listener);\n};\n\n/**\n * Add IAP promoted subscription event\n *\n * @platform iOS\n */\nexport const promotedProductListener = (listener: () => void) => {\n if (isIos) {\n const eventEmitter = new NativeEventEmitter(getIosModule());\n return eventEmitter.addListener('iap-promoted-product', listener);\n }\n\n return null;\n};\n"],"mappings":"AAAA,SAA6BA,kBAA7B,QAAsD,cAAtD;AAEA,SAAQC,gBAAR,EAA0BC,YAA1B,EAAwCC,eAAxC,QAA8D,OAA9D;AACA,SAAQC,SAAR,EAAmBC,KAAnB,QAA+B,YAA/B;;AAIA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAClCC,QADqC,IAElC;EACH,MAAMC,YAAY,GAAG,IAAIR,kBAAJ,CAAuBG,eAAe,EAAtC,CAArB;EACA,MAAMM,mBAAmB,GAAGD,YAAY,CAACE,WAAb,CAC1B,kBAD0B,EAE1BH,QAF0B,CAA5B;;EAKA,IAAIH,SAAJ,EAAe;IACbH,gBAAgB,GAAGU,cAAnB;EACD;;EAED,OAAOF,mBAAP;AACD,CAdM;AAgBP;AACA;AACA;;AACA,OAAO,MAAMG,qBAAqB,GAChCL,QADmC,IAEX;EACxB,MAAMC,YAAY,GAAG,IAAIR,kBAAJ,CAAuBG,eAAe,EAAtC,CAArB;EACA,OAAOK,YAAY,CAACE,WAAb,CAAyB,gBAAzB,EAA2CH,QAA3C,CAAP;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMM,uBAAuB,GAAIN,QAAD,IAA0B;EAC/D,IAAIF,KAAJ,EAAW;IACT,MAAMG,YAAY,GAAG,IAAIR,kBAAJ,CAAuBE,YAAY,EAAnC,CAArB;IACA,OAAOM,YAAY,CAACE,WAAb,CAAyB,sBAAzB,EAAiDH,QAAjD,CAAP;EACD;;EAED,OAAO,IAAP;AACD,CAPM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.7",
|
|
4
4
|
"description": "React Native In App Purchase Module.",
|
|
5
5
|
"repository": "https://github.com/dooboolab/react-native-iap",
|
|
6
6
|
"author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab)",
|
package/src/eventEmitter.ts
CHANGED
|
@@ -5,14 +5,13 @@ import {isAndroid, isIos} from './internal';
|
|
|
5
5
|
import type {PurchaseError} from './purchaseError';
|
|
6
6
|
import type {Purchase} from './types';
|
|
7
7
|
|
|
8
|
-
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Add IAP purchase event
|
|
12
10
|
*/
|
|
13
11
|
export const purchaseUpdatedListener = (
|
|
14
12
|
listener: (event: Purchase) => void,
|
|
15
13
|
) => {
|
|
14
|
+
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
16
15
|
const emitterSubscription = eventEmitter.addListener(
|
|
17
16
|
'purchase-updated',
|
|
18
17
|
listener,
|
|
@@ -30,7 +29,10 @@ export const purchaseUpdatedListener = (
|
|
|
30
29
|
*/
|
|
31
30
|
export const purchaseErrorListener = (
|
|
32
31
|
listener: (error: PurchaseError) => void,
|
|
33
|
-
): EmitterSubscription =>
|
|
32
|
+
): EmitterSubscription => {
|
|
33
|
+
const eventEmitter = new NativeEventEmitter(getNativeModule());
|
|
34
|
+
return eventEmitter.addListener('purchase-error', listener);
|
|
35
|
+
};
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* Add IAP promoted subscription event
|
|
@@ -39,10 +41,8 @@ export const purchaseErrorListener = (
|
|
|
39
41
|
*/
|
|
40
42
|
export const promotedProductListener = (listener: () => void) => {
|
|
41
43
|
if (isIos) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
listener,
|
|
45
|
-
);
|
|
44
|
+
const eventEmitter = new NativeEventEmitter(getIosModule());
|
|
45
|
+
return eventEmitter.addListener('iap-promoted-product', listener);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return null;
|