react-native-iap 12.3.1 → 12.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/RNIapIosSk2.m +1 -1
- package/ios/RNIapIosSk2.swift +11 -11
- package/lib/commonjs/types/appleSk2.js +3 -3
- package/lib/commonjs/types/appleSk2.js.map +1 -1
- package/lib/module/types/appleSk2.js +3 -3
- package/lib/module/types/appleSk2.js.map +1 -1
- package/lib/typescript/types/appleSk2.d.ts +1 -1
- package/package.json +1 -1
- package/src/types/appleSk2.ts +2 -1
package/ios/RNIapIosSk2.m
CHANGED
|
@@ -73,7 +73,7 @@ RCT_EXTERN_METHOD(finishTransaction:
|
|
|
73
73
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
74
74
|
reject:(RCTPromiseRejectBlock)reject)
|
|
75
75
|
|
|
76
|
-
RCT_EXTERN_METHOD(
|
|
76
|
+
RCT_EXTERN_METHOD(getPendingTransactions:
|
|
77
77
|
(RCTPromiseResolveBlock)resolve
|
|
78
78
|
reject:(RCTPromiseRejectBlock)reject)
|
|
79
79
|
|
package/ios/RNIapIosSk2.swift
CHANGED
|
@@ -9,7 +9,7 @@ protocol Sk2Delegate {
|
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
func initConnection(
|
|
12
|
-
_ resolve: @escaping RCTPromiseResolveBlock
|
|
12
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
13
13
|
reject: @escaping RCTPromiseRejectBlock
|
|
14
14
|
)
|
|
15
15
|
|
|
@@ -42,7 +42,7 @@ protocol Sk2Delegate {
|
|
|
42
42
|
|
|
43
43
|
func isEligibleForIntroOffer(
|
|
44
44
|
_ groupID: String,
|
|
45
|
-
resolve: @escaping RCTPromiseResolveBlock
|
|
45
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
46
46
|
reject: @escaping RCTPromiseRejectBlock
|
|
47
47
|
)
|
|
48
48
|
|
|
@@ -66,11 +66,11 @@ protocol Sk2Delegate {
|
|
|
66
66
|
|
|
67
67
|
func finishTransaction(
|
|
68
68
|
_ transactionIdentifier: String,
|
|
69
|
-
resolve: @escaping RCTPromiseResolveBlock
|
|
69
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
70
70
|
reject: @escaping RCTPromiseRejectBlock
|
|
71
71
|
)
|
|
72
72
|
|
|
73
|
-
func
|
|
73
|
+
func getPendingTransactions (
|
|
74
74
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
75
75
|
reject: @escaping RCTPromiseRejectBlock
|
|
76
76
|
)
|
|
@@ -117,7 +117,7 @@ class DummySk2: Sk2Delegate {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
func initConnection(
|
|
120
|
-
_ resolve: @escaping RCTPromiseResolveBlock
|
|
120
|
+
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
121
121
|
reject: @escaping RCTPromiseRejectBlock
|
|
122
122
|
) {
|
|
123
123
|
reject(errorCode, errorMessage, nil)
|
|
@@ -160,7 +160,7 @@ class DummySk2: Sk2Delegate {
|
|
|
160
160
|
|
|
161
161
|
func isEligibleForIntroOffer(
|
|
162
162
|
_ groupID: String,
|
|
163
|
-
resolve: @escaping RCTPromiseResolveBlock
|
|
163
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
164
164
|
reject: @escaping RCTPromiseRejectBlock
|
|
165
165
|
) {
|
|
166
166
|
reject(errorCode, errorMessage, nil)
|
|
@@ -192,13 +192,13 @@ class DummySk2: Sk2Delegate {
|
|
|
192
192
|
|
|
193
193
|
func finishTransaction(
|
|
194
194
|
_ transactionIdentifier: String,
|
|
195
|
-
resolve: @escaping RCTPromiseResolveBlock
|
|
195
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
196
196
|
reject: @escaping RCTPromiseRejectBlock
|
|
197
197
|
) {
|
|
198
198
|
reject(errorCode, errorMessage, nil)
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
func
|
|
201
|
+
func getPendingTransactions (
|
|
202
202
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
203
203
|
reject: @escaping RCTPromiseRejectBlock
|
|
204
204
|
) {
|
|
@@ -376,11 +376,11 @@ class RNIapIosSk2: RCTEventEmitter, Sk2Delegate {
|
|
|
376
376
|
delegate.finishTransaction(transactionIdentifier, resolve: resolve, reject: reject)
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
@objc public func
|
|
379
|
+
@objc public func getPendingTransactions (
|
|
380
380
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
381
381
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
382
382
|
) {
|
|
383
|
-
delegate.
|
|
383
|
+
delegate.getPendingTransactions(resolve, reject: reject)
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
@objc public func sync(
|
|
@@ -830,7 +830,7 @@ class RNIapIosSk2iOS15: Sk2Delegate {
|
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
832
|
|
|
833
|
-
@objc public func
|
|
833
|
+
@objc public func getPendingTransactions (
|
|
834
834
|
_ resolve: @escaping RCTPromiseResolveBlock = { _ in },
|
|
835
835
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
836
836
|
) {
|
|
@@ -65,7 +65,8 @@ const transactionSk2Map = _ref3 => {
|
|
|
65
65
|
originalPurchaseDate,
|
|
66
66
|
productID,
|
|
67
67
|
purchaseDate,
|
|
68
|
-
purchasedQuantity
|
|
68
|
+
purchasedQuantity,
|
|
69
|
+
originalID
|
|
69
70
|
} = _ref3;
|
|
70
71
|
const purchase = {
|
|
71
72
|
productId: productID,
|
|
@@ -78,8 +79,7 @@ const transactionSk2Map = _ref3 => {
|
|
|
78
79
|
//Not avaiable
|
|
79
80
|
quantityIOS: purchasedQuantity,
|
|
80
81
|
originalTransactionDateIOS: String(originalPurchaseDate),
|
|
81
|
-
originalTransactionIdentifierIOS:
|
|
82
|
-
|
|
82
|
+
originalTransactionIdentifierIOS: originalID
|
|
83
83
|
};
|
|
84
84
|
return purchase;
|
|
85
85
|
};
|
|
@@ -1 +1 @@
|
|
|
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 RefundRequestStatus = 'success' | 'userCancelled';\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:
|
|
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","originalID","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 RefundRequestStatus = 'success' | 'userCancelled';\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 originalID,\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: originalID,\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;;AAuCO,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,SAOD;EAAA,IAPE;IAChCvB,EADgC;IAEhCwB,oBAFgC;IAGhCC,SAHgC;IAIhCC,YAJgC;IAKhCC,iBALgC;IAMhCC;EANgC,CAOF;EAC9B,MAAMC,QAAkB,GAAG;IACzBtB,SAAS,EAAEkB,SADc;IAEzBK,aAAa,EAAEtB,MAAM,CAACR,EAAD,CAFI;IAGzB+B,eAAe,EAAEL,YAHQ;IAGM;IAC/BM,kBAAkB,EAAE,EAJK;IAID;IACxBC,aAAa,EAAE,EALU;IAKN;IACnBC,WAAW,EAAEP,iBANY;IAOzBQ,0BAA0B,EAAE3B,MAAM,CAACgB,oBAAD,CAPT;IAQzBY,gCAAgC,EAAER;EART,CAA3B;EAUA,OAAOC,QAAP;AACD,CAnBM;AAqBP;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"}
|
|
@@ -51,7 +51,8 @@ export const transactionSk2Map = _ref3 => {
|
|
|
51
51
|
originalPurchaseDate,
|
|
52
52
|
productID,
|
|
53
53
|
purchaseDate,
|
|
54
|
-
purchasedQuantity
|
|
54
|
+
purchasedQuantity,
|
|
55
|
+
originalID
|
|
55
56
|
} = _ref3;
|
|
56
57
|
const purchase = {
|
|
57
58
|
productId: productID,
|
|
@@ -64,8 +65,7 @@ export const transactionSk2Map = _ref3 => {
|
|
|
64
65
|
//Not avaiable
|
|
65
66
|
quantityIOS: purchasedQuantity,
|
|
66
67
|
originalTransactionDateIOS: String(originalPurchaseDate),
|
|
67
|
-
originalTransactionIdentifierIOS:
|
|
68
|
-
|
|
68
|
+
originalTransactionIdentifierIOS: originalID
|
|
69
69
|
};
|
|
70
70
|
return purchase;
|
|
71
71
|
};
|
|
@@ -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","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 RefundRequestStatus = 'success' | 'userCancelled';\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:
|
|
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","transactionSk2Map","originalPurchaseDate","productID","purchaseDate","purchasedQuantity","originalID","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 RefundRequestStatus = 'success' | 'userCancelled';\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 originalID,\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: originalID,\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,SAAQA,oBAAR,QAAmC,GAAnC;AAuCA,OAAO,MAAMC,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;AAmBP,OAAO,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,EAAEhB,oBAAoB,CAACiB,GADH;IAE5BT,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;IACdK,2BAA2B,EAAG,GAAEH,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEI,kBAAjB,0DAAG,sBAAkCC,KAAM,EAT5C;IAU5BC,yBAAyB,EACvBN,YADuB,aACvBA,YADuB,iDACvBA,YAAY,CAAEI,kBADS,2DACvB,uBAAkCG,IAAlC,CAAuCC,WAAvC;EAX0B,CAA9B;EAaA,OAAOhB,IAAP;AACD,CAtBM;AAuEP,OAAO,MAAMiB,iBAAiB,GAAG,SAOD;EAAA,IAPE;IAChCtB,EADgC;IAEhCuB,oBAFgC;IAGhCC,SAHgC;IAIhCC,YAJgC;IAKhCC,iBALgC;IAMhCC;EANgC,CAOF;EAC9B,MAAMC,QAAkB,GAAG;IACzBrB,SAAS,EAAEiB,SADc;IAEzBK,aAAa,EAAErB,MAAM,CAACR,EAAD,CAFI;IAGzB8B,eAAe,EAAEL,YAHQ;IAGM;IAC/BM,kBAAkB,EAAE,EAJK;IAID;IACxBC,aAAa,EAAE,EALU;IAKN;IACnBC,WAAW,EAAEP,iBANY;IAOzBQ,0BAA0B,EAAE1B,MAAM,CAACe,oBAAD,CAPT;IAQzBY,gCAAgC,EAAER;EART,CAA3B;EAUA,OAAOC,QAAP;AACD,CAnBM;AAqBP;AACA;AACA;;AA4BA,OAAO,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"}
|
|
@@ -72,7 +72,7 @@ export declare type SubscriptionStatus = 'expired' | 'inBillingRetryPeriod' | 'i
|
|
|
72
72
|
export declare type ProductStatus = {
|
|
73
73
|
state: SubscriptionStatus;
|
|
74
74
|
};
|
|
75
|
-
export declare const transactionSk2Map: ({ id, originalPurchaseDate, productID, purchaseDate, purchasedQuantity, }: TransactionSk2) => Purchase;
|
|
75
|
+
export declare const transactionSk2Map: ({ id, originalPurchaseDate, productID, purchaseDate, purchasedQuantity, originalID, }: TransactionSk2) => Purchase;
|
|
76
76
|
/**
|
|
77
77
|
* Payment discount interface @see https://developer.apple.com/documentation/storekit/skpaymentdiscount?language=objc
|
|
78
78
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.3",
|
|
4
4
|
"description": "React Native In App Purchase Module.",
|
|
5
5
|
"repository": "https://github.com/dooboolab/react-native-iap",
|
|
6
6
|
"author": "dooboolab <support@dooboolab.com> (https://github.com/dooboolab)",
|
package/src/types/appleSk2.ts
CHANGED
|
@@ -142,6 +142,7 @@ export const transactionSk2Map = ({
|
|
|
142
142
|
productID,
|
|
143
143
|
purchaseDate,
|
|
144
144
|
purchasedQuantity,
|
|
145
|
+
originalID,
|
|
145
146
|
}: TransactionSk2): Purchase => {
|
|
146
147
|
const purchase: Purchase = {
|
|
147
148
|
productId: productID,
|
|
@@ -151,7 +152,7 @@ export const transactionSk2Map = ({
|
|
|
151
152
|
purchaseToken: '', //Not avaiable
|
|
152
153
|
quantityIOS: purchasedQuantity,
|
|
153
154
|
originalTransactionDateIOS: String(originalPurchaseDate),
|
|
154
|
-
originalTransactionIdentifierIOS:
|
|
155
|
+
originalTransactionIdentifierIOS: originalID,
|
|
155
156
|
};
|
|
156
157
|
return purchase;
|
|
157
158
|
};
|