@fluid-app/portal-sdk 0.1.162 → 0.1.164

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 (69) hide show
  1. package/dist/{MySiteScreen-g8Esyofu.mjs → MySiteScreen-CG2DnzQH.mjs} +2 -2
  2. package/dist/{MySiteScreen-g8Esyofu.mjs.map → MySiteScreen-CG2DnzQH.mjs.map} +1 -1
  3. package/dist/{MySiteScreen-Cos0jTa_.cjs → MySiteScreen-DRMrEMEI.cjs} +2 -2
  4. package/dist/{MySiteScreen-Xcg07a3M.cjs → MySiteScreen-Lr2SbrXz.cjs} +2 -2
  5. package/dist/{MySiteScreen-Xcg07a3M.cjs.map → MySiteScreen-Lr2SbrXz.cjs.map} +1 -1
  6. package/dist/{OrdersScreen-DZyOBKmU.cjs → OrdersScreen-B6n41CbG.cjs} +1 -1
  7. package/dist/{OrdersScreen-ZGUm8buk.cjs → OrdersScreen-BKCQdz5A.cjs} +55 -56
  8. package/dist/OrdersScreen-BKCQdz5A.cjs.map +1 -0
  9. package/dist/{OrdersScreen-DeLoyVGI.mjs → OrdersScreen-CFRVfzez.mjs} +55 -56
  10. package/dist/OrdersScreen-CFRVfzez.mjs.map +1 -0
  11. package/dist/{use-portal-shareables-api-DRK9Y5dp.mjs → PortalContentApiProvider-CW0ADhPi.mjs} +285 -94
  12. package/dist/PortalContentApiProvider-CW0ADhPi.mjs.map +1 -0
  13. package/dist/{use-portal-shareables-api-DcjYlAOy.cjs → PortalContentApiProvider-Di5emtYd.cjs} +290 -129
  14. package/dist/PortalContentApiProvider-Di5emtYd.cjs.map +1 -0
  15. package/dist/PortalProductsApiProvider-BCXX9NGK.mjs +780 -0
  16. package/dist/PortalProductsApiProvider-BCXX9NGK.mjs.map +1 -0
  17. package/dist/PortalProductsApiProvider-BquMHwvt.cjs +816 -0
  18. package/dist/PortalProductsApiProvider-BquMHwvt.cjs.map +1 -0
  19. package/dist/{ProductsScreen-B2SKzTE4.cjs → ProductsScreen-C6eNgxjP.cjs} +4 -3
  20. package/dist/{ProductsScreen-D6eoU86k.mjs → ProductsScreen-CVNJudq9.mjs} +39 -44
  21. package/dist/ProductsScreen-CVNJudq9.mjs.map +1 -0
  22. package/dist/{ProductsScreen-DbwSCY7G.cjs → ProductsScreen-KjjhlDGo.cjs} +39 -44
  23. package/dist/ProductsScreen-KjjhlDGo.cjs.map +1 -0
  24. package/dist/{ProductsScreen-BGah2tcD.mjs → ProductsScreen-nHmUftQn.mjs} +4 -3
  25. package/dist/{ShareablesScreen-DRUT-yoi.mjs → ShareablesScreen-CdTyyDRO.mjs} +4 -3
  26. package/dist/{ShareablesScreen-Dy04EXe5.cjs → ShareablesScreen-DUzo8kRi.cjs} +4 -3
  27. package/dist/ShareablesScreen-DpEP_6u0.mjs +132 -0
  28. package/dist/ShareablesScreen-DpEP_6u0.mjs.map +1 -0
  29. package/dist/ShareablesScreen-Dz8w2l3e.cjs +144 -0
  30. package/dist/ShareablesScreen-Dz8w2l3e.cjs.map +1 -0
  31. package/dist/{ShopScreen-CQ48b1c8.mjs → ShopScreen-BH6zQndJ.mjs} +10 -724
  32. package/dist/ShopScreen-BH6zQndJ.mjs.map +1 -0
  33. package/dist/{ShopScreen-CFqoT4IC.cjs → ShopScreen-BUXUtEuj.cjs} +13 -727
  34. package/dist/ShopScreen-BUXUtEuj.cjs.map +1 -0
  35. package/dist/{ShopScreen-B7faQx84.cjs → ShopScreen-BbucUNI7.cjs} +2 -1
  36. package/dist/{SubscriptionsScreen-C2iORyT_.cjs → SubscriptionsScreen-BdGF5OLE.cjs} +408 -409
  37. package/dist/SubscriptionsScreen-BdGF5OLE.cjs.map +1 -0
  38. package/dist/{SubscriptionsScreen-ClWrrqPK.cjs → SubscriptionsScreen-Cwa2lR1D.cjs} +1 -1
  39. package/dist/{SubscriptionsScreen-BfdK8067.mjs → SubscriptionsScreen-Dn3AEUJi.mjs} +408 -409
  40. package/dist/SubscriptionsScreen-Dn3AEUJi.mjs.map +1 -0
  41. package/dist/{dist-lO2OG0T5.cjs → dist-BF_4vk1z.cjs} +1 -1
  42. package/dist/{dist-lO2OG0T5.cjs.map → dist-BF_4vk1z.cjs.map} +1 -1
  43. package/dist/index.cjs +21 -20
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.cts.map +1 -1
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +21 -20
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/{sortable.esm-DSrWP4x9.mjs → sortable.esm-E6JdQn7I.mjs} +1 -1
  50. package/dist/{sortable.esm-DSrWP4x9.mjs.map → sortable.esm-E6JdQn7I.mjs.map} +1 -1
  51. package/package.json +17 -17
  52. package/dist/OrdersScreen-DeLoyVGI.mjs.map +0 -1
  53. package/dist/OrdersScreen-ZGUm8buk.cjs.map +0 -1
  54. package/dist/ProductsScreen-D6eoU86k.mjs.map +0 -1
  55. package/dist/ProductsScreen-DbwSCY7G.cjs.map +0 -1
  56. package/dist/ShareablesScreen-DPHZMh-V.cjs +0 -391
  57. package/dist/ShareablesScreen-DPHZMh-V.cjs.map +0 -1
  58. package/dist/ShareablesScreen-DrQDQ1-U.mjs +0 -379
  59. package/dist/ShareablesScreen-DrQDQ1-U.mjs.map +0 -1
  60. package/dist/ShopScreen-CFqoT4IC.cjs.map +0 -1
  61. package/dist/ShopScreen-CQ48b1c8.mjs.map +0 -1
  62. package/dist/SubscriptionsScreen-BfdK8067.mjs.map +0 -1
  63. package/dist/SubscriptionsScreen-C2iORyT_.cjs.map +0 -1
  64. package/dist/use-portal-products-client-BUFD20ZY.mjs +0 -65
  65. package/dist/use-portal-products-client-BUFD20ZY.mjs.map +0 -1
  66. package/dist/use-portal-products-client-DTkFvOal.cjs +0 -71
  67. package/dist/use-portal-products-client-DTkFvOal.cjs.map +0 -1
  68. package/dist/use-portal-shareables-api-DRK9Y5dp.mjs.map +0 -1
  69. package/dist/use-portal-shareables-api-DcjYlAOy.cjs.map +0 -1
