@xapps-platform/marketplace-ui 0.1.5 → 0.1.6

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
@@ -1,5 +1,5 @@
1
1
  // src/MarketplaceContext.tsx
2
- import { createContext as createContext2, useContext as useContext2 } from "react";
2
+ import { createContext as createContext2, useContext as useContext2, useEffect } from "react";
3
3
 
4
4
  // ../platform-i18n/src/index.tsx
5
5
  import { createContext, useContext, useMemo } from "react";
@@ -235,11 +235,13 @@ var MARKETPLACE_CATALOGS = {
235
235
  "activity.show_details": "Show details",
236
236
  "activity.hide_details": "Hide details",
237
237
  "activity.response_title": "Response",
238
+ "activity.payment_pending": "Payment Pending",
238
239
  "activity.payment_required": "Payment Required",
239
240
  "activity.complete_payment": "Complete Payment",
240
241
  "activity.confirm_payment": "Confirm Payment",
241
242
  "activity.confirming_payment": "Confirming...",
242
243
  "activity.refresh_status": "Refresh Status",
244
+ "activity.waiting_for_payment": "Waiting for payment confirmation\u2026",
243
245
  "activity.waiting_for_response": "Waiting for response\u2026",
244
246
  "activity.execution_timeline": "Execution Timeline",
245
247
  "activity.artifacts_title": "Artifacts",
@@ -490,11 +492,13 @@ var MARKETPLACE_CATALOGS = {
490
492
  "activity.show_details": "Arat\u0103 detalii",
491
493
  "activity.hide_details": "Ascunde detalii",
492
494
  "activity.response_title": "R\u0103spuns",
495
+ "activity.payment_pending": "Plat\u0103 \xEEn a\u0219teptare",
493
496
  "activity.payment_required": "Plata este necesar\u0103",
494
497
  "activity.complete_payment": "Finalizeaz\u0103 plata",
495
498
  "activity.confirm_payment": "Confirm\u0103 plata",
496
499
  "activity.confirming_payment": "Se confirm\u0103...",
497
500
  "activity.refresh_status": "Re\xEEmprosp\u0103teaz\u0103 starea",
501
+ "activity.waiting_for_payment": "\xCEn a\u0219teptarea confirm\u0103rii pl\u0103\u021Bii\u2026",
498
502
  "activity.waiting_for_response": "\xCEn a\u0219teptarea r\u0103spunsului\u2026",
499
503
  "activity.execution_timeline": "Cronologia execu\u021Biei",
500
504
  "activity.artifacts_title": "Artefacte",
@@ -662,10 +666,73 @@ function resolveMarketplaceText(value, locale) {
662
666
  }
663
667
 
664
668
  // src/MarketplaceContext.tsx
665
- import { jsx as jsx3 } from "react/jsx-runtime";
669
+ import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
666
670
  var Ctx = createContext2(null);
671
+ function applyMarketplaceThemeToDocument(theme) {
672
+ if (!theme || typeof document === "undefined") return;
673
+ const root = document.documentElement;
674
+ const map = [
675
+ ["primary", ["--cx-primary", "--mx-primary"]],
676
+ ["primaryDark", ["--cx-primary-dark", "--mx-primary-hover"]],
677
+ ["bg", ["--cx-bg", "--mx-bg"]],
678
+ ["bgSubtle", ["--cx-bg-subtle", "--mx-bg-subtle"]],
679
+ ["card", ["--cx-card", "--mx-card-bg"]],
680
+ ["border", ["--cx-border", "--mx-border"]],
681
+ ["text", ["--cx-text", "--mx-text-main"]],
682
+ ["muted", ["--cx-muted", "--mx-text-muted"]],
683
+ ["shadowSm", ["--cx-shadow-sm", "--mx-shadow-sm"]],
684
+ ["shadow", ["--cx-shadow", "--mx-shadow"]],
685
+ ["shadowLg", ["--cx-shadow-lg", "--mx-shadow-lg"]],
686
+ ["radiusSm", ["--cx-radius-sm", "--mx-radius-sm"]],
687
+ ["radiusMd", ["--cx-radius-md", "--mx-radius-md"]],
688
+ ["radius", ["--cx-radius", "--cx-radius-lg", "--mx-radius-md", "--mx-radius-lg"]],
689
+ ["radiusLg", ["--cx-radius-lg", "--mx-radius-lg"]],
690
+ ["fontFamily", ["--mx-font-family"]]
691
+ ];
692
+ for (const [key, cssVars] of map) {
693
+ const rawValue = theme[key];
694
+ const value = typeof rawValue === "string" ? rawValue.trim() : "";
695
+ if (!value) continue;
696
+ for (const cssVar of cssVars) root.style.setProperty(cssVar, value);
697
+ }
698
+ if (typeof theme.radius === "string" && theme.radius.trim() && !(typeof theme.radiusSm === "string" && theme.radiusSm.trim())) {
699
+ root.style.setProperty("--cx-radius-sm", theme.radius.trim());
700
+ root.style.setProperty("--mx-radius-sm", theme.radius.trim());
701
+ }
702
+ if (typeof theme.bg === "string" && theme.bg.trim() && !theme.bgSubtle) {
703
+ root.style.setProperty("--cx-bg-subtle", theme.bg.trim());
704
+ root.style.setProperty("--mx-bg-subtle", theme.bg.trim());
705
+ }
706
+ const directTokens = theme.tokens && typeof theme.tokens === "object" && !Array.isArray(theme.tokens) ? theme.tokens : null;
707
+ if (directTokens) {
708
+ for (const [cssVar, rawValue] of Object.entries(directTokens)) {
709
+ const value = typeof rawValue === "string" ? rawValue.trim() : "";
710
+ if (!value) continue;
711
+ if (!cssVar.startsWith("--mx-") && !cssVar.startsWith("--cx-") && !cssVar.startsWith("--xapps-")) {
712
+ continue;
713
+ }
714
+ root.style.setProperty(cssVar, value);
715
+ }
716
+ }
717
+ const themeMode = typeof theme.mode === "string" ? theme.mode.trim().toLowerCase() : typeof theme.themeMode === "string" ? theme.themeMode.trim().toLowerCase() : "";
718
+ if (themeMode === "dark" || themeMode === "light") {
719
+ root.dataset.xappsThemeMode = themeMode;
720
+ }
721
+ }
722
+ function MarketplaceRuntimeBridge(props) {
723
+ useEffect(() => {
724
+ const locale = String(props.env?.locale || props.host.locale || "").trim();
725
+ if (locale && typeof document !== "undefined") {
726
+ document.documentElement.lang = locale;
727
+ }
728
+ }, [props.env?.locale, props.host.locale]);
729
+ useEffect(() => {
730
+ applyMarketplaceThemeToDocument(props.host.theme || null);
731
+ }, [props.host.theme]);
732
+ return /* @__PURE__ */ jsx3(Fragment, { children: props.children });
733
+ }
667
734
  function MarketplaceProvider(props) {
668
- return /* @__PURE__ */ jsx3(MarketplaceI18nProvider, { locale: props.env?.locale, children: /* @__PURE__ */ jsx3(Ctx.Provider, { value: { client: props.client, host: props.host, env: props.env }, children: props.children }) });
735
+ return /* @__PURE__ */ jsx3(MarketplaceI18nProvider, { locale: props.env?.locale, children: /* @__PURE__ */ jsx3(MarketplaceRuntimeBridge, { host: props.host, env: props.env, children: /* @__PURE__ */ jsx3(Ctx.Provider, { value: { client: props.client, host: props.host, env: props.env }, children: props.children }) }) });
669
736
  }
670
737
  function useMarketplace() {
671
738
  const v = useContext2(Ctx);
@@ -677,11 +744,11 @@ function useMarketplace() {
677
744
  import { Route, Routes } from "react-router-dom";
678
745
 
679
746
  // src/pages/CatalogPage.tsx
680
- import { useEffect as useEffect2, useMemo as useMemo2, useState } from "react";
747
+ import { useEffect as useEffect3, useMemo as useMemo2, useState } from "react";
681
748
  import { Link as Link2, useLocation, useNavigate } from "react-router-dom";
682
749
 
683
750
  // src/components/ConfirmActionModal.tsx
684
- import { useEffect } from "react";
751
+ import { useEffect as useEffect2 } from "react";
685
752
  import { jsx as jsx4, jsxs } from "react/jsx-runtime";
686
753
  function ConfirmActionModal(props) {
687
754
  const { t } = useMarketplaceI18n();
@@ -694,7 +761,7 @@ function ConfirmActionModal(props) {
694
761
  onConfirm,
695
762
  onCancel
696
763
  } = props;
697
- useEffect(() => {
764
+ useEffect2(() => {
698
765
  if (!open || typeof window === "undefined") return;
699
766
  const handleKeyDown = (event) => {
700
767
  if (event.key === "Escape") {
@@ -859,7 +926,7 @@ function normalizeExpandStage(value, expanded) {
859
926
  }
860
927
 
861
928
  // src/pages/CatalogPage.tsx
862
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
929
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
863
930
  function useQueryToken() {
864
931
  const loc = useLocation();
865
932
  const qs = new URLSearchParams(loc.search);
@@ -961,22 +1028,22 @@ function CatalogPage() {
961
1028
  setBusy(false);
962
1029
  }
963
1030
  }
964
- useEffect2(() => {
1031
+ useEffect3(() => {
965
1032
  void refresh();
966
1033
  host.refreshInstallations();
967
1034
  }, []);
968
- useEffect2(() => {
1035
+ useEffect3(() => {
969
1036
  const stored = readStoredCatalogFilters(storageKey);
970
1037
  setInstalledOnly(Boolean(stored?.addedOnly));
971
1038
  setSelectedTag(typeof stored?.selectedTag === "string" ? stored.selectedTag : defaultTag);
972
1039
  }, [defaultTag, storageKey]);
973
- useEffect2(() => {
1040
+ useEffect3(() => {
974
1041
  const restrictedTags = env?.tags ?? [];
975
1042
  if (selectedTag && restrictedTags.length > 0 && !restrictedTags.includes(selectedTag)) {
976
1043
  setSelectedTag(defaultTag);
977
1044
  }
978
1045
  }, [defaultTag, env?.tags, selectedTag]);
979
- useEffect2(() => {
1046
+ useEffect3(() => {
980
1047
  writeStoredCatalogFilters(storageKey, {
981
1048
  addedOnly: installedOnly,
982
1049
  selectedTag: selectedTag || ""
@@ -1115,7 +1182,7 @@ function CatalogPage() {
1115
1182
  /* @__PURE__ */ jsx6("div", { className: "mx-skeleton-line mx-skeleton-line-full" }),
1116
1183
  /* @__PURE__ */ jsx6("div", { className: "mx-skeleton-line mx-skeleton-line-short" })
1117
1184
  ] })
1118
- ] }, i)) }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
1185
+ ] }, i)) }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
1119
1186
  !busy && /* @__PURE__ */ jsx6("div", { className: "mx-results-bar", children: /* @__PURE__ */ jsx6("div", { className: "mx-results-count", children: filtered.length === items.length ? t(
1120
1187
  "catalog.results_all",
1121
1188
  {
@@ -1280,7 +1347,7 @@ function CatalogPage() {
1280
1347
  }
1281
1348
 
1282
1349
  // src/pages/InvoicesPage.tsx
1283
- import { useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
1350
+ import { useEffect as useEffect4, useMemo as useMemo3, useState as useState2 } from "react";
1284
1351
  import { Link as Link4, useLocation as useLocation2 } from "react-router-dom";
1285
1352
 
1286
1353
  // src/components/MarketplaceActivityTabs.tsx
@@ -1333,7 +1400,7 @@ function MarketplaceActivityTabs(props) {
1333
1400
  }
1334
1401
 
1335
1402
  // src/pages/InvoicesPage.tsx
1336
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1403
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1337
1404
  function useQueryToken2() {
1338
1405
  const loc = useLocation2();
1339
1406
  const qs = new URLSearchParams(loc.search);
@@ -1408,7 +1475,7 @@ function InvoicesPage() {
1408
1475
  setBusy(false);
1409
1476
  }
1410
1477
  }
1411
- useEffect3(() => {
1478
+ useEffect4(() => {
1412
1479
  void refresh(pageParam);
1413
1480
  host.notifyNavigation?.({
1414
1481
  path: typeof window !== "undefined" ? window.location.pathname : "",
@@ -1416,7 +1483,7 @@ function InvoicesPage() {
1416
1483
  params: { xappId: xappIdFilter || null }
1417
1484
  });
1418
1485
  }, [installationIdFilter, pageParam, paymentSessionIdFilter, xappIdFilter]);
1419
- useEffect3(() => {
1486
+ useEffect4(() => {
1420
1487
  if (!focusedInvoiceId || !client.getMyInvoiceHistory) {
1421
1488
  setFocusedInvoice(null);
1422
1489
  setFocusedHistory([]);
@@ -1445,7 +1512,7 @@ function InvoicesPage() {
1445
1512
  cancelled = true;
1446
1513
  };
1447
1514
  }, [client, focusedInvoiceId]);
1448
- useEffect3(() => {
1515
+ useEffect4(() => {
1449
1516
  if (!xappIdFilter) {
1450
1517
  setXappTitle("");
1451
1518
  return;
@@ -1493,7 +1560,7 @@ function InvoicesPage() {
1493
1560
  return /* @__PURE__ */ jsxs4("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
1494
1561
  /* @__PURE__ */ jsxs4("div", { className: "mx-breadcrumb", children: [
1495
1562
  /* @__PURE__ */ jsx8(Link4, { to: isEmbedded ? "/" : "/marketplace", children: t("common.marketplace", void 0, "Marketplace") }),
1496
- xappLink && /* @__PURE__ */ jsxs4(Fragment2, { children: [
1563
+ xappLink && /* @__PURE__ */ jsxs4(Fragment3, { children: [
1497
1564
  /* @__PURE__ */ jsx8("span", { className: "mx-breadcrumb-sep", children: "/" }),
1498
1565
  /* @__PURE__ */ jsx8(Link4, { to: xappLink, children: xappTitle || xappIdFilter })
1499
1566
  ] }),
@@ -1571,7 +1638,7 @@ function InvoicesPage() {
1571
1638
  ] }),
1572
1639
  /* @__PURE__ */ jsx8(Link4, { to: listHref, className: "mx-btn mx-btn-ghost", children: t("activity.back_to_invoice_list", void 0, "Back to invoice list") })
1573
1640
  ] }),
1574
- focusedError ? /* @__PURE__ */ jsx8("div", { className: "mx-alert mx-alert-error mx-alert-panel", children: focusedError }) : focusedInvoice ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1641
+ focusedError ? /* @__PURE__ */ jsx8("div", { className: "mx-alert mx-alert-error mx-alert-panel", children: focusedError }) : focusedInvoice ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
1575
1642
  /* @__PURE__ */ jsxs4("div", { className: "mx-record-grid", children: [
1576
1643
  /* @__PURE__ */ jsxs4("div", { className: "mx-record-field", children: [
1577
1644
  /* @__PURE__ */ jsx8("div", { className: "mx-record-label", children: t("common.status", void 0, "Status") }),
@@ -1766,9 +1833,9 @@ function InvoicesPage() {
1766
1833
  }
1767
1834
 
1768
1835
  // src/pages/NotificationsPage.tsx
1769
- import { useEffect as useEffect4, useMemo as useMemo4, useState as useState3 } from "react";
1836
+ import { useEffect as useEffect5, useMemo as useMemo4, useState as useState3 } from "react";
1770
1837
  import { Link as Link5, useLocation as useLocation3 } from "react-router-dom";
1771
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1838
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1772
1839
  function useQueryToken3() {
1773
1840
  const loc = useLocation3();
1774
1841
  const qs = new URLSearchParams(loc.search);
@@ -1882,7 +1949,7 @@ function NotificationsPage() {
1882
1949
  setError(readFirstString(asRecord(e).message) || String(e));
1883
1950
  }
1884
1951
  }
1885
- useEffect4(() => {
1952
+ useEffect5(() => {
1886
1953
  void refresh();
1887
1954
  host.notifyNavigation?.({
1888
1955
  path: typeof window !== "undefined" ? window.location.pathname : "",
@@ -1890,7 +1957,7 @@ function NotificationsPage() {
1890
1957
  params: { xappId: xappIdFilter || null }
1891
1958
  });
1892
1959
  }, [focusedNotificationId, installationIdFilter, xappIdFilter]);
1893
- useEffect4(() => {
1960
+ useEffect5(() => {
1894
1961
  if (!focusedNotificationId) {
1895
1962
  setFocusedNotification(null);
1896
1963
  setFocusedError(null);
@@ -1919,7 +1986,7 @@ function NotificationsPage() {
1919
1986
  cancelled = true;
1920
1987
  };
1921
1988
  }, [client, focusedNotificationId, installationIdFilter, xappIdFilter]);
1922
- useEffect4(() => {
1989
+ useEffect5(() => {
1923
1990
  if (!xappIdFilter) {
1924
1991
  setXappTitle("");
1925
1992
  return;
@@ -1966,7 +2033,7 @@ function NotificationsPage() {
1966
2033
  return /* @__PURE__ */ jsxs5("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
1967
2034
  /* @__PURE__ */ jsxs5("div", { className: "mx-breadcrumb", children: [
1968
2035
  /* @__PURE__ */ jsx9(Link5, { to: isEmbedded ? "/" : "/marketplace", children: t("common.marketplace", void 0, "Marketplace") }),
1969
- xappLink && /* @__PURE__ */ jsxs5(Fragment3, { children: [
2036
+ xappLink && /* @__PURE__ */ jsxs5(Fragment4, { children: [
1970
2037
  /* @__PURE__ */ jsx9("span", { className: "mx-breadcrumb-sep", children: "/" }),
1971
2038
  /* @__PURE__ */ jsx9(Link5, { to: xappLink, children: xappTitle || xappIdFilter })
1972
2039
  ] }),
@@ -2189,9 +2256,9 @@ function NotificationsPage() {
2189
2256
  }
2190
2257
 
2191
2258
  // src/pages/PaymentsPage.tsx
2192
- import { useEffect as useEffect5, useMemo as useMemo5, useState as useState4 } from "react";
2259
+ import { useEffect as useEffect6, useMemo as useMemo5, useState as useState4 } from "react";
2193
2260
  import { Link as Link6, useLocation as useLocation4 } from "react-router-dom";
2194
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2261
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2195
2262
  function useQueryToken4() {
2196
2263
  const loc = useLocation4();
2197
2264
  const qs = new URLSearchParams(loc.search);
@@ -2251,7 +2318,7 @@ function PaymentsPage() {
2251
2318
  setBusy(false);
2252
2319
  }
2253
2320
  }
2254
- useEffect5(() => {
2321
+ useEffect6(() => {
2255
2322
  void refresh();
2256
2323
  host.notifyNavigation?.({
2257
2324
  path: typeof window !== "undefined" ? window.location.pathname : "",
@@ -2259,7 +2326,7 @@ function PaymentsPage() {
2259
2326
  params: { xappId: xappIdFilter || null }
2260
2327
  });
2261
2328
  }, [focusedPaymentSessionId, installationIdFilter, xappIdFilter]);
2262
- useEffect5(() => {
2329
+ useEffect6(() => {
2263
2330
  if (!focusedPaymentSessionId || !client.getMyPaymentSession) {
2264
2331
  setFocusedSession(null);
2265
2332
  setFocusedError(null);
@@ -2283,7 +2350,7 @@ function PaymentsPage() {
2283
2350
  cancelled = true;
2284
2351
  };
2285
2352
  }, [client, focusedPaymentSessionId]);
2286
- useEffect5(() => {
2353
+ useEffect6(() => {
2287
2354
  if (!xappIdFilter) {
2288
2355
  setXappTitle("");
2289
2356
  return;
@@ -2330,7 +2397,7 @@ function PaymentsPage() {
2330
2397
  return /* @__PURE__ */ jsxs6("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
2331
2398
  /* @__PURE__ */ jsxs6("div", { className: "mx-breadcrumb", children: [
2332
2399
  /* @__PURE__ */ jsx10(Link6, { to: isEmbedded ? "/" : "/marketplace", children: t("common.marketplace", void 0, "Marketplace") }),
2333
- xappLink && /* @__PURE__ */ jsxs6(Fragment4, { children: [
2400
+ xappLink && /* @__PURE__ */ jsxs6(Fragment5, { children: [
2334
2401
  /* @__PURE__ */ jsx10("span", { className: "mx-breadcrumb-sep", children: "/" }),
2335
2402
  /* @__PURE__ */ jsx10(Link6, { to: xappLink, children: xappTitle || xappIdFilter })
2336
2403
  ] }),
@@ -2548,7 +2615,7 @@ function PaymentsPage() {
2548
2615
  }
2549
2616
 
2550
2617
  // src/pages/RequestDetailPage.tsx
2551
- import { useEffect as useEffect6, useMemo as useMemo6, useState as useState5 } from "react";
2618
+ import { useEffect as useEffect7, useMemo as useMemo6, useState as useState5 } from "react";
2552
2619
  import { Link as Link7, useLocation as useLocation5, useNavigate as useNavigate2, useParams } from "react-router-dom";
2553
2620
 
2554
2621
  // src/components/SchemaOutputView.tsx
@@ -2636,6 +2703,10 @@ function normalizeActionKind(raw) {
2636
2703
  function resolveText(t, key, fallback) {
2637
2704
  return typeof t === "function" ? t(key, fallback) : fallback;
2638
2705
  }
2706
+ function isSettledPaymentStatus(value) {
2707
+ const normalized = readString3(value).toLowerCase();
2708
+ return normalized === "paid" || normalized === "settled" || normalized === "succeeded" || normalized === "completed";
2709
+ }
2639
2710
  function resolveCtaLabel(actionKind, t) {
2640
2711
  if (actionKind === "complete_payment") {
2641
2712
  return resolveText(t, "payment_lock.complete_payment", "Complete Payment");
@@ -2734,7 +2805,11 @@ function resolvePaymentLockStateFromGuardSummary(summaryInput, options) {
2734
2805
  })();
2735
2806
  const isPaymentKind = actionKind === "complete_payment" || actionKind === "payment_required";
2736
2807
  const isPaymentReason = reason === "payment_required" || reason === "payment_evidence_missing" || reason === "payment_receipt_already_used";
2737
- const isLocked = isPaymentKind || isPaymentReason;
2808
+ const requestStatus = readString3(options?.requestStatus).toUpperCase();
2809
+ const paymentSettled = isSettledPaymentStatus(options?.paymentStatus);
2810
+ const isHeldForPayment = requestStatus === "PAYMENT_PENDING";
2811
+ const isResolvedPastHold = paymentSettled && requestStatus !== "" && !isHeldForPayment;
2812
+ const isLocked = !isResolvedPastHold && (isPaymentKind || isPaymentReason);
2738
2813
  return {
2739
2814
  isLocked,
2740
2815
  reason,
@@ -2749,8 +2824,137 @@ function resolvePaymentLockStateFromGuardSummary(summaryInput, options) {
2749
2824
  };
2750
2825
  }
2751
2826
 
2827
+ // src/utils/operationalSurfaces.ts
2828
+ function readPathEmbedded() {
2829
+ return typeof window !== "undefined" && window.location.pathname.startsWith("/embed");
2830
+ }
2831
+ function getOperationalSurfaces(detail) {
2832
+ const value = detail?.operational_surfaces;
2833
+ if (!value || typeof value !== "object") return null;
2834
+ return value;
2835
+ }
2836
+ function readOperationalSurfaceMode(input) {
2837
+ const policy = input.env?.operationalSurfacesVisibility;
2838
+ return input.isEmbedded ? policy?.embed ?? "contract" : policy?.portal ?? "contract";
2839
+ }
2840
+ function isOperationalSurfaceVisible(detail, surface, options) {
2841
+ const surfaces = getOperationalSurfaces(detail);
2842
+ const descriptor = surfaces?.[surface];
2843
+ if (!descriptor?.enabled) return false;
2844
+ const isEmbedded = options?.isEmbedded ?? readPathEmbedded();
2845
+ return isEmbedded ? descriptor.visibility.embed : descriptor.visibility.portal;
2846
+ }
2847
+ function surfaceClientAvailable(client, surface) {
2848
+ if (surface === "requests") return typeof client.listMyRequests === "function";
2849
+ if (surface === "payments") return typeof client.listMyPaymentSessions === "function";
2850
+ if (surface === "invoices") return typeof client.listMyInvoices === "function";
2851
+ if (surface === "notifications") return typeof client.listMyNotifications === "function";
2852
+ return false;
2853
+ }
2854
+ function buildOperationalSurfaceHref(input) {
2855
+ const isEmbedded = input.isEmbedded ?? readPathEmbedded();
2856
+ const params = new URLSearchParams({
2857
+ xappId: input.xappId,
2858
+ ...input.installationId ? { installationId: input.installationId } : {},
2859
+ ...input.paymentSessionId ? { paymentSessionId: input.paymentSessionId } : {},
2860
+ ...input.invoiceId ? { invoiceId: input.invoiceId } : {},
2861
+ ...input.notificationId ? { notificationId: input.notificationId } : {},
2862
+ ...input.token ? { token: input.token } : {}
2863
+ });
2864
+ const base = isEmbedded ? `/${input.surface}` : `/marketplace/${input.surface}`;
2865
+ const detailSegment = input.surface === "requests" && input.requestId ? `/${encodeURIComponent(input.requestId)}` : "";
2866
+ return `${base}${detailSegment}?${params.toString()}`;
2867
+ }
2868
+ function getVisibleOperationalSurfaces(input) {
2869
+ const isEmbedded = input.isEmbedded ?? readPathEmbedded();
2870
+ const mode = readOperationalSurfaceMode({
2871
+ env: input.env,
2872
+ isEmbedded
2873
+ });
2874
+ const allSurfaces = [
2875
+ "requests",
2876
+ "payments",
2877
+ "invoices",
2878
+ "notifications"
2879
+ ];
2880
+ if (mode === "testing_all") {
2881
+ return allSurfaces.filter((surface) => {
2882
+ if (surface === "requests" && input.env?.requestsEnabled === false) return false;
2883
+ return surfaceClientAvailable(input.client, surface);
2884
+ });
2885
+ }
2886
+ const surfaces = getOperationalSurfaces(input.detail);
2887
+ if (!surfaces) return [];
2888
+ return allSurfaces.filter(
2889
+ (surface) => surfaceClientAvailable(input.client, surface) && isOperationalSurfaceVisible(input.detail, surface, { isEmbedded })
2890
+ );
2891
+ }
2892
+ function getOperationalSurfaceLabel(surface) {
2893
+ if (surface === "requests") return "Requests";
2894
+ if (surface === "payments") return "Payments";
2895
+ if (surface === "invoices") return "Invoices";
2896
+ return "Notifications";
2897
+ }
2898
+ function resolveOperationalSurfacePlacement(input) {
2899
+ const isEmbedded = input.isEmbedded ?? readPathEmbedded();
2900
+ const policy = input.env?.operationalSurfacePlacement;
2901
+ const scopePolicy = isEmbedded ? policy?.embed : policy?.portal;
2902
+ const bySurface = scopePolicy?.bySurface?.[input.surface];
2903
+ if (bySurface) return bySurface;
2904
+ return scopePolicy?.default ?? "in_router";
2905
+ }
2906
+ async function discoverOperationalSurfaceData(input) {
2907
+ const xappId = String(input.xappId || "").trim();
2908
+ const installationId = String(input.installationId || "").trim();
2909
+ if (!xappId) return [];
2910
+ const queryBase = {
2911
+ xappId,
2912
+ ...installationId ? { installationId } : {}
2913
+ };
2914
+ const checks = await Promise.all([
2915
+ (async () => {
2916
+ if (typeof input.client.listMyPaymentSessions !== "function") return null;
2917
+ try {
2918
+ const res = await input.client.listMyPaymentSessions({
2919
+ ...queryBase,
2920
+ limit: 1
2921
+ });
2922
+ return Array.isArray(res?.items) && res.items.length > 0 ? "payments" : null;
2923
+ } catch {
2924
+ return null;
2925
+ }
2926
+ })(),
2927
+ (async () => {
2928
+ if (typeof input.client.listMyInvoices !== "function") return null;
2929
+ try {
2930
+ const res = await input.client.listMyInvoices({
2931
+ ...queryBase,
2932
+ page: 1,
2933
+ pageSize: 1
2934
+ });
2935
+ return Array.isArray(res?.items) && res.items.length > 0 ? "invoices" : null;
2936
+ } catch {
2937
+ return null;
2938
+ }
2939
+ })(),
2940
+ (async () => {
2941
+ if (typeof input.client.listMyNotifications !== "function") return null;
2942
+ try {
2943
+ const res = await input.client.listMyNotifications({
2944
+ ...queryBase,
2945
+ limit: 1
2946
+ });
2947
+ return Array.isArray(res?.items) && res.items.length > 0 || Number(res?.unread_count || 0) > 0 ? "notifications" : null;
2948
+ } catch {
2949
+ return null;
2950
+ }
2951
+ })()
2952
+ ]);
2953
+ return checks.filter((surface) => Boolean(surface));
2954
+ }
2955
+
2752
2956
  // src/pages/RequestDetailPage.tsx
2753
- import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2957
+ import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2754
2958
  function useQueryToken5() {
2755
2959
  const loc = useLocation5();
2756
2960
  const qs = new URLSearchParams(loc.search);
@@ -2760,6 +2964,18 @@ function useQuery4() {
2760
2964
  const loc = useLocation5();
2761
2965
  return useMemo6(() => new URLSearchParams(loc.search), [loc.search]);
2762
2966
  }
2967
+ function navigateToExternalOrHost(url) {
2968
+ const next = String(url || "").trim();
2969
+ if (!next || typeof window === "undefined") return;
2970
+ try {
2971
+ if (window.parent && window.parent !== window) {
2972
+ window.parent.postMessage({ type: "XAPPS_UI_NAVIGATE", data: { path: next } }, "*");
2973
+ return;
2974
+ }
2975
+ } catch {
2976
+ }
2977
+ window.location.href = next;
2978
+ }
2763
2979
  function RequestDetailPage() {
2764
2980
  const { client, host, env } = useMarketplace();
2765
2981
  const { t, locale } = useMarketplaceI18n();
@@ -2780,6 +2996,8 @@ function RequestDetailPage() {
2780
2996
  const requestRecord = asRecord(dataRecord.request);
2781
2997
  const toolRecord = asRecord(dataRecord.tool);
2782
2998
  const manifestRecord = asRecord(dataRecord.manifest);
2999
+ const requestPayment = asRecord(requestRecord.payment);
3000
+ const requestPaymentSummary = asRecord(requestRecord.payment_summary);
2783
3001
  const status = readFirstString(requestRecord.status) || void 0;
2784
3002
  const isTerminal = status === "COMPLETED" || status === "FAILED";
2785
3003
  const effectiveXappId = readFirstString(requestRecord.xapp_id, xappIdFilter);
@@ -2812,6 +3030,8 @@ function RequestDetailPage() {
2812
3030
  if (!resolvePaymentLockStateFromGuardSummary(
2813
3031
  asRecord(asRecord(res).request).guard_summary ?? null,
2814
3032
  {
3033
+ requestStatus: readFirstString(asRecord(asRecord(res).request).status),
3034
+ paymentStatus: readFirstString(asRecord(asRecord(res).request).payment_status),
2815
3035
  t: (key, fallback) => t(key, void 0, fallback)
2816
3036
  }
2817
3037
  ).isLocked) {
@@ -2823,31 +3043,7 @@ function RequestDetailPage() {
2823
3043
  setBusy(false);
2824
3044
  }
2825
3045
  }
2826
- async function reconcilePaymentFinality() {
2827
- if (!id || reconcileBusy || !client.reconcileMyRequestPayment) return;
2828
- setReconcileError(null);
2829
- setReconcileState("confirming_payment");
2830
- setReconcileBusy(true);
2831
- try {
2832
- const res = await client.reconcileMyRequestPayment({
2833
- requestId: String(id),
2834
- paymentSessionId: requestPaymentLock.paymentSessionId
2835
- });
2836
- setReconcileState(res?.finality_state || "none");
2837
- const redirectUrl = String(res?.redirect_url || "").trim();
2838
- if (redirectUrl) {
2839
- window.location.href = redirectUrl;
2840
- return;
2841
- }
2842
- await refreshOnce();
2843
- } catch (e) {
2844
- setReconcileError(readFirstString(asRecord(e).message) || String(e));
2845
- setReconcileState("failed");
2846
- } finally {
2847
- setReconcileBusy(false);
2848
- }
2849
- }
2850
- useEffect6(() => {
3046
+ useEffect7(() => {
2851
3047
  if (!id) return;
2852
3048
  let alive = true;
2853
3049
  let timer = null;
@@ -2940,11 +3136,62 @@ function RequestDetailPage() {
2940
3136
  }, [toolRecord]);
2941
3137
  const requestPaymentLock = useMemo6(
2942
3138
  () => resolvePaymentLockStateFromGuardSummary(requestRecord.guard_summary ?? null, {
3139
+ requestStatus: readFirstString(requestRecord.status),
3140
+ paymentStatus: readFirstString(requestRecord.payment_status),
2943
3141
  reconcileState,
2944
3142
  t: (key, fallback) => t(key, void 0, fallback)
2945
3143
  }),
2946
3144
  [requestRecord.guard_summary, reconcileState, t]
2947
3145
  );
3146
+ const isPaymentPending = String(status || "").trim().toUpperCase() === "PAYMENT_PENDING";
3147
+ const showPaymentWaitState = requestPaymentLock.isLocked || isPaymentPending;
3148
+ const eventPaymentSessionId = useMemo6(() => {
3149
+ const events = Array.isArray(dataRecord.events) ? dataRecord.events : [];
3150
+ for (let index = events.length - 1; index >= 0; index -= 1) {
3151
+ const candidate = readPaymentSessionIdFromUnknown(getEventPayload(events[index]));
3152
+ if (candidate) return candidate;
3153
+ }
3154
+ return "";
3155
+ }, [dataRecord.events]);
3156
+ const effectivePaymentSessionId = readFirstString(
3157
+ requestPaymentLock.paymentSessionId,
3158
+ requestRecord.payment_session_id,
3159
+ requestRecord.paymentSessionId,
3160
+ requestPayment.payment_session_id,
3161
+ requestPayment.paymentSessionId,
3162
+ requestPaymentSummary.payment_session_id,
3163
+ requestPaymentSummary.paymentSessionId,
3164
+ eventPaymentSessionId
3165
+ ) || "";
3166
+ const directPaymentUrl = readFirstString(
3167
+ requestRecord.payment_resume_url,
3168
+ requestRecord.paymentResumeUrl,
3169
+ requestPayment.resume_url,
3170
+ requestPayment.resumeUrl,
3171
+ requestPaymentSummary.payment_resume_url,
3172
+ requestPaymentSummary.paymentResumeUrl,
3173
+ requestPaymentLock.actionUrl
3174
+ ) || "";
3175
+ const paymentSurfaceHref = (() => {
3176
+ if (!effectivePaymentSessionId) return "";
3177
+ const installationId = readFirstString(requestRecord.installation_id) || void 0;
3178
+ if (effectiveXappId) {
3179
+ return buildOperationalSurfaceHref({
3180
+ surface: "payments",
3181
+ xappId: effectiveXappId,
3182
+ installationId,
3183
+ paymentSessionId: effectivePaymentSessionId,
3184
+ token: token || void 0,
3185
+ isEmbedded
3186
+ });
3187
+ }
3188
+ const params = new URLSearchParams({
3189
+ paymentSessionId: effectivePaymentSessionId,
3190
+ ...installationId ? { installationId } : {},
3191
+ ...token ? { token } : {}
3192
+ });
3193
+ return `${isEmbedded ? "/payments" : "/marketplace/payments"}?${params.toString()}`;
3194
+ })();
2948
3195
  function getEventPayload(ev) {
2949
3196
  const eventRecord = asRecord(ev);
2950
3197
  if (!Object.keys(eventRecord).length) return null;
@@ -2961,6 +3208,39 @@ function RequestDetailPage() {
2961
3208
  }
2962
3209
  return null;
2963
3210
  }
3211
+ function readPaymentSessionIdFromUnknown(value) {
3212
+ const record = asRecord(value);
3213
+ const direct = readFirstString(
3214
+ record.payment_session_id,
3215
+ record.paymentSessionId,
3216
+ asRecord(record.action).payment_session_id,
3217
+ asRecord(record.action).paymentSessionId,
3218
+ asRecord(record.guard).payment_session_id,
3219
+ asRecord(asRecord(record.guard).action).payment_session_id,
3220
+ asRecord(asRecord(record.guard).action).paymentSessionId
3221
+ );
3222
+ if (direct) return direct;
3223
+ const url = readFirstString(
3224
+ record.url,
3225
+ record.payment_url,
3226
+ record.paymentUrl,
3227
+ asRecord(record.action).url,
3228
+ asRecord(asRecord(record.guard).action).url
3229
+ );
3230
+ if (!url) return "";
3231
+ try {
3232
+ const parsed = new URL(
3233
+ url,
3234
+ typeof window !== "undefined" ? window.location.href : "http://localhost"
3235
+ );
3236
+ return readFirstString(
3237
+ parsed.searchParams.get("payment_session_id"),
3238
+ parsed.searchParams.get("paymentSessionId")
3239
+ ) || "";
3240
+ } catch {
3241
+ return "";
3242
+ }
3243
+ }
2964
3244
  function extractGuardSummary(payload) {
2965
3245
  const p = asRecord(payload);
2966
3246
  const guard = asRecord(p.guard);
@@ -3038,7 +3318,7 @@ function RequestDetailPage() {
3038
3318
  if (raw == null) return null;
3039
3319
  const enriched = attachArtifactLinks(raw, artifacts);
3040
3320
  const isOpen = expandedPayloads[idx] ?? false;
3041
- return /* @__PURE__ */ jsxs8(Fragment5, { children: [
3321
+ return /* @__PURE__ */ jsxs8(Fragment6, { children: [
3042
3322
  /* @__PURE__ */ jsxs8(
3043
3323
  "button",
3044
3324
  {
@@ -3067,14 +3347,56 @@ function RequestDetailPage() {
3067
3347
  }
3068
3348
  function StatusBadge4({ status: status2 }) {
3069
3349
  const s = String(status2 || "");
3350
+ const normalized = s.trim().toUpperCase();
3070
3351
  const className = s === "COMPLETED" ? "mx-badge-success" : s === "FAILED" ? "mx-badge-danger" : "mx-badge-warning";
3071
- return /* @__PURE__ */ jsx12("span", { className: `mx-badge ${className}`, children: s || "\u2014" });
3352
+ const label = normalized === "PAYMENT_PENDING" ? t("activity.payment_pending", void 0, "Payment Pending") : s || "\u2014";
3353
+ return /* @__PURE__ */ jsx12("span", { className: `mx-badge ${className}`, children: label });
3354
+ }
3355
+ async function continuePayment() {
3356
+ if (client.reconcileMyRequestPayment && isPaymentPending) {
3357
+ setReconcileError(null);
3358
+ setReconcileState("confirming_payment");
3359
+ setReconcileBusy(true);
3360
+ try {
3361
+ const hostReturnUrl = readHostReturnUrl(loc.search);
3362
+ const currentReturnUrl = String(
3363
+ hostReturnUrl || (typeof window !== "undefined" ? window.location.href : "") || ""
3364
+ ).trim();
3365
+ const res = await client.reconcileMyRequestPayment({
3366
+ requestId: String(id),
3367
+ paymentSessionId: effectivePaymentSessionId || void 0,
3368
+ returnUrl: currentReturnUrl || void 0,
3369
+ cancelUrl: currentReturnUrl || void 0
3370
+ });
3371
+ setReconcileState(res?.finality_state || "none");
3372
+ const redirectUrl = String(res?.redirect_url || "").trim();
3373
+ if (redirectUrl) {
3374
+ navigateToExternalOrHost(redirectUrl);
3375
+ return;
3376
+ }
3377
+ await refreshOnce();
3378
+ return;
3379
+ } catch (e) {
3380
+ setReconcileError(readFirstString(asRecord(e).message) || String(e));
3381
+ setReconcileState("failed");
3382
+ return;
3383
+ } finally {
3384
+ setReconcileBusy(false);
3385
+ }
3386
+ }
3387
+ if (directPaymentUrl) {
3388
+ navigateToExternalOrHost(directPaymentUrl);
3389
+ return;
3390
+ }
3391
+ if (paymentSurfaceHref) {
3392
+ void navigate(paymentSurfaceHref);
3393
+ }
3072
3394
  }
3073
3395
  return /* @__PURE__ */ jsxs8("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
3074
3396
  /* @__PURE__ */ jsxs8("div", { className: "mx-breadcrumb", children: [
3075
3397
  !env?.singleXappMode && /* @__PURE__ */ jsx12(Link7, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") }),
3076
3398
  env?.singleXappMode && !env?.embedMode && /* @__PURE__ */ jsx12(Link7, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") }),
3077
- xappTo && /* @__PURE__ */ jsxs8(Fragment5, { children: [
3399
+ xappTo && /* @__PURE__ */ jsxs8(Fragment6, { children: [
3078
3400
  (!env?.singleXappMode || env?.singleXappMode && !env?.embedMode) && /* @__PURE__ */ jsx12("span", { className: "mx-breadcrumb-sep", children: "/" }),
3079
3401
  /* @__PURE__ */ jsx12(Link7, { to: xappTo, children: xappCrumbLabel })
3080
3402
  ] }),
@@ -3143,7 +3465,7 @@ function RequestDetailPage() {
3143
3465
  /* @__PURE__ */ jsx12("h2", { className: "mx-title mx-request-section-title", children: title }),
3144
3466
  /* @__PURE__ */ jsxs8("div", { className: "mx-request-meta-row", children: [
3145
3467
  /* @__PURE__ */ jsx12("span", { children: effectiveXappTitle || "\u2014" }),
3146
- readString(requestRecord.xapp_version) && /* @__PURE__ */ jsxs8(Fragment5, { children: [
3468
+ readString(requestRecord.xapp_version) && /* @__PURE__ */ jsxs8(Fragment6, { children: [
3147
3469
  /* @__PURE__ */ jsx12("span", { children: "\xB7" }),
3148
3470
  /* @__PURE__ */ jsxs8("span", { children: [
3149
3471
  "v",
@@ -3175,34 +3497,32 @@ function RequestDetailPage() {
3175
3497
  ] }),
3176
3498
  /* @__PURE__ */ jsxs8("section", { className: "mx-table-container mx-request-section", children: [
3177
3499
  /* @__PURE__ */ jsx12("h3", { className: "mx-section-title mx-section-title-md", children: t("activity.response_title", void 0, "Response") }),
3178
- requestPaymentLock.isLocked && requestPaymentLock.actionUrl ? /* @__PURE__ */ jsxs8("div", { className: "mx-payment-lock-banner", children: [
3179
- /* @__PURE__ */ jsx12("div", { className: "mx-payment-lock-title", children: t("activity.payment_required", void 0, "Payment Required") }),
3180
- /* @__PURE__ */ jsx12("div", { className: "mx-payment-lock-message", children: requestPaymentLock.message }),
3500
+ showPaymentWaitState ? /* @__PURE__ */ jsxs8("div", { className: "mx-payment-lock-banner", children: [
3501
+ /* @__PURE__ */ jsx12("div", { className: "mx-payment-lock-title", children: isPaymentPending ? t("activity.payment_pending", void 0, "Payment Pending") : t("activity.payment_required", void 0, "Payment Required") }),
3502
+ /* @__PURE__ */ jsx12("div", { className: "mx-payment-lock-message", children: requestPaymentLock.isLocked ? requestPaymentLock.message : t(
3503
+ "activity.waiting_for_payment",
3504
+ void 0,
3505
+ "Waiting for payment confirmation\u2026"
3506
+ ) }),
3181
3507
  /* @__PURE__ */ jsxs8("div", { className: "mx-payment-lock-actions", children: [
3182
- /* @__PURE__ */ jsx12(
3508
+ isPaymentPending || effectivePaymentSessionId || directPaymentUrl || paymentSurfaceHref ? /* @__PURE__ */ jsx12(
3183
3509
  "button",
3184
3510
  {
3185
3511
  className: "mx-btn mx-btn-primary",
3186
- onClick: () => {
3187
- window.location.href = requestPaymentLock.actionUrl;
3188
- },
3189
- children: requestPaymentLock.ctaLabel || t("activity.complete_payment", void 0, "Complete Payment")
3190
- }
3191
- ),
3192
- client.reconcileMyRequestPayment && requestPaymentLock.paymentSessionId ? /* @__PURE__ */ jsx12(
3193
- "button",
3194
- {
3195
- className: "mx-btn mx-btn-secondary",
3196
- onClick: () => void reconcilePaymentFinality(),
3197
- disabled: reconcileBusy || requestPaymentLock.reconcileState === "confirmed_paid",
3198
- children: reconcileBusy ? t("activity.confirming_payment", void 0, "Confirming...") : t("activity.confirm_payment", void 0, "Confirm Payment")
3512
+ onClick: () => void continuePayment(),
3513
+ disabled: reconcileBusy,
3514
+ children: t("activity.complete_payment", void 0, "Complete Payment")
3199
3515
  }
3200
3516
  ) : null,
3201
3517
  /* @__PURE__ */ jsx12("button", { className: "mx-btn mx-btn-secondary", onClick: () => void refreshOnce(), children: t("activity.refresh_status", void 0, "Refresh Status") })
3202
3518
  ] }),
3203
3519
  reconcileError ? /* @__PURE__ */ jsx12("div", { className: "mx-payment-lock-error", children: reconcileError }) : null
3204
3520
  ] }) : null,
3205
- !isTerminal ? /* @__PURE__ */ jsx12("div", { className: "mx-waiting-state", children: t("activity.waiting_for_response", void 0, "Waiting for response\u2026") }) : /* @__PURE__ */ jsx12(SchemaOutputView, { schema: outputSchema, value: responsePayload })
3521
+ !isTerminal ? showPaymentWaitState ? /* @__PURE__ */ jsx12("div", { className: "mx-waiting-state", children: t(
3522
+ "activity.waiting_for_payment",
3523
+ void 0,
3524
+ "Waiting for payment confirmation\u2026"
3525
+ ) }) : /* @__PURE__ */ jsx12("div", { className: "mx-waiting-state", children: t("activity.waiting_for_response", void 0, "Waiting for response\u2026") }) : /* @__PURE__ */ jsx12(SchemaOutputView, { schema: outputSchema, value: responsePayload })
3206
3526
  ] }),
3207
3527
  Array.isArray(dataRecord.events) && dataRecord.events.length > 0 && (() => {
3208
3528
  const evts = dataRecord.events;
@@ -3500,9 +3820,9 @@ function RequestDetailPage() {
3500
3820
  }
3501
3821
 
3502
3822
  // src/pages/RequestsPage.tsx
3503
- import { useEffect as useEffect7, useMemo as useMemo7, useState as useState6 } from "react";
3823
+ import { useEffect as useEffect8, useMemo as useMemo7, useState as useState6 } from "react";
3504
3824
  import { Link as Link8, useLocation as useLocation6 } from "react-router-dom";
3505
- import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
3825
+ import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
3506
3826
  function useQueryToken6() {
3507
3827
  const loc = useLocation6();
3508
3828
  const qs = new URLSearchParams(loc.search);
@@ -3515,10 +3835,9 @@ function useQuery5() {
3515
3835
  function renderGuardActionHint(summary) {
3516
3836
  const action = asRecord(summary.action);
3517
3837
  const kind = readString(action.kind);
3518
- const url = readString(action.url);
3519
- if (kind === "upgrade_subscription") return `Upgrade subscription${url ? ` (${url})` : ""}`;
3520
- if (kind === "complete_payment") return `Complete payment${url ? ` (${url})` : ""}`;
3521
- if (kind === "step_up_auth") return `Complete step-up authentication${url ? ` (${url})` : ""}`;
3838
+ if (kind === "upgrade_subscription") return "Upgrade subscription";
3839
+ if (kind === "complete_payment") return "Complete payment";
3840
+ if (kind === "step_up_auth") return "Complete step-up authentication";
3522
3841
  if (kind === "confirm_action") {
3523
3842
  const msg = readString(action.message);
3524
3843
  return msg ? `Confirm action (${msg})` : "Confirm action";
@@ -3561,7 +3880,7 @@ function RequestsPage() {
3561
3880
  setBusy(false);
3562
3881
  }
3563
3882
  }
3564
- useEffect7(() => {
3883
+ useEffect8(() => {
3565
3884
  void refresh(pageParam);
3566
3885
  host.notifyNavigation?.({
3567
3886
  path: window.location.pathname,
@@ -3569,7 +3888,7 @@ function RequestsPage() {
3569
3888
  params: { xappId: xappIdFilter }
3570
3889
  });
3571
3890
  }, [xappIdFilter, pageParam]);
3572
- useEffect7(() => {
3891
+ useEffect8(() => {
3573
3892
  if (!xappIdFilter) {
3574
3893
  setXappTitle("");
3575
3894
  return;
@@ -3607,8 +3926,10 @@ function RequestsPage() {
3607
3926
  };
3608
3927
  function StatusBadge4({ status }) {
3609
3928
  const s = String(status || "");
3929
+ const normalized = s.trim().toUpperCase();
3610
3930
  const className = s === "COMPLETED" ? "mx-badge-success" : s === "FAILED" ? "mx-badge-danger" : "mx-badge-warning";
3611
- return /* @__PURE__ */ jsx13("span", { className: `mx-badge ${className}`, children: s || "\u2014" });
3931
+ const label = normalized === "PAYMENT_PENDING" ? t("activity.payment_pending", void 0, "Payment Pending") : s || "\u2014";
3932
+ return /* @__PURE__ */ jsx13("span", { className: `mx-badge ${className}`, children: label });
3612
3933
  }
3613
3934
  if (env?.requestsEnabled === false) {
3614
3935
  return /* @__PURE__ */ jsx13("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: /* @__PURE__ */ jsxs9("div", { className: "mx-table-container mx-unavailable", children: [
@@ -3628,7 +3949,7 @@ function RequestsPage() {
3628
3949
  /* @__PURE__ */ jsxs9("div", { className: "mx-breadcrumb", children: [
3629
3950
  !env?.singleXappMode && /* @__PURE__ */ jsx13(Link8, { to: isEmbedded ? "/" : "/marketplace", children: t("common.marketplace", void 0, "Marketplace") }),
3630
3951
  env?.singleXappMode && !isEmbedded && /* @__PURE__ */ jsx13(Link8, { to: isEmbedded ? "/" : "/marketplace", children: t("common.marketplace", void 0, "Marketplace") }),
3631
- xappIdFilter && xappLink && /* @__PURE__ */ jsxs9(Fragment6, { children: [
3952
+ xappIdFilter && xappLink && /* @__PURE__ */ jsxs9(Fragment7, { children: [
3632
3953
  (!env?.singleXappMode || env?.singleXappMode && !isEmbedded) && /* @__PURE__ */ jsx13("span", { className: "mx-breadcrumb-sep", children: "/" }),
3633
3954
  /* @__PURE__ */ jsx13(Link8, { to: xappLink, children: xappTitle || xappIdFilter })
3634
3955
  ] }),
@@ -3813,140 +4134,9 @@ function RequestsPage() {
3813
4134
  }
3814
4135
 
3815
4136
  // src/pages/XappDetailPage.tsx
3816
- import { useEffect as useEffect8, useMemo as useMemo8, useRef, useState as useState7 } from "react";
4137
+ import { useEffect as useEffect9, useMemo as useMemo8, useRef, useState as useState7 } from "react";
3817
4138
  import { Link as Link9, useLocation as useLocation7, useNavigate as useNavigate3, useParams as useParams2 } from "react-router-dom";
3818
-
3819
- // src/utils/operationalSurfaces.ts
3820
- function readPathEmbedded() {
3821
- return typeof window !== "undefined" && window.location.pathname.startsWith("/embed");
3822
- }
3823
- function getOperationalSurfaces(detail) {
3824
- const value = detail?.operational_surfaces;
3825
- if (!value || typeof value !== "object") return null;
3826
- return value;
3827
- }
3828
- function readOperationalSurfaceMode(input) {
3829
- const policy = input.env?.operationalSurfacesVisibility;
3830
- return input.isEmbedded ? policy?.embed ?? "contract" : policy?.portal ?? "contract";
3831
- }
3832
- function isOperationalSurfaceVisible(detail, surface, options) {
3833
- const surfaces = getOperationalSurfaces(detail);
3834
- const descriptor = surfaces?.[surface];
3835
- if (!descriptor?.enabled) return false;
3836
- const isEmbedded = options?.isEmbedded ?? readPathEmbedded();
3837
- return isEmbedded ? descriptor.visibility.embed : descriptor.visibility.portal;
3838
- }
3839
- function surfaceClientAvailable(client, surface) {
3840
- if (surface === "requests") return typeof client.listMyRequests === "function";
3841
- if (surface === "payments") return typeof client.listMyPaymentSessions === "function";
3842
- if (surface === "invoices") return typeof client.listMyInvoices === "function";
3843
- if (surface === "notifications") return typeof client.listMyNotifications === "function";
3844
- return false;
3845
- }
3846
- function buildOperationalSurfaceHref(input) {
3847
- const isEmbedded = input.isEmbedded ?? readPathEmbedded();
3848
- const params = new URLSearchParams({
3849
- xappId: input.xappId,
3850
- ...input.installationId ? { installationId: input.installationId } : {},
3851
- ...input.paymentSessionId ? { paymentSessionId: input.paymentSessionId } : {},
3852
- ...input.invoiceId ? { invoiceId: input.invoiceId } : {},
3853
- ...input.notificationId ? { notificationId: input.notificationId } : {},
3854
- ...input.token ? { token: input.token } : {}
3855
- });
3856
- const base = isEmbedded ? `/${input.surface}` : `/marketplace/${input.surface}`;
3857
- const detailSegment = input.surface === "requests" && input.requestId ? `/${encodeURIComponent(input.requestId)}` : "";
3858
- return `${base}${detailSegment}?${params.toString()}`;
3859
- }
3860
- function getVisibleOperationalSurfaces(input) {
3861
- const isEmbedded = input.isEmbedded ?? readPathEmbedded();
3862
- const mode = readOperationalSurfaceMode({
3863
- env: input.env,
3864
- isEmbedded
3865
- });
3866
- const allSurfaces = [
3867
- "requests",
3868
- "payments",
3869
- "invoices",
3870
- "notifications"
3871
- ];
3872
- if (mode === "testing_all") {
3873
- return allSurfaces.filter((surface) => {
3874
- if (surface === "requests" && input.env?.requestsEnabled === false) return false;
3875
- return surfaceClientAvailable(input.client, surface);
3876
- });
3877
- }
3878
- const surfaces = getOperationalSurfaces(input.detail);
3879
- if (!surfaces) return [];
3880
- return allSurfaces.filter(
3881
- (surface) => surfaceClientAvailable(input.client, surface) && isOperationalSurfaceVisible(input.detail, surface, { isEmbedded })
3882
- );
3883
- }
3884
- function getOperationalSurfaceLabel(surface) {
3885
- if (surface === "requests") return "Requests";
3886
- if (surface === "payments") return "Payments";
3887
- if (surface === "invoices") return "Invoices";
3888
- return "Notifications";
3889
- }
3890
- function resolveOperationalSurfacePlacement(input) {
3891
- const isEmbedded = input.isEmbedded ?? readPathEmbedded();
3892
- const policy = input.env?.operationalSurfacePlacement;
3893
- const scopePolicy = isEmbedded ? policy?.embed : policy?.portal;
3894
- const bySurface = scopePolicy?.bySurface?.[input.surface];
3895
- if (bySurface) return bySurface;
3896
- return scopePolicy?.default ?? "in_router";
3897
- }
3898
- async function discoverOperationalSurfaceData(input) {
3899
- const xappId = String(input.xappId || "").trim();
3900
- const installationId = String(input.installationId || "").trim();
3901
- if (!xappId) return [];
3902
- const queryBase = {
3903
- xappId,
3904
- ...installationId ? { installationId } : {}
3905
- };
3906
- const checks = await Promise.all([
3907
- (async () => {
3908
- if (typeof input.client.listMyPaymentSessions !== "function") return null;
3909
- try {
3910
- const res = await input.client.listMyPaymentSessions({
3911
- ...queryBase,
3912
- limit: 1
3913
- });
3914
- return Array.isArray(res?.items) && res.items.length > 0 ? "payments" : null;
3915
- } catch {
3916
- return null;
3917
- }
3918
- })(),
3919
- (async () => {
3920
- if (typeof input.client.listMyInvoices !== "function") return null;
3921
- try {
3922
- const res = await input.client.listMyInvoices({
3923
- ...queryBase,
3924
- page: 1,
3925
- pageSize: 1
3926
- });
3927
- return Array.isArray(res?.items) && res.items.length > 0 ? "invoices" : null;
3928
- } catch {
3929
- return null;
3930
- }
3931
- })(),
3932
- (async () => {
3933
- if (typeof input.client.listMyNotifications !== "function") return null;
3934
- try {
3935
- const res = await input.client.listMyNotifications({
3936
- ...queryBase,
3937
- limit: 1
3938
- });
3939
- return Array.isArray(res?.items) && res.items.length > 0 || Number(res?.unread_count || 0) > 0 ? "notifications" : null;
3940
- } catch {
3941
- return null;
3942
- }
3943
- })()
3944
- ]);
3945
- return checks.filter((surface) => Boolean(surface));
3946
- }
3947
-
3948
- // src/pages/XappDetailPage.tsx
3949
- import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
4139
+ import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
3950
4140
  function useQueryToken7() {
3951
4141
  const loc = useLocation7();
3952
4142
  const qs = new URLSearchParams(loc.search);
@@ -4107,7 +4297,7 @@ function XappDetailPage() {
4107
4297
  setBusy(false);
4108
4298
  }
4109
4299
  }
4110
- useEffect8(() => {
4300
+ useEffect9(() => {
4111
4301
  void refresh();
4112
4302
  host.refreshInstallations();
4113
4303
  host.notifyNavigation?.({
@@ -4116,7 +4306,7 @@ function XappDetailPage() {
4116
4306
  params: { xappId }
4117
4307
  });
4118
4308
  }, [client, installation?.installationId, xappId]);
4119
- useEffect8(() => {
4309
+ useEffect9(() => {
4120
4310
  const currentXappId = String(xappId ?? "").trim();
4121
4311
  if (!currentXappId) {
4122
4312
  setDiscoveredOperationalSurfaces([]);
@@ -4164,7 +4354,7 @@ function XappDetailPage() {
4164
4354
  const termsUrl = readString4(terms?.url);
4165
4355
  const hasTermsContent = Boolean(termsText || termsUrl);
4166
4356
  const requiresTerms = Boolean(terms || action === "install" || action === "update");
4167
- useEffect8(() => {
4357
+ useEffect9(() => {
4168
4358
  if (action === "install") {
4169
4359
  setTermsAccepted(false);
4170
4360
  setTermsAction("install");
@@ -4177,7 +4367,7 @@ function XappDetailPage() {
4177
4367
  setTermsOpen(true);
4178
4368
  }
4179
4369
  }, [action, installation]);
4180
- useEffect8(() => {
4370
+ useEffect9(() => {
4181
4371
  if (action !== "open-widget") return;
4182
4372
  if (env?.embedMode) return;
4183
4373
  if (!installation || !widgetsEnabled) return;
@@ -4319,7 +4509,7 @@ function XappDetailPage() {
4319
4509
  ) })
4320
4510
  ] }),
4321
4511
  error && /* @__PURE__ */ jsx14("div", { className: "mx-detail-error", children: error }),
4322
- busy && !data ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
4512
+ busy && !data ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4323
4513
  /* @__PURE__ */ jsxs10("div", { className: "mx-detail-skeleton-header", "aria-busy": "true", children: [
4324
4514
  /* @__PURE__ */ jsx14("div", { className: "mx-detail-skeleton-icon" }),
4325
4515
  /* @__PURE__ */ jsxs10("div", { className: "mx-detail-skeleton-info", children: [
@@ -4353,7 +4543,7 @@ function XappDetailPage() {
4353
4543
  /* @__PURE__ */ jsx14("div", { className: "mx-skeleton-line mx-skeleton-line-short" })
4354
4544
  ] }) })
4355
4545
  ] })
4356
- ] }) : /* @__PURE__ */ jsxs10(Fragment7, { children: [
4546
+ ] }) : /* @__PURE__ */ jsxs10(Fragment8, { children: [
4357
4547
  /* @__PURE__ */ jsxs10("header", { className: "mx-detail-header", children: [
4358
4548
  /* @__PURE__ */ jsx14("img", { src: imageUrl, alt: title, className: "mx-detail-icon" }),
4359
4549
  /* @__PURE__ */ jsxs10("div", { className: "mx-detail-info", children: [
@@ -4373,7 +4563,7 @@ function XappDetailPage() {
4373
4563
  updateAvailable ? /* @__PURE__ */ jsx14("div", { className: "mx-detail-update-pill", children: t("xapp.update_available", void 0, "Update available") }) : null
4374
4564
  ] })
4375
4565
  ] }),
4376
- /* @__PURE__ */ jsx14("div", { className: "mx-detail-actions", children: canMutate ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
4566
+ /* @__PURE__ */ jsx14("div", { className: "mx-detail-actions", children: canMutate ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4377
4567
  installation && updateAvailable && host.requestUpdate ? /* @__PURE__ */ jsx14(
4378
4568
  "button",
4379
4569
  {
@@ -5058,9 +5248,9 @@ function XappDetailPage() {
5058
5248
  }
5059
5249
 
5060
5250
  // src/pages/WidgetView.tsx
5061
- import { useEffect as useEffect9, useRef as useRef2, useState as useState8 } from "react";
5251
+ import { useEffect as useEffect10, useRef as useRef2, useState as useState8 } from "react";
5062
5252
  import { Link as Link10, useLocation as useLocation8, useNavigate as useNavigate4, useParams as useParams3 } from "react-router-dom";
5063
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
5253
+ import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
5064
5254
  function useQueryToken8() {
5065
5255
  const loc = useLocation8();
5066
5256
  const qs = new URLSearchParams(loc.search);
@@ -5161,7 +5351,7 @@ function WidgetView() {
5161
5351
  page: "portal-home"
5162
5352
  });
5163
5353
  };
5164
- useEffect9(() => {
5354
+ useEffect10(() => {
5165
5355
  if (!installationId) return;
5166
5356
  let alive = true;
5167
5357
  void (async () => {
@@ -5190,7 +5380,7 @@ function WidgetView() {
5190
5380
  alive = false;
5191
5381
  };
5192
5382
  }, [installationId, client, host, locale]);
5193
- useEffect9(() => {
5383
+ useEffect10(() => {
5194
5384
  if (!xappId) {
5195
5385
  setDiscoveredOperationalSurfaces([]);
5196
5386
  return;
@@ -5210,7 +5400,7 @@ function WidgetView() {
5210
5400
  cancelled = true;
5211
5401
  };
5212
5402
  }, [client, installationId, xappId]);
5213
- useEffect9(() => {
5403
+ useEffect10(() => {
5214
5404
  if (!installationId || !widgetId || !host.notifyNavigation) return;
5215
5405
  host.notifyNavigation({
5216
5406
  path: window.location.pathname,
@@ -5218,7 +5408,7 @@ function WidgetView() {
5218
5408
  params: { installationId, widgetId }
5219
5409
  });
5220
5410
  }, [installationId, widgetId, host]);
5221
- useEffect9(() => {
5411
+ useEffect10(() => {
5222
5412
  if (!installationId || !widgetId) return;
5223
5413
  let alive = true;
5224
5414
  void (async () => {
@@ -5252,7 +5442,7 @@ function WidgetView() {
5252
5442
  expires_in: Number.isFinite(Number(refreshed?.expires_in)) && Number(refreshed?.expires_in) > 0 ? Number(refreshed?.expires_in) : void 0
5253
5443
  };
5254
5444
  }
5255
- useEffect9(() => {
5445
+ useEffect10(() => {
5256
5446
  return () => {
5257
5447
  for (const [, pending] of nestedExpandPendingRef.current) {
5258
5448
  window.clearTimeout(pending.timeoutId);
@@ -5262,7 +5452,7 @@ function WidgetView() {
5262
5452
  nestedExpandPendingRef.current.clear();
5263
5453
  };
5264
5454
  }, []);
5265
- useEffect9(() => {
5455
+ useEffect10(() => {
5266
5456
  const shell = shellRef.current;
5267
5457
  const rootEl = shell?.parentElement ?? null;
5268
5458
  const htmlEl = document.documentElement;
@@ -5295,7 +5485,7 @@ function WidgetView() {
5295
5485
  }
5296
5486
  };
5297
5487
  }, [env?.embedMode, hostNestedExpandStage]);
5298
- useEffect9(() => {
5488
+ useEffect10(() => {
5299
5489
  if (!env?.embedMode) return;
5300
5490
  const handler = (e) => {
5301
5491
  if (e.source !== window.parent) return;
@@ -5311,7 +5501,7 @@ function WidgetView() {
5311
5501
  window.addEventListener("message", handler);
5312
5502
  return () => window.removeEventListener("message", handler);
5313
5503
  }, [env?.embedMode]);
5314
- useEffect9(() => {
5504
+ useEffect10(() => {
5315
5505
  const handler = (e) => {
5316
5506
  const msg = asRecord(e.data);
5317
5507
  const msgType = readString(msg.type);
@@ -5345,7 +5535,7 @@ function WidgetView() {
5345
5535
  window.addEventListener("message", handler);
5346
5536
  return () => window.removeEventListener("message", handler);
5347
5537
  }, []);
5348
- useEffect9(() => {
5538
+ useEffect10(() => {
5349
5539
  if (!widgetToken) return;
5350
5540
  const postExpandResultToWidget = (target, result) => {
5351
5541
  if (!target || typeof target.postMessage !== "function") return;
@@ -5620,7 +5810,7 @@ function WidgetView() {
5620
5810
  xappId,
5621
5811
  t
5622
5812
  ]);
5623
- useEffect9(() => {
5813
+ useEffect10(() => {
5624
5814
  if (!widgetToken || !env?.locale) return;
5625
5815
  try {
5626
5816
  iframeRef.current?.contentWindow?.postMessage(
@@ -5638,6 +5828,11 @@ function WidgetView() {
5638
5828
  const params = new URLSearchParams({ token: widgetToken });
5639
5829
  const hostReturnUrl = readHostReturnUrl(loc.search);
5640
5830
  if (hostReturnUrl) params.set("xapps_host_return_url", hostReturnUrl);
5831
+ if (env?.embedMode && hostNestedExpandStage !== "inline") {
5832
+ params.set("xapps_host_overlay", "1");
5833
+ } else {
5834
+ params.delete("xapps_host_overlay");
5835
+ }
5641
5836
  const paymentParams = readPaymentEvidenceParams(loc.search);
5642
5837
  for (const [k, v] of paymentParams.entries()) {
5643
5838
  params.set(k, v);
@@ -5648,7 +5843,7 @@ function WidgetView() {
5648
5843
  return /* @__PURE__ */ jsxs11("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
5649
5844
  /* @__PURE__ */ jsxs11("div", { className: "mx-breadcrumb", children: [
5650
5845
  /* @__PURE__ */ jsx15("button", { className: "mx-breadcrumb-link-btn", onClick: onBackToPortal, children: t("common.portal", void 0, "Portal") }),
5651
- !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5846
+ !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5652
5847
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5653
5848
  /* @__PURE__ */ jsx15(Link10, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") })
5654
5849
  ] }),
@@ -5669,7 +5864,7 @@ function WidgetView() {
5669
5864
  return /* @__PURE__ */ jsxs11("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
5670
5865
  /* @__PURE__ */ jsxs11("div", { className: "mx-breadcrumb", children: [
5671
5866
  /* @__PURE__ */ jsx15("button", { className: "mx-breadcrumb-link-btn", onClick: onBackToPortal, children: t("common.portal", void 0, "Portal") }),
5672
- !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5867
+ !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5673
5868
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5674
5869
  /* @__PURE__ */ jsx15(Link10, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") })
5675
5870
  ] }),
@@ -5690,7 +5885,7 @@ function WidgetView() {
5690
5885
  return /* @__PURE__ */ jsxs11("div", { className: `mx-catalog-container ${isEmbedded ? "is-embedded" : ""}`, children: [
5691
5886
  /* @__PURE__ */ jsxs11("div", { className: "mx-breadcrumb", children: [
5692
5887
  /* @__PURE__ */ jsx15("button", { className: "mx-breadcrumb-link-btn", onClick: onBackToPortal, children: t("common.portal", void 0, "Portal") }),
5693
- !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5888
+ !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5694
5889
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5695
5890
  /* @__PURE__ */ jsx15(Link10, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") })
5696
5891
  ] }),
@@ -5723,11 +5918,11 @@ function WidgetView() {
5723
5918
  children: [
5724
5919
  env?.embedMode && hostNestedExpandStage === "inline" && /* @__PURE__ */ jsxs11("div", { className: "mx-breadcrumb mx-breadcrumb-top", children: [
5725
5920
  /* @__PURE__ */ jsx15("button", { className: "mx-breadcrumb-link-btn", onClick: onBackToPortal, children: t("common.portal", void 0, "Portal") }),
5726
- !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5921
+ !env?.singleXappMode && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5727
5922
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5728
5923
  /* @__PURE__ */ jsx15(Link10, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") })
5729
5924
  ] }),
5730
- xappTo && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5925
+ xappTo && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5731
5926
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5732
5927
  /* @__PURE__ */ jsx15(Link10, { to: xappTo, children: xappTitle || t("common.app", void 0, "App") })
5733
5928
  ] }),
@@ -5736,7 +5931,7 @@ function WidgetView() {
5736
5931
  ] }),
5737
5932
  !env?.embedMode && hostNestedExpandStage === "inline" && /* @__PURE__ */ jsxs11("div", { className: "mx-breadcrumb", children: [
5738
5933
  /* @__PURE__ */ jsx15(Link10, { to: marketplaceTo, children: t("common.marketplace", void 0, "Marketplace") }),
5739
- xappTo && /* @__PURE__ */ jsxs11(Fragment8, { children: [
5934
+ xappTo && /* @__PURE__ */ jsxs11(Fragment9, { children: [
5740
5935
  /* @__PURE__ */ jsx15("span", { className: "mx-breadcrumb-sep", children: "/" }),
5741
5936
  /* @__PURE__ */ jsx15(Link10, { to: xappTo, children: xappTitle || t("common.app", void 0, "App") })
5742
5937
  ] }),
@@ -5787,9 +5982,9 @@ function WidgetView() {
5787
5982
  }
5788
5983
 
5789
5984
  // src/pages/PublishersPage.tsx
5790
- import { useEffect as useEffect10, useMemo as useMemo9, useState as useState9 } from "react";
5985
+ import { useEffect as useEffect11, useMemo as useMemo9, useState as useState9 } from "react";
5791
5986
  import { Link as Link11, useLocation as useLocation9 } from "react-router-dom";
5792
- import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
5987
+ import { Fragment as Fragment10, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
5793
5988
  function useQueryToken9() {
5794
5989
  const loc = useLocation9();
5795
5990
  const qs = new URLSearchParams(loc.search);
@@ -5847,7 +6042,7 @@ function PublishersPage() {
5847
6042
  }
5848
6043
  setItems(Array.from(grouped.values()).sort((a, b) => a.name.localeCompare(b.name)));
5849
6044
  }
5850
- useEffect10(() => {
6045
+ useEffect11(() => {
5851
6046
  void (async () => {
5852
6047
  setBusy(true);
5853
6048
  setError(null);
@@ -5965,7 +6160,7 @@ function PublishersPage() {
5965
6160
  /* @__PURE__ */ jsx16("div", { className: "mx-skeleton-line mx-skeleton-line-title" }),
5966
6161
  /* @__PURE__ */ jsx16("div", { className: "mx-skeleton-line mx-skeleton-line-short" })
5967
6162
  ] })
5968
- ] }) }) }, i)) }) : /* @__PURE__ */ jsxs12(Fragment9, { children: [
6163
+ ] }) }) }, i)) }) : /* @__PURE__ */ jsxs12(Fragment10, { children: [
5969
6164
  !busy && /* @__PURE__ */ jsx16("div", { className: "mx-results-bar", children: /* @__PURE__ */ jsx16("div", { className: "mx-results-count", children: t(
5970
6165
  "publisher.results_count",
5971
6166
  { count: ordered.length, suffix: ordered.length === 1 ? "" : "s" },
@@ -6042,9 +6237,9 @@ function PublishersPage() {
6042
6237
  }
6043
6238
 
6044
6239
  // src/pages/PublisherDetailPage.tsx
6045
- import { useEffect as useEffect11, useMemo as useMemo10, useState as useState10 } from "react";
6240
+ import { useEffect as useEffect12, useMemo as useMemo10, useState as useState10 } from "react";
6046
6241
  import { Link as Link12, useLocation as useLocation10, useParams as useParams4 } from "react-router-dom";
6047
- import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
6242
+ import { Fragment as Fragment11, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
6048
6243
  function useQueryToken10() {
6049
6244
  const loc = useLocation10();
6050
6245
  const qs = new URLSearchParams(loc.search);
@@ -6083,7 +6278,7 @@ function PublisherDetailPage() {
6083
6278
  setBusy(false);
6084
6279
  }
6085
6280
  }
6086
- useEffect11(() => {
6281
+ useEffect12(() => {
6087
6282
  void refresh();
6088
6283
  }, [publisherSlug]);
6089
6284
  const publisherName = useMemo10(() => {
@@ -6174,7 +6369,7 @@ function PublisherDetailPage() {
6174
6369
  /* @__PURE__ */ jsx17("div", { className: "mx-skeleton-line mx-skeleton-line-full" }),
6175
6370
  /* @__PURE__ */ jsx17("div", { className: "mx-skeleton-line mx-skeleton-line-short" })
6176
6371
  ] })
6177
- ] }, i)) }) : /* @__PURE__ */ jsxs13(Fragment10, { children: [
6372
+ ] }, i)) }) : /* @__PURE__ */ jsxs13(Fragment11, { children: [
6178
6373
  !busy && /* @__PURE__ */ jsx17("div", { className: "mx-results-bar", children: /* @__PURE__ */ jsx17("div", { className: "mx-results-count", children: filteredItems.length === items.length ? `${filteredItems.length} xapp${filteredItems.length === 1 ? "" : "s"}` : `${filteredItems.length} of ${items.length} xapp${items.length === 1 ? "" : "s"}` }) }),
6179
6374
  /* @__PURE__ */ jsx17("div", { className: "mx-grid", children: filteredItems.length === 0 && !busy ? /* @__PURE__ */ jsxs13("div", { className: "mx-empty-catalog", children: [
6180
6375
  /* @__PURE__ */ jsx17("div", { className: "mx-empty-catalog-icon", children: "\u2315" }),