capacitor-plugin-cdv-purchase 13.16.1 → 13.17.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.
@@ -36,7 +36,8 @@ repositories {
36
36
  dependencies {
37
37
  implementation fileTree(dir: 'libs', include: ['*.jar'])
38
38
  implementation project(':capacitor-android')
39
- implementation 'com.android.billingclient:billing:8.3.0'
39
+ implementation 'com.android.billingclient:billing:9.0.0'
40
+ implementation 'androidx.core:core:1.9.0'
40
41
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
41
42
  testImplementation "junit:junit:$junitVersion"
42
43
  }
@@ -91,6 +91,14 @@ public class PurchasePlugin extends Plugin implements
91
91
  /** Value for mBillingClientResult until BillingClient is connected. */
92
92
  private static final int BILLING_CLIENT_NOT_CONNECTED = -1;
93
93
 
94
+ /**
95
+ * Error code for a blocked Play Store (OEM kids mode, parental controls,
96
+ * enterprise policies). Must stay in sync with the canonical definitions
97
+ * in src/android/cc/fovea/Constants.java (ERR_STORE_BLOCKED) and
98
+ * src/ts/error-codes.ts (STORE_BLOCKED), both ERROR_CODES_BASE + 33.
99
+ */
100
+ private static final int ERR_STORE_BLOCKED = 6777033;
101
+
94
102
  /** Last response from the billing client. */
95
103
  private BillingResult mBillingClientResult = BillingResult.newBuilder()
96
104
  .setResponseCode(BILLING_CLIENT_NOT_CONNECTED).build();
@@ -353,7 +361,7 @@ public class PurchasePlugin extends Plugin implements
353
361
  private String codeToMessage(int code) {
354
362
  switch (code) {
355
363
  case BillingResponseCode.BILLING_UNAVAILABLE:
356
- return "Billing API version is not supported for the type requested";
364
+ return "Billing is not available on this device";
357
365
  case BillingResponseCode.DEVELOPER_ERROR:
358
366
  return "Invalid arguments provided to the API";
359
367
  case BillingResponseCode.ERROR:
@@ -390,6 +398,19 @@ public class PurchasePlugin extends Plugin implements
390
398
  return codeToString(code) + ": " + message;
391
399
  }
392
400
 
401
+ /**
402
+ * Check if a BillingResult indicates that the Play Store is blocked
403
+ * on this device (OEM kids mode, parental controls, enterprise policies).
404
+ *
405
+ * In GPBL V9, this condition was reclassified from ERROR to BILLING_UNAVAILABLE
406
+ * with a "Play Store is blocked" debug message.
407
+ */
408
+ private boolean isPlayStoreBlocked(final BillingResult result) {
409
+ return result.getResponseCode() == BillingResponseCode.BILLING_UNAVAILABLE
410
+ && result.getDebugMessage() != null
411
+ && result.getDebugMessage().contains("Play Store is blocked");
412
+ }
413
+
393
414
  // -------------------------------------------------------------------------
394
415
  // BillingClient connection management
395
416
  // -------------------------------------------------------------------------
@@ -514,7 +535,12 @@ public class PurchasePlugin extends Plugin implements
514
535
  }
515
536
  }, () -> {
516
537
  Log.d(TAG, "init() -> Failure: " + format(getLastResult()));
517
- call.reject("Setup failure. " + format(getLastResult()));
538
+ if (isPlayStoreBlocked(getLastResult())) {
539
+ call.reject("Play Store is blocked on this device",
540
+ String.valueOf(ERR_STORE_BLOCKED));
541
+ } else {
542
+ call.reject("Setup failure. " + format(getLastResult()));
543
+ }
518
544
  });
519
545
  }
520
546
 
@@ -792,7 +818,12 @@ public class PurchasePlugin extends Plugin implements
792
818
  Log.w(TAG, "onPurchasesUpdated() -> Failed: "
793
819
  + format(result));
794
820
  if (mPendingBuyCall != null) {
795
- mPendingBuyCall.reject(format(result), String.valueOf(code));
821
+ if (isPlayStoreBlocked(result)) {
822
+ mPendingBuyCall.reject("Play Store is blocked on this device",
823
+ String.valueOf(ERR_STORE_BLOCKED));
824
+ } else {
825
+ mPendingBuyCall.reject(format(result), String.valueOf(code));
826
+ }
796
827
  mPendingBuyCall = null;
797
828
  }
798
829
  }
package/dist/index.js CHANGED
@@ -81,6 +81,8 @@ var CdvPurchase;
81
81
  ErrorCode[ErrorCode["INVALID_SIGNATURE"] = ERROR_CODES_BASE + 31] = "INVALID_SIGNATURE";
