@fluid-app/portal-sdk 0.1.196 → 0.1.198

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-Zoz_YDJM.cjs → PortalContentApiProvider-Bn44plrY.cjs} +102 -34
  2. package/dist/PortalContentApiProvider-Bn44plrY.cjs.map +1 -0
  3. package/dist/{PortalContentApiProvider-3zgq-z26.mjs → PortalContentApiProvider-tSZDt_f2.mjs} +102 -34
  4. package/dist/PortalContentApiProvider-tSZDt_f2.mjs.map +1 -0
  5. package/dist/{ProductsScreen-BLsyTVHI.cjs → ProductsScreen-Cvzwt-X-.cjs} +2 -2
  6. package/dist/{ProductsScreen-xuQq68Lm.mjs → ProductsScreen-nryGJv7S.mjs} +2 -2
  7. package/dist/{ProductsScreen-DNigWzOk.mjs → ProductsScreen-o7LU64rN.mjs} +2 -2
  8. package/dist/{ProductsScreen-DNigWzOk.mjs.map → ProductsScreen-o7LU64rN.mjs.map} +1 -1
  9. package/dist/{ProductsScreen-BiyYxql3.cjs → ProductsScreen-uTXJCUPs.cjs} +2 -2
  10. package/dist/{ProductsScreen-BiyYxql3.cjs.map → ProductsScreen-uTXJCUPs.cjs.map} +1 -1
  11. package/dist/{ShareablesScreen-CfuQenlV.mjs → ShareablesScreen-DPAjypds.mjs} +2 -2
  12. package/dist/{ShareablesScreen-CfuQenlV.mjs.map → ShareablesScreen-DPAjypds.mjs.map} +1 -1
  13. package/dist/{ShareablesScreen-w72hongE.mjs → ShareablesScreen-DrMFfqJl.mjs} +2 -2
  14. package/dist/{ShareablesScreen-Df9GKUVi.cjs → ShareablesScreen-Dw818mdV.cjs} +2 -2
  15. package/dist/{ShareablesScreen-Df9GKUVi.cjs.map → ShareablesScreen-Dw818mdV.cjs.map} +1 -1
  16. package/dist/{ShareablesScreen-CP4uXPPz.cjs → ShareablesScreen-iUMt1ep3.cjs} +2 -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 +20 -20
  27. package/dist/PortalContentApiProvider-3zgq-z26.mjs.map +0 -1
  28. package/dist/PortalContentApiProvider-Zoz_YDJM.cjs.map +0 -1
@@ -1424,6 +1424,35 @@ function ProductDetailScreen({ productId, countryCode, fetchProduct: fetchPortal
1424
1424
  });
1425
1425
  }
1426
1426
  //#endregion
1427
+ //#region ../../shareables/ui/src/components/OwnerFilterTabs.tsx
1428
+ function getFilteredEmptyMessage({ searchTerm, ownerFilter, hasOtherFilters = false, entityName = "items", defaultMessage = "Nothing available at the moment." }) {
1429
+ const isFiltered = ownerFilter !== "all" || hasOtherFilters;
1430
+ if (searchTerm && isFiltered) return `No ${entityName} match "${searchTerm}" with the current filters. Try a different search term or switch to "All".`;
1431
+ if (searchTerm) return `No ${entityName} match "${searchTerm}". Try a different search term.`;
1432
+ if (isFiltered) return `No matching ${entityName} for the current filters.`;
1433
+ return defaultMessage;
1434
+ }
1435
+ function OwnerFilterTabs({ value, onValueChange, myLabel = "Mine" }) {
1436
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Tabs, {
1437
+ value,
1438
+ onValueChange: (v) => onValueChange(v),
1439
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.TabsList, { children: [
1440
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1441
+ value: "all",
1442
+ children: "All"
1443
+ }),
1444
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1445
+ value: "my",
1446
+ children: myLabel
1447
+ }),
1448
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1449
+ value: "company",
1450
+ children: "Company"
1451
+ })
1452
+ ] })
1453
+ });
1454
+ }
1455
+ //#endregion
1427
1456
  //#region ../../shareables/ui/src/components/screens/MediaListingScreen.tsx
1428
1457
  const PAGE_SIZE$3 = 24;
1429
1458
  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";
@@ -1575,23 +1604,10 @@ function MediaListingScreen({ onNavigate }) {
1575
1604
  children: [
1576
1605
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1577
1606
  className: "flex items-center gap-3",
1578
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Tabs, {
1607
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OwnerFilterTabs, {
1579
1608
  value: ownerFilter,
1580
- onValueChange: (value) => setOwnerFilter(value),
1581
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.TabsList, { children: [
1582
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1583
- value: "all",
1584
- children: "All"
1585
- }),
1586
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1587
- value: "my",
1588
- children: "My Media"
1589
- }),
1590
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TabsTrigger, {
1591
- value: "company",
1592
- children: "Company"
1593
- })
1594
- ] })
1609
+ onValueChange: setOwnerFilter,
1610
+ myLabel: "My Media"
1595
1611
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1596
1612
  className: "ml-auto flex items-center gap-2",
