react-native-iap 14.0.0-rc.1 → 14.0.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.
@@ -1 +1 @@
1
- {"version":3,"names":["getAvailablePurchases","getActiveSubscriptions","subscriptionIds","purchases","subscriptions","filter","purchase","length","includes","productId","map","iosPurchase","isActive","expirationDateIOS","Date","undefined","autoRenewingAndroid","environmentIOS","willExpireSoon","daysUntilExpirationIOS","Math","ceil","now","error","console","hasActiveSubscriptions","activeSubscriptions"],"sourceRoot":"../../../src","sources":["helpers/subscription.ts"],"mappings":";;AAAA,SAAQA,qBAAqB,QAAO,aAAK;AAOzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG,MACpCC,eAA0B,IACQ;EAClC,IAAI;IACF;IACA,MAAMC,SAAS,GAAG,MAAMH,qBAAqB,CAAC,CAAC;;IAE/C;IACA,MAAMI,aAAa,GAAGD,SAAS,CAC5BE,MAAM,CAAEC,QAAQ,IAAK;MACpB;MACA,IAAIJ,eAAe,IAAIA,eAAe,CAACK,MAAM,GAAG,CAAC,EAAE;QACjD,OAAOL,eAAe,CAACM,QAAQ,CAACF,QAAQ,CAACG,SAAS,CAAC;MACrD;MACA,OAAO,IAAI;IACb,CAAC,CAAC,CACDC,GAAG,CAAEJ,QAAQ,IAAyB;MACrC,MAAMK,WAAW,GAAGL,QAAuB;MAC3C,OAAO;QACLG,SAAS,EAAEH,QAAQ,CAACG,SAAS;QAC7BG,QAAQ,EAAE,IAAI;QAAE;QAChBC,iBAAiB,EAAEF,WAAW,CAACE,iBAAiB,GAAG,IAAIC,IAAI,CAACH,WAAW,CAACE,iBAAiB,CAAC,GAAGE,SAAS;QACtGC,mBAAmB,EAAGV,QAAQ,CAAqBU,mBAAmB;QACtEC,cAAc,EAAEN,WAAW,CAACM,cAAc;QAC1CC,cAAc,EAAE,KAAK;QAAE;QACvBC,sBAAsB,EAAER,WAAW,CAACE,iBAAiB,GACnDO,IAAI,CAACC,IAAI,CAAC,CAACV,WAAW,CAACE,iBAAiB,GAAGC,IAAI,CAACQ,GAAG,CAAC,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAGP;MACtF,CAAC;IACH,CAAC,CAAC;IAEJ,OAAOX,aAAa;EACtB,CAAC,CAAC,OAAOmB,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,qCAAqC,EAAEA,KAAK,CAAC;IAC3D,MAAMA,KAAK;EACb;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,sBAAsB,GAAG,MACpCvB,eAA0B,IACL;EACrB,IAAI;IACF,MAAMwB,mBAAmB,GAAG,MAAMzB,sBAAsB,CAACC,eAAe,CAAC;IACzE,OAAOwB,mBAAmB,CAACnB,MAAM,GAAG,CAAC;EACvC,CAAC,CAAC,OAAOgB,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;IAC7D,OAAO,KAAK;EACd;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getAvailablePurchases","getActiveSubscriptions","subscriptionIds","purchases","subscriptions","filter","purchase","length","includes","productId","map","iosPurchase","isActive","expirationDateIOS","Date","undefined","autoRenewingAndroid","environmentIOS","willExpireSoon","daysUntilExpirationIOS","Math","ceil","now","error","console","hasActiveSubscriptions","activeSubscriptions"],"sourceRoot":"../../../src","sources":["helpers/subscription.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,aAAK;AAG3C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAG,MACpCC,eAA0B,IACQ;EAClC,IAAI;IACF;IACA,MAAMC,SAAS,GAAG,MAAMH,qBAAqB,CAAC,CAAC;;IAE/C;IACA,MAAMI,aAAa,GAAGD,SAAS,CAC5BE,MAAM,CAAEC,QAAQ,IAAK;MACpB;MACA,IAAIJ,eAAe,IAAIA,eAAe,CA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":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ErrorCode","parseErrorStringToJsonObj","errorString","Error","message","code","E_UNKNOWN","parsed","JSON","parse","colonIndex","indexOf","potentialCode","substring","trim","startsWith","test","isUserCancelledError","error","errorObj","E_USER_CANCELLED","responseCode"],"sourceRoot":"../../../src","sources":["utils/error.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAAQA,SAAS,QAAO,aAAU;AAWlC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACvCC,WAAqC,EAC3B;EACV;EACA,IAAIA,WAAW,YAAYC,KAAK,EAAE;IAChCD,WAAW,GAAGA,WAAW,CAACE,OAAO;EACnC;;EAEA;EACA,IAAI,OAAOF,WAAW,KAAK,QAAQ,EAAE;IACnC,OAAO;MACLG,IAAI,EAAEL,SAAS,CAACM,SAAS;MACzBF,OAAO,EAAE;IACX,CAAC;EACH;;EAEA;EACA,IAAI;IACF,MAAMG,MAAM,GAAGC,IAAI,CAACC,KAAK,CAACP,WAAW,CAAC;IACtC,IAAI,OAAOK,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;MACjD;MACA,OAAO;QACLF,IAAI,EAAEE,MAAM,CAACF,IAAI,IAAIL,SAAS,CAACM,SAAS;QACxCF,OAAO,EAAEG,MAAM,CAACH,OAAO,IAAIF,WAAW;QACtC,GAAGK;MACL,CAAC;IACH;EACF,CAAC,CAAC,MAAM;IACN;EAAA;;EAGF;EACA,MAAMG,UAAU,GAAGR,WAAW,CAACS,OAAO,CAAC,GAAG,CAAC;EAC3C,IAAID,UAAU,GAAG,CAAC,IAAIA,UAAU,GAAG,EAAE,EAAE;IACrC;IACA,MAAME,aAAa,GAAGV,WAAW,CAACW,SAAS,CAAC,CAAC,EAAEH,UAAU,CAAC,CAACI,IAAI,CAAC,CAAC;IACjE;IACA,IAAIF,aAAa,CAACG,UAAU,CAAC,IAAI,CAAC,IAAI,WAAW,CAACC,IAAI,CAACJ,aAAa,CAAC,EAAE;MACrE,OAAO;QACLP,IAAI,EAAEO,aAAa;QACnBR,OAAO,EAAEF,WAAW,CAACW,SAAS,CAACH,UAAU,GAAG,CAAC,CAAC,CAACI,IAAI,CAAC;MACtD,CAAC;IACH;EACF;;EAEA;EACA,OAAO;IACLT,IAAI,EAAEL,SAAS,CAACM,SAAS;IACzBF,OAAO,EAAEF;EACX,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASe,oBAAoBA,CAClCC,KAA0C,EACjC;EACT,MAAMC,QAAQ,GACZ,OAAOD,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAI,MAAM,IAAIA,KAAK,GACzDA,KAAK,GACNjB,yBAAyB,CAACiB,KAAK,CAAC;EAEtC,OACEC,QAAQ,CAACd,IAAI,KAAKL,SAAS,CAACoB,gBAAgB,IAC5CD,QAAQ,CAACd,IAAI,KAAK,iBAAiB;EAAI;EACvCc,QAAQ,CAACE,YAAY,KAAK,CAAC,CAC3B,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["ErrorCode","parseErrorStringToJsonObj","errorString","Error","message","code","E_UNKNOWN","parsed","JSON","parse","colonIndex","indexOf","potentialCode","substring","trim","startsWith","test","isUserCancelledError","error","errorObj","E_USER_CANCELLED","responseCode"],"sourceRoot":"../../../src","sources":["utils/error.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,SAAS,QAAQ,aAAU;AAWpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACvCC,WAAqC,EAC3B;EACV;EACA,IAAIA,WAAW,YAAYC,KAAK,EAAE;IAChCD,WAAW,GAAGA,WAAW,CAACE,OAAO;EACnC;;EAEA;EACA,IAAI,OAAOF,WAAW,KAAK,QAAQ,EAAE;IACnC,OAAO;MACLG,IAAI,EAAEL,SAAS,CAACM,SAAS;MACzBF,OAAO,EAA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AQ,CAACd,IAAI,KAAK,iBAAiB;EAAI;EACvCc,QAAQ,CAACE,YAAY,KAAK,CAAC,CAC5B,CAAC;AACJ","ignoreList":[]}
@@ -2,10 +2,10 @@
2
2
 
3
3
  /**
4
4
  * Type Bridge Utilities
5
- *
5
+ *
6
6
  * This file provides conversion utilities between Nitro types (simple primitives)
7
7
  * and TypeScript union types (complex types.ts definitions).
8
- *
8
+ *
9
9
  * Purpose: Prevent type fragmentation between native (Nitro) and TypeScript sides
10
10
  */
11
11
 
@@ -92,7 +92,7 @@ export function convertProductToSubscriptionProduct(product) {
92
92
  }
93
93
 
94
94
  // ============================================================================
95
- // PURCHASE CONVERSION
95
+ // PURCHASE CONVERSION
96
96
  // ============================================================================
97
97
 
98
98
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","convertNitroProductToProduct","nitroProduct","product","id","title","description","type","displayName","displayPrice","currency","price","platform","OS","iosProduct","isFamilyShareable","jsonRepresentation","subscriptionPeriodUnitIOS","subscriptionPeriodNumberIOS","introductoryPriceIOS","introductoryPriceAsAmountIOS","introductoryPricePaymentModeIOS","introductoryPriceNumberOfPeriodsIOS","introductoryPriceSubscriptionPeriodIOS","androidProduct","originalPrice","originalPriceAmountMicros","introductoryPriceValue","introductoryPriceCycles","introductoryPricePeriod","subscriptionPeriod","freeTrialPeriod","subscriptionOfferDetailsAndroid","JSON","parse","e","console","warn","oneTimePurchaseOfferFormattedPrice","oneTimePurchaseOfferPriceAmountMicros","oneTimePurchaseOfferPriceCurrencyCode","convertProductToSubscriptionProduct","convertNitroPurchaseToPurchase","nitroPurchase","purchase","productId","transactionDate","transactionReceipt","purchaseToken","iosPurchase","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","appAccountToken","androidPurchase","purchaseTokenAndroid","dataAndroid","signatureAndroid","autoRenewingAndroid","purchaseStateAndroid","isAcknowledgedAndroid","packageNameAndroid","obfuscatedAccountIdAndroid","obfuscatedProfileIdAndroid","validateNitroProduct","required","field","error","validateNitroPurchase","checkTypeSynchronization","issues","testNitroProduct","converted","push","isSync","length"],"sourceRoot":"../../../src","sources":["utils/type-bridge.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAAQA,QAAQ,QAAO,cAAc;;AAErC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAACC,YAA0B,EAAW;EAChF;EACA,MAAMC,OAAY,GAAG;IACnBC,EAAE,EAAEF,YAAY,CAACE,EAAE;IACnBC,KAAK,EAAEH,YAAY,CAACG,KAAK;IACzBC,WAAW,EAAEJ,YAAY,CAACI,WAAW;IACrCC,IAAI,EAAEL,YAAY,CAACK,IAAwB;IAC3CC,WAAW,EAAEN,YAAY,CAACM,WAAW;IACrCC,YAAY,EAAEP,YAAY,CAACO,YAAY,IAAI,EAAE;IAC7CC,QAAQ,EAAER,YAAY,CAACQ,QAAQ,IAAI,EAAE;IACrCC,KAAK,EAAET,YAAY,CAACS,KAAK;IACzBC,QAAQ,EAAEV,YAAY,CAACU;EACzB,CAAC;;EAED;EACA,IAAIZ,QAAQ,CAACa,EAAE,KAAK,KAAK,EAAE;IACzB;IACA,MAAMC,UAAU,GAAGX,OAAc,CAAC,CAAC;IACnCW,UAAU,CAACC,iBAAiB,GAAGb,YAAY,CAACa,iBAAiB;IAC7DD,UAAU,CAACE,kBAAkB,GAAGd,YAAY,CAACc,kBAAkB;IAC/DF,UAAU,CAACG,yBAAyB,GAAGf,YAAY,CAACe,yBAAyB;IAC7EH,UAAU,CAACI,2BAA2B,GAAGhB,YAAY,CAACgB,2BAA2B;IACjFJ,UAAU,CAACK,oBAAoB,GAAGjB,YAAY,CAACiB,oBAAoB;IACnEL,UAAU,CAACM,4BAA4B,GAAGlB,YAAY,CAACkB,4BAA4B;IACnFN,UAAU,CAACO,+BAA+B,GAAGnB,YAAY,CAACmB,+BAA+B;IACzFP,UAAU,CAACQ,mCAAmC,GAAGpB,YAAY,CAACoB,mCAAm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MACrCnE,EAAE,EAAE,MAAM;MACVC,KAAK,EAAE,MAAM;MACbC,WAAW,EAAE,MAAM;MACnBC,IAAI,EAAE,OAAO;MACbK,QAAQ,EAAE,KAAK;MACfH,YAAY,EAAE,OAAO;MACrBC,QAAQ,EAAE;IACZ,CAAC;IAED,MAAM8D,SAAS,GAAGvE,4BAA4B,CAACsE,gBAAgB,CAAC;IAEhE,IAAI,CAACC,SAAS,CAACpE,EAAE,IAAI,CAACoE,SAAS,CAACnE,KAAK,EAAE;MACrCiE,MAAM,CAACG,IAAI,CAAC,wBAAwB,CAAC;IACvC;EACF,CAAC,CAAC,OAAON,KAAK,EAAE;IACdG,MAAM,CAACG,IAAI,CAAC,0BAA0BN,KAAK,EAAE,CAAC;EAChD;EAEA,OAAO;IACLO,MAAM,EAAEJ,MAAM,CAACK,MAAM,KAAK,CAAC;IAC3BL;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["Platform","convertNitroProductToProduct","nitroProduct","product","id","title","description","type","displayName","displayPrice","currency","price","platform","OS","iosProduct","isFamilyShareable","jsonRepresentation","subscriptionPeriodUnitIOS","subscriptionPeriodNumberIOS","introductoryPriceIOS","introductoryPriceAsAmountIOS","introductoryPricePaymentModeIOS","introductoryPriceNumberOfPeriodsIOS","introductoryPriceSubscriptionPeriodIOS","androidProduct","originalPrice","originalPriceAmountMicros","introductoryPriceValue","introductoryPriceCycles","introductoryPricePeriod","subscriptionPeriod","freeTrialPeriod","subscriptionOfferDetailsAndroid","JSON","parse","e","console","warn","oneTimePurchaseOfferFormattedPrice","oneTimePurchaseOfferPriceAmountMicros","oneTimePurchaseOfferPriceCurrencyCode","convertProductToSubscriptionProduct","convertNitroPurchaseToPurchase","nitroPurchase","purchase","productId","transactionDate","transactionReceipt","purchaseToken","iosPurchase","quantityIOS","originalTransactionDateIOS","originalTransactionIdentifierIOS","appAccountToken","androidPurchase","purchaseTokenAndroid","dataAndroid","signatureAndroid","autoRenewingAndroid","purchaseStateAndroid","isAcknowledgedAndroid","packageNameAndroid","obfuscatedAccountIdAndroid","obfuscatedProfileIdAndroid","validateNitroProduct","required","field","error","validateNitroPurchase","checkTypeSynchronization","issues","testNitroProduct","converted","push","isSync","length"],"sourceRoot":"../../../src","sources":["utils/type-bridge.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAC1CC,YAA0B,EACjB;EACT;EACA,MAAMC,OAAY,GAAG;IACnBC,EAAE,EAAEF,YAAY,CAACE,EAAE;IACnBC,KAAK,EAAEH,YAAY,CAACG,KAAK;IACzBC,WAAW,EAAEJ,YAAY,CAACI,WAAW;IACrCC,IAAI,EAAEL,YAAY,CAACK,IAAwB;IAC3CC,WAAW,EAAEN,YAAY,CAACM,WAAW;IACrCC,YAAY,EAAEP,YAAY,CAACO,YAAY,IAAI,EAAE;IAC7CC,QAAQ,EAAER,YAAY,CAACQ,QAAQ,IAAI,EAAE;IACrCC,KAAK,EAAET,YAAY,CAACS,KAAK;IACzBC,QAAQ,EAAEV,YAAY,CAACU;EACzB,CAAC;;EAED;EACA,IAAIZ,QAAQ,CAACa,EAAE,KAAK,KAAK,EAAE;IACzB;IACA,MAAMC,UAAU,GAAGX,OAAc,EAAC;IAClCW,UAAU,CAACC,iBAAiB,GAAGb,YAAY,CAACa,iBAAiB;IAC7DD,UAAU,CAACE,kBAAkB,GAAGd,YAAY,CAACc,kBAAkB;IAC/DF,UAAU,CAACG,yBAAyB,GAClCf,YAAY,CAACe,yBAAyB;IACxCH,UAAU,CAACI,2BAA2B,GACpChB,YAAY,CAACgB,2BAA2B;IAC1CJ,UAAU,CAACK,oBAAoB,GAAGjB,YAAY,CAACiB,oBAAoB;IACnEL,UAAU,CAACM,4BAA4B,GACrClB,YAAY,CAACkB,4BAA4B;IAC3CN,UAAU,CAACO,+BAA+B,GACxCnB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B,GAAG,EAAE;EAE3B,IAAI;IACF;IACA,MAAMC,gBAA8B,GAAG;MACrCnE,EAAE,EAAE,MAAM;MACVC,KAAK,EAAE,MAAM;MACbC,WAAW,EAAE,MAAM;MACnBC,IAAI,EAAE,OAAO;MACbK,QAAQ,EAAE,KAAK;MACfH,YAAY,EAAE,OAAO;MACrBC,QAAQ,EAAE;IACZ,CAAC;IAED,MAAM8D,SAAS,GAAGvE,4BAA4B,CAACsE,gBAAgB,CAAC;IAEhE,IAAI,CAACC,SAAS,CAACpE,EAAE,IAAI,CAACoE,SAAS,CAACnE,KAAK,EAAE;MACrCiE,MAAM,CAACG,IAAI,CAAC,wBAAwB,CAAC;IACvC;EACF,CAAC,CAAC,OAAON,KAAK,EAAE;IACdG,MAAM,CAACG,IAAI,CAAC,0BAA0BN,KAAK,EAAE,CAAC;EAChD;EAEA,OAAO;IACLO,MAAM,EAAEJ,MAAM,CAACK,MAAM,KAAK,CAAC;IAC3BL;EACF,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;;AAgHtD,wBAAmE"}
1
+ {"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;;AAgHvD,wBAAkE"}
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../../src/helpers/subscription.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,kBAAkB,EAAE,CAiC9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,OAAO,CAQjB,CAAC"}
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../../../src/helpers/subscription.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgC,MAAM,UAAU,CAAA;AAEhF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,kBAAkB,EAAE,CAwC9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,OAAO,CAQjB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/utils/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GACpC,QAAQ,CAgDV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GACzC,OAAO,CAWT"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/utils/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GACpC,QAAQ,CAgDV;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GACzC,OAAO,CAWT"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../../../src/utils/type-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAOrE;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAuDhF;AAID;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,CASzF;AAMD;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,aAAa,GAAG,QAAQ,CAgCrF;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CASxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAS3E;AAMD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA4BA"}
1
+ {"version":3,"file":"type-bridge.d.ts","sourceRoot":"","sources":["../../../../src/utils/type-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAOtE;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,YAAY,GACzB,OAAO,CAoET;AAID;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,OAAO,GACf,mBAAmB,CAYrB;AAMD;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,aAAa,GAC3B,QAAQ,CAoCV;AAQD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAexE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAe3E;AAMD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI;IAC1C,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CA4BA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "14.0.0-rc.1",
3
+ "version": "14.0.0",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -38,7 +38,6 @@
38
38
  "!**/.*"
39
39
  ],
40
40
  "scripts": {
41
- "postinstall": "yarn prepare && yarn build:plugin",
42
41
  "build:plugin": "tsc --build plugin",
43
42
  "setup:expo": "cd example-expo && bun setup",
44
43
  "example": "yarn workspace rn-iap-example",
@@ -3,117 +3,117 @@ import {
3
3
  WarningAggregator,
4
4
  withAndroidManifest,
5
5
  withAppBuildGradle,
6
- } from 'expo/config-plugins';
7
- import type {ConfigPlugin} from 'expo/config-plugins';
6
+ } from 'expo/config-plugins'
7
+ import type { ConfigPlugin } from 'expo/config-plugins'
8
8
 
9
- const pkg = require('../../package.json');
9
+ const pkg = require('../../package.json')
10
10
 
11
11
  // Global flag to prevent duplicate logs
12
- let hasLoggedPluginExecution = false;
12
+ let hasLoggedPluginExecution = false
13
13
 
14
14
  const addLineToGradle = (
15
15
  content: string,
16
16
  anchor: RegExp | string,
17
17
  lineToAdd: string,
18
- offset: number = 1,
18
+ offset: number = 1
19
19
  ): string => {
20
- const lines = content.split('\n');
21
- const index = lines.findIndex((line) => line.match(anchor));
20
+ const lines = content.split('\n')
21
+ const index = lines.findIndex((line) => line.match(anchor))
22
22
  if (index === -1) {
23
23
  console.warn(
24
- `Anchor "${anchor}" not found in build.gradle. Appending to end.`,
25
- );
26
- lines.push(lineToAdd);
24
+ `Anchor "${anchor}" not found in build.gradle. Appending to end.`
25
+ )
26
+ lines.push(lineToAdd)
27
27
  } else {
28
- lines.splice(index + offset, 0, lineToAdd);
28
+ lines.splice(index + offset, 0, lineToAdd)
29
29
  }
30
- return lines.join('\n');
31
- };
30
+ return lines.join('\n')
31
+ }
32
32
 