82
82
  /** Error: Parameters are missing in a payment discount. */
83
83
  ErrorCode[ErrorCode["MISSING_OFFER_PARAMS"] = ERROR_CODES_BASE + 32] = "MISSING_OFFER_PARAMS";
84
+ /** Error: The store is blocked (e.g. Google Play blocking purchases). */
85
+ ErrorCode[ErrorCode["STORE_BLOCKED"] = ERROR_CODES_BASE + 33] = "STORE_BLOCKED";
84
86
  /**
85
87
  * Server code used when a subscription expired.
86
88
  *
@@ -672,7 +674,7 @@ var CdvPurchase;
672
674
  body.additionalData.obfuscatedUsername = obfuscated;
673
675
  }
674
676
  // Add device information
675
- body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
677
+ body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), yield CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
676
678
  // Add legacy pricing information
677
679
  if (((_c = body.offers) === null || _c === void 0 ? void 0 : _c.length) === 1) {
678
680
  const offer = body.offers[0];
@@ -1702,7 +1704,7 @@ var CdvPurchase;
1702
1704
  /**
1703
1705
  * Current release number of the plugin.
1704
1706
  */
1705
- CdvPurchase.PLUGIN_VERSION = '13.16.1';
1707
+ CdvPurchase.PLUGIN_VERSION = '13.17.1';
1706
1708
  /**
1707
1709
  * Entry class of the plugin.
1708
1710
  */
@@ -6097,8 +6099,17 @@ var CdvPurchase;
6097
6099
  }
6098
6100
  resolve(undefined);
6099
6101
  };