1597
1613
  children: [
@@ -1672,7 +1688,13 @@ function MediaListingScreen({ onNavigate }) {
1672
1688
  className: "flex flex-col items-center justify-center py-16",
1673
1689
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1674
1690
  className: "text-muted-foreground text-sm",
1675
- 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."
1691
+ children: getFilteredEmptyMessage({
1692
+ searchTerm: debouncedSearch,
1693
+ ownerFilter,
1694
+ hasOtherFilters: kindFilter !== "all",
1695
+ entityName: "media",
1696
+ defaultMessage: "No media available."
1697
+ })
1676
1698
  })
1677
1699
  }) : viewMode === "grid" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1678
1700
  className: GRID_CLASS$2,
@@ -8915,7 +8937,11 @@ function PlaylistsListingScreen(_props) {
8915
8937
  const [searchTerm, setSearchTerm] = (0, react.useState)("");
8916
8938
  const [debouncedSearch, setDebouncedSearch] = (0, react.useState)("");
8917
8939
  const [sortValue, setSortValue] = (0, react.useState)("title");
8940
+ const [ownerFilter, setOwnerFilter] = (0, react.useState)("all");
8918
8941
  const [selectedIds, setSelectedIds] = (0, react.useState)(/* @__PURE__ */ new Set());
8942
+ (0, react.useEffect)(() => {
8943
+ setSelectedIds(/* @__PURE__ */ new Set());
8944
+ }, [ownerFilter]);
8919
8945
  (0, react.useEffect)(() => {
8920
8946
  const timer = setTimeout(() => setDebouncedSearch(searchTerm), 300);
8921
8947
  return () => clearTimeout(timer);
@@ -8946,6 +8972,15 @@ function PlaylistsListingScreen(_props) {
8946
8972
  placeholderData: _tanstack_react_query.keepPreviousData
8947
8973
  });
8948
8974
  const allPlaylists = (0, react.useMemo)(() => data?.pages.flatMap((page) => page.playlists) ?? [], [data?.pages]);
8975
+ const filteredPlaylists = (0, react.useMemo)(() => {
8976
+ if (ownerFilter === "all" || !user?.id) return allPlaylists;
8977
+ if (ownerFilter === "my") return allPlaylists.filter((p) => p.user_id === user.id);
8978
+ return allPlaylists.filter((p) => p.user_id !== user.id);
8979
+ }, [
8980
+ allPlaylists,
8981
+ ownerFilter,
8982
+ user?.id
8983
+ ]);
8949
8984
  (0, react.useEffect)(() => {
8950
8985
  const target = observerTarget.current;
8951
8986
  if (!target) return;
@@ -8972,9 +9007,9 @@ function PlaylistsListingScreen(_props) {
8972
9007
  });
8973
9008
  }, []);
8974
9009
  const handleSelectAll = (0, react.useCallback)(() => {
8975
- if (selectedIds.size === allPlaylists.length) setSelectedIds(/* @__PURE__ */ new Set());
8976
- else setSelectedIds(new Set(allPlaylists.map((p) => p.id)));
8977
- }, [selectedIds.size, allPlaylists]);
9010
+ if (selectedIds.size === filteredPlaylists.length) setSelectedIds(/* @__PURE__ */ new Set());
9011
+ else setSelectedIds(new Set(filteredPlaylists.map((p) => p.id)));
9012
+ }, [selectedIds.size, filteredPlaylists]);
8978
9013
  const handleClearSelection = (0, react.useCallback)(() => {
8979
9014
  setSelectedIds(/* @__PURE__ */ new Set());
8980
9015
  }, []);
@@ -9074,14 +9109,18 @@ function PlaylistsListingScreen(_props) {
9074
9109
  children: [
9075
9110
  hasSelection ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BulkSelectionBar, {
9076
9111
  selectedCount: selectedIds.size,
9077
- totalCount: allPlaylists.length,
9112
+ totalCount: filteredPlaylists.length,
9078
9113
  onSelectAll: handleSelectAll,
9079
9114
  onClearSelection: handleClearSelection,
9080
9115
  onBulkFavorite: handleBulkFavorite
9081
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9082
- className: "flex justify-end",
9083
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9084
- className: "w-full max-w-sm",
9116
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9117
+ className: "flex items-center gap-3",
9118
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OwnerFilterTabs, {
9119
+ value: ownerFilter,
9120
+ onValueChange: setOwnerFilter,
9121
+ myLabel: "My Playlists"
9122
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9123
+ className: "ml-auto w-full max-w-sm",
9085
9124
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SearchSort.SearchSort, {
9086
9125
  searchValue: searchTerm,
9087
9126
  onSearchChange: setSearchTerm,
@@ -9107,17 +9146,22 @@ function PlaylistsListingScreen(_props) {
9107
9146
  sortValue,
9108
9147
  onSortChange: setSortValue
9109
9148
  })
9110
- })
9149
+ })]
9111
9150
  }),
