@fluid-app/portal-sdk 0.1.178 → 0.1.180

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.
Files changed (32) hide show
  1. package/dist/{FluidProvider-TKGU3gSm.mjs → FluidProvider-Bjlw3uIJ.mjs} +54 -84
  2. package/dist/FluidProvider-Bjlw3uIJ.mjs.map +1 -0
  3. package/dist/{FluidProvider-CIuinUdw.cjs → FluidProvider-XHTzXe-E.cjs} +53 -89
  4. package/dist/FluidProvider-XHTzXe-E.cjs.map +1 -0
  5. package/dist/{MessagingScreen-CwMR1WJG.cjs → MessagingScreen-BcpCwuYL.cjs} +2 -2
  6. package/dist/{MessagingScreen-CwMR1WJG.cjs.map → MessagingScreen-BcpCwuYL.cjs.map} +1 -1
  7. package/dist/{MessagingScreen-BUC8Fwaz.mjs → MessagingScreen-CxWUaN04.mjs} +2 -2
  8. package/dist/{MessagingScreen-BUC8Fwaz.mjs.map → MessagingScreen-CxWUaN04.mjs.map} +1 -1
  9. package/dist/{MessagingScreen-XzPsvsXP.cjs → MessagingScreen-D35g9qBs.cjs} +2 -2
  10. package/dist/{ProductsScreen-C0KlCDt_.mjs → ProductsScreen-08MJy-SJ.mjs} +2 -0
  11. package/dist/{ProfileScreen-De6Xdkr4.cjs → ProfileScreen-C-8qFmXB.cjs} +2 -2
  12. package/dist/{ProfileScreen-De6Xdkr4.cjs.map → ProfileScreen-C-8qFmXB.cjs.map} +1 -1
  13. package/dist/{ProfileScreen-BuDwsZ3f.mjs → ProfileScreen-CQJyNrls.mjs} +2 -2
  14. package/dist/{ProfileScreen-BuDwsZ3f.mjs.map → ProfileScreen-CQJyNrls.mjs.map} +1 -1
  15. package/dist/{ProfileScreen-CD0p8061.cjs → ProfileScreen-CZDMIHZ9.cjs} +2 -2
  16. package/dist/{ShareablesScreen-_S-OESoe.mjs → ShareablesScreen-jHqnOgXM.mjs} +2 -0
  17. package/dist/{ShopScreen-DqUle1Zv.cjs → ShopScreen-BeuMn_38.cjs} +2 -2
  18. package/dist/{ShopScreen-Bg5pr5RL.mjs → ShopScreen-ChzQkJ1u.mjs} +2 -2
  19. package/dist/{ShopScreen-Bg5pr5RL.mjs.map → ShopScreen-ChzQkJ1u.mjs.map} +1 -1
  20. package/dist/{ShopScreen-z1kE-juB.cjs → ShopScreen-GBG7PGT3.cjs} +2 -2
  21. package/dist/{ShopScreen-z1kE-juB.cjs.map → ShopScreen-GBG7PGT3.cjs.map} +1 -1
  22. package/dist/index.cjs +61 -62
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +110 -20
  25. package/dist/index.d.cts.map +1 -1
  26. package/dist/index.d.mts +110 -20
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +65 -66
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +12 -12
  31. package/dist/FluidProvider-CIuinUdw.cjs.map +0 -1
  32. package/dist/FluidProvider-TKGU3gSm.mjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-9hOWP6kD.cjs");
3
- const require_FluidProvider = require("./FluidProvider-CIuinUdw.cjs");
3
+ const require_FluidProvider = require("./FluidProvider-XHTzXe-E.cjs");
4
4
  const require_ScreenRenderer = require("./ScreenRenderer-8F7DT7CQ.cjs");
5
5
  require("./account-api-context-DZP9IiGg.cjs");
6
6
  require("./store-api-context-D1gZn22Z.cjs");
@@ -46,8 +46,8 @@ const require_use_account = require("./use-account-BWdcuCCW.cjs");
46
46
  const require_use_store = require("./use-store-DvtLtZ3f.cjs");
47
47
  const require_CustomersScreen = require("./CustomersScreen-DRcCBHkL.cjs");
48
48
  const require_AppNavigationContext = require("./AppNavigationContext-BKszSW5R.cjs");
