@xapps-platform/marketplace-ui 0.1.11 → 0.1.13
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 +27 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4587,6 +4587,7 @@ function resolveMonetizationPackagePurchasePolicy(input) {
|
|
|
4587
4587
|
const packageKind = readLower(item.packageKind);
|
|
4588
4588
|
const productId = readLower(item.productId);
|
|
4589
4589
|
const currentSubscriptionProductId = readLower(currentSubscription.product_id);
|
|
4590
|
+
const includedCredits = readPackageCredits(item);
|
|
4590
4591
|
const ownershipCandidates = new Set(collectPackageOwnershipCandidates(item));
|
|
4591
4592
|
const ownedAdditiveUnlock = additiveEntitlements.some((entry) => {
|
|
4592
4593
|
const entitlement = entry && typeof entry === "object" && !Array.isArray(entry) ? entry : {};
|
|
@@ -4607,6 +4608,15 @@ function resolveMonetizationPackagePurchasePolicy(input) {
|
|
|
4607
4608
|
reason: "current_recurring_plan"
|
|
4608
4609
|
};
|
|
4609
4610
|
}
|
|
4611
|
+
const consumableOneTimeUnlock = (productFamily === "one_time_unlock" || packageKind === "one_time_unlock") && includedCredits > 0;
|
|
4612
|
+
if (consumableOneTimeUnlock) {
|
|
4613
|
+
return {
|
|
4614
|
+
canPurchase: true,
|
|
4615
|
+
status: "available",
|
|
4616
|
+
transitionKind: "buy_additive_unlock",
|
|
4617
|
+
reason: null
|
|
4618
|
+
};
|
|
4619
|
+
}
|
|
4610
4620
|
if ((productFamily === "one_time_unlock" || packageKind === "one_time_unlock") && ownedAdditiveUnlock) {
|
|
4611
4621
|
return {
|
|
4612
4622
|
canPurchase: false,
|
|
@@ -5420,6 +5430,16 @@ function XappDetailPageContent(props) {
|
|
|
5420
5430
|
if (!xappId || typeof client.prepareMyXappPurchaseIntent !== "function" || typeof client.createMyXappPurchasePaymentSession !== "function" || !normalizedSlug) {
|
|
5421
5431
|
return;
|
|
5422
5432
|
}
|
|
5433
|
+
if (!hasSubject || !canMutate) {
|
|
5434
|
+
setCheckoutError(
|
|
5435
|
+
t(
|
|
5436
|
+
"xapp.checkout_session_required",
|
|
5437
|
+
void 0,
|
|
5438
|
+
"Checkout requires a subject-bound catalog session. Start from a signed host session to purchase plans."
|
|
5439
|
+
)
|
|
5440
|
+
);
|
|
5441
|
+
return;
|
|
5442
|
+
}
|
|
5423
5443
|
const pkg = selectedPaywallPackageRecords.find(
|
|
5424
5444
|
(item) => readString5(item.packageSlug).trim().toLowerCase() === normalizedSlug
|
|
5425
5445
|
);
|
|
@@ -5550,7 +5570,8 @@ function XappDetailPageContent(props) {
|
|
|
5550
5570
|
return resolveMonetizationPackagePurchasePolicy({
|
|
5551
5571
|
item,
|
|
5552
5572
|
currentSubscription: monetizationSubscription,
|
|
5553
|
-
additiveEntitlements: activeAdditiveEntitlements
|
|
5573
|
+
additiveEntitlements: activeAdditiveEntitlements,
|
|
5574
|
+
accessProjection: monetizationAccessProjection
|
|
5554
5575
|
});
|
|
5555
5576
|
}
|
|
5556
5577
|
const currentAccessCard = hasMonetizationState ? /* @__PURE__ */ jsxs10("div", { className: "mx-sidebar-card", children: [
|
|
@@ -5610,6 +5631,9 @@ function XappDetailPageContent(props) {
|
|
|
5610
5631
|
/* @__PURE__ */ jsx14("div", { className: "mx-paywall-card-packages", children: selectedPaywallRenderModel.packages.map((item) => {
|
|
5611
5632
|
const normalizedPackageSlug = item.packageSlug.trim().toLowerCase();
|
|
5612
5633
|
const purchasePolicy = getPackagePurchasePolicy(item);
|
|
5634
|
+
const packageSignals = item.signals.filter(
|
|
5635
|
+
(signal) => !(purchasePolicy.transitionKind === "replace_recurring" && signal.toLowerCase().includes("trial"))
|
|
5636
|
+
);
|
|
5613
5637
|
const isCurrentPackage = purchasePolicy.status === "current_recurring_plan";
|
|
5614
5638
|
const isOwnedAdditive = purchasePolicy.status === "owned_additive_unlock";
|
|
5615
5639
|
const isAdditiveCompanion = purchasePolicy.transitionKind === "buy_additive_unlock" && subscriptionStatus === "active";
|
|
@@ -5633,13 +5657,13 @@ function XappDetailPageContent(props) {
|
|
|
5633
5657
|
isAdditiveCompanion ? /* @__PURE__ */ jsx14("span", { className: "mx-paywall-card-package-default", children: t("xapp.additive_unlock_label", void 0, "Add-on with membership") }) : null,
|
|
5634
5658
|
item.isDefault ? /* @__PURE__ */ jsx14("span", { className: "mx-paywall-card-package-default", children: t("xapp.default_label", void 0, "Default") }) : null
|
|
5635
5659
|
] }),
|
|
5636
|
-
|
|
5660
|
+
packageSignals.length > 0 ? /* @__PURE__ */ jsx14("div", { className: "mx-paywall-card-signals", children: packageSignals.map((signal) => /* @__PURE__ */ jsx14("span", { className: "mx-paywall-card-signal", children: signal }, signal)) }) : null,
|
|
5637
5661
|
isAdditiveCompanion ? /* @__PURE__ */ jsx14("div", { className: "mx-paywall-card-summary", children: t(
|
|
5638
5662
|
"xapp.additive_unlock_message",
|
|
5639
5663
|
void 0,
|
|
5640
5664
|
"This one-time unlock is additive. It adds access on top of the active recurring membership instead of replacing it."
|
|
5641
5665
|
) }) : null,
|
|
5642
|
-
typeof client.prepareMyXappPurchaseIntent === "function" && typeof client.createMyXappPurchasePaymentSession === "function" && canMutate ? /* @__PURE__ */ jsx14(
|
|
5666
|
+
typeof client.prepareMyXappPurchaseIntent === "function" && typeof client.createMyXappPurchasePaymentSession === "function" && hasSubject && canMutate ? /* @__PURE__ */ jsx14(
|
|
5643
5667
|
"button",
|
|
5644
5668
|
{
|
|
5645
5669
|
className: "mx-btn mx-btn-secondary",
|