react-native-iap 15.3.6 → 15.4.0-rc.2

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 (83) hide show
  1. package/README.md +1 -1
  2. package/android/build.gradle +13 -5
  3. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -6
  4. package/ios/HybridRnIap.swift +13 -1
  5. package/lib/module/index.js +56 -16
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/module/index.kepler.js +170 -0
  8. package/lib/module/index.kepler.js.map +1 -0
  9. package/lib/module/types/amazon-devices-kepler/index.d.js +2 -0
  10. package/lib/module/types/amazon-devices-kepler/index.d.js.map +1 -0
  11. package/lib/module/types.js +5 -2
  12. package/lib/module/types.js.map +1 -1
  13. package/lib/module/utils/error.js +2 -2
  14. package/lib/module/utils/error.js.map +1 -1
  15. package/lib/module/utils/type-bridge.js +4 -1
  16. package/lib/module/utils/type-bridge.js.map +1 -1
  17. package/lib/module/vega-adapter.js +981 -0
  18. package/lib/module/vega-adapter.js.map +1 -0
  19. package/lib/module/vega.js +10 -0
  20. package/lib/module/vega.js.map +1 -0
  21. package/lib/module/vega.kepler.js +18 -0
  22. package/lib/module/vega.kepler.js.map +1 -0
  23. package/lib/typescript/src/index.d.ts +9 -2
  24. package/lib/typescript/src/index.d.ts.map +1 -1
  25. package/lib/typescript/src/index.kepler.d.ts +55 -0
  26. package/lib/typescript/src/index.kepler.d.ts.map +1 -0
  27. package/lib/typescript/src/specs/RnIap.nitro.d.ts +10 -1
  28. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  29. package/lib/typescript/src/types.d.ts +16 -3
  30. package/lib/typescript/src/types.d.ts.map +1 -1
  31. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  32. package/lib/typescript/src/vega-adapter.d.ts +76 -0
  33. package/lib/typescript/src/vega-adapter.d.ts.map +1 -0
  34. package/lib/typescript/src/vega.d.ts +4 -0
  35. package/lib/typescript/src/vega.d.ts.map +1 -0
  36. package/lib/typescript/src/vega.kepler.d.ts +4 -0
  37. package/lib/typescript/src/vega.kepler.d.ts.map +1 -0
  38. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  39. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +5 -0
  40. package/nitrogen/generated/android/c++/JIapStore.hpp +3 -0
  41. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitAmazonProps.hpp +71 -0
  42. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +9 -1
  43. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderProps.hpp +4 -0
  44. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.cpp +26 -0
  45. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.hpp +75 -0
  46. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitProps.hpp +4 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapStore.kt +2 -1
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitAmazonProps.kt +44 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +5 -2
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.kt +53 -0
  51. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +47 -0
  52. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +3 -0
  53. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +3 -0
  54. package/nitrogen/generated/ios/swift/IapStore.swift +4 -0
  55. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitAmazonProps.swift +103 -0
  56. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
  57. package/nitrogen/generated/ios/swift/Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps.swift +18 -0
  58. package/nitrogen/generated/shared/c++/IapStore.hpp +4 -0
  59. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitAmazonProps.hpp +94 -0
  60. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +8 -1
  61. package/openiap-versions.json +2 -2
  62. package/package.json +19 -12
  63. package/src/index.kepler.ts +311 -0
  64. package/src/index.ts +65 -19
  65. package/src/specs/RnIap.nitro.ts +13 -2
  66. package/src/types/amazon-devices-kepler/index.d.ts +14 -0
  67. package/src/types.ts +17 -3
  68. package/src/utils/error.ts +2 -2
  69. package/src/utils/type-bridge.ts +4 -1
  70. package/src/vega-adapter.ts +1503 -0
  71. package/src/vega.kepler.ts +21 -0
  72. package/src/vega.ts +10 -0
  73. package/android/src/test/java/com/margelo/nitro/iap/ListenerThreadSafetyTest.kt +0 -154
  74. package/android/src/test/java/com/margelo/nitro/iap/OpenIapExceptionTest.kt +0 -93
  75. package/android/src/test/java/com/margelo/nitro/iap/ProductQueryHelpersTest.kt +0 -140
  76. package/app.plugin.js +0 -1
  77. package/lib/typescript/plugin/src/withIAP.d.ts +0 -48
  78. package/lib/typescript/plugin/src/withIAP.d.ts.map +0 -1
  79. package/plugin/build/withIAP.d.ts +0 -47
  80. package/plugin/build/withIAP.js +0 -314
  81. package/plugin/src/withIAP.ts +0 -500
  82. package/plugin/tsconfig.json +0 -18
  83. package/plugin/tsconfig.tsbuildinfo +0 -1
