@fluid-app/portal-sdk 0.1.196 → 0.1.197

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 (28) hide show
  1. package/dist/{PortalContentApiProvider-3zgq-z26.mjs → PortalContentApiProvider-C2cVPFwK.mjs} +74 -30
  2. package/dist/PortalContentApiProvider-C2cVPFwK.mjs.map +1 -0
  3. package/dist/{PortalContentApiProvider-Zoz_YDJM.cjs → PortalContentApiProvider-CmDBRz5Y.cjs} +74 -30
  4. package/dist/PortalContentApiProvider-CmDBRz5Y.cjs.map +1 -0
  5. package/dist/{ProductsScreen-BLsyTVHI.cjs → ProductsScreen-A6AmNu6A.cjs} +2 -2
  6. package/dist/{ProductsScreen-xuQq68Lm.mjs → ProductsScreen-Bmvtrqwz.mjs} +4 -2
  7. package/dist/{ProductsScreen-DNigWzOk.mjs → ProductsScreen-CgoKo7Zn.mjs} +2 -2
  8. package/dist/{ProductsScreen-DNigWzOk.mjs.map → ProductsScreen-CgoKo7Zn.mjs.map} +1 -1
  9. package/dist/{ProductsScreen-BiyYxql3.cjs → ProductsScreen-Dmu_hEzn.cjs} +2 -2
  10. package/dist/{ProductsScreen-BiyYxql3.cjs.map → ProductsScreen-Dmu_hEzn.cjs.map} +1 -1
  11. package/dist/{ShareablesScreen-CP4uXPPz.cjs → ShareablesScreen-3G_tIwAB.cjs} +2 -2
  12. package/dist/{ShareablesScreen-Df9GKUVi.cjs → ShareablesScreen-Dead0Hax.cjs} +2 -2
  13. package/dist/{ShareablesScreen-Df9GKUVi.cjs.map → ShareablesScreen-Dead0Hax.cjs.map} +1 -1
  14. package/dist/{ShareablesScreen-CfuQenlV.mjs → ShareablesScreen-eZgLDxLb.mjs} +2 -2
  15. package/dist/{ShareablesScreen-CfuQenlV.mjs.map → ShareablesScreen-eZgLDxLb.mjs.map} +1 -1
  16. package/dist/{ShareablesScreen-w72hongE.mjs → ShareablesScreen-gaClu1n7.mjs} +4 -2
  17. package/dist/{ShopScreen-z-1csZzu.mjs → ShopScreen-BBFsy04y.mjs} +25 -10
  18. package/dist/{ShopScreen-z-1csZzu.mjs.map → ShopScreen-BBFsy04y.mjs.map} +1 -1
  19. package/dist/{ShopScreen-CUWxEit0.cjs → ShopScreen-BCZ_tsd3.cjs} +25 -10
  20. package/dist/{ShopScreen-CUWxEit0.cjs.map → ShopScreen-BCZ_tsd3.cjs.map} +1 -1
  21. package/dist/{ShopScreen-DN8UWl8P.cjs → ShopScreen-tjFoj6_r.cjs} +1 -1
  22. package/dist/index.cjs +10 -10
  23. package/dist/index.d.cts.map +1 -1
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +10 -10
  26. package/package.json +12 -12
  27. package/dist/PortalContentApiProvider-3zgq-z26.mjs.map +0 -1
  28. package/dist/PortalContentApiProvider-Zoz_YDJM.cjs.map +0 -1
@@ -1422,6 +1422,35 @@ function ProductDetailScreen({ productId, countryCode, fetchProduct: fetchPortal
1422
1422
  });
1423
1423
  }
1424
1424
  //#endregion
1425
+ //#region ../../shareables/ui/src/components/OwnerFilterTabs.tsx
1426
+ function getFilteredEmptyMessage({ searchTerm, ownerFilter, hasOtherFilters = false, entityName = "items", defaultMessage = "Nothing available at the moment." }) {
1427
+ const isFiltered = ownerFilter !== "all" || hasOtherFilters;
1428
+ if (searchTerm && isFiltered) return `No ${entityName} match "${searchTerm}" with the current filters. Try a different search term or switch to "All".`;
1429
+ if (searchTerm) return `No ${entityName} match "${searchTerm}". Try a different search term.`;
1430
+ if (isFiltered) return `No matching ${entityName} for the current filters.`;
1431
+ return defaultMessage;
1432
+ }
1433
+ function OwnerFilterTabs({ value, onValueChange, myLabel = "Mine" }) {
1434
+ return /* @__PURE__ */ jsx(Tabs, {
1435
+ value,
1436
+ onValueChange: (v) => onValueChange(v),
1437
+ children: /* @__PURE__ */ jsxs(TabsList, { children: [
1438
+ /* @__PURE__ */ jsx(TabsTrigger, {
1439
+ value: "all",
1440
+ children: "All"
1441
+ }),
1442
+ /* @__PURE__ */ jsx(TabsTrigger, {
1443
+ value: "my",
1444
+ children: myLabel
1445
+ }),
1446
+ /* @__PURE__ */ jsx(TabsTrigger, {
1447
+ value: "company",
1448
+ children: "Company"
1449
+ })
1450
+ ] })
1451
+ });
1452
+ }
1453
+ //#endregion
1425
1454
  //#region ../../shareables/ui/src/components/screens/MediaListingScreen.tsx
