react-native-iap 12.8.5 → 12.9.0
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/android/build.gradle +1 -1
- package/android/src/amazon/AndroidManifest.xml +1 -1
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/EventSender.kt +2 -2
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/PurchasingServiceProxy.kt +1 -1
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/PurchasingServiceProxyAmazonImpl.kt +1 -1
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/RNIapActivityListener.kt +1 -1
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/RNIapAmazonListener.kt +20 -20
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/RNIapAmazonModule.kt +5 -5
- package/android/src/amazon/java/com/dooboolab/{RNIap → rniap}/RNIapPackage.kt +1 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/dooboolab/{RNIap → rniap}/PromiseUtils.kt +2 -2
- package/android/src/main/java/com/dooboolab/{RNIap → rniap}/PromiseUtlis.kt +1 -1
- package/android/src/play/java/com/dooboolab/{RNIap → rniap}/PlayUtils.kt +12 -12
- package/android/src/play/java/com/dooboolab/{RNIap → rniap}/RNIapActivityListener.kt +1 -1
- package/android/src/play/java/com/dooboolab/{RNIap → rniap}/RNIapModule.kt +58 -58
- package/android/src/play/java/com/dooboolab/{RNIap → rniap}/RNIapPackage.kt +1 -1
- package/android/src/testAmazon/java/com/dooboolab/{RNIap → rniap}/RNIapAmazonModuleTest.kt +2 -2
- package/lib/commonjs/eventEmitter.js +3 -17
- package/lib/commonjs/eventEmitter.js.map +1 -1
- package/lib/commonjs/hooks/index.js +0 -2
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useIAP.js +0 -7
- package/lib/commonjs/hooks/useIAP.js.map +1 -1
- package/lib/commonjs/hooks/withIAPContext.js +0 -11
- package/lib/commonjs/hooks/withIAPContext.js.map +1 -1
- package/lib/commonjs/iap.js +15 -84
- package/lib/commonjs/iap.js.map +1 -1
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/enhancedFetch.js +0 -4
- package/lib/commonjs/internal/enhancedFetch.js.map +1 -1
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js +3 -6
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js.map +1 -1
- package/lib/commonjs/internal/index.js +0 -6
- package/lib/commonjs/internal/index.js.map +1 -1
- package/lib/commonjs/internal/platform.js +6 -40
- package/lib/commonjs/internal/platform.js.map +1 -1
- package/lib/commonjs/modules/amazon.js +3 -12
- package/lib/commonjs/modules/amazon.js.map +1 -1
- package/lib/commonjs/modules/android.js +3 -17
- package/lib/commonjs/modules/android.js.map +1 -1
- package/lib/commonjs/modules/index.js +0 -8
- package/lib/commonjs/modules/index.js.map +1 -1
- package/lib/commonjs/modules/ios.js +9 -39
- package/lib/commonjs/modules/ios.js.map +1 -1
- package/lib/commonjs/modules/iosSk2.js +5 -19
- package/lib/commonjs/modules/iosSk2.js.map +1 -1
- package/lib/commonjs/purchaseError.js +4 -8
- package/lib/commonjs/purchaseError.js.map +1 -1
- package/lib/commonjs/types/android.js +19 -29
- package/lib/commonjs/types/android.js.map +1 -1
- package/lib/commonjs/types/apple.js +1 -3
- package/lib/commonjs/types/apple.js.map +1 -1
- package/lib/commonjs/types/appleSk2.js +2 -13
- package/lib/commonjs/types/appleSk2.js.map +1 -1
- package/lib/commonjs/types/index.js +21 -31
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/eventEmitter.js +3 -6
- package/lib/module/eventEmitter.js.map +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useIAP.js +0 -2
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/hooks/withIAPContext.js +0 -3
- package/lib/module/hooks/withIAPContext.js.map +1 -1
- package/lib/module/iap.js +15 -43
- package/lib/module/iap.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/enhancedFetch.js +0 -2
- package/lib/module/internal/enhancedFetch.js.map +1 -1
- package/lib/module/internal/fillProductsWithAdditionalData.js +3 -3
- package/lib/module/internal/fillProductsWithAdditionalData.js.map +1 -1
- package/lib/module/internal/index.js.map +1 -1
- package/lib/module/internal/platform.js +8 -14
- package/lib/module/internal/platform.js.map +1 -1
- package/lib/module/modules/amazon.js +3 -3
- package/lib/module/modules/amazon.js.map +1 -1
- package/lib/module/modules/android.js +3 -5
- package/lib/module/modules/android.js.map +1 -1
- package/lib/module/modules/index.js.map +1 -1
- package/lib/module/modules/ios.js +9 -20
- package/lib/module/modules/ios.js.map +1 -1
- package/lib/module/modules/iosSk2.js +5 -5
- package/lib/module/modules/iosSk2.js.map +1 -1
- package/lib/module/purchaseError.js +3 -6
- package/lib/module/purchaseError.js.map +1 -1
- package/lib/module/types/android.js +16 -22
- package/lib/module/types/android.js.map +1 -1
- package/lib/module/types/apple.js +1 -1
- package/lib/module/types/apple.js.map +1 -1
- package/lib/module/types/appleSk2.js +2 -3
- package/lib/module/types/appleSk2.js.map +1 -1
- package/lib/module/types/index.js +17 -25
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts +1 -1
- package/lib/typescript/plugin/src/withIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/hooks/withIAPContext.d.ts +1 -1
- package/lib/typescript/src/hooks/withIAPContext.d.ts.map +1 -1
- package/lib/typescript/src/iap.d.ts +1 -1
- package/lib/typescript/src/iap.d.ts.map +1 -1
- package/lib/typescript/src/internal/platform.d.ts +7 -5
- package/lib/typescript/src/internal/platform.d.ts.map +1 -1
- package/lib/typescript/src/modules/amazon.d.ts +8 -8
- package/lib/typescript/src/modules/amazon.d.ts.map +1 -1
- package/lib/typescript/src/modules/android.d.ts +9 -9
- package/lib/typescript/src/modules/android.d.ts.map +1 -1
- package/lib/typescript/src/modules/ios.d.ts +11 -11
- package/lib/typescript/src/modules/ios.d.ts.map +1 -1
- package/lib/typescript/src/modules/iosSk2.d.ts +11 -11
- package/lib/typescript/src/modules/iosSk2.d.ts.map +1 -1
- package/lib/typescript/src/types/amazon.d.ts +2 -2
- package/lib/typescript/src/types/amazon.d.ts.map +1 -1
- package/lib/typescript/src/types/android.d.ts +1 -1
- package/lib/typescript/src/types/android.d.ts.map +1 -1
- package/lib/typescript/src/types/appleSk2.d.ts +11 -11
- package/lib/typescript/src/types/appleSk2.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +10 -10
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +18 -17
- package/plugin/build/withIAP.d.ts +1 -1
- package/src/hooks/withIAPContext.tsx +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
import { enhancedFetch } from '../internal';
|
|
3
3
|
export const AmazonModule = NativeModules.RNIapAmazonModule;
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* Validate receipt for Amazon. NOTE: This method is here for debugging purposes only. Including
|
|
6
7
|
* your developer secret in the binary you ship to users is potentially dangerous.
|
|
@@ -11,7 +12,6 @@ export const AmazonModule = NativeModules.RNIapAmazonModule;
|
|
|
11
12
|
* @param {boolean} useSandbox Defaults to true, use sandbox environment or production.
|
|
12
13
|
* @returns {Promise<object>}
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
export const validateReceiptAmazon = async _ref => {
|
|
16
16
|
let {
|
|
17
17
|
developerSecret,
|
|
@@ -23,17 +23,17 @@ export const validateReceiptAmazon = async _ref => {
|
|
|
23
23
|
const url = `https://appstore-sdk.amazon.com/${sandBoxUrl}version/1.0/verifyReceiptId/developer/${developerSecret}/user/${userId}/receiptId/${receiptId}`;
|
|
24
24
|
return await enhancedFetch(url);
|
|
25
25
|
};
|
|
26
|
+
|
|
26
27
|
/**
|
|
27
28
|
* Returns the status of verifying app's license @see AmazonLicensingStatus
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
30
|
export const verifyLicense = async () => AmazonModule.verifyLicense();
|
|
31
|
+
|
|
31
32
|
/**
|
|
32
33
|
* Deep link to subscriptions screen on Android.
|
|
33
34
|
* @param {string} sku The product's SKU (on Android)
|
|
34
35
|
* @returns {Promise<void>}
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
37
|
export const deepLinkToSubscriptionsAmazon = async _ref2 => {
|
|
38
38
|
let {
|
|
39
39
|
isAmazonDevice
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","enhancedFetch","AmazonModule","RNIapAmazonModule","validateReceiptAmazon","developerSecret","userId","receiptId","useSandbox","sandBoxUrl","url","verifyLicense","deepLinkToSubscriptionsAmazon","isAmazonDevice","deepLinkToSubscriptions"],"sourceRoot":"../../../src","sources":["modules/amazon.ts"],"mappings":"AAAA,SAAQA,
|
|
1
|
+
{"version":3,"names":["NativeModules","enhancedFetch","AmazonModule","RNIapAmazonModule","validateReceiptAmazon","_ref","developerSecret","userId","receiptId","useSandbox","sandBoxUrl","url","verifyLicense","deepLinkToSubscriptionsAmazon","_ref2","isAmazonDevice","deepLinkToSubscriptions"],"sourceRoot":"../../../src","sources":["modules/amazon.ts"],"mappings":"AAAA,SAAQA,aAAa,QAAO,cAAc;AAE1C,SAAQC,aAAa,QAAO,aAAa;AA2CzC,OAAO,MAAMC,YAAY,GACvBF,aAAa,CAACG,iBAAsC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAG,MAAAC,IAAA,IAUT;EAAA,IAVgB;IAC1CC,eAAe;IACfC,MAAM;IACNC,SAAS;IACTC,UAAU,GAAG;EAMf,CAAC,GAAAJ,IAAA;EACC,MAAMK,UAAU,GAAGD,UAAU,GAAG,UAAU,GAAG,EAAE;EAC/C,MAAME,GAAG,GAAI,mCAAkCD,UAAW,yCAAwCJ,eAAgB,SAAQC,MAAO,cAAaC,SAAU,EAAC;EAEzJ,OAAO,MAAMP,aAAa,CAAcU,GAAG,CAAC;AAC9C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAC3BV,YAAY,CAACU,aAAa,EAAE;;AAE9B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,GAAG,MAAAC,KAAA;EAAA,IAAO;IAClDC;EAGF,CAAC,GAAAD,KAAA;EAAA,OAAoBZ,YAAY,CAACc,uBAAuB,CAACD,cAAc,CAAC;AAAA"}
|
|
@@ -8,12 +8,12 @@ export const AndroidModule = NativeModules.RNIapModule;
|
|
|
8
8
|
export const getInstallSourceAndroid = () => {
|
|
9
9
|
return RNIapModule ? InstallSourceAndroid.GOOGLE_PLAY : InstallSourceAndroid.AMAZON;
|
|
10
10
|
};
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Deep link to subscriptions screen on Android.
|
|
13
14
|
* @param {string} sku The product's SKU (on Android)
|
|
14
15
|
* @returns {Promise<void>}
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
17
|
export const deepLinkToSubscriptionsAndroid = async _ref => {
|
|
18
18
|
let {
|
|
19
19
|
sku
|
|
@@ -21,6 +21,7 @@ export const deepLinkToSubscriptionsAndroid = async _ref => {
|
|
|
21
21
|
checkNativeAndroidAvailable();
|
|
22
22
|
return Linking.openURL(`https://play.google.com/store/account/subscriptions?package=${await RNIapModule.getPackageName()}&sku=${sku}`);
|
|
23
23
|
};
|
|
24
|
+
|
|
24
25
|
/**
|
|
25
26
|
* Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including
|
|
26
27
|
* your access token in the binary you ship to users is potentially dangerous.
|
|
@@ -32,7 +33,6 @@ export const deepLinkToSubscriptionsAndroid = async _ref => {
|
|
|
32
33
|
* @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.
|
|
33
34
|
* @returns {Promise<object>}
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
36
|
export const validateReceiptAndroid = async _ref2 => {
|
|
37
37
|
let {
|
|
38
38
|
packageName,
|
|
@@ -49,21 +49,19 @@ export const validateReceiptAndroid = async _ref2 => {
|
|
|
49
49
|
'Content-Type': 'application/json'
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
|
|
53
52
|
if (!response.ok) {
|
|
54
53
|
throw Object.assign(new Error(response.statusText), {
|
|
55
54
|
statusCode: response.status
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
|
-
|
|
59
57
|
return response.json();
|
|
60
58
|
};
|
|
59
|
+
|
|
61
60
|
/**
|
|
62
61
|
* Acknowledge a product (on Android.) No-op on iOS.
|
|
63
62
|
* @param {string} token The product's token (on Android)
|
|
64
63
|
* @returns {Promise<PurchaseResult | void>}
|
|
65
64
|
*/
|
|
66
|
-
|
|
67
65
|
export const acknowledgePurchaseAndroid = _ref3 => {
|
|
68
66
|
let {
|
|
69
67
|
token,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Linking","NativeModules","checkNativeAndroidAvailable","getAndroidModule","InstallSourceAndroid","RNIapModule","AndroidModule","getInstallSourceAndroid","GOOGLE_PLAY","AMAZON","deepLinkToSubscriptionsAndroid","sku","openURL","getPackageName","validateReceiptAndroid","packageName","productId","productToken","accessToken","isSub","type","url","response","fetch","method","headers","ok","Object","assign","Error","statusText","statusCode","status","json","acknowledgePurchaseAndroid","token","developerPayload","acknowledgePurchase"],"sourceRoot":"../../../src","sources":["modules/android.ts"],"mappings":"AAAA,SAAQA,
|
|
1
|
+
{"version":3,"names":["Linking","NativeModules","checkNativeAndroidAvailable","getAndroidModule","InstallSourceAndroid","RNIapModule","AndroidModule","getInstallSourceAndroid","GOOGLE_PLAY","AMAZON","deepLinkToSubscriptionsAndroid","_ref","sku","openURL","getPackageName","validateReceiptAndroid","_ref2","packageName","productId","productToken","accessToken","isSub","type","url","response","fetch","method","headers","ok","Object","assign","Error","statusText","statusCode","status","json","acknowledgePurchaseAndroid","_ref3","token","developerPayload","acknowledgePurchase"],"sourceRoot":"../../../src","sources":["modules/android.ts"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,aAAa,QAAO,cAAc;AAEnD,SAAQC,2BAA2B,EAAEC,gBAAgB,QAAO,aAAa;AACzE,SACEC,oBAAoB,QAOf,UAAU;AAKjB,MAAM;EAACC;AAAW,CAAC,GAAGJ,aAAa;AAsDnC,OAAO,MAAMK,aAAa,GAAGL,aAAa,CAACI,WAAiC;AAE5E,OAAO,MAAME,uBAAuB,GAAGA,CAAA,KAA4B;EACjE,OAAOF,WAAW,GACdD,oBAAoB,CAACI,WAAW,GAChCJ,oBAAoB,CAACK,MAAM;AACjC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,GAAG,MAAAC,IAAA,IAIzB;EAAA,IAJgC;IACnDC;EAGF,CAAC,GAAAD,IAAA;EACCT,2BAA2B,EAAE;EAE7B,OAAOF,OAAO,CAACa,OAAO,CACnB,+DAA8D,MAAMR,WAAW,CAACS,cAAc,EAAG,QAAOF,GAAI,EAAC,CAC/G;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,sBAAsB,GAAG,MAAAC,KAAA,IAYF;EAAA,IAZS;IAC3CC,WAAW;IACXC,SAAS;IACTC,YAAY;IACZC,WAAW;IACXC;EAOF,CAAC,GAAAL,KAAA;EACC,MAAMM,IAAI,GAAGD,KAAK,GAAG,eAAe,GAAG,UAAU;EAEjD,MAAME,GAAG,GACP,0EAA0E,GACzE,IAAGN,WAAY,cAAaK,IAAK,IAAGJ,SAAU,EAAC,GAC/C,WAAUC,YAAa,iBAAgBC,WAAY,EAAC;EAEvD,MAAMI,QAAQ,GAAG,MAAMC,KAAK,CAACF,GAAG,EAAE;IAChCG,MAAM,EAAE,KAAK;IACbC,OAAO,EAAE;MACP,cAAc,EAAE;IAClB;EACF,CAAC,CAAC;EAEF,IAAI,CAACH,QAAQ,CAACI,EAAE,EAAE;IAChB,MAAMC,MAAM,CAACC,MAAM,CAAC,IAAIC,KAAK,CAACP,QAAQ,CAACQ,UAAU,CAAC,EAAE;MAClDC,UAAU,EAAET,QAAQ,CAACU;IACvB,CAAC,CAAC;EACJ;EAEA,OAAOV,QAAQ,CAACW,IAAI,EAAE;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAGC,KAAA,IAMM;EAAA,IANL;IACzCC,KAAK;IACLC;EAIF,CAAC,GAAAF,KAAA;EACC,OAAOlC,gBAAgB,EAAE,CAACqC,mBAAmB,CAACF,KAAK,EAAEC,gBAAgB,CAAC;AACxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["modules/index.ts"],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["modules/index.ts"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,OAAO;AACrB,cAAc,UAAU"}
|
|
@@ -3,12 +3,12 @@ import { getIosModule, isIosStorekit2 } from '../internal';
|
|
|
3
3
|
const {
|
|
4
4
|
RNIapIos
|
|
5
5
|
} = NativeModules;
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Get the current receipt base64 encoded in IOS.
|
|
9
8
|
* @returns {Promise<ProductPurchase[]>}
|
|
10
9
|
*/
|
|
11
10
|
export const getPendingPurchasesIOS = async () => getIosModule().getPendingTransactions();
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
* Get the current receipt base64 encoded in IOS.
|
|
14
14
|
*
|
|
@@ -45,12 +45,10 @@ Based on the note above, looks like forceRefresh only makes sense when testing a
|
|
|
45
45
|
And only afer a direct user action.
|
|
46
46
|
* @returns {Promise<string | undefined | null>} The receipt data
|
|
47
47
|
*/
|
|
48
|
-
|
|
49
48
|
export const getReceiptIOS = async _ref => {
|
|
50
49
|
let {
|
|
51
50
|
forceRefresh
|
|
52
51
|
} = _ref;
|
|
53
|
-
|
|
54
52
|
if (!isIosStorekit2()) {
|
|
55
53
|
return RNIapIos.requestReceipt(forceRefresh ?? false);
|
|
56
54
|
} else {
|
|
@@ -61,14 +59,13 @@ export const getReceiptIOS = async _ref => {
|
|
|
61
59
|
* Launches a modal to register the redeem offer code in IOS.
|
|
62
60
|
* @returns {Promise<null>}
|
|
63
61
|
*/
|
|
64
|
-
|
|
65
62
|
export const presentCodeRedemptionSheetIOS = async () => getIosModule().presentCodeRedemptionSheet();
|
|
63
|
+
|
|
66
64
|
/**
|
|
67
65
|
* Should Add Store Payment (iOS only)
|
|
68
66
|
* Indicates the the App Store purchase should continue from the app instead of the App Store.
|
|
69
67
|
* @returns {Promise<Product | null>} promoted product
|
|
70
68
|
*/
|
|
71
|
-
|
|
72
69
|
export const getPromotedProductIOS = () => {
|
|
73
70
|
if (!isIosStorekit2()) {
|
|
74
71
|
return RNIapIos.promotedProduct();
|
|
@@ -76,14 +73,13 @@ export const getPromotedProductIOS = () => {
|
|
|
76
73
|
return Promise.reject('Only available on Sk1');
|
|
77
74
|
}
|
|
78
75
|
};
|
|
76
|
+
|
|
79
77
|
/**
|
|
80
78
|
* Buy the currently selected promoted product (iOS only)
|
|
81
79
|
* Initiates the payment process for a promoted product. Should only be called in response to the `iap-promoted-product` event.
|
|
82
80
|
* @returns {Promise<void>}
|
|
83
81
|
*/
|
|
84
|
-
|
|
85
82
|
export const buyPromotedProductIOS = () => getIosModule().buyPromotedProduct();
|
|
86
|
-
|
|
87
83
|
const fetchJsonOrThrow = async (url, receiptBody) => {
|
|
88
84
|
const response = await fetch(url, {
|
|
89
85
|
method: 'POST',
|
|
@@ -93,51 +89,45 @@ const fetchJsonOrThrow = async (url, receiptBody) => {
|
|
|
93
89
|
},
|
|
94
90
|
body: JSON.stringify(receiptBody)
|
|
95
91
|
});
|
|
96
|
-
|
|
97
92
|
if (!response.ok) {
|
|
98
93
|
throw Object.assign(new Error(response.statusText), {
|
|
99
94
|
statusCode: response.status
|
|
100
95
|
});
|
|
101
96
|
}
|
|
102
|
-
|
|
103
97
|
return response.json();
|
|
104
98
|
};
|
|
105
|
-
|
|
106
99
|
const TEST_RECEIPT = 21007;
|
|
107
|
-
|
|
108
100
|
const requestAgnosticReceiptValidationIos = async receiptBody => {
|
|
109
|
-
const response = await fetchJsonOrThrow('https://buy.itunes.apple.com/verifyReceipt', receiptBody);
|
|
110
|
-
// https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
|
|
101
|
+
const response = await fetchJsonOrThrow('https://buy.itunes.apple.com/verifyReceipt', receiptBody);
|
|
111
102
|
|
|
103
|
+
// Best practice is to check for test receipt and check sandbox instead
|
|
104
|
+
// https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
|
|
112
105
|
if (response && response.status === TEST_RECEIPT) {
|
|
113
106
|
const testResponse = await fetchJsonOrThrow('https://sandbox.itunes.apple.com/verifyReceipt', receiptBody);
|
|
114
107
|
return testResponse;
|
|
115
108
|
}
|
|
116
|
-
|
|
117
109
|
return response;
|
|
118
110
|
};
|
|
111
|
+
|
|
119
112
|
/**
|
|
120
113
|
* Validate receipt for iOS.
|
|
121
114
|
* @param {object} receiptBody the receipt body to send to apple server.
|
|
122
115
|
* @param {boolean} isTest whether this is in test environment which is sandbox.
|
|
123
116
|
* @returns {Promise<Apple.ReceiptValidationResponse | false>}
|
|
124
117
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
118
|
export const validateReceiptIos = async _ref2 => {
|
|
128
119
|
let {
|
|
129
120
|
receiptBody,
|
|
130
121
|
isTest
|
|
131
122
|
} = _ref2;
|
|
132
|
-
|
|
133
123
|
if (isTest == null) {
|
|
134
124
|
return await requestAgnosticReceiptValidationIos(receiptBody);
|
|
135
125
|
}
|
|
136
|
-
|
|
137
126
|
const url = isTest ? 'https://sandbox.itunes.apple.com/verifyReceipt' : 'https://buy.itunes.apple.com/verifyReceipt';
|
|
138
127
|
const response = await fetchJsonOrThrow(url, receiptBody);
|
|
139
128
|
return response;
|
|
140
129
|
};
|
|
130
|
+
|
|
141
131
|
/**
|
|
142
132
|
* Clear Transaction (iOS only)
|
|
143
133
|
* Finish remaining transactions. Related to issue #257 and #801
|
|
@@ -145,14 +135,13 @@ export const validateReceiptIos = async _ref2 => {
|
|
|
145
135
|
* https://github.com/dooboolab/react-native-iap/issues/801
|
|
146
136
|
* @returns {Promise<void>}
|
|
147
137
|
*/
|
|
148
|
-
|
|
149
138
|
export const clearTransactionIOS = () => getIosModule().clearTransaction();
|
|
139
|
+
|
|
150
140
|
/**
|
|
151
141
|
* Clear valid Products (iOS only)
|
|
152
142
|
* Remove all products which are validated by Apple server.
|
|
153
143
|
* @returns {void}
|
|
154
144
|
*/
|
|
155
|
-
|
|
156
145
|
export const clearProductsIOS = () => getIosModule().clearProducts();
|
|
157
146
|
export const deepLinkToSubscriptionsIos = () => Linking.openURL('https://apps.apple.com/account/subscriptions');
|
|
158
147
|
//# sourceMappingURL=ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Linking","NativeModules","getIosModule","isIosStorekit2","RNIapIos","getPendingPurchasesIOS","getPendingTransactions","getReceiptIOS","forceRefresh","requestReceipt","Promise","reject","presentCodeRedemptionSheetIOS","presentCodeRedemptionSheet","getPromotedProductIOS","promotedProduct","buyPromotedProductIOS","buyPromotedProduct","fetchJsonOrThrow","url","receiptBody","response","fetch","method","headers","Accept","body","JSON","stringify","ok","Object","assign","Error","statusText","statusCode","status","json","TEST_RECEIPT","requestAgnosticReceiptValidationIos","testResponse","validateReceiptIos","isTest","clearTransactionIOS","clearTransaction","clearProductsIOS","clearProducts","deepLinkToSubscriptionsIos","openURL"],"sourceRoot":"../../../src","sources":["modules/ios.ts"],"mappings":"AAAA,SAAQA,
|
|
1
|
+
{"version":3,"names":["Linking","NativeModules","getIosModule","isIosStorekit2","RNIapIos","getPendingPurchasesIOS","getPendingTransactions","getReceiptIOS","_ref","forceRefresh","requestReceipt","Promise","reject","presentCodeRedemptionSheetIOS","presentCodeRedemptionSheet","getPromotedProductIOS","promotedProduct","buyPromotedProductIOS","buyPromotedProduct","fetchJsonOrThrow","url","receiptBody","response","fetch","method","headers","Accept","body","JSON","stringify","ok","Object","assign","Error","statusText","statusCode","status","json","TEST_RECEIPT","requestAgnosticReceiptValidationIos","testResponse","validateReceiptIos","_ref2","isTest","clearTransactionIOS","clearTransaction","clearProductsIOS","clearProducts","deepLinkToSubscriptionsIos","openURL"],"sourceRoot":"../../../src","sources":["modules/ios.ts"],"mappings":"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"}
|
|
@@ -2,35 +2,35 @@ import { NativeModules } from 'react-native';
|
|
|
2
2
|
const {
|
|
3
3
|
RNIapIosSk2
|
|
4
4
|
} = NativeModules;
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Sync state with Appstore (iOS only)
|
|
8
7
|
* https://developer.apple.com/documentation/storekit/appstore/3791906-sync
|
|
9
8
|
*/
|
|
10
9
|
export const sync = () => RNIapIosSk2.sync();
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
export const isEligibleForIntroOffer = groupID => RNIapIosSk2.isEligibleForIntroOffer(groupID);
|
|
15
|
+
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
export const subscriptionStatus = sku => RNIapIosSk2.subscriptionStatus(sku);
|
|
21
|
+
|
|
21
22
|
/**
|
|
22
23
|
*
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
25
|
export const currentEntitlement = sku => RNIapIosSk2.currentEntitlement(sku);
|
|
26
|
+
|
|
26
27
|
/**
|
|
27
28
|
*
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
30
|
export const latestTransaction = sku => RNIapIosSk2.latestTransaction(sku);
|
|
31
|
+
|
|
31
32
|
/**
|
|
32
33
|
*
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
35
|
export const beginRefundRequest = sku => RNIapIosSk2.beginRefundRequest(sku);
|
|
36
36
|
//# sourceMappingURL=iosSk2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","RNIapIosSk2","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sourceRoot":"../../../src","sources":["modules/iosSk2.ts"],"mappings":"AAAA,SAAQA,
|
|
1
|
+
{"version":3,"names":["NativeModules","RNIapIosSk2","sync","isEligibleForIntroOffer","groupID","subscriptionStatus","sku","currentEntitlement","latestTransaction","beginRefundRequest"],"sourceRoot":"../../../src","sources":["modules/iosSk2.ts"],"mappings":"AAAA,SAAQA,aAAa,QAAO,cAAc;AAY1C,MAAM;EAACC;AAAW,CAAC,GAAGD,aAAa;AAkDnC;AACA;AACA;AACA;AACA,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAqBD,WAAW,CAACC,IAAI,EAAE;;AAE3D;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAIC,OAAe,IACrDH,WAAW,CAACE,uBAAuB,CAACC,OAAO,CAAC;;AAE9C;AACA;AACA;;AAEA,OAAO,MAAMC,kBAAkB,GAAIC,GAAW,IAC5CL,WAAW,CAACI,kBAAkB,CAACC,GAAG,CAAC;;AAErC;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAID,GAAW,IAC5CL,WAAW,CAACM,kBAAkB,CAACD,GAAG,CAAC;;AAErC;AACA;AACA;AACA,OAAO,MAAME,iBAAiB,GAAIF,GAAW,IAC3CL,WAAW,CAACO,iBAAiB,CAACF,GAAG,CAAC;;AAEpC;AACA;AACA;AACA,OAAO,MAAMG,kBAAkB,GAAIH,GAAW,IAC5CL,WAAW,CAACQ,kBAAkB,CAACH,GAAG,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export let ErrorCode
|
|
2
|
-
|
|
3
|
-
(function (ErrorCode) {
|
|
1
|
+
export let ErrorCode = /*#__PURE__*/function (ErrorCode) {
|
|
4
2
|
ErrorCode["E_UNKNOWN"] = "E_UNKNOWN";
|
|
5
3
|
ErrorCode["E_USER_CANCELLED"] = "E_USER_CANCELLED";
|
|
6
4
|
ErrorCode["E_USER_ERROR"] = "E_USER_ERROR";
|
|
@@ -18,8 +16,8 @@ export let ErrorCode;
|
|
|
18
16
|
ErrorCode["E_DEFERRED_PAYMENT"] = "E_DEFERRED_PAYMENT";
|
|
19
17
|
ErrorCode["E_INTERRUPTED"] = "E_INTERRUPTED";
|
|
20
18
|
ErrorCode["E_IAP_NOT_AVAILABLE"] = "E_IAP_NOT_AVAILABLE";
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return ErrorCode;
|
|
20
|
+
}({});
|
|
23
21
|
export class PurchaseError {
|
|
24
22
|
constructor(name, message, responseCode, debugMessage, code, productId) {
|
|
25
23
|
this.name = name;
|
|
@@ -35,6 +33,5 @@ export class PurchaseError {
|
|
|
35
33
|
this.code = code;
|
|
36
34
|
this.productId = productId;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
}
|
|
40
37
|
//# sourceMappingURL=purchaseError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ErrorCode","PurchaseError","constructor","name","message","responseCode","debugMessage","code","productId"],"sourceRoot":"../../src","sources":["purchaseError.ts"],"mappings":"AAAA,WAAYA,
|
|
1
|
+
{"version":3,"names":["ErrorCode","PurchaseError","constructor","name","message","responseCode","debugMessage","code","productId"],"sourceRoot":"../../src","sources":["purchaseError.ts"],"mappings":"AAAA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAoBrB,OAAO,MAAMC,aAAa,CAAkB;EAC1CC,WAAWA,CACFC,IAAY,EACZC,OAAe,EACfC,YAAqB,EACrBC,YAAqB,EACrBC,IAAgB,EAChBC,SAAkB,EACzB;IAAA,KANOL,IAAY,GAAZA,IAAY;IAAA,KACZC,OAAe,GAAfA,OAAe;IAAA,KACfC,YAAqB,GAArBA,YAAqB;IAAA,KACrBC,YAAqB,GAArBA,YAAqB;IAAA,KACrBC,IAAgB,GAAhBA,IAAgB;IAAA,KAChBC,SAAkB,GAAlBA,SAAkB;IAEzB,IAAI,CAACL,IAAI,GAAG,mCAAmC;IAC/C,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC5B;AACF"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
export let AndroidPurchaseState
|
|
2
|
-
|
|
3
|
-
(function (AndroidPurchaseState) {
|
|
1
|
+
export let AndroidPurchaseState = /*#__PURE__*/function (AndroidPurchaseState) {
|
|
4
2
|
AndroidPurchaseState[AndroidPurchaseState["purchased"] = 0] = "purchased";
|
|
5
3
|
AndroidPurchaseState[AndroidPurchaseState["canceled"] = 1] = "canceled";
|
|
6
4
|
AndroidPurchaseState[AndroidPurchaseState["pending"] = 2] = "pending";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export let AndroidPurchaseType
|
|
10
|
-
|
|
11
|
-
(function (AndroidPurchaseType) {
|
|
5
|
+
return AndroidPurchaseState;
|
|
6
|
+
}({});
|
|
7
|
+
export let AndroidPurchaseType = /*#__PURE__*/function (AndroidPurchaseType) {
|
|
12
8
|
AndroidPurchaseType[AndroidPurchaseType["test"] = 0] = "test";
|
|
13
9
|
AndroidPurchaseType[AndroidPurchaseType["promo"] = 1] = "promo";
|
|
14
10
|
AndroidPurchaseType[AndroidPurchaseType["rewarded"] = 2] = "rewarded";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export let AndroidConsumptionState
|
|
18
|
-
|
|
19
|
-
(function (AndroidConsumptionState) {
|
|
11
|
+
return AndroidPurchaseType;
|
|
12
|
+
}({});
|
|
13
|
+
export let AndroidConsumptionState = /*#__PURE__*/function (AndroidConsumptionState) {
|
|
20
14
|
AndroidConsumptionState[AndroidConsumptionState["yet"] = 0] = "yet";
|
|
21
15
|
AndroidConsumptionState[AndroidConsumptionState["consumed"] = 1] = "consumed";
|
|
22
|
-
|
|
16
|
+
return AndroidConsumptionState;
|
|
17
|
+
}({});
|
|
18
|
+
export let AndroidAcknowledgementState = /*#__PURE__*/function (AndroidAcknowledgementState) {
|
|
19
|
+
AndroidAcknowledgementState[AndroidAcknowledgementState["yet"] = 0] = "yet";
|
|
20
|
+
AndroidAcknowledgementState[AndroidAcknowledgementState["acknowledged"] = 1] = "acknowledged";
|
|
21
|
+
return AndroidAcknowledgementState;
|
|
22
|
+
}({});
|
|
23
23
|
|
|
24
|
-
export let AndroidAcknowledgementState;
|
|
25
24
|
/**
|
|
26
25
|
* Get a list of products (consumable and non-consumable items, but not subscriptions)
|
|
27
26
|
* @param {number} startTimeMillis The time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
|
|
@@ -37,16 +36,11 @@ export let AndroidAcknowledgementState;
|
|
|
37
36
|
* @param {string} kind
|
|
38
37
|
*/
|
|
39
38
|
|
|
40
|
-
(function (AndroidAcknowledgementState) {
|
|
41
|
-
AndroidAcknowledgementState[AndroidAcknowledgementState["yet"] = 0] = "yet";
|
|
42
|
-
AndroidAcknowledgementState[AndroidAcknowledgementState["acknowledged"] = 1] = "acknowledged";
|
|
43
|
-
})(AndroidAcknowledgementState || (AndroidAcknowledgementState = {}));
|
|
44
|
-
|
|
45
39
|
/** Added to maintain backwards compatibility */
|
|
46
40
|
export const singleProductAndroidMap = originalProd => {
|
|
47
41
|
var _originalProd$oneTime, _originalProd$oneTime2, _originalProd$oneTime3;
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const prod = {
|
|
43
|
+
...originalProd,
|
|
50
44
|
//legacy properties
|
|
51
45
|
price: ((_originalProd$oneTime = originalProd.oneTimePurchaseOfferDetails) === null || _originalProd$oneTime === void 0 ? void 0 : _originalProd$oneTime.formattedPrice) ?? originalProd.price,
|
|
52
46
|
localizedPrice: ((_originalProd$oneTime2 = originalProd.oneTimePurchaseOfferDetails) === null || _originalProd$oneTime2 === void 0 ? void 0 : _originalProd$oneTime2.formattedPrice) ?? originalProd.price,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AndroidPurchaseState","AndroidPurchaseType","AndroidConsumptionState","AndroidAcknowledgementState","singleProductAndroidMap","originalProd","prod","price","oneTimePurchaseOfferDetails","formattedPrice","localizedPrice","currency","priceCurrencyCode"],"sourceRoot":"../../../src","sources":["types/android.ts"],"mappings":"AAEA,WAAYA,
|
|
1
|
+
{"version":3,"names":["AndroidPurchaseState","AndroidPurchaseType","AndroidConsumptionState","AndroidAcknowledgementState","singleProductAndroidMap","originalProd","_originalProd$oneTime","_originalProd$oneTime2","_originalProd$oneTime3","prod","price","oneTimePurchaseOfferDetails","formattedPrice","localizedPrice","currency","priceCurrencyCode"],"sourceRoot":"../../../src","sources":["types/android.ts"],"mappings":"AAEA,WAAYA,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAM/B,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAKnC,WAAYC,2BAA2B,0BAA3BA,2BAA2B;EAA3BA,2BAA2B,CAA3BA,2BAA2B;EAA3BA,2BAA2B,CAA3BA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AAKvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA,OAAO,MAAMC,uBAAuB,GAClCC,YAA4B,IACT;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EACnB,MAAMC,IAAoB,GAAG;IAC3B,GAAGJ,YAAY;IACf;IACAK,KAAK,EACH,EAAAJ,qBAAA,GAAAD,YAAY,CAACM,2BAA2B,cAAAL,qBAAA,uBAAxCA,qBAAA,CAA0CM,cAAc,KACxDP,YAAY,CAACK,KAAK;IACpBG,cAAc,EACZ,EAAAN,sBAAA,GAAAF,YAAY,CAACM,2BAA2B,cAAAJ,sBAAA,uBAAxCA,sBAAA,CAA0CK,cAAc,KACxDP,YAAY,CAACK,KAAK;IACpBI,QAAQ,EACN,EAAAN,sBAAA,GAAAH,YAAY,CAACM,2BAA2B,cAAAH,sBAAA,uBAAxCA,sBAAA,CAA0CO,iBAAiB,KAC3DV,YAAY,CAACS;EACjB,CAAC;EACD,OAAOL,IAAI;AACb,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc
|
|
3
3
|
*/
|
|
4
|
+
|
|
4
5
|
export const offerToRecord = offer => {
|
|
5
6
|
if (!offer) {
|
|
6
7
|
return undefined;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
9
|
return {
|
|
10
10
|
identifier: offer.identifier,
|
|
11
11
|
keyIdentifier: offer.keyIdentifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["offerToRecord","offer","undefined","identifier","keyIdentifier","nonce","signature","timestamp","toString"],"sourceRoot":"../../../src","sources":["types/apple.ts"],"mappings":"AAAA;AACA;AACA
|
|
1
|
+
{"version":3,"names":["offerToRecord","offer","undefined","identifier","keyIdentifier","nonce","signature","timestamp","toString"],"sourceRoot":"../../../src","sources":["types/apple.ts"],"mappings":"AAAA;AACA;AACA;;AA4BA,OAAO,MAAMA,aAAa,GACxBC,KAAkC,IACoB;EACtD,IAAI,CAACA,KAAK,EAAE;IACV,OAAOC,SAAS;EAClB;EACA,OAAO;IACLC,UAAU,EAAEF,KAAK,CAACE,UAAU;IAC5BC,aAAa,EAAEH,KAAK,CAACG,aAAa;IAClCC,KAAK,EAAEJ,KAAK,CAACI,KAAK;IAClBC,SAAS,EAAEL,KAAK,CAACK,SAAS;IAC1BC,SAAS,EAAEN,KAAK,CAACM,SAAS,CAACC,QAAQ;EACrC,CAAC;AACH,CAAC"}
|
|
@@ -15,13 +15,12 @@ export const productSk2Map = _ref => {
|
|
|
15
15
|
price: String(price),
|
|
16
16
|
localizedPrice: displayPrice,
|
|
17
17
|
currency: '' // Not avaiable on new API, use localizedPrice instead
|
|
18
|
-
|
|
19
18
|
};
|
|
19
|
+
|
|
20
20
|
return prod;
|
|
21
21
|
};
|
|
22
22
|
export const subscriptionSk2Map = _ref2 => {
|
|
23
23
|
var _subscription$subscri, _subscription$subscri2;
|
|
24
|
-
|
|
25
24
|
let {
|
|
26
25
|
id,
|
|
27
26
|
description,
|
|
@@ -69,6 +68,7 @@ export const transactionSk2ToPurchaseMap = _ref3 => {
|
|
|
69
68
|
};
|
|
70
69
|
return purchase;
|
|
71
70
|
};
|
|
71
|
+
|
|
72
72
|
/**
|
|
73
73
|
* Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc
|
|
74
74
|
*/
|
|
@@ -77,7 +77,6 @@ export const offerSk2Map = offer => {
|
|
|
77
77
|
if (!offer) {
|
|
78
78
|
return undefined;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
80
|
return {
|
|
82
81
|
offerID: offer.identifier,
|
|
83
82
|
keyID: offer.keyIdentifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SubscriptionPlatform","productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2ToPurchaseMap","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sourceRoot":"../../../src","sources":["types/appleSk2.ts"],"mappings":"AASA,SAAQA,
|
|
1
|
+
{"version":3,"names":["SubscriptionPlatform","productSk2Map","_ref","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","_ref2","_subscription$subscri","_subscription$subscri2","subscription","platform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2ToPurchaseMap","_ref3","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sourceRoot":"../../../src","sources":["types/appleSk2.ts"],"mappings":"AASA,SAAQA,oBAAoB,QAAO,GAAG;AAuCtC,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAMC;EAAA,IANA;IAC5BC,EAAE;IACFC,WAAW;IACXC,WAAW;IACXC,KAAK;IACLC;EACU,CAAC,GAAAL,IAAA;EACX,MAAMM,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WAAW;IAClBK,SAAS,EAAEC,MAAM,CAACR,EAAE,CAAC;IACrBC,WAAW;IACXQ,IAAI,EAAE,KAAK;IACXN,KAAK,EAAEK,MAAM,CAACL,KAAK,CAAC;IACpBO,cAAc,EAAEN,YAAY;IAC5BO,QAAQ,EAAE,EAAE,CAAE;EAChB,CAAC;;EACD,OAAON,IAAI;AACb,CAAC;AAED,OAAO,MAAMO,kBAAkB,GAAGC,KAAA,IAOC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAPA;IACjCf,EAAE;IACFC,WAAW;IACXC,WAAW;IACXC,KAAK;IACLC,YAAY;IACZY;EACU,CAAC,GAAAH,KAAA;EACX,MAAMR,IAAqB,GAAG;IAC5BY,QAAQ,EAAEpB,oBAAoB,CAACqB,GAAG;IAClCZ,KAAK,EAAEJ,WAAW;IAClBK,SAAS,EAAEC,MAAM,CAACR,EAAE,CAAC;IACrBC,WAAW;IACXQ,IAAI,EAAE,MAAM;IACZN,KAAK,EAAEK,MAAM,CAACL,KAAK,CAAC;IACpBO,cAAc,EAAEN,YAAY;IAC5BO,QAAQ,EAAE,EAAE;IAAE;IACdQ,2BAA2B,EAAG,GAAEH,YAAY,aAAZA,YAAY,wBAAAF,qBAAA,GAAZE,YAAY,CAAEI,kBAAkB,cAAAN,qBAAA,uBAAhCA,qBAAA,CAAkCO,KAAM,EAAC;IACzEC,yBAAyB,EACvBN,YAAY,aAAZA,YAAY,wBAAAD,sBAAA,GAAZC,YAAY,CAAEI,kBAAkB,cAAAL,sBAAA,uBAAhCA,sBAAA,CAAkCQ,IAAI,CAACC,WAAW;EACtD,CAAC;EACD,OAAOnB,IAAI;AACb,CAAC;AAkDD,OAAO,MAAMoB,2BAA2B,GAAGC,KAAA,IAOX;EAAA,IAPY;IAC1C1B,EAAE;IACF2B,oBAAoB;IACpBC,SAAS;IACTC,YAAY;IACZC,iBAAiB;IACjBC;EACc,CAAC,GAAAL,KAAA;EACf,MAAMM,QAAkB,GAAG;IACzBzB,SAAS,EAAEqB,SAAS;IACpBK,aAAa,EAAEzB,MAAM,CAACR,EAAE,CAAC;IACzBkC,eAAe,EAAEL,YAAY;IAAE;IAC/BM,kBAAkB,EAAE,EAAE;IAAE;IACxBC,aAAa,EAAE,EAAE;IAAE;IACnBC,WAAW,EAAEP,iBAAiB;IAC9BQ,0BAA0B,EAAEX,oBAAoB;IAChDY,gCAAgC,EAAER;EACpC,CAAC;EACD,OAAOC,QAAQ;AACjB,CAAC;;AAED;AACA;AACA;;AA4BA,OAAO,MAAMQ,WAAW,GACtBC,KAAwC,IACiB;EACzD,IAAI,CAACA,KAAK,EAAE;IACV,OAAOC,SAAS;EAClB;EACA,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UAAU;IACzBC,KAAK,EAAEJ,KAAK,CAACK,aAAa;IAC1BC,KAAK,EAAEN,KAAK,CAACM,KAAK;IAClBC,SAAS,EAAEP,KAAK,CAACO,SAAS;IAC1BC,SAAS,EAAER,KAAK,CAACQ,SAAS,CAACC,QAAQ;EACrC,CAAC;AACH,CAAC"}
|
|
@@ -1,49 +1,41 @@
|
|
|
1
|
-
export let ProrationModesAndroid
|
|
2
|
-
|
|
3
|
-
(function (ProrationModesAndroid) {
|
|
1
|
+
export let ProrationModesAndroid = /*#__PURE__*/function (ProrationModesAndroid) {
|
|
4
2
|
ProrationModesAndroid[ProrationModesAndroid["IMMEDIATE_WITH_TIME_PRORATION"] = 1] = "IMMEDIATE_WITH_TIME_PRORATION";
|
|
5
3
|
ProrationModesAndroid[ProrationModesAndroid["IMMEDIATE_AND_CHARGE_PRORATED_PRICE"] = 2] = "IMMEDIATE_AND_CHARGE_PRORATED_PRICE";
|
|
6
4
|
ProrationModesAndroid[ProrationModesAndroid["IMMEDIATE_WITHOUT_PRORATION"] = 3] = "IMMEDIATE_WITHOUT_PRORATION";
|
|
7
5
|
ProrationModesAndroid[ProrationModesAndroid["DEFERRED"] = 4] = "DEFERRED";
|
|
8
6
|
ProrationModesAndroid[ProrationModesAndroid["IMMEDIATE_AND_CHARGE_FULL_PRICE"] = 5] = "IMMEDIATE_AND_CHARGE_FULL_PRICE";
|
|
9
7
|
ProrationModesAndroid[ProrationModesAndroid["UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY"] = 0] = "UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export let PurchaseStateAndroid
|
|
13
|
-
|
|
14
|
-
(function (PurchaseStateAndroid) {
|
|
8
|
+
return ProrationModesAndroid;
|
|
9
|
+
}({});
|
|
10
|
+
export let PurchaseStateAndroid = /*#__PURE__*/function (PurchaseStateAndroid) {
|
|
15
11
|
PurchaseStateAndroid[PurchaseStateAndroid["UNSPECIFIED_STATE"] = 0] = "UNSPECIFIED_STATE";
|
|
16
12
|
PurchaseStateAndroid[PurchaseStateAndroid["PURCHASED"] = 1] = "PURCHASED";
|
|
17
13
|
PurchaseStateAndroid[PurchaseStateAndroid["PENDING"] = 2] = "PENDING";
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
return PurchaseStateAndroid;
|
|
15
|
+
}({});
|
|
20
16
|
export const PROMOTED_PRODUCT = 'iap-promoted-product';
|
|
21
|
-
export let InstallSourceAndroid
|
|
22
|
-
|
|
23
|
-
(function (InstallSourceAndroid) {
|
|
17
|
+
export let InstallSourceAndroid = /*#__PURE__*/function (InstallSourceAndroid) {
|
|
24
18
|
InstallSourceAndroid[InstallSourceAndroid["NOT_SET"] = 0] = "NOT_SET";
|
|
25
19
|
InstallSourceAndroid[InstallSourceAndroid["GOOGLE_PLAY"] = 1] = "GOOGLE_PLAY";
|
|
26
20
|
InstallSourceAndroid[InstallSourceAndroid["AMAZON"] = 2] = "AMAZON";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export let ProductType
|
|
30
|
-
|
|
31
|
-
(function (ProductType) {
|
|
21
|
+
return InstallSourceAndroid;
|
|
22
|
+
}({});
|
|
23
|
+
export let ProductType = /*#__PURE__*/function (ProductType) {
|
|
32
24
|
ProductType["subs"] = "subs";
|
|
33
25
|
ProductType["sub"] = "sub";
|
|
34
26
|
ProductType["inapp"] = "inapp";
|
|
35
27
|
ProductType["iap"] = "iap";
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
return ProductType;
|
|
29
|
+
}({});
|
|
38
30
|
/**
|
|
39
31
|
* Can be used to distinguish the different platforms' subscription information
|
|
40
32
|
*/
|
|
41
|
-
export let SubscriptionPlatform
|
|
42
|
-
/** Android Billing v5 type */
|
|
43
|
-
|
|
44
|
-
(function (SubscriptionPlatform) {
|
|
33
|
+
export let SubscriptionPlatform = /*#__PURE__*/function (SubscriptionPlatform) {
|
|
45
34
|
SubscriptionPlatform["android"] = "android";
|
|
46
35
|
SubscriptionPlatform["amazon"] = "amazon";
|
|
47
36
|
SubscriptionPlatform["ios"] = "ios";
|
|
48
|
-
|
|
37
|
+
return SubscriptionPlatform;
|
|
38
|
+
}({});
|
|
39
|
+
|
|
40
|
+
/** Android Billing v5 type */
|
|
49
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAWA,WAAYA,
|
|
1
|
+
{"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"AAWA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AASjC,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,OAAO,MAAMC,gBAAgB,GAAG,sBAAsB;AAEtD,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAMhC,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA8FvB;AACA;AACA;AACA,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;;AAMhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
|
|
2
|
+
type PaymentProvider = 'Amazon AppStore' | 'both' | 'Play Store';
|
|
3
3
|
export declare const modifyAppBuildGradle: (buildGradle: string, paymentProvider: PaymentProvider) => string;
|
|
4
4
|
export declare const modifyProjectBuildGradle: (buildGradle: string) => string;
|
|
5
5
|
interface Props {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,sBAAsB,CAAC;AASvE,
|
|
1
|
+
{"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,sBAAsB,CAAC;AASvE,KAAK,eAAe,GAAG,iBAAiB,GAAG,MAAM,GAAG,YAAY,CAAC;AAuCjE,eAAO,MAAM,oBAAoB,gBAClB,MAAM,mBACF,eAAe,WAwBjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAiB,MAAM,WAM3D,CAAC;AAyBF,UAAU,KAAK;IACb,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;;AA0BD,wBAAmE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { requestPurchase as iapRequestPurchase, requestSubscription as iapRequestSubscription } from '../iap';
|
|
2
2
|
import type { PurchaseError } from '../purchaseError';
|
|
3
3
|
import type { Product, Purchase, PurchaseResult, Subscription } from '../types';
|
|
4
|
-
|
|
4
|
+
type IAP_STATUS = {
|
|
5
5
|
connected: boolean;
|
|
6
6
|
products: Product[];
|
|
7
7
|
promotedProductsIOS: Product[];
|