react-native-iap 12.0.3 → 12.1.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/lib/commonjs/iap.js +143 -110
- package/lib/commonjs/iap.js.map +1 -1
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js +2 -1
- package/lib/commonjs/internal/fillProductsWithAdditionalData.js.map +1 -1
- package/lib/commonjs/internal/platform.js +28 -1
- package/lib/commonjs/internal/platform.js.map +1 -1
- package/lib/commonjs/modules/android.js.map +1 -1
- package/lib/commonjs/modules/ios.js.map +1 -1
- package/lib/commonjs/types/appleSk2.js +3 -0
- package/lib/commonjs/types/appleSk2.js.map +1 -1
- package/lib/commonjs/types/index.js +15 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/iap.js +143 -111
- package/lib/module/iap.js.map +1 -1
- package/lib/module/internal/fillProductsWithAdditionalData.js +2 -1
- package/lib/module/internal/fillProductsWithAdditionalData.js.map +1 -1
- package/lib/module/internal/platform.js +24 -0
- package/lib/module/internal/platform.js.map +1 -1
- package/lib/module/modules/android.js.map +1 -1
- package/lib/module/modules/ios.js.map +1 -1
- package/lib/module/types/appleSk2.js +2 -0
- package/lib/module/types/appleSk2.js.map +1 -1
- package/lib/module/types/index.js +12 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/iap.d.ts +4 -4
- package/lib/typescript/internal/fillProductsWithAdditionalData.d.ts +2 -1
- package/lib/typescript/internal/platform.d.ts +9 -0
- package/lib/typescript/modules/android.d.ts +1 -1
- package/lib/typescript/modules/ios.d.ts +4 -4
- package/lib/typescript/types/index.d.ts +54 -28
- package/package.json +1 -1
- package/src/iap.ts +130 -74
- package/src/internal/fillProductsWithAdditionalData.ts +3 -2
- package/src/internal/platform.ts +20 -0
- package/src/modules/android.ts +1 -1
- package/src/modules/ios.ts +5 -5
- package/src/types/appleSk2.ts +2 -0
- package/src/types/index.ts +70 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNIapIos","RNIapIosSk2","RNIapModule","RNIapAmazonModule","NativeModules","isIos","Platform","OS","isAndroid","isAmazon","isPlay","androidNativeModule","setAndroidNativeModule","nativeModule","checkNativeAndroidAvailable","Error","ErrorCode","E_IAP_NOT_AVAILABLE","getAndroidModule","getNativeModule","getIosModule","iosNativeModule","isStorekit2Avaiable","isAvailable","isIosStorekit2","setIosNativeModule","storekit2Mode","disable","console","warn","storekit1Mode","storekitHybridMode","info","checkNativeIOSAvailable"],"sources":["platform.ts"],"sourcesContent":["import {NativeModules, Platform} from 'react-native';\n\nimport {ErrorCode} from '../purchaseError';\n\nconst {RNIapIos, RNIapIosSk2, RNIapModule, RNIapAmazonModule} = NativeModules;\n\nexport const isIos = Platform.OS === 'ios';\nexport const isAndroid = Platform.OS === 'android';\nexport const isAmazon = isAndroid && !!RNIapAmazonModule;\nexport const isPlay = isAndroid && !!RNIapModule;\n\n// Android\n\nlet androidNativeModule = RNIapModule;\n\nexport const setAndroidNativeModule = (\n nativeModule: typeof RNIapModule,\n): void => {\n androidNativeModule = nativeModule;\n};\n\nexport const checkNativeAndroidAvailable = (): void => {\n if (!RNIapModule && !RNIapAmazonModule) {\n throw new Error(ErrorCode.E_IAP_NOT_AVAILABLE);\n }\n};\n\nexport const getAndroidModule = ():\n | typeof RNIapModule\n | typeof RNIapAmazonModule => {\n checkNativeAndroidAvailable();\n\n return androidNativeModule\n ? androidNativeModule\n : RNIapModule\n ? RNIapModule\n : RNIapAmazonModule;\n};\n\nexport const getNativeModule = ():\n | typeof RNIapModule\n | typeof RNIapAmazonModule\n | typeof RNIapIos\n | typeof RNIapIosSk2 => {\n return isAndroid ? getAndroidModule() : getIosModule();\n};\n\n// iOS\n\nlet iosNativeModule: typeof RNIapIos | typeof RNIapIosSk2 = RNIapIos;\n\nexport const isStorekit2Avaiable = (): boolean =>\n isIos && RNIapIosSk2?.isAvailable() === 1;\n\nexport const isIosStorekit2 = () =>\n isIos &&\n !!iosNativeModule &&\n iosNativeModule === RNIapIosSk2 &&\n isStorekit2Avaiable();\n\nexport const setIosNativeModule = (\n nativeModule: typeof RNIapIos | typeof RNIapIosSk2,\n): void => {\n iosNativeModule = nativeModule;\n};\n\nexport const storekit2Mode = () => {\n iosNativeModule = RNIapIosSk2;\n if (isStorekit2Avaiable()) {\n RNIapIos.disable();\n return true;\n }\n if (isIos) {\n console.warn('Storekit 2 is not available on this device');\n return false;\n }\n return true;\n};\n\nexport const storekit1Mode = () => {\n iosNativeModule = RNIapIos;\n if (isStorekit2Avaiable()) {\n RNIapIosSk2.disable();\n return true;\n }\n return false;\n};\n\nexport const storekitHybridMode = () => {\n if (isStorekit2Avaiable()) {\n iosNativeModule = RNIapIosSk2;\n console.info('Using Storekit 2');\n return true;\n } else {\n iosNativeModule = RNIapIos;\n console.info('Using Storekit 1');\n return true;\n }\n};\n\nconst checkNativeIOSAvailable = (): void => {\n if (!RNIapIos && !isStorekit2Avaiable()) {\n throw new Error(ErrorCode.E_IAP_NOT_AVAILABLE);\n }\n};\n\nexport const getIosModule = (): typeof RNIapIos | typeof RNIapIosSk2 => {\n checkNativeIOSAvailable();\n\n return iosNativeModule\n ? iosNativeModule\n : RNIapIosSk2\n ? RNIapIosSk2\n : RNIapIos;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAM;EAACA,QAAD;EAAWC,WAAX;EAAwBC,WAAxB;EAAqCC;AAArC,IAA0DC,0BAAhE;AAEO,MAAMC,KAAK,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAA9B;;AACA,MAAMC,SAAS,GAAGF,qBAAA,CAASC,EAAT,KAAgB,SAAlC;;AACA,MAAME,QAAQ,GAAGD,SAAS,IAAI,CAAC,CAACL,iBAAhC;;AACA,MAAMO,MAAM,GAAGF,SAAS,IAAI,CAAC,CAACN,WAA9B,C,CAEP;;;AAEA,IAAIS,mBAAmB,GAAGT,WAA1B;;AAEO,MAAMU,sBAAsB,GACjCC,YADoC,IAE3B;EACTF,mBAAmB,GAAGE,YAAtB;AACD,CAJM;;;;AAMA,MAAMC,2BAA2B,GAAG,MAAY;EACrD,IAAI,CAACZ,WAAD,IAAgB,CAACC,iBAArB,EAAwC;IACtC,MAAM,IAAIY,KAAJ,CAAUC,wBAAA,CAAUC,mBAApB,CAAN;EACD;AACF,CAJM
|
|
1
|
+
{"version":3,"names":["RNIapIos","RNIapIosSk2","RNIapModule","RNIapAmazonModule","NativeModules","isIos","Platform","OS","isAndroid","isAmazon","isPlay","androidNativeModule","setAndroidNativeModule","nativeModule","checkNativeAndroidAvailable","Error","ErrorCode","E_IAP_NOT_AVAILABLE","getAndroidModule","getAndroidModuleType","module","getNativeModule","getIosModule","iosNativeModule","isStorekit2Avaiable","isAvailable","isIosStorekit2","setIosNativeModule","storekit2Mode","disable","console","warn","storekit1Mode","storekitHybridMode","info","checkNativeIOSAvailable"],"sources":["platform.ts"],"sourcesContent":["import {NativeModules, Platform} from 'react-native';\n\nimport {ErrorCode} from '../purchaseError';\n\nconst {RNIapIos, RNIapIosSk2, RNIapModule, RNIapAmazonModule} = NativeModules;\n\nexport const isIos = Platform.OS === 'ios';\nexport const isAndroid = Platform.OS === 'android';\nexport const isAmazon = isAndroid && !!RNIapAmazonModule;\nexport const isPlay = isAndroid && !!RNIapModule;\n\n// Android\n\nlet androidNativeModule = RNIapModule;\n\nexport const setAndroidNativeModule = (\n nativeModule: typeof RNIapModule,\n): void => {\n androidNativeModule = nativeModule;\n};\n\nexport const checkNativeAndroidAvailable = (): void => {\n if (!RNIapModule && !RNIapAmazonModule) {\n throw new Error(ErrorCode.E_IAP_NOT_AVAILABLE);\n }\n};\n\n/**\n * If changing the typings of `getAndroidModule` to accommodate extra modules,\n * make sure to update `getAndroidModuleType`.\n */\nexport const getAndroidModule = ():\n | typeof RNIapModule\n | typeof RNIapAmazonModule => {\n checkNativeAndroidAvailable();\n\n return androidNativeModule\n ? androidNativeModule\n : RNIapModule\n ? RNIapModule\n : RNIapAmazonModule;\n};\n\n/**\n * Returns whether the Android in-app-purchase code is using the Android,\n * Amazon, or another store.\n */\nexport const getAndroidModuleType = (): 'android' | 'amazon' | null => {\n const module = getAndroidModule();\n switch (module) {\n case RNIapModule:\n return 'android';\n case RNIapAmazonModule:\n return 'amazon';\n default:\n return null;\n }\n};\n\nexport const getNativeModule = ():\n | typeof RNIapModule\n | typeof RNIapAmazonModule\n | typeof RNIapIos\n | typeof RNIapIosSk2 => {\n return isAndroid ? getAndroidModule() : getIosModule();\n};\n\n// iOS\n\nlet iosNativeModule: typeof RNIapIos | typeof RNIapIosSk2 = RNIapIos;\n\nexport const isStorekit2Avaiable = (): boolean =>\n isIos && RNIapIosSk2?.isAvailable() === 1;\n\nexport const isIosStorekit2 = () =>\n isIos &&\n !!iosNativeModule &&\n iosNativeModule === RNIapIosSk2 &&\n isStorekit2Avaiable();\n\nexport const setIosNativeModule = (\n nativeModule: typeof RNIapIos | typeof RNIapIosSk2,\n): void => {\n iosNativeModule = nativeModule;\n};\n\nexport const storekit2Mode = () => {\n iosNativeModule = RNIapIosSk2;\n if (isStorekit2Avaiable()) {\n RNIapIos.disable();\n return true;\n }\n if (isIos) {\n console.warn('Storekit 2 is not available on this device');\n return false;\n }\n return true;\n};\n\nexport const storekit1Mode = () => {\n iosNativeModule = RNIapIos;\n if (isStorekit2Avaiable()) {\n RNIapIosSk2.disable();\n return true;\n }\n return false;\n};\n\nexport const storekitHybridMode = () => {\n if (isStorekit2Avaiable()) {\n iosNativeModule = RNIapIosSk2;\n console.info('Using Storekit 2');\n return true;\n } else {\n iosNativeModule = RNIapIos;\n console.info('Using Storekit 1');\n return true;\n }\n};\n\nconst checkNativeIOSAvailable = (): void => {\n if (!RNIapIos && !isStorekit2Avaiable()) {\n throw new Error(ErrorCode.E_IAP_NOT_AVAILABLE);\n }\n};\n\nexport const getIosModule = (): typeof RNIapIos | typeof RNIapIosSk2 => {\n checkNativeIOSAvailable();\n\n return iosNativeModule\n ? iosNativeModule\n : RNIapIosSk2\n ? RNIapIosSk2\n : RNIapIos;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAM;EAACA,QAAD;EAAWC,WAAX;EAAwBC,WAAxB;EAAqCC;AAArC,IAA0DC,0BAAhE;AAEO,MAAMC,KAAK,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAA9B;;AACA,MAAMC,SAAS,GAAGF,qBAAA,CAASC,EAAT,KAAgB,SAAlC;;AACA,MAAME,QAAQ,GAAGD,SAAS,IAAI,CAAC,CAACL,iBAAhC;;AACA,MAAMO,MAAM,GAAGF,SAAS,IAAI,CAAC,CAACN,WAA9B,C,CAEP;;;AAEA,IAAIS,mBAAmB,GAAGT,WAA1B;;AAEO,MAAMU,sBAAsB,GACjCC,YADoC,IAE3B;EACTF,mBAAmB,GAAGE,YAAtB;AACD,CAJM;;;;AAMA,MAAMC,2BAA2B,GAAG,MAAY;EACrD,IAAI,CAACZ,WAAD,IAAgB,CAACC,iBAArB,EAAwC;IACtC,MAAM,IAAIY,KAAJ,CAAUC,wBAAA,CAAUC,mBAApB,CAAN;EACD;AACF,CAJM;AAMP;AACA;AACA;AACA;;;;;AACO,MAAMC,gBAAgB,GAAG,MAEA;EAC9BJ,2BAA2B;EAE3B,OAAOH,mBAAmB,GACtBA,mBADsB,GAEtBT,WAAW,GACXA,WADW,GAEXC,iBAJJ;AAKD,CAVM;AAYP;AACA;AACA;AACA;;;;;AACO,MAAMgB,oBAAoB,GAAG,MAAmC;EACrE,MAAMC,MAAM,GAAGF,gBAAgB,EAA/B;;EACA,QAAQE,MAAR;IACE,KAAKlB,WAAL;MACE,OAAO,SAAP;;IACF,KAAKC,iBAAL;MACE,OAAO,QAAP;;IACF;MACE,OAAO,IAAP;EANJ;AAQD,CAVM;;;;AAYA,MAAMkB,eAAe,GAAG,MAIL;EACxB,OAAOb,SAAS,GAAGU,gBAAgB,EAAnB,GAAwBI,YAAY,EAApD;AACD,CANM,C,CAQP;;;;AAEA,IAAIC,eAAqD,GAAGvB,QAA5D;;AAEO,MAAMwB,mBAAmB,GAAG,MACjCnB,KAAK,IAAI,CAAAJ,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEwB,WAAb,QAA+B,CADnC;;;;AAGA,MAAMC,cAAc,GAAG,MAC5BrB,KAAK,IACL,CAAC,CAACkB,eADF,IAEAA,eAAe,KAAKtB,WAFpB,IAGAuB,mBAAmB,EAJd;;;;AAMA,MAAMG,kBAAkB,GAC7Bd,YADgC,IAEvB;EACTU,eAAe,GAAGV,YAAlB;AACD,CAJM;;;;AAMA,MAAMe,aAAa,GAAG,MAAM;EACjCL,eAAe,GAAGtB,WAAlB;;EACA,IAAIuB,mBAAmB,EAAvB,EAA2B;IACzBxB,QAAQ,CAAC6B,OAAT;IACA,OAAO,IAAP;EACD;;EACD,IAAIxB,KAAJ,EAAW;IACTyB,OAAO,CAACC,IAAR,CAAa,4CAAb;IACA,OAAO,KAAP;EACD;;EACD,OAAO,IAAP;AACD,CAXM;;;;AAaA,MAAMC,aAAa,GAAG,MAAM;EACjCT,eAAe,GAAGvB,QAAlB;;EACA,IAAIwB,mBAAmB,EAAvB,EAA2B;IACzBvB,WAAW,CAAC4B,OAAZ;IACA,OAAO,IAAP;EACD;;EACD,OAAO,KAAP;AACD,CAPM;;;;AASA,MAAMI,kBAAkB,GAAG,MAAM;EACtC,IAAIT,mBAAmB,EAAvB,EAA2B;IACzBD,eAAe,GAAGtB,WAAlB;IACA6B,OAAO,CAACI,IAAR,CAAa,kBAAb;IACA,OAAO,IAAP;EACD,CAJD,MAIO;IACLX,eAAe,GAAGvB,QAAlB;IACA8B,OAAO,CAACI,IAAR,CAAa,kBAAb;IACA,OAAO,IAAP;EACD;AACF,CAVM;;;;AAYP,MAAMC,uBAAuB,GAAG,MAAY;EAC1C,IAAI,CAACnC,QAAD,IAAa,CAACwB,mBAAmB,EAArC,EAAyC;IACvC,MAAM,IAAIT,KAAJ,CAAUC,wBAAA,CAAUC,mBAApB,CAAN;EACD;AACF,CAJD;;AAMO,MAAMK,YAAY,GAAG,MAA4C;EACtEa,uBAAuB;EAEvB,OAAOZ,eAAe,GAClBA,eADkB,GAElBtB,WAAW,GACXA,WADW,GAEXD,QAJJ;AAKD,CARM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNIapModule","NativeModules","AndroidModule","getInstallSourceAndroid","InstallSourceAndroid","GOOGLE_PLAY","AMAZON","deepLinkToSubscriptionsAndroid","sku","checkNativeAndroidAvailable","Linking","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","getAndroidModule","acknowledgePurchase"],"sources":["android.ts"],"sourcesContent":["import {Linking, NativeModules} from 'react-native';\n\nimport {checkNativeAndroidAvailable, getAndroidModule} from '../internal';\nimport {\n InstallSourceAndroid,\n Product,\n ProductType,\n ProrationModesAndroid,\n Purchase,\n PurchaseResult,\n Sku,\n} from '../types';\nimport type * as Android from '../types/android';\n\nimport type {NativeModuleProps} from './common';\n\nconst {RNIapModule} = NativeModules;\n\ntype FlushFailedPurchasesCachedAsPending = () => Promise<boolean>;\n\ntype GetItemsByType = <T = Product>(\n type: ProductType,\n skus: Sku[],\n) => Promise<T[]>;\n\ntype GetAvailableItemsByType = <T = Purchase>(\n type: ProductType,\n) => Promise<T[]>;\n\ntype GetPurchaseHistoryByType = <T = Purchase>(\n type: ProductType,\n) => Promise<T[]>;\n\nexport type BuyItemByType = (\n type: string,\n skus: Sku[],\n purchaseToken: string | undefined,\n prorationMode: ProrationModesAndroid,\n obfuscatedAccountId: string | undefined,\n obfuscatedProfileId: string | undefined,\n subscriptionOffers: string[],\n isOfferPersonalized: boolean,\n) => Promise<Purchase>;\n\ntype AcknowledgePurchase = (\n purchaseToken: string,\n developerPayloadAndroid?: string,\n) => Promise<PurchaseResult | boolean>;\n\ntype ConsumeProduct = (\n purchaseToken: string,\n developerPayloadAndroid?: string,\n) => Promise<PurchaseResult | boolean>;\n\ntype StartListening = () => Promise<void>;\ntype GetPackageName = () => Promise<string>;\n\nexport interface AndroidModuleProps extends NativeModuleProps {\n flushFailedPurchasesCachedAsPending: FlushFailedPurchasesCachedAsPending;\n getItemsByType: GetItemsByType;\n getAvailableItemsByType: GetAvailableItemsByType;\n getPurchaseHistoryByType: GetPurchaseHistoryByType;\n buyItemByType: BuyItemByType;\n acknowledgePurchase: AcknowledgePurchase;\n consumeProduct: ConsumeProduct;\n startListening: StartListening;\n getPackageName: GetPackageName;\n}\n\nexport const AndroidModule = NativeModules.RNIapModule as AndroidModuleProps;\n\nexport const getInstallSourceAndroid = (): InstallSourceAndroid => {\n return RNIapModule\n ? InstallSourceAndroid.GOOGLE_PLAY\n : InstallSourceAndroid.AMAZON;\n};\n\n/**\n * Deep link to subscriptions screen on Android. No-op on iOS.\n * @param {string} sku The product's SKU (on Android)\n * @returns {Promise<void>}\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n}: {\n sku: Sku;\n}): Promise<void> => {\n checkNativeAndroidAvailable();\n\n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${await RNIapModule.getPackageName()}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {string} packageName package name of your app.\n * @param {string} productId product id for your in app product.\n * @param {string} productToken token for your purchase.\n * @param {string} accessToken accessToken from googleApis.\n * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<object>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<Android.ReceiptType> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}?access_token=${accessToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {string} token The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n developerPayload,\n}: {\n token: string;\n developerPayload?: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return getAndroidModule().acknowledgePurchase(token, developerPayload);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAaA,MAAM;EAACA;AAAD,IAAgBC,0BAAtB;AAqDO,MAAMC,aAAa,GAAGD,0BAAA,CAAcD,WAApC;;;AAEA,MAAMG,uBAAuB,GAAG,MAA4B;EACjE,OAAOH,WAAW,GACdI,2BAAA,CAAqBC,WADP,GAEdD,2BAAA,CAAqBE,MAFzB;AAGD,CAJM;AAMP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,8BAA8B,GAAG,cAIzB;EAAA,IAJgC;IACnDC;EADmD,CAIhC;EACnB,IAAAC,qCAAA;EAEA,OAAOC,oBAAA,CAAQC,OAAR,CACJ,+DAA8D,MAAMX,WAAW,CAACY,cAAZ,EAA6B,QAAOJ,GAAI,EADxG,CAAP;AAGD,CAVM;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMK,sBAAsB,GAAG,eAYF;EAAA,IAZS;IAC3CC,WAD2C;IAE3CC,SAF2C;IAG3CC,YAH2C;IAI3CC,WAJ2C;IAK3CC;EAL2C,CAYT;EAClC,MAAMC,IAAI,GAAGD,KAAK,GAAG,eAAH,GAAqB,UAAvC;EAEA,MAAME,GAAG,GACP,6EACC,IAAGN,WAAY,cAAaK,IAAK,IAAGJ,SAAU,EAD/C,GAEC,WAAUC,YAAa,iBAAgBC,WAAY,EAHtD;EAKA,MAAMI,QAAQ,GAAG,MAAMC,KAAK,CAACF,GAAD,EAAM;IAChCG,MAAM,EAAE,KADwB;IAEhCC,OAAO,EAAE;MACP,gBAAgB;IADT;EAFuB,CAAN,CAA5B;;EAOA,IAAI,CAACH,QAAQ,CAACI,EAAd,EAAkB;IAChB,MAAMC,MAAM,CAACC,MAAP,CAAc,IAAIC,KAAJ,CAAUP,QAAQ,CAACQ,UAAnB,CAAd,EAA8C;MAClDC,UAAU,EAAET,QAAQ,CAACU;IAD6B,CAA9C,CAAN;EAGD;;EAED,OAAOV,QAAQ,CAACW,IAAT,EAAP;AACD,CAlCM;AAoCP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,0BAA0B,GAAG,SAMM;EAAA,IANL;IACzCC,KADyC;IAEzCC;EAFyC,CAMK;EAC9C,OAAO,IAAAC,0BAAA,IAAmBC,mBAAnB,CAAuCH,KAAvC,EAA8CC,gBAA9C,CAAP;AACD,CARM"}
|
|
1
|
+
{"version":3,"names":["RNIapModule","NativeModules","AndroidModule","getInstallSourceAndroid","InstallSourceAndroid","GOOGLE_PLAY","AMAZON","deepLinkToSubscriptionsAndroid","sku","checkNativeAndroidAvailable","Linking","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","getAndroidModule","acknowledgePurchase"],"sources":["android.ts"],"sourcesContent":["import {Linking, NativeModules} from 'react-native';\n\nimport {checkNativeAndroidAvailable, getAndroidModule} from '../internal';\nimport {\n InstallSourceAndroid,\n Product,\n ProductType,\n ProrationModesAndroid,\n Purchase,\n PurchaseResult,\n Sku,\n} from '../types';\nimport type * as Android from '../types/android';\n\nimport type {NativeModuleProps} from './common';\n\nconst {RNIapModule} = NativeModules;\n\ntype FlushFailedPurchasesCachedAsPending = () => Promise<boolean>;\n\ntype GetItemsByType = <T = Product>(\n type: ProductType,\n skus: Sku[],\n) => Promise<T[]>;\n\ntype GetAvailableItemsByType = <T = Purchase>(\n type: ProductType,\n) => Promise<T[]>;\n\ntype GetPurchaseHistoryByType = <T = Purchase>(\n type: ProductType,\n) => Promise<T[]>;\n\nexport type BuyItemByType = (\n type: string,\n skus: Sku[],\n purchaseToken: string | undefined,\n prorationMode: ProrationModesAndroid | undefined,\n obfuscatedAccountId: string | undefined,\n obfuscatedProfileId: string | undefined,\n subscriptionOffers: string[],\n isOfferPersonalized: boolean,\n) => Promise<Purchase>;\n\ntype AcknowledgePurchase = (\n purchaseToken: string,\n developerPayloadAndroid?: string,\n) => Promise<PurchaseResult | boolean>;\n\ntype ConsumeProduct = (\n purchaseToken: string,\n developerPayloadAndroid?: string,\n) => Promise<PurchaseResult | boolean>;\n\ntype StartListening = () => Promise<void>;\ntype GetPackageName = () => Promise<string>;\n\nexport interface AndroidModuleProps extends NativeModuleProps {\n flushFailedPurchasesCachedAsPending: FlushFailedPurchasesCachedAsPending;\n getItemsByType: GetItemsByType;\n getAvailableItemsByType: GetAvailableItemsByType;\n getPurchaseHistoryByType: GetPurchaseHistoryByType;\n buyItemByType: BuyItemByType;\n acknowledgePurchase: AcknowledgePurchase;\n consumeProduct: ConsumeProduct;\n startListening: StartListening;\n getPackageName: GetPackageName;\n}\n\nexport const AndroidModule = NativeModules.RNIapModule as AndroidModuleProps;\n\nexport const getInstallSourceAndroid = (): InstallSourceAndroid => {\n return RNIapModule\n ? InstallSourceAndroid.GOOGLE_PLAY\n : InstallSourceAndroid.AMAZON;\n};\n\n/**\n * Deep link to subscriptions screen on Android. No-op on iOS.\n * @param {string} sku The product's SKU (on Android)\n * @returns {Promise<void>}\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n}: {\n sku: Sku;\n}): Promise<void> => {\n checkNativeAndroidAvailable();\n\n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${await RNIapModule.getPackageName()}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {string} packageName package name of your app.\n * @param {string} productId product id for your in app product.\n * @param {string} productToken token for your purchase.\n * @param {string} accessToken accessToken from googleApis.\n * @param {boolean} isSub whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<object>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<Android.ReceiptType> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}?access_token=${accessToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {string} token The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n developerPayload,\n}: {\n token: string;\n developerPayload?: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return getAndroidModule().acknowledgePurchase(token, developerPayload);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAaA,MAAM;EAACA;AAAD,IAAgBC,0BAAtB;AAqDO,MAAMC,aAAa,GAAGD,0BAAA,CAAcD,WAApC;;;AAEA,MAAMG,uBAAuB,GAAG,MAA4B;EACjE,OAAOH,WAAW,GACdI,2BAAA,CAAqBC,WADP,GAEdD,2BAAA,CAAqBE,MAFzB;AAGD,CAJM;AAMP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,8BAA8B,GAAG,cAIzB;EAAA,IAJgC;IACnDC;EADmD,CAIhC;EACnB,IAAAC,qCAAA;EAEA,OAAOC,oBAAA,CAAQC,OAAR,CACJ,+DAA8D,MAAMX,WAAW,CAACY,cAAZ,EAA6B,QAAOJ,GAAI,EADxG,CAAP;AAGD,CAVM;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMK,sBAAsB,GAAG,eAYF;EAAA,IAZS;IAC3CC,WAD2C;IAE3CC,SAF2C;IAG3CC,YAH2C;IAI3CC,WAJ2C;IAK3CC;EAL2C,CAYT;EAClC,MAAMC,IAAI,GAAGD,KAAK,GAAG,eAAH,GAAqB,UAAvC;EAEA,MAAME,GAAG,GACP,6EACC,IAAGN,WAAY,cAAaK,IAAK,IAAGJ,SAAU,EAD/C,GAEC,WAAUC,YAAa,iBAAgBC,WAAY,EAHtD;EAKA,MAAMI,QAAQ,GAAG,MAAMC,KAAK,CAACF,GAAD,EAAM;IAChCG,MAAM,EAAE,KADwB;IAEhCC,OAAO,EAAE;MACP,gBAAgB;IADT;EAFuB,CAAN,CAA5B;;EAOA,IAAI,CAACH,QAAQ,CAACI,EAAd,EAAkB;IAChB,MAAMC,MAAM,CAACC,MAAP,CAAc,IAAIC,KAAJ,CAAUP,QAAQ,CAACQ,UAAnB,CAAd,EAA8C;MAClDC,UAAU,EAAET,QAAQ,CAACU;IAD6B,CAA9C,CAAN;EAGD;;EAED,OAAOV,QAAQ,CAACW,IAAT,EAAP;AACD,CAlCM;AAoCP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,0BAA0B,GAAG,SAMM;EAAA,IANL;IACzCC,KADyC;IAEzCC;EAFyC,CAMK;EAC9C,OAAO,IAAAC,0BAAA,IAAmBC,mBAAnB,CAAuCH,KAAvC,EAA8CC,gBAA9C,CAAP;AACD,CARM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getPendingPurchasesIOS","getIosModule","getPendingTransactions","getReceiptIOS","forceRefresh","requestReceipt","presentCodeRedemptionSheetIOS","presentCodeRedemptionSheet","getPromotedProductIOS","isIosStorekit2","promotedProduct","Promise","reject","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"],"sources":["ios.ts"],"sourcesContent":["import type {ResponseBody as ReceiptValidationResponse} from '@jeremybarbet/apple-api-types';\n\nimport {getIosModule, isIosStorekit2} from '../internal';\nimport type {\n
|
|
1
|
+
{"version":3,"names":["getPendingPurchasesIOS","getIosModule","getPendingTransactions","getReceiptIOS","forceRefresh","requestReceipt","presentCodeRedemptionSheetIOS","presentCodeRedemptionSheet","getPromotedProductIOS","isIosStorekit2","promotedProduct","Promise","reject","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"],"sources":["ios.ts"],"sourcesContent":["import type {ResponseBody as ReceiptValidationResponse} from '@jeremybarbet/apple-api-types';\n\nimport {getIosModule, isIosStorekit2} from '../internal';\nimport type {\n ProductIOS,\n ProductPurchase,\n Purchase,\n Sku,\n SubscriptionIOS,\n} from '../types';\nimport type {PaymentDiscount} from '../types/apple';\n\nimport type {NativeModuleProps} from './common';\n\ntype getItems = (skus: Sku[]) => Promise<ProductIOS[] | SubscriptionIOS[]>;\n\ntype getAvailableItems = (\n automaticallyFinishRestoredTransactions: boolean,\n) => Promise<Purchase[]>;\n\nexport type BuyProduct = (\n sku: Sku,\n andDangerouslyFinishTransactionAutomaticallyIOS: boolean,\n applicationUsername: string | undefined,\n quantity: number,\n withOffer: Record<keyof PaymentDiscount, string> | undefined,\n) => Promise<Purchase>;\n\ntype clearTransaction = () => Promise<void>;\ntype clearProducts = () => Promise<void>;\ntype promotedProduct = () => Promise<ProductIOS | null>;\ntype buyPromotedProduct = () => Promise<void>;\ntype requestReceipt = (refresh: boolean) => Promise<string>;\n\ntype finishTransaction = (transactionIdentifier: string) => Promise<boolean>;\n\ntype getPendingTransactions = () => Promise<ProductPurchase[]>;\ntype presentCodeRedemptionSheet = () => Promise<null>;\n\nexport interface IosModuleProps extends NativeModuleProps {\n getItems: getItems;\n getAvailableItems: getAvailableItems;\n buyProduct: BuyProduct;\n clearTransaction: clearTransaction;\n clearProducts: clearProducts;\n promotedProduct: promotedProduct;\n buyPromotedProduct: buyPromotedProduct;\n requestReceipt: requestReceipt;\n finishTransaction: finishTransaction;\n getPendingTransactions: getPendingTransactions;\n presentCodeRedemptionSheet: presentCodeRedemptionSheet;\n disable: () => Promise<null>;\n}\n\n/**\n * Get the current receipt base64 encoded in IOS.\n * @param {forceRefresh?:boolean}\n * @returns {Promise<ProductPurchase[]>}\n */\nexport const getPendingPurchasesIOS = async (): Promise<ProductPurchase[]> =>\n getIosModule().getPendingTransactions();\n\n/**\n * Get the current receipt base64 encoded in IOS.\n * @param {forceRefresh?:boolean}\n * @returns {Promise<string>}\n */\nexport const getReceiptIOS = async ({\n forceRefresh,\n}: {\n forceRefresh?: boolean;\n}): Promise<string> => getIosModule().requestReceipt(forceRefresh ?? false);\n\n/**\n * Launches a modal to register the redeem offer code in IOS.\n * @returns {Promise<null>}\n */\nexport const presentCodeRedemptionSheetIOS = async (): Promise<null> =>\n getIosModule().presentCodeRedemptionSheet();\n\n/**\n * Should Add Store Payment (iOS only)\n * Indicates the the App Store purchase should continue from the app instead of the App Store.\n * @returns {Promise<Product | null>} promoted product\n */\nexport const getPromotedProductIOS = (): Promise<ProductIOS | null> => {\n if (!isIosStorekit2()) {\n return getIosModule().promotedProduct();\n } else {\n return Promise.reject('Only available on Sk1');\n }\n};\n\n/**\n * Buy the currently selected promoted product (iOS only)\n * Initiates the payment process for a promoted product. Should only be called in response to the `iap-promoted-product` event.\n * @returns {Promise<void>}\n */\nexport const buyPromotedProductIOS = (): Promise<void> =>\n getIosModule().buyPromotedProduct();\n\nconst fetchJsonOrThrow = async (\n url: string,\n receiptBody: Record<string, unknown>,\n): Promise<ReceiptValidationResponse | false> => {\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(receiptBody),\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\nconst TEST_RECEIPT = 21007;\nconst requestAgnosticReceiptValidationIos = async (\n receiptBody: Record<string, unknown>,\n): Promise<ReceiptValidationResponse | false> => {\n const response = await fetchJsonOrThrow(\n 'https://buy.itunes.apple.com/verifyReceipt',\n receiptBody,\n );\n\n // Best practice is to check for test receipt and check sandbox instead\n // https://developer.apple.com/documentation/appstorereceipts/verifyreceipt\n if (response && response.status === TEST_RECEIPT) {\n const testResponse = await fetchJsonOrThrow(\n 'https://sandbox.itunes.apple.com/verifyReceipt',\n receiptBody,\n );\n\n return testResponse;\n }\n\n return response;\n};\n\n/**\n * Validate receipt for iOS.\n * @param {object} receiptBody the receipt body to send to apple server.\n * @param {boolean} isTest whether this is in test environment which is sandbox.\n * @returns {Promise<Apple.ReceiptValidationResponse | false>}\n */\nexport const validateReceiptIos = async ({\n receiptBody,\n isTest,\n}: {\n receiptBody: Record<string, unknown>;\n isTest?: boolean;\n}): Promise<ReceiptValidationResponse | false> => {\n if (isTest == null) {\n return await requestAgnosticReceiptValidationIos(receiptBody);\n }\n\n const url = isTest\n ? 'https://sandbox.itunes.apple.com/verifyReceipt'\n : 'https://buy.itunes.apple.com/verifyReceipt';\n\n const response = await fetchJsonOrThrow(url, receiptBody);\n\n return response;\n};\n\n/**\n * Clear Transaction (iOS only)\n * Finish remaining transactions. Related to issue #257 and #801\n * link : https://github.com/dooboolab/react-native-iap/issues/257\n * https://github.com/dooboolab/react-native-iap/issues/801\n * @returns {Promise<void>}\n */\nexport const clearTransactionIOS = (): Promise<void> =>\n getIosModule().clearTransaction();\n\n/**\n * Clear valid Products (iOS only)\n * Remove all products which are validated by Apple server.\n * @returns {void}\n */\nexport const clearProductsIOS = (): Promise<void> =>\n getIosModule().clearProducts();\n"],"mappings":";;;;;;;AAEA;;AAoDA;AACA;AACA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAG,YACpC,IAAAC,sBAAA,IAAeC,sBAAf,EADK;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,aAAa,GAAG;EAAA,IAAO;IAClCC;EADkC,CAAP;EAAA,OAIN,IAAAH,sBAAA,IAAeI,cAAf,CAA8BD,YAAY,IAAI,KAA9C,CAJM;AAAA,CAAtB;AAMP;AACA;AACA;AACA;;;;;AACO,MAAME,6BAA6B,GAAG,YAC3C,IAAAL,sBAAA,IAAeM,0BAAf,EADK;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,qBAAqB,GAAG,MAAkC;EACrE,IAAI,CAAC,IAAAC,wBAAA,GAAL,EAAuB;IACrB,OAAO,IAAAR,sBAAA,IAAeS,eAAf,EAAP;EACD,CAFD,MAEO;IACL,OAAOC,OAAO,CAACC,MAAR,CAAe,uBAAf,CAAP;EACD;AACF,CANM;AAQP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,qBAAqB,GAAG,MACnC,IAAAZ,sBAAA,IAAea,kBAAf,EADK;;;;AAGP,MAAMC,gBAAgB,GAAG,OACvBC,GADuB,EAEvBC,WAFuB,KAGwB;EAC/C,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACH,GAAD,EAAM;IAChCI,MAAM,EAAE,MADwB;IAEhCC,OAAO,EAAE;MACPC,MAAM,EAAE,kBADD;MAEP,gBAAgB;IAFT,CAFuB;IAMhCC,IAAI,EAAEC,IAAI,CAACC,SAAL,CAAeR,WAAf;EAN0B,CAAN,CAA5B;;EASA,IAAI,CAACC,QAAQ,CAACQ,EAAd,EAAkB;IAChB,MAAMC,MAAM,CAACC,MAAP,CAAc,IAAIC,KAAJ,CAAUX,QAAQ,CAACY,UAAnB,CAAd,EAA8C;MAClDC,UAAU,EAAEb,QAAQ,CAACc;IAD6B,CAA9C,CAAN;EAGD;;EAED,OAAOd,QAAQ,CAACe,IAAT,EAAP;AACD,CApBD;;AAsBA,MAAMC,YAAY,GAAG,KAArB;;AACA,MAAMC,mCAAmC,GAAG,MAC1ClB,WAD0C,IAEK;EAC/C,MAAMC,QAAQ,GAAG,MAAMH,gBAAgB,CACrC,4CADqC,EAErCE,WAFqC,CAAvC,CAD+C,CAM/C;EACA;;EACA,IAAIC,QAAQ,IAAIA,QAAQ,CAACc,MAAT,KAAoBE,YAApC,EAAkD;IAChD,MAAME,YAAY,GAAG,MAAMrB,gBAAgB,CACzC,gDADyC,EAEzCE,WAFyC,CAA3C;IAKA,OAAOmB,YAAP;EACD;;EAED,OAAOlB,QAAP;AACD,CApBD;AAsBA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMmB,kBAAkB,GAAG,eAMgB;EAAA,IANT;IACvCpB,WADuC;IAEvCqB;EAFuC,CAMS;;EAChD,IAAIA,MAAM,IAAI,IAAd,EAAoB;IAClB,OAAO,MAAMH,mCAAmC,CAAClB,WAAD,CAAhD;EACD;;EAED,MAAMD,GAAG,GAAGsB,MAAM,GACd,gDADc,GAEd,4CAFJ;EAIA,MAAMpB,QAAQ,GAAG,MAAMH,gBAAgB,CAACC,GAAD,EAAMC,WAAN,CAAvC;EAEA,OAAOC,QAAP;AACD,CAlBM;AAoBP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMqB,mBAAmB,GAAG,MACjC,IAAAtC,sBAAA,IAAeuC,gBAAf,EADK;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,gBAAgB,GAAG,MAC9B,IAAAxC,sBAAA,IAAeyC,aAAf,EADK"}
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.transactionSk2Map = exports.subscriptionSk2Map = exports.productSk2Map = exports.offerSk2Map = void 0;
|
|
7
7
|
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
|
|
8
10
|
const productSk2Map = _ref => {
|
|
9
11
|
let {
|
|
10
12
|
id,
|
|
@@ -40,6 +42,7 @@ const subscriptionSk2Map = _ref2 => {
|
|
|
40
42
|
subscription
|
|
41
43
|
} = _ref2;
|
|
42
44
|
const prod = {
|
|
45
|
+
platform: _.SubscriptionPlatform.ios,
|
|
43
46
|
title: displayName,
|
|
44
47
|
productId: String(id),
|
|
45
48
|
description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"names":["productSk2Map","id","description","displayName","price","displayPrice","prod","title","productId","String","type","localizedPrice","currency","subscriptionSk2Map","subscription","platform","SubscriptionPlatform","ios","subscriptionPeriodNumberIOS","subscriptionPeriod","value","subscriptionPeriodUnitIOS","unit","toUpperCase","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","purchase","transactionId","transactionDate","transactionReceipt","purchaseToken","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","offerSk2Map","offer","undefined","offerID","identifier","keyID","keyIdentifier","nonce","signature","timestamp","toString"],"sources":["appleSk2.ts"],"sourcesContent":["import type {PurchaseError} from '../purchaseError';\n\nimport type {\n ProductIOS,\n Purchase,\n SubscriptionIOS,\n SubscriptionIosPeriod,\n} from '.';\nimport type * as Apple from './apple';\nimport {SubscriptionPlatform} from '.';\n\nexport type SubscriptionPeriod = {\n unit: 'day' | 'week' | 'month' | 'year';\n value: number;\n};\n\nexport type PaymentMode = 'freeTrial' | 'payAsYouGo' | 'payUpFront';\n\nexport type SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\nexport type SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionPeriod;\n};\n\nexport type ProductSk2 = {\n description: string;\n displayName: string;\n displayPrice: string;\n id: number;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n price: number;\n subscription: SubscriptionInfo;\n type: 'autoRenewable' | 'consumable' | 'nonConsumable' | 'nonRenewable';\n};\nexport const productSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n}: ProductSk2): ProductIOS => {\n const prod: ProductIOS = {\n title: displayName,\n productId: String(id),\n description,\n type: 'iap',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n };\n return prod;\n};\n\nexport const subscriptionSk2Map = ({\n id,\n description,\n displayName,\n price,\n displayPrice,\n subscription,\n}: ProductSk2): SubscriptionIOS => {\n const prod: SubscriptionIOS = {\n platform: SubscriptionPlatform.ios,\n title: displayName,\n productId: String(id),\n description,\n type: 'subs',\n price: String(price),\n localizedPrice: displayPrice,\n currency: '', // Not avaiable on new API, use localizedPrice instead\n subscriptionPeriodNumberIOS: `${subscription?.subscriptionPeriod?.value}`,\n subscriptionPeriodUnitIOS:\n subscription?.subscriptionPeriod?.unit.toUpperCase() as SubscriptionIosPeriod,\n };\n return prod;\n};\n\nexport type TransactionSk2 = {\n appAccountToken: string;\n appBundleID: string;\n debugDescription: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n expirationDate: number;\n id: number;\n isUpgraded: boolean;\n jsonRepresentation: string;\n offerID: string;\n offerType: string;\n originalID: string;\n originalPurchaseDate: number;\n ownershipType: string;\n productID: string;\n productType: string;\n purchaseDate: number;\n purchasedQuantity: number;\n revocationDate: number;\n revocationReason: string;\n signedDate: number;\n subscriptionGroupID: number;\n webOrderLineItemID: number;\n};\n\nexport type TransactionError = PurchaseError;\n\n/**\n * Only one of `transaction` and `error` is not undefined at the time\n */\nexport type TransactionEvent = {\n transaction?: TransactionSk2;\n error?: TransactionError;\n};\n\nexport type SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\nexport type ProductStatus = {\n state: SubscriptionStatus;\n};\n\nexport const transactionSk2Map = ({\n id,\n originalPurchaseDate,\n productID,\n purchaseDate,\n purchasedQuantity,\n}: TransactionSk2): Purchase => {\n const purchase: Purchase = {\n productId: productID,\n transactionId: String(id),\n transactionDate: purchaseDate, //??\n transactionReceipt: '', // Not available\n purchaseToken: '', //Not avaiable\n quantityIOS: purchasedQuantity,\n originalTransactionDateIOS: String(originalPurchaseDate),\n originalTransactionIdentifierIOS: String(id), // ??\n };\n return purchase;\n};\n\n/**\n * Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc\n */\nexport interface PaymentDiscountSk2 {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n offerID: string;\n\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyID: string;\n\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n}\n\nexport const offerSk2Map = (\n offer: Apple.PaymentDiscount | undefined,\n): Record<keyof PaymentDiscountSk2, string> | undefined => {\n if (!offer) {\n return undefined;\n }\n return {\n offerID: offer.identifier,\n keyID: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n"],"mappings":";;;;;;;AASA;;AAqCO,MAAMA,aAAa,GAAG,QAMC;EAAA,IANA;IAC5BC,EAD4B;IAE5BC,WAF4B;IAG5BC,WAH4B;IAI5BC,KAJ4B;IAK5BC;EAL4B,CAMA;EAC5B,MAAMC,IAAgB,GAAG;IACvBC,KAAK,EAAEJ,WADgB;IAEvBK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAFM;IAGvBC,WAHuB;IAIvBQ,IAAI,EAAE,KAJiB;IAKvBN,KAAK,EAAEK,MAAM,CAACL,KAAD,CALU;IAMvBO,cAAc,EAAEN,YANO;IAOvBO,QAAQ,EAAE,EAPa,CAOT;;EAPS,CAAzB;EASA,OAAON,IAAP;AACD,CAjBM;;;;AAmBA,MAAMO,kBAAkB,GAAG,SAOC;EAAA;;EAAA,IAPA;IACjCZ,EADiC;IAEjCC,WAFiC;IAGjCC,WAHiC;IAIjCC,KAJiC;IAKjCC,YALiC;IAMjCS;EANiC,CAOA;EACjC,MAAMR,IAAqB,GAAG;IAC5BS,QAAQ,EAAEC,sBAAA,CAAqBC,GADH;IAE5BV,KAAK,EAAEJ,WAFqB;IAG5BK,SAAS,EAAEC,MAAM,CAACR,EAAD,CAHW;IAI5BC,WAJ4B;IAK5BQ,IAAI,EAAE,MALsB;IAM5BN,KAAK,EAAEK,MAAM,CAACL,KAAD,CANe;IAO5BO,cAAc,EAAEN,YAPY;IAQ5BO,QAAQ,EAAE,EARkB;IAQd;IACdM,2BAA2B,EAAG,GAAEJ,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEK,kBAAjB,0DAAG,sBAAkCC,KAAM,EAT5C;IAU5BC,yBAAyB,EACvBP,YADuB,aACvBA,YADuB,iDACvBA,YAAY,CAAEK,kBADS,2DACvB,uBAAkCG,IAAlC,CAAuCC,WAAvC;EAX0B,CAA9B;EAaA,OAAOjB,IAAP;AACD,CAtBM;;;;AAuEA,MAAMkB,iBAAiB,GAAG,SAMD;EAAA,IANE;IAChCvB,EADgC;IAEhCwB,oBAFgC;IAGhCC,SAHgC;IAIhCC,YAJgC;IAKhCC;EALgC,CAMF;EAC9B,MAAMC,QAAkB,GAAG;IACzBrB,SAAS,EAAEkB,SADc;IAEzBI,aAAa,EAAErB,MAAM,CAACR,EAAD,CAFI;IAGzB8B,eAAe,EAAEJ,YAHQ;IAGM;IAC/BK,kBAAkB,EAAE,EAJK;IAID;IACxBC,aAAa,EAAE,EALU;IAKN;IACnBC,WAAW,EAAEN,iBANY;IAOzBO,0BAA0B,EAAE1B,MAAM,CAACgB,oBAAD,CAPT;IAQzBW,gCAAgC,EAAE3B,MAAM,CAACR,EAAD,CARf,CAQqB;;EARrB,CAA3B;EAUA,OAAO4B,QAAP;AACD,CAlBM;AAoBP;AACA;AACA;;;;;AA4BO,MAAMQ,WAAW,GACtBC,KADyB,IAEgC;EACzD,IAAI,CAACA,KAAL,EAAY;IACV,OAAOC,SAAP;EACD;;EACD,OAAO;IACLC,OAAO,EAAEF,KAAK,CAACG,UADV;IAELC,KAAK,EAAEJ,KAAK,CAACK,aAFR;IAGLC,KAAK,EAAEN,KAAK,CAACM,KAHR;IAILC,SAAS,EAAEP,KAAK,CAACO,SAJZ;IAKLC,SAAS,EAAER,KAAK,CAACQ,SAAN,CAAgBC,QAAhB;EALN,CAAP;AAOD,CAbM"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PurchaseStateAndroid = exports.ProrationModesAndroid = exports.ProductType = exports.PROMOTED_PRODUCT = exports.InstallSourceAndroid = void 0;
|
|
6
|
+
exports.SubscriptionPlatform = exports.PurchaseStateAndroid = exports.ProrationModesAndroid = exports.ProductType = exports.PROMOTED_PRODUCT = exports.InstallSourceAndroid = void 0;
|
|
7
7
|
let ProrationModesAndroid;
|
|
8
8
|
exports.ProrationModesAndroid = ProrationModesAndroid;
|
|
9
9
|
|
|
@@ -45,4 +45,18 @@ exports.ProductType = ProductType;
|
|
|
45
45
|
ProductType["inapp"] = "inapp";
|
|
46
46
|
ProductType["iap"] = "iap";
|
|
47
47
|
})(ProductType || (exports.ProductType = ProductType = {}));
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Can be used to distinguish the different platforms' subscription information
|
|
51
|
+
*/
|
|
52
|
+
let SubscriptionPlatform;
|
|
53
|
+
/** Android Billing v5 type */
|
|
54
|
+
|
|
55
|
+
exports.SubscriptionPlatform = SubscriptionPlatform;
|
|
56
|
+
|
|
57
|
+
(function (SubscriptionPlatform) {
|
|
58
|
+
SubscriptionPlatform["android"] = "android";
|
|
59
|
+
SubscriptionPlatform["amazon"] = "amazon";
|
|
60
|
+
SubscriptionPlatform["ios"] = "ios";
|
|
61
|
+
})(SubscriptionPlatform || (exports.SubscriptionPlatform = SubscriptionPlatform = {}));
|
|
48
62
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n
|
|
1
|
+
{"version":3,"names":["ProrationModesAndroid","PurchaseStateAndroid","PROMOTED_PRODUCT","InstallSourceAndroid","ProductType","SubscriptionPlatform"],"sources":["index.ts"],"sourcesContent":["import type {\n AmazonModuleProps,\n AndroidModuleProps,\n IosModuleProps,\n} from '../modules';\nimport type {IosModulePropsSk2} from '../modules/iosSk2';\n\nimport type * as Apple from './apple';\n\nexport type Sku = string;\n\nexport enum ProrationModesAndroid {\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n IMMEDIATE_WITHOUT_PRORATION = 3,\n DEFERRED = 4,\n IMMEDIATE_AND_CHARGE_FULL_PRICE = 5,\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n}\n\nexport enum PurchaseStateAndroid {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\nexport const PROMOTED_PRODUCT = 'iap-promoted-product';\n\nexport enum InstallSourceAndroid {\n NOT_SET = 0,\n GOOGLE_PLAY = 1,\n AMAZON = 2,\n}\n\nexport enum ProductType {\n /** Subscription */\n subs = 'subs',\n\n /** Subscription */\n sub = 'sub',\n\n /** Consumable */\n inapp = 'inapp',\n\n /** Consumable */\n iap = 'iap',\n}\n\nexport interface ProductCommon {\n type: 'subs' | 'sub' | 'inapp' | 'iap';\n productId: string; //iOS\n productIds?: string[];\n title: string;\n description: string;\n price: string;\n currency: string;\n localizedPrice: string;\n countryCode?: string;\n}\n\nexport interface ProductPurchase {\n productId: string;\n transactionId?: string;\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string;\n //iOS\n quantityIOS?: number;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n //Android\n productIds?: string[];\n dataAndroid?: string;\n signatureAndroid?: string;\n autoRenewingAndroid?: boolean;\n purchaseStateAndroid?: PurchaseStateAndroid;\n isAcknowledgedAndroid?: boolean;\n packageNameAndroid?: string;\n developerPayloadAndroid?: string;\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n //Amazon\n userIdAmazon?: string;\n userMarketplaceAmazon?: string;\n userJsonAmazon?: string;\n isCanceledAmazon?: boolean;\n}\n\nexport interface PurchaseResult {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n purchaseToken?: string;\n}\n\nexport interface SubscriptionPurchase extends ProductPurchase {\n autoRenewingAndroid?: boolean;\n originalTransactionDateIOS?: string;\n originalTransactionIdentifierIOS?: string;\n}\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\nexport interface Discount {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n subscriptionPeriod: string;\n}\n\nexport interface ProductAndroid extends ProductCommon {\n type: 'inapp' | 'iap';\n oneTimePurchaseOfferDetails?: {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n };\n}\nexport interface ProductIOS extends ProductCommon {\n type: 'inapp' | 'iap';\n}\n\nexport type Product = ProductAndroid & ProductIOS;\n\n/**\n * Can be used to distinguish the different platforms' subscription information\n */\nexport enum SubscriptionPlatform {\n android = 'android',\n amazon = 'amazon',\n ios = 'ios',\n}\n\n/** Android Billing v5 type */\nexport interface SubscriptionAndroid {\n platform: SubscriptionPlatform.android;\n productType: 'subs';\n name: string;\n title: string;\n description: string;\n productId: string;\n subscriptionOfferDetails: SubscriptionOfferAndroid[];\n}\n\nexport interface SubscriptionOfferAndroid {\n offerToken: string;\n pricingPhases: {\n pricingPhaseList: PricingPhaseAndroid[];\n };\n offerTags: string[];\n}\n\nexport interface PricingPhaseAndroid {\n formattedPrice: string;\n priceCurrencyCode: string;\n /**\n * P1W, P1M, P1Y\n */\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n}\n\n/**\n * TODO: As of 2022-10-10, this typing is not verified against the real\n * Amazon API. Please update this if you have a more accurate type.\n */\nexport interface SubscriptionAmazon extends ProductCommon {\n platform: SubscriptionPlatform.amazon;\n type: 'subs';\n\n productType?: string;\n name?: string;\n}\n\nexport type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\nexport interface SubscriptionIOS extends ProductCommon {\n platform: SubscriptionPlatform.ios;\n type: 'subs';\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?:\n | ''\n | 'FREETRIAL'\n | 'PAYASYOUGO'\n | 'PAYUPFRONT';\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n}\n\nexport type Subscription =\n | SubscriptionAndroid\n | SubscriptionAmazon\n | SubscriptionIOS;\n\nexport interface RequestPurchaseBaseAndroid {\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n}\n\nexport interface RequestPurchaseAndroid extends RequestPurchaseBaseAndroid {\n skus: Sku[];\n}\n\nexport interface RequestPurchaseIOS {\n sku: Sku;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: Apple.PaymentDiscount;\n}\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon purchases */\nexport type RequestPurchaseAmazon = RequestPurchaseIOS;\n\nexport type RequestPurchase =\n | RequestPurchaseAndroid\n | RequestPurchaseAmazon\n | RequestPurchaseIOS;\n\n/**\n * In order to purchase a new subscription, every sku must have a selected offerToken\n * @see SubscriptionAndroid.subscriptionOfferDetails.offerToken\n */\nexport interface SubscriptionOffer {\n sku: Sku;\n offerToken: string;\n}\n\nexport interface RequestSubscriptionAndroid extends RequestPurchaseBaseAndroid {\n purchaseTokenAndroid?: string;\n prorationModeAndroid?: ProrationModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n}\n\nexport type RequestSubscriptionIOS = RequestPurchaseIOS;\n\n/** As of 2022-10-12, we only use the `sku` field for Amazon subscriptions */\nexport type RequestSubscriptionAmazon = RequestSubscriptionIOS;\n\nexport type RequestSubscription =\n | RequestSubscriptionAndroid\n | RequestSubscriptionAmazon\n | RequestSubscriptionIOS;\n\ndeclare module 'react-native' {\n interface NativeModulesStatic {\n RNIapIos: IosModuleProps;\n RNIapIosSk2: IosModulePropsSk2;\n RNIapModule: AndroidModuleProps;\n RNIapAmazonModule: AmazonModuleProps;\n }\n}\n"],"mappings":";;;;;;IAWYA,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;IASAC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;AAML,MAAMC,gBAAgB,GAAG,sBAAzB;;IAEKC,oB;;;WAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;EAAAA,oB,CAAAA,oB;GAAAA,oB,oCAAAA,oB;;IAMAC,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA8FZ;AACA;AACA;IACYC,oB;AAMZ;;;;WANYA,oB;EAAAA,oB;EAAAA,oB;EAAAA,oB;GAAAA,oB,oCAAAA,oB"}
|
package/lib/module/iap.js
CHANGED
|
@@ -5,9 +5,8 @@ import * as IapIos from './modules/ios';
|
|
|
5
5
|
import * as IapIosSk2 from './modules/iosSk2';
|
|
6
6
|
import { offerToRecord } from './types/apple';
|
|
7
7
|
import { offerSk2Map, productSk2Map, subscriptionSk2Map, transactionSk2Map } from './types/appleSk2';
|
|
8
|
-
import { fillProductsWithAdditionalData, getAndroidModule, getIosModule, getNativeModule, isAmazon, isIosStorekit2, storekit1Mode, storekit2Mode, storekitHybridMode } from './internal';
|
|
9
|
-
import { ProductType } from './types';
|
|
10
|
-
import { PurchaseStateAndroid } from './types';
|
|
8
|
+
import { fillProductsWithAdditionalData, getAndroidModule, getAndroidModuleType, getIosModule, getNativeModule, isAmazon, isIosStorekit2, storekit1Mode, storekit2Mode, storekitHybridMode } from './internal';
|
|
9
|
+
import { ProductType, PurchaseStateAndroid, SubscriptionPlatform } from './types';
|
|
11
10
|
export { IapAndroid, IapAmazon, IapIos, IapIosSk2, isIosStorekit2 };
|
|
12
11
|
const {
|
|
13
12
|
RNIapIos,
|
|
@@ -200,14 +199,42 @@ export const getSubscriptions = _ref2 => {
|
|
|
200
199
|
items = await RNIapIos.getItems(skus);
|
|
201
200
|
}
|
|
202
201
|
|
|
203
|
-
|
|
202
|
+
items = items.filter(item => skus.includes(item.productId) && item.type === 'subs');
|
|
203
|
+
return addSubscriptionPlatform(items, SubscriptionPlatform.ios);
|
|
204
204
|
},
|
|
205
205
|
android: async () => {
|
|
206
|
-
const
|
|
207
|
-
|
|
206
|
+
const androidPlatform = getAndroidModuleType();
|
|
207
|
+
let subscriptions = await getAndroidModule().getItemsByType(ANDROID_ITEM_TYPE_SUBSCRIPTION, skus);
|
|
208
|
+
|
|
209
|
+
switch (androidPlatform) {
|
|
210
|
+
case 'android':
|
|
211
|
+
{
|
|
212
|
+
const castSubscriptions = subscriptions;
|
|
213
|
+
return addSubscriptionPlatform(castSubscriptions, SubscriptionPlatform.android);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
case 'amazon':
|
|
217
|
+
let castSubscriptions = subscriptions;
|
|
218
|
+
castSubscriptions = await fillProductsWithAdditionalData(castSubscriptions);
|
|
219
|
+
return addSubscriptionPlatform(castSubscriptions, SubscriptionPlatform.amazon);
|
|
220
|
+
|
|
221
|
+
case null:
|
|
222
|
+
default:
|
|
223
|
+
throw new Error(`getSubscriptions received unknown platform ${androidPlatform}. Verify the logic in getAndroidModuleType`);
|
|
224
|
+
}
|
|
208
225
|
}
|
|
209
226
|
}) || (() => Promise.reject(new Error('Unsupported Platform'))))();
|
|
210
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Adds an extra property to subscriptions so we can distinguish the platform
|
|
230
|
+
* we retrieved them on.
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
const addSubscriptionPlatform = (subscriptions, platform) => {
|
|
234
|
+
return subscriptions.map(subscription => ({ ...subscription,
|
|
235
|
+
platform
|
|
236
|
+
}));
|
|
237
|
+
};
|
|
211
238
|
/**
|
|
212
239
|
* Gets an inventory of purchases made by the user regardless of consumption status
|
|
213
240
|
* ## Usage
|
|
@@ -232,11 +259,12 @@ const App = () => {
|
|
|
232
259
|
```
|
|
233
260
|
@param {alsoPublishToEventListener}:boolean. (IOS Sk2 only) When `true`, every element will also be pushed to the purchaseUpdated listener.
|
|
234
261
|
Note that this is only for backaward compatiblity. It won't publish to transactionUpdated (Storekit2) Defaults to `false`
|
|
235
|
-
@param {automaticallyFinishRestoredTransactions}:boolean. (IOS Sk1 only) When `true`, all the transactions that are returned are automatically
|
|
236
|
-
finished. This means that if you call this method again you won't get the same result on the same device. On the other hand, if `false` you'd
|
|
262
|
+
@param {automaticallyFinishRestoredTransactions}:boolean. (IOS Sk1 only) When `true`, all the transactions that are returned are automatically
|
|
263
|
+
finished. This means that if you call this method again you won't get the same result on the same device. On the other hand, if `false` you'd
|
|
237
264
|
have to manually finish the returned transaction once you have delivered the content to your user.
|
|
238
265
|
*/
|
|
239
266
|
|
|
267
|
+
|
|
240
268
|
export const getPurchaseHistory = function () {
|
|
241
269
|
let {
|
|
242
270
|
alsoPublishToEventListener = false,
|
|
@@ -339,7 +367,7 @@ const App = () => {
|
|
|
339
367
|
```
|
|
340
368
|
@param {alsoPublishToEventListener}:boolean When `true`, every element will also be pushed to the purchaseUpdated listener.
|
|
341
369
|
Note that this is only for backaward compatiblity. It won't publish to transactionUpdated (Storekit2) Defaults to `false`
|
|
342
|
-
*
|
|
370
|
+
*
|
|
343
371
|
*/
|
|
344
372
|
|
|
345
373
|
export const getAvailablePurchases = function () {
|
|
@@ -381,22 +409,22 @@ always keeping at false, and verifying the transaction receipts on the server-si
|
|
|
381
409
|
|
|
382
410
|
```ts
|
|
383
411
|
requestPurchase(
|
|
384
|
-
The product's sku/ID
|
|
412
|
+
The product's sku/ID
|
|
385
413
|
sku,
|
|
386
414
|
|
|
387
|
-
|
|
415
|
+
|
|
388
416
|
* You should set this to false and call finishTransaction manually when you have delivered the purchased goods to the user.
|
|
389
417
|
* @default false
|
|
390
|
-
|
|
418
|
+
|
|
391
419
|
andDangerouslyFinishTransactionAutomaticallyIOS = false,
|
|
392
420
|
|
|
393
|
-
/** Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
421
|
+
/** Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
394
422
|
obfuscatedAccountIdAndroid,
|
|
395
423
|
|
|
396
|
-
Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
424
|
+
Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
397
425
|
obfuscatedProfileIdAndroid,
|
|
398
426
|
|
|
399
|
-
The purchaser's user ID
|
|
427
|
+
The purchaser's user ID
|
|
400
428
|
applicationUsername,
|
|
401
429
|
): Promise<ProductPurchase>;
|
|
402
430
|
```
|
|
@@ -434,54 +462,56 @@ const App = () => {
|
|
|
434
462
|
|
|
435
463
|
*/
|
|
436
464
|
|
|
437
|
-
export const requestPurchase =
|
|
438
|
-
|
|
439
|
-
sku
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
obfuscatedProfileIdAndroid,
|
|
443
|
-
appAccountToken,
|
|
444
|
-
skus,
|
|
445
|
-
// Android Billing V5
|
|
446
|
-
isOfferPersonalized = undefined,
|
|
447
|
-
// Android Billing V5
|
|
448
|
-
quantity,
|
|
449
|
-
withOffer
|
|
450
|
-
} = _ref3;
|
|
451
|
-
return (Platform.select({
|
|
452
|
-
ios: async () => {
|
|
453
|
-
if (!sku) {
|
|
454
|
-
return Promise.reject(new Error('sku is required for iOS purchase'));
|
|
455
|
-
}
|
|
465
|
+
export const requestPurchase = request => (Platform.select({
|
|
466
|
+
ios: async () => {
|
|
467
|
+
if (!('sku' in request)) {
|
|
468
|
+
throw new Error('sku is required for iOS purchase');
|
|
469
|
+
}
|
|
456
470
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
471
|
+
const {
|
|
472
|
+
sku,
|
|
473
|
+
andDangerouslyFinishTransactionAutomaticallyIOS = false,
|
|
474
|
+
appAccountToken,
|
|
475
|
+
quantity,
|
|
476
|
+
withOffer
|
|
477
|
+
} = request;
|
|
460
478
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
} else {
|
|
465
|
-
return RNIapIos.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offerToRecord(withOffer));
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
android: async () => {
|
|
469
|
-
if (isAmazon) {
|
|
470
|
-
if (!sku) {
|
|
471
|
-
return Promise.reject(new Error('sku is required for Amazon purchase'));
|
|
472
|
-
}
|
|
479
|
+
if (andDangerouslyFinishTransactionAutomaticallyIOS) {
|
|
480
|
+
console.warn('You are dangerously allowing react-native-iap to finish your transaction automatically. You should set andDangerouslyFinishTransactionAutomatically to false when calling requestPurchase and call finishTransaction manually when you have delivered the purchased goods to the user. It defaults to true to provide backwards compatibility. Will default to false in version 4.0.0.');
|
|
481
|
+
}
|
|
473
482
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
483
|
+
if (isIosStorekit2()) {
|
|
484
|
+
const offer = offerSk2Map(withOffer);
|
|
485
|
+
return RNIapIosSk2.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offer);
|
|
486
|
+
} else {
|
|
487
|
+
return RNIapIos.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offerToRecord(withOffer));
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
android: async () => {
|
|
491
|
+
if (isAmazon) {
|
|
492
|
+
if (!('sku' in request)) {
|
|
493
|
+
throw new Error('sku is required for Amazon purchase');
|
|
494
|
+
}
|
|
479
495
|
|
|
480
|
-
|
|
496
|
+
const {
|
|
497
|
+
sku
|
|
498
|
+
} = request;
|
|
499
|
+
return RNIapAmazonModule.buyItemByType(sku);
|
|
500
|
+
} else {
|
|
501
|
+
if (!('skus' in request) || !request.skus.length) {
|
|
502
|
+
throw new Error('skus is required for Android purchase');
|
|
481
503
|
}
|
|
504
|
+
|
|
505
|
+
const {
|
|
506
|
+
skus,
|
|
507
|
+
obfuscatedAccountIdAndroid,
|
|
508
|
+
obfuscatedProfileIdAndroid,
|
|
509
|
+
isOfferPersonalized
|
|
510
|
+
} = request;
|
|
511
|
+
return getAndroidModule().buyItemByType(ANDROID_ITEM_TYPE_IAP, skus, undefined, -1, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, [], isOfferPersonalized ?? false);
|
|
482
512
|
}
|
|
483
|
-
}
|
|
484
|
-
};
|
|
513
|
+
}
|
|
514
|
+
}) || Promise.resolve)();
|
|
485
515
|
/**
|
|
486
516
|
* Request a purchase for product. This will be received in `PurchaseUpdatedListener`.
|
|
487
517
|
* Request a purchase for a subscription.
|
|
@@ -497,7 +527,7 @@ always keeping at false, and verifying the transaction receipts on the server-si
|
|
|
497
527
|
|
|
498
528
|
```ts
|
|
499
529
|
requestSubscription(
|
|
500
|
-
The product's sku/ID
|
|
530
|
+
The product's sku/ID
|
|
501
531
|
sku,
|
|
502
532
|
|
|
503
533
|
|
|
@@ -506,19 +536,19 @@ requestSubscription(
|
|
|
506
536
|
|
|
507
537
|
andDangerouslyFinishTransactionAutomaticallyIOS = false,
|
|
508
538
|
|
|
509
|
-
purchaseToken that the user is upgrading or downgrading from (Android).
|
|
539
|
+
purchaseToken that the user is upgrading or downgrading from (Android).
|
|
510
540
|
purchaseTokenAndroid,
|
|
511
541
|
|
|
512
|
-
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY, IMMEDIATE_WITH_TIME_PRORATION, IMMEDIATE_AND_CHARGE_PRORATED_PRICE, IMMEDIATE_WITHOUT_PRORATION, DEFERRED
|
|
542
|
+
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY, IMMEDIATE_WITH_TIME_PRORATION, IMMEDIATE_AND_CHARGE_PRORATED_PRICE, IMMEDIATE_WITHOUT_PRORATION, DEFERRED
|
|
513
543
|
prorationModeAndroid = -1,
|
|
514
544
|
|
|
515
|
-
/** Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
545
|
+
/** Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.
|
|
516
546
|
obfuscatedAccountIdAndroid,
|
|
517
547
|
|
|
518
|
-
Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
548
|
+
Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.
|
|
519
549
|
obfuscatedProfileIdAndroid,
|
|
520
550
|
|
|
521
|
-
The purchaser's user ID
|
|
551
|
+
The purchaser's user ID
|
|
522
552
|
applicationUsername,
|
|
523
553
|
): Promise<SubscriptionPurchase>
|
|
524
554
|
```
|
|
@@ -560,56 +590,58 @@ const App = () => {
|
|
|
560
590
|
```
|
|
561
591
|
*/
|
|
562
592
|
|
|
563
|
-
export const requestSubscription =
|
|
564
|
-
|
|
565
|
-
sku
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
prorationModeAndroid = -1,
|
|
569
|
-
obfuscatedAccountIdAndroid,
|
|
570
|
-
obfuscatedProfileIdAndroid,
|
|
571
|
-
subscriptionOffers = undefined,
|
|
572
|
-
// Android Billing V5
|
|
573
|
-
isOfferPersonalized = undefined,
|
|
574
|
-
// Android Billing V5
|
|
575
|
-
appAccountToken,
|
|
576
|
-
quantity,
|
|
577
|
-
withOffer
|
|
578
|
-
} = _ref4;
|
|
579
|
-
return (Platform.select({
|
|
580
|
-
ios: async () => {
|
|
581
|
-
if (!sku) {
|
|
582
|
-
return Promise.reject(new Error('sku is required for iOS subscription'));
|
|
583
|
-
}
|
|
593
|
+
export const requestSubscription = request => (Platform.select({
|
|
594
|
+
ios: async () => {
|
|
595
|
+
if (!('sku' in request)) {
|
|
596
|
+
throw new Error('sku is required for iOS subscriptions');
|
|
597
|
+
}
|
|
584
598
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
599
|
+
const {
|
|
600
|
+
sku,
|
|
601
|
+
andDangerouslyFinishTransactionAutomaticallyIOS = false,
|
|
602
|
+
appAccountToken,
|
|
603
|
+
quantity,
|
|
604
|
+
withOffer
|
|
605
|
+
} = request;
|
|
588
606
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
} else {
|
|
593
|
-
return RNIapIos.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offerToRecord(withOffer));
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
android: async () => {
|
|
597
|
-
if (isAmazon) {
|
|
598
|
-
if (!sku) {
|
|
599
|
-
return Promise.reject(new Error('sku is required for Amazon purchase'));
|
|
600
|
-
}
|
|
607
|
+
if (andDangerouslyFinishTransactionAutomaticallyIOS) {
|
|
608
|
+
console.warn('You are dangerously allowing react-native-iap to finish your transaction automatically. You should set andDangerouslyFinishTransactionAutomatically to false when calling requestPurchase and call finishTransaction manually when you have delivered the purchased goods to the user. It defaults to true to provide backwards compatibility. Will default to false in version 4.0.0.');
|
|
609
|
+
}
|
|
601
610
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
611
|
+
if (isIosStorekit2()) {
|
|
612
|
+
const offer = offerSk2Map(withOffer);
|
|
613
|
+
return RNIapIosSk2.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offer);
|
|
614
|
+
} else {
|
|
615
|
+
return RNIapIos.buyProduct(sku, andDangerouslyFinishTransactionAutomaticallyIOS, appAccountToken, quantity ?? -1, offerToRecord(withOffer));
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
android: async () => {
|
|
619
|
+
if (isAmazon) {
|
|
620
|
+
if (!('sku' in request)) {
|
|
621
|
+
throw new Error('sku is required for Amazon subscriptions');
|
|
622
|
+
}
|
|
607
623
|
|
|
608
|
-
|
|
624
|
+
const {
|
|
625
|
+
sku
|
|
626
|
+
} = request;
|
|
627
|
+
return RNIapAmazonModule.buyItemByType(sku);
|
|
628
|
+
} else {
|
|
629
|
+
if (!('subscriptionOffers' in request) || request.subscriptionOffers.length === 0) {
|
|
630
|
+
throw new Error('subscriptionOffers are required for Google Play subscriptions');
|
|
609
631
|
}
|
|
632
|
+
|
|
633
|
+
const {
|
|
634
|
+
subscriptionOffers,
|
|
635
|
+
purchaseTokenAndroid,
|
|
636
|
+
prorationModeAndroid,
|
|
637
|
+
obfuscatedAccountIdAndroid,
|
|
638
|
+
obfuscatedProfileIdAndroid,
|
|
639
|
+
isOfferPersonalized
|
|
640
|
+
} = request;
|
|
641
|
+
return RNIapModule.buyItemByType(ANDROID_ITEM_TYPE_SUBSCRIPTION, subscriptionOffers === null || subscriptionOffers === void 0 ? void 0 : subscriptionOffers.map(so => so.sku), purchaseTokenAndroid, prorationModeAndroid, obfuscatedAccountIdAndroid, obfuscatedProfileIdAndroid, subscriptionOffers === null || subscriptionOffers === void 0 ? void 0 : subscriptionOffers.map(so => so.offerToken), isOfferPersonalized ?? false);
|
|
610
642
|
}
|
|
611
|
-
}
|
|
612
|
-
};
|
|
643
|
+
}
|
|
644
|
+
}) || (() => Promise.resolve(null)))();
|
|
613
645
|
/**
|
|
614
646
|
* Finish Transaction (both platforms)
|
|
615
647
|
* Abstracts Finish Transaction
|
|
@@ -617,7 +649,7 @@ export const requestSubscription = _ref4 => {
|
|
|
617
649
|
* Call this after you have persisted the purchased state to your server or local data in your app.
|
|
618
650
|
* `react-native-iap` will continue to deliver the purchase updated events with the successful purchase until you finish the transaction. **Even after the app has relaunched.**
|
|
619
651
|
* Android: it will consume purchase for consumables and acknowledge purchase for non-consumables.
|
|
620
|
-
*
|
|
652
|
+
*
|
|
621
653
|
```tsx
|
|
622
654
|
import React from 'react';
|
|
623
655
|
import {Button} from 'react-native';
|
|
@@ -632,15 +664,15 @@ const App = () => {
|
|
|
632
664
|
|
|
633
665
|
return <Button title="Buy product" onPress={handlePurchase} />;
|
|
634
666
|
};
|
|
635
|
-
```
|
|
667
|
+
```
|
|
636
668
|
*/
|
|
637
669
|
|
|
638
|
-
export const finishTransaction =
|
|
670
|
+
export const finishTransaction = _ref3 => {
|
|
639
671
|
let {
|
|
640
672
|
purchase,
|
|
641
673
|
isConsumable,
|
|
642
674
|
developerPayloadAndroid
|
|
643
|
-
} =
|
|
675
|
+
} = _ref3;
|
|
644
676
|
return (Platform.select({
|
|
645
677
|
ios: async () => {
|
|
646
678
|
const transactionId = purchase.transactionId;
|