@@ -1,500 +0,0 @@
1
- import {
2
- createRunOncePlugin,
3
- WarningAggregator,
4
- withAndroidManifest,
5
- withAppBuildGradle,
6
- withPodfile,
7
- withEntitlementsPlist,
8
- withInfoPlist,
9
- } from 'expo/config-plugins';
10
- import type {ConfigPlugin} from 'expo/config-plugins';
11
- import type {ExpoConfig} from '@expo/config-types';
12
- import {readFileSync} from 'node:fs';
13
- import {resolve as resolvePath} from 'node:path';
14
-
15
- const pkg = require('../../package.json');
16
-
17
- // Global flag to prevent duplicate logs
18
- let hasLoggedPluginExecution = false;
19
-
20
- const addLineToGradle = (
21
- content: string,
22
- anchor: RegExp | string,
23
- lineToAdd: string,
24
- offset: number = 1,
25
- ): string => {
26
- const lines = content.split('\n');
27
- const index = lines.findIndex((line) => line.match(anchor));
28
- if (index === -1) {
29
- console.warn(
30
- `Anchor "${anchor}" not found in build.gradle. Appending to end.`,
31
- );
32
- lines.push(lineToAdd);
33
- } else {
34
- lines.splice(index + offset, 0, lineToAdd);
35
- }
36
- return lines.join('\n');
37
- };
38
-
39
- export const modifyProjectBuildGradle = (gradle: string): string => {
40
- // Keep backward-compatible behavior: add supportLibVersion inside ext { } if missing
41
- if (!gradle.includes('supportLibVersion')) {
42
- const lines = gradle.split('\n');
43
- const extIndex = lines.findIndex((line) => line.trim() === 'ext {');
44
- if (extIndex !== -1) {
45
- lines.splice(extIndex + 1, 0, 'supportLibVersion = "28.0.0"');
46
- return lines.join('\n');
47
- }
48
- }
49
- return gradle;
50
- };
51
-
52
- const OPENIAP_COORD = 'io.github.hyochan.openiap:openiap-google';
53
-
54
- function loadOpenIapConfig(): {google: string} {
55
- const versionsPath = resolvePath(__dirname, '../../openiap-versions.json');
56
- try {
57
- const raw = readFileSync(versionsPath, 'utf8');
58
- const parsed = JSON.parse(raw);
59
- const googleVersion =
60
- typeof parsed?.google === 'string' ? parsed.google.trim() : '';
61
- if (!googleVersion) {
62
- throw new Error(
63
- 'react-native-iap: "google" version missing or invalid in openiap-versions.json',
64
- );
65
- }
66
- return {google: googleVersion};
67
- } catch (error) {
68
- throw new Error(
69
- `react-native-iap: Unable to load openiap-versions.json (${error instanceof Error ? error.message : error})`,
70
- );
71
- }
72
- }
73
-
74
- let cachedOpenIapVersion: string | null = null;
75
- const getOpenIapVersion = (): string => {
76
- if (cachedOpenIapVersion) {
77
- return cachedOpenIapVersion;
78
- }
79
- cachedOpenIapVersion = loadOpenIapConfig().google;
80
- return cachedOpenIapVersion;
81
- };
82
-
83
- const modifyAppBuildGradle = (gradle: string): string => {
84
- let modified = gradle;
85
-
86
- let openiapVersion: string;
87
- try {
88
- openiapVersion = getOpenIapVersion();
89
- } catch (error) {
90
- WarningAggregator.addWarningAndroid(
91
- 'react-native-iap',
92
- `react-native-iap: Failed to resolve OpenIAP version (${error instanceof Error ? error.message : error})`,
93
- );
94
- return gradle;
95
- }
96
-
97
- // Replace legacy Billing/GMS instructions with OpenIAP Google library
98
- // Remove any old billingclient or play-services-base lines we may have added previously
99
- modified = modified
100
- .replace(
101
- /^[ \t]*(implementation|api)[ \t]+["']com\.android\.billingclient:billing-ktx:[^"']+["'][ \t]*$/gim,
102
- '',
103
- )
104
- .replace(
105
- /^[ \t]*(implementation|api)[ \t]+["']com\.google\.android\.gms:play-services-base:[^"']+["'][ \t]*$/gim,
106
- '',
107
- )
108
- .replace(/\n{3,}/g, '\n\n');
109
-
110
- const openiapDep = ` implementation "${OPENIAP_COORD}:${openiapVersion}"`;
111
-
112
- if (!modified.includes(OPENIAP_COORD)) {
113
- if (!/dependencies\s*{/.test(modified)) {
114
- modified += `\n\ndependencies {\n${openiapDep}\n}\n`;
115
- } else {
116
- modified = addLineToGradle(modified, /dependencies\s*{/, openiapDep);
117
- }
118
- if (!hasLoggedPluginExecution) {
119
- console.log(
120
- `🛠️ react-native-iap: Added OpenIAP (${openiapVersion}) to build.gradle`,
121
- );
122
- }
123
- }
124
-
125
- return modified;
126
- };
127
-
128
- const withIapAndroid: ConfigPlugin<{iapkitApiKey?: string} | undefined> = (
129
- config,
130
- props,
131
- ) => {
132
- // Add OpenIAP dependency to app build.gradle
133
- config = withAppBuildGradle(config, (config) => {
134
- config.modResults.contents = modifyAppBuildGradle(
135
- config.modResults.contents,
136
- );
137
- return config;
138
- });
139
-
140
- config = withAndroidManifest(config, (config) => {
141
- const manifest = config.modResults;
142
- if (!manifest.manifest['uses-permission']) {
143
- manifest.manifest['uses-permission'] = [];
144
- }
145
-
146
- const permissions = manifest.manifest['uses-permission'];
147
- const billingPerm = {$: {'android:name': 'com.android.vending.BILLING'}};
148
-
149
- const alreadyExists = permissions.some(
150
- (p) => p.$['android:name'] === 'com.android.vending.BILLING',
151
- );
152
- if (!alreadyExists) {
153
- permissions.push(billingPerm);
154
- if (!hasLoggedPluginExecution) {
155
- console.log(
156
- '✅ Added com.android.vending.BILLING to AndroidManifest.xml',
157
- );
158
- }
159
- } else {
160
- if (!hasLoggedPluginExecution) {
161
- console.log(
162
- 'ℹ️ com.android.vending.BILLING already exists in AndroidManifest.xml',
163
- );
164
- }
165
- }
166
-
167
- // Add IAPKit API key as meta-data if provided
168
- if (props?.iapkitApiKey) {
169
- const application = manifest.manifest.application;
170
- const app = application?.[0];
171
- if (app) {
172
- if (!app['meta-data']) {
173
- app['meta-data'] = [];
174
- }
175
-
176
- const metaDataKey = 'dev.iapkit.API_KEY';
177
- const existingMetaData = (
178
- app['meta-data'] as {$?: {'android:name'?: string}}[]
179
- ).find((m) => m.$?.['android:name'] === metaDataKey);
180
-
181
- if (!existingMetaData) {
182
- app['meta-data'].push({
183
- $: {
184
- 'android:name': metaDataKey,
185
- 'android:value': props.iapkitApiKey,
186
- },
187
- });
188
- if (!hasLoggedPluginExecution) {
189
- console.log('✅ Added IAPKit API key to AndroidManifest.xml');
190
- }
191
- }
192
- }
193
- }
194
-
195
- return config;
196
- });
197
-
198
- return config;
199
- };
200
-
201
- export interface IosAlternativeBillingConfig {
202
- /** Country codes where external purchases are supported (ISO 3166-1 alpha-2) */
203
- countries?: string[];
204
- /** External purchase URLs per country (iOS 15.4+) */
205
- links?: Record<string, string>;
206
- /** Multiple external purchase URLs per country (iOS 17.5+, up to 5 per country) */
207
- multiLinks?: Record<string, string[]>;
208
- /** Custom link regions (iOS 18.1+) */
209
- customLinkRegions?: string[];
210
- /** Streaming link regions for music apps (iOS 18.2+) */
211
- streamingLinkRegions?: string[];
212
- /** Enable external purchase link entitlement */
213
- enableExternalPurchaseLink?: boolean;
214
- /** Enable external purchase link streaming entitlement (music apps only) */
215
- enableExternalPurchaseLinkStreaming?: boolean;
216
- }
217
-
218
- /** Add external purchase entitlements and Info.plist configuration */
219
- const withIosAlternativeBilling: ConfigPlugin<
220
- IosAlternativeBillingConfig | undefined
221
- > = (config, options) => {
222
- if (!options || !options.countries || options.countries.length === 0) {
223
- return config;
224
- }
225
-
226
- // Add entitlements
227
- config = withEntitlementsPlist(config, (config) => {
228
- // Always add basic external purchase entitlement when countries are specified
229
- config.modResults['com.apple.developer.storekit.external-purchase'] = true;
230
- if (!hasLoggedPluginExecution) {
231
- console.log(
232
- '✅ Added com.apple.developer.storekit.external-purchase to entitlements',
233
- );
234
- }
235
-
236
- // Add external purchase link entitlement if enabled
237
- if (options.enableExternalPurchaseLink) {
238
- config.modResults['com.apple.developer.storekit.external-purchase-link'] =
239
- true;
240
- if (!hasLoggedPluginExecution) {
241
- console.log(
242
- '✅ Added com.apple.developer.storekit.external-purchase-link to entitlements',
243
- );
244
- }
245
- }
246
-
247
- // Add streaming entitlement if enabled
248
- if (options.enableExternalPurchaseLinkStreaming) {
249
- config.modResults[
250
- 'com.apple.developer.storekit.external-purchase-link-streaming'
251
- ] = true;
252
- if (!hasLoggedPluginExecution) {
253
- console.log(
254
- '✅ Added com.apple.developer.storekit.external-purchase-link-streaming to entitlements',
255
- );
256
- }
257
- }
258
-
259
- return config;
260
- });
261
-
262
- // Add Info.plist configuration
263
- config = withInfoPlist(config, (config) => {
264
- const plist = config.modResults;
265
-
266
- // Helper function to normalize country codes to uppercase
267
- const normalize = (code: string) => code.trim().toUpperCase();
268
-
269
- // 1. SKExternalPurchase (Required)
270
- const normalizedCountries = options.countries?.map(normalize);
271
- plist.SKExternalPurchase = normalizedCountries;
272
- if (!hasLoggedPluginExecution) {
273
- console.log(
274
- `✅ Added SKExternalPurchase with countries: ${normalizedCountries?.join(
275
- ', ',
276
- )}`,
277
- );
278
- }
279
-
280
- // 2. SKExternalPurchaseLink (Optional - iOS 15.4+)
281
- if (options.links && Object.keys(options.links).length > 0) {
282
- plist.SKExternalPurchaseLink = Object.fromEntries(
283
- Object.entries(options.links).map(([code, url]) => [
284
- normalize(code),
285
- url,
286
- ]),
287
- );
288
- if (!hasLoggedPluginExecution) {
289
- console.log(
290
- `✅ Added SKExternalPurchaseLink for ${
291
- Object.keys(options.links).length
292
- } countries`,
293
- );
294
- }
295
- }
296
-
297
- // 3. SKExternalPurchaseMultiLink (iOS 17.5+)
298
- if (options.multiLinks && Object.keys(options.multiLinks).length > 0) {
299
- plist.SKExternalPurchaseMultiLink = Object.fromEntries(
300
- Object.entries(options.multiLinks).map(([code, urls]) => [
301
- normalize(code),
302
- urls,
303
- ]),
304
- );
305
- if (!hasLoggedPluginExecution) {
306
- console.log(
307
- `✅ Added SKExternalPurchaseMultiLink for ${
308
- Object.keys(options.multiLinks).length
309
- } countries`,
310
- );
311
- }
312
- }
313
-
314
- // 4. SKExternalPurchaseCustomLinkRegions (iOS 18.1+)
315
- if (options.customLinkRegions && options.customLinkRegions.length > 0) {
316
- plist.SKExternalPurchaseCustomLinkRegions =
317
- options.customLinkRegions.map(normalize);
318
- if (!hasLoggedPluginExecution) {
319
- console.log(
320
- `✅ Added SKExternalPurchaseCustomLinkRegions: ${options.customLinkRegions
321
- .map(normalize)
322
- .join(', ')}`,
323
- );
324
- }
325
- }
326
-
327
- // 5. SKExternalPurchaseLinkStreamingRegions (iOS 18.2+)
328
- if (
329
- options.streamingLinkRegions &&
330
- options.streamingLinkRegions.length > 0
331
- ) {
332
- plist.SKExternalPurchaseLinkStreamingRegions =
333
- options.streamingLinkRegions.map(normalize);
334
- if (!hasLoggedPluginExecution) {
335
- console.log(
336
- `✅ Added SKExternalPurchaseLinkStreamingRegions: ${options.streamingLinkRegions
337
- .map(normalize)
338
- .join(', ')}`,
339
- );
340
- }
341
- }
342
-
343
- return config;
344
- });
345
-
346
- return config;
347
- };
348
-
349
- type IapPluginProps = {
350
- ios?: {
351
- // Enable to inject Folly coroutine-disabling macros into Podfile during prebuild
352
- 'with-folly-no-coroutines'?: boolean;
353
- // @deprecated Use 'with-folly-no-coroutines'. Kept for backward compatibility.
354
- 'with-folly-no-couroutines'?: boolean;
355
- };
356
- /**
357
- * iOS Alternative Billing configuration.
358
- * Configure external purchase countries, links, and entitlements.
359
- * Requires approval from Apple.
360
- * @platform ios
361
- */
362
- iosAlternativeBilling?: IosAlternativeBillingConfig;
363
- /**
364
- * IAPKit project key for managed purchase verification.
365
- * This key will be added to AndroidManifest.xml (as meta-data) and Info.plist.
366
- * Get your project key from https://kit.openiap.dev
367
- */
368
- iapkitApiKey?: string;
369
- };
370
-
371
- const withIapIosFollyWorkaround: ConfigPlugin<IapPluginProps | undefined> = (
372
- config,
373
- props,
374
- ) => {
375
- const newKey = props?.ios?.['with-folly-no-coroutines'];
376
- const oldKey = props?.ios?.['with-folly-no-couroutines'];
377
- if (oldKey && !hasLoggedPluginExecution) {
378
- // Temporary deprecation notice; remove when old key is dropped
379
- WarningAggregator.addWarningIOS(
380
- 'react-native-iap',
381
- "react-native-iap: 'ios.with-folly-no-couroutines' is deprecated; use 'ios.with-folly-no-coroutines'.",
382
- );
383
- }
384
- const enabled = !!(newKey ?? oldKey);
385
- if (!enabled) return config;
386
-
387
- return withPodfile(config, (config) => {
388
- let contents = config.modResults.contents;
389
-
390
- // Idempotency: if any of the defines already exists, assume it's applied
391
- if (
392
- contents.includes('FOLLY_CFG_NO_COROUTINES') ||
393
- contents.includes('FOLLY_HAS_COROUTINES=0')
394
- ) {
395
- return config;
396
- }
397
-
398
- const anchor = 'post_install do |installer|';
399
- const snippet = `
400
- # react-native-iap (expo): Disable Folly coroutines to avoid including non-vendored <folly/coro/*> headers
401
- installer.pods_project.targets.each do |target|
402
- target.build_configurations.each do |config|
403
- defs = (config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)'])
404
- defs << 'FOLLY_NO_CONFIG=1' unless defs.any? { |d| d.to_s.include?('FOLLY_NO_CONFIG') }
405
- # Portability.h respects FOLLY_CFG_NO_COROUTINES to fully disable coroutine support
406
- defs << 'FOLLY_CFG_NO_COROUTINES=1' unless defs.any? { |d| d.to_s.include?('FOLLY_CFG_NO_COROUTINES') }
407
- defs << 'FOLLY_HAS_COROUTINES=0' unless defs.any? { |d| d.to_s.include?('FOLLY_HAS_COROUTINES') }
408
- config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs
409
- end
410
- end`;
411
-
412
- if (contents.includes(anchor)) {
413
- contents = contents.replace(anchor, `${anchor}\n${snippet}`);
414
- } else {
415
- // As a fallback, append a new post_install block
416
- contents += `
417
-
418
- ${anchor}
419
- ${snippet}
420
- end
421
- `;
422
- }
423
-
424
- config.modResults.contents = contents;
425
- return config;
426
- });
427
- };
428
-
429
- /** Add IAPKit API key to iOS Info.plist */
430
- const withIapkitApiKeyIOS: ConfigPlugin<string | undefined> = (
431
- config,
432
- apiKey,
433
- ) => {
434
- if (!apiKey) {
435
- return config;
436
- }
437
-
438
- return withInfoPlist(config, (config) => {
439
- const plist = config.modResults;
440
- const plistKey = 'IAPKitAPIKey';
441
-
442
- if (!plist[plistKey]) {
443
- plist[plistKey] = apiKey;
444
- if (!hasLoggedPluginExecution) {
445
- console.log('✅ Added IAPKit API key to Info.plist');
446
- }
447
- }
448
-
449
- return config;
450
- });
451
- };
452
-
453
- const withIAP: ConfigPlugin<IapPluginProps | undefined> = (config, props) => {
454
- try {
455
- let result = withIapAndroid(config, {iapkitApiKey: props?.iapkitApiKey});
456
- result = withIapIosFollyWorkaround(result, props);
457
- // Add iOS alternative billing configuration if provided
458
- if (props?.iosAlternativeBilling) {
459
- result = withIosAlternativeBilling(result, props.iosAlternativeBilling);
460
- }
461
- // Add IAPKit API key to iOS Info.plist if provided
462
- if (props?.iapkitApiKey) {
463
- result = withIapkitApiKeyIOS(result, props.iapkitApiKey);
464
- }
465
- // Set flag after first execution to prevent duplicate logs
466
- hasLoggedPluginExecution = true;
467
- return result;
468
- } catch (error) {
469
- WarningAggregator.addWarningAndroid(
470
- 'react-native-iap',
471
- `react-native-iap plugin encountered an error: ${error}`,
472
- );
473
- console.error('react-native-iap plugin error:', error);
474
- return config;
475
- }
476
- };
477
-
478
- // Standard Expo config plugin export
479
- // Export a test-friendly wrapper that accepts 1 or 2 args
480
- type IapPluginCallable = {
481
- (config: ExpoConfig): ExpoConfig;
482
- (config: ExpoConfig, props?: IapPluginProps): ExpoConfig;
483
- };
484
-
485
- const _wrapped = createRunOncePlugin(
486
- withIAP,
487
- pkg.name,
488
- pkg.version,
489
- ) as unknown as (
490
- config: ExpoConfig,
491
- props: IapPluginProps | undefined,
492
- ) => ExpoConfig;
493
-
494
- const pluginExport: IapPluginCallable = ((
495
- config: ExpoConfig,
496
- props?: IapPluginProps,
497
- ) => _wrapped(config, props)) as unknown as IapPluginCallable;
498
-
499
- export {withIosAlternativeBilling};
500
- export {pluginExport as default};
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "declaration": true,
7
- "outDir": "./build",
8
- "rootDir": "./src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "resolveJsonModule": true,
14
- "moduleResolution": "node"
15
- },
16
- "include": ["src/**/*"],
17
- "exclude": ["node_modules", "build"]
18
- }
@@ -1 +0,0 @@
1
- {"root":["./src/withIAP.ts"],"version":"5.9.2"}