6100
- const iabError = (err) => {
6102
+ const iabError = (err, code) => {
6101
6103
  this.initialized = false;
6104
+ // `Number(code)` normalizes both Cordova (numeric) and Capacitor (string) error codes.
6105
+ if (Number(code) === CdvPurchase.ErrorCode.STORE_BLOCKED) {
6106
+ // The Play Store is blocked by OEM restrictions; it won't unblock,
6107
+ // so report the error and resolve without retrying.
6108
+ const error = playStoreError(CdvPurchase.ErrorCode.STORE_BLOCKED, "Init failed - " + err, null);
6109
+ this.context.error(error);
6110
+ resolve(error);
6111
+ return;
6112
+ }
6102
6113
  this.context.error(playStoreError(CdvPurchase.ErrorCode.SETUP, "Init failed - " + err, null));
6103
6114
  this.retry.retry(() => this.initialize());
6104
6115
  };
@@ -6353,6 +6364,13 @@ var CdvPurchase;
6353
6364
  const buySuccess = () => resolve(undefined);
6354
6365
  const buyFailed = (message, code) => {
6355
6366
  this.log.warn('Order failed: ' + JSON.stringify({ message, code }));
6367
+ // `Number(code)` normalizes both Cordova (numeric) and Capacitor (string) error codes.
6368
+ if (Number(code) === CdvPurchase.ErrorCode.STORE_BLOCKED) {
6369
+ // The Play Store is blocked by OEM restrictions; resolve with the
6370
+ // blocked-store error immediately.
6371
+ resolve(playStoreError(CdvPurchase.ErrorCode.STORE_BLOCKED, message, offer.productId));
6372
+ return;
6373
+ }
6356
6374
  resolve(playStoreError(code !== null && code !== void 0 ? code : CdvPurchase.ErrorCode.UNKNOWN, message, offer.productId));
6357
6375
  };
6358
6376
  if (offer.productType === CdvPurchase.ProductType.PAID_SUBSCRIPTION) {
@@ -8923,78 +8941,123 @@ var CdvPurchase;
8923
8941
  else // default: no tracking
8924
8942
  return ['analytics', 'support', 'fraud'];
8925
8943
  }
8944
+ /** Map @capacitor/device data to the cordova-plugin-device format.
8945
+ *
8946
+ * Used as a fallback when cordova-plugin-device isn't installed (typically
8947
+ * in Capacitor apps). Detected through the plugin proxy that Capacitor
8948
+ * registers at window.Capacitor.Plugins.Device, so the plugin doesn't
8949
+ * need a dependency on @capacitor/device.
8950
+ *
8951
+ * @param includeId fetch the device identifier (requires user consent) */
8952
+ function getCapacitorDevice(includeId) {
8953
+ var _a, _b, _c;
8954
+ return __awaiter(this, void 0, void 0, function* () {
8955
+ const capacitorDevice = (_b = (_a = window.Capacitor) === null || _a === void 0 ? void 0 : _a.Plugins) === null || _b === void 0 ? void 0 : _b.Device;
8956
+ if (!capacitorDevice)
8957
+ return {};
8958
+ const device = {};
8959
+ try {
8960
+ const info = yield capacitorDevice.getInfo();
8961
+ if (isObject(info)) {
8962
+ device.model = info.model;
8963
+ // match cordova-plugin-device casing ("iOS", "Android")
8964
+ device.platform = info.operatingSystem === 'ios' ? 'iOS'
8965
+ : info.operatingSystem === 'android' ? 'Android'
8966
+ : info.operatingSystem;
8967
+ device.version = info.osVersion;
8968
+ device.manufacturer = info.manufacturer;
8969
+ device.isVirtual = info.isVirtual;
8970
+ }
8971
+ }
8972
+ catch (e) { /* @capacitor/device not functional, skip device info */ }
8973
+ if (includeId) {
8974
+ try {
8975
+ const id = yield capacitorDevice.getId();
8976
+ // "identifier" since @capacitor/device v4, "uuid" before
8977
+ device.uuid = (_c = id === null || id === void 0 ? void 0 : id.identifier) !== null && _c !== void 0 ? _c : id === null || id === void 0 ? void 0 : id.uuid;
8978
+ }
8979
+ catch (e) { /* ignore, "uuid" stays undefined */ }
8980
+ }
8981
+ return device;
8982
+ });
8983
+ }
8926
8984
  function getDeviceInfo(store) {
8927
- const privacyPolicy = getPrivacyPolicy(store); // string[]
8928
- function allowed(policy) {
8929
- return privacyPolicy.indexOf(policy) >= 0;
8930
- }
8931
- // Different versions of the plugin use different response fields.
8932
- // Sending this information allows the validator to reply with only expected information.
8933
- const ret = {
8934
- plugin: 'cordova-plugin-purchase/' + CdvPurchase.PLUGIN_VERSION,
8935
- };
8936
- const wdw = window;
8937
- // the cordova-plugin-device global object
8938
- const device = isObject(wdw.device) ? wdw.device : {};
8939
- // Send the receipt validator information about the device.
8940
- // This will allow to make vendor or device specific fixes and detect class
8941
- // of devices with issues.
8942
- // Knowing running version of OS and libraries also required for handling
8943
- // support requests.
8944
- if (allowed('analytics') || allowed('support')) {
8945
- // Version of ionic (if applicable)
8946
- const ionic = wdw.Ionic || wdw.ionic;
8947
- if (ionic && ionic.version)
8948
- ret.ionic = ionic.version;
8949
- // Information from the cordova-plugin-device (if installed)
8950
- if (device.cordova)
8951
- ret.cordova = device.cordova; // Version of cordova
8952
- if (device.model)
8953
- ret.model = device.model; // Device model
8954
- if (device.platform)
8955
- ret.platform = device.platform; // OS
8956
- if (device.version)
8957
- ret.version = device.version; // OS version
8958
- if (device.manufacturer)
8959
- ret.manufacturer = device.manufacturer; // Device manufacturer
8960
- }
8961
- // Device identifiers are used for tracking users across services
8962
- // It is sometimes required for support requests too, but I choose to
8963
- // keep this out.
8964
- if (allowed('tracking')) {
8965
- if (device.serial)
8966
- ret.serial = device.serial; // Hardware serial number
8967
- if (device.uuid)
8968
- ret.uuid = device.uuid; // Device UUID
8969
- }
8970
- // Running from a simulator is an error condition for in-app purchases.
8971
- // Since only developers run in a simulator, let's always report that.
8972
- if (device.isVirtual)
8973
- ret.isVirtual = device.isVirtual; // Simulator
8974
- // Probably nobody wants to disable fraud discovery.
8975
- // A fingerprint of the device identifiers is used for fraud discovery.
8976
- // An alert should be triggered by the validator when a lot of devices
8977
- // share a single receipt.
8978
- if (allowed('fraud')) {
8979
- // For fraud discovery, we only need a fingerprint of the device.
8980
- var fingerprint = '';
8981
- if (device.serial)
8982
- fingerprint = 'serial:' + device.serial; // Hardware serial number
8983
- else if (device.uuid)
8984
- fingerprint = 'uuid:' + device.uuid; // Device UUID
8985
- else {
8986
- // Using only model and manufacturer, we might end-up with many
8987
- // users sharing the same fingerprint, which is fine for fraud discovery.
8985
+ return __awaiter(this, void 0, void 0, function* () {
8986
+ const privacyPolicy = getPrivacyPolicy(store); // string[]
8987
+ function allowed(policy) {
8988
+ return privacyPolicy.indexOf(policy) >= 0;
8989
+ }
8990
+ // Different versions of the plugin use different response fields.
8991
+ // Sending this information allows the validator to reply with only expected information.
8992
+ const ret = {
8993
+ plugin: 'cordova-plugin-purchase/' + CdvPurchase.PLUGIN_VERSION,
8994
+ };
8995
+ const wdw = window;
8996
+ // the cordova-plugin-device global object,
8997
+ // with @capacitor/device as a fallback
8998
+ const device = isObject(wdw.device)
8999
+ ? wdw.device
9000
+ : yield getCapacitorDevice(allowed('tracking') || allowed('fraud'));
9001
+ // Send the receipt validator information about the device.
9002
+ // This will allow to make vendor or device specific fixes and detect class
9003
+ // of devices with issues.
9004
+ // Knowing running version of OS and libraries also required for handling
9005
+ // support requests.
9006
+ if (allowed('analytics') || allowed('support')) {
9007
+ // Version of ionic (if applicable)
9008
+ const ionic = wdw.Ionic || wdw.ionic;
9009
+ if (ionic && ionic.version)
9010
+ ret.ionic = ionic.version;
9011
+ // Information from the cordova-plugin-device (if installed)
9012
+ if (device.cordova)
9013
+ ret.cordova = device.cordova; // Version of cordova
8988
9014
  if (device.model)
8989
- fingerprint += '/' + device.model;
9015
+ ret.model = device.model; // Device model
9016
+ if (device.platform)
9017
+ ret.platform = device.platform; // OS
9018
+ if (device.version)
9019
+ ret.version = device.version; // OS version
8990
9020
  if (device.manufacturer)
8991
- fingerprint = '/' + device.manufacturer;
9021
+ ret.manufacturer = device.manufacturer; // Device manufacturer
9022
+ }
9023
+ // Device identifiers are used for tracking users across services
9024
+ // It is sometimes required for support requests too, but I choose to
9025
+ // keep this out.
9026
+ if (allowed('tracking')) {
9027
+ if (device.serial)
9028
+ ret.serial = device.serial; // Hardware serial number
9029
+ if (device.uuid)
9030
+ ret.uuid = device.uuid; // Device UUID
9031
+ }
9032
+ // Running from a simulator is an error condition for in-app purchases.
9033
+ // Since only developers run in a simulator, let's always report that.
9034
+ if (device.isVirtual)
9035
+ ret.isVirtual = device.isVirtual; // Simulator
9036
+ // Probably nobody wants to disable fraud discovery.
9037
+ // A fingerprint of the device identifiers is used for fraud discovery.
9038
+ // An alert should be triggered by the validator when a lot of devices
9039
+ // share a single receipt.
9040
+ if (allowed('fraud')) {
9041
+ // For fraud discovery, we only need a fingerprint of the device.
9042
+ var fingerprint = '';
9043
+ if (device.serial)
9044
+ fingerprint = 'serial:' + device.serial; // Hardware serial number
9045
+ else if (device.uuid)
9046
+ fingerprint = 'uuid:' + device.uuid; // Device UUID
9047
+ else {
9048
+ // Using only model and manufacturer, we might end-up with many
9049
+ // users sharing the same fingerprint, which is fine for fraud discovery.
9050
+ if (device.model)
9051
+ fingerprint += '/' + device.model;
9052
+ if (device.manufacturer)
9053
+ fingerprint += '/' + device.manufacturer;
9054
+ }
9055
+ // Fingerprint is hashed to keep required level of privacy.
9056
+ if (fingerprint)
9057
+ ret.fingerprint = CdvPurchase.Utils.md5(fingerprint);
8992
9058
  }
8993
- // Fingerprint is hashed to keep required level of privacy.
8994
- if (fingerprint)
8995
- ret.fingerprint = CdvPurchase.Utils.md5(fingerprint);
8996
- }
8997
- return ret;
9059
+ return ret;
9060
+ });
8998
9061
  }
8999
9062
  Internal.getDeviceInfo = getDeviceInfo;
9000
9063
  })(Validator.Internal || (Validator.Internal = {}));
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["esm/index.js","../build/entry.mjs"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Set the marker so the shared store.js knows Capacitor native bridges are available\nif (typeof window !== 'undefined') {\n window.CdvPurchaseCapacitor = { installed: true };\n}\nconst PurchasePlugin = registerPlugin('PurchasePlugin');\nexport { PurchasePlugin };\n","// Capacitor bridge — sets CdvPurchaseCapacitor marker and registers native plugin\nexport { PurchasePlugin } from '../dist/esm/index.js';\n\n// Store runtime — executes the IIFE, creates window.CdvPurchase\nimport { CdvPurchase } from 'virtual:store-js';\n\n// Re-export the full namespace\nexport { CdvPurchase };\n\n// Convenience named exports\nexport const store = CdvPurchase.store;\nexport const Store = CdvPurchase.Store;\nexport const ProductType = CdvPurchase.ProductType;\nexport const Platform = CdvPurchase.Platform;\nexport const LogLevel = CdvPurchase.LogLevel;\nexport const ErrorCode = CdvPurchase.ErrorCode;\nexport const Logger = CdvPurchase.Logger;\nexport const Iaptic = CdvPurchase.Iaptic;\n"],"names":[],"mappings":";;AACA;AACA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACnC,IAAI,MAAM,CAAC,oBAAoB,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE;AACrD;AACK,MAAC,cAAc,GAAG,cAAc,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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js","sources":["esm/index.js","../build/entry.mjs"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n// Set the marker so the shared store.js knows Capacitor native bridges are available\nif (typeof window !== 'undefined') {\n window.CdvPurchaseCapacitor = { installed: true };\n}\nconst PurchasePlugin = registerPlugin('PurchasePlugin');\nexport { PurchasePlugin };\n","// Capacitor bridge — sets CdvPurchaseCapacitor marker and registers native plugin\nexport { PurchasePlugin } from '../dist/esm/index.js';\n\n// Store runtime — executes the IIFE, creates window.CdvPurchase\nimport { CdvPurchase } from 'virtual:store-js';\n\n// Re-export the full namespace\nexport { CdvPurchase };\n\n// Convenience named exports\nexport const store = CdvPurchase.store;\nexport const Store = CdvPurchase.Store;\nexport const ProductType = CdvPurchase.ProductType;\nexport const Platform = CdvPurchase.Platform;\nexport const LogLevel = CdvPurchase.LogLevel;\nexport const ErrorCode = CdvPurchase.ErrorCode;\nexport const Logger = CdvPurchase.Logger;\nexport const Iaptic = CdvPurchase.Iaptic;\n"],"names":[],"mappings":";;AACA;AACA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACnC,IAAI,MAAM,CAAC,oBAAoB,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE;AACrD;AACK,MAAC,cAAc,GAAG,cAAc,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACLtD;;AASA;AACY,MAAC,KAAK,GAAG,WAAW,CAAC;AACrB,MAAC,KAAK,GAAG,WAAW,CAAC;AACrB,MAAC,WAAW,GAAG,WAAW,CAAC;AAC3B,MAAC,QAAQ,GAAG,WAAW,CAAC;AACxB,MAAC,QAAQ,GAAG,WAAW,CAAC;AACxB,MAAC,SAAS,GAAG,WAAW,CAAC;AACzB,MAAC,MAAM,GAAG,WAAW,CAAC;AACtB,MAAC,MAAM,GAAG,WAAW,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-cdv-purchase",
3
- "version": "13.16.1",
3
+ "version": "13.17.1",
4
4
  "description": "In-App Purchases for Capacitor — iOS (StoreKit 2) and Android (Google Play Billing)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -14,8 +14,12 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "capacitor": {
17
- "ios": { "src": "ios" },
18
- "android": { "src": "android" }
17
+ "ios": {
18
+ "src": "ios"
19
+ },
20
+ "android": {
21
+ "src": "android"
22
+ }
19
23
  },
