@xapps-platform/marketplace-ui 0.1.10 → 0.1.12

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 CHANGED
@@ -5420,6 +5420,16 @@ function XappDetailPageContent(props) {
5420
5420
  if (!xappId || typeof client.prepareMyXappPurchaseIntent !== "function" || typeof client.createMyXappPurchasePaymentSession !== "function" || !normalizedSlug) {
5421
5421
  return;
5422
5422
  }
5423
+ if (!hasSubject || !canMutate) {
5424
+ setCheckoutError(
5425
+ t(
5426
+ "xapp.checkout_session_required",
5427
+ void 0,
5428
+ "Checkout requires a subject-bound catalog session. Start from a signed host session to purchase plans."
5429
+ )
5430
+ );
5431
+ return;
5432
+ }
5423
5433
  const pkg = selectedPaywallPackageRecords.find(
5424
5434
  (item) => readString5(item.packageSlug).trim().toLowerCase() === normalizedSlug
5425
5435
  );
@@ -5639,7 +5649,7 @@ function XappDetailPageContent(props) {
5639
5649
  void 0,
5640
5650
  "This one-time unlock is additive. It adds access on top of the active recurring membership instead of replacing it."
5641
5651
  ) }) : null,
5642
- typeof client.prepareMyXappPurchaseIntent === "function" && typeof client.createMyXappPurchasePaymentSession === "function" && canMutate ? /* @__PURE__ */ jsx14(
5652
+ typeof client.prepareMyXappPurchaseIntent === "function" && typeof client.createMyXappPurchasePaymentSession === "function" && hasSubject && canMutate ? /* @__PURE__ */ jsx14(
5643
5653
  "button",
5644
5654
  {
5645
5655
  className: "mx-btn mx-btn-secondary",
@@ -6631,7 +6641,19 @@ function WidgetView() {
6631
6641
  let alive = true;
6632
6642
  void (async () => {
6633
6643
  try {
6634
- const { token: wToken, context } = await client.getWidgetToken(installationId, widgetId);
6644
+ const widgetTokenResponse = await client.getWidgetToken(installationId, widgetId);
6645
+ const resolvedWidgetId = readString(asRecord(widgetTokenResponse).widgetId);
6646
+ if (resolvedWidgetId && resolvedWidgetId !== widgetId) {
6647
+ navigate(
6648
+ {
6649
+ pathname: isEmbedded ? `/widget/${encodeURIComponent(installationId)}/${encodeURIComponent(resolvedWidgetId)}` : `/marketplace/widget/${encodeURIComponent(installationId)}/${encodeURIComponent(resolvedWidgetId)}`,
6650
+ search: tokenSearch
6651
+ },
6652
+ { replace: true }
6653
+ );
6654
+ return;
6655
+ }
6656
+ const { token: wToken, context } = widgetTokenResponse;
6635
6657
  if (!alive) return;
6636
6658
  setSessionExpired(null);
6637
6659
  setWidgetToken(wToken);
@@ -6645,7 +6667,7 @@ function WidgetView() {
6645
6667
  return () => {
6646
6668
  alive = false;
6647
6669
  };
6648
- }, [installationId, widgetId, client]);
6670
+ }, [installationId, widgetId, client, isEmbedded, navigate, tokenSearch]);
6649
6671
  async function remintWidgetSession() {
6650
6672
  if (!installationId || !widgetId) {
6651
6673
  throw new Error("Missing installationId/widgetId for widget refresh");