expo-iap 6.4.4 → 6.5.1

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.
Files changed (51) hide show
  1. package/.prettierignore +1 -0
  2. package/README.md +18 -17
  3. package/android/src/main/java/expo/modules/iap/ExpoIapHelper.kt +9 -2
  4. package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +73 -36
  5. package/build/ExpoIapModule.d.ts +1 -1
  6. package/build/ExpoIapModule.d.ts.map +1 -1
  7. package/build/ExpoIapModule.js.map +1 -1
  8. package/build/index.d.ts +17 -0
  9. package/build/index.d.ts.map +1 -1
  10. package/build/index.js +43 -8
  11. package/build/index.js.map +1 -1
  12. package/build/index.kepler.d.ts +3 -0
  13. package/build/index.kepler.d.ts.map +1 -1
  14. package/build/index.kepler.js +4 -0
  15. package/build/index.kepler.js.map +1 -1
  16. package/build/modules/android.d.ts.map +1 -1
  17. package/build/modules/android.js +11 -11
  18. package/build/modules/android.js.map +1 -1
  19. package/build/modules/ios.d.ts +4 -0
  20. package/build/modules/ios.d.ts.map +1 -1
  21. package/build/modules/ios.js +4 -0
  22. package/build/modules/ios.js.map +1 -1
  23. package/build/types.d.ts +77 -3
  24. package/build/types.d.ts.map +1 -1
  25. package/build/types.js.map +1 -1
  26. package/build/useIAP.d.ts +2 -0
  27. package/build/useIAP.d.ts.map +1 -1
  28. package/build/useIAP.js +3 -1
  29. package/build/useIAP.js.map +1 -1
  30. package/build/utils/nativeError.d.ts.map +1 -1
  31. package/build/utils/nativeError.js +7 -3
  32. package/build/utils/nativeError.js.map +1 -1
  33. package/build/utils/restorePurchases.d.ts.map +1 -1
  34. package/build/utils/restorePurchases.js +4 -2
  35. package/build/utils/restorePurchases.js.map +1 -1
  36. package/ios/ExpoIapModule.swift +20 -0
  37. package/openiap-versions.json +3 -3
  38. package/osv-scanner.toml +5 -5
  39. package/package.json +1 -5
  40. package/plugin/build/withIAP.js +89 -97
  41. package/plugin/jest.config.js +1 -0
  42. package/plugin/src/withIAP.ts +110 -120
  43. package/src/ExpoIapModule.ts +2 -0
  44. package/src/index.kepler.ts +8 -0
  45. package/src/index.ts +55 -10
  46. package/src/modules/android.ts +49 -21
  47. package/src/modules/ios.ts +4 -0
  48. package/src/types.ts +82 -3
  49. package/src/useIAP.ts +6 -0
  50. package/src/utils/nativeError.ts +10 -3
  51. package/src/utils/restorePurchases.ts +9 -4