20
24
  "peerDependencies": {
21
25
  "@capacitor/core": "^6.0.0 || ^7.0.0 || ^8.0.0"
package/www/store.d.ts CHANGED
@@ -66,6 +66,8 @@ declare namespace CdvPurchase {
66
66
  INVALID_SIGNATURE,
67
67
  /** Error: Parameters are missing in a payment discount. */
68
68
  MISSING_OFFER_PARAMS,
69
+ /** Error: The store is blocked (e.g. Google Play blocking purchases). */
70
+ STORE_BLOCKED,
69
71
  /**
70
72
  * Server code used when a subscription expired.
71
73
  *
@@ -909,7 +911,7 @@ declare namespace CdvPurchase {
909
911
  /**
910
912
  * Current release number of the plugin.
911
913
  */
912
- const PLUGIN_VERSION = "13.16.1";
914
+ const PLUGIN_VERSION = "13.17.1";
913
915
  /**
914
916
  * Entry class of the plugin.
915
917
  */
@@ -6240,7 +6242,7 @@ declare namespace CdvPurchase {
6240
6242
  interface PrivacyPolicyProvider {
6241
6243
  validator_privacy_policy: undefined | string | string[];
6242
6244
  }
6243
- function getDeviceInfo(store: PrivacyPolicyProvider): DeviceInfo;
6245
+ function getDeviceInfo(store: PrivacyPolicyProvider): Promise<DeviceInfo>;
6244
6246
  }
6245
6247
  }
6246
6248
  }
