capacitor-plugin-cdv-purchase 13.15.4 → 13.16.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.
- package/dist/index.js +172 -22
- package/dist/index.js.map +1 -1
- package/ios/Sources/PurchasePlugin/PurchasePlugin.swift +6 -3
- package/package.json +1 -1
- package/www/store.d.ts +117 -6
- package/www/store.js +173 -22
package/dist/index.js
CHANGED
|
@@ -661,10 +661,16 @@ var CdvPurchase;
|
|
|
661
661
|
const body = yield (adapter === null || adapter === void 0 ? void 0 : adapter.receiptValidationBody(receipt));
|
|
662
662
|
if (!body)
|
|
663
663
|
return;
|
|
664
|
-
// Add the applicationUsername
|
|
665
|
-
|
|
664
|
+
// Add the applicationUsername and its obfuscated form
|
|
665
|
+
const rawUsername = this.controller.getApplicationUsername();
|
|
666
|
+
body.additionalData = Object.assign(Object.assign({}, (_a = body.additionalData) !== null && _a !== void 0 ? _a : {}), { applicationUsername: rawUsername });
|
|
666
667
|
if (!body.additionalData.applicationUsername)
|
|
667
668
|
delete body.additionalData.applicationUsername;
|
|
669
|
+
if (rawUsername) {
|
|
670
|
+
const obfuscated = this.controller.obfuscateUsername(rawUsername, receipt.platform);
|
|
671
|
+
if (obfuscated)
|
|
672
|
+
body.additionalData.obfuscatedUsername = obfuscated;
|
|
673
|
+
}
|
|
668
674
|
// Add device information
|
|
669
675
|
body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
|
|
670
676
|
// Add legacy pricing information
|
|
@@ -782,13 +788,32 @@ var CdvPurchase;
|
|
|
782
788
|
Internal.Validator = Validator;
|
|
783
789
|
/**
|
|
784
790
|
* Check if a payload looks like a valid validator response.
|
|
791
|
+
*
|
|
792
|
+
* When `ok` is `true`, validates that `data` exists and contains the
|
|
793
|
+
* fields the rest of the pipeline reads unconditionally: `id` (used to
|
|
794
|
+
* key the verified-receipt cache) and `transaction` (stored as the
|
|
795
|
+
* native transaction). Optional fields like `latest_receipt`,
|
|
796
|
+
* `collection`, `warning`, `date` are not required — a validator that
|
|
797
|
+
* omits them produces a usable VerifiedReceipt all the same.
|
|
798
|
+
*
|
|
799
|
+
* When `ok` is `false`, the `data` field is optional per ErrorPayload.
|
|
785
800
|
*/
|
|
786
801
|
function isValidatorResponsePayload(payload) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
802
|
+
if (!payload || typeof payload !== 'object')
|
|
803
|
+
return false;
|
|
804
|
+
const p = payload;
|
|
805
|
+
if (typeof p.ok !== 'boolean')
|
|
806
|
+
return false;
|
|
807
|
+
if (p.ok === true) {
|
|
808
|
+
const data = p.data;
|
|
809
|
+
if (!data || typeof data !== 'object')
|
|
810
|
+
return false;
|
|
811
|
+
if (typeof data.id !== 'string')
|
|
812
|
+
return false;
|
|
813
|
+
if (!data.transaction || typeof data.transaction !== 'object')
|
|
814
|
+
return false;
|
|
815
|
+
}
|
|
816
|
+
return true;
|
|
792
817
|
}
|
|
793
818
|
})(CdvPurchase.Internal || (CdvPurchase.Internal = {}));
|
|
794
819
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
@@ -1598,6 +1623,37 @@ var CdvPurchase;
|
|
|
1598
1623
|
Internal.ExpiryMonitor = ExpiryMonitor;
|
|
1599
1624
|
})(CdvPurchase.Internal || (CdvPurchase.Internal = {}));
|
|
1600
1625
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
1626
|
+
var CdvPurchase;
|
|
1627
|
+
(function (CdvPurchase) {
|
|
1628
|
+
(function (Utils) {
|
|
1629
|
+
/**
|
|
1630
|
+
* Convert a string to a UUIDv3-like format using MD5 hashing.
|
|
1631
|
+
*
|
|
1632
|
+
* Takes an input string, computes its MD5 hash, then formats the 32 hex
|
|
1633
|
+
* characters as a UUID with version nibble set to '3' (MD5) and variant
|
|
1634
|
+
* nibble set to '8' (RFC 4122).
|
|
1635
|
+
*
|
|
1636
|
+
* This produces a deterministic, valid UUID suitable for Apple's SK2
|
|
1637
|
+
* `appAccountToken` and Google Play's `obfuscatedAccountId`.
|
|
1638
|
+
*
|
|
1639
|
+
* @param str - The input string to hash and format
|
|
1640
|
+
* @returns A UUIDv3-like string (36 chars with dashes), or empty string if input is empty
|
|
1641
|
+
*/
|
|
1642
|
+
function md5toUUID(str) {
|
|
1643
|
+
if (!str)
|
|
1644
|
+
return '';
|
|
1645
|
+
const hash = Utils.md5(str);
|
|
1646
|
+
// UUID format: xxxxxxxx-xxxx-3xxx-8xxx-xxxxxxxxxxxx
|
|
1647
|
+
// Position 12: version '3' (MD5), Position 16: variant '8' (RFC 4122)
|
|
1648
|
+
return hash.substring(0, 8) + '-'
|
|
1649
|
+
+ hash.substring(8, 12) + '-'
|
|
1650
|
+
+ '3' + hash.substring(13, 16) + '-'
|
|
1651
|
+
+ '8' + hash.substring(17, 20) + '-'
|
|
1652
|
+
+ hash.substring(20, 32);
|
|
1653
|
+
}
|
|
1654
|
+
Utils.md5toUUID = md5toUUID;
|
|
1655
|
+
})(CdvPurchase.Utils || (CdvPurchase.Utils = {}));
|
|
1656
|
+
})(CdvPurchase || (CdvPurchase = {}));
|
|
1601
1657
|
/// <reference path="types.ts" />
|
|
1602
1658
|
/// <reference path="utils/compatibility.ts" />
|
|
1603
1659
|
/// <reference path="utils/platform-name.ts" />
|
|
@@ -1612,6 +1668,7 @@ var CdvPurchase;
|
|
|
1612
1668
|
/// <reference path="internal/transaction-monitor.ts" />
|
|
1613
1669
|
/// <reference path="internal/receipts-monitor.ts" />
|
|
1614
1670
|
/// <reference path="internal/expiry-monitor.ts" />
|
|
1671
|
+
/// <reference path="utils/to-uuid.ts" />
|
|
1615
1672
|
/**
|
|
1616
1673
|
* Namespace for the cordova-plugin-purchase plugin.
|
|
1617
1674
|
*
|
|
@@ -1645,7 +1702,7 @@ var CdvPurchase;
|
|
|
1645
1702
|
/**
|
|
1646
1703
|
* Current release number of the plugin.
|
|
1647
1704
|
*/
|
|
1648
|
-
CdvPurchase.PLUGIN_VERSION = '13.
|
|
1705
|
+
CdvPurchase.PLUGIN_VERSION = '13.16.1';
|
|
1649
1706
|
/**
|
|
1650
1707
|
* Entry class of the plugin.
|
|
1651
1708
|
*/
|
|
@@ -1677,6 +1734,8 @@ var CdvPurchase;
|
|
|
1677
1734
|
* @see {@link LogLevel}
|
|
1678
1735
|
*/
|
|
1679
1736
|
this.verbosity = CdvPurchase.LogLevel.ERROR;
|
|
1737
|
+
/** @internal Tracks whether the info notice for 'legacy' has been emitted */
|
|
1738
|
+
this._legacyObfuscatorNoticeEmitted = false;
|
|
1680
1739
|
/** List of callbacks for the "ready" events */
|
|
1681
1740
|
this._readyCallbacks = new CdvPurchase.Internal.ReadyCallbacks(this.log);
|
|
1682
1741
|
/** Callbacks when a product definition was updated */
|
|
@@ -1736,6 +1795,7 @@ var CdvPurchase;
|
|
|
1736
1795
|
this._validator = new CdvPurchase.Internal.Validator({
|
|
1737
1796
|
adapters: this.adapters,
|
|
1738
1797
|
getApplicationUsername: this.getApplicationUsername.bind(this),
|
|
1798
|
+
obfuscateUsername: this.obfuscateUsername.bind(this),
|
|
1739
1799
|
get localReceipts() { return store.localReceipts; },
|
|
1740
1800
|
get validator() { return store.validator; },
|
|
1741
1801
|
get validator_privacy_policy() { return store.validator_privacy_policy; },
|
|
@@ -1793,6 +1853,40 @@ var CdvPurchase;
|
|
|
1793
1853
|
return this.applicationUsername();
|
|
1794
1854
|
return this.applicationUsername;
|
|
1795
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* Obfuscate the application username according to the configured obfuscation strategy.
|
|
1858
|
+
*
|
|
1859
|
+
* See {@link Obfuscator} for the per-mode output format.
|
|
1860
|
+
*
|
|
1861
|
+
* @internal
|
|
1862
|
+
*/
|
|
1863
|
+
obfuscateUsername(applicationUsername, platform) {
|
|
1864
|
+
var _a;
|
|
1865
|
+
if (!applicationUsername)
|
|
1866
|
+
return undefined;
|
|
1867
|
+
const obfuscator = (_a = this.obfuscator) !== null && _a !== void 0 ? _a : 'legacy';
|
|
1868
|
+
if (typeof obfuscator === 'function') {
|
|
1869
|
+
return obfuscator(applicationUsername, platform);
|
|
1870
|
+
}
|
|
1871
|
+
switch (obfuscator) {
|
|
1872
|
+
case 'disabled':
|
|
1873
|
+
return applicationUsername;
|
|
1874
|
+
case 'uuid':
|
|
1875
|
+
return CdvPurchase.Utils.md5toUUID(applicationUsername);
|
|
1876
|
+
case 'legacy':
|
|
1877
|
+
default:
|
|
1878
|
+
if (!this._legacyObfuscatorNoticeEmitted) {
|
|
1879
|
+
this._legacyObfuscatorNoticeEmitted = true;
|
|
1880
|
+
this.log.info('store.obfuscator defaults to "legacy" for backward compatibility. New integrations should set store.obfuscator = "uuid". See https://github.com/j3k0/cordova-plugin-purchase/issues/1665');
|
|
1881
|
+
}
|
|
1882
|
+
if (platform === CdvPurchase.Platform.GOOGLE_PLAY) {
|
|
1883
|
+
// Backward-compatible: raw MD5 hash (32 hex chars, no dashes)
|
|
1884
|
+
return CdvPurchase.Utils.md5(applicationUsername);
|
|
1885
|
+
}
|
|
1886
|
+
// UUIDv3 format — valid for Apple appAccountToken (SK1 + SK2) and any other platform
|
|
1887
|
+
return CdvPurchase.Utils.md5toUUID(applicationUsername);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1796
1890
|
/**
|
|
1797
1891
|
* Register a product.
|
|
1798
1892
|
*
|
|
@@ -1851,6 +1945,8 @@ var CdvPurchase;
|
|
|
1851
1945
|
error: this.triggerError.bind(this),
|
|
1852
1946
|
get verbosity() { return store.verbosity; },
|
|
1853
1947
|
getApplicationUsername() { return store.getApplicationUsername(); },
|
|
1948
|
+
obfuscateUsername: (username, platform) => store.obfuscateUsername(username, platform),
|
|
1949
|
+
get obfuscator() { return store.obfuscator; },
|
|
1854
1950
|
get listener() { return store.listener; },
|
|
1855
1951
|
get log() { return store.log; },
|
|
1856
1952
|
get registeredProducts() { return store.registeredProducts; },
|
|
@@ -2765,9 +2861,11 @@ var CdvPurchase;
|
|
|
2765
2861
|
return true;
|
|
2766
2862
|
if (transaction.isConsumed)
|
|
2767
2863
|
return true;
|
|
2864
|
+
if (transaction.isPending)
|
|
2865
|
+
return false;
|
|
2768
2866
|
if (transaction.expirationDate)
|
|
2769
2867
|
return transaction.expirationDate.getTime() <= +new Date();
|
|
2770
|
-
return
|
|
2868
|
+
return false;
|
|
2771
2869
|
}
|
|
2772
2870
|
}
|
|
2773
2871
|
Internal.LocalReceipts = LocalReceipts;
|
|
@@ -3070,6 +3168,24 @@ var CdvPurchase;
|
|
|
3070
3168
|
}, 300);
|
|
3071
3169
|
}
|
|
3072
3170
|
get products() { return this._products; }
|
|
3171
|
+
/**
|
|
3172
|
+
* Resolve the username string passed to the native bridge for a
|
|
3173
|
+
* purchase. SK1 + 'legacy' keeps the raw username for backward
|
|
3174
|
+
* compatibility; every other mode obfuscates through the
|
|
3175
|
+
* configured strategy. 'disabled' always returns the raw value.
|
|
3176
|
+
*/
|
|
3177
|
+
resolveBridgeUsername() {
|
|
3178
|
+
var _a;
|
|
3179
|
+
const raw = this.context.getApplicationUsername();
|
|
3180
|
+
if (!raw)
|
|
3181
|
+
return undefined;
|
|
3182
|
+
const obfuscator = (_a = this.context.obfuscator) !== null && _a !== void 0 ? _a : 'legacy';
|
|
3183
|
+
if (obfuscator === 'disabled')
|
|
3184
|
+
return raw;
|
|
3185
|
+
if (obfuscator === 'legacy' && !this.useSK2)
|
|
3186
|
+
return raw;
|
|
3187
|
+
return this.context.obfuscateUsername(raw, CdvPurchase.Platform.APPLE_APPSTORE);
|
|
3188
|
+
}
|
|
3073
3189
|
/** Find a given product from ID */
|
|
3074
3190
|
getProduct(id) { return this._products.find(p => p.id === id); }
|
|
3075
3191
|
get receipts() {
|
|
@@ -3565,7 +3681,9 @@ var CdvPurchase;
|
|
|
3565
3681
|
// When we switch AppStore user, the cached receipt isn't from the new user.
|
|
3566
3682
|
// so after a purchase, we want to make sure we're using the receipt from the logged in user.
|
|
3567
3683
|
this.forceReceiptReload = true;
|
|
3568
|
-
|
|
3684
|
+
warnIfDeprecatedAdditionalUsername(this.log, additionalData);
|
|
3685
|
+
const username = this.resolveBridgeUsername();
|
|
3686
|
+
this.bridge.purchase(offer.productId, quantity, username, discount, success, error);
|
|
3569
3687
|
});
|
|
3570
3688
|
});
|
|
3571
3689
|
}
|
|
@@ -3822,6 +3940,16 @@ var CdvPurchase;
|
|
|
3822
3940
|
function appStoreError(code, message, productId) {
|
|
3823
3941
|
return CdvPurchase.storeError(code, message, CdvPurchase.Platform.APPLE_APPSTORE, productId);
|
|
3824
3942
|
}
|
|
3943
|
+
let deprecatedAdditionalUsernameNoticed = false;
|
|
3944
|
+
function warnIfDeprecatedAdditionalUsername(log, additionalData) {
|
|
3945
|
+
// Bracket access avoids the @deprecated read warning on the field.
|
|
3946
|
+
if (!additionalData || !additionalData['applicationUsername'])
|
|
3947
|
+
return;
|
|
3948
|
+
if (deprecatedAdditionalUsernameNoticed)
|
|
3949
|
+
return;
|
|
3950
|
+
deprecatedAdditionalUsernameNoticed = true;
|
|
3951
|
+
log.warn('additionalData.applicationUsername is deprecated and ignored. Set store.applicationUsername instead.');
|
|
3952
|
+
}
|
|
3825
3953
|
})(CdvPurchase.AppleAppStore || (CdvPurchase.AppleAppStore = {}));
|
|
3826
3954
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
3827
3955
|
var CdvPurchase;
|
|
@@ -6218,6 +6346,8 @@ var CdvPurchase;
|
|
|
6218
6346
|
/** @inheritDoc */
|
|
6219
6347
|
order(offer, additionalData) {
|
|
6220
6348
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6349
|
+
warnIfDeprecatedAdditionalUsername(this.log, additionalData);
|
|
6350
|
+
additionalData = withObfuscatedAccountId(additionalData, this.context);
|
|
6221
6351
|
return new Promise(resolve => {
|
|
6222
6352
|
this.log.info("Order - " + JSON.stringify(offer));
|
|
6223
6353
|
const buySuccess = () => resolve(undefined);
|
|
@@ -6365,6 +6495,33 @@ var CdvPurchase;
|
|
|
6365
6495
|
PRODUCTION: 7 * 24 * 60 * 60 * 1000 + 10 * 60 * 1000, // 7 days + 10 minutes for production
|
|
6366
6496
|
};
|
|
6367
6497
|
GooglePlay.Adapter = Adapter;
|
|
6498
|
+
let deprecatedAdditionalUsernameNoticed = false;
|
|
6499
|
+
function warnIfDeprecatedAdditionalUsername(log, additionalData) {
|
|
6500
|
+
// Bracket access avoids the @deprecated read warning on the field.
|
|
6501
|
+
if (!additionalData || !additionalData['applicationUsername'])
|
|
6502
|
+
return;
|
|
6503
|
+
if (deprecatedAdditionalUsernameNoticed)
|
|
6504
|
+
return;
|
|
6505
|
+
deprecatedAdditionalUsernameNoticed = true;
|
|
6506
|
+
log.warn('additionalData.applicationUsername is deprecated and ignored. Set store.applicationUsername instead.');
|
|
6507
|
+
}
|
|
6508
|
+
/**
|
|
6509
|
+
* Return a copy of `additionalData` with `googlePlay.accountId` populated
|
|
6510
|
+
* from `store.applicationUsername` (via the configured obfuscator) when
|
|
6511
|
+
* not already provided by the caller. Never mutates the input.
|
|
6512
|
+
*/
|
|
6513
|
+
function withObfuscatedAccountId(additionalData, context) {
|
|
6514
|
+
var _a;
|
|
6515
|
+
const next = Object.assign({}, (additionalData !== null && additionalData !== void 0 ? additionalData : {}));
|
|
6516
|
+
next.googlePlay = Object.assign({}, ((_a = additionalData === null || additionalData === void 0 ? void 0 : additionalData.googlePlay) !== null && _a !== void 0 ? _a : {}));
|
|
6517
|
+
if (!next.googlePlay.accountId) {
|
|
6518
|
+
const username = context.getApplicationUsername();
|
|
6519
|
+
if (username) {
|
|
6520
|
+
next.googlePlay.accountId = context.obfuscateUsername(username, CdvPurchase.Platform.GOOGLE_PLAY);
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
return next;
|
|
6524
|
+
}
|
|
6368
6525
|
function playStoreError(code, message, productId) {
|
|
6369
6526
|
return CdvPurchase.storeError(code, message, CdvPurchase.Platform.GOOGLE_PLAY, productId);
|
|
6370
6527
|
}
|
|
@@ -6528,11 +6685,7 @@ var CdvPurchase;
|
|
|
6528
6685
|
return !!obj && obj.constructor === Object ? obj : {};
|
|
6529
6686
|
}
|
|
6530
6687
|
function extendAdditionalData(ad) {
|
|
6531
|
-
|
|
6532
|
-
if (!additionalData.accountId && (ad === null || ad === void 0 ? void 0 : ad.applicationUsername)) {
|
|
6533
|
-
additionalData.accountId = CdvPurchase.Utils.md5(ad.applicationUsername);
|
|
6534
|
-
}
|
|
6535
|
-
return additionalData;
|
|
6688
|
+
return ensureObject(ad === null || ad === void 0 ? void 0 : ad.googlePlay);
|
|
6536
6689
|
}
|
|
6537
6690
|
})(GooglePlay.Bridge || (GooglePlay.Bridge = {}));
|
|
6538
6691
|
})(CdvPurchase.GooglePlay || (CdvPurchase.GooglePlay = {}));
|
|
@@ -6751,11 +6904,7 @@ var CdvPurchase;
|
|
|
6751
6904
|
return !!obj && obj.constructor === Object ? obj : {};
|
|
6752
6905
|
}
|
|
6753
6906
|
function extendAdditionalData(ad) {
|
|
6754
|
-
|
|
6755
|
-
if (!additionalData.accountId && (ad === null || ad === void 0 ? void 0 : ad.applicationUsername)) {
|
|
6756
|
-
additionalData.accountId = CdvPurchase.Utils.md5(ad.applicationUsername);
|
|
6757
|
-
}
|
|
6758
|
-
return additionalData;
|
|
6907
|
+
return ensureObject(ad === null || ad === void 0 ? void 0 : ad.googlePlay);
|
|
6759
6908
|
}
|
|
6760
6909
|
})(GooglePlay.Bridge || (GooglePlay.Bridge = {}));
|
|
6761
6910
|
})(CdvPurchase.GooglePlay || (CdvPurchase.GooglePlay = {}));
|
|
@@ -7600,11 +7749,12 @@ var CdvPurchase;
|
|
|
7600
7749
|
});
|
|
7601
7750
|
}
|
|
7602
7751
|
handleReceiptValidationResponse(receipt, response) {
|
|
7752
|
+
var _a, _b;
|
|
7603
7753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7604
7754
|
this.log.info('handleReceiptValidationResponse for IapticJS');
|
|
7605
7755
|
if (response.ok) {
|
|
7606
|
-
response.data.transaction;
|
|
7607
|
-
const collection = response.data.collection;
|
|
7756
|
+
(_a = response.data) === null || _a === void 0 ? void 0 : _a.transaction;
|
|
7757
|
+
const collection = (_b = response.data) === null || _b === void 0 ? void 0 : _b.collection;
|
|
7608
7758
|
// Update receipt based on validated collection
|
|
7609
7759
|
if (collection) {
|
|
7610
7760
|
const purchases = collection.map((vp) => {
|
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;"}
|
|
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;"}
|
|
@@ -186,9 +186,12 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
186
186
|
Task {
|
|
187
187
|
do {
|
|
188
188
|
var options: Set<Product.PurchaseOption> = []
|
|
189
|
-
if let username = call.getString("applicationUsername") {
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
if let username = call.getString("applicationUsername"), !username.isEmpty {
|
|
190
|
+
if let uuid = UUID(uuidString: username) {
|
|
191
|
+
options.insert(.appAccountToken(uuid))
|
|
192
|
+
} else {
|
|
193
|
+
debugLog("applicationUsername is not a valid UUID, appAccountToken will not be set: \(username)")
|
|
194
|
+
}
|
|
192
195
|
}
|
|
193
196
|
if quantity > 1 {
|
|
194
197
|
options.insert(.quantity(quantity))
|
package/package.json
CHANGED
package/www/store.d.ts
CHANGED
|
@@ -348,6 +348,7 @@ declare namespace CdvPurchase {
|
|
|
348
348
|
adapters: Adapters;
|
|
349
349
|
validator_privacy_policy: PrivacyPolicyItem | PrivacyPolicyItem[] | undefined;
|
|
350
350
|
getApplicationUsername(): string | undefined;
|
|
351
|
+
obfuscateUsername: (applicationUsername: string, platform: CdvPurchase.Platform) => string | undefined;
|
|
351
352
|
verifiedCallbacks: Callbacks<VerifiedReceipt>;
|
|
352
353
|
unverifiedCallbacks: Callbacks<UnverifiedReceipt>;
|
|
353
354
|
finish(receipt: VerifiedReceipt): Promise<void>;
|
|
@@ -443,6 +444,10 @@ declare namespace CdvPurchase {
|
|
|
443
444
|
listener: AdapterListener;
|
|
444
445
|
/** Retrieves the application username */
|
|
445
446
|
getApplicationUsername: () => string | undefined;
|
|
447
|
+
/** Obfuscate the application username for the given platform */
|
|
448
|
+
obfuscateUsername: (applicationUsername: string, platform: CdvPurchase.Platform) => string | undefined;
|
|
449
|
+
/** The obfuscation strategy */
|
|
450
|
+
obfuscator?: CdvPurchase.Obfuscator;
|
|
446
451
|
/** Functions used to decorate the API */
|
|
447
452
|
apiDecorators: ProductDecorator & TransactionDecorator & OfferDecorator & ReceiptDecorator;
|
|
448
453
|
/** Collection of per-platform storefront values. */
|
|
@@ -854,6 +859,24 @@ declare namespace CdvPurchase {
|
|
|
854
859
|
}
|
|
855
860
|
}
|
|
856
861
|
}
|
|
862
|
+
declare namespace CdvPurchase {
|
|
863
|
+
namespace Utils {
|
|
864
|
+
/**
|
|
865
|
+
* Convert a string to a UUIDv3-like format using MD5 hashing.
|
|
866
|
+
*
|
|
867
|
+
* Takes an input string, computes its MD5 hash, then formats the 32 hex
|
|
868
|
+
* characters as a UUID with version nibble set to '3' (MD5) and variant
|
|
869
|
+
* nibble set to '8' (RFC 4122).
|
|
870
|
+
*
|
|
871
|
+
* This produces a deterministic, valid UUID suitable for Apple's SK2
|
|
872
|
+
* `appAccountToken` and Google Play's `obfuscatedAccountId`.
|
|
873
|
+
*
|
|
874
|
+
* @param str - The input string to hash and format
|
|
875
|
+
* @returns A UUIDv3-like string (36 chars with dashes), or empty string if input is empty
|
|
876
|
+
*/
|
|
877
|
+
function md5toUUID(str: string): string;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
857
880
|
/**
|
|
858
881
|
* Namespace for the cordova-plugin-purchase plugin.
|
|
859
882
|
*
|
|
@@ -886,7 +909,7 @@ declare namespace CdvPurchase {
|
|
|
886
909
|
/**
|
|
887
910
|
* Current release number of the plugin.
|
|
888
911
|
*/
|
|
889
|
-
const PLUGIN_VERSION = "13.
|
|
912
|
+
const PLUGIN_VERSION = "13.16.1";
|
|
890
913
|
/**
|
|
891
914
|
* Entry class of the plugin.
|
|
892
915
|
*/
|
|
@@ -928,14 +951,44 @@ declare namespace CdvPurchase {
|
|
|
928
951
|
/**
|
|
929
952
|
* Return the identifier of the user for your application.
|
|
930
953
|
*
|
|
931
|
-
*
|
|
932
|
-
* the
|
|
954
|
+
* This value is obfuscated according to {@link Store.obfuscator} before being
|
|
955
|
+
* sent to the native platform API. The default obfuscator (`'legacy'`) hashes
|
|
956
|
+
* or formats the value so the original username is never transmitted in cleartext.
|
|
957
|
+
*
|
|
958
|
+
* For Apple's App Store, the obfuscated value is used as `appAccountToken`
|
|
959
|
+
* (which must be a valid UUID when using StoreKit 2).
|
|
960
|
+
*
|
|
961
|
+
* You can also pass it per-transaction via `additionalData.applicationUsername`
|
|
962
|
+
* in `store.order()` or `store.requestPayment()`, which takes priority.
|
|
933
963
|
*/
|
|
934
964
|
applicationUsername?: string | (() => string | undefined);
|
|
935
965
|
/**
|
|
936
966
|
* Get the application username as a string by either calling or returning {@link Store.applicationUsername}
|
|
937
967
|
*/
|
|
938
968
|
getApplicationUsername(): string | undefined;
|
|
969
|
+
/**
|
|
970
|
+
* Obfuscation strategy for the application username.
|
|
971
|
+
*
|
|
972
|
+
* Controls how `applicationUsername` is transformed before being sent
|
|
973
|
+
* to each platform's native API. `'uuid'` is the recommended setting
|
|
974
|
+
* for new integrations; the default `'legacy'` exists only for
|
|
975
|
+
* backward compatibility with server-side modules that already
|
|
976
|
+
* correlate against the raw 32-hex MD5 value.
|
|
977
|
+
*
|
|
978
|
+
* @default 'legacy'
|
|
979
|
+
* @see {@link Obfuscator}
|
|
980
|
+
*/
|
|
981
|
+
obfuscator?: CdvPurchase.Obfuscator;
|
|
982
|
+
/** @internal Tracks whether the info notice for 'legacy' has been emitted */
|
|
983
|
+
private _legacyObfuscatorNoticeEmitted;
|
|
984
|
+
/**
|
|
985
|
+
* Obfuscate the application username according to the configured obfuscation strategy.
|
|
986
|
+
*
|
|
987
|
+
* See {@link Obfuscator} for the per-mode output format.
|
|
988
|
+
*
|
|
989
|
+
* @internal
|
|
990
|
+
*/
|
|
991
|
+
obfuscateUsername(applicationUsername: string, platform: CdvPurchase.Platform): string | undefined;
|
|
939
992
|
/**
|
|
940
993
|
* URL or implementation of the receipt validation service
|
|
941
994
|
*
|
|
@@ -1512,7 +1565,16 @@ declare namespace CdvPurchase {
|
|
|
1512
1565
|
* @see {@link Store.requestPayment}
|
|
1513
1566
|
*/
|
|
1514
1567
|
interface AdditionalData {
|
|
1515
|
-
/**
|
|
1568
|
+
/**
|
|
1569
|
+
* The application's user identifier.
|
|
1570
|
+
*
|
|
1571
|
+
* @deprecated Set {@link Store.applicationUsername} instead. The
|
|
1572
|
+
* per-transaction value is ignored — adapters always read the
|
|
1573
|
+
* store-level username so receipt validation later (which doesn't
|
|
1574
|
+
* have access to the original additionalData) sees the same value
|
|
1575
|
+
* that was sent to the native API at purchase time. Passing this
|
|
1576
|
+
* field logs a one-shot notice.
|
|
1577
|
+
*/
|
|
1516
1578
|
applicationUsername?: string;
|
|
1517
1579
|
/**
|
|
1518
1580
|
* Quantity of items to purchase.
|
|
@@ -1530,6 +1592,38 @@ declare namespace CdvPurchase {
|
|
|
1530
1592
|
/** Apple AppStore specific additional data */
|
|
1531
1593
|
appStore?: AppleAppStore.AdditionalData;
|
|
1532
1594
|
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Obfuscation strategy for the application username.
|
|
1597
|
+
*
|
|
1598
|
+
* Controls how `applicationUsername` is transformed before being sent to
|
|
1599
|
+
* each platform's native API.
|
|
1600
|
+
*
|
|
1601
|
+
* - `'uuid'` — **Recommended.** MD5 hash formatted as UUIDv3 on all
|
|
1602
|
+
* platforms. Deterministic, valid UUID, works as Apple's
|
|
1603
|
+
* `appAccountToken` (SK1 + SK2) and Google Play's
|
|
1604
|
+
* `obfuscatedAccountId`.
|
|
1605
|
+
*
|
|
1606
|
+
* - `'legacy'` (default) — Only use this when an existing server-side
|
|
1607
|
+
* integration already correlates against the original 32-hex MD5 value
|
|
1608
|
+
* sent on Google Play. New integrations should pick `'uuid'`.
|
|
1609
|
+
* - Google Play: raw MD5 hash (32 hex chars)
|
|
1610
|
+
* - Apple AppStore (SK2): MD5 hash formatted as UUIDv3
|
|
1611
|
+
* - Apple AppStore (SK1, deprecated): raw username, unchanged
|
|
1612
|
+
* - Other platforms: MD5 hash formatted as UUIDv3
|
|
1613
|
+
*
|
|
1614
|
+
* - `'disabled'` — No obfuscation. The raw `applicationUsername` is
|
|
1615
|
+
* passed through to all platforms. For Apple SK2, the value must be a
|
|
1616
|
+
* valid UUID string or `appAccountToken` will not be set.
|
|
1617
|
+
*
|
|
1618
|
+
* - Custom function — `(username: string, platform: Platform) => string`.
|
|
1619
|
+
* Receives the raw username and platform, returns the obfuscated value.
|
|
1620
|
+
* For Apple (both SK1 and SK2), the function must return a valid UUID
|
|
1621
|
+
* string.
|
|
1622
|
+
*
|
|
1623
|
+
* @see {@link Store.obfuscator}
|
|
1624
|
+
* @see {@link https://github.com/j3k0/cordova-plugin-purchase/issues/1665}
|
|
1625
|
+
*/
|
|
1626
|
+
type Obfuscator = 'legacy' | 'uuid' | 'disabled' | ((applicationUsername: string, platform: Platform) => string);
|
|
1533
1627
|
/**
|
|
1534
1628
|
* Purchase platforms supported by the plugin
|
|
1535
1629
|
*/
|
|
@@ -2700,6 +2794,13 @@ declare namespace CdvPurchase {
|
|
|
2700
2794
|
/** List of products loaded from AppStore */
|
|
2701
2795
|
_products: SKProduct[];
|
|
2702
2796
|
get products(): Product[];
|
|
2797
|
+
/**
|
|
2798
|
+
* Resolve the username string passed to the native bridge for a
|
|
2799
|
+
* purchase. SK1 + 'legacy' keeps the raw username for backward
|
|
2800
|
+
* compatibility; every other mode obfuscates through the
|
|
2801
|
+
* configured strategy. 'disabled' always returns the raw value.
|
|
2802
|
+
*/
|
|
2803
|
+
private resolveBridgeUsername;
|
|
2703
2804
|
/** Find a given product from ID */
|
|
2704
2805
|
getProduct(id: string): SKProduct | undefined;
|
|
2705
2806
|
/** The application receipt, contains all transactions */
|
|
@@ -4879,7 +4980,9 @@ declare namespace CdvPurchase {
|
|
|
4879
4980
|
/**
|
|
4880
4981
|
* Obfuscated user account identifier
|
|
4881
4982
|
*
|
|
4882
|
-
*
|
|
4983
|
+
* Populated by the adapter using `store.obfuscateUsername()`.
|
|
4984
|
+
* Format depends on `store.obfuscator` setting.
|
|
4985
|
+
* @see {@link CdvPurchase.Store.obfuscator}
|
|
4883
4986
|
*/
|
|
4884
4987
|
accountId?: string;
|
|
4885
4988
|
/**
|
|
@@ -4951,7 +5054,7 @@ declare namespace CdvPurchase {
|
|
|
4951
5054
|
signature: string;
|
|
4952
5055
|
/** String in JSON format that contains details about the purchase order. */
|
|
4953
5056
|
receipt: string;
|
|
4954
|
-
/** Obfuscated account id specified at purchase
|
|
5057
|
+
/** Obfuscated account id specified at purchase. Format depends on `store.obfuscator`. */
|
|
4955
5058
|
accountId: string;
|
|
4956
5059
|
/** Obfuscated profile id specified at purchase - used when a single user can have multiple profiles */
|
|
4957
5060
|
profileId: string;
|
|
@@ -6188,6 +6291,14 @@ declare namespace CdvPurchase {
|
|
|
6188
6291
|
*
|
|
6189
6292
|
* @optional */
|
|
6190
6293
|
applicationUsername?: string | number;
|
|
6294
|
+
/**
|
|
6295
|
+
* The obfuscated form of `applicationUsername`, derived by applying
|
|
6296
|
+
* `store.obfuscator`. The server can use this to correlate obfuscated
|
|
6297
|
+
* IDs from Apple/Google server notifications (e.g. `appAccountToken`,
|
|
6298
|
+
* `obfuscatedExternalAccountId`) with the original user.
|
|
6299
|
+
*
|
|
6300
|
+
* @optional */
|
|
6301
|
+
obfuscatedUsername?: string;
|
|
6191
6302
|
};
|
|
6192
6303
|
/** Microsoft license information */
|
|
6193
6304
|
license?: {
|
package/www/store.js
CHANGED
|
@@ -666,10 +666,16 @@ var CdvPurchase;
|
|
|
666
666
|
const body = yield (adapter === null || adapter === void 0 ? void 0 : adapter.receiptValidationBody(receipt));
|
|
667
667
|
if (!body)
|
|
668
668
|
return;
|
|
669
|
-
// Add the applicationUsername
|
|
670
|
-
|
|
669
|
+
// Add the applicationUsername and its obfuscated form
|
|
670
|
+
const rawUsername = this.controller.getApplicationUsername();
|
|
671
|
+
body.additionalData = Object.assign(Object.assign({}, (_a = body.additionalData) !== null && _a !== void 0 ? _a : {}), { applicationUsername: rawUsername });
|
|
671
672
|
if (!body.additionalData.applicationUsername)
|
|
672
673
|
delete body.additionalData.applicationUsername;
|
|
674
|
+
if (rawUsername) {
|
|
675
|
+
const obfuscated = this.controller.obfuscateUsername(rawUsername, receipt.platform);
|
|
676
|
+
if (obfuscated)
|
|
677
|
+
body.additionalData.obfuscatedUsername = obfuscated;
|
|
678
|
+
}
|
|
673
679
|
// Add device information
|
|
674
680
|
body.device = Object.assign(Object.assign({}, (_b = body.device) !== null && _b !== void 0 ? _b : {}), CdvPurchase.Validator.Internal.getDeviceInfo(this.controller));
|
|
675
681
|
// Add legacy pricing information
|
|
@@ -787,13 +793,32 @@ var CdvPurchase;
|
|
|
787
793
|
Internal.Validator = Validator;
|
|
788
794
|
/**
|
|
789
795
|
* Check if a payload looks like a valid validator response.
|
|
796
|
+
*
|
|
797
|
+
* When `ok` is `true`, validates that `data` exists and contains the
|
|
798
|
+
* fields the rest of the pipeline reads unconditionally: `id` (used to
|
|
799
|
+
* key the verified-receipt cache) and `transaction` (stored as the
|
|
800
|
+
* native transaction). Optional fields like `latest_receipt`,
|
|
801
|
+
* `collection`, `warning`, `date` are not required — a validator that
|
|
802
|
+
* omits them produces a usable VerifiedReceipt all the same.
|
|
803
|
+
*
|
|
804
|
+
* When `ok` is `false`, the `data` field is optional per ErrorPayload.
|
|
790
805
|
*/
|
|
791
806
|
function isValidatorResponsePayload(payload) {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
807
|
+
if (!payload || typeof payload !== 'object')
|
|
808
|
+
return false;
|
|
809
|
+
const p = payload;
|
|
810
|
+
if (typeof p.ok !== 'boolean')
|
|
811
|
+
return false;
|
|
812
|
+
if (p.ok === true) {
|
|
813
|
+
const data = p.data;
|
|
814
|
+
if (!data || typeof data !== 'object')
|
|
815
|
+
return false;
|
|
816
|
+
if (typeof data.id !== 'string')
|
|
817
|
+
return false;
|
|
818
|
+
if (!data.transaction || typeof data.transaction !== 'object')
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
return true;
|
|
797
822
|
}
|
|
798
823
|
})(Internal = CdvPurchase.Internal || (CdvPurchase.Internal = {}));
|
|
799
824
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
@@ -1615,6 +1640,38 @@ var CdvPurchase;
|
|
|
1615
1640
|
Internal.ExpiryMonitor = ExpiryMonitor;
|
|
1616
1641
|
})(Internal = CdvPurchase.Internal || (CdvPurchase.Internal = {}));
|
|
1617
1642
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
1643
|
+
var CdvPurchase;
|
|
1644
|
+
(function (CdvPurchase) {
|
|
1645
|
+
let Utils;
|
|
1646
|
+
(function (Utils) {
|
|
1647
|
+
/**
|
|
1648
|
+
* Convert a string to a UUIDv3-like format using MD5 hashing.
|
|
1649
|
+
*
|
|
1650
|
+
* Takes an input string, computes its MD5 hash, then formats the 32 hex
|
|
1651
|
+
* characters as a UUID with version nibble set to '3' (MD5) and variant
|
|
1652
|
+
* nibble set to '8' (RFC 4122).
|
|
1653
|
+
*
|
|
1654
|
+
* This produces a deterministic, valid UUID suitable for Apple's SK2
|
|
1655
|
+
* `appAccountToken` and Google Play's `obfuscatedAccountId`.
|
|
1656
|
+
*
|
|
1657
|
+
* @param str - The input string to hash and format
|
|
1658
|
+
* @returns A UUIDv3-like string (36 chars with dashes), or empty string if input is empty
|
|
1659
|
+
*/
|
|
1660
|
+
function md5toUUID(str) {
|
|
1661
|
+
if (!str)
|
|
1662
|
+
return '';
|
|
1663
|
+
const hash = Utils.md5(str);
|
|
1664
|
+
// UUID format: xxxxxxxx-xxxx-3xxx-8xxx-xxxxxxxxxxxx
|
|
1665
|
+
// Position 12: version '3' (MD5), Position 16: variant '8' (RFC 4122)
|
|
1666
|
+
return hash.substring(0, 8) + '-'
|
|
1667
|
+
+ hash.substring(8, 12) + '-'
|
|
1668
|
+
+ '3' + hash.substring(13, 16) + '-'
|
|
1669
|
+
+ '8' + hash.substring(17, 20) + '-'
|
|
1670
|
+
+ hash.substring(20, 32);
|
|
1671
|
+
}
|
|
1672
|
+
Utils.md5toUUID = md5toUUID;
|
|
1673
|
+
})(Utils = CdvPurchase.Utils || (CdvPurchase.Utils = {}));
|
|
1674
|
+
})(CdvPurchase || (CdvPurchase = {}));
|
|
1618
1675
|
/// <reference path="types.ts" />
|
|
1619
1676
|
/// <reference path="utils/compatibility.ts" />
|
|
1620
1677
|
/// <reference path="utils/platform-name.ts" />
|
|
@@ -1629,6 +1686,7 @@ var CdvPurchase;
|
|
|
1629
1686
|
/// <reference path="internal/transaction-monitor.ts" />
|
|
1630
1687
|
/// <reference path="internal/receipts-monitor.ts" />
|
|
1631
1688
|
/// <reference path="internal/expiry-monitor.ts" />
|
|
1689
|
+
/// <reference path="utils/to-uuid.ts" />
|
|
1632
1690
|
/**
|
|
1633
1691
|
* Namespace for the cordova-plugin-purchase plugin.
|
|
1634
1692
|
*
|
|
@@ -1662,7 +1720,7 @@ var CdvPurchase;
|
|
|
1662
1720
|
/**
|
|
1663
1721
|
* Current release number of the plugin.
|
|
1664
1722
|
*/
|
|
1665
|
-
CdvPurchase.PLUGIN_VERSION = '13.
|
|
1723
|
+
CdvPurchase.PLUGIN_VERSION = '13.16.1';
|
|
1666
1724
|
/**
|
|
1667
1725
|
* Entry class of the plugin.
|
|
1668
1726
|
*/
|
|
@@ -1694,6 +1752,8 @@ var CdvPurchase;
|
|
|
1694
1752
|
* @see {@link LogLevel}
|
|
1695
1753
|
*/
|
|
1696
1754
|
this.verbosity = CdvPurchase.LogLevel.ERROR;
|
|
1755
|
+
/** @internal Tracks whether the info notice for 'legacy' has been emitted */
|
|
1756
|
+
this._legacyObfuscatorNoticeEmitted = false;
|
|
1697
1757
|
/** List of callbacks for the "ready" events */
|
|
1698
1758
|
this._readyCallbacks = new CdvPurchase.Internal.ReadyCallbacks(this.log);
|
|
1699
1759
|
/** Callbacks when a product definition was updated */
|
|
@@ -1753,6 +1813,7 @@ var CdvPurchase;
|
|
|
1753
1813
|
this._validator = new CdvPurchase.Internal.Validator({
|
|
1754
1814
|
adapters: this.adapters,
|
|
1755
1815
|
getApplicationUsername: this.getApplicationUsername.bind(this),
|
|
1816
|
+
obfuscateUsername: this.obfuscateUsername.bind(this),
|
|
1756
1817
|
get localReceipts() { return store.localReceipts; },
|
|
1757
1818
|
get validator() { return store.validator; },
|
|
1758
1819
|
get validator_privacy_policy() { return store.validator_privacy_policy; },
|
|
@@ -1810,6 +1871,40 @@ var CdvPurchase;
|
|
|
1810
1871
|
return this.applicationUsername();
|
|
1811
1872
|
return this.applicationUsername;
|
|
1812
1873
|
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Obfuscate the application username according to the configured obfuscation strategy.
|
|
1876
|
+
*
|
|
1877
|
+
* See {@link Obfuscator} for the per-mode output format.
|
|
1878
|
+
*
|
|
1879
|
+
* @internal
|
|
1880
|
+
*/
|
|
1881
|
+
obfuscateUsername(applicationUsername, platform) {
|
|
1882
|
+
var _a;
|
|
1883
|
+
if (!applicationUsername)
|
|
1884
|
+
return undefined;
|
|
1885
|
+
const obfuscator = (_a = this.obfuscator) !== null && _a !== void 0 ? _a : 'legacy';
|
|
1886
|
+
if (typeof obfuscator === 'function') {
|
|
1887
|
+
return obfuscator(applicationUsername, platform);
|
|
1888
|
+
}
|
|
1889
|
+
switch (obfuscator) {
|
|
1890
|
+
case 'disabled':
|
|
1891
|
+
return applicationUsername;
|
|
1892
|
+
case 'uuid':
|
|
1893
|
+
return CdvPurchase.Utils.md5toUUID(applicationUsername);
|
|
1894
|
+
case 'legacy':
|
|
1895
|
+
default:
|
|
1896
|
+
if (!this._legacyObfuscatorNoticeEmitted) {
|
|
1897
|
+
this._legacyObfuscatorNoticeEmitted = true;
|
|
1898
|
+
this.log.info('store.obfuscator defaults to "legacy" for backward compatibility. New integrations should set store.obfuscator = "uuid". See https://github.com/j3k0/cordova-plugin-purchase/issues/1665');
|
|
1899
|
+
}
|
|
1900
|
+
if (platform === CdvPurchase.Platform.GOOGLE_PLAY) {
|
|
1901
|
+
// Backward-compatible: raw MD5 hash (32 hex chars, no dashes)
|
|
1902
|
+
return CdvPurchase.Utils.md5(applicationUsername);
|
|
1903
|
+
}
|
|
1904
|
+
// UUIDv3 format — valid for Apple appAccountToken (SK1 + SK2) and any other platform
|
|
1905
|
+
return CdvPurchase.Utils.md5toUUID(applicationUsername);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1813
1908
|
/**
|
|
1814
1909
|
* Register a product.
|
|
1815
1910
|
*
|
|
@@ -1868,6 +1963,8 @@ var CdvPurchase;
|
|
|
1868
1963
|
error: this.triggerError.bind(this),
|
|
1869
1964
|
get verbosity() { return store.verbosity; },
|
|
1870
1965
|
getApplicationUsername() { return store.getApplicationUsername(); },
|
|
1966
|
+
obfuscateUsername: (username, platform) => store.obfuscateUsername(username, platform),
|
|
1967
|
+
get obfuscator() { return store.obfuscator; },
|
|
1871
1968
|
get listener() { return store.listener; },
|
|
1872
1969
|
get log() { return store.log; },
|
|
1873
1970
|
get registeredProducts() { return store.registeredProducts; },
|
|
@@ -2818,9 +2915,11 @@ var CdvPurchase;
|
|
|
2818
2915
|
return true;
|
|
2819
2916
|
if (transaction.isConsumed)
|
|
2820
2917
|
return true;
|
|
2918
|
+
if (transaction.isPending)
|
|
2919
|
+
return false;
|
|
2821
2920
|
if (transaction.expirationDate)
|
|
2822
2921
|
return transaction.expirationDate.getTime() <= +new Date();
|
|
2823
|
-
return
|
|
2922
|
+
return false;
|
|
2824
2923
|
}
|
|
2825
2924
|
}
|
|
2826
2925
|
Internal.LocalReceipts = LocalReceipts;
|
|
@@ -3143,6 +3242,24 @@ var CdvPurchase;
|
|
|
3143
3242
|
}, 300);
|
|
3144
3243
|
}
|
|
3145
3244
|
get products() { return this._products; }
|
|
3245
|
+
/**
|
|
3246
|
+
* Resolve the username string passed to the native bridge for a
|
|
3247
|
+
* purchase. SK1 + 'legacy' keeps the raw username for backward
|
|
3248
|
+
* compatibility; every other mode obfuscates through the
|
|
3249
|
+
* configured strategy. 'disabled' always returns the raw value.
|
|
3250
|
+
*/
|
|
3251
|
+
resolveBridgeUsername() {
|
|
3252
|
+
var _a;
|
|
3253
|
+
const raw = this.context.getApplicationUsername();
|
|
3254
|
+
if (!raw)
|
|
3255
|
+
return undefined;
|
|
3256
|
+
const obfuscator = (_a = this.context.obfuscator) !== null && _a !== void 0 ? _a : 'legacy';
|
|
3257
|
+
if (obfuscator === 'disabled')
|
|
3258
|
+
return raw;
|
|
3259
|
+
if (obfuscator === 'legacy' && !this.useSK2)
|
|
3260
|
+
return raw;
|
|
3261
|
+
return this.context.obfuscateUsername(raw, CdvPurchase.Platform.APPLE_APPSTORE);
|
|
3262
|
+
}
|
|
3146
3263
|
/** Find a given product from ID */
|
|
3147
3264
|
getProduct(id) { return this._products.find(p => p.id === id); }
|
|
3148
3265
|
get receipts() {
|
|
@@ -3638,7 +3755,9 @@ var CdvPurchase;
|
|
|
3638
3755
|
// When we switch AppStore user, the cached receipt isn't from the new user.
|
|
3639
3756
|
// so after a purchase, we want to make sure we're using the receipt from the logged in user.
|
|
3640
3757
|
this.forceReceiptReload = true;
|
|
3641
|
-
|
|
3758
|
+
warnIfDeprecatedAdditionalUsername(this.log, additionalData);
|
|
3759
|
+
const username = this.resolveBridgeUsername();
|
|
3760
|
+
this.bridge.purchase(offer.productId, quantity, username, discount, success, error);
|
|
3642
3761
|
});
|
|
3643
3762
|
});
|
|
3644
3763
|
}
|
|
@@ -3895,6 +4014,16 @@ var CdvPurchase;
|
|
|
3895
4014
|
function appStoreError(code, message, productId) {
|
|
3896
4015
|
return CdvPurchase.storeError(code, message, CdvPurchase.Platform.APPLE_APPSTORE, productId);
|
|
3897
4016
|
}
|
|
4017
|
+
let deprecatedAdditionalUsernameNoticed = false;
|
|
4018
|
+
function warnIfDeprecatedAdditionalUsername(log, additionalData) {
|
|
4019
|
+
// Bracket access avoids the @deprecated read warning on the field.
|
|
4020
|
+
if (!additionalData || !additionalData['applicationUsername'])
|
|
4021
|
+
return;
|
|
4022
|
+
if (deprecatedAdditionalUsernameNoticed)
|
|
4023
|
+
return;
|
|
4024
|
+
deprecatedAdditionalUsernameNoticed = true;
|
|
4025
|
+
log.warn('additionalData.applicationUsername is deprecated and ignored. Set store.applicationUsername instead.');
|
|
4026
|
+
}
|
|
3898
4027
|
})(AppleAppStore = CdvPurchase.AppleAppStore || (CdvPurchase.AppleAppStore = {}));
|
|
3899
4028
|
})(CdvPurchase || (CdvPurchase = {}));
|
|
3900
4029
|
var CdvPurchase;
|
|
@@ -6359,6 +6488,8 @@ var CdvPurchase;
|
|
|
6359
6488
|
/** @inheritDoc */
|
|
6360
6489
|
order(offer, additionalData) {
|
|
6361
6490
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6491
|
+
warnIfDeprecatedAdditionalUsername(this.log, additionalData);
|
|
6492
|
+
additionalData = withObfuscatedAccountId(additionalData, this.context);
|
|
6362
6493
|
return new Promise(resolve => {
|
|
6363
6494
|
this.log.info("Order - " + JSON.stringify(offer));
|
|
6364
6495
|
const buySuccess = () => resolve(undefined);
|
|
@@ -6516,6 +6647,33 @@ var CdvPurchase;
|
|
|
6516
6647
|
PRODUCTION: 7 * 24 * 60 * 60 * 1000 + 10 * 60 * 1000, // 7 days + 10 minutes for production
|
|
6517
6648
|
};
|
|
6518
6649
|
GooglePlay.Adapter = Adapter;
|
|
6650
|
+
let deprecatedAdditionalUsernameNoticed = false;
|
|
6651
|
+
function warnIfDeprecatedAdditionalUsername(log, additionalData) {
|
|
6652
|
+
// Bracket access avoids the @deprecated read warning on the field.
|
|
6653
|
+
if (!additionalData || !additionalData['applicationUsername'])
|
|
6654
|
+
return;
|
|
6655
|
+
if (deprecatedAdditionalUsernameNoticed)
|
|
6656
|
+
return;
|
|
6657
|
+
deprecatedAdditionalUsernameNoticed = true;
|
|
6658
|
+
log.warn('additionalData.applicationUsername is deprecated and ignored. Set store.applicationUsername instead.');
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* Return a copy of `additionalData` with `googlePlay.accountId` populated
|
|
6662
|
+
* from `store.applicationUsername` (via the configured obfuscator) when
|
|
6663
|
+
* not already provided by the caller. Never mutates the input.
|
|
6664
|
+
*/
|
|
6665
|
+
function withObfuscatedAccountId(additionalData, context) {
|
|
6666
|
+
var _a;
|
|
6667
|
+
const next = Object.assign({}, (additionalData !== null && additionalData !== void 0 ? additionalData : {}));
|
|
6668
|
+
next.googlePlay = Object.assign({}, ((_a = additionalData === null || additionalData === void 0 ? void 0 : additionalData.googlePlay) !== null && _a !== void 0 ? _a : {}));
|
|
6669
|
+
if (!next.googlePlay.accountId) {
|
|
6670
|
+
const username = context.getApplicationUsername();
|
|
6671
|
+
if (username) {
|
|
6672
|
+
next.googlePlay.accountId = context.obfuscateUsername(username, CdvPurchase.Platform.GOOGLE_PLAY);
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
return next;
|
|
6676
|
+
}
|
|
6519
6677
|
function playStoreError(code, message, productId) {
|
|
6520
6678
|
return CdvPurchase.storeError(code, message, CdvPurchase.Platform.GOOGLE_PLAY, productId);
|
|
6521
6679
|
}
|
|
@@ -6681,11 +6839,7 @@ var CdvPurchase;
|
|
|
6681
6839
|
return !!obj && obj.constructor === Object ? obj : {};
|
|
6682
6840
|
}
|
|
6683
6841
|
function extendAdditionalData(ad) {
|
|
6684
|
-
|
|
6685
|
-
if (!additionalData.accountId && (ad === null || ad === void 0 ? void 0 : ad.applicationUsername)) {
|
|
6686
|
-
additionalData.accountId = CdvPurchase.Utils.md5(ad.applicationUsername);
|
|
6687
|
-
}
|
|
6688
|
-
return additionalData;
|
|
6842
|
+
return ensureObject(ad === null || ad === void 0 ? void 0 : ad.googlePlay);
|
|
6689
6843
|
}
|
|
6690
6844
|
})(Bridge = GooglePlay.Bridge || (GooglePlay.Bridge = {}));
|
|
6691
6845
|
})(GooglePlay = CdvPurchase.GooglePlay || (CdvPurchase.GooglePlay = {}));
|
|
@@ -6949,11 +7103,7 @@ var CdvPurchase;
|
|
|
6949
7103
|
return !!obj && obj.constructor === Object ? obj : {};
|
|
6950
7104
|
}
|
|
6951
7105
|
function extendAdditionalData(ad) {
|
|
6952
|
-
|
|
6953
|
-
if (!additionalData.accountId && (ad === null || ad === void 0 ? void 0 : ad.applicationUsername)) {
|
|
6954
|
-
additionalData.accountId = CdvPurchase.Utils.md5(ad.applicationUsername);
|
|
6955
|
-
}
|
|
6956
|
-
return additionalData;
|
|
7106
|
+
return ensureObject(ad === null || ad === void 0 ? void 0 : ad.googlePlay);
|
|
6957
7107
|
}
|
|
6958
7108
|
})(Bridge = GooglePlay.Bridge || (GooglePlay.Bridge = {}));
|
|
6959
7109
|
})(GooglePlay = CdvPurchase.GooglePlay || (CdvPurchase.GooglePlay = {}));
|
|
@@ -7813,11 +7963,12 @@ var CdvPurchase;
|
|
|
7813
7963
|
});
|
|
7814
7964
|
}
|
|
7815
7965
|
handleReceiptValidationResponse(receipt, response) {
|
|
7966
|
+
var _a, _b;
|
|
7816
7967
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7817
7968
|
this.log.info('handleReceiptValidationResponse for IapticJS');
|
|
7818
7969
|
if (response.ok) {
|
|
7819
|
-
const validatedData = response.data.transaction;
|
|
7820
|
-
const collection = response.data.collection;
|
|
7970
|
+
const validatedData = (_a = response.data) === null || _a === void 0 ? void 0 : _a.transaction;
|
|
7971
|
+
const collection = (_b = response.data) === null || _b === void 0 ? void 0 : _b.collection;
|
|
7821
7972
|
// Update receipt based on validated collection
|
|
7822
7973
|
if (collection) {
|
|
7823
7974
|
const purchases = collection.map((vp) => {
|