1426
1455
  const PAGE_SIZE$3 = 24;
1427
1456
  const GRID_CLASS$2 = "grid grid-cols-1 gap-8 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4";
@@ -1573,23 +1602,10 @@ function MediaListingScreen({ onNavigate }) {
1573
1602
  children: [
1574
1603
  /* @__PURE__ */ jsxs("div", {
1575
1604
  className: "flex items-center gap-3",
1576
- children: [/* @__PURE__ */ jsx(Tabs, {
1605
+ children: [/* @__PURE__ */ jsx(OwnerFilterTabs, {
1577
1606
  value: ownerFilter,
1578
- onValueChange: (value) => setOwnerFilter(value),
1579
- children: /* @__PURE__ */ jsxs(TabsList, { children: [
1580
- /* @__PURE__ */ jsx(TabsTrigger, {
1581
- value: "all",
1582
- children: "All"
1583
- }),
1584
- /* @__PURE__ */ jsx(TabsTrigger, {
1585
- value: "my",
1586
- children: "My Media"
1587
- }),
1588
- /* @__PURE__ */ jsx(TabsTrigger, {
1589
- value: "company",
1590
- children: "Company"
1591
- })
1592
- ] })
1607
+ onValueChange: setOwnerFilter,
1608
+ myLabel: "My Media"
1593
1609
  }), /* @__PURE__ */ jsxs("div", {
1594
1610
  className: "ml-auto flex items-center gap-2",
1595
1611
  children: [
@@ -1670,7 +1686,13 @@ function MediaListingScreen({ onNavigate }) {
1670
1686
  className: "flex flex-col items-center justify-center py-16",
1671
1687
  children: /* @__PURE__ */ jsx("p", {
1672
1688
  className: "text-muted-foreground text-sm",
1673
- children: debouncedSearch ? "No media match your search." : ownerFilter !== "all" || kindFilter !== "all" ? "No matching media on this page — try another page or adjusting filters." : "No media available."
1689
+ children: getFilteredEmptyMessage({
1690
+ searchTerm: debouncedSearch,
1691
+ ownerFilter,
1692
+ hasOtherFilters: kindFilter !== "all",
1693
+ entityName: "media",
1694
+ defaultMessage: "No media available."
1695
+ })
1674
1696
  })
1675
1697
  }) : viewMode === "grid" ? /* @__PURE__ */ jsx("div", {
1676
1698
  className: GRID_CLASS$2,
@@ -8913,7 +8935,11 @@ function PlaylistsListingScreen(_props) {
8913
8935
  const [searchTerm, setSearchTerm] = useState("");
8914
8936
  const [debouncedSearch, setDebouncedSearch] = useState("");
8915
8937
  const [sortValue, setSortValue] = useState("title");
8938
+ const [ownerFilter, setOwnerFilter] = useState("all");
8916
8939
  const [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set());
8940
+ useEffect(() => {
8941
+ setSelectedIds(/* @__PURE__ */ new Set());
8942
+ }, [ownerFilter]);
8917
8943
  useEffect(() => {
8918
8944
  const timer = setTimeout(() => setDebouncedSearch(searchTerm), 300);
8919
8945
  return () => clearTimeout(timer);
@@ -8944,6 +8970,15 @@ function PlaylistsListingScreen(_props) {
8944
8970
  placeholderData: keepPreviousData
8945
8971
  });
8946
8972
  const allPlaylists = useMemo(() => data?.pages.flatMap((page) => page.playlists) ?? [], [data?.pages]);
8973
+ const filteredPlaylists = useMemo(() => {
8974
+ if (ownerFilter === "all" || !user?.id) return allPlaylists;
8975
+ if (ownerFilter === "my") return allPlaylists.filter((p) => p.user_id === user.id);
8976
+ return allPlaylists.filter((p) => p.user_id !== user.id);
8977
+ }, [
8978
+ allPlaylists,
8979
+ ownerFilter,
8980
+ user?.id
8981
+ ]);
8947
8982
  useEffect(() => {
8948
8983
  const target = observerTarget.current;
8949
8984
  if (!target) return;
@@ -8970,9 +9005,9 @@ function PlaylistsListingScreen(_props) {
8970
9005
  });
8971
9006
  }, []);
8972
9007
  const handleSelectAll = useCallback(() => {
8973
- if (selectedIds.size === allPlaylists.length) setSelectedIds(/* @__PURE__ */ new Set());
8974
- else setSelectedIds(new Set(allPlaylists.map((p) => p.id)));
8975
- }, [selectedIds.size, allPlaylists]);
9008
+ if (selectedIds.size === filteredPlaylists.length) setSelectedIds(/* @__PURE__ */ new Set());
9009
+ else setSelectedIds(new Set(filteredPlaylists.map((p) => p.id)));
9010
+ }, [selectedIds.size, filteredPlaylists]);
8976
9011
  const handleClearSelection = useCallback(() => {
8977
9012
  setSelectedIds(/* @__PURE__ */ new Set());
8978
9013
  }, []);
@@ -9072,14 +9107,18 @@ function PlaylistsListingScreen(_props) {
9072
9107
  children: [
9073
9108
  hasSelection ? /* @__PURE__ */ jsx(BulkSelectionBar, {
9074
9109
  selectedCount: selectedIds.size,
9075
- totalCount: allPlaylists.length,
9110
+ totalCount: filteredPlaylists.length,
9076
9111
  onSelectAll: handleSelectAll,
9077
9112
  onClearSelection: handleClearSelection,
9078
9113
  onBulkFavorite: handleBulkFavorite
9079
- }) : /* @__PURE__ */ jsx("div", {
9080
- className: "flex justify-end",
9081
- children: /* @__PURE__ */ jsx("div", {
9082
- className: "w-full max-w-sm",
9114
+ }) : /* @__PURE__ */ jsxs("div", {
9115
+ className: "flex items-center gap-3",
9116
+ children: [/* @__PURE__ */ jsx(OwnerFilterTabs, {
9117
+ value: ownerFilter,
9118
+ onValueChange: setOwnerFilter,
9119
+ myLabel: "My Playlists"
9120
+ }), /* @__PURE__ */ jsx("div", {
9121
+ className: "ml-auto w-full max-w-sm",
9083
9122
  children: /* @__PURE__ */ jsx(SearchSort, {
9084
9123
  searchValue: searchTerm,
9085
9124
  onSearchChange: setSearchTerm,
@@ -9105,17 +9144,22 @@ function PlaylistsListingScreen(_props) {
9105
9144
  sortValue,
9106
9145
  onSortChange: setSortValue
9107
9146
  })
9108
- })
9147
+ })]
9109
9148
  }),
9110
- allPlaylists.length === 0 ? /* @__PURE__ */ jsx("div", {
9149
+ filteredPlaylists.length === 0 && !isFetchingNextPage && !hasNextPage ? /* @__PURE__ */ jsx("div", {
9111
9150
  className: "flex flex-col items-center justify-center py-16",
9112
9151
  children: /* @__PURE__ */ jsx("p", {
9113
9152
  className: "text-muted-foreground text-sm",
9114
- children: searchTerm ? `No playlists match "${searchTerm}". Try a different search term.` : "There are no playlists available at the moment."
9153
+ children: getFilteredEmptyMessage({
9154
+ searchTerm,
9155
+ ownerFilter,
9156
+ entityName: "playlists",
9157
+ defaultMessage: "There are no playlists available at the moment."
9158
+ })
9115
9159
  })
9116
9160
  }) : /* @__PURE__ */ jsx("div", {
9117
9161
  className: GRID_CLASS$1,
9118
- children: allPlaylists.map((playlist) => {
9162
+ children: filteredPlaylists.map((playlist) => {
9119
9163
  const firstItem = playlist.items?.[0];
9120
9164
  const imageUrl = playlist.image_url ?? firstItem?.image_url ?? firstItem?.relateable?.image_url ?? firstItem?.relateable?.compressed_image_url;
9121
9165
  const itemCount = playlist.items_count ?? playlist.items?.length ?? 0;
@@ -11778,4 +11822,4 @@ function PortalContentApiProvider({ children }) {
11778
11822
  //#endregion
11779
11823
  export { ShareablesApp as a, ShareablesCoreProvider as c, ProductsApp as i, usePortalContentContext as n, useFilePickerApi as o, toggleFavorite as r, ShareablesUIProvider as s, PortalContentApiProvider as t };
11780
11824
 
11781
- //# sourceMappingURL=PortalContentApiProvider-3zgq-z26.mjs.map
11825
+ //# sourceMappingURL=PortalContentApiProvider-C2cVPFwK.mjs.map