@@ -5,8 +5,8 @@ import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./
5
5
  import { a as useEditor, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-CkIGP8my.mjs";
6
6
  import { t as SearchSort } from "./SearchSort-Br8J8JS8.mjs";
7
7
  import { n as TextAlign, t as Underline } from "./dist-C9vpl_rR.mjs";
8
- import { a as verticalListSortingStrategy, c as PointerSensor, d as useSensors, f as CSS, i as useSortable, l as closestCenter, n as arrayMove, o as DndContext, r as sortableKeyboardCoordinates, s as KeyboardSensor, t as SortableContext, u as useSensor } from "./sortable.esm-DSrWP4x9.mjs";
9
- import { t as usePortalProductsClient } from "./use-portal-products-client-BUFD20ZY.mjs";
8
+ import { a as verticalListSortingStrategy, c as PointerSensor, d as useSensors, f as CSS, i as useSortable, l as closestCenter, n as arrayMove, o as DndContext, r as sortableKeyboardCoordinates, s as KeyboardSensor, t as SortableContext, u as useSensor } from "./sortable.esm-E6JdQn7I.mjs";
9
+ import { o as usePortalProductsApi } from "./PortalProductsApiProvider-BCXX9NGK.mjs";
10
10
  import React, { PureComponent, createContext, createRef, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
11
11
  import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
12
12
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -91,22 +91,7 @@ const shareablesKeys = {
91
91
  //#endregion
92
92
  //#region ../../shareables/core/src/api-context.tsx
93
93
  const ShareablesApiContext = createContext(null);
94
- function ShareablesApiProvider({ media, playlists, fileResources, share, productMedia, children }) {
95
- const value = useMemo(() => ({
96
- media,
97
- playlists,
98
- fileResources,
99
- share,
100
- productMedia: productMedia ?? { getProductMedia: () => {
101
- throw new Error("ProductMediaApi not provided to ShareablesApiProvider");
102
- } }
103
- }), [
104
- media,
105
- playlists,
106
- fileResources,
107
- share,
108
- productMedia
109
- ]);
94
+ function ShareablesApiProvider({ value, children }) {
110
95
  return /* @__PURE__ */ jsx(ShareablesApiContext.Provider, {
111
96
  value,
112
97
  children
@@ -1772,6 +1757,107 @@ const damQueryKeys = {
1772
1757
  ]
1773
1758
  };
1774
1759
  //#endregion
1760
+ //#region ../../file-picker/core/src/schemas/dam.ts
1761
+ const damVariantSchema = z.object({
1762
+ id: z.string(),
1763
+ url: z.string().nullable(),
1764
+ file_name: z.string(),
1765
+ mime_type: z.string(),
1766
+ content: z.any().nullable(),
1767
+ created_at: z.string(),
1768
+ updated_at: z.string(),
1769
+ default: z.boolean(),
1770
+ is_original: z.boolean(),
1771
+ is_text: z.boolean(),
1772
+ media_type: z.string(),
1773
+ processing_status: z.string(),
1774
+ tags: z.array(z.string())
1775
+ });
1776
+ const damAssetSchema = z.object({
1777
+ id: z.number(),
1778
+ canonical_path: z.string(),
1779
+ category: z.string(),
1780
+ code: z.string(),
1781
+ company: z.string(),
1782
+ created_at: z.string(),
1783
+ default_variant_id: z.string(),
1784
+ default_variant_url: z.string().optional(),
1785
+ description: z.string(),
1786
+ name: z.string(),
1787
+ updated_at: z.string(),
1788
+ variants: z.array(damVariantSchema).optional()
1789
+ });
1790
+ const damTreeFolderNodeSchema = z.object({
1791
+ asset_code: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
1792
+ name: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
1793
+ category: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
1794
+ variants: z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]).optional()
1795
+ }).passthrough();
1796
+ const damTreeSchema = z.record(z.string(), z.union([
1797
+ z.lazy(() => damTreeSchema),
1798
+ damAssetSchema,
1799
+ damTreeFolderNodeSchema
1800
+ ]));
1801
+ const damQueryResponseSchema = z.object({
1802
+ path: z.string(),
1803
+ tree: damTreeSchema,
1804
+ meta: z.object({ next_cursor: z.string().optional() }).optional()
1805
+ });
1806
+ z.object({ asset: z.object({
1807
+ file: z.any(),
1808
+ name: z.string(),
1809
+ description: z.string().optional(),
1810
+ tags: z.string().optional()
1811
+ }) });
1812
+ z.object({
1813
+ asset: damAssetSchema,
1814
+ meta: z.object({
1815
+ request_id: z.string(),
1816
+ timestamp: z.string()
1817
+ })
1818
+ });
1819
+ z.object({
1820
+ placeholder_asset: z.object({
1821
+ mime_type: z.string(),
1822
+ name: z.string().optional(),
1823
+ description: z.string().optional()
1824
+ }),
1825
+ skip_autotagging: z.boolean().optional()
1826
+ });
1827
+ z.object({
1828
+ asset: z.object({
1829
+ file: z.any(),
1830
+ name: z.string(),
1831
+ description: z.string().optional(),
1832
+ tags: z.string().optional()
1833
+ }).optional(),
1834
+ text_asset: z.object({
1835
+ file_name: z.string(),
1836
+ mime_type: z.string(),
1837
+ text: z.string(),
1838
+ name: z.string().optional(),
1839
+ description: z.string().optional(),
1840
+ tags: z.string().optional()
1841
+ }).optional(),
1842
+ placeholder_asset: z.object({
1843
+ mime_type: z.string(),
1844
+ name: z.string().optional(),
1845
+ description: z.string().optional()
1846
+ }).optional(),
1847
+ skip_autotagging: z.boolean().optional()
1848
+ });
1849
+ z.object({
1850
+ asset: z.object({
1851
+ id: z.number(),
1852
+ canonical_path: z.string(),
1853
+ name: z.string()
1854
+ }),
1855
+ meta: z.object({
1856
+ request_id: z.string(),
1857
+ timestamp: z.string()
1858
+ })
1859
+ });
1860
+ //#endregion
1775
1861
  //#region ../../file-picker/core/src/schemas/file-picker-config.ts
1776
1862
  const filePickerConfigSchema = z.object({
1777
1863
  accept: z.array(z.string()).optional(),
@@ -8865,6 +8951,33 @@ function ProductsApp({ countryCode, companyLogoUrl, fetchProducts, fetchProduct,
8865
8951
  });
8866
8952
  }
8867
8953
  //#endregion
8954
+ //#region ../../file-picker/api-client/src/api/url-proxy.ts
8955
+ const urlProxyResponseSchema = z.object({
8956
+ data: z.string(),
8957
+ contentType: z.string(),
8958
+ size: z.number()
8959
+ });
8960
+ /**
8961
+ * Proxy a URL fetch through the backend to bypass CORS restrictions.
8962
+ * The backend fetches the file and returns it as base64-encoded data.
8963
+ *
8964
+ * @param url - The URL to fetch
8965
+ * @param proxyEndpoint - The proxy endpoint (defaults to "/api/proxy-url")
8966
+ */
8967
+ async function proxyUrlFetch(url, proxyEndpoint = "/api/proxy-url") {
8968
+ const response = await fetch(proxyEndpoint, {
8969
+ method: "POST",
8970
+ headers: { "Content-Type": "application/json" },
8971
+ body: JSON.stringify({ url })
8972
+ });
8973
+ if (!response.ok) {
8974
+ const errorData = await response.json().catch(() => ({ error: "Failed to proxy URL fetch" }));
8975
+ throw new Error(errorData.error || `HTTP ${response.status}`);
8976
+ }
8977
+ const data = await response.json();
8978
+ return urlProxyResponseSchema.parse(data);
8979
+ }
8980
+ //#endregion
8868
8981
  //#region ../../api-clients/portal-tenant-content/src/namespaces/portal_tenant_content.ts
8869
8982
  /**
8870
8983
  * List media (own uploads and company media)
@@ -9100,7 +9213,97 @@ async function dam_assets_discard(client, code) {
9100
9213
  return client.patch(`/api/content/dam/assets/${code}/discard`);
9101
9214
  }
9102
9215
  //#endregion
9103
- //#region src/adapters/shareables-api-adapter.ts
9216
+ //#region ../../file-picker/api-client/src/portal-tenant-adapter.ts
9217
+ /**
9218
+ * Maps a BFF DAM asset to the file-picker port's DamAssetCreateResponse shape.
9219
+ *
9220
+ * The BFF response includes nullable meta.request_id (from Api::Response),
9221
+ * while the port schema requires a string. We coalesce to empty string.
9222
+ */
9223
+ function mapCreateResponse(response) {
9224
+ const raw = response.asset ?? {};
9225
+ return {
9226
+ asset: damAssetSchema.parse({
9227
+ ...raw,
9228
+ canonical_path: raw.canonical_path ?? "",
9229
+ category: raw.category ?? "",
9230
+ company: raw.company ?? "",
9231
+ description: raw.description ?? "",
9232
+ default_variant_id: raw.default_variant_id ?? ""
9233
+ }),
9234
+ meta: {
9235
+ request_id: response.meta?.request_id ?? "",
9236
+ timestamp: response.meta?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString()
9237
+ }
9238
+ };
9239
+ }
9240
+ /**
9241
+ * Maps a BFF asset path response to the file-picker port's shape.
9242
+ */
9243
+ function mapAssetPathCreateResponse(response) {
9244
+ const assetPath = response.asset_path ?? {};
9245
+ return {
9246
+ asset: {
9247
+ id: assetPath.id ?? 0,
9248
+ canonical_path: assetPath.path ?? "",
9249
+ name: assetPath.asset_code ?? ""
9250
+ },
9251
+ meta: {
9252
+ request_id: response.meta?.request_id ?? "",
9253
+ timestamp: response.meta?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString()
9254
+ }
9255
+ };
9256
+ }
9257
+ /**
9258
+ * Creates a FilePickerApi adapter backed by the portal-tenant BFF's
9259
+ * `/api/content/dam/*` endpoints, using cookie-based auth via the
9260
+ * provided FetchClient.
9261
+ *
9262
+ * Unsplash search is not available through the BFF — callers that need
9263
+ * Unsplash should use the legacy adapter or provide their own
9264
+ * implementation.
9265
+ *
9266
+ * The `onProgress` callback in `createDamAsset` is not supported — the
9267
+ * underlying `fetch` API does not expose upload progress events.
9268
+ *
9269
+ * URL proxy delegates to the same-origin `/api/proxy-url` endpoint
9270
+ * (served by the hosting app, not the BFF) for CORS bypass, identical
9271
+ * to the legacy adapter behaviour.
9272
+ */
9273
+ function createPortalTenantFilePickerApiAdapter(client) {
9274
+ return {
9275
+ createDamAsset: async (params) => {
9276
+ const formData = new FormData();
9277
+ formData.append("asset[file]", params.file);
9278
+ formData.append("asset[name]", params.name);
9279
+ if (params.description) formData.append("asset[description]", params.description);
9280
+ if (params.tags && params.tags.length > 0) formData.append("asset[tags]", params.tags.join(","));
9281
+ return mapCreateResponse(await client.requestWithFormData("/api/content/dam/assets", formData, { method: "POST" }));
9282
+ },
9283
+ queryDamAssets: async (params) => {
9284
+ const response = await dam_query(client, params);
9285
+ return damQueryResponseSchema.parse({
9286
+ ...response,
9287
+ meta: response.meta ? { next_cursor: response.meta.pagination?.next_cursor ?? void 0 } : void 0
9288
+ });
9289
+ },
9290
+ deleteDamAsset: async (code) => {
9291
+ return dam_assets_destroy(client, code);
9292
+ },
9293
+ discardDamAsset: async (code) => {
9294
+ return dam_assets_discard(client, code);
9295
+ },
9296
+ createDamAssetPathForAssets: async (params) => {
9297
+ return mapAssetPathCreateResponse(await dam_asset_paths_create(client, params.code, { asset_path: { path: params.asset_paths.join(",") } }));
9298
+ },
9299
+ searchUnsplash: async (_query, _page, _perPage) => {
9300
+ throw new Error("Unsplash search is not available through the portal-tenant BFF. Configure an Unsplash access key and use the standard FilePickerApi adapter instead.");
9301
+ },
9302
+ proxyUrlFetch: (url) => proxyUrlFetch(url)
9303
+ };
9304
+ }
9305
+ //#endregion
9306
+ //#region src/adapters/content-api-adapter.ts
9104
9307
  function mapMedia(raw) {
9105
9308
  return {
9106
9309
  id: raw.id ?? 0,
@@ -9126,10 +9329,7 @@ function mapMediaMeta(raw) {
9126
9329
  } : void 0
9127
9330
  };
9128
9331
  }
9129
- /**
9130
- * Creates a ContentMediaApi adapter backed by the portal-tenant content BFF.
9131
- */
9132
- function createPortalTenantMediaAdapter(client) {
9332
+ function createRawMediaAdapter(client) {
9133
9333
  return {
9134
9334
  listMedia: async (params) => {
9135
9335
  const response = await media_list(client, {
@@ -9225,13 +9425,8 @@ function toBffMediumResponse(bff) {
9225
9425
  created_at: bff.created_at
9226
9426
  };
9227
9427
  }
9228
- /**
9229
- * Creates a ShareablesApi["media"]-compatible adapter backed by the
9230
- * portal-tenant content BFF. Includes cursor-to-page-number caching
9231
- * for bridging the legacy UI's page-number pagination.
9232
- */
9233
- function createPortalTenantMediaShareablesAdapter(client) {
9234
- const portAdapter = createPortalTenantMediaAdapter(client);
9428
+ function createMediaAdapter(client) {
9429
+ const portAdapter = createRawMediaAdapter(client);
9235
9430
  const cursorByPage = /* @__PURE__ */ new Map();
9236
9431
  let lastFilterKey = "";
9237
9432
  return {
@@ -9337,10 +9532,7 @@ function mapPlaylistsMeta(raw) {
9337
9532
  } : void 0
9338
9533
  };
9339
9534
  }
9340
- /**
9341
- * Creates a ContentPlaylistsApi adapter backed by the portal-tenant content BFF.
9342
- */
9343
- function createPortalTenantPlaylistsAdapter(client) {
9535
+ function createRawPlaylistsAdapter(client) {
9344
9536
  return {
9345
9537
  listPlaylists: async (params) => {
9346
9538
  const response = await playlists_list(client, {
@@ -9422,13 +9614,8 @@ function toBffPlaylist(bff, items) {
9422
9614
  items_count: bff.items_count
9423
9615
  };
9424
9616
  }
9425
- /**
9426
- * Creates a ShareablesApi["playlists"]-compatible adapter backed by the
9427
- * portal-tenant content BFF. Fetches playlist + items in parallel for
9428
- * detail views and maps enriched flat fields onto playlist items.
9429
- */
9430
- function createPortalTenantPlaylistsShareablesAdapter(client) {
9431
- const portAdapter = createPortalTenantPlaylistsAdapter(client);
9617
+ function createPlaylistsAdapter(client) {
9618
+ const portAdapter = createRawPlaylistsAdapter(client);
9432
9619
  return {
9433
9620
  getPlaylists: async (options) => {
9434
9621
  const rawSort = options?.sort;
@@ -9556,10 +9743,7 @@ function mapSharesMeta(raw) {
9556
9743
  } : void 0
9557
9744
  };
9558
9745
  }
9559
- /**
9560
- * Creates a ContentSharesApi adapter backed by the portal-tenant content BFF.
9561
- */
9562
- function createPortalTenantSharesAdapter(client) {
9746
+ function createRawSharesAdapter(client) {
9563
9747
  return {
9564
9748
  listShares: async (params) => {
9565
9749
  const response = await shares_list(client, {
@@ -9590,12 +9774,8 @@ const SHAREABLE_TYPE_MAP = {
9590
9774
  Page: "page",
9591
9775
  page: "page"
9592
9776
  };
9593
- /**
9594
- * Creates a ShareablesApi["share"]-compatible adapter backed by the
9595
- * portal-tenant content BFF. Maps legacy model names to BFF shareable types.
9596
- */
9597
- function createPortalTenantSharesShareablesAdapter(client) {
9598
- const portAdapter = createPortalTenantSharesAdapter(client);
9777
+ function createShareAdapter(client) {
9778
+ const portAdapter = createRawSharesAdapter(client);
9599
9779
  return { createShareLink: async (input) => {
9600
9780
  if (!input.relateableId) throw new Error("Cannot create share link without a relateableId");
9601
9781
  const shareableType = SHAREABLE_TYPE_MAP[input.relateableType];
@@ -9641,10 +9821,7 @@ function mapDamAssetsMeta(raw) {
9641
9821
  } : void 0
9642
9822
  };
9643
9823
  }
9644
- /**
9645
- * Creates a ContentDamAssetsApi adapter backed by the portal-tenant content BFF.
9646
- */
9647
- function createPortalTenantDamAssetsAdapter(client) {
9824
+ function createRawDamAssetsAdapter(client) {
9648
9825
  return {
9649
9826
  listAssets: async (params) => {
9650
9827
  const response = await dam_assets_list(client, {
@@ -9682,13 +9859,8 @@ function createPortalTenantDamAssetsAdapter(client) {
9682
9859
  }
9683
9860
  };
9684
9861
  }
9685
- /**
9686
- * Creates a ShareablesApi["fileResources"]-compatible adapter backed by the
9687
- * portal-tenant content BFF. Maps DamAsset to FileResource shape and
9688
- * includes cursor-to-page-number caching for legacy UI pagination.
9689
- */
9690
- function createPortalTenantFilesShareablesAdapter(client) {
9691
- const portAdapter = createPortalTenantDamAssetsAdapter(client);
9862
+ function createFileResourcesAdapter(client) {
9863
+ const portAdapter = createRawDamAssetsAdapter(client);
9692
9864
  const cursorByPage = /* @__PURE__ */ new Map();
9693
9865
  return { getFileResources: async (params) => {
9694
9866
  const pageNumber = params?.pageParam ? Number(params.pageParam) : 1;
@@ -9748,47 +9920,66 @@ function mapProductMedia(raw) {
9748
9920
  comments_count: 0
9749
9921
  };
9750
9922
  }
9751
- /**
9752
- * Creates a ShareablesApi["productMedia"]-compatible adapter that bridges
9753
- * the products BFF into the shareables domain. Takes any object satisfying
9754
- * ProductMediaSource (e.g. PortalProductsApi from products-core).
9755
- */
9756
- function createPortalTenantProductMediaShareablesAdapter(source) {
9923
+ function createProductMediaAdapter(source) {
9757
9924
  return { getProductMedia: async (productId) => {
9758
9925
  return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
9759
9926
  } };
9760
9927
  }
9761
- //#endregion
9762
- //#region src/shareables/use-portal-shareables-api.ts
9763
9928
  /**
9764
- * Composes all ShareablesApi adapters from the portal-tenant BFF client.
9765
- * Screens consume this hook instead of importing adapter factories directly.
9929
+ * Creates a composite ContentDomainApi backed by the portal-tenant Content
9930
+ * BFF endpoints. Follows the same pattern as
9931
+ * `createPortalContactsDomainApiAdapter`.
9766
9932
  */
9767
- function usePortalShareablesApi() {
9933
+ function createPortalContentDomainApiAdapter(client, productsApi) {
9934
+ return {
9935
+ media: createMediaAdapter(client),
9936
+ playlists: createPlaylistsAdapter(client),
9937
+ fileResources: createFileResourcesAdapter(client),
9938
+ share: createShareAdapter(client),
9939
+ productMedia: createProductMediaAdapter(productsApi)
9940
+ };
9941
+ }
9942
+ /**
9943
+ * Creates a ContentPlaylistsApi (the port-level playlists adapter) for
9944
+ * operations that aren't part of the shareables PlaylistsApi — e.g.
9945
+ * `deletePlaylist`. Exposed separately because ContentDomainApi.playlists
9946
+ * is the higher-level shareables PlaylistsApi.
9947
+ */
9948
+ function createPortalContentPlaylistsAdapter(client) {
9949
+ return createRawPlaylistsAdapter(client);
9950
+ }
9951
+ //#endregion
9952
+ //#region src/content/PortalContentApiProvider.tsx
9953
+ const ContentContext = createContext(null);
9954
+ function usePortalContentContext() {
9955
+ const ctx = useContext(ContentContext);
9956
+ if (!ctx) throw new Error("usePortalContentContext must be used within a <PortalContentApiProvider>");
9957
+ return ctx;
9958
+ }
9959
+ function PortalContentApiProvider({ children }) {
9768
9960
  const client = usePortalTenantClient();
9769
- const portalProductsApi = usePortalProductsClient();
9770
- const media = useMemo(() => createPortalTenantMediaShareablesAdapter(client), [client]);
9771
- const playlists = useMemo(() => createPortalTenantPlaylistsShareablesAdapter(client), [client]);
9772
- const fileResources = useMemo(() => createPortalTenantFilesShareablesAdapter(client), [client]);
9773
- const share = useMemo(() => createPortalTenantSharesShareablesAdapter(client), [client]);
9774
- const productMedia = useMemo(() => createPortalTenantProductMediaShareablesAdapter(portalProductsApi), [portalProductsApi]);
9775
- return useMemo(() => ({
9776
- media,
9777
- playlists,
9778
- fileResources,
9779
- share,
9780
- productMedia,
9781
- productsApi: portalProductsApi
9961
+ const productsApi = usePortalProductsApi();
9962
+ const contentApi = useMemo(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
9963
+ const playlistsAdapter = useMemo(() => createPortalContentPlaylistsAdapter(client), [client]);
9964
+ const filePickerApi = useMemo(() => createPortalTenantFilePickerApiAdapter(client), [client]);
9965
+ const ctx = useMemo(() => ({
9966
+ productsApi,
9967
+ playlistsAdapter,
9968
+ filePickerApi
9782
9969
  }), [
9783
- media,
9784
- playlists,
9785
- fileResources,
9786
- share,
9787
- productMedia,
9788
- portalProductsApi
9970
+ productsApi,
9971
+ playlistsAdapter,
9972
+ filePickerApi
9789
9973
  ]);
9974
+ return /* @__PURE__ */ jsx(ContentContext.Provider, {
9975
+ value: ctx,
9976
+ children: /* @__PURE__ */ jsx(ShareablesApiProvider, {
9977
+ value: contentApi,
9978
+ children
9979
+ })
9980
+ });
9790
9981
  }
9791
9982
  //#endregion
9792
- export { dam_assets_discard as a, ShareablesApp as c, ShareablesCoreProvider as d, dam_assets_destroy as i, ShareablesUIProvider as l, createPortalTenantPlaylistsAdapter as n, dam_query as o, dam_asset_paths_create as r, ProductsApp as s, usePortalShareablesApi as t, ShareablesApiProvider as u };
9983
+ export { ShareablesUIProvider as a, ShareablesApp as i, usePortalContentContext as n, ShareablesCoreProvider as o, ProductsApp as r, PortalContentApiProvider as t };
9793
9984
 
9794
- //# sourceMappingURL=use-portal-shareables-api-DRK9Y5dp.mjs.map
9985
+ //# sourceMappingURL=PortalContentApiProvider-CW0ADhPi.mjs.map