package/.prettierignore CHANGED
@@ -5,3 +5,4 @@ src/purchase-flow-confirmers.ts
5
5
  docs/**
6
6
  .claude/commands/**
7
7
  src/__tests__/purchaseFlow.shared.test.ts
8
+ src/__tests__/fixtures/behavior-errors.json
package/README.md CHANGED
@@ -100,19 +100,24 @@ If expo-iap saves you time, a ⭐ on [hyodotdev/openiap](https://github.com/hyod
100
100
  ## Sponsors
101
101
 
102
102
  <p align="center">
103
- <a href="https://meta.com">
104
- <img src="https://openiap.dev/meta.svg" alt="Meta" height="80" align="middle">
105
- </a>
103
+ <a href="https://meta.com"><img src="https://openiap.dev/meta.svg" alt="Meta" height="80" align="middle"></a>
106
104
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
107
- <a href="https://developer.amazon.com/">
108
- <picture>
109
- <source media="(prefers-color-scheme: dark)" srcset="https://openiap.dev/sponsors/amazon-dark.webp">
110
- <img src="https://openiap.dev/sponsors/amazon.webp" alt="Amazon Developer" height="44" align="middle">
111
- </picture>
112
- </a>
105
+ <a href="https://developer.amazon.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://openiap.dev/sponsors/amazon-dark.webp"><img src="https://openiap.dev/sponsors/amazon.webp" alt="Amazon Developer" height="44" align="middle"></picture></a>
106
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
107
+ <a href="https://codemagic.io/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://openiap.dev/sponsors/codemagic-dark.svg"><img src="https://openiap.dev/sponsors/codemagic.svg" alt="Codemagic" height="22" align="middle"></picture></a>
108
+ </p>
109
+
110
+ Thank you to [Meta](https://meta.com), [Amazon Developer](https://developer.amazon.com/), and [Codemagic](https://codemagic.io/) for supporting OpenIAP. [View sponsorship options](https://openiap.dev/sponsors).
111
+
112
+ ### In-kind support
113
+
114
+ <p align="center">
115
+ <a href="https://claude.com/contact-sales/claude-for-oss"><picture><source media="(prefers-color-scheme: dark)" srcset="https://openiap.dev/sponsors/claude-dark.svg"><img src="https://openiap.dev/sponsors/claude.svg" alt="Claude" height="17" align="middle"></picture></a>
116
+ &nbsp;&nbsp;&nbsp;&nbsp;
117
+ <a href="https://codemagic.io/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://openiap.dev/sponsors/codemagic-dark.svg"><img src="https://openiap.dev/sponsors/codemagic.svg" alt="Codemagic" height="19" align="middle"></picture></a>
113
118
  </p>
114
119
 
115
- Thank you to [Meta](https://meta.com) and [Amazon Developer](https://developer.amazon.com/) for supporting OpenIAP. [View sponsorship options](https://openiap.dev/sponsors).
120
+ [Claude for Open Source](https://claude.com/contact-sales/claude-for-oss) provides the Claude Ultra plan for the maintainer for 6 months.<br>[Codemagic](https://codemagic.io/) provides infrastructure support for OpenIAP.
116
121
 
117
122
  ### OpenCollective
118
123
 
@@ -126,16 +131,12 @@ We also recognize sponsors and backers through OpenCollective. The original reac
126
131
 
127
132
  ### Past supporters
128
133
 
129
- Supported the project before the OpenIAP sponsor program.
134
+ Supported the project before the OpenIAP sponsor program: Nami for 30 months and Courier for 1 month.
130
135
 
131
136
  <p align="center">
132
- <a href="https://namiml.com">
133
- <img src="https://openiap.dev/sponsors/nami.webp" alt="Nami" height="32" align="middle">
134
- </a>
137
+ <a href="https://namiml.com"><img src="https://openiap.dev/sponsors/nami.webp" alt="Nami" height="20" align="middle"></a>
135
138
  &nbsp;&nbsp;&nbsp;&nbsp;
136
- <a href="https://www.courier.com/?utm_source=react-native-iap&utm_campaign=osssponsors">
137
- <img src="https://openiap.dev/sponsors/courier.webp" alt="Courier" height="32" align="middle">
138
- </a>
139
+ <a href="https://www.courier.com/?utm_source=react-native-iap&utm_campaign=osssponsors"><img src="https://openiap.dev/sponsors/courier.webp" alt="Courier" height="15" align="middle"></a>
139
140
  </p>
140
141
 
141
142
  [openiap-sponsors]: https://openiap.dev/sponsors
@@ -49,9 +49,16 @@ object ExpoIapHelper {
49
49
  internal fun rejectWithErrorEnvelope(
50
50
  promise: Promise,
51
51
  error: Exception,
52
+ fallbackCode: String = OpenIapError.ServiceUnavailable.CODE,
52
53
  ) {
53
- val openIapError = error as? OpenIapError ?: OpenIapError.ServiceUnavailable(error.message)
54
- promise.reject(openIapError.code, serializeErrorEnvelope(serializeOpenIapError(openIapError)), null)
54
+ val payload =
55
+ (error as? OpenIapError)?.let(::serializeOpenIapError)
56
+ ?: mapOf(
57
+ "code" to fallbackCode,
58
+ "message" to (error.message ?: OpenIapError.defaultMessage(fallbackCode)),
59
+ "platform" to "android",
60
+ )
61
+ promise.reject(payload["code"] as String, serializeErrorEnvelope(payload), null)
55
62
  }
56
63
 
57
64
  fun emitOrQueue(
@@ -2,6 +2,7 @@ package expo.modules.iap
2
2
 
3
3
  import android.content.Context
4
4
  import dev.hyo.openiap.DeepLinkOptions
5
+ import dev.hyo.openiap.ExternalPurchaseLinkRequest
5
6
  import dev.hyo.openiap.FetchProductsResultAll
6
7
  import dev.hyo.openiap.FetchProductsResultProducts
7
8
  import dev.hyo.openiap.FetchProductsResultSubscriptions
@@ -200,14 +201,7 @@ class ExpoIapModule : Module() {
200
201
  if (!ok) {
201
202
  // Clear any buffered events from a failed init
202
203
  pendingEvents.clear()
203
- ExpoIapLog.failure("initConnection", IllegalStateException("Failed to initialize connection"))
204
- val error = OpenIapError.InitConnection.forProvider(context)
205
- promise.reject(
206
- error.code,
207
- error.message,
208
- null,
209
- )
210
- return@withLock
204
+ throw OpenIapError.InitConnection.forProvider(context)
211
205
  }
212
206
 
213
207
  // Mark ready then flush any buffered events
@@ -223,7 +217,7 @@ class ExpoIapModule : Module() {
223
217
  promise.resolve(true)
224
218
  } catch (e: Exception) {
225
219
  ExpoIapLog.failure("initConnection", e)
226
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.InitConnection.CODE, e.message, e)
220
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e, OpenIapError.InitConnection.CODE)
227
221
  }
228
222
  }
229
223
  }
@@ -249,11 +243,7 @@ class ExpoIapModule : Module() {
249
243
  promise.resolve(result)
250
244
  } catch (error: Exception) {
251
245
  ExpoIapLog.failure("endConnection", error)
252
- promise.reject(
253
- endConnectionErrorCode(error),
254
- error.message,
255
- error,
256
- )
246
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, error, endConnectionErrorCode(error))
257
247
  }
258
248
  }
259
249
  }
@@ -314,7 +304,7 @@ class ExpoIapModule : Module() {
314
304
  promise.resolve(payload)
315
305
  } catch (e: Exception) {
316
306
  ExpoIapLog.failure("getAvailableItems", e)
317
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, null)
307
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
318
308
  }
319
309
  }
320
310
  }
@@ -332,7 +322,7 @@ class ExpoIapModule : Module() {
332
322
  promise.resolve(null)
333
323
  } catch (e: Exception) {
334
324
  ExpoIapLog.failure("deepLinkToSubscriptionsAndroid", e)
335
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, null)
325
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
336
326
  }
337
327
  }
338
328
  }
@@ -377,7 +367,7 @@ class ExpoIapModule : Module() {
377
367
  promise.resolve(code)
378
368
  } catch (e: Exception) {
379
369
  ExpoIapLog.failure("getStorefront", e)
380
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
370
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
381
371
  }
382
372
  }
383
373
  }
@@ -509,7 +499,7 @@ class ExpoIapModule : Module() {
509
499
  promise.resolve(true)
510
500
  } catch (e: Exception) {
511
501
  ExpoIapLog.failure("restorePurchases", e)
512
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, null)
502
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
513
503
  }
514
504
  }
515
505
  }
@@ -521,7 +511,7 @@ class ExpoIapModule : Module() {
521
511
  promise.resolve(null)
522
512
  } catch (e: Exception) {
523
513
  ExpoIapLog.failure("finishTransaction", e)
524
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.DeveloperError.CODE, e.message, null)
514
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e, OpenIapError.DeveloperError.CODE)
525
515
  }
526
516
  }
527
517
  }
@@ -572,12 +562,13 @@ class ExpoIapModule : Module() {
572
562
  } catch (e: CancellationException) {
573
563
  throw e
574
564
  } catch (e: Exception) {
575
- val code = when (e) {
576
- is OpenIapError -> e.code
577
- is IllegalArgumentException -> OpenIapError.DeveloperError.CODE
578
- else -> OpenIapError.ServiceUnavailable.CODE
579
- }
580
- promise.reject(code, e.message, e)
565
+ val fallbackCode =
566
+ if (e is IllegalArgumentException) {
567
+ OpenIapError.DeveloperError.CODE
568
+ } else {
569
+ OpenIapError.ServiceUnavailable.CODE
570
+ }
571
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e, fallbackCode)
581
572
  }
582
573
  }
583
574
  }
@@ -599,7 +590,7 @@ class ExpoIapModule : Module() {
599
590
  promise.resolve(resultMap)
600
591
  } catch (e: Exception) {
601
592
  ExpoIapLog.failure("verifyPurchase", e)
602
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.VerificationFailed.CODE, e.message, e)
593
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e, OpenIapError.VerificationFailed.CODE)
603
594
  }
604
595
  }
605
596
  }
@@ -623,7 +614,7 @@ class ExpoIapModule : Module() {
623
614
  promise.resolve(resultMap)
624
615
  } catch (e: Exception) {
625
616
  ExpoIapLog.failure("verifyPurchaseWithProvider", e)
626
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.VerificationFailed.CODE, e.message, e)
617
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e, OpenIapError.VerificationFailed.CODE)
627
618
  }
628
619
  }
629
620
  }
@@ -641,7 +632,7 @@ class ExpoIapModule : Module() {
641
632
  promise.resolve(result)
642
633
  } catch (e: Exception) {
643
634
  ExpoIapLog.failure("getActiveSubscriptions", e)
644
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
635
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
645
636
  }
646
637
  }
647
638
  }
@@ -658,7 +649,7 @@ class ExpoIapModule : Module() {
658
649
  promise.resolve(hasActive)
659
650
  } catch (e: Exception) {
660
651
  ExpoIapLog.failure("hasActiveSubscriptions", e)
661
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
652
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
662
653
  }
663
654
  }
664
655
  }
@@ -684,7 +675,7 @@ class ExpoIapModule : Module() {
684
675
  promise.resolve(response)
685
676
  } catch (e: Exception) {
686
677
  ExpoIapLog.failure("isBillingProgramAvailableAndroid", e)
687
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
678
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
688
679
  }
689
680
  }
690
681
  }
@@ -710,7 +701,7 @@ class ExpoIapModule : Module() {
710
701
  promise.resolve(result.toJson())
711
702
  } catch (e: Exception) {
712
703
  ExpoIapLog.failure("getBillingChoiceInfoAndroid", e)
713
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
704
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
714
705
  }
715
706
  }
716
707
  }
@@ -742,7 +733,7 @@ class ExpoIapModule : Module() {
742
733
  promise.resolve(response)
743
734
  } catch (e: Exception) {
744
735
  ExpoIapLog.failure("createBillingProgramReportingDetailsAndroid", e)
745
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
736
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
746
737
  }
747
738
  }
748
739
  }
@@ -758,7 +749,7 @@ class ExpoIapModule : Module() {
758
749
  promise.resolve(openIapStore.showAlternativeBillingOnlyInformationDialog(activity).toJson())
759
750
  } catch (e: Exception) {
760
751
  ExpoIapLog.failure("showAlternativeBillingOnlyInformationDialogAndroid", e)
761
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
752
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
762
753
  }
763
754
  }
764
755
  }
@@ -792,7 +783,7 @@ class ExpoIapModule : Module() {
792
783
  promise.resolve(result.toJson())
793
784
  } catch (e: Exception) {
794
785
  ExpoIapLog.failure("showBillingProgramInformationDialogAndroid", e)
795
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
786
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
796
787
  }
797
788
  }
798
789
  }
@@ -827,7 +818,7 @@ class ExpoIapModule : Module() {
827
818
  promise.resolve(result.toJson())
828
819
  } catch (e: Exception) {
829
820
  ExpoIapLog.failure("showInAppMessagesAndroid", e)
830
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
821
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
831
822
  }
832
823
  }
833
824
  }
@@ -875,7 +866,53 @@ class ExpoIapModule : Module() {
875
866
  promise.resolve(result)
876
867
  } catch (e: Exception) {
877
868
  ExpoIapLog.failure("launchExternalLinkAndroid", e)
878
- promise.reject((e as? OpenIapError)?.code ?: OpenIapError.ServiceUnavailable.CODE, e.message, e)
869
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
870
+ }
871
+ }
872
+ }
873
+
874
+ AsyncFunction("isExternalPurchaseLinkAvailable") { promise: Promise ->
875
+ ExpoIapLog.payload("isExternalPurchaseLinkAvailable", null)
876
+ scope.launch {
877
+ try {
878
+ val isAvailable = openIapStore.isExternalPurchaseLinkAvailable()
879
+ ExpoIapLog.result("isExternalPurchaseLinkAvailable", isAvailable)
880
+ promise.resolve(isAvailable)
881
+ } catch (e: Exception) {
882
+ ExpoIapLog.failure("isExternalPurchaseLinkAvailable", e)
883
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
884
+ }
885
+ }
886
+ }
887
+
888
+ AsyncFunction("openExternalPurchaseLink") { params: Map<String, Any?>, promise: Promise ->
889
+ ExpoIapLog.payload("openExternalPurchaseLink", params)
890
+ scope.launch {
891
+ try {
892
+ val request =
893
+ runCatching { ExternalPurchaseLinkRequest.fromJson(params) }
894
+ .getOrNull() ?: run {
895
+ promise.reject(
896
+ OpenIapError.DeveloperError.CODE,
897
+ "Invalid external purchase link request: `url` is required.",
898
+ null,
899
+ )
900
+ return@launch
901
+ }
902
+ val activity =
903
+ runCatching { currentActivity }
904
+ .onFailure {
905
+ ExpoIapLog.failure("openExternalPurchaseLink activity", it)
906
+ }.getOrNull() ?: run {
907
+ promise.reject(OpenIapError.ServiceUnavailable.CODE, "Activity not available", null)
908
+ return@launch
909
+ }
910
+ val result = openIapStore.openExternalPurchaseLink(activity, request).toJson()
911
+ ExpoIapLog.result("openExternalPurchaseLink", result)
912
+ promise.resolve(result)
913
+ } catch (e: Exception) {
914
+ ExpoIapLog.failure("openExternalPurchaseLink", e)
915
+ ExpoIapHelper.rejectWithErrorEnvelope(promise, e)
879
916
  }
880
917
  }
881
918
  }
@@ -18,7 +18,7 @@ type MutationFields<K extends keyof Mutation> = {
18
18
  * Native surface behind the default export. Results the wrappers decode stay
19
19
  * `unknown`; the rest match the generated operation signatures.
20
20
  */
