@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
@@ -6,8 +6,8 @@ const require_dist$3 = require("./dist-thaj08s5.cjs");
6
6
  const require_es = require("./es-xQF-WIMq.cjs");
7
7
  const require_SearchSort = require("./SearchSort-CYhjl8tC.cjs");
8
8
  const require_dist$4 = require("./dist-BSKQ_GoC.cjs");
9
- const require_dist$5 = require("./dist-lO2OG0T5.cjs");
10
- const require_use_portal_products_client = require("./use-portal-products-client-DTkFvOal.cjs");
9
+ const require_dist$5 = require("./dist-BF_4vk1z.cjs");
10
+ const require_PortalProductsApiProvider = require("./PortalProductsApiProvider-BquMHwvt.cjs");
11
11
  let react = require("react");
12
12
  react = require_chunk.__toESM(react);
13
13
  let _tanstack_react_query = require("@tanstack/react-query");
@@ -93,22 +93,7 @@ const shareablesKeys = {
93
93
  //#endregion
94
94
  //#region ../../shareables/core/src/api-context.tsx
95
95
  const ShareablesApiContext = (0, react.createContext)(null);
96
- function ShareablesApiProvider({ media, playlists, fileResources, share, productMedia, children }) {
97
- const value = (0, react.useMemo)(() => ({
98
- media,
99
- playlists,
100
- fileResources,
101
- share,
102
- productMedia: productMedia ?? { getProductMedia: () => {
103
- throw new Error("ProductMediaApi not provided to ShareablesApiProvider");
104
- } }
105
- }), [
106
- media,
107
- playlists,
108
- fileResources,
109
- share,
110
- productMedia
111
- ]);
96
+ function ShareablesApiProvider({ value, children }) {
112
97
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareablesApiContext.Provider, {
113
98
  value,
114
99
  children
@@ -1774,6 +1759,107 @@ const damQueryKeys = {
1774
1759
  ]
1775
1760
  };
1776
1761
  //#endregion
1762
+ //#region ../../file-picker/core/src/schemas/dam.ts
1763
+ const damVariantSchema = zod.z.object({
1764
+ id: zod.z.string(),
1765
+ url: zod.z.string().nullable(),
1766
+ file_name: zod.z.string(),
1767
+ mime_type: zod.z.string(),
1768
+ content: zod.z.any().nullable(),
1769
+ created_at: zod.z.string(),
1770
+ updated_at: zod.z.string(),
1771
+ default: zod.z.boolean(),
1772
+ is_original: zod.z.boolean(),
1773
+ is_text: zod.z.boolean(),
1774
+ media_type: zod.z.string(),
1775
+ processing_status: zod.z.string(),
1776
+ tags: zod.z.array(zod.z.string())
1777
+ });
1778
+ const damAssetSchema = zod.z.object({
1779
+ id: zod.z.number(),
1780
+ canonical_path: zod.z.string(),
1781
+ category: zod.z.string(),
1782
+ code: zod.z.string(),
1783
+ company: zod.z.string(),
1784
+ created_at: zod.z.string(),
1785
+ default_variant_id: zod.z.string(),
1786
+ default_variant_url: zod.z.string().optional(),
1787
+ description: zod.z.string(),
1788
+ name: zod.z.string(),
1789
+ updated_at: zod.z.string(),
1790
+ variants: zod.z.array(damVariantSchema).optional()
1791
+ });
1792
+ const damTreeFolderNodeSchema = zod.z.object({
1793
+ asset_code: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1794
+ name: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1795
+ category: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1796
+ variants: zod.z.union([zod.z.array(zod.z.unknown()), zod.z.record(zod.z.string(), zod.z.unknown())]).optional()
1797
+ }).passthrough();
1798
+ const damTreeSchema = zod.z.record(zod.z.string(), zod.z.union([
1799
+ zod.z.lazy(() => damTreeSchema),
1800
+ damAssetSchema,
1801
+ damTreeFolderNodeSchema
1802
+ ]));
1803
+ const damQueryResponseSchema = zod.z.object({
1804
+ path: zod.z.string(),
1805
+ tree: damTreeSchema,
1806
+ meta: zod.z.object({ next_cursor: zod.z.string().optional() }).optional()
1807
+ });
1808
+ zod.z.object({ asset: zod.z.object({
1809
+ file: zod.z.any(),
1810
+ name: zod.z.string(),
1811
+ description: zod.z.string().optional(),
1812
+ tags: zod.z.string().optional()
1813
+ }) });
1814
+ zod.z.object({
1815
+ asset: damAssetSchema,
1816
+ meta: zod.z.object({
1817
+ request_id: zod.z.string(),
1818
+ timestamp: zod.z.string()
1819
+ })
1820
+ });
1821
+ zod.z.object({
1822
+ placeholder_asset: zod.z.object({
1823
+ mime_type: zod.z.string(),
1824
+ name: zod.z.string().optional(),
1825
+ description: zod.z.string().optional()
1826
+ }),
1827
+ skip_autotagging: zod.z.boolean().optional()
1828
+ });
1829
+ zod.z.object({
1830
+ asset: zod.z.object({
1831
+ file: zod.z.any(),
1832
+ name: zod.z.string(),
1833
+ description: zod.z.string().optional(),
1834
+ tags: zod.z.string().optional()
1835
+ }).optional(),
1836
+ text_asset: zod.z.object({
1837
+ file_name: zod.z.string(),
1838
+ mime_type: zod.z.string(),
1839
+ text: zod.z.string(),
1840
+ name: zod.z.string().optional(),
1841
+ description: zod.z.string().optional(),
1842
+ tags: zod.z.string().optional()
1843
+ }).optional(),
1844
+ placeholder_asset: zod.z.object({
1845
+ mime_type: zod.z.string(),
1846
+ name: zod.z.string().optional(),
1847
+ description: zod.z.string().optional()
1848
+ }).optional(),
1849
+ skip_autotagging: zod.z.boolean().optional()
1850
+ });
1851
+ zod.z.object({
1852
+ asset: zod.z.object({
1853
+ id: zod.z.number(),
1854
+ canonical_path: zod.z.string(),
1855
+ name: zod.z.string()
1856
+ }),
1857
+ meta: zod.z.object({
1858
+ request_id: zod.z.string(),
1859
+ timestamp: zod.z.string()
1860
+ })
1861
+ });
1862
+ //#endregion
1777
1863
  //#region ../../file-picker/core/src/schemas/file-picker-config.ts
1778
1864
  const filePickerConfigSchema = zod.z.object({
1779
1865
  accept: zod.z.array(zod.z.string()).optional(),
@@ -8870,6 +8956,33 @@ function ProductsApp({ countryCode, companyLogoUrl, fetchProducts, fetchProduct,
8870
8956
  });
8871
8957
  }
8872
8958
  //#endregion
8959
+ //#region ../../file-picker/api-client/src/api/url-proxy.ts
8960
+ const urlProxyResponseSchema = zod.z.object({
8961
+ data: zod.z.string(),
8962
+ contentType: zod.z.string(),
8963
+ size: zod.z.number()
8964
+ });
8965
+ /**
8966
+ * Proxy a URL fetch through the backend to bypass CORS restrictions.
8967
+ * The backend fetches the file and returns it as base64-encoded data.
8968
+ *
8969
+ * @param url - The URL to fetch
8970
+ * @param proxyEndpoint - The proxy endpoint (defaults to "/api/proxy-url")
8971
+ */
8972
+ async function proxyUrlFetch(url, proxyEndpoint = "/api/proxy-url") {
8973
+ const response = await fetch(proxyEndpoint, {
8974
+ method: "POST",
8975
+ headers: { "Content-Type": "application/json" },
8976
+ body: JSON.stringify({ url })
8977
+ });
8978
+ if (!response.ok) {
8979
+ const errorData = await response.json().catch(() => ({ error: "Failed to proxy URL fetch" }));
8980
+ throw new Error(errorData.error || `HTTP ${response.status}`);
8981
+ }
8982
+ const data = await response.json();
8983
+ return urlProxyResponseSchema.parse(data);
8984
+ }
8985
+ //#endregion
8873
8986
  //#region ../../api-clients/portal-tenant-content/src/namespaces/portal_tenant_content.ts
8874
8987
  /**
8875
8988
  * List media (own uploads and company media)
@@ -9105,7 +9218,97 @@ async function dam_assets_discard(client, code) {
9105
9218
  return client.patch(`/api/content/dam/assets/${code}/discard`);
9106
9219
  }
9107
9220
  //#endregion
9108
- //#region src/adapters/shareables-api-adapter.ts
9221
+ //#region ../../file-picker/api-client/src/portal-tenant-adapter.ts
9222
+ /**
9223
+ * Maps a BFF DAM asset to the file-picker port's DamAssetCreateResponse shape.
9224
+ *
9225
+ * The BFF response includes nullable meta.request_id (from Api::Response),
9226
+ * while the port schema requires a string. We coalesce to empty string.
9227
+ */
9228
+ function mapCreateResponse(response) {
9229
+ const raw = response.asset ?? {};
9230
+ return {
9231
+ asset: damAssetSchema.parse({
9232
+ ...raw,
9233
+ canonical_path: raw.canonical_path ?? "",
9234
+ category: raw.category ?? "",
9235
+ company: raw.company ?? "",
9236
+ description: raw.description ?? "",
9237
+ default_variant_id: raw.default_variant_id ?? ""
9238
+ }),
9239
+ meta: {
9240
+ request_id: response.meta?.request_id ?? "",
9241
+ timestamp: response.meta?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString()
9242
+ }
9243
+ };
9244
+ }
9245
+ /**
9246
+ * Maps a BFF asset path response to the file-picker port's shape.
9247
+ */
9248
+ function mapAssetPathCreateResponse(response) {
9249
+ const assetPath = response.asset_path ?? {};
9250
+ return {
9251
+ asset: {
9252
+ id: assetPath.id ?? 0,
9253
+ canonical_path: assetPath.path ?? "",
9254
+ name: assetPath.asset_code ?? ""
9255
+ },
9256
+ meta: {
9257
+ request_id: response.meta?.request_id ?? "",
9258
+ timestamp: response.meta?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString()
9259
+ }
9260
+ };
9261
+ }
9262
+ /**
9263
+ * Creates a FilePickerApi adapter backed by the portal-tenant BFF's
9264
+ * `/api/content/dam/*` endpoints, using cookie-based auth via the
9265
+ * provided FetchClient.
9266
+ *
9267
+ * Unsplash search is not available through the BFF — callers that need
9268
+ * Unsplash should use the legacy adapter or provide their own
9269
+ * implementation.
9270
+ *
9271
+ * The `onProgress` callback in `createDamAsset` is not supported — the
9272
+ * underlying `fetch` API does not expose upload progress events.
9273
+ *
9274
+ * URL proxy delegates to the same-origin `/api/proxy-url` endpoint
9275
+ * (served by the hosting app, not the BFF) for CORS bypass, identical
9276
+ * to the legacy adapter behaviour.
9277
+ */
9278
+ function createPortalTenantFilePickerApiAdapter(client) {
9279
+ return {
9280
+ createDamAsset: async (params) => {
9281
+ const formData = new FormData();
9282
+ formData.append("asset[file]", params.file);
9283
+ formData.append("asset[name]", params.name);
9284
+ if (params.description) formData.append("asset[description]", params.description);
9285
+ if (params.tags && params.tags.length > 0) formData.append("asset[tags]", params.tags.join(","));
9286
+ return mapCreateResponse(await client.requestWithFormData("/api/content/dam/assets", formData, { method: "POST" }));
9287
+ },
9288
+ queryDamAssets: async (params) => {
9289
+ const response = await dam_query(client, params);
9290
+ return damQueryResponseSchema.parse({
9291
+ ...response,
9292
+ meta: response.meta ? { next_cursor: response.meta.pagination?.next_cursor ?? void 0 } : void 0
9293
+ });
9294
+ },
9295
+ deleteDamAsset: async (code) => {
9296
+ return dam_assets_destroy(client, code);
9297
+ },
9298
+ discardDamAsset: async (code) => {
9299
+ return dam_assets_discard(client, code);
9300
+ },
9301
+ createDamAssetPathForAssets: async (params) => {
9302
+ return mapAssetPathCreateResponse(await dam_asset_paths_create(client, params.code, { asset_path: { path: params.asset_paths.join(",") } }));
9303
+ },
9304
+ searchUnsplash: async (_query, _page, _perPage) => {
9305
+ 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.");
9306
+ },
9307
+ proxyUrlFetch: (url) => proxyUrlFetch(url)
9308
+ };
9309
+ }
9310
+ //#endregion
9311
+ //#region src/adapters/content-api-adapter.ts
9109
9312
  function mapMedia(raw) {
9110
9313
  return {
9111
9314
  id: raw.id ?? 0,
@@ -9131,10 +9334,7 @@ function mapMediaMeta(raw) {
9131
9334
  } : void 0
9132
9335
  };
9133
9336
  }
9134
- /**
9135
- * Creates a ContentMediaApi adapter backed by the portal-tenant content BFF.
9136
- */
9137
- function createPortalTenantMediaAdapter(client) {
9337
+ function createRawMediaAdapter(client) {
9138
9338
  return {
9139
9339
  listMedia: async (params) => {
9140
9340
  const response = await media_list(client, {
@@ -9230,13 +9430,8 @@ function toBffMediumResponse(bff) {
9230
9430
  created_at: bff.created_at
9231
9431
  };
9232
9432
  }
9233
- /**
9234
- * Creates a ShareablesApi["media"]-compatible adapter backed by the
9235
- * portal-tenant content BFF. Includes cursor-to-page-number caching
9236
- * for bridging the legacy UI's page-number pagination.
9237
- */
9238
- function createPortalTenantMediaShareablesAdapter(client) {
9239
- const portAdapter = createPortalTenantMediaAdapter(client);
9433
+ function createMediaAdapter(client) {
9434
+ const portAdapter = createRawMediaAdapter(client);
9240
9435
  const cursorByPage = /* @__PURE__ */ new Map();
9241
9436
  let lastFilterKey = "";
9242
9437
  return {
@@ -9342,10 +9537,7 @@ function mapPlaylistsMeta(raw) {
9342
9537
  } : void 0
9343
9538
  };
9344
9539
  }
9345
- /**
9346
- * Creates a ContentPlaylistsApi adapter backed by the portal-tenant content BFF.
9347
- */
9348
- function createPortalTenantPlaylistsAdapter(client) {
9540
+ function createRawPlaylistsAdapter(client) {
9349
9541
  return {
9350
9542
  listPlaylists: async (params) => {
9351
9543
  const response = await playlists_list(client, {
@@ -9427,13 +9619,8 @@ function toBffPlaylist(bff, items) {
9427
9619
  items_count: bff.items_count
9428
9620
  };
9429
9621
  }
9430
- /**
9431
- * Creates a ShareablesApi["playlists"]-compatible adapter backed by the
9432
- * portal-tenant content BFF. Fetches playlist + items in parallel for
9433
- * detail views and maps enriched flat fields onto playlist items.
9434
- */
9435
- function createPortalTenantPlaylistsShareablesAdapter(client) {
9436
- const portAdapter = createPortalTenantPlaylistsAdapter(client);
9622
+ function createPlaylistsAdapter(client) {
9623
+ const portAdapter = createRawPlaylistsAdapter(client);
9437
9624
  return {
9438
9625
  getPlaylists: async (options) => {
9439
9626
  const rawSort = options?.sort;
@@ -9561,10 +9748,7 @@ function mapSharesMeta(raw) {
9561
9748
  } : void 0
9562
9749
  };
9563
9750
  }
9564
- /**
9565
- * Creates a ContentSharesApi adapter backed by the portal-tenant content BFF.
9566
- */
9567
- function createPortalTenantSharesAdapter(client) {
9751
+ function createRawSharesAdapter(client) {
9568
9752
  return {
9569
9753
  listShares: async (params) => {
9570
9754
  const response = await shares_list(client, {
@@ -9595,12 +9779,8 @@ const SHAREABLE_TYPE_MAP = {
9595
9779
  Page: "page",
9596
9780
  page: "page"
9597
9781
  };
9598
- /**
9599
- * Creates a ShareablesApi["share"]-compatible adapter backed by the
9600
- * portal-tenant content BFF. Maps legacy model names to BFF shareable types.
9601
- */
9602
- function createPortalTenantSharesShareablesAdapter(client) {
9603
- const portAdapter = createPortalTenantSharesAdapter(client);
9782
+ function createShareAdapter(client) {
9783
+ const portAdapter = createRawSharesAdapter(client);
9604
9784
  return { createShareLink: async (input) => {
9605
9785
  if (!input.relateableId) throw new Error("Cannot create share link without a relateableId");
9606
9786
  const shareableType = SHAREABLE_TYPE_MAP[input.relateableType];
@@ -9646,10 +9826,7 @@ function mapDamAssetsMeta(raw) {
9646
9826
  } : void 0
9647
9827
  };
9648
9828
  }
9649
- /**
9650
- * Creates a ContentDamAssetsApi adapter backed by the portal-tenant content BFF.
9651
- */
9652
- function createPortalTenantDamAssetsAdapter(client) {
9829
+ function createRawDamAssetsAdapter(client) {
9653
9830
  return {
9654
9831
  listAssets: async (params) => {
9655
9832
  const response = await dam_assets_list(client, {
@@ -9687,13 +9864,8 @@ function createPortalTenantDamAssetsAdapter(client) {
9687
9864
  }
9688
9865
  };
9689
9866
  }
9690
- /**
9691
- * Creates a ShareablesApi["fileResources"]-compatible adapter backed by the
9692
- * portal-tenant content BFF. Maps DamAsset to FileResource shape and
9693
- * includes cursor-to-page-number caching for legacy UI pagination.
9694
- */
9695
- function createPortalTenantFilesShareablesAdapter(client) {
9696
- const portAdapter = createPortalTenantDamAssetsAdapter(client);
9867
+ function createFileResourcesAdapter(client) {
9868
+ const portAdapter = createRawDamAssetsAdapter(client);
9697
9869
  const cursorByPage = /* @__PURE__ */ new Map();
9698
9870
  return { getFileResources: async (params) => {
9699
9871
  const pageNumber = params?.pageParam ? Number(params.pageParam) : 1;
@@ -9753,57 +9925,76 @@ function mapProductMedia(raw) {
9753
9925
  comments_count: 0
9754
9926
  };
9755
9927
  }
9756
- /**
9757
- * Creates a ShareablesApi["productMedia"]-compatible adapter that bridges
9758
- * the products BFF into the shareables domain. Takes any object satisfying
9759
- * ProductMediaSource (e.g. PortalProductsApi from products-core).
9760
- */
9761
- function createPortalTenantProductMediaShareablesAdapter(source) {
9928
+ function createProductMediaAdapter(source) {
9762
9929
  return { getProductMedia: async (productId) => {
9763
9930
  return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
9764
9931
  } };
9765
9932
  }
9766
- //#endregion
9767
- //#region src/shareables/use-portal-shareables-api.ts
9768
9933
  /**
9769
- * Composes all ShareablesApi adapters from the portal-tenant BFF client.
9770
- * Screens consume this hook instead of importing adapter factories directly.
9934
+ * Creates a composite ContentDomainApi backed by the portal-tenant Content
9935
+ * BFF endpoints. Follows the same pattern as
9936
+ * `createPortalContactsDomainApiAdapter`.
9771
9937
  */
9772
- function usePortalShareablesApi() {
9938
+ function createPortalContentDomainApiAdapter(client, productsApi) {
9939
+ return {
9940
+ media: createMediaAdapter(client),
9941
+ playlists: createPlaylistsAdapter(client),
9942
+ fileResources: createFileResourcesAdapter(client),
9943
+ share: createShareAdapter(client),
9944
+ productMedia: createProductMediaAdapter(productsApi)
9945
+ };
9946
+ }
9947
+ /**
9948
+ * Creates a ContentPlaylistsApi (the port-level playlists adapter) for
9949
+ * operations that aren't part of the shareables PlaylistsApi — e.g.
9950
+ * `deletePlaylist`. Exposed separately because ContentDomainApi.playlists
9951
+ * is the higher-level shareables PlaylistsApi.
9952
+ */
9953
+ function createPortalContentPlaylistsAdapter(client) {
9954
+ return createRawPlaylistsAdapter(client);
9955
+ }
9956
+ //#endregion
9957
+ //#region src/content/PortalContentApiProvider.tsx
9958
+ const ContentContext = (0, react.createContext)(null);
9959
+ function usePortalContentContext() {
9960
+ const ctx = (0, react.useContext)(ContentContext);
9961
+ if (!ctx) throw new Error("usePortalContentContext must be used within a <PortalContentApiProvider>");
9962
+ return ctx;
9963
+ }
9964
+ function PortalContentApiProvider({ children }) {
9773
9965
  const client = require_PortalTenantClientProvider.usePortalTenantClient();
9774
- const portalProductsApi = require_use_portal_products_client.usePortalProductsClient();
9775
- const media = (0, react.useMemo)(() => createPortalTenantMediaShareablesAdapter(client), [client]);
9776
- const playlists = (0, react.useMemo)(() => createPortalTenantPlaylistsShareablesAdapter(client), [client]);
9777
- const fileResources = (0, react.useMemo)(() => createPortalTenantFilesShareablesAdapter(client), [client]);
9778
- const share = (0, react.useMemo)(() => createPortalTenantSharesShareablesAdapter(client), [client]);
9779
- const productMedia = (0, react.useMemo)(() => createPortalTenantProductMediaShareablesAdapter(portalProductsApi), [portalProductsApi]);
9780
- return (0, react.useMemo)(() => ({
9781
- media,
9782
- playlists,
9783
- fileResources,
9784
- share,
9785
- productMedia,
9786
- productsApi: portalProductsApi
9966
+ const productsApi = require_PortalProductsApiProvider.usePortalProductsApi();
9967
+ const contentApi = (0, react.useMemo)(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
9968
+ const playlistsAdapter = (0, react.useMemo)(() => createPortalContentPlaylistsAdapter(client), [client]);
9969
+ const filePickerApi = (0, react.useMemo)(() => createPortalTenantFilePickerApiAdapter(client), [client]);
9970
+ const ctx = (0, react.useMemo)(() => ({
9971
+ productsApi,
9972
+ playlistsAdapter,
9973
+ filePickerApi
9787
9974
  }), [
9788
- media,
9789
- playlists,
9790
- fileResources,
9791
- share,
9792
- productMedia,
9793
- portalProductsApi
9975
+ productsApi,
9976
+ playlistsAdapter,
9977
+ filePickerApi
9794
9978
  ]);
9979
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentContext.Provider, {
9980
+ value: ctx,
9981
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareablesApiProvider, {
9982
+ value: contentApi,
9983
+ children
9984
+ })
9985
+ });
9795
9986
  }
9796
9987
  //#endregion
9797
- Object.defineProperty(exports, "ProductsApp", {
9988
+ Object.defineProperty(exports, "PortalContentApiProvider", {
9798
9989
  enumerable: true,
9799
9990
  get: function() {
9800
- return ProductsApp;
9991
+ return PortalContentApiProvider;
9801
9992
  }
9802
9993
  });
9803
- Object.defineProperty(exports, "ShareablesApiProvider", {
9994
+ Object.defineProperty(exports, "ProductsApp", {
9804
9995
  enumerable: true,
9805
9996
  get: function() {
9806
- return ShareablesApiProvider;
9997
+ return ProductsApp;
9807
9998
  }
9808
9999
  });
9809
10000
  Object.defineProperty(exports, "ShareablesApp", {
@@ -9824,41 +10015,11 @@ Object.defineProperty(exports, "ShareablesUIProvider", {
9824
10015
  return ShareablesUIProvider;
9825
10016
  }
9826
10017
  });
9827
- Object.defineProperty(exports, "createPortalTenantPlaylistsAdapter", {
9828
- enumerable: true,
9829
- get: function() {
9830
- return createPortalTenantPlaylistsAdapter;
9831
- }
9832
- });
9833
- Object.defineProperty(exports, "dam_asset_paths_create", {
9834
- enumerable: true,
9835
- get: function() {
9836
- return dam_asset_paths_create;
9837
- }
9838
- });
9839
- Object.defineProperty(exports, "dam_assets_destroy", {
9840
- enumerable: true,
9841
- get: function() {
9842
- return dam_assets_destroy;
9843
- }
9844
- });
9845
- Object.defineProperty(exports, "dam_assets_discard", {
9846
- enumerable: true,
9847
- get: function() {
9848
- return dam_assets_discard;
9849
- }
9850
- });
9851
- Object.defineProperty(exports, "dam_query", {
9852
- enumerable: true,
9853
- get: function() {
9854
- return dam_query;
9855
- }
9856
- });
9857
- Object.defineProperty(exports, "usePortalShareablesApi", {
10018
+ Object.defineProperty(exports, "usePortalContentContext", {
9858
10019
  enumerable: true,
9859
10020
  get: function() {
9860
- return usePortalShareablesApi;
10021
+ return usePortalContentContext;
9861
10022
  }
9862
10023
  });
9863
10024
 
9864
- //# sourceMappingURL=use-portal-shareables-api-DcjYlAOy.cjs.map
10025
+ //# sourceMappingURL=PortalContentApiProvider-Di5emtYd.cjs.map