expo-iap 2.2.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,8 +41,3 @@ android {
41
41
  abortOnError false
42
42
  }
43
43
  }
44
-
45
- dependencies {
46
- implementation "com.android.billingclient:billing-ktx:7.0.0"
47
- implementation "com.google.android.gms:play-services-base:18.1.0"
48
- }
@@ -113,6 +113,7 @@ export type ProductPurchaseIos = PurchaseBase & {
113
113
  };
114
114
  priceIos?: number;
115
115
  currencyIos?: string;
116
+ jwsRepresentationIos?: string;
116
117
  };
117
118
  export {};
118
119
  //# sourceMappingURL=ExpoIapIos.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIapIos.types.d.ts","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE3D,KAAK,qBAAqB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC;AACpE,KAAK,WAAW,GAAG,EAAE,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;AAElE,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;CACtC,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,UA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E,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionIosPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionIosPeriod;\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n verificationResultIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n};\n"]}
1
+ {"version":3,"file":"ExpoIapIos.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapIos.types.ts"],"names":[],"mappings":"","sourcesContent":["import {PurchaseBase, ProductBase} from '../ExpoIap.types';\n\ntype SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';\ntype PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';\n\ntype SubscriptionOffer = {\n displayPrice: string;\n id: string;\n paymentMode: PaymentMode;\n period: SubscriptionIosPeriod;\n periodCount: number;\n price: number;\n type: 'introductory' | 'promotional';\n};\n\ntype SubscriptionInfo = {\n introductoryOffer?: SubscriptionOffer;\n promotionalOffers?: SubscriptionOffer[];\n subscriptionGroupID: string;\n subscriptionPeriod: SubscriptionIosPeriod;\n};\n\nexport type ProductIos = ProductBase & {\n displayName: string;\n isFamilyShareable: boolean;\n jsonRepresentation: string;\n subscription: SubscriptionInfo;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n};\n\nexport type Discount = {\n identifier: string;\n type: string;\n numberOfPeriods: string;\n price: string;\n localizedPrice: string;\n paymentMode: PaymentMode;\n subscriptionPeriod: string;\n};\n\nexport type SubscriptionProductIos = ProductIos & {\n discounts?: Discount[];\n introductoryPrice?: string;\n introductoryPriceAsAmountIOS?: string;\n introductoryPricePaymentModeIOS?: PaymentMode;\n introductoryPriceNumberOfPeriodsIOS?: string;\n introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;\n subscriptionPeriodNumberIOS?: string;\n subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;\n};\n\nexport type PaymentDiscount = {\n /**\n * A string used to uniquely identify a discount offer for a product.\n */\n identifier: string;\n /**\n * A string that identifies the key used to generate the signature.\n */\n keyIdentifier: string;\n /**\n * A universally unique ID (UUID) value that you define.\n */\n nonce: string;\n /**\n * A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.\n */\n signature: string;\n /**\n * The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.\n */\n timestamp: number;\n};\n\nexport type RequestPurchaseIosProps = {\n sku: string;\n andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n /**\n * UUID representing user account\n */\n appAccountToken?: string;\n quantity?: number;\n withOffer?: PaymentDiscount;\n};\n\nexport type RequestSubscriptionIosProps = RequestPurchaseIosProps;\n\ntype SubscriptionStatus =\n | 'expired'\n | 'inBillingRetryPeriod'\n | 'inGracePeriod'\n | 'revoked'\n | 'subscribed';\n\ntype RenewalInfo = {\n jsonRepresentation?: string;\n willAutoRenew: boolean;\n autoRenewPreference?: string;\n};\n\nexport type ProductStatusIos = {\n state: SubscriptionStatus;\n renewalInfo?: RenewalInfo;\n};\n\nexport type ProductPurchaseIos = PurchaseBase & {\n // iOS basic fields\n quantityIos?: number;\n originalTransactionDateIos?: number;\n originalTransactionIdentifierIos?: string;\n verificationResultIos?: string;\n appAccountToken?: string;\n // iOS additional fields from StoreKit 2\n expirationDateIos?: number;\n webOrderLineItemIdIos?: number;\n environmentIos?: string;\n storefrontCountryCodeIos?: string;\n appBundleIdIos?: string;\n productTypeIos?: string;\n subscriptionGroupIdIos?: string;\n isUpgradedIos?: boolean;\n ownershipTypeIos?: string;\n reasonIos?: string;\n reasonStringRepresentationIos?: string;\n transactionReasonIos?: 'PURCHASE' | 'RENEWAL' | string;\n revocationDateIos?: number;\n revocationReasonIos?: string;\n offerIos?: {\n id: string;\n type: string;\n paymentMode: string;\n };\n priceIos?: number;\n currencyIos?: string;\n jwsRepresentationIos?: string;\n};\n"]}
package/bun.lockb CHANGED
Binary file
@@ -16,7 +16,7 @@ struct IapEvent {
16
16
  }