21
- export type ExpoIapNativeModule = NativeEventModule & QueryFields<'canPresentExternalPurchaseNoticeIOS' | 'currentEntitlementIOS' | 'getActiveSubscriptions' | 'getAppTransactionIOS' | 'verifyAppOwnership' | 'getBillingChoiceInfoAndroid' | 'getExternalPurchaseCustomLinkTokenIOS' | 'getPromotedProductIOS' | 'getReceiptDataIOS' | 'getTransactionJwsIOS' | 'hasActiveSubscriptions' | 'isEligibleForExternalPurchaseCustomLinkIOS' | 'isEligibleForIntroOfferIOS' | 'isTransactionVerifiedIOS' | 'latestTransactionIOS'> & MutationFields<'beginRefundRequestIOS' | 'clearTransactionIOS' | 'endConnection' | 'initConnection' | 'isBillingProgramAvailableAndroid' | 'launchExternalLinkAndroid' | 'openRedeemOfferCode' | 'presentExternalPurchaseLinkIOS' | 'presentExternalPurchaseNoticeSheetIOS' | 'showBillingProgramInformationDialogAndroid' | 'showExternalPurchaseCustomLinkNoticeIOS' | 'showAlternativeBillingOnlyInformationDialogAndroid' | 'showInAppMessagesAndroid' | 'syncIOS' | 'verifyPurchase' | 'verifyPurchaseWithProvider'> & {
21
+ export type ExpoIapNativeModule = NativeEventModule & QueryFields<'canPresentExternalPurchaseNoticeIOS' | 'currentEntitlementIOS' | 'getActiveSubscriptions' | 'getAppTransactionIOS' | 'verifyAppOwnership' | 'getBillingChoiceInfoAndroid' | 'getExternalPurchaseCustomLinkTokenIOS' | 'getPromotedProductIOS' | 'getReceiptDataIOS' | 'getTransactionJwsIOS' | 'hasActiveSubscriptions' | 'isEligibleForExternalPurchaseCustomLinkIOS' | 'isExternalPurchaseLinkAvailable' | 'isEligibleForIntroOfferIOS' | 'isTransactionVerifiedIOS' | 'latestTransactionIOS'> & MutationFields<'beginRefundRequestIOS' | 'clearTransactionIOS' | 'endConnection' | 'initConnection' | 'isBillingProgramAvailableAndroid' | 'launchExternalLinkAndroid' | 'openExternalPurchaseLink' | 'openRedeemOfferCode' | 'presentExternalPurchaseLinkIOS' | 'presentExternalPurchaseNoticeSheetIOS' | 'showBillingProgramInformationDialogAndroid' | 'showExternalPurchaseCustomLinkNoticeIOS' | 'showAlternativeBillingOnlyInformationDialogAndroid' | 'showInAppMessagesAndroid' | 'syncIOS' | 'verifyPurchase' | 'verifyPurchaseWithProvider'> & {
22
22
  USING_ONSIDE_SDK: boolean;
23
23
  USING_VEGA_SDK: boolean;
24
24
  fetchProducts(request: {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,qBAAqB,EACrB,qCAAqC,EACrC,2BAA2B,EAC3B,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,8BAA8B,EAC9B,KAAK,EACL,UAAU,EACV,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAMjB,0EAA0E;AAC1E,KAAK,iBAAiB,GAAG;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,WAAW,CAAC,CAAC,EACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAC7B,iBAAiB,GAAG,SAAS,CAAC;IACjC,cAAc,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI,CAAC;IAC5E,iCAAiC,CAAC,CAChC,OAAO,CAAC,EAAE,8BAA8B,GAAG,IAAI,GAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,SAAS,MAAM,KAAK,IAAI;KAAE,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CAAC,CAAC;AACpE,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,QAAQ,IAAI;KAAE,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;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C,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,mBAAmB,CAC3B,UAAU,EACV,2CAA2C,MAAM,CAC/C,IAAI,CACL,mDAAmD,CACrD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n requireNativeModule,\n UnavailabilityError,\n type EventSubscription,\n} from 'expo-modules-core';\nimport {installedFromOnside} from './onside';\nimport type {\n BillingProgramAndroid,\n BillingProgramReportingDetailsAndroid,\n DeveloperBillingTypeAndroid,\n Mutation,\n MutationField,\n ProductQueryType,\n PurchaseInput,\n PurchaseOptions,\n PurchaseUpdatedListenerOptions,\n Query,\n QueryField,\n SubscriptionStatusIOS,\n} from './types';\nimport {getVegaIapModule, isVegaOS} from './vega';\n\ntype NativeIapModuleName = 'ExpoIapVega' | 'ExpoIapOnside' | 'ExpoIap';\nconst ONSIDE_MARKETPLACE_ID = 'com.onside.marketplace-app';\n\n/** Members read from the raw module; every store module provides them. */\ntype NativeEventModule = {\n ERROR_CODES?: Record<string, unknown>;\n HAS_EXPLICIT_STORE_PROVIDER?: boolean;\n addListener<T>(\n eventName: string,\n listener: (payload: T) => void,\n ): EventSubscription | undefined;\n removeListener?<T>(eventName: string, listener: (payload: T) => void): void;\n setPurchaseUpdatedListenerOptions?(\n options?: PurchaseUpdatedListenerOptions | null,\n ): Promise<void>;\n};\n\ntype QueryFields<K extends keyof Query> = {[P in K]: QueryField<P>};\ntype MutationFields<K extends keyof Mutation> = {[P in K]: MutationField<P>};\n\n/**\n * Native surface behind the default export. Results the wrappers decode stay\n * `unknown`; the rest match the generated operation signatures.\n */\nexport type ExpoIapNativeModule = NativeEventModule &\n QueryFields<\n | 'canPresentExternalPurchaseNoticeIOS'\n | 'currentEntitlementIOS'\n | 'getActiveSubscriptions'\n | 'getAppTransactionIOS'\n | 'verifyAppOwnership'\n | 'getBillingChoiceInfoAndroid'\n | 'getExternalPurchaseCustomLinkTokenIOS'\n | 'getPromotedProductIOS'\n | 'getReceiptDataIOS'\n | 'getTransactionJwsIOS'\n | 'hasActiveSubscriptions'\n | 'isEligibleForExternalPurchaseCustomLinkIOS'\n | 'isEligibleForIntroOfferIOS'\n | 'isTransactionVerifiedIOS'\n | 'latestTransactionIOS'\n > &\n MutationFields<\n | 'beginRefundRequestIOS'\n | 'clearTransactionIOS'\n | 'endConnection'\n | 'initConnection'\n | 'isBillingProgramAvailableAndroid'\n | 'launchExternalLinkAndroid'\n | 'openRedeemOfferCode'\n | 'presentExternalPurchaseLinkIOS'\n | 'presentExternalPurchaseNoticeSheetIOS'\n | 'showBillingProgramInformationDialogAndroid'\n | 'showExternalPurchaseCustomLinkNoticeIOS'\n | 'showAlternativeBillingOnlyInformationDialogAndroid'\n | 'showInAppMessagesAndroid'\n | 'syncIOS'\n | 'verifyPurchase'\n | 'verifyPurchaseWithProvider'\n > & {\n USING_ONSIDE_SDK: boolean;\n USING_VEGA_SDK: boolean;\n fetchProducts(request: {\n skus: string[];\n type: ProductQueryType;\n }): Promise<unknown[]>;\n fetchProducts(type: ProductQueryType, skus: string[]): Promise<unknown[]>;\n getAvailableItems(\n alsoPublishToEventListenerIOS: boolean,\n onlyIncludeActiveItemsIOS: boolean,\n ): Promise<unknown>;\n getAvailableItems(options: PurchaseOptions): Promise<unknown>;\n getAllTransactionsIOS(): Promise<unknown>;\n getPendingTransactionsIOS(): Promise<unknown>;\n showManageSubscriptionsIOS(): Promise<unknown>;\n deepLinkToSubscriptionsIOS(): Promise<boolean>;\n requestPurchase(request: object): Promise<unknown>;\n finishTransaction(\n purchase: PurchaseInput,\n isConsumable: boolean | null,\n ): Promise<boolean>;\n /** Internal: the once-per-install flag behind the first-purchase notice. */\n claimFirstPurchaseNotice(): Promise<boolean>;\n acknowledgePurchaseAndroid(purchaseToken: string): Promise<unknown>;\n consumePurchaseAndroid(purchaseToken: string): Promise<unknown>;\n createBillingProgramReportingDetailsAndroid(\n program: BillingProgramAndroid,\n developerBillingType: DeveloperBillingTypeAndroid | null,\n ): Promise<BillingProgramReportingDetailsAndroid>;\n subscriptionStatusIOS(sku: string): Promise<SubscriptionStatusIOS[] | null>;\n requestReceiptRefreshIOS(): Promise<string>;\n deepLinkToSubscriptionsAndroid?(options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n }): Promise<void> | void;\n getStorefront?(): Promise<string> | string;\n restorePurchases?(): Promise<boolean>;\n };\n\ntype ResolvedNativeModule = {\n module: NativeEventModule;\n name: NativeIapModuleName;\n};\n\nlet cached: ResolvedNativeModule | null = null;\nlet onsideModuleUnavailable = false;\nlet explicitStoreProvider: boolean | undefined;\n\nfunction getResolved(): ResolvedNativeModule {\n function shouldUseOnsideModule(): boolean {\n if (\n installedFromOnside === true ||\n typeof installedFromOnside === 'string'\n ) {\n if (explicitStoreProvider === undefined) {\n try {\n const module =\n cached?.name === 'ExpoIap'\n ? cached.module\n : requireNativeModule<NativeEventModule>('ExpoIap');\n explicitStoreProvider = module.HAS_EXPLICIT_STORE_PROVIDER === true;\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIap')) throw error;\n explicitStoreProvider = false;\n }\n }\n if (explicitStoreProvider) return false;\n }\n if (installedFromOnside === true) {\n return true;\n }\n\n if (typeof installedFromOnside !== 'string') {\n return false;\n }\n\n const normalized = installedFromOnside.trim().toLowerCase();\n return normalized === 'true' || normalized === ONSIDE_MARKETPLACE_ID;\n }\n\n function getExpectedModuleName(): NativeIapModuleName {\n if (isVegaOS()) {\n return 'ExpoIapVega';\n }\n\n return shouldUseOnsideModule() ? 'ExpoIapOnside' : 'ExpoIap';\n }\n\n function resolveNativeModule(): ResolvedNativeModule {\n if (isVegaOS()) {\n const vegaModule = getVegaIapModule();\n if (!vegaModule) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'Amazon Vega IAP module is unavailable. Install @amazon-devices/keplerscript-appstore-iap-lib in the Vega app target and build with the React Native for Vega kepler platform.',\n );\n }\n return {module: vegaModule, name: 'ExpoIapVega'};\n }\n\n if (shouldUseOnsideModule()) {\n if (onsideModuleUnavailable) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n try {\n return {\n module: requireNativeModule<NativeEventModule>('ExpoIapOnside'),\n name: 'ExpoIapOnside',\n };\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIapOnside')) {\n throw error;\n }\n onsideModuleUnavailable = true;\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n }\n\n return {\n module: requireNativeModule<NativeEventModule>('ExpoIap'),\n name: 'ExpoIap',\n };\n }\n\n const expectedName = getExpectedModuleName();\n if (!cached || cached.name !== expectedName) {\n cached = resolveNativeModule();\n }\n return cached;\n}\n\nfunction isMissingModuleError(error: unknown, moduleName: string): boolean {\n if (error instanceof UnavailabilityError) {\n return true;\n }\n\n if (error instanceof Error) {\n return error.message.includes(`Cannot find native module '${moduleName}'`);\n }\n\n return false;\n}\n\nexport const NATIVE_ERROR_CODES: Record<string, unknown> = new Proxy(\n {} as Record<string, unknown>,\n {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const errorCodes: Record<string, unknown> =\n getResolved().module.ERROR_CODES || {};\n return errorCodes[prop];\n },\n },\n);\n\n/**\n * Returns the raw native module, not the Proxy. Use it for addListener: a JSI\n * HostObject needs the real module as `this`, and a Proxy throws \"native state\n * unsupported on Proxy\" on New Architecture / Hermes.\n */\nexport function getNativeModule(): NativeEventModule {\n return getResolved().module;\n}\n\n// The Proxy forwards every member to the lazily resolved store module.\nexport default new Proxy({} as ExpoIapNativeModule, {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const resolved = getResolved();\n if (prop === 'USING_ONSIDE_SDK') {\n return resolved.name === 'ExpoIapOnside';\n }\n if (prop === 'USING_VEGA_SDK') {\n return resolved.name === 'ExpoIapVega';\n }\n\n const value: unknown = Reflect.get(resolved.module, prop);\n if (value !== undefined || resolved.name !== 'ExpoIapOnside') {\n return value;\n }\n\n return () => {\n throw new UnavailabilityError(\n 'expo-iap',\n `The Onside marketplace does not support ${String(\n prop,\n )}. The call was not routed through Apple StoreKit.`,\n );\n };\n },\n});\n"]}
1
+ {"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAe7C,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAGlD,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAyG3D,IAAI,MAAM,GAAgC,IAAI,CAAC;AAC/C,IAAI,uBAAuB,GAAG,KAAK,CAAC;AACpC,IAAI,qBAA0C,CAAC;AAE/C,SAAS,WAAW;IAClB,SAAS,qBAAqB;QAC5B,IACE,mBAAmB,KAAK,IAAI;YAC5B,OAAO,mBAAmB,KAAK,QAAQ,EACvC,CAAC;YACD,IAAI,qBAAqB,KAAK,SAAS,EAAE,CAAC;gBACxC,IAAI,CAAC;oBACH,MAAM,MAAM,GACV,MAAM,EAAE,IAAI,KAAK,SAAS;wBACxB,CAAC,CAAC,MAAM,CAAC,MAAM;wBACf,CAAC,CAAC,mBAAmB,CAAoB,SAAS,CAAC,CAAC;oBACxD,qBAAqB,GAAG,MAAM,CAAC,2BAA2B,KAAK,IAAI,CAAC;gBACtE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,oBAAoB,CA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C;AAEF;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,WAAW,EAAE,CAAC,MAAM,CAAC;AAC9B,CAAC;AAED,uEAAuE;AACvE,eAAe,IAAI,KAAK,CAAC,EAAyB,EAAE;IAClD,GAAG,CAAC,MAAM,EAAE,IAAI;QACd,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,IAAI,KAAK,eAAe,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9B,OAAO,QAAQ,CAAC,IAAI,KAAK,aAAa,CAAC;QACzC,CAAC;QAED,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,mBAAmB,CAC3B,UAAU,EACV,2CAA2C,MAAM,CAC/C,IAAI,CACL,mDAAmD,CACrD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n requireNativeModule,\n UnavailabilityError,\n type EventSubscription,\n} from 'expo-modules-core';\nimport {installedFromOnside} from './onside';\nimport type {\n BillingProgramAndroid,\n BillingProgramReportingDetailsAndroid,\n DeveloperBillingTypeAndroid,\n Mutation,\n MutationField,\n ProductQueryType,\n PurchaseInput,\n PurchaseOptions,\n PurchaseUpdatedListenerOptions,\n Query,\n QueryField,\n SubscriptionStatusIOS,\n} from './types';\nimport {getVegaIapModule, isVegaOS} from './vega';\n\ntype NativeIapModuleName = 'ExpoIapVega' | 'ExpoIapOnside' | 'ExpoIap';\nconst ONSIDE_MARKETPLACE_ID = 'com.onside.marketplace-app';\n\n/** Members read from the raw module; every store module provides them. */\ntype NativeEventModule = {\n ERROR_CODES?: Record<string, unknown>;\n HAS_EXPLICIT_STORE_PROVIDER?: boolean;\n addListener<T>(\n eventName: string,\n listener: (payload: T) => void,\n ): EventSubscription | undefined;\n removeListener?<T>(eventName: string, listener: (payload: T) => void): void;\n setPurchaseUpdatedListenerOptions?(\n options?: PurchaseUpdatedListenerOptions | null,\n ): Promise<void>;\n};\n\ntype QueryFields<K extends keyof Query> = {[P in K]: QueryField<P>};\ntype MutationFields<K extends keyof Mutation> = {[P in K]: MutationField<P>};\n\n/**\n * Native surface behind the default export. Results the wrappers decode stay\n * `unknown`; the rest match the generated operation signatures.\n */\nexport type ExpoIapNativeModule = NativeEventModule &\n QueryFields<\n | 'canPresentExternalPurchaseNoticeIOS'\n | 'currentEntitlementIOS'\n | 'getActiveSubscriptions'\n | 'getAppTransactionIOS'\n | 'verifyAppOwnership'\n | 'getBillingChoiceInfoAndroid'\n | 'getExternalPurchaseCustomLinkTokenIOS'\n | 'getPromotedProductIOS'\n | 'getReceiptDataIOS'\n | 'getTransactionJwsIOS'\n | 'hasActiveSubscriptions'\n | 'isEligibleForExternalPurchaseCustomLinkIOS'\n | 'isExternalPurchaseLinkAvailable'\n | 'isEligibleForIntroOfferIOS'\n | 'isTransactionVerifiedIOS'\n | 'latestTransactionIOS'\n > &\n MutationFields<\n | 'beginRefundRequestIOS'\n | 'clearTransactionIOS'\n | 'endConnection'\n | 'initConnection'\n | 'isBillingProgramAvailableAndroid'\n | 'launchExternalLinkAndroid'\n | 'openExternalPurchaseLink'\n | 'openRedeemOfferCode'\n | 'presentExternalPurchaseLinkIOS'\n | 'presentExternalPurchaseNoticeSheetIOS'\n | 'showBillingProgramInformationDialogAndroid'\n | 'showExternalPurchaseCustomLinkNoticeIOS'\n | 'showAlternativeBillingOnlyInformationDialogAndroid'\n | 'showInAppMessagesAndroid'\n | 'syncIOS'\n | 'verifyPurchase'\n | 'verifyPurchaseWithProvider'\n > & {\n USING_ONSIDE_SDK: boolean;\n USING_VEGA_SDK: boolean;\n fetchProducts(request: {\n skus: string[];\n type: ProductQueryType;\n }): Promise<unknown[]>;\n fetchProducts(type: ProductQueryType, skus: string[]): Promise<unknown[]>;\n getAvailableItems(\n alsoPublishToEventListenerIOS: boolean,\n onlyIncludeActiveItemsIOS: boolean,\n ): Promise<unknown>;\n getAvailableItems(options: PurchaseOptions): Promise<unknown>;\n getAllTransactionsIOS(): Promise<unknown>;\n getPendingTransactionsIOS(): Promise<unknown>;\n showManageSubscriptionsIOS(): Promise<unknown>;\n deepLinkToSubscriptionsIOS(): Promise<boolean>;\n requestPurchase(request: object): Promise<unknown>;\n finishTransaction(\n purchase: PurchaseInput,\n isConsumable: boolean | null,\n ): Promise<boolean>;\n /** Internal: the once-per-install flag behind the first-purchase notice. */\n claimFirstPurchaseNotice(): Promise<boolean>;\n acknowledgePurchaseAndroid(purchaseToken: string): Promise<unknown>;\n consumePurchaseAndroid(purchaseToken: string): Promise<unknown>;\n createBillingProgramReportingDetailsAndroid(\n program: BillingProgramAndroid,\n developerBillingType: DeveloperBillingTypeAndroid | null,\n ): Promise<BillingProgramReportingDetailsAndroid>;\n subscriptionStatusIOS(sku: string): Promise<SubscriptionStatusIOS[] | null>;\n requestReceiptRefreshIOS(): Promise<string>;\n deepLinkToSubscriptionsAndroid?(options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n }): Promise<void> | void;\n getStorefront?(): Promise<string> | string;\n restorePurchases?(): Promise<boolean>;\n };\n\ntype ResolvedNativeModule = {\n module: NativeEventModule;\n name: NativeIapModuleName;\n};\n\nlet cached: ResolvedNativeModule | null = null;\nlet onsideModuleUnavailable = false;\nlet explicitStoreProvider: boolean | undefined;\n\nfunction getResolved(): ResolvedNativeModule {\n function shouldUseOnsideModule(): boolean {\n if (\n installedFromOnside === true ||\n typeof installedFromOnside === 'string'\n ) {\n if (explicitStoreProvider === undefined) {\n try {\n const module =\n cached?.name === 'ExpoIap'\n ? cached.module\n : requireNativeModule<NativeEventModule>('ExpoIap');\n explicitStoreProvider = module.HAS_EXPLICIT_STORE_PROVIDER === true;\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIap')) throw error;\n explicitStoreProvider = false;\n }\n }\n if (explicitStoreProvider) return false;\n }\n if (installedFromOnside === true) {\n return true;\n }\n\n if (typeof installedFromOnside !== 'string') {\n return false;\n }\n\n const normalized = installedFromOnside.trim().toLowerCase();\n return normalized === 'true' || normalized === ONSIDE_MARKETPLACE_ID;\n }\n\n function getExpectedModuleName(): NativeIapModuleName {\n if (isVegaOS()) {\n return 'ExpoIapVega';\n }\n\n return shouldUseOnsideModule() ? 'ExpoIapOnside' : 'ExpoIap';\n }\n\n function resolveNativeModule(): ResolvedNativeModule {\n if (isVegaOS()) {\n const vegaModule = getVegaIapModule();\n if (!vegaModule) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'Amazon Vega IAP module is unavailable. Install @amazon-devices/keplerscript-appstore-iap-lib in the Vega app target and build with the React Native for Vega kepler platform.',\n );\n }\n return {module: vegaModule, name: 'ExpoIapVega'};\n }\n\n if (shouldUseOnsideModule()) {\n if (onsideModuleUnavailable) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n try {\n return {\n module: requireNativeModule<NativeEventModule>('ExpoIapOnside'),\n name: 'ExpoIapOnside',\n };\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIapOnside')) {\n throw error;\n }\n onsideModuleUnavailable = true;\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n }\n\n return {\n module: requireNativeModule<NativeEventModule>('ExpoIap'),\n name: 'ExpoIap',\n };\n }\n\n const expectedName = getExpectedModuleName();\n if (!cached || cached.name !== expectedName) {\n cached = resolveNativeModule();\n }\n return cached;\n}\n\nfunction isMissingModuleError(error: unknown, moduleName: string): boolean {\n if (error instanceof UnavailabilityError) {\n return true;\n }\n\n if (error instanceof Error) {\n return error.message.includes(`Cannot find native module '${moduleName}'`);\n }\n\n return false;\n}\n\nexport const NATIVE_ERROR_CODES: Record<string, unknown> = new Proxy(\n {} as Record<string, unknown>,\n {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const errorCodes: Record<string, unknown> =\n getResolved().module.ERROR_CODES || {};\n return errorCodes[prop];\n },\n },\n);\n\n/**\n * Returns the raw native module, not the Proxy. Use it for addListener: a JSI\n * HostObject needs the real module as `this`, and a Proxy throws \"native state\n * unsupported on Proxy\" on New Architecture / Hermes.\n */\nexport function getNativeModule(): NativeEventModule {\n return getResolved().module;\n}\n\n// The Proxy forwards every member to the lazily resolved store module.\nexport default new Proxy({} as ExpoIapNativeModule, {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const resolved = getResolved();\n if (prop === 'USING_ONSIDE_SDK') {\n return resolved.name === 'ExpoIapOnside';\n }\n if (prop === 'USING_VEGA_SDK') {\n return resolved.name === 'ExpoIapVega';\n }\n\n const value: unknown = Reflect.get(resolved.module, prop);\n if (value !== undefined || resolved.name !== 'ExpoIapOnside') {\n return value;\n }\n\n return () => {\n throw new UnavailabilityError(\n 'expo-iap',\n `The Onside marketplace does not support ${String(\n prop,\n )}. The call was not routed through Apple StoreKit.`,\n );\n };\n },\n});\n"]}
package/build/index.d.ts CHANGED
@@ -371,6 +371,23 @@ export declare const deepLinkToSubscriptions: MutationField<'deepLinkToSubscript
371
371
  * @see {@link https://openiap.dev/docs/apis/open-redeem-offer-code}
372
372
  */
373
373
  export declare const openRedeemOfferCode: MutationField<'openRedeemOfferCode'>;
374
+ /**
375
+ * Whether this device and storefront may link out to an external purchase
376
+ * with `openExternalPurchaseLink`. Resolves false where no program applies.
377
+ *
378
+ * @see {@link https://openiap.dev/docs/apis/is-external-purchase-link-available}
379
+ */
380
+ export declare const isExternalPurchaseLinkAvailable: QueryField<'isExternalPurchaseLinkAvailable'>;
381
+ /**
382
+ * Show the store disclosure, open the external purchase link after the user
383
+ * continues, and return the token to report from your server.
384
+ *
385
+ * @param request - URL plus optional Apple and Google options
386
+ * @returns Promise resolving to the link status and report token
387
+ *
388
+ * @see {@link https://openiap.dev/docs/apis/open-external-purchase-link}
389
+ */
390
+ export declare const openExternalPurchaseLink: MutationField<'openExternalPurchaseLink'>;
374
391
  /**
375
392
  * Verify purchase with the configured providers.
376
393
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AAcrC,OAAO,KAAK,EAGV,sCAAsC,EAEtC,aAAa,EAEb,OAAO,EACP,gBAAgB,EAEhB,QAAQ,EAER,8BAA8B,EAC9B,UAAU,EAOV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAM9B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAEvB,oBAAY,YAAY;IACtB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,kBAAkB,yBAAyB;IAC3C,wBAAwB,gCAAgC;IACxD;;;OAGG;IACH,+BAA+B,uCAAuC;IACtE,sGAAsG;IAC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,CAAC,CAAC,oBAAoB,CAAC,CASrD;AAED,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,uBAAuB,EAAC,MAAM,WAAW,CAAC;AACvE,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,0BAA0B,EAC1B,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAC,yBAAyB,EAAC,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,IAAI,iBAAiB,EAClC,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC"}
package/build/index.js CHANGED
@@ -641,19 +641,17 @@ function validateAndroidPurchaseBranchOptions(request, type) {
641
641
  }
642
642
  /** Verify app acquisition; send Android integrity tokens to your backend. */
643
643
  export const verifyAppOwnership = async (options) => {
644
- if (isVegaOS() ||
645
- ExpoIapModule.USING_ONSIDE_SDK ||
646
- (Platform.OS !== 'ios' && Platform.OS !== 'android')) {
644
+ // Checked before the module is read: web has no native module to resolve.
645
+ if (Platform.OS !== 'ios' && Platform.OS !== 'android') {
647
646
  return {
648
647
  status: 'unknown',
649
648
  reason: 'unsupported',
650
- storeId: isVegaOS()
651
- ? 'amazon'
652
- : ExpoIapModule.USING_ONSIDE_SDK
653
- ? 'onside'
654
- : 'unknown',
649
+ storeId: isVegaOS() ? 'amazon' : 'unknown',
655
650
  };
656
651
  }
652
+ if (ExpoIapModule.USING_ONSIDE_SDK) {
653
+ return { status: 'unknown', reason: 'unsupported', storeId: 'onside' };
654
+ }
657
655
  return invokeNativeWithPurchaseError(() => ExpoIapModule.verifyAppOwnership(options ?? {}), nativePlatform(), {
658
656
  code: ErrorCode.ServiceError,
659
657
  });
@@ -942,6 +940,43 @@ export const openRedeemOfferCode = async () => {
942
940
  }
943
941
  return invokeNativeWithPurchaseError(() => ExpoIapModule.openRedeemOfferCode(), nativePlatform(), { code: ErrorCode.PurchaseError, message: 'Failed to redeem offer code.' });
944
942
  };
943
+ /**
944
+ * Whether this device and storefront may link out to an external purchase
945
+ * with `openExternalPurchaseLink`. Resolves false where no program applies.
946
+ *
947
+ * @see {@link https://openiap.dev/docs/apis/is-external-purchase-link-available}
948
+ */
949
+ export const isExternalPurchaseLinkAvailable = async () => {
950
+ if (isVegaOS())
951
+ return false;
952
+ if (!isStorePlatform()) {
953
+ throw unsupportedPlatformError();
954
+ }
955
+ return invokeNativeWithPurchaseError(() => ExpoIapModule.isExternalPurchaseLinkAvailable(), nativePlatform(), {
956
+ code: ErrorCode.ServiceError,
957
+ message: 'Failed to check external purchase link availability.',
958
+ });
959
+ };
960
+ /**
961
+ * Show the store disclosure, open the external purchase link after the user
962
+ * continues, and return the token to report from your server.
963
+ *
964
+ * @param request - URL plus optional Apple and Google options
965
+ * @returns Promise resolving to the link status and report token
966
+ *
967
+ * @see {@link https://openiap.dev/docs/apis/open-external-purchase-link}
968
+ */
969
+ export const openExternalPurchaseLink = async (request) => {
970
+ if (isVegaOS())
971
+ return { status: 'unavailable', platform: 'android' };
972
+ if (!isStorePlatform()) {
973
+ throw unsupportedPlatformError();
974
+ }
975
+ return invokeNativeWithPurchaseError(() => ExpoIapModule.openExternalPurchaseLink(request), nativePlatform(), {
976
+ code: ErrorCode.ServiceError,
977
+ message: 'Failed to open external purchase link.',
978
+ });
979
+ };
945
980
  /**
946
981
  * Verify purchase with the configured providers.
947
982
  *