package/www/store.js CHANGED
@@ -78,6 +78,8 @@ var CdvPurchase;
78
78
  ErrorCode[ErrorCode["INVALID_SIGNATURE"] = ERROR_CODES_BASE + 31] = "INVALID_SIGNATURE";
79
79
  /** Error: Parameters are missing in a payment discount. */
80
80
  ErrorCode[ErrorCode["MISSING_OFFER_PARAMS"] = ERROR_CODES_BASE + 32] = "MISSING_OFFER_PARAMS";
81
+ /** Error: The store is blocked (e.g. Google Play blocking purchases). */
82
+ ErrorCode[ErrorCode["STORE_BLOCKED"] = ERROR_CODES_BASE + 33] = "STORE_BLOCKED";
81
83
  /**
82
84
  * Server code used when a subscription expired.
83
85
  *
@@ -677,7 +679,7 @@ var CdvPurchase;
677
679
  body.additionalData.obfuscatedUsername = obfuscated;
678
680
  }
679
681
  // Add device information
680
- body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
682
+ body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), yield CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
681
683
  // Add legacy pricing information
682
684
  if (((_c = body.offers) === null || _c === void 0 ? void 0 : _c.length) === 1) {
683
685
  const offer = body.offers[0];
@@ -1720,7 +1722,7 @@ var CdvPurchase;
1720
1722
  /**
1721
1723
  * Current release number of the plugin.
1722
1724
  */