49
- const require_MessagingScreen = require("./MessagingScreen-CwMR1WJG.cjs");
50
- const require_ProfileScreen = require("./ProfileScreen-De6Xdkr4.cjs");
49
+ const require_MessagingScreen = require("./MessagingScreen-BcpCwuYL.cjs");
50
+ const require_ProfileScreen = require("./ProfileScreen-C-8qFmXB.cjs");
51
51
  require("./dist-BRT-FAUb.cjs");
52
52
  require("./es-Dr47illR.cjs");
53
53
  const require_ContactsScreen = require("./ContactsScreen-DoITKHce.cjs");
@@ -64,7 +64,7 @@ const require_ProductsScreen = require("./ProductsScreen-CWqkme1L.cjs");
64
64
  require("./use-mysite-portal-DzDYRU0u.cjs");
65
65
  const require_MySiteScreen = require("./MySiteScreen-B_ue0dF6.cjs");
66
66
  const require_ShareablesScreen = require("./ShareablesScreen-B_tGIt_X.cjs");
67
- const require_ShopScreen = require("./ShopScreen-z1kE-juB.cjs");
67
+ const require_ShopScreen = require("./ShopScreen-GBG7PGT3.cjs");
68
68
  require("./UpgradeScreen-BwWZYjrw.cjs");
69
69
  require("./AppDownloadScreen-DXkRe6MQ.cjs");
70
70
  let react = require("react");
