react-native-iap 14.7.6 → 14.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -0
- package/ios/HybridRnIap.swift +86 -1
- package/lib/module/index.js +94 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +22 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/type-bridge.js +1 -0
- package/lib/module/utils/type-bridge.js.map +1 -1
- package/lib/typescript/src/index.d.ts +59 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +32 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +75 -6
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkNoticeResultIOS.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkNoticeTypeIOS.hpp +59 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkTokenResultIOS.hpp +62 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseCustomLinkTokenTypeIOS.hpp +59 -0
- package/nitrogen/generated/android/c++/JExternalPurchaseNoticeResultIOS.hpp +5 -1
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +64 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkNoticeResultIOS.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkNoticeTypeIOS.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkTokenResultIOS.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseCustomLinkTokenTypeIOS.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/ExternalPurchaseNoticeResultIOS.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +12 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +92 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +12 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +36 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkNoticeResultIOS.swift +65 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkNoticeTypeIOS.swift +40 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkTokenResultIOS.swift +84 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseCustomLinkTokenTypeIOS.swift +40 -0
- package/nitrogen/generated/ios/swift/ExternalPurchaseNoticeResultIOS.swift +31 -1
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseCustomLinkNoticeResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_ExternalPurchaseCustomLinkTokenResultIOS.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +57 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkNoticeResultIOS.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkNoticeTypeIOS.hpp +76 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkTokenResultIOS.hpp +80 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseCustomLinkTokenTypeIOS.hpp +76 -0
- package/nitrogen/generated/shared/c++/ExternalPurchaseNoticeResultIOS.hpp +5 -1
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +15 -0
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +134 -16
- package/src/specs/RnIap.nitro.ts +95 -4
- package/src/types.ts +81 -6
- package/src/utils/type-bridge.ts +1 -0
package/src/index.ts
CHANGED
|
@@ -17,6 +17,11 @@ import {ErrorCode} from './types';
|
|
|
17
17
|
import type {
|
|
18
18
|
AndroidSubscriptionOfferInput,
|
|
19
19
|
DiscountOfferInputIOS,
|
|
20
|
+
ExternalPurchaseCustomLinkNoticeResultIOS,
|
|
21
|
+
ExternalPurchaseCustomLinkNoticeTypeIOS,
|
|
22
|
+
ExternalPurchaseCustomLinkTokenResultIOS,
|
|
23
|
+
ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
24
|
+
ExternalPurchaseNoticeResultIOS,
|
|
20
25
|
FetchProductsResult,
|
|
21
26
|
MutationField,
|
|
22
27
|
Product,
|
|
@@ -2590,22 +2595,21 @@ export const canPresentExternalPurchaseNoticeIOS: QueryField<
|
|
|
2590
2595
|
* }
|
|
2591
2596
|
* ```
|
|
2592
2597
|
*/
|
|
2593
|
-
export const presentExternalPurchaseNoticeSheetIOS
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
}
|
|
2608
|
-
};
|
|
2598
|
+
export const presentExternalPurchaseNoticeSheetIOS =
|
|
2599
|
+
async (): Promise<ExternalPurchaseNoticeResultIOS> => {
|
|
2600
|
+
if (Platform.OS !== 'ios') {
|
|
2601
|
+
throw new Error('External purchase is only supported on iOS');
|
|
2602
|
+
}
|
|
2603
|
+
try {
|
|
2604
|
+
return await IAP.instance.presentExternalPurchaseNoticeSheetIOS();
|
|
2605
|
+
} catch (error) {
|
|
2606
|
+
RnIapConsole.error(
|
|
2607
|
+
'Failed to present external purchase notice sheet:',
|
|
2608
|
+
error,
|
|
2609
|
+
);
|
|
2610
|
+
throw error;
|
|
2611
|
+
}
|
|
2612
|
+
};
|
|
2609
2613
|
|
|
2610
2614
|
/**
|
|
2611
2615
|
* Present an external purchase link to redirect users to your website (iOS 16.0+).
|
|
@@ -2635,3 +2639,117 @@ export const presentExternalPurchaseLinkIOS: MutationField<
|
|
|
2635
2639
|
throw error;
|
|
2636
2640
|
}
|
|
2637
2641
|
};
|
|
2642
|
+
|
|
2643
|
+
// ╔════════════════════════════════════════════════════════════════════════╗
|
|
2644
|
+
// ║ EXTERNAL PURCHASE CUSTOM LINK (iOS 18.1+) ║
|
|
2645
|
+
// ╚════════════════════════════════════════════════════════════════════════╝
|
|
2646
|
+
|
|
2647
|
+
/**
|
|
2648
|
+
* Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
|
|
2649
|
+
* Returns true if the app can use custom external purchase links.
|
|
2650
|
+
*
|
|
2651
|
+
* @returns Promise<boolean> - true if eligible
|
|
2652
|
+
* @platform iOS
|
|
2653
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
|
|
2654
|
+
*
|
|
2655
|
+
* @example
|
|
2656
|
+
* ```typescript
|
|
2657
|
+
* const isEligible = await isEligibleForExternalPurchaseCustomLinkIOS();
|
|
2658
|
+
* if (isEligible) {
|
|
2659
|
+
* // App can use custom external purchase links
|
|
2660
|
+
* }
|
|
2661
|
+
* ```
|
|
2662
|
+
*/
|
|
2663
|
+
export const isEligibleForExternalPurchaseCustomLinkIOS =
|
|
2664
|
+
async (): Promise<boolean> => {
|
|
2665
|
+
if (Platform.OS !== 'ios') {
|
|
2666
|
+
return false;
|
|
2667
|
+
}
|
|
2668
|
+
try {
|
|
2669
|
+
return await IAP.instance.isEligibleForExternalPurchaseCustomLinkIOS();
|
|
2670
|
+
} catch (error) {
|
|
2671
|
+
RnIapConsole.error(
|
|
2672
|
+
'Failed to check external purchase custom link eligibility:',
|
|
2673
|
+
error,
|
|
2674
|
+
);
|
|
2675
|
+
return false;
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Get external purchase token for reporting to Apple (iOS 18.1+).
|
|
2681
|
+
* Use this token with Apple's External Purchase Server API to report transactions.
|
|
2682
|
+
*
|
|
2683
|
+
* @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)
|
|
2684
|
+
* @returns Promise<ExternalPurchaseCustomLinkTokenResultIOS> - Result with token string or error
|
|
2685
|
+
* @platform iOS
|
|
2686
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
|
|
2687
|
+
*
|
|
2688
|
+
* @example
|
|
2689
|
+
* ```typescript
|
|
2690
|
+
* // For new customer acquisition
|
|
2691
|
+
* const result = await getExternalPurchaseCustomLinkTokenIOS('acquisition');
|
|
2692
|
+
* if (result.token) {
|
|
2693
|
+
* // Report token to Apple's External Purchase Server API
|
|
2694
|
+
* await reportToApple(result.token);
|
|
2695
|
+
* }
|
|
2696
|
+
* ```
|
|
2697
|
+
*/
|
|
2698
|
+
export const getExternalPurchaseCustomLinkTokenIOS = async (
|
|
2699
|
+
tokenType: ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
2700
|
+
): Promise<ExternalPurchaseCustomLinkTokenResultIOS> => {
|
|
2701
|
+
if (Platform.OS !== 'ios') {
|
|
2702
|
+
throw new Error(
|
|
2703
|
+
'External purchase custom link is only supported on iOS 18.1+',
|
|
2704
|
+
);
|
|
2705
|
+
}
|
|
2706
|
+
try {
|
|
2707
|
+
return await IAP.instance.getExternalPurchaseCustomLinkTokenIOS(tokenType);
|
|
2708
|
+
} catch (error) {
|
|
2709
|
+
RnIapConsole.error(
|
|
2710
|
+
'Failed to get external purchase custom link token:',
|
|
2711
|
+
error,
|
|
2712
|
+
);
|
|
2713
|
+
throw error;
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
|
|
2717
|
+
/**
|
|
2718
|
+
* Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
|
|
2719
|
+
* Displays the system disclosure notice sheet for custom external purchase links.
|
|
2720
|
+
* Call this after a deliberate customer interaction before linking out to external purchases.
|
|
2721
|
+
*
|
|
2722
|
+
* @param noticeType - Notice type: 'browser' (external purchases displayed in browser)
|
|
2723
|
+
* @returns Promise<ExternalPurchaseCustomLinkNoticeResultIOS> - Result with continued status and error if any
|
|
2724
|
+
* @platform iOS
|
|
2725
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
|
|
2726
|
+
*
|
|
2727
|
+
* @example
|
|
2728
|
+
* ```typescript
|
|
2729
|
+
* const result = await showExternalPurchaseCustomLinkNoticeIOS('browser');
|
|
2730
|
+
* if (result.continued) {
|
|
2731
|
+
* // User agreed to continue to external purchase
|
|
2732
|
+
* await Linking.openURL('https://your-store.com/checkout');
|
|
2733
|
+
* }
|
|
2734
|
+
* ```
|
|
2735
|
+
*/
|
|
2736
|
+
export const showExternalPurchaseCustomLinkNoticeIOS = async (
|
|
2737
|
+
noticeType: ExternalPurchaseCustomLinkNoticeTypeIOS,
|
|
2738
|
+
): Promise<ExternalPurchaseCustomLinkNoticeResultIOS> => {
|
|
2739
|
+
if (Platform.OS !== 'ios') {
|
|
2740
|
+
throw new Error(
|
|
2741
|
+
'External purchase custom link is only supported on iOS 18.1+',
|
|
2742
|
+
);
|
|
2743
|
+
}
|
|
2744
|
+
try {
|
|
2745
|
+
return await IAP.instance.showExternalPurchaseCustomLinkNoticeIOS(
|
|
2746
|
+
noticeType,
|
|
2747
|
+
);
|
|
2748
|
+
} catch (error) {
|
|
2749
|
+
RnIapConsole.error(
|
|
2750
|
+
'Failed to show external purchase custom link notice:',
|
|
2751
|
+
error,
|
|
2752
|
+
);
|
|
2753
|
+
throw error;
|
|
2754
|
+
}
|
|
2755
|
+
};
|
package/src/specs/RnIap.nitro.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import type {HybridObject} from 'react-native-nitro-modules';
|
|
2
|
+
|
|
3
|
+
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
4
|
+
// ║ NITRO MODULE CONSTRAINTS ║
|
|
5
|
+
// ╠══════════════════════════════════════════════════════════════════════════╣
|
|
6
|
+
// ║ Nitro Modules (react-native-nitro-modules) has specific limitations ║
|
|
7
|
+
// ║ when generating C++/Swift/Kotlin bridge code from TypeScript types: ║
|
|
8
|
+
// ║ ║
|
|
9
|
+
// ║ 1. UNION TYPES REQUIRE 2+ VALUES ║
|
|
10
|
+
// ║ - Single-value unions like `type Foo = 'bar'` cause codegen errors ║
|
|
11
|
+
// ║ - Error: "String literal 'x' cannot be represented in C++ because ║
|
|
12
|
+
// ║ it is ambiguous between a string and a discriminating union enum" ║
|
|
13
|
+
// ║ - Solution: Add a fallback value (e.g., 'unspecified') to make 2+ ║
|
|
14
|
+
// ║ ║
|
|
15
|
+
// ║ 2. TYPES MUST BE DEFINED IN THIS FILE OR IMPORTED AS `type` ║
|
|
16
|
+
// ║ - Nitro codegen reads this file to generate native bridge code ║
|
|
17
|
+
// ║ - Interface types from types.ts can be imported and used directly ║
|
|
18
|
+
// ║ - Union types with 2+ values can be imported from types.ts ║
|
|
19
|
+
// ║ - Single-value unions must be redefined locally with extra values ║
|
|
20
|
+
// ╚══════════════════════════════════════════════════════════════════════════╝
|
|
21
|
+
|
|
2
22
|
// NOTE: This Nitro spec re-exports types from the generated schema (src/types.ts)
|
|
3
23
|
// via type aliases to avoid duplicating structure. Nitro's codegen expects the
|
|
4
24
|
// canonical `Nitro*` names defined here, so we keep the aliases rather than
|
|
@@ -8,6 +28,11 @@ import type {
|
|
|
8
28
|
AndroidSubscriptionOfferInput,
|
|
9
29
|
DeepLinkOptions,
|
|
10
30
|
InitConnectionConfig,
|
|
31
|
+
ExternalPurchaseCustomLinkNoticeResultIOS,
|
|
32
|
+
ExternalPurchaseCustomLinkTokenResultIOS,
|
|
33
|
+
// ExternalPurchaseCustomLinkTokenTypeIOS has 2 values ('acquisition' | 'services')
|
|
34
|
+
// so it can be imported directly from types.ts
|
|
35
|
+
ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
11
36
|
ExternalPurchaseLinkResultIOS,
|
|
12
37
|
ExternalPurchaseNoticeResultIOS,
|
|
13
38
|
MutationFinishTransactionArgs,
|
|
@@ -28,9 +53,25 @@ import type {
|
|
|
28
53
|
WinBackOfferInputIOS,
|
|
29
54
|
} from '../types';
|
|
30
55
|
|
|
31
|
-
//
|
|
56
|
+
// ╔══════════════════════════════════════════════════════════════════════════╗
|
|
57
|
+
// ║ LOCAL TYPE DEFINITIONS FOR NITRO ║
|
|
58
|
+
// ╠══════════════════════════════════════════════════════════════════════════╣
|
|
59
|
+
// ║ Types below are defined locally because: ║
|
|
60
|
+
// ║ - GQL-generated type has only 1 value (Nitro requires 2+), OR ║
|
|
61
|
+
// ║ - Nitro codegen needs the type defined in this file for bridge gen ║
|
|
62
|
+
// ╚══════════════════════════════════════════════════════════════════════════╝
|
|
63
|
+
|
|
64
|
+
// ExternalPurchaseCustomLinkNoticeTypeIOS (iOS 18.1+)
|
|
65
|
+
// GQL type: 'browser' (1 value) → Nitro requires 2+ values
|
|
66
|
+
// Added 'unspecified' as fallback to satisfy Nitro constraint
|
|
67
|
+
export type ExternalPurchaseCustomLinkNoticeTypeIOS = 'browser' | 'unspecified';
|
|
68
|
+
|
|
69
|
+
// Platform identifier for cross-platform purchase/product data
|
|
70
|
+
// Defined locally for Nitro codegen (not in GQL schema)
|
|
32
71
|
export type IapPlatform = 'ios' | 'android';
|
|
33
72
|
|
|
73
|
+
// IAPKit purchase state enum for receipt verification
|
|
74
|
+
// Defined locally for Nitro codegen (IAPKit-specific, not in GQL schema)
|
|
34
75
|
export type IapkitPurchaseState =
|
|
35
76
|
| 'entitled'
|
|
36
77
|
| 'pending-acknowledgment'
|
|
@@ -42,13 +83,17 @@ export type IapkitPurchaseState =
|
|
|
42
83
|
| 'unknown'
|
|
43
84
|
| 'inauthentic';
|
|
44
85
|
|
|
45
|
-
//
|
|
86
|
+
// Store identifier for purchase origin
|
|
87
|
+
// Defined locally for Nitro codegen (not in GQL schema)
|
|
46
88
|
export type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';
|
|
47
89
|
|
|
48
|
-
//
|
|
90
|
+
// Purchase verification provider selection
|
|
91
|
+
// Defined locally for Nitro codegen (not in GQL schema)
|
|
49
92
|
export type PurchaseVerificationProvider = 'iapkit' | 'none';
|
|
50
93
|
|
|
51
|
-
// Billing Programs API
|
|
94
|
+
// Billing Programs API (Android)
|
|
95
|
+
// GQL type exists but defined locally for Nitro codegen consistency
|
|
96
|
+
// Android 8.2.0+, 8.3.0+ for external-payments, 7.0+ for user-choice-billing
|
|
52
97
|
export type BillingProgramAndroid =
|
|
53
98
|
| 'unspecified'
|
|
54
99
|
| 'external-content-link'
|
|
@@ -57,16 +102,21 @@ export type BillingProgramAndroid =
|
|
|
57
102
|
| 'user-choice-billing';
|
|
58
103
|
|
|
59
104
|
// Developer Billing Launch Mode (Android 8.3.0+)
|
|
105
|
+
// Defined locally for Nitro codegen
|
|
60
106
|
export type DeveloperBillingLaunchModeAndroid =
|
|
61
107
|
| 'unspecified'
|
|
62
108
|
| 'launch-in-external-browser-or-app'
|
|
63
109
|
| 'caller-will-launch-link';
|
|
64
110
|
|
|
111
|
+
// External Link Launch Mode (Android 8.2.0+)
|
|
112
|
+
// Defined locally for Nitro codegen
|
|
65
113
|
export type ExternalLinkLaunchModeAndroid =
|
|
66
114
|
| 'unspecified'
|
|
67
115
|
| 'launch-in-external-browser-or-app'
|
|
68
116
|
| 'caller-will-launch-link';
|
|
69
117
|
|
|
118
|
+
// External Link Type (Android 8.2.0+)
|
|
119
|
+
// Defined locally for Nitro codegen
|
|
70
120
|
export type ExternalLinkTypeAndroid =
|
|
71
121
|
| 'unspecified'
|
|
72
122
|
| 'link-to-digital-content-offer'
|
|
@@ -1127,4 +1177,45 @@ export interface RnIap extends HybridObject<{ios: 'swift'; android: 'kotlin'}> {
|
|
|
1127
1177
|
presentExternalPurchaseLinkIOS(
|
|
1128
1178
|
url: string,
|
|
1129
1179
|
): Promise<ExternalPurchaseLinkResultIOS>;
|
|
1180
|
+
|
|
1181
|
+
// ╔════════════════════════════════════════════════════════════════════════╗
|
|
1182
|
+
// ║ EXTERNAL PURCHASE CUSTOM LINK (iOS 18.1+) ║
|
|
1183
|
+
// ╚════════════════════════════════════════════════════════════════════════╝
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
|
|
1187
|
+
* Returns true if the app can use custom external purchase links.
|
|
1188
|
+
*
|
|
1189
|
+
* @returns Promise<boolean> - true if eligible
|
|
1190
|
+
* @platform iOS
|
|
1191
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
|
|
1192
|
+
*/
|
|
1193
|
+
isEligibleForExternalPurchaseCustomLinkIOS(): Promise<boolean>;
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Get external purchase token for reporting to Apple (iOS 18.1+).
|
|
1197
|
+
* Use this token with Apple's External Purchase Server API to report transactions.
|
|
1198
|
+
*
|
|
1199
|
+
* @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)
|
|
1200
|
+
* @returns Promise<ExternalPurchaseCustomLinkTokenResultIOS> - Result with token string or error
|
|
1201
|
+
* @platform iOS
|
|
1202
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
|
|
1203
|
+
*/
|
|
1204
|
+
getExternalPurchaseCustomLinkTokenIOS(
|
|
1205
|
+
tokenType: ExternalPurchaseCustomLinkTokenTypeIOS,
|
|
1206
|
+
): Promise<ExternalPurchaseCustomLinkTokenResultIOS>;
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
|
|
1210
|
+
* Displays the system disclosure notice sheet for custom external purchase links.
|
|
1211
|
+
* Call this after a deliberate customer interaction before linking out to external purchases.
|
|
1212
|
+
*
|
|
1213
|
+
* @param noticeType - Notice type: 'browser' (external purchases displayed in browser)
|
|
1214
|
+
* @returns Promise<ExternalPurchaseCustomLinkNoticeResultIOS> - Result with continued status and error if any
|
|
1215
|
+
* @platform iOS
|
|
1216
|
+
* @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
|
|
1217
|
+
*/
|
|
1218
|
+
showExternalPurchaseCustomLinkNoticeIOS(
|
|
1219
|
+
noticeType: ExternalPurchaseCustomLinkNoticeTypeIOS,
|
|
1220
|
+
): Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
|
|
1130
1221
|
}
|
package/src/types.ts
CHANGED
|
@@ -386,7 +386,40 @@ export interface ExternalOfferReportingDetailsAndroid {
|
|
|
386
386
|
externalTransactionToken: string;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
/** Result of
|
|
389
|
+
/** Result of showing ExternalPurchaseCustomLink notice (iOS 18.1+). */
|
|
390
|
+
export interface ExternalPurchaseCustomLinkNoticeResultIOS {
|
|
391
|
+
/** Whether the user chose to continue to external purchase */
|
|
392
|
+
continued: boolean;
|
|
393
|
+
/** Optional error message if the presentation failed */
|
|
394
|
+
error?: (string | null);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Notice types for ExternalPurchaseCustomLink (iOS 18.1+).
|
|
399
|
+
* Determines the style of disclosure notice to display.
|
|
400
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/noticetype
|
|
401
|
+
*/
|
|
402
|
+
export type ExternalPurchaseCustomLinkNoticeTypeIOS = 'browser';
|
|
403
|
+
|
|
404
|
+
/** Result of requesting an ExternalPurchaseCustomLink token (iOS 18.1+). */
|
|
405
|
+
export interface ExternalPurchaseCustomLinkTokenResultIOS {
|
|
406
|
+
/** Optional error message if token retrieval failed */
|
|
407
|
+
error?: (string | null);
|
|
408
|
+
/**
|
|
409
|
+
* The external purchase token string.
|
|
410
|
+
* Report this token to Apple's External Purchase Server API.
|
|
411
|
+
*/
|
|
412
|
+
token?: (string | null);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Token types for ExternalPurchaseCustomLink (iOS 18.1+).
|
|
417
|
+
* Used to request different types of external purchase tokens for reporting to Apple.
|
|
418
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
|
|
419
|
+
*/
|
|
420
|
+
export type ExternalPurchaseCustomLinkTokenTypeIOS = 'acquisition' | 'services';
|
|
421
|
+
|
|
422
|
+
/** Result of presenting an external purchase link */
|
|
390
423
|
export interface ExternalPurchaseLinkResultIOS {
|
|
391
424
|
/** Optional error message if the presentation failed */
|
|
392
425
|
error?: (string | null);
|
|
@@ -394,13 +427,22 @@ export interface ExternalPurchaseLinkResultIOS {
|
|
|
394
427
|
success: boolean;
|
|
395
428
|
}
|
|
396
429
|
|
|
397
|
-
/** User actions on external purchase notice sheet (iOS
|
|
430
|
+
/** User actions on external purchase notice sheet (iOS 17.4+) */
|
|
398
431
|
export type ExternalPurchaseNoticeAction = 'continue' | 'dismissed';
|
|
399
432
|
|
|
400
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* Result of presenting external purchase notice sheet (iOS 17.4+)
|
|
435
|
+
* Returns the token when user continues to external purchase.
|
|
436
|
+
*/
|
|
401
437
|
export interface ExternalPurchaseNoticeResultIOS {
|
|
402
438
|
/** Optional error message if the presentation failed */
|
|
403
439
|
error?: (string | null);
|
|
440
|
+
/**
|
|
441
|
+
* External purchase token returned when user continues (iOS 17.4+).
|
|
442
|
+
* This token should be reported to Apple's External Purchase Server API.
|
|
443
|
+
* Only present when result is Continue.
|
|
444
|
+
*/
|
|
445
|
+
externalPurchaseToken?: (string | null);
|
|
404
446
|
/** Notice result indicating user action */
|
|
405
447
|
result: ExternalPurchaseNoticeAction;
|
|
406
448
|
}
|
|
@@ -527,9 +569,13 @@ export interface Mutation {
|
|
|
527
569
|
launchExternalLinkAndroid: Promise<boolean>;
|
|
528
570
|
/** Present the App Store code redemption sheet */
|
|
529
571
|
presentCodeRedemptionSheetIOS: Promise<boolean>;
|
|
530
|
-
/** Present external purchase custom link with StoreKit UI
|
|
572
|
+
/** Present external purchase custom link with StoreKit UI */
|
|
531
573
|
presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;
|
|
532
|
-
/**
|
|
574
|
+
/**
|
|
575
|
+
* Present external purchase notice sheet (iOS 17.4+).
|
|
576
|
+
* Uses ExternalPurchase.presentNoticeSheet() which returns a token when user continues.
|
|
577
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet()
|
|
578
|
+
*/
|
|
533
579
|
presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;
|
|
534
580
|
/** Initiate a purchase flow; rely on events for final state */
|
|
535
581
|
requestPurchase?: Promise<(Purchase | Purchase[] | null)>;
|
|
@@ -553,6 +599,13 @@ export interface Mutation {
|
|
|
553
599
|
* Throws OpenIapError.NotPrepared if billing client not ready
|
|
554
600
|
*/
|
|
555
601
|
showAlternativeBillingDialogAndroid: Promise<boolean>;
|
|
602
|
+
/**
|
|
603
|
+
* Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).
|
|
604
|
+
* Displays the system disclosure notice sheet for custom external purchase links.
|
|
605
|
+
* Call this after a deliberate customer interaction before linking out to external purchases.
|
|
606
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)
|
|
607
|
+
*/
|
|
608
|
+
showExternalPurchaseCustomLinkNoticeIOS: Promise<ExternalPurchaseCustomLinkNoticeResultIOS>;
|
|
556
609
|
/** Open subscription management UI and return changed purchases (iOS 15+) */
|
|
557
610
|
showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;
|
|
558
611
|
/** Force a StoreKit sync for transactions (iOS 15+) */
|
|
@@ -611,6 +664,8 @@ export type MutationRequestPurchaseArgs =
|
|
|
611
664
|
};
|
|
612
665
|
|
|
613
666
|
|
|
667
|
+
export type MutationShowExternalPurchaseCustomLinkNoticeIosArgs = ExternalPurchaseCustomLinkNoticeTypeIOS;
|
|
668
|
+
|
|
614
669
|
export type MutationValidateReceiptArgs = VerifyPurchaseProps;
|
|
615
670
|
|
|
616
671
|
export type MutationVerifyPurchaseArgs = VerifyPurchaseProps;
|
|
@@ -1053,7 +1108,10 @@ export type PurchaseState = 'pending' | 'purchased' | 'unknown';
|
|
|
1053
1108
|
export type PurchaseVerificationProvider = 'iapkit';
|
|
1054
1109
|
|
|
1055
1110
|
export interface Query {
|
|
1056
|
-
/**
|
|
1111
|
+
/**
|
|
1112
|
+
* Check if external purchase notice sheet can be presented (iOS 17.4+)
|
|
1113
|
+
* Uses ExternalPurchase.canPresent
|
|
1114
|
+
*/
|
|
1057
1115
|
canPresentExternalPurchaseNoticeIOS: Promise<boolean>;
|
|
1058
1116
|
/** Get current StoreKit 2 entitlements (iOS 15+) */
|
|
1059
1117
|
currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;
|
|
@@ -1065,6 +1123,12 @@ export interface Query {
|
|
|
1065
1123
|
getAppTransactionIOS?: Promise<(AppTransaction | null)>;
|
|
1066
1124
|
/** Get all available purchases for the current user */
|
|
1067
1125
|
getAvailablePurchases: Promise<Purchase[]>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Get external purchase token for reporting to Apple (iOS 18.1+).
|
|
1128
|
+
* Use this token with Apple's External Purchase Server API to report transactions.
|
|
1129
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)
|
|
1130
|
+
*/
|
|
1131
|
+
getExternalPurchaseCustomLinkTokenIOS: Promise<ExternalPurchaseCustomLinkTokenResultIOS>;
|
|
1068
1132
|
/** Retrieve all pending transactions in the StoreKit queue */
|
|
1069
1133
|
getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
|
|
1070
1134
|
/** Get the currently promoted product (iOS 11+) */
|
|
@@ -1082,6 +1146,12 @@ export interface Query {
|
|
|
1082
1146
|
getTransactionJwsIOS?: Promise<(string | null)>;
|
|
1083
1147
|
/** Check whether the user has active subscriptions */
|
|
1084
1148
|
hasActiveSubscriptions: Promise<boolean>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).
|
|
1151
|
+
* Returns true if the app can use custom external purchase links.
|
|
1152
|
+
* Reference: https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible
|
|
1153
|
+
*/
|
|
1154
|
+
isEligibleForExternalPurchaseCustomLinkIOS: Promise<boolean>;
|
|
1085
1155
|
/** Check introductory offer eligibility for a subscription group */
|
|
1086
1156
|
isEligibleForIntroOfferIOS: Promise<boolean>;
|
|
1087
1157
|
/** Verify a StoreKit 2 transaction signature */
|
|
@@ -1107,6 +1177,8 @@ export type QueryGetActiveSubscriptionsArgs = (string[] | null) | undefined;
|
|
|
1107
1177
|
|
|
1108
1178
|
export type QueryGetAvailablePurchasesArgs = (PurchaseOptions | null) | undefined;
|
|
1109
1179
|
|
|
1180
|
+
export type QueryGetExternalPurchaseCustomLinkTokenIosArgs = ExternalPurchaseCustomLinkTokenTypeIOS;
|
|
1181
|
+
|
|
1110
1182
|
export type QueryGetTransactionJwsIosArgs = string;
|
|
1111
1183
|
|
|
1112
1184
|
export type QueryHasActiveSubscriptionsArgs = (string[] | null) | undefined;
|
|
@@ -1742,6 +1814,7 @@ export type QueryArgsMap = {
|
|
|
1742
1814
|
getActiveSubscriptions: QueryGetActiveSubscriptionsArgs;
|
|
1743
1815
|
getAppTransactionIOS: never;
|
|
1744
1816
|
getAvailablePurchases: QueryGetAvailablePurchasesArgs;
|
|
1817
|
+
getExternalPurchaseCustomLinkTokenIOS: QueryGetExternalPurchaseCustomLinkTokenIosArgs;
|
|
1745
1818
|
getPendingTransactionsIOS: never;
|
|
1746
1819
|
getPromotedProductIOS: never;
|
|
1747
1820
|
getReceiptDataIOS: never;
|
|
@@ -1749,6 +1822,7 @@ export type QueryArgsMap = {
|
|
|
1749
1822
|
getStorefrontIOS: never;
|
|
1750
1823
|
getTransactionJwsIOS: QueryGetTransactionJwsIosArgs;
|
|
1751
1824
|
hasActiveSubscriptions: QueryHasActiveSubscriptionsArgs;
|
|
1825
|
+
isEligibleForExternalPurchaseCustomLinkIOS: never;
|
|
1752
1826
|
isEligibleForIntroOfferIOS: QueryIsEligibleForIntroOfferIosArgs;
|
|
1753
1827
|
isTransactionVerifiedIOS: QueryIsTransactionVerifiedIosArgs;
|
|
1754
1828
|
latestTransactionIOS: QueryLatestTransactionIosArgs;
|
|
@@ -1790,6 +1864,7 @@ export type MutationArgsMap = {
|
|
|
1790
1864
|
requestPurchaseOnPromotedProductIOS: never;
|
|
1791
1865
|
restorePurchases: never;
|
|
1792
1866
|
showAlternativeBillingDialogAndroid: never;
|
|
1867
|
+
showExternalPurchaseCustomLinkNoticeIOS: MutationShowExternalPurchaseCustomLinkNoticeIosArgs;
|
|
1793
1868
|
showManageSubscriptionsIOS: never;
|
|
1794
1869
|
syncIOS: never;
|
|
1795
1870
|
validateReceipt: MutationValidateReceiptArgs;
|
package/src/utils/type-bridge.ts
CHANGED
|
@@ -93,6 +93,7 @@ function normalizeProductTypeIOS(value?: Nullable<string>): ProductTypeIOS {
|
|
|
93
93
|
return 'auto-renewable-subscription';
|
|
94
94
|
case 'nonrenewingsubscription':
|
|
95
95
|
case 'non_renewing_subscription':
|
|
96
|
+
case 'non-renewing-subscription':
|
|
96
97
|
return 'non-renewing-subscription';
|
|
97
98
|
default:
|
|
98
99
|
if (value) {
|