1723
- CdvPurchase.PLUGIN_VERSION = '13.16.1';
1725
+ CdvPurchase.PLUGIN_VERSION = '13.17.1';
1724
1726
  /**
1725
1727
  * Entry class of the plugin.
1726
1728
  */
@@ -6239,8 +6241,17 @@ var CdvPurchase;
6239
6241
  }
6240
6242
  resolve(undefined);
6241
6243
  };
6242
- const iabError = (err) => {
6244
+ const iabError = (err, code) => {
6243
6245
  this.initialized = false;
6246
+ // `Number(code)` normalizes both Cordova (numeric) and Capacitor (string) error codes.
6247
+ if (Number(code) === CdvPurchase.ErrorCode.STORE_BLOCKED) {
6248
+ // The Play Store is blocked by OEM restrictions; it won't unblock,
6249
+ // so report the error and resolve without retrying.
6250
+ const error = playStoreError(CdvPurchase.ErrorCode.STORE_BLOCKED, "Init failed - " + err, null);
6251
+ this.context.error(error);
6252
+ resolve(error);
6253
+ return;
6254
+ }
6244
6255
  this.context.error(playStoreError(CdvPurchase.ErrorCode.SETUP, "Init failed - " + err, null));
6245
6256
  this.retry.retry(() => this.initialize());
6246
6257
  };
@@ -6495,6 +6506,13 @@ var CdvPurchase;
6495
6506
  const buySuccess = () => resolve(undefined);
6496
6507
  const buyFailed = (message, code) => {
6497
6508
  this.log.warn('Order failed: ' + JSON.stringify({ message, code }));
6509
+ // `Number(code)` normalizes both Cordova (numeric) and Capacitor (string) error codes.
6510
+ if (Number(code) === CdvPurchase.ErrorCode.STORE_BLOCKED) {
6511
+ // The Play Store is blocked by OEM restrictions; resolve with the
6512
+ // blocked-store error immediately.
6513
+ resolve(playStoreError(CdvPurchase.ErrorCode.STORE_BLOCKED, message, offer.productId));
6514
+ return;
6515
+ }
6498
6516
  resolve(playStoreError(code !== null && code !== void 0 ? code : CdvPurchase.ErrorCode.UNKNOWN, message, offer.productId));
6499
6517
  };
6500
6518
  if (offer.productType === CdvPurchase.ProductType.PAID_SUBSCRIPTION) {
@@ -9156,78 +9174,123 @@ var CdvPurchase;
9156
9174
  else // default: no tracking
9157
9175
  return ['analytics', 'support', 'fraud'];
9158
9176
  }
9177
+ /** Map @capacitor/device data to the cordova-plugin-device format.
9178
+ *
9179
+ * Used as a fallback when cordova-plugin-device isn't installed (typically
9180
+ * in Capacitor apps). Detected through the plugin proxy that Capacitor
9181
+ * registers at window.Capacitor.Plugins.Device, so the plugin doesn't
9182
+ * need a dependency on @capacitor/device.
9183
+ *
9184
+ * @param includeId fetch the device identifier (requires user consent) */
9185
+ function getCapacitorDevice(includeId) {
9186
+ var _a, _b, _c;
9187
+ return __awaiter(this, void 0, void 0, function* () {
9188
+ const capacitorDevice = (_b = (_a = window.Capacitor) === null || _a === void 0 ? void 0 : _a.Plugins) === null || _b === void 0 ? void 0 : _b.Device;
9189
+ if (!capacitorDevice)
9190
+ return {};
9191
+ const device = {};
9192
+ try {
9193
+ const info = yield capacitorDevice.getInfo();
9194
+ if (isObject(info)) {
9195
+ device.model = info.model;
9196
+ // match cordova-plugin-device casing ("iOS", "Android")
9197
+ device.platform = info.operatingSystem === 'ios' ? 'iOS'
9198
+ : info.operatingSystem === 'android' ? 'Android'
9199
+ : info.operatingSystem;
9200
+ device.version = info.osVersion;
9201
+ device.manufacturer = info.manufacturer;
9202
+ device.isVirtual = info.isVirtual;
9203
+ }
9204
+ }
9205
+ catch (e) { /* @capacitor/device not functional, skip device info */ }
9206
+ if (includeId) {
9207
+ try {
9208
+ const id = yield capacitorDevice.getId();
9209
+ // "identifier" since @capacitor/device v4, "uuid" before
9210
+ device.uuid = (_c = id === null || id === void 0 ? void 0 : id.identifier) !== null && _c !== void 0 ? _c : id === null || id === void 0 ? void 0 : id.uuid;
9211
+ }
9212
+ catch (e) { /* ignore, "uuid" stays undefined */ }
9213
+ }
9214
+ return device;
9215
+ });
9216
+ }
9159
9217
  function getDeviceInfo(store) {
9160
- const privacyPolicy = getPrivacyPolicy(store); // string[]
9161
- function allowed(policy) {
9162
- return privacyPolicy.indexOf(policy) >= 0;
9163
- }
9164
- // Different versions of the plugin use different response fields.
9165
- // Sending this information allows the validator to reply with only expected information.
9166
- const ret = {
9167
- plugin: 'cordova-plugin-purchase/' + CdvPurchase.PLUGIN_VERSION,
9168
- };
9169
- const wdw = window;
9170
- // the cordova-plugin-device global object
9171
- const device = isObject(wdw.device) ? wdw.device : {};
9172
- // Send the receipt validator information about the device.
9173
- // This will allow to make vendor or device specific fixes and detect class
9174
- // of devices with issues.
9175
- // Knowing running version of OS and libraries also required for handling
9176
- // support requests.
9177
- if (allowed('analytics') || allowed('support')) {
9178
- // Version of ionic (if applicable)
9179
- const ionic = wdw.Ionic || wdw.ionic;
9180
- if (ionic && ionic.version)
9181
- ret.ionic = ionic.version;
9182
- // Information from the cordova-plugin-device (if installed)
9183
- if (device.cordova)
9184
- ret.cordova = device.cordova; // Version of cordova
9185
- if (device.model)
9186
- ret.model = device.model; // Device model
9187
- if (device.platform)
9188
- ret.platform = device.platform; // OS
9189
- if (device.version)
9190
- ret.version = device.version; // OS version
9191
- if (device.manufacturer)
9192
- ret.manufacturer = device.manufacturer; // Device manufacturer
9193
- }
9194
- // Device identifiers are used for tracking users across services
9195
- // It is sometimes required for support requests too, but I choose to
9196
- // keep this out.
9197
- if (allowed('tracking')) {
9198
- if (device.serial)
9199
- ret.serial = device.serial; // Hardware serial number
9200
- if (device.uuid)
9201
- ret.uuid = device.uuid; // Device UUID
9202
- }
9203
- // Running from a simulator is an error condition for in-app purchases.
9204
- // Since only developers run in a simulator, let's always report that.
9205
- if (device.isVirtual)
9206
- ret.isVirtual = device.isVirtual; // Simulator
9207
- // Probably nobody wants to disable fraud discovery.
9208
- // A fingerprint of the device identifiers is used for fraud discovery.
9209
- // An alert should be triggered by the validator when a lot of devices
9210
- // share a single receipt.
9211
- if (allowed('fraud')) {
9212
- // For fraud discovery, we only need a fingerprint of the device.
9213
- var fingerprint = '';
9214
- if (device.serial)
9215
- fingerprint = 'serial:' + device.serial; // Hardware serial number
9216
- else if (device.uuid)
9217
- fingerprint = 'uuid:' + device.uuid; // Device UUID
9218
- else {
9219
- // Using only model and manufacturer, we might end-up with many
9220
- // users sharing the same fingerprint, which is fine for fraud discovery.
9218
+ return __awaiter(this, void 0, void 0, function* () {
9219
+ const privacyPolicy = getPrivacyPolicy(store); // string[]
9220
+ function allowed(policy) {
9221
+ return privacyPolicy.indexOf(policy) >= 0;
9222
+ }
9223
+ // Different versions of the plugin use different response fields.
9224
+ // Sending this information allows the validator to reply with only expected information.
9225
+ const ret = {
9226
+ plugin: 'cordova-plugin-purchase/' + CdvPurchase.PLUGIN_VERSION,
9227
+ };
9228
+ const wdw = window;
9229
+ // the cordova-plugin-device global object,
9230
+ // with @capacitor/device as a fallback
9231
+ const device = isObject(wdw.device)
9232
+ ? wdw.device
9233
+ : yield getCapacitorDevice(allowed('tracking') || allowed('fraud'));
9234
+ // Send the receipt validator information about the device.
9235
+ // This will allow to make vendor or device specific fixes and detect class
9236
+ // of devices with issues.
9237
+ // Knowing running version of OS and libraries also required for handling
9238
+ // support requests.
9239
+ if (allowed('analytics') || allowed('support')) {
9240
+ // Version of ionic (if applicable)
9241
+ const ionic = wdw.Ionic || wdw.ionic;
9242
+ if (ionic && ionic.version)
9243
+ ret.ionic = ionic.version;
9244
+ // Information from the cordova-plugin-device (if installed)
9245
+ if (device.cordova)
9246
+ ret.cordova = device.cordova; // Version of cordova
9221
9247
  if (device.model)
9222
- fingerprint += '/' + device.model;
9248
+ ret.model = device.model; // Device model
9249
+ if (device.platform)
9250
+ ret.platform = device.platform; // OS
9251
+ if (device.version)
9252
+ ret.version = device.version; // OS version
9223
9253
  if (device.manufacturer)
9224
- fingerprint = '/' + device.manufacturer;
9254
+ ret.manufacturer = device.manufacturer; // Device manufacturer
9255
+ }
9256
+ // Device identifiers are used for tracking users across services
9257
+ // It is sometimes required for support requests too, but I choose to
9258
+ // keep this out.
9259
+ if (allowed('tracking')) {
9260
+ if (device.serial)
9261
+ ret.serial = device.serial; // Hardware serial number
9262
+ if (device.uuid)
9263
+ ret.uuid = device.uuid; // Device UUID
9264
+ }
9265
+ // Running from a simulator is an error condition for in-app purchases.
9266
+ // Since only developers run in a simulator, let's always report that.
9267
+ if (device.isVirtual)
9268
+ ret.isVirtual = device.isVirtual; // Simulator
9269
+ // Probably nobody wants to disable fraud discovery.
9270
+ // A fingerprint of the device identifiers is used for fraud discovery.
9271
+ // An alert should be triggered by the validator when a lot of devices
9272
+ // share a single receipt.
9273
+ if (allowed('fraud')) {
9274
+ // For fraud discovery, we only need a fingerprint of the device.
9275
+ var fingerprint = '';
9276
+ if (device.serial)
9277
+ fingerprint = 'serial:' + device.serial; // Hardware serial number
9278
+ else if (device.uuid)
9279
+ fingerprint = 'uuid:' + device.uuid; // Device UUID
9280
+ else {
9281
+ // Using only model and manufacturer, we might end-up with many
9282
+ // users sharing the same fingerprint, which is fine for fraud discovery.
9283
+ if (device.model)
9284
+ fingerprint += '/' + device.model;
9285
+ if (device.manufacturer)
9286
+ fingerprint += '/' + device.manufacturer;
9287
+ }
9288
+ // Fingerprint is hashed to keep required level of privacy.
9289
+ if (fingerprint)
9290
+ ret.fingerprint = CdvPurchase.Utils.md5(fingerprint);
9225
9291
  }
9226
- // Fingerprint is hashed to keep required level of privacy.
9227
- if (fingerprint)
9228
- ret.fingerprint = CdvPurchase.Utils.md5(fingerprint);
9229
- }
9230
- return ret;
9292
+ return ret;
9293
+ });
9231
9294
  }
9232
9295
  Internal.getDeviceInfo = getDeviceInfo;
9233
9296
  })(Internal = Validator.Internal || (Validator.Internal = {}));