17
17
 
18
18
  @available(iOS 15.0, *)
19
- func serializeTransaction(_ transaction: Transaction) -> [String: Any?] {
19
+ func serializeTransaction(_ transaction: Transaction, jwsRepresentationIos: String? = nil) -> [String: Any?] {
20
20
  let isSubscription =
21
21
  transaction.productType.rawValue.lowercased().contains("renewable")
22
22
  || transaction.expirationDate != nil
@@ -70,6 +70,10 @@ func serializeTransaction(_ transaction: Transaction) -> [String: Any?] {
70
70
  "transactionReasonIos": transactionReasonIos,
71
71
  ]
72
72
 
73
+ if (jwsRepresentationIos != nil) {
74
+ purchaseMap["jwsRepresentationIos"] = jwsRepresentationIos
75
+ }
76
+
73
77
  if #available(iOS 16.0, *) {
74
78
  purchaseMap["environmentIos"] = transaction.environment.rawValue
75
79
  }
@@ -321,7 +325,7 @@ public class ExpoIapModule: Module {
321
325
  let signature = discountOffer?["signature"],
322
326
  let timestamp = discountOffer?["timestamp"],
323
327
  let uuidNonce = UUID(uuidString: nonce),
324
- let signatureData = signature.data(using: .utf8),
328
+ let signatureData = Data(base64Encoded: signature),
325
329
  let timestampInt = Int(timestamp)
326
330
  {
327
331
  options.insert(
@@ -361,7 +365,7 @@ public class ExpoIapModule: Module {
361
365
  return nil
362
366
  } else {
363
367
  self.transactions[String(transaction.id)] = transaction
364
- let serialized = serializeTransaction(transaction)
368
+ let serialized = serializeTransaction(transaction, jwsRepresentationIos: verification.jwsRepresentation)
365
369
  self.sendEvent(IapEvent.PurchaseUpdated, serialized)
366
370
  return serialized
367
371
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "2.2.9",
3
+ "version": "2.3.0",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,6 +1,3 @@
1
1
  import { ConfigPlugin } from 'expo/config-plugins';
2
- export declare const modifyProjectBuildGradle: (buildGradle: string) => string;
3
- interface Props {
4
- }
5
- declare const _default: ConfigPlugin<Props | undefined>;
2
+ declare const _default: ConfigPlugin<void>;
6
3
  export default _default;
@@ -1,65 +1,70 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modifyProjectBuildGradle = void 0;
4
3
  const config_plugins_1 = require("expo/config-plugins");
5
- const config_plugins_2 = require("expo/config-plugins");
6
4
  const pkg = require('../../package.json');
7
- const addToBuildGradle = (newLine, anchor, offset, buildGradle) => {
8
- const lines = buildGradle.split('\n');
9
- const lineIndex = lines.findIndex((line) => line.match(anchor));
10
- if (lineIndex === -1) {
11
- console.warn('Anchor "ext" not found in build.gradle, appending to end');
12
- lines.push(newLine);
5
+ const addLineToGradle = (content, anchor, lineToAdd, offset = 1) => {
6
+ const lines = content.split('\n');
7
+ const index = lines.findIndex((line) => line.match(anchor));
8
+ if (index === -1) {
9
+ console.warn(`Anchor "${anchor}" not found in build.gradle. Appending to end.`);
10
+ lines.push(lineToAdd);
13
11
  }
14
12
  else {
15
- lines.splice(lineIndex + offset, 0, newLine);
13
+ lines.splice(index + offset, 0, lineToAdd);
16
14
  }
17
15
  return lines.join('\n');
18
16
  };
19
- const modifyProjectBuildGradle = (buildGradle) => {
20
- const supportLibVersion = `supportLibVersion = "28.0.0"`;
21
- if (buildGradle.includes(supportLibVersion)) {
22
- return buildGradle;
17
+ const modifyProjectBuildGradle = (gradle) => {
18
+ let modified = gradle;
19
+ // 1. supportLibVersion
20
+ const supportLib = `supportLibVersion = "28.0.0"`;
21
+ if (!modified.includes(supportLib)) {
22
+ modified = addLineToGradle(modified, /ext\s*{/, supportLib);
23
23
  }
24
- return addToBuildGradle(supportLibVersion, 'ext', 1, buildGradle);
24
+ // 2. billing library
25
+ const billingDep = ` implementation "com.android.billingclient:billing-ktx:7.0.0"`;
26
+ const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
27
+ if (!modified.includes(billingDep)) {
28
+ modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
29
+ }
30
+ if (!modified.includes(gmsDep)) {
31
+ modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
32
+ }
33
+ return modified;
25
34
  };
26
- exports.modifyProjectBuildGradle = modifyProjectBuildGradle;
27
35
  const withIAPAndroid = (config) => {
28
36
  config = (0, config_plugins_1.withProjectBuildGradle)(config, (config) => {
29
- config.modResults.contents = (0, exports.modifyProjectBuildGradle)(config.modResults.contents);
37
+ config.modResults.contents = modifyProjectBuildGradle(config.modResults.contents);
30
38
  return config;
31
39
  });
32
- // Adding BILLING permission to AndroidManifest.xml
33
40
  config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
34
- console.log('Modifying AndroidManifest.xml...');
35
41
  const manifest = config.modResults;
36
42
  if (!manifest.manifest['uses-permission']) {
37
43
  manifest.manifest['uses-permission'] = [];
38
44
  }
39
45
  const permissions = manifest.manifest['uses-permission'];
40
- const billingPermission = {
41
- $: { 'android:name': 'com.android.vending.BILLING' },
42
- };
43
- if (!permissions.some((perm) => perm.$['android:name'] === 'com.android.vending.BILLING')) {
44
- permissions.push(billingPermission);
45
- console.log('Added com.android.vending.BILLING to permissions');
46
+ const billingPerm = { $: { 'android:name': 'com.android.vending.BILLING' } };
47
+ const alreadyExists = permissions.some((p) => p.$['android:name'] === 'com.android.vending.BILLING');
48
+ if (!alreadyExists) {
49
+ permissions.push(billingPerm);
50
+ console.log('✅ Added com.android.vending.BILLING to AndroidManifest.xml');
46
51
  }
47
52
  else {
48
- console.log('com.android.vending.BILLING already exists in manifest');
53
+ console.log('ℹ️ com.android.vending.BILLING already exists in AndroidManifest.xml');
49
54
  }
50
55
  return config;
51
56
  });
52
57
  return config;
53
58
  };
54
- const withIAP = (config, props) => {
59
+ const withIAP = (config, _props) => {
55
60
  try {
56
- console.log('Applying expo-iap plugin...');
57
- config = withIAPAndroid(config);
61
+ console.log('🛠️ Applying expo-iap config plugin...');
62
+ return withIAPAndroid(config);
58
63
  }
59
64
  catch (error) {
60
- config_plugins_1.WarningAggregator.addWarningAndroid('expo-iap', `There was a problem configuring expo-iap in your native Android project: ${error}`);
61
- console.error('Error in expo-iap plugin:', error);
65
+ config_plugins_1.WarningAggregator.addWarningAndroid('expo-iap', `expo-iap plugin encountered an error: ${error}`);
66
+ console.error('expo-iap plugin error:', error);
67
+ return config;
62
68
  }
63
- return config;
64
69
  };
65
- exports.default = (0, config_plugins_2.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
70
+ exports.default = (0, config_plugins_1.createRunOncePlugin)(withIAP, pkg.name, pkg.version);
@@ -2,34 +2,51 @@ import {
2
2
  WarningAggregator,
3
3
  withAndroidManifest,
4
4
  withProjectBuildGradle,
5
+ ConfigPlugin,
6
+ createRunOncePlugin,
5
7
  } from 'expo/config-plugins';
6
- import {ConfigPlugin, createRunOncePlugin} from 'expo/config-plugins';
7
8
 
8
9
  const pkg = require('../../package.json');
9
10
 
10
- const addToBuildGradle = (
11
- newLine: string,
11
+ const addLineToGradle = (
12
+ content: string,
12
13
  anchor: RegExp | string,
13
- offset: number,
14
- buildGradle: string,
15
- ) => {
16
- const lines = buildGradle.split('\n');
17
- const lineIndex = lines.findIndex((line) => line.match(anchor));
18
- if (lineIndex === -1) {
19
- console.warn('Anchor "ext" not found in build.gradle, appending to end');
20
- lines.push(newLine);
14
+ lineToAdd: string,
15
+ offset: number = 1,
16
+ ): string => {
17
+ const lines = content.split('\n');
18
+ const index = lines.findIndex((line) => line.match(anchor));
19
+ if (index === -1) {
20
+ console.warn(
21
+ `Anchor "${anchor}" not found in build.gradle. Appending to end.`,
22
+ );
23
+ lines.push(lineToAdd);
21
24
  } else {
22
- lines.splice(lineIndex + offset, 0, newLine);
25
+ lines.splice(index + offset, 0, lineToAdd);
23
26
  }
24
27
  return lines.join('\n');
25
28
  };
26
29
 
27
- export const modifyProjectBuildGradle = (buildGradle: string) => {
28
- const supportLibVersion = `supportLibVersion = "28.0.0"`;
29
- if (buildGradle.includes(supportLibVersion)) {
30
- return buildGradle;
30
+ const modifyProjectBuildGradle = (gradle: string): string => {
31
+ let modified = gradle;
32
+
33
+ // 1. supportLibVersion
34
+ const supportLib = `supportLibVersion = "28.0.0"`;
35
+ if (!modified.includes(supportLib)) {
36
+ modified = addLineToGradle(modified, /ext\s*{/, supportLib);
37
+ }
38
+
39
+ // 2. billing library
40
+ const billingDep = ` implementation "com.android.billingclient:billing-ktx:7.0.0"`;
41
+ const gmsDep = ` implementation "com.google.android.gms:play-services-base:18.1.0"`;
42
+ if (!modified.includes(billingDep)) {
43
+ modified = addLineToGradle(modified, /dependencies\s*{/, billingDep);
44
+ }
45
+ if (!modified.includes(gmsDep)) {
46
+ modified = addLineToGradle(modified, /dependencies\s*{/, gmsDep, 1);
31
47
  }
32
- return addToBuildGradle(supportLibVersion, 'ext', 1, buildGradle);
48
+
49
+ return modified;
33
50
  };
34
51
 
35
52
  const withIAPAndroid: ConfigPlugin = (config) => {
@@ -40,28 +57,27 @@ const withIAPAndroid: ConfigPlugin = (config) => {
40
57
  return config;
41
58
  });
42
59
 
43
- // Adding BILLING permission to AndroidManifest.xml
44
60
  config = withAndroidManifest(config, (config) => {
45
- console.log('Modifying AndroidManifest.xml...');
46
61
  const manifest = config.modResults;
47
-
48
62
  if (!manifest.manifest['uses-permission']) {
49
63
  manifest.manifest['uses-permission'] = [];
50
64
  }
51
65
 
52
66
  const permissions = manifest.manifest['uses-permission'];
53
- const billingPermission = {
54
- $: {'android:name': 'com.android.vending.BILLING'},
55
- };
56
- if (
57
- !permissions.some(
58
- (perm: any) => perm.$['android:name'] === 'com.android.vending.BILLING',
59
- )
60
- ) {
61
- permissions.push(billingPermission);
62
- console.log('Added com.android.vending.BILLING to permissions');
67
+ const billingPerm = {$: {'android:name': 'com.android.vending.BILLING'}};
68
+
69
+ const alreadyExists = permissions.some(
70
+ (p) => p.$['android:name'] === 'com.android.vending.BILLING',
71
+ );
72
+ if (!alreadyExists) {
73
+ permissions.push(billingPerm);
74
+ console.log(
75
+ '✅ Added com.android.vending.BILLING to AndroidManifest.xml',
76
+ );
63
77
  } else {
64
- console.log('com.android.vending.BILLING already exists in manifest');
78
+ console.log(
79
+ 'ℹ️ com.android.vending.BILLING already exists in AndroidManifest.xml',
80
+ );
65
81
  }
66
82
 
67
83
  return config;
@@ -70,20 +86,18 @@ const withIAPAndroid: ConfigPlugin = (config) => {
70
86
  return config;
71
87
  };
72
88
 
73
- interface Props {}
74
-
75
- const withIAP: ConfigPlugin<Props | undefined> = (config, props) => {
89
+ const withIAP: ConfigPlugin = (config, _props) => {
76
90
  try {
77
- console.log('Applying expo-iap plugin...');
78
- config = withIAPAndroid(config);
91
+ console.log('🛠️ Applying expo-iap config plugin...');
92
+ return withIAPAndroid(config);
79
93
  } catch (error) {
80
94
  WarningAggregator.addWarningAndroid(
81
95
  'expo-iap',
82
- `There was a problem configuring expo-iap in your native Android project: ${error}`,
96
+ `expo-iap plugin encountered an error: ${error}`,
83
97
  );
84
- console.error('Error in expo-iap plugin:', error);
98
+ console.error('expo-iap plugin error:', error);
99
+ return config;
85
100
  }
86
- return config;
87
101
  };
88
102
 
89
103
  export default createRunOncePlugin(withIAP, pkg.name, pkg.version);
@@ -133,4 +133,5 @@ export type ProductPurchaseIos = PurchaseBase & {
133
133
  };
134
134
  priceIos?: number;
135
135
  currencyIos?: string;
136
+ jwsRepresentationIos?: string;
136
137
  };