@@ -1410,15 +1410,14 @@ function toNavigationItem(item) {
1410
1410
  //#endregion
1411
1411
  //#region src/transforms/index.ts
1412
1412
  /**
1413
- * Convert a raw FluidOS API response to RawManifestResponse.
1414
- *
1415
- * The wire format includes `navigation_items` and full theme objects,
1416
- * but the generated OpenAPI types differ (e.g. `navigation_tree`, `themes: number[]`).
1417
- * This function bridges that gap so callers avoid `as unknown as` casts.
1413
+ * Convert an `AppManifestResponse` into the `RawManifestResponse` shape
1414
+ * expected by the transform pipeline. `AppManifestResponse` is structurally
1415
+ * assignable to `RawManifestResponse`, so this is a runtime-only guard that
1416
+ * rejects empty payloads.
1418
1417
  */
1419
- function toRawManifest(raw) {
1420
- if (!raw.manifest) throw new Error("FluidOS API returned empty manifest");
1421
- return raw;
1418
+ function toRawManifest(response) {
1419
+ if (!response.manifest) throw new Error("Portal BFF returned empty manifest");
1420
+ return response;
1422
1421
  }
1423
1422
  /**
1424
1423
  * Transform a raw FluidOS manifest API response into RepAppData.
@@ -1438,24 +1437,25 @@ function transformManifestToRepAppData(response) {
1438
1437
  const mobileNav = rawProfile?.mobile_navigation;
1439
1438
  const mobileNavigationItems = (mobileNav?.navigation_items ?? []).map(toNavigationItem);
1440
1439
  const activeThemeId = require_FluidProvider.getActiveThemeId(rawThemes);
1440
+ const definitionId = manifest.definition_id ?? 0;
1441
1441
  return {
1442
- definition_id: manifest.definition_id,
1442
+ definition_id: definitionId,
1443
1443
  published_version: manifest.published_version ?? 0,
1444
1444
  screens,
1445
1445
  profile: {
1446
1446
  name: rawProfile?.name ?? "Default",
1447
- definition_id: rawProfile?.definition_id ?? manifest.definition_id,
1447
+ definition_id: rawProfile?.definition_id ?? definitionId,
1448
1448
  themes: require_FluidProvider.transformThemes(rawThemes),
1449
1449
  ...activeThemeId !== void 0 ? { activeThemeId } : {},
1450
1450
  navigation: {
1451
- definition_id: nav?.definition_id ?? manifest.definition_id,
1451
+ definition_id: nav?.definition_id ?? definitionId,
1452
1452
  id: nav?.id ?? 0,
1453
1453
  name: nav?.name ?? "Main Navigation",
1454
1454
  navigation_items: navigationItems,
1455
1455
  screens
1456
1456
  },
1457
1457
  ...mobileNav ? { mobile_navigation: {
1458
- definition_id: mobileNav.definition_id ?? manifest.definition_id,
1458
+ definition_id: mobileNav.definition_id ?? definitionId,
1459
1459
  id: mobileNav.id ?? 0,
1460
1460
  name: mobileNav.name ?? "Mobile Navigation",
1461
1461
  navigation_items: mobileNavigationItems,
@@ -1467,17 +1467,17 @@ function transformManifestToRepAppData(response) {
1467
1467
  //#endregion
1468
1468
  //#region src/hooks/use-fluid-app.ts
1469
1469
  /**
1470
- * Base query key for full app data (fluidos endpoint).
1470
+ * Base query key for full app data (rendered manifest endpoint).
1471
1471
  * Kept for backwards compatibility — the runtime key used by the hook
1472
1472
  * includes a company prefix via {@link useCompanyScopedQueryKey}.
1473
1473
  */
1474
1474
  const APP_DATA_QUERY_KEY = ["fluid", "app"];
1475
1475
  /**
1476
- * Fetch the raw FluidOS manifest via the BFF-proxied adapter.
1476
+ * Fetch the raw rendered manifest via the portal-tenant BFF adapter.
1477
1477
  * Shared by `useFluidApp` and `useFluidProfile` to avoid drift.
1478
1478
  */
1479
1479
  async function fetchRawManifest(api) {
1480
- return toRawManifest(await api.getManifest({ platform: "browser" }));
1480
+ return toRawManifest(await api.fetchManifest());
1481
1481
  }
1482
1482
  /**
1483
1483
  * Module-level persister instance (browser only).
@@ -1487,7 +1487,7 @@ async function fetchRawManifest(api) {
1487
1487
  */
1488
1488
  const appDataPersister = typeof window !== "undefined" && !{}.env?.DEV ? require_FluidProvider.createPersister() : void 0;
1489
1489
  /**
1490
- * Hook to fetch the full portal app data from the fluidos API.
1490
+ * Hook to fetch the full portal app data from the rendered-manifest endpoint.
1491
1491
  *
1492
1492
  * Returns a `RepAppData` object containing:
1493
1493
  * - `screens` — all screen definitions with normalized component trees
@@ -1517,47 +1517,17 @@ const appDataPersister = typeof window !== "undefined" && !{}.env?.DEV ? require
1517
1517
  * ```
1518
1518
  */
1519
1519
  function useFluidApp(options) {
1520
- const fluidOsApi = require_FluidProvider.useFluidOsApi();
1520
+ const appDefinitionApi = require_FluidProvider.useAppDefinitionApi();
1521
1521
  const { scopeKey } = useCompanyScopedQueryKey();
1522
1522
  return (0, _tanstack_react_query.useQuery)({
1523
1523
  queryKey: scopeKey(APP_DATA_QUERY_KEY),
1524
- queryFn: () => fetchRawManifest(fluidOsApi),
1524
+ queryFn: () => fetchRawManifest(appDefinitionApi),
1525
1525
  select: transformManifestToRepAppData,
1526
1526
  ...appDataPersister && { persister: appDataPersister.persisterFn },
1527
1527
  ...options?.enabled !== void 0 && { enabled: options.enabled }
1528
1528
  });
1529
1529
  }
1530
1530
  //#endregion
1531
- //#region src/hooks/use-app-definition.ts
1532
- /**
1533
- * Base query key for the app definition endpoint.
1534
- * The runtime key includes a company prefix via {@link useCompanyScopedQueryKey}.
1535
- */
1536
- const APP_DEFINITION_QUERY_KEY = ["fluid", "app-definition"];
1537
- /**
1538
- * Hook to fetch the active app manifest from the portal-tenant BFF.
1539
- *
1540
- * Returns the manifest metadata (id, name, version)
1541
- * sourced from `GET /api/app/manifest` via the {@link AppDefinitionApi} port.
1542
- *
1543
- * @example
1544
- * ```tsx
1545
- * function MyComponent() {
1546
- * const { data } = useAppDefinition();
1547
- * const definitionId = data?.definition.id ?? 0;
1548
- * }
1549
- * ```
1550
- */
1551
- function useAppDefinition(options) {
1552
- const api = require_FluidProvider.useAppDefinitionApi();
1553
- const { scopeKey } = useCompanyScopedQueryKey();
1554
- return (0, _tanstack_react_query.useQuery)({
1555
- queryKey: scopeKey(APP_DEFINITION_QUERY_KEY),
1556
- queryFn: () => api.fetchDefinition(),
1557
- ...options?.enabled !== void 0 && { enabled: options.enabled }
1558
- });
1559
- }
1560
- //#endregion
1561
1531
  //#region src/shell/AppShellLoading.tsx
1562
1532
  const SPIN_STYLE_ID = "fluid-app-shell-loading-spin";
1563
1533
  /**
@@ -2165,12 +2135,12 @@ function AccountManageLayout({ children }) {
2165
2135
  }
2166
2136
  //#endregion
2167
2137
  //#region src/shell/system-screen-map.ts
2168
- const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-CD0p8061.cjs")).then((m) => ({ default: m.ProfileScreen })));
2138
+ const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-CZDMIHZ9.cjs")).then((m) => ({ default: m.ProfileScreen })));
2169
2139
  const OrdersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./OrdersScreen-COGBqaif.cjs")).then((m) => ({ default: m.OrdersScreen })));
2170
2140
  const SubscriptionsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./SubscriptionsScreen-CYIUXxrJ.cjs")).then((m) => ({ default: m.SubscriptionsScreen })));
2171
- const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-XzPsvsXP.cjs")).then((m) => ({ default: m.MessagingScreen })));
2141
+ const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-D35g9qBs.cjs")).then((m) => ({ default: m.MessagingScreen })));
2172
2142
  const ContactsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ContactsScreen-f9MvO-hX.cjs")).then((m) => ({ default: m.ContactsScreen })));
2173
- const ShopScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShopScreen-DqUle1Zv.cjs")).then((m) => ({ default: m.ShopScreen })));
2143
+ const ShopScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShopScreen-BeuMn_38.cjs")).then((m) => ({ default: m.ShopScreen })));
2174
2144
  const CustomersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./CustomersScreen-DRcCBHkL.cjs")).then((n) => n.CustomersScreen_exports).then((m) => ({ default: m.CustomersScreen })));
2175
2145
  const ProductsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProductsScreen-DjzkmBOS.cjs")).then((m) => ({ default: m.ProductsScreen })));
2176
2146
  const ShareablesScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShareablesScreen-BZG-rFuT.cjs")).then((m) => ({ default: m.ShareablesScreen })));
@@ -2419,7 +2389,6 @@ function AppShell({ appData: appDataProp, navigation: navigationProp, customPage
2419
2389
  }, [basePath]);
2420
2390
  const { data: fetchedAppData, isLoading } = useFluidApp({ enabled: !appDataProp });
2421
2391
  const appData = appDataProp ?? fetchedAppData;
2422
- const { data: appDefinitionData } = useAppDefinition({ enabled: !appDataProp });
2423
2392
  const { data: account } = require_use_account.useAccount();
2424
2393
  const repUser = (0, react.useMemo)(() => ({
2425
2394
  name: account?.first_name && account?.last_name ? `${account.first_name} ${account.last_name}` : null,
@@ -2613,7 +2582,7 @@ function AppShell({ appData: appDataProp, navigation: navigationProp, customPage
2613
2582
  navItems: filteredMobileNavItems,
2614
2583
  currentSlug: activeSlug,
2615
2584
  onNavigate: handleNavigate,
2616
- appDefinitionId: appDefinitionData?.definition.id ?? appData?.definition_id ?? 0
2585
+ appDefinitionId: appData?.definition_id ?? 0
2617
2586
  }),
2618
2587
  children: content
2619
2588
  })
@@ -2760,17 +2729,47 @@ const PROFILE_QUERY_KEY = ["fluid", "profile"];
2760
2729
  * ```
2761
2730
  */
2762
2731
  function useFluidProfile() {
2763
- const fluidOsApi = require_FluidProvider.useFluidOsApi();
2732
+ const appDefinitionApi = require_FluidProvider.useAppDefinitionApi();
2764
2733
  const { scopeKey } = useCompanyScopedQueryKey();
2765
2734
  return (0, _tanstack_react_query.useQuery)({
2766
2735
  queryKey: scopeKey(APP_DATA_QUERY_KEY),
2767
- queryFn: () => fetchRawManifest(fluidOsApi),
2736
+ queryFn: () => fetchRawManifest(appDefinitionApi),
2768
2737
  select: (raw) => {
2769
2738
  return transformManifestToRepAppData(raw).profile;
2770
2739
  }
2771
2740
  });
2772
2741
  }
2773
2742
  //#endregion
2743
+ //#region src/hooks/use-app-definition.ts
2744
+ /**
2745
+ * Base query key for the app definition endpoint.
2746
+ * The runtime key includes a company prefix via {@link useCompanyScopedQueryKey}.
2747
+ */
2748
+ const APP_DEFINITION_QUERY_KEY = ["fluid", "app-definition"];
2749
+ /**
2750
+ * Hook to fetch the active app manifest from the portal-tenant BFF.
2751
+ *
2752
+ * Returns the manifest metadata (id, name, version)
2753
+ * sourced from `GET /api/app/manifest` via the {@link AppDefinitionApi} port.
2754
+ *
2755
+ * @example
2756
+ * ```tsx
2757
+ * function MyComponent() {
2758
+ * const { data } = useAppDefinition();
2759
+ * const definitionId = data?.definition.id ?? 0;
2760
+ * }
2761
+ * ```
2762
+ */
2763
+ function useAppDefinition(options) {
2764
+ const api = require_FluidProvider.useAppDefinitionApi();
2765
+ const { scopeKey } = useCompanyScopedQueryKey();
2766
+ return (0, _tanstack_react_query.useQuery)({
2767
+ queryKey: scopeKey(APP_DEFINITION_QUERY_KEY),
2768
+ queryFn: () => api.fetchDefinition(),
2769
+ ...options?.enabled !== void 0 && { enabled: options.enabled }
2770
+ });
2771
+ }
2772
+ //#endregion
2774
2773
  //#region src/hooks/use-fluid-theme.ts
2775
2774
  /**
2776
2775
  * Hook to access and control theme settings
@@ -3631,8 +3630,8 @@ zod.z.object({
3631
3630
  //#endregion
3632
3631
  //#region src/screens/index.ts
3633
3632
  const screenPropertySchemas = {
3634
- ProfileScreen: () => Promise.resolve().then(() => require("./ProfileScreen-CD0p8061.cjs")).then((m) => m.profileScreenPropertySchema),
3635
- MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-XzPsvsXP.cjs")).then((m) => m.messagingScreenPropertySchema),
3633
+ ProfileScreen: () => Promise.resolve().then(() => require("./ProfileScreen-CZDMIHZ9.cjs")).then((m) => m.profileScreenPropertySchema),
3634
+ MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-D35g9qBs.cjs")).then((m) => m.messagingScreenPropertySchema),
3636
3635
  ContactsScreen: () => Promise.resolve().then(() => require("./ContactsScreen-f9MvO-hX.cjs")).then((m) => m.contactsScreenPropertySchema),
3637
3636
  OrdersScreen: () => Promise.resolve().then(() => require("./OrdersScreen-COGBqaif.cjs")).then((m) => m.ordersScreenPropertySchema),
3638
3637
  SubscriptionsScreen: () => Promise.resolve().then(() => require("./SubscriptionsScreen-CYIUXxrJ.cjs")).then((m) => m.subscriptionsScreenPropertySchema),
@@ -3640,7 +3639,7 @@ const screenPropertySchemas = {
3640
3639
  ProductsScreen: () => Promise.resolve().then(() => require("./ProductsScreen-DjzkmBOS.cjs")).then((m) => m.productsScreenPropertySchema),
3641
3640
  MySiteScreen: () => Promise.resolve().then(() => require("./MySiteScreen-W907mNoB.cjs")).then((m) => m.mySiteScreenPropertySchema),
3642
3641
  ShareablesScreen: () => Promise.resolve().then(() => require("./ShareablesScreen-BZG-rFuT.cjs")).then((m) => m.shareablesScreenPropertySchema),
3643
- ShopScreen: () => Promise.resolve().then(() => require("./ShopScreen-DqUle1Zv.cjs")).then((m) => m.shopScreenPropertySchema),
3642
+ ShopScreen: () => Promise.resolve().then(() => require("./ShopScreen-BeuMn_38.cjs")).then((m) => m.shopScreenPropertySchema),
3644
3643
  UpgradeScreen: () => Promise.resolve().then(() => require("./UpgradeScreen-DqpdSO-F.cjs")).then((m) => m.upgradeScreenPropertySchema),
3645
3644
  AppDownloadScreen: () => Promise.resolve().then(() => require("./AppDownloadScreen-DXkRe6MQ.cjs")).then((n) => n.AppDownloadScreen_exports).then((m) => m.appDownloadScreenPropertySchema)
3646
3645
  };