capacitor-plugin-cdv-purchase 13.15.3 → 13.15.4
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 +75 -36
- package/dist/index.js.map +1 -1
- package/ios/Sources/PurchasePlugin/PurchasePlugin.swift +6 -2
- package/package.json +3 -2
- package/www/store.d.ts +32 -1
- package/www/store.js +75 -36
package/dist/index.js
CHANGED
|
@@ -1645,7 +1645,7 @@ var CdvPurchase;
|
|
|
1645
1645
|
/**
|
|
1646
1646
|
* Current release number of the plugin.
|
|
1647
1647
|
*/
|
|
1648
|
-
CdvPurchase.PLUGIN_VERSION = '13.15.
|
|
1648
|
+
CdvPurchase.PLUGIN_VERSION = '13.15.4';
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Entry class of the plugin.
|
|
1651
1651
|
*/
|
|
@@ -3427,46 +3427,39 @@ var CdvPurchase;
|
|
|
3427
3427
|
loadEligibility(validProducts) {
|
|
3428
3428
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3429
3429
|
this.log.debug('load eligibility: ' + JSON.stringify(validProducts));
|
|
3430
|
-
|
|
3431
|
-
|
|
3430
|
+
// Collect eligibility requests alongside native-provided answers (from
|
|
3431
|
+
// StoreKit 2's isEligibleForIntroOffer, when available).
|
|
3432
|
+
const { requests, nativeAnswers } = AppleAppStore.Internal.collectEligibilityRequests(validProducts);
|
|
3433
|
+
if (requests.length === 0) {
|
|
3432
3434
|
return new AppleAppStore.Internal.DiscountEligibilities([], []);
|
|
3433
3435
|
}
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
if (eligibilityRequests.length > 0) {
|
|
3455
|
-
const applicationReceipt = yield this.loadAppStoreReceipt();
|
|
3456
|
-
if (!applicationReceipt || !applicationReceipt.appStoreReceipt) {
|
|
3457
|
-
this.log.debug('no receipt, assuming introductory price are available.');
|
|
3458
|
-
return new AppleAppStore.Internal.DiscountEligibilities(eligibilityRequests, eligibilityRequests.map(r => r.discountType === "Introductory"));
|
|
3459
|
-
}
|
|
3460
|
-
else {
|
|
3461
|
-
this.log.debug('calling discount eligibility determiner.');
|
|
3462
|
-
const response = yield this.callDiscountEligibilityDeterminer(applicationReceipt, eligibilityRequests);
|
|
3463
|
-
this.log.debug('response: ' + JSON.stringify(response));
|
|
3464
|
-
return new AppleAppStore.Internal.DiscountEligibilities(eligibilityRequests, response);
|
|
3465
|
-
}
|
|
3436
|
+
// Fast path — if every eligibility answer came from native, we can skip
|
|
3437
|
+
// the receipt fetch and the determiner entirely. This is the common case
|
|
3438
|
+
// for StoreKit 2 where the app store receipt is always empty.
|
|
3439
|
+
const allNative = nativeAnswers.every(a => a !== undefined);
|
|
3440
|
+
if (allNative) {
|
|
3441
|
+
this.log.debug('native eligibility answers cover all requests, skipping determiner.');
|
|
3442
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, nativeAnswers);
|
|
3443
|
+
}
|
|
3444
|
+
// Otherwise fall back to the receipt + determiner path, then overlay any
|
|
3445
|
+
// native answers we do have (native wins on conflict — it's authoritative).
|
|
3446
|
+
if (!this.discountEligibilityDeterminer) {
|
|
3447
|
+
this.log.debug('No discount eligibility determiner; using native answers only where available.');
|
|
3448
|
+
const defaultForMissing = requests.map(r => r.discountType === 'Introductory');
|
|
3449
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, AppleAppStore.Internal.mergeNativeEligibility(defaultForMissing, nativeAnswers));
|
|
3450
|
+
}
|
|
3451
|
+
const applicationReceipt = yield this.loadAppStoreReceipt();
|
|
3452
|
+
let response;
|
|
3453
|
+
if (!applicationReceipt || !applicationReceipt.appStoreReceipt) {
|
|
3454
|
+
this.log.debug('no receipt, assuming introductory price are available.');
|
|
3455
|
+
response = requests.map(r => r.discountType === 'Introductory');
|
|
3466
3456
|
}
|
|
3467
3457
|
else {
|
|
3468
|
-
|
|
3458
|
+
this.log.debug('calling discount eligibility determiner.');
|
|
3459
|
+
response = yield this.callDiscountEligibilityDeterminer(applicationReceipt, requests);
|
|
3460
|
+
this.log.debug('response: ' + JSON.stringify(response));
|
|
3469
3461
|
}
|
|
3462
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, AppleAppStore.Internal.mergeNativeEligibility(response, nativeAnswers));
|
|
3470
3463
|
});
|
|
3471
3464
|
}
|
|
3472
3465
|
callDiscountEligibilityDeterminer(applicationReceipt, eligibilityRequests) {
|
|
@@ -4795,6 +4788,52 @@ var CdvPurchase;
|
|
|
4795
4788
|
}
|
|
4796
4789
|
}
|
|
4797
4790
|
Internal.DiscountEligibilities = DiscountEligibilities;
|
|
4791
|
+
/**
|
|
4792
|
+
* Build the pair of (requests, native-provided answers) for every valid product.
|
|
4793
|
+
*
|
|
4794
|
+
* The two arrays are parallel: for each request, the matching `nativeAnswers` entry
|
|
4795
|
+
* is either the native eligibility (from StoreKit 2's `isEligibleForIntroOffer`)
|
|
4796
|
+
* or `undefined` if native did not provide one (SK1 / older native plugin).
|
|
4797
|
+
*
|
|
4798
|
+
* Only Introductory requests can carry a native answer — SK2 does not answer
|
|
4799
|
+
* promotional offer eligibility at the adapter level.
|
|
4800
|
+
*/
|
|
4801
|
+
function collectEligibilityRequests(validProducts) {
|
|
4802
|
+
const requests = [];
|
|
4803
|
+
const nativeAnswers = [];
|
|
4804
|
+
validProducts.forEach(valid => {
|
|
4805
|
+
var _a, _b, _c;
|
|
4806
|
+
(_a = valid.discounts) === null || _a === void 0 ? void 0 : _a.forEach(discount => {
|
|
4807
|
+
requests.push({
|
|
4808
|
+
productId: valid.id,
|
|
4809
|
+
discountId: discount.id,
|
|
4810
|
+
discountType: discount.type,
|
|
4811
|
+
});
|
|
4812
|
+
nativeAnswers.push(discount.type === 'Introductory' ? valid.introPriceEligible : undefined);
|
|
4813
|
+
});
|
|
4814
|
+
if (((_c = (_b = valid.discounts) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) === 0 && valid.introPrice) {
|
|
4815
|
+
requests.push({
|
|
4816
|
+
productId: valid.id,
|
|
4817
|
+
discountId: 'intro',
|
|
4818
|
+
discountType: 'Introductory',
|
|
4819
|
+
});
|
|
4820
|
+
nativeAnswers.push(valid.introPriceEligible);
|
|
4821
|
+
}
|
|
4822
|
+
});
|
|
4823
|
+
return { requests, nativeAnswers };
|
|
4824
|
+
}
|
|
4825
|
+
Internal.collectEligibilityRequests = collectEligibilityRequests;
|
|
4826
|
+
/**
|
|
4827
|
+
* Overlay native-provided eligibility answers on top of a determiner response.
|
|
4828
|
+
*
|
|
4829
|
+
* Native wins on conflict — it's the authoritative source for StoreKit 2.
|
|
4830
|
+
* Determiner response is used where native did not provide an answer (SK1
|
|
4831
|
+
* or older native builds).
|
|
4832
|
+
*/
|
|
4833
|
+
function mergeNativeEligibility(determinerResponse, nativeAnswers) {
|
|
4834
|
+
return determinerResponse.map((r, i) => nativeAnswers[i] !== undefined ? nativeAnswers[i] : r);
|
|
4835
|
+
}
|
|
4836
|
+
Internal.mergeNativeEligibility = mergeNativeEligibility;
|
|
4798
4837
|
})(AppleAppStore.Internal || (AppleAppStore.Internal = {}));
|
|
4799
4838
|
})(CdvPurchase.AppleAppStore || (CdvPurchase.AppleAppStore = {}));
|
|
4800
4839
|
})(CdvPurchase || (CdvPurchase = {}));
|
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,CAA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,GAAG,WAAW,CAAC;;;;"}
|
|
@@ -150,7 +150,7 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
150
150
|
|
|
151
151
|
for product in storeProducts {
|
|
152
152
|
sk2.products[product.id] = product
|
|
153
|
-
validProducts.append(productToDict(product))
|
|
153
|
+
validProducts.append(await productToDict(product))
|
|
154
154
|
validIds.insert(product.id)
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -445,7 +445,7 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
@available(iOS 15.0, *)
|
|
448
|
-
private func productToDict(_ product: Product) -> [String: Any] {
|
|
448
|
+
private func productToDict(_ product: Product) async -> [String: Any] {
|
|
449
449
|
var dict: [String: Any] = [
|
|
450
450
|
"id": product.id,
|
|
451
451
|
"title": product.displayName,
|
|
@@ -478,6 +478,10 @@ public class PurchasePlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
478
478
|
dict["introPricePeriod"] = intro.period.value
|
|
479
479
|
dict["introPricePeriodUnit"] = periodUnitToString(intro.period.unit)
|
|
480
480
|
dict["introPricePaymentMode"] = paymentModeToString(intro.paymentMode)
|
|
481
|
+
// StoreKit 2 eligibility — honors the user's prior subscription/trial history.
|
|
482
|
+
// Only meaningful when an intro offer exists; omitted otherwise so older TS
|
|
483
|
+
// builds that don't know about this field keep their SK1-era behavior.
|
|
484
|
+
dict["introPriceEligible"] = await subscription.isEligibleForIntroOffer
|
|
481
485
|
}
|
|
482
486
|
|
|
483
487
|
// Promotional offers (discounts)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-plugin-cdv-purchase",
|
|
3
|
-
"version": "13.15.
|
|
3
|
+
"version": "13.15.4",
|
|
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",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
14
15
|
},
|
|
15
16
|
"capacitor": {
|
|
16
17
|
"ios": { "src": "ios" },
|
package/www/store.d.ts
CHANGED
|
@@ -886,7 +886,7 @@ declare namespace CdvPurchase {
|
|
|
886
886
|
/**
|
|
887
887
|
* Current release number of the plugin.
|
|
888
888
|
*/
|
|
889
|
-
const PLUGIN_VERSION = "13.15.
|
|
889
|
+
const PLUGIN_VERSION = "13.15.4";
|
|
890
890
|
/**
|
|
891
891
|
* Entry class of the plugin.
|
|
892
892
|
*/
|
|
@@ -2970,6 +2970,15 @@ declare namespace CdvPurchase {
|
|
|
2970
2970
|
introPricePeriodUnit?: IPeriodUnit;
|
|
2971
2971
|
/** Payment mode for introductory price */
|
|
2972
2972
|
introPricePaymentMode?: PaymentMode;
|
|
2973
|
+
/**
|
|
2974
|
+
* Whether the user is eligible for the introductory price.
|
|
2975
|
+
*
|
|
2976
|
+
* Populated from StoreKit 2's `Product.SubscriptionInfo.isEligibleForIntroOffer`
|
|
2977
|
+
* when running on SK2 (iOS 15+). Absent on SK1 and on older native builds that
|
|
2978
|
+
* don't surface it — in which case the discount eligibility determiner is used
|
|
2979
|
+
* as before.
|
|
2980
|
+
*/
|
|
2981
|
+
introPriceEligible?: boolean;
|
|
2973
2982
|
/** Available discount offers */
|
|
2974
2983
|
discounts?: Discount[];
|
|
2975
2984
|
/** Group this product is member of */
|
|
@@ -3170,6 +3179,28 @@ declare namespace CdvPurchase {
|
|
|
3170
3179
|
constructor(request: DiscountEligibilityRequest[], response: boolean[]);
|
|
3171
3180
|
isEligible(productId: string, discountType: DiscountType, discountId: string): boolean;
|
|
3172
3181
|
}
|
|
3182
|
+
/**
|
|
3183
|
+
* Build the pair of (requests, native-provided answers) for every valid product.
|
|
3184
|
+
*
|
|
3185
|
+
* The two arrays are parallel: for each request, the matching `nativeAnswers` entry
|
|
3186
|
+
* is either the native eligibility (from StoreKit 2's `isEligibleForIntroOffer`)
|
|
3187
|
+
* or `undefined` if native did not provide one (SK1 / older native plugin).
|
|
3188
|
+
*
|
|
3189
|
+
* Only Introductory requests can carry a native answer — SK2 does not answer
|
|
3190
|
+
* promotional offer eligibility at the adapter level.
|
|
3191
|
+
*/
|
|
3192
|
+
function collectEligibilityRequests(validProducts: Bridge.ValidProduct[]): {
|
|
3193
|
+
requests: DiscountEligibilityRequest[];
|
|
3194
|
+
nativeAnswers: (boolean | undefined)[];
|
|
3195
|
+
};
|
|
3196
|
+
/**
|
|
3197
|
+
* Overlay native-provided eligibility answers on top of a determiner response.
|
|
3198
|
+
*
|
|
3199
|
+
* Native wins on conflict — it's the authoritative source for StoreKit 2.
|
|
3200
|
+
* Determiner response is used where native did not provide an answer (SK1
|
|
3201
|
+
* or older native builds).
|
|
3202
|
+
*/
|
|
3203
|
+
function mergeNativeEligibility(determinerResponse: boolean[], nativeAnswers: (boolean | undefined)[]): boolean[];
|
|
3173
3204
|
}
|
|
3174
3205
|
}
|
|
3175
3206
|
}
|
package/www/store.js
CHANGED
|
@@ -1662,7 +1662,7 @@ var CdvPurchase;
|
|
|
1662
1662
|
/**
|
|
1663
1663
|
* Current release number of the plugin.
|
|
1664
1664
|
*/
|
|
1665
|
-
CdvPurchase.PLUGIN_VERSION = '13.15.
|
|
1665
|
+
CdvPurchase.PLUGIN_VERSION = '13.15.4';
|
|
1666
1666
|
/**
|
|
1667
1667
|
* Entry class of the plugin.
|
|
1668
1668
|
*/
|
|
@@ -3500,46 +3500,39 @@ var CdvPurchase;
|
|
|
3500
3500
|
loadEligibility(validProducts) {
|
|
3501
3501
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3502
3502
|
this.log.debug('load eligibility: ' + JSON.stringify(validProducts));
|
|
3503
|
-
|
|
3504
|
-
|
|
3503
|
+
// Collect eligibility requests alongside native-provided answers (from
|
|
3504
|
+
// StoreKit 2's isEligibleForIntroOffer, when available).
|
|
3505
|
+
const { requests, nativeAnswers } = AppleAppStore.Internal.collectEligibilityRequests(validProducts);
|
|
3506
|
+
if (requests.length === 0) {
|
|
3505
3507
|
return new AppleAppStore.Internal.DiscountEligibilities([], []);
|
|
3506
3508
|
}
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
if (eligibilityRequests.length > 0) {
|
|
3528
|
-
const applicationReceipt = yield this.loadAppStoreReceipt();
|
|
3529
|
-
if (!applicationReceipt || !applicationReceipt.appStoreReceipt) {
|
|
3530
|
-
this.log.debug('no receipt, assuming introductory price are available.');
|
|
3531
|
-
return new AppleAppStore.Internal.DiscountEligibilities(eligibilityRequests, eligibilityRequests.map(r => r.discountType === "Introductory"));
|
|
3532
|
-
}
|
|
3533
|
-
else {
|
|
3534
|
-
this.log.debug('calling discount eligibility determiner.');
|
|
3535
|
-
const response = yield this.callDiscountEligibilityDeterminer(applicationReceipt, eligibilityRequests);
|
|
3536
|
-
this.log.debug('response: ' + JSON.stringify(response));
|
|
3537
|
-
return new AppleAppStore.Internal.DiscountEligibilities(eligibilityRequests, response);
|
|
3538
|
-
}
|
|
3509
|
+
// Fast path — if every eligibility answer came from native, we can skip
|
|
3510
|
+
// the receipt fetch and the determiner entirely. This is the common case
|
|
3511
|
+
// for StoreKit 2 where the app store receipt is always empty.
|
|
3512
|
+
const allNative = nativeAnswers.every(a => a !== undefined);
|
|
3513
|
+
if (allNative) {
|
|
3514
|
+
this.log.debug('native eligibility answers cover all requests, skipping determiner.');
|
|
3515
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, nativeAnswers);
|
|
3516
|
+
}
|
|
3517
|
+
// Otherwise fall back to the receipt + determiner path, then overlay any
|
|
3518
|
+
// native answers we do have (native wins on conflict — it's authoritative).
|
|
3519
|
+
if (!this.discountEligibilityDeterminer) {
|
|
3520
|
+
this.log.debug('No discount eligibility determiner; using native answers only where available.');
|
|
3521
|
+
const defaultForMissing = requests.map(r => r.discountType === 'Introductory');
|
|
3522
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, AppleAppStore.Internal.mergeNativeEligibility(defaultForMissing, nativeAnswers));
|
|
3523
|
+
}
|
|
3524
|
+
const applicationReceipt = yield this.loadAppStoreReceipt();
|
|
3525
|
+
let response;
|
|
3526
|
+
if (!applicationReceipt || !applicationReceipt.appStoreReceipt) {
|
|
3527
|
+
this.log.debug('no receipt, assuming introductory price are available.');
|
|
3528
|
+
response = requests.map(r => r.discountType === 'Introductory');
|
|
3539
3529
|
}
|
|
3540
3530
|
else {
|
|
3541
|
-
|
|
3531
|
+
this.log.debug('calling discount eligibility determiner.');
|
|
3532
|
+
response = yield this.callDiscountEligibilityDeterminer(applicationReceipt, requests);
|
|
3533
|
+
this.log.debug('response: ' + JSON.stringify(response));
|
|
3542
3534
|
}
|
|
3535
|
+
return new AppleAppStore.Internal.DiscountEligibilities(requests, AppleAppStore.Internal.mergeNativeEligibility(response, nativeAnswers));
|
|
3543
3536
|
});
|
|
3544
3537
|
}
|
|
3545
3538
|
callDiscountEligibilityDeterminer(applicationReceipt, eligibilityRequests) {
|
|
@@ -4882,6 +4875,52 @@ var CdvPurchase;
|
|
|
4882
4875
|
}
|
|
4883
4876
|
}
|
|
4884
4877
|
Internal.DiscountEligibilities = DiscountEligibilities;
|
|
4878
|
+
/**
|
|
4879
|
+
* Build the pair of (requests, native-provided answers) for every valid product.
|
|
4880
|
+
*
|
|
4881
|
+
* The two arrays are parallel: for each request, the matching `nativeAnswers` entry
|
|
4882
|
+
* is either the native eligibility (from StoreKit 2's `isEligibleForIntroOffer`)
|
|
4883
|
+
* or `undefined` if native did not provide one (SK1 / older native plugin).
|
|
4884
|
+
*
|
|
4885
|
+
* Only Introductory requests can carry a native answer — SK2 does not answer
|
|
4886
|
+
* promotional offer eligibility at the adapter level.
|
|
4887
|
+
*/
|
|
4888
|
+
function collectEligibilityRequests(validProducts) {
|
|
4889
|
+
const requests = [];
|
|
4890
|
+
const nativeAnswers = [];
|
|
4891
|
+
validProducts.forEach(valid => {
|
|
4892
|
+
var _a, _b, _c;
|
|
4893
|
+
(_a = valid.discounts) === null || _a === void 0 ? void 0 : _a.forEach(discount => {
|
|
4894
|
+
requests.push({
|
|
4895
|
+
productId: valid.id,
|
|
4896
|
+
discountId: discount.id,
|
|
4897
|
+
discountType: discount.type,
|
|
4898
|
+
});
|
|
4899
|
+
nativeAnswers.push(discount.type === 'Introductory' ? valid.introPriceEligible : undefined);
|
|
4900
|
+
});
|
|
4901
|
+
if (((_c = (_b = valid.discounts) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) === 0 && valid.introPrice) {
|
|
4902
|
+
requests.push({
|
|
4903
|
+
productId: valid.id,
|
|
4904
|
+
discountId: 'intro',
|
|
4905
|
+
discountType: 'Introductory',
|
|
4906
|
+
});
|
|
4907
|
+
nativeAnswers.push(valid.introPriceEligible);
|
|
4908
|
+
}
|
|
4909
|
+
});
|
|
4910
|
+
return { requests, nativeAnswers };
|
|
4911
|
+
}
|
|
4912
|
+
Internal.collectEligibilityRequests = collectEligibilityRequests;
|
|
4913
|
+
/**
|
|
4914
|
+
* Overlay native-provided eligibility answers on top of a determiner response.
|
|
4915
|
+
*
|
|
4916
|
+
* Native wins on conflict — it's the authoritative source for StoreKit 2.
|
|
4917
|
+
* Determiner response is used where native did not provide an answer (SK1
|
|
4918
|
+
* or older native builds).
|
|
4919
|
+
*/
|
|
4920
|
+
function mergeNativeEligibility(determinerResponse, nativeAnswers) {
|
|
4921
|
+
return determinerResponse.map((r, i) => nativeAnswers[i] !== undefined ? nativeAnswers[i] : r);
|
|
4922
|
+
}
|
|
4923
|
+
Internal.mergeNativeEligibility = mergeNativeEligibility;
|
|
4885
4924
|
})(Internal = AppleAppStore.Internal || (AppleAppStore.Internal = {}));
|
|
4886
4925
|
})(AppleAppStore = CdvPurchase.AppleAppStore || (CdvPurchase.AppleAppStore = {}));
|
|
4887
4926
|
})(CdvPurchase || (CdvPurchase = {}));
|