9112
- allPlaylists.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9151
+ filteredPlaylists.length === 0 && !isFetchingNextPage && !hasNextPage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9113
9152
  className: "flex flex-col items-center justify-center py-16",
9114
9153
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9115
9154
  className: "text-muted-foreground text-sm",
9116
- children: searchTerm ? `No playlists match "${searchTerm}". Try a different search term.` : "There are no playlists available at the moment."
9155
+ children: getFilteredEmptyMessage({
9156
+ searchTerm,
9157
+ ownerFilter,
9158
+ entityName: "playlists",
9159
+ defaultMessage: "There are no playlists available at the moment."
9160
+ })
9117
9161
  })
9118
9162
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9119
9163
  className: GRID_CLASS$1,
9120
- children: allPlaylists.map((playlist) => {
9164
+ children: filteredPlaylists.map((playlist) => {
9121
9165
  const firstItem = playlist.items?.[0];
9122
9166
  const imageUrl = playlist.image_url ?? firstItem?.image_url ?? firstItem?.relateable?.image_url ?? firstItem?.relateable?.compressed_image_url;
9123
9167
  const itemCount = playlist.items_count ?? playlist.items?.length ?? 0;
@@ -10185,6 +10229,7 @@ function PlaylistItemsSection({ playlistId }) {
10185
10229
  });
10186
10230
  return;
10187
10231
  }
10232
+ let nextOrder = tableItems.length + 1;
10188
10233
  for (const result of mediaResults) {
10189
10234
  const label = result.metadata?.file_name?.replace(/\.[^/.]+$/, "") || `Medium #${result.asset_id}`;
10190
10235
  const relateableId = result.asset_id;
@@ -10196,9 +10241,10 @@ function PlaylistItemsSection({ playlistId }) {
10196
10241
  });
10197
10242
  continue;
10198
10243
  }
10244
+ const order = nextOrder++;
10199
10245
  const newItem = {
10200
10246
  id: Date.now() + Math.random(),
10201
- order: 0,
10247
+ order,
10202
10248
  relateable_type: relateableType,
10203
10249
  relateable: {
10204
10250
  id: relateableId,
@@ -10213,7 +10259,7 @@ function PlaylistItemsSection({ playlistId }) {
10213
10259
  data: {
10214
10260
  relateable_type: relateableType,
10215
10261
  relateable_id: relateableId,
10216
- order: 0
10262
+ order
10217
10263
  }
10218
10264
  });
10219
10265
  showToast({
@@ -11488,11 +11534,33 @@ function createPlaylistsAdapter(client) {
11488
11534
  media_id: item.relateable_id,
11489
11535
  position: typeof item.order === "number" ? item.order : Number(item.order)
11490
11536
  })));
11491
- return toBffPlaylist((await portAdapter.getPlaylist(id)).playlist);
11537
+ return {
11538
+ id,
11539
+ title: "",
11540
+ description: null,
11541
+ image_url: null,
11542
+ slug: null,
11543
+ active: true,
11544
+ user_id: null,
11545
+ is_favorited: false,
11546
+ items: [],
11547
+ items_count: 0
11548
+ };
11492
11549
  },
11493
11550
  removeItemsFromPlaylist: async (playlistId, data) => {
11494
11551
  await Promise.all(data.item_ids.map((itemId) => portAdapter.removePlaylistItem(playlistId, itemId)));
11495
- return toBffPlaylist((await portAdapter.getPlaylist(playlistId)).playlist);
11552
+ return {
11553
+ id: playlistId,
11554
+ title: "",
11555
+ description: null,
11556
+ image_url: null,
11557
+ slug: null,
11558
+ active: true,
11559
+ user_id: null,
11560
+ is_favorited: false,
11561
+ items: [],
11562
+ items_count: 0
11563
+ };
11496
11564
  }
11497
11565
  };
11498
11566
  }
@@ -11830,4 +11898,4 @@ Object.defineProperty(exports, "usePortalContentContext", {
11830
11898
  }
11831
11899
  });
11832
11900
 
11833
- //# sourceMappingURL=PortalContentApiProvider-Zoz_YDJM.cjs.map
11901
+ //# sourceMappingURL=PortalContentApiProvider-Bn44plrY.cjs.map