33
33
  const modifyAppBuildGradle = (gradle: string): string => {
34
- let modified = gradle;
34
+ let modified = gradle
35
35
 
36
36
  // Add billing library dependencies to app-level build.gradle
37
- const billingDep = ` implementation "com.android.billingclient:billing-ktx:8.0.0"`;
38
- const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
37
+ const billingDep = ` implementation "com.android.billingclient:billing-ktx:8.0.0"`
38
+ const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`
39
39
 
40
- let hasAddedDependency = false;
40
+ let hasAddedDependency = false
41
41
 
42
42
  if (!modified.includes(billingDep)) {
43
- modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
44
- hasAddedDependency = true;
43
+ modified = addLineToGradle(modified, /dependencies\s*{/, billingDep)
44
+ hasAddedDependency = true
45
45
  }
46
46
  if (!modified.includes(gmsDep)) {
47
- modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
48
- hasAddedDependency = true;
47
+ modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1)
48
+ hasAddedDependency = true
49
49
  }
50
50
 
51
51
  // Log only once and only if we actually added dependencies
52
52
  if (hasAddedDependency && !hasLoggedPluginExecution) {
53
53
  console.log(
54
- 'đŸ› ī¸ react-native-iap: Added billing dependencies to build.gradle',
55
- );
54
+ 'đŸ› ī¸ react-native-iap: Added billing dependencies to build.gradle'
55
+ )
56
56
  }
57
57
 
58
- return modified;
59
- };
58
+ return modified
59
+ }
60
60
 
61
61
  const withIapAndroid: ConfigPlugin = (config) => {
62
62
  // Add IAP dependencies to app build.gradle
63
63
  config = withAppBuildGradle(config, (config) => {
64
64
  config.modResults.contents = modifyAppBuildGradle(
65
- config.modResults.contents,
66
- );
67
- return config;
68
- });
65
+ config.modResults.contents
66
+ )
67
+ return config
68
+ })
69
69
 
70
70
  config = withAndroidManifest(config, (config) => {
71
- const manifest = config.modResults;
71
+ const manifest = config.modResults
72
72
  if (!manifest.manifest['uses-permission']) {
73
- manifest.manifest['uses-permission'] = [];
73
+ manifest.manifest['uses-permission'] = []
74
74
  }
75
75
 
76
- const permissions = manifest.manifest['uses-permission'];
77
- const billingPerm = {$: {'android:name': 'com.android.vending.BILLING'}};
76
+ const permissions = manifest.manifest['uses-permission']
77
+ const billingPerm = { $: { 'android:name': 'com.android.vending.BILLING' } }
78
78
 
79
79
  const alreadyExists = permissions.some(
80
- (p) => p.$['android:name'] === 'com.android.vending.BILLING',
81
- );
80
+ (p) => p.$['android:name'] === 'com.android.vending.BILLING'
81
+ )
82
82
  if (!alreadyExists) {
83
- permissions.push(billingPerm);
83
+ permissions.push(billingPerm)
84
84
  if (!hasLoggedPluginExecution) {
85
85
  console.log(
86
- '✅ Added com.android.vending.BILLING to AndroidManifest.xml',
87
- );
86
+ '✅ Added com.android.vending.BILLING to AndroidManifest.xml'
87
+ )
88
88
  }
89
89
  } else {
90
90
  if (!hasLoggedPluginExecution) {
91
91
  console.log(
92
- 'â„šī¸ com.android.vending.BILLING already exists in AndroidManifest.xml',
93
- );
92
+ 'â„šī¸ com.android.vending.BILLING already exists in AndroidManifest.xml'
93
+ )
94
94
  }
95
95
  }
96
96
 
97
- return config;
98
- });
97
+ return config
98
+ })
99
99
 
100
- return config;
101
- };
100
+ return config
101
+ }
102
102
 
103
103
  const withIAP: ConfigPlugin = (config, _props) => {
104
104
  try {
105
- const result = withIapAndroid(config);
105
+ const result = withIapAndroid(config)
106
106
  // Set flag after first execution to prevent duplicate logs
107
- hasLoggedPluginExecution = true;
108
- return result;
107
+ hasLoggedPluginExecution = true
108
+ return result
109
109
  } catch (error) {
110
110
  WarningAggregator.addWarningAndroid(
111
111
  'react-native-iap',
112
- `react-native-iap plugin encountered an error: ${error}`,
113
- );
114
- console.error('react-native-iap plugin error:', error);
115
- return config;
112
+ `react-native-iap plugin encountered an error: ${error}`
113
+ )
114
+ console.error('react-native-iap plugin error:', error)
115
+ return config
116
116
  }
117
- };
117
+ }
118
118
 
119
- export default createRunOncePlugin(withIAP, pkg.name, pkg.version);
119
+ export default createRunOncePlugin(withIAP, pkg.name, pkg.version)
@@ -1 +1 @@
1
- {"root":["./src/withiap.ts"],"version":"5.9.2"}
1
+ {"root":["./src/withIAP.ts"],"version":"5.9.2"}
@@ -1,9 +1,5 @@
1
- import {getAvailablePurchases} from '../';
2
- import type {
3
- ActiveSubscription,
4
- PurchaseIOS,
5
- PurchaseAndroid,
6
- } from '../types';
1
+ import { getAvailablePurchases } from '../'
2
+ import type { ActiveSubscription, PurchaseIOS, PurchaseAndroid } from '../types'
7
3
 
8
4
  /**
9
5
  * Get active subscriptions
@@ -11,41 +7,48 @@ import type {
11
7
  * @returns Promise<ActiveSubscription[]> - Array of active subscriptions
12
8
  */
13
9
  export const getActiveSubscriptions = async (
14
- subscriptionIds?: string[],
10
+ subscriptionIds?: string[]
15
11
  ): Promise<ActiveSubscription[]> => {
16
12
  try {
17
13
  // Get available purchases and filter for subscriptions
18
- const purchases = await getAvailablePurchases();
19
-
14
+ const purchases = await getAvailablePurchases()
15
+
20
16
  // Filter for subscriptions and map to ActiveSubscription format
21
17
  const subscriptions = purchases
22
18
  .filter((purchase) => {
23
19
  // Filter by subscription IDs if provided
24
20
  if (subscriptionIds && subscriptionIds.length > 0) {
25
- return subscriptionIds.includes(purchase.productId);
21
+ return subscriptionIds.includes(purchase.productId)
26
22
  }
27
- return true;
23
+ return true
28
24
  })
29
25
  .map((purchase): ActiveSubscription => {
30
- const iosPurchase = purchase as PurchaseIOS;
26
+ const iosPurchase = purchase as PurchaseIOS
31
27
  return {
32
28
  productId: purchase.productId,
33
29
  isActive: true, // If it's in availablePurchases, it's active
34
- expirationDateIOS: iosPurchase.expirationDateIOS ? new Date(iosPurchase.expirationDateIOS) : undefined,
35
- autoRenewingAndroid: (purchase as PurchaseAndroid).autoRenewingAndroid,
30
+ expirationDateIOS: iosPurchase.expirationDateIOS
31
+ ? new Date(iosPurchase.expirationDateIOS)
32
+ : undefined,
33
+ autoRenewingAndroid: (purchase as PurchaseAndroid)
34
+ .autoRenewingAndroid,
36
35
  environmentIOS: iosPurchase.environmentIOS,
37
36
  willExpireSoon: false, // Would need to calculate based on expiration date
38
- daysUntilExpirationIOS: iosPurchase.expirationDateIOS ?
39
- Math.ceil((iosPurchase.expirationDateIOS - Date.now()) / (1000 * 60 * 60 * 24)) : undefined,
40
- };
41
- });
42
-
43
- return subscriptions;
37
+ daysUntilExpirationIOS: iosPurchase.expirationDateIOS
38
+ ? Math.ceil(
39
+ (iosPurchase.expirationDateIOS - Date.now()) /
40
+ (1000 * 60 * 60 * 24)
41
+ )
42
+ : undefined,
43
+ }
44
+ })
45
+
46
+ return subscriptions
44
47
  } catch (error) {
45
- console.error('Failed to get active subscriptions:', error);
46
- throw error;
48
+ console.error('Failed to get active subscriptions:', error)
49
+ throw error
47
50
  }
48
- };
51
+ }
49
52
 
50
53
  /**
51
54
  * Check if there are any active subscriptions
@@ -53,13 +56,13 @@ export const getActiveSubscriptions = async (
53
56
  * @returns Promise<boolean> - True if there are active subscriptions
54
57
  */
55
58
  export const hasActiveSubscriptions = async (
56
- subscriptionIds?: string[],
59
+ subscriptionIds?: string[]
57
60
  ): Promise<boolean> => {
58
61
  try {
59
- const activeSubscriptions = await getActiveSubscriptions(subscriptionIds);
60
- return activeSubscriptions.length > 0;
62
+ const activeSubscriptions = await getActiveSubscriptions(subscriptionIds)
63
+ return activeSubscriptions.length > 0
61
64
  } catch (error) {
62
- console.error('Failed to check active subscriptions:', error);
63
- return false;
65
+ console.error('Failed to check active subscriptions:', error)
66
+ return false
64
67
  }
65
- };
68
+ }
@@ -2,15 +2,15 @@
2
2
  * Error utilities for parsing platform-specific error responses
3
3
  */
4
4
 
5
- import {ErrorCode} from '../types';
5
+ import { ErrorCode } from '../types'
6
6
 
7
7
  export interface IapError {
8
- code: string;
9
- message: string;
10
- responseCode?: number;
11
- debugMessage?: string;
12
- productId?: string;
13
- [key: string]: any; // Allow additional platform-specific fields
8
+ code: string
9
+ message: string
10
+ responseCode?: number
11
+ debugMessage?: string
12
+ productId?: string
13
+ [key: string]: any // Allow additional platform-specific fields
14
14
  }
15
15
 
16
16
  /**
@@ -25,11 +25,11 @@ export interface IapError {
25
25
  * @returns Parsed error object with code and message
26
26
  */
27
27
  export function parseErrorStringToJsonObj(
28
- errorString: string | Error | unknown,
28
+ errorString: string | Error | unknown
29
29
  ): IapError {
30
30
  // Handle Error objects
31
31
  if (errorString instanceof Error) {
32
- errorString = errorString.message;
32
+ errorString = errorString.message
33
33
  }
34
34
 
35
35
  // Handle non-string inputs
@@ -37,35 +37,35 @@ export function parseErrorStringToJsonObj(
37
37
  return {
38
38
  code: ErrorCode.E_UNKNOWN,
39
39
  message: 'Unknown error occurred',
40
- };
40
+ }
41
41
  }
42
42
 
43
43
  // Try to parse as JSON first
44
44
  try {
45
- const parsed = JSON.parse(errorString);
45
+ const parsed = JSON.parse(errorString)
46
46
  if (typeof parsed === 'object' && parsed !== null) {
47
47
  // Ensure it has at least code and message
48
48
  return {
49
49
  code: parsed.code || ErrorCode.E_UNKNOWN,
50
50
  message: parsed.message || errorString,
51
51
  ...parsed,
52
- };
52
+ }
53
53
  }
54
54
  } catch {
55
55
  // Not JSON, continue with other formats
56
56
  }
57
57
 
58
58
  // Try to parse "CODE: message" format
59
- const colonIndex = errorString.indexOf(':');
59
+ const colonIndex = errorString.indexOf(':')
60
60
  if (colonIndex > 0 && colonIndex < 50) {
61
61
  // Reasonable position for error code
62
- const potentialCode = errorString.substring(0, colonIndex).trim();
62
+ const potentialCode = errorString.substring(0, colonIndex).trim()
63
63
  // Check if it looks like an error code (starts with E_ or contains uppercase)
64
64
  if (potentialCode.startsWith('E_') || /^[A-Z_]+$/.test(potentialCode)) {
65
65
  return {
66
66
  code: potentialCode,
67
67
  message: errorString.substring(colonIndex + 1).trim(),
68
- };
68
+ }
69
69
  }
70
70
  }
71
71
 
@@ -73,7 +73,7 @@ export function parseErrorStringToJsonObj(
73
73
  return {
74
74
  code: ErrorCode.E_UNKNOWN,
75
75
  message: errorString,
76
- };
76
+ }
77
77
  }
78
78
 
79
79
  /**
@@ -82,16 +82,16 @@ export function parseErrorStringToJsonObj(
82
82
  * @returns true if the error is a user cancellation
83
83
  */
84
84
  export function isUserCancelledError(
85
- error: IapError | string | Error | unknown,
85
+ error: IapError | string | Error | unknown
86
86
  ): boolean {
87
87
  const errorObj =
88
88
  typeof error === 'object' && error !== null && 'code' in error
89
89
  ? (error as IapError)
90
- : parseErrorStringToJsonObj(error);
90
+ : parseErrorStringToJsonObj(error)
91
91
 
92
92
  return (
93
93
  errorObj.code === ErrorCode.E_USER_CANCELLED ||
94
94
  errorObj.code === 'E_USER_CANCELED' || // Alternative spelling
95
95
  errorObj.responseCode === 1
96
- ); // Android BillingClient.BillingResponseCode.USER_CANCELED
96
+ ) // Android BillingClient.BillingResponseCode.USER_CANCELED
97
97
  }
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * Type Bridge Utilities
3
- *
3
+ *
4
4
  * This file provides conversion utilities between Nitro types (simple primitives)
5
5
  * and TypeScript union types (complex types.ts definitions).
6
- *
6
+ *
7
7
  * Purpose: Prevent type fragmentation between native (Nitro) and TypeScript sides
8
8
  */
9
9
 
10
- import type {NitroProduct, NitroPurchase} from '../specs/RnIap.nitro';
11
- import type {Product, Purchase, SubscriptionProduct} from '../types';
12
- import {Platform} from 'react-native';
10
+ import type { NitroProduct, NitroPurchase } from '../specs/RnIap.nitro'
11
+ import type { Product, Purchase, SubscriptionProduct } from '../types'
12
+ import { Platform } from 'react-native'
13
13
 
14
14
  // ============================================================================
15
15
  // PRODUCT CONVERSION
@@ -19,7 +19,9 @@ import {Platform} from 'react-native';
19
19
  * Convert NitroProduct (from native) to TypeScript Product (for library consumers)
20
20
  * This ensures all fields are properly mapped and accessible
21
21
  */
22
- export function convertNitroProductToProduct(nitroProduct: NitroProduct): Product {
22
+ export function convertNitroProductToProduct(
23
+ nitroProduct: NitroProduct
24
+ ): Product {
23
25
  // Create base product with common fields, handling platform casting
24
26
  const product: any = {
25
27
  id: nitroProduct.id,
@@ -31,49 +33,62 @@ export function convertNitroProductToProduct(nitroProduct: NitroProduct): Produc
31
33
  currency: nitroProduct.currency || '',
32
34
  price: nitroProduct.price,
33
35
  platform: nitroProduct.platform as 'ios' | 'android',
34
- };
36
+ }
35
37
 
36
38
  // Add platform-specific fields based on current platform
37
39
  if (Platform.OS === 'ios') {
38
40
  // Map iOS fields from Nitro to TypeScript types
39
- const iosProduct = product as any; // Temporarily cast to access iOS fields
40
- iosProduct.isFamilyShareable = nitroProduct.isFamilyShareable;
41
- iosProduct.jsonRepresentation = nitroProduct.jsonRepresentation;
42
- iosProduct.subscriptionPeriodUnitIOS = nitroProduct.subscriptionPeriodUnitIOS;
43
- iosProduct.subscriptionPeriodNumberIOS = nitroProduct.subscriptionPeriodNumberIOS;
44
- iosProduct.introductoryPriceIOS = nitroProduct.introductoryPriceIOS;
45
- iosProduct.introductoryPriceAsAmountIOS = nitroProduct.introductoryPriceAsAmountIOS;
46
- iosProduct.introductoryPricePaymentModeIOS = nitroProduct.introductoryPricePaymentModeIOS;
47
- iosProduct.introductoryPriceNumberOfPeriodsIOS = nitroProduct.introductoryPriceNumberOfPeriodsIOS;
48
- iosProduct.introductoryPriceSubscriptionPeriodIOS = nitroProduct.introductoryPriceSubscriptionPeriodIOS;
41
+ const iosProduct = product as any // Temporarily cast to access iOS fields
42
+ iosProduct.isFamilyShareable = nitroProduct.isFamilyShareable
43
+ iosProduct.jsonRepresentation = nitroProduct.jsonRepresentation
44
+ iosProduct.subscriptionPeriodUnitIOS =
45
+ nitroProduct.subscriptionPeriodUnitIOS
46
+ iosProduct.subscriptionPeriodNumberIOS =
47
+ nitroProduct.subscriptionPeriodNumberIOS
48
+ iosProduct.introductoryPriceIOS = nitroProduct.introductoryPriceIOS
49
+ iosProduct.introductoryPriceAsAmountIOS =
50
+ nitroProduct.introductoryPriceAsAmountIOS
51
+ iosProduct.introductoryPricePaymentModeIOS =
52
+ nitroProduct.introductoryPricePaymentModeIOS
53
+ iosProduct.introductoryPriceNumberOfPeriodsIOS =
54
+ nitroProduct.introductoryPriceNumberOfPeriodsIOS
55
+ iosProduct.introductoryPriceSubscriptionPeriodIOS =
56
+ nitroProduct.introductoryPriceSubscriptionPeriodIOS
49
57
  } else if (Platform.OS === 'android') {
50
58
  // Map Android fields from Nitro to TypeScript types
51
- const androidProduct = product as any; // Temporarily cast to access Android fields
52
- androidProduct.originalPrice = nitroProduct.originalPrice;
53
- androidProduct.originalPriceAmountMicros = nitroProduct.originalPriceAmountMicros;
54
- androidProduct.introductoryPriceValue = nitroProduct.introductoryPriceValue;
55
- androidProduct.introductoryPriceCycles = nitroProduct.introductoryPriceCycles;
56
- androidProduct.introductoryPricePeriod = nitroProduct.introductoryPricePeriod;
57
- androidProduct.subscriptionPeriod = nitroProduct.subscriptionPeriod;
58
- androidProduct.freeTrialPeriod = nitroProduct.freeTrialPeriod;
59
-
59
+ const androidProduct = product as any // Temporarily cast to access Android fields
60
+ androidProduct.originalPrice = nitroProduct.originalPrice
61
+ androidProduct.originalPriceAmountMicros =
62
+ nitroProduct.originalPriceAmountMicros
63
+ androidProduct.introductoryPriceValue = nitroProduct.introductoryPriceValue
64
+ androidProduct.introductoryPriceCycles =
65
+ nitroProduct.introductoryPriceCycles
66
+ androidProduct.introductoryPricePeriod =
67
+ nitroProduct.introductoryPricePeriod
68
+ androidProduct.subscriptionPeriod = nitroProduct.subscriptionPeriod
69
+ androidProduct.freeTrialPeriod = nitroProduct.freeTrialPeriod
70
+
60
71
  // Map subscription offer details (parse from JSON string)
61
72
  if (nitroProduct.subscriptionOfferDetailsAndroid) {
62
73
  try {
63
- androidProduct.subscriptionOfferDetailsAndroid = JSON.parse(nitroProduct.subscriptionOfferDetailsAndroid);
74
+ androidProduct.subscriptionOfferDetailsAndroid = JSON.parse(
75
+ nitroProduct.subscriptionOfferDetailsAndroid
76
+ )
64
77
  } catch (e) {
65
- console.warn('Failed to parse subscription offer details:', e);
66
- androidProduct.subscriptionOfferDetailsAndroid = null;
78
+ console.warn('Failed to parse subscription offer details:', e)
79
+ androidProduct.subscriptionOfferDetailsAndroid = null
67
80
  }
68
81
  }
69
-
82
+
70
83
  // Create flattened offer fields for easier access in example code
71
- androidProduct.oneTimePurchaseOfferFormattedPrice = nitroProduct.displayPrice;
72
- androidProduct.oneTimePurchaseOfferPriceAmountMicros = nitroProduct.originalPriceAmountMicros;
73
- androidProduct.oneTimePurchaseOfferPriceCurrencyCode = nitroProduct.currency;
84
+ androidProduct.oneTimePurchaseOfferFormattedPrice =
85
+ nitroProduct.displayPrice
86
+ androidProduct.oneTimePurchaseOfferPriceAmountMicros =
87
+ nitroProduct.originalPriceAmountMicros
88
+ androidProduct.oneTimePurchaseOfferPriceCurrencyCode = nitroProduct.currency
74
89
  }
75
90
 
76
- return product as Product;
91
+ return product as Product
77
92
  }
78
93
 
79
94
  // Note: Use nitroProducts.map(convertNitroProductToProduct) instead of a separate function
@@ -81,25 +96,32 @@ export function convertNitroProductToProduct(nitroProduct: NitroProduct): Produc
81
96
  /**
82
97
  * Convert Product to SubscriptionProduct (type-safe casting)
83
98
  */
84
- export function convertProductToSubscriptionProduct(product: Product): SubscriptionProduct {
99
+ export function convertProductToSubscriptionProduct(
100
+ product: Product
101
+ ): SubscriptionProduct {
85
102
  if (product.type !== 'subs') {
86
- console.warn('Converting non-subscription product to SubscriptionProduct:', product.id);
103
+ console.warn(
104
+ 'Converting non-subscription product to SubscriptionProduct:',
105
+ product.id
106
+ )
87
107
  }
88
108
  // Since SubscriptionProduct is now an intersection type, we need to cast properly
89
109
  return {
90
110
  ...product,
91
111
  type: 'subs' as const,
92
- } as SubscriptionProduct;
112
+ } as SubscriptionProduct
93
113
  }
94
114
 
95
115
  // ============================================================================
96
- // PURCHASE CONVERSION
116
+ // PURCHASE CONVERSION
97
117
  // ============================================================================
98
118
 
99
119
  /**
100
120
  * Convert NitroPurchase (from native) to TypeScript Purchase (for library consumers)
101
121
  */
102
- export function convertNitroPurchaseToPurchase(nitroPurchase: NitroPurchase): Purchase {
122
+ export function convertNitroPurchaseToPurchase(
123
+ nitroPurchase: NitroPurchase
124
+ ): Purchase {
103
125
  // Create base purchase with common fields
104
126
  const purchase: any = {
105
127
  id: nitroPurchase.id,
@@ -108,29 +130,33 @@ export function convertNitroPurchaseToPurchase(nitroPurchase: NitroPurchase): Pu
108
130
  transactionReceipt: '', // Will be set by native layer
109
131
  purchaseToken: nitroPurchase.purchaseToken,
110
132
  platform: nitroPurchase.platform as 'ios' | 'android',
111
- };
133
+ }
112
134
 
113
135
  // Add platform-specific fields
114
136
  if (Platform.OS === 'ios') {
115
- const iosPurchase = purchase as any;
116
- iosPurchase.quantityIOS = nitroPurchase.quantityIOS;
117
- iosPurchase.originalTransactionDateIOS = nitroPurchase.originalTransactionDateIOS;
118
- iosPurchase.originalTransactionIdentifierIOS = nitroPurchase.originalTransactionIdentifierIOS;
119
- iosPurchase.appAccountToken = nitroPurchase.appAccountToken;
137
+ const iosPurchase = purchase as any
138
+ iosPurchase.quantityIOS = nitroPurchase.quantityIOS
139
+ iosPurchase.originalTransactionDateIOS =
140
+ nitroPurchase.originalTransactionDateIOS
141
+ iosPurchase.originalTransactionIdentifierIOS =
142
+ nitroPurchase.originalTransactionIdentifierIOS
143
+ iosPurchase.appAccountToken = nitroPurchase.appAccountToken
120
144
  } else if (Platform.OS === 'android') {
121
- const androidPurchase = purchase as any;
122
- androidPurchase.purchaseTokenAndroid = nitroPurchase.purchaseTokenAndroid;
123
- androidPurchase.dataAndroid = nitroPurchase.dataAndroid;
124
- androidPurchase.signatureAndroid = nitroPurchase.signatureAndroid;
125
- androidPurchase.autoRenewingAndroid = nitroPurchase.autoRenewingAndroid;
126
- androidPurchase.purchaseStateAndroid = nitroPurchase.purchaseStateAndroid;
127
- androidPurchase.isAcknowledgedAndroid = nitroPurchase.isAcknowledgedAndroid;
128
- androidPurchase.packageNameAndroid = nitroPurchase.packageNameAndroid;
129
- androidPurchase.obfuscatedAccountIdAndroid = nitroPurchase.obfuscatedAccountIdAndroid;
130
- androidPurchase.obfuscatedProfileIdAndroid = nitroPurchase.obfuscatedProfileIdAndroid;
145
+ const androidPurchase = purchase as any
146
+ androidPurchase.purchaseTokenAndroid = nitroPurchase.purchaseTokenAndroid
147
+ androidPurchase.dataAndroid = nitroPurchase.dataAndroid
148
+ androidPurchase.signatureAndroid = nitroPurchase.signatureAndroid
149
+ androidPurchase.autoRenewingAndroid = nitroPurchase.autoRenewingAndroid
150
+ androidPurchase.purchaseStateAndroid = nitroPurchase.purchaseStateAndroid
151
+ androidPurchase.isAcknowledgedAndroid = nitroPurchase.isAcknowledgedAndroid
152
+ androidPurchase.packageNameAndroid = nitroPurchase.packageNameAndroid
153
+ androidPurchase.obfuscatedAccountIdAndroid =
154
+ nitroPurchase.obfuscatedAccountIdAndroid
155
+ androidPurchase.obfuscatedProfileIdAndroid =
156
+ nitroPurchase.obfuscatedProfileIdAndroid
131
157
  }
132
158
 
133
- return purchase as Purchase;
159
+ return purchase as Purchase
134
160
  }
135
161
 
136
162
  // Note: Use nitroPurchases.map(convertNitroPurchaseToPurchase) instead of a separate function
@@ -143,28 +169,40 @@ export function convertNitroPurchaseToPurchase(nitroPurchase: NitroPurchase): Pu
143
169
  * Validate that a NitroProduct has all required fields for conversion
144
170
  */
145
171
  export function validateNitroProduct(nitroProduct: NitroProduct): boolean {
146
- const required = ['id', 'title', 'description', 'type', 'platform'];
172
+ const required = ['id', 'title', 'description', 'type', 'platform']
147
173
  for (const field of required) {
148
- if (!(field in nitroProduct) || nitroProduct[field as keyof NitroProduct] == null) {
149
- console.error(`NitroProduct missing required field: ${field}`, nitroProduct);
150
- return false;
174
+ if (
175
+ !(field in nitroProduct) ||
176
+ nitroProduct[field as keyof NitroProduct] == null
177
+ ) {
178
+ console.error(
179
+ `NitroProduct missing required field: ${field}`,
180
+ nitroProduct
181
+ )
182
+ return false
151
183
  }
152
184
  }
153
- return true;
185
+ return true
154
186
  }
155
187
 
156
188
  /**
157
189
  * Validate that a NitroPurchase has all required fields for conversion
158
190
  */
159
191
  export function validateNitroPurchase(nitroPurchase: NitroPurchase): boolean {
160
- const required = ['id', 'productId', 'transactionDate', 'platform'];
192
+ const required = ['id', 'productId', 'transactionDate', 'platform']
161
193
  for (const field of required) {
162
- if (!(field in nitroPurchase) || nitroPurchase[field as keyof NitroPurchase] == null) {
163
- console.error(`NitroPurchase missing required field: ${field}`, nitroPurchase);
164
- return false;
194
+ if (
195
+ !(field in nitroPurchase) ||
196
+ nitroPurchase[field as keyof NitroPurchase] == null
197
+ ) {
198
+ console.error(
199
+ `NitroPurchase missing required field: ${field}`,
200
+ nitroPurchase
201
+ )
202
+ return false
165
203
  }
166
204
  }
167
- return true;
205
+ return true
168
206
  }
169
207
 
170
208
  // ============================================================================
@@ -176,10 +214,10 @@ export function validateNitroPurchase(nitroPurchase: NitroPurchase): boolean {
176
214
  * This function can be run in development to detect type mismatches
177
215
  */
178
216
  export function checkTypeSynchronization(): {
179
- isSync: boolean;
180
- issues: string[];
217
+ isSync: boolean
218
+ issues: string[]
181
219
  } {
182
- const issues: string[] = [];
220
+ const issues: string[] = []
183
221
 
184
222
  try {
185
223
  // Simple test: can we convert between types?
@@ -191,19 +229,19 @@ export function checkTypeSynchronization(): {
191
229
  platform: 'ios',
192
230
  displayPrice: '$1.00',
193
231
  currency: 'USD',
194
- };
232
+ }
233
+
234
+ const converted = convertNitroProductToProduct(testNitroProduct)
195
235
 
196
- const converted = convertNitroProductToProduct(testNitroProduct);
197
-
198
236
  if (!converted.id || !converted.title) {
199
- issues.push('Type conversion failed');
237
+ issues.push('Type conversion failed')
200
238
  }
201
239
  } catch (error) {
202
- issues.push(`Type conversion error: ${error}`);
240
+ issues.push(`Type conversion error: ${error}`)
203
241
  }
204
242
 
205
243
  return {
206
244
  isSync: issues.length === 0,
207
245
  issues,
208
- };
209
- }
246
+ }
247
+ }
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,3 +0,0 @@
1
- import type { ConfigPlugin } from 'expo/config-plugins';
2
- declare const _default: ConfigPlugin<void>;
3
- export default _default;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_plugins_1 = require("expo/config-plugins");
4
- const pkg = require('../../package.json');
5
- // Global flag to prevent duplicate logs
6
- let hasLoggedPluginExecution = false;
7
- const addLineToGradle = (content, anchor, lineToAdd, offset = 1) => {
8
- const lines = content.split('\n');
9
- const index = lines.findIndex((line) => line.match(anchor));
10
- if (index === -1) {
11
- console.warn(`Anchor "${anchor}" not found in build.gradle. Appending to end.`);
12
- lines.push(lineToAdd);
13
- }
14
- else {
15
- lines.splice(index + offset, 0, lineToAdd);
16
- }
17
- return lines.join('\n');
18
- };
19
- const modifyAppBuildGradle = (gradle) => {
20
- let modified = gradle;
21
- // Add billing library dependencies to app-level build.gradle
22
- const billingDep = ` implementation "com.android.billingclient:billing-ktx:8.0.0"`;
23
- const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
24
- let hasAddedDependency = false;
25
- if (!modified.includes(billingDep)) {
26
- modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
27
- hasAddedDependency = true;
28
- }
29
- if (!modified.includes(gmsDep)) {
30
- modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
31
- hasAddedDependency = true;
32
- }
33
- // Log only once and only if we actually added dependencies
34
- if (hasAddedDependency && !hasLoggedPluginExecution) {
35
- console.log('đŸ› ī¸ react-native-iap: Added billing dependencies to build.gradle');
36
- }
37
- return modified;
38
- };
39
- const withIapAndroid = (config) => {
40
- // Add IAP dependencies to app build.gradle
41
- config = (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
42
- config.modResults.contents = modifyAppBuildGradle(config.modResults.contents);
43
- return config;
44
- });
45
- config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
46
- const manifest = config.modResults;
47
- if (!manifest.manifest['uses-permission']) {
48
- manifest.manifest['uses-permission'] = [];
49
- }
50
- const permissions = manifest.manifest['uses-permission'];
51
- const billingPerm = { $: { 'android:name': 'com.android.vending.BILLING' } };
52
- const alreadyExists = permissions.some((p) => p.$['android:name'] === 'com.android.vending.BILLING');
53
- if (!alreadyExists) {
54
- permissions.push(billingPerm);
55
- if (!hasLoggedPluginExecution) {
56
- console.log('✅ Added com.android.vending.BILLING to AndroidManifest.xml');
57
- }
58
- }
59
- else {
60
- if (!hasLoggedPluginExecution) {
61
- console.log('â„šī¸ com.android.vending.BILLING already exists in AndroidManifest.xml');
62
- }
63
- }
64
- return config;
65
- });
66
- return config;
67
- };
68
- const withIAP = (config, _props) => {
69
- try {
70
- const result = withIapAndroid(config);
71
- // Set flag after first execution to prevent duplicate logs
72
- hasLoggedPluginExecution = true;
73
- return result;
74
- }
75
- catch (error) {
76
- config_plugins_1.WarningAggregator.addWarningAndroid('react-native-iap', `react-native-iap plugin encountered an error: ${error}`);
77
- console.error('react-native-iap plugin error:', error);
78
- return config;
79
- }
80
- };
81
- exports.default = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
@@ -1 +0,0 @@
1
- {"root":["../src/withiap.ts"],"version":"5.9.2"}