@fluid-app/portal-sdk 0.1.182 → 0.1.183

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 (47) hide show
  1. package/dist/{FluidProvider-B1XBDYlq.cjs → FluidProvider-CX2WZMLJ.cjs} +2 -2
  2. package/dist/{FluidProvider-B1XBDYlq.cjs.map → FluidProvider-CX2WZMLJ.cjs.map} +1 -1
  3. package/dist/{FluidProvider-B15cV2Xo.mjs → FluidProvider-CxTAbzER.mjs} +2 -2
  4. package/dist/{FluidProvider-B15cV2Xo.mjs.map → FluidProvider-CxTAbzER.mjs.map} +1 -1
  5. package/dist/{MessagingScreen-DcAX3uhm.mjs → MessagingScreen-DGB7agVV.mjs} +2 -2
  6. package/dist/{MessagingScreen-DcAX3uhm.mjs.map → MessagingScreen-DGB7agVV.mjs.map} +1 -1
  7. package/dist/{MessagingScreen-DIwJdXze.cjs → MessagingScreen-R9yqOP_e.cjs} +2 -2
  8. package/dist/{MessagingScreen-BTtr7ziP.cjs → MessagingScreen-hdB0BzpO.cjs} +2 -2
  9. package/dist/{MessagingScreen-BTtr7ziP.cjs.map → MessagingScreen-hdB0BzpO.cjs.map} +1 -1
  10. package/dist/{PortalContentApiProvider--tsJ7o74.mjs → PortalContentApiProvider-C5BcaBSL.mjs} +147 -26
  11. package/dist/PortalContentApiProvider-C5BcaBSL.mjs.map +1 -0
  12. package/dist/{PortalContentApiProvider-DyC6LEke.cjs → PortalContentApiProvider-eSOgc4Nv.cjs} +147 -26
  13. package/dist/{PortalContentApiProvider-DyC6LEke.cjs.map → PortalContentApiProvider-eSOgc4Nv.cjs.map} +1 -1
  14. package/dist/{ProductsScreen-Qk1zKT-D.cjs → ProductsScreen-C2mx-086.cjs} +2 -2
  15. package/dist/{ProductsScreen-S45XRFan.mjs → ProductsScreen-CIT--Mnq.mjs} +2 -2
  16. package/dist/{ProductsScreen-BjpSL8H8.cjs → ProductsScreen-CJPwyXvT.cjs} +2 -2
  17. package/dist/{ProductsScreen-BjpSL8H8.cjs.map → ProductsScreen-CJPwyXvT.cjs.map} +1 -1
  18. package/dist/{ProductsScreen-C80r2yNT.mjs → ProductsScreen-P4n3OFln.mjs} +2 -2
  19. package/dist/{ProductsScreen-C80r2yNT.mjs.map → ProductsScreen-P4n3OFln.mjs.map} +1 -1
  20. package/dist/{ProfileScreen-D6iQX-sL.cjs → ProfileScreen-CpQ5GpTs.cjs} +2 -2
  21. package/dist/{ProfileScreen-D6iQX-sL.cjs.map → ProfileScreen-CpQ5GpTs.cjs.map} +1 -1
  22. package/dist/{ProfileScreen-CEwrC2f4.cjs → ProfileScreen-D0CUvLHq.cjs} +2 -2
  23. package/dist/{ProfileScreen-CBnQqqsI.mjs → ProfileScreen-DzhxfhqL.mjs} +2 -2
  24. package/dist/{ProfileScreen-CBnQqqsI.mjs.map → ProfileScreen-DzhxfhqL.mjs.map} +1 -1
  25. package/dist/{ShareablesScreen-DBkDODzX.mjs → ShareablesScreen-BII-fIRD.mjs} +27 -22
  26. package/dist/ShareablesScreen-BII-fIRD.mjs.map +1 -0
  27. package/dist/{ShareablesScreen-BBxez962.mjs → ShareablesScreen-BLNcb2M-.mjs} +2 -3
  28. package/dist/{ShareablesScreen-DplgNCYs.cjs → ShareablesScreen-CBrJ8Vzm.cjs} +27 -22
  29. package/dist/ShareablesScreen-CBrJ8Vzm.cjs.map +1 -0
  30. package/dist/{ShareablesScreen-38fg84um.cjs → ShareablesScreen-C_KC7Ey1.cjs} +2 -3
  31. package/dist/{ShopScreen-DQPEIpru.mjs → ShopScreen-1k9PZ8qQ.mjs} +2 -2
  32. package/dist/{ShopScreen-DQPEIpru.mjs.map → ShopScreen-1k9PZ8qQ.mjs.map} +1 -1
  33. package/dist/{ShopScreen-r2i_ELGi.cjs → ShopScreen-B9EmEprQ.cjs} +2 -2
  34. package/dist/{ShopScreen-Cka6dqGQ.cjs → ShopScreen-BkwsMZ6V.cjs} +2 -2
  35. package/dist/{ShopScreen-Cka6dqGQ.cjs.map → ShopScreen-BkwsMZ6V.cjs.map} +1 -1
  36. package/dist/index.cjs +17 -17
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +17 -17
  40. package/dist/{portal_tenant_content-DSG9lqzg.mjs → portal_tenant_content-DgM42X08.mjs} +35 -2
  41. package/dist/{portal_tenant_content-DSG9lqzg.mjs.map → portal_tenant_content-DgM42X08.mjs.map} +1 -1
  42. package/dist/{portal_tenant_content-ONX_dSEw.cjs → portal_tenant_content-Dwmo8XZ-.cjs} +52 -1
  43. package/dist/{portal_tenant_content-ONX_dSEw.cjs.map → portal_tenant_content-Dwmo8XZ-.cjs.map} +1 -1
  44. package/package.json +15 -15
  45. package/dist/PortalContentApiProvider--tsJ7o74.mjs.map +0 -1
  46. package/dist/ShareablesScreen-DBkDODzX.mjs.map +0 -1
  47. package/dist/ShareablesScreen-DplgNCYs.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-9hOWP6kD.cjs");
2
- const require_portal_tenant_content = require("./portal_tenant_content-ONX_dSEw.cjs");
2
+ const require_portal_tenant_content = require("./portal_tenant_content-Dwmo8XZ-.cjs");
3
3
  const require_PortalTenantClientProvider = require("./PortalTenantClientProvider-CVv-4rQ9.cjs");
4
4
  const require_src = require("./src-CvtwdzKm.cjs");
5
5
  const require_ScreenHeaderContext = require("./ScreenHeaderContext-B06T9svT.cjs");
@@ -9083,10 +9083,25 @@ function mapMedia(raw) {
9083
9083
  id: raw.id ?? 0,
9084
9084
  title: raw.title ?? "",
9085
9085
  description: raw.description ?? null,
9086
- media_type: raw.content_format ?? "",
9086
+ content_format: raw.content_format ?? null,
9087
+ status: raw.status ?? "active",
9087
9088
  url: raw.url ?? null,
9088
9089
  thumbnail_url: raw.thumbnail_url ?? null,
9089
9090
  owner_type: raw.owner_type ?? "",
9091
+ cta: raw.cta ? {
9092
+ enabled: raw.cta.enabled ?? null,
9093
+ type: raw.cta.type ?? null,
9094
+ button_text: raw.cta.button_text ?? null,
9095
+ button_color: raw.cta.button_color ?? null,
9096
+ button_description: raw.cta.button_description ?? null,
9097
+ action_url: raw.cta.action_url ?? null
9098
+ } : null,
9099
+ seo: raw.seo ? {
9100
+ title: raw.seo.title ?? null,
9101
+ description: raw.seo.description ?? null,
9102
+ image_url: raw.seo.image_url ?? null,
9103
+ block_crawler: raw.seo.block_crawler ?? null
9104
+ } : null,
9090
9105
  created_at: raw.created_at ?? "",
9091
9106
  updated_at: raw.updated_at ?? ""
9092
9107
  };
@@ -9147,6 +9162,60 @@ function createRawMediaAdapter(client) {
9147
9162
  }
9148
9163
  };
9149
9164
  }
9165
+ /**
9166
+ * Creates a ContentMediaProductsApi adapter backed by the portal-tenant content BFF.
9167
+ */
9168
+ function createPortalTenantMediaProductsAdapter(client) {
9169
+ return {
9170
+ listMediaProducts: async (mediumId, params) => {
9171
+ const response = await require_portal_tenant_content.media_products_list(client, mediumId, {
9172
+ "page[cursor]": params?.cursor,
9173
+ "page[limit]": params?.limit
9174
+ });
9175
+ return {
9176
+ media_products: (response.media_products ?? []).map((p) => ({
9177
+ id: p.id ?? 0,
9178
+ name: p.name,
9179
+ slug: p.slug ?? null,
9180
+ image_url: p.image_url ?? null,
9181
+ price: p.price ?? null,
9182
+ currency: p.currency ?? null,
9183
+ added_at: p.added_at ?? null
9184
+ })),
9185
+ meta: mapMediaMeta(response.meta)
9186
+ };
9187
+ },
9188
+ addMediaProduct: async (mediumId, body) => {
9189
+ const response = await require_portal_tenant_content.media_products_add(client, mediumId, { product: { id: body.id } });
9190
+ const p = response.media_product ?? {};
9191
+ return {
9192
+ media_product: {
9193
+ id: p.id ?? 0,
9194
+ name: p.name,
9195
+ slug: p.slug ?? null,
9196
+ image_url: p.image_url ?? null,
9197
+ price: p.price ?? null,
9198
+ currency: p.currency ?? null,
9199
+ added_at: p.added_at ?? null
9200
+ },
9201
+ meta: {
9202
+ request_id: response.meta?.request_id ?? null,
9203
+ timestamp: response.meta?.timestamp ?? ""
9204
+ }
9205
+ };
9206
+ },
9207
+ removeMediaProduct: async (mediumId, productId) => {
9208
+ const response = await require_portal_tenant_content.media_products_remove(client, mediumId, productId);
9209
+ return {
9210
+ media_product: { product_id: response.media_product?.product_id ?? 0 },
9211
+ meta: {
9212
+ request_id: response.meta?.request_id ?? null,
9213
+ timestamp: response.meta?.timestamp ?? ""
9214
+ }
9215
+ };
9216
+ }
9217
+ };
9218
+ }
9150
9219
  function mediaKindFromType(mediaType) {
9151
9220
  if (mediaType === "video") return "video";
9152
9221
  if (mediaType === "image") return "image";
@@ -9154,14 +9223,17 @@ function mediaKindFromType(mediaType) {
9154
9223
  return null;
9155
9224
  }
9156
9225
  function toBffMediumResponse(bff) {
9157
- const kind = mediaKindFromType(bff.media_type);
9158
- const isVideo = bff.media_type === "video";
9159
- const isPdf = bff.media_type === "pdf" || bff.media_type === "document";
9226
+ const kind = bff.content_format ?? null;
9227
+ const isVideo = kind === "video";
9228
+ const isPdf = kind === "pdf";
9229
+ const ctaData = bff.cta;
9230
+ const seoData = bff.seo;
9160
9231
  return {
9161
9232
  id: bff.id,
9162
9233
  user_id: null,
9163
- media_type: bff.media_type,
9164
- media_format: bff.media_type,
9234
+ owner_type: bff.owner_type ?? null,
9235
+ media_type: bff.content_format ?? "image",
9236
+ media_format: bff.content_format ?? "image",
9165
9237
  image_url: !isVideo && !isPdf ? bff.url ?? bff.thumbnail_url ?? null : bff.thumbnail_url ?? null,
9166
9238
  video_url: isVideo ? bff.url ?? null : null,
9167
9239
  pdf_url: isPdf ? bff.url ?? null : null,
@@ -9178,7 +9250,7 @@ function toBffMediumResponse(bff) {
9178
9250
  },
9179
9251
  stripped: bff.description ?? null,
9180
9252
  kind,
9181
- active: true,
9253
+ active: bff.status === "active",
9182
9254
  visibility: null,
9183
9255
  share_link: null,
9184
9256
  views: 0,
@@ -9186,16 +9258,32 @@ function toBffMediumResponse(bff) {
9186
9258
  watch: null,
9187
9259
  video_status: null,
9188
9260
  duration: null,
9189
- cta_url: null,
9190
- cta_button_text: null,
9191
- cta_enabled: false,
9192
- cta_action_type: null,
9261
+ cta_url: ctaData?.action_url ?? null,
9262
+ cta_button_text: ctaData?.button_text ?? null,
9263
+ cta_enabled: ctaData?.enabled ?? false,
9264
+ cta_action_type: ctaData?.type ?? null,
9193
9265
  video_shopping_enabled: false,
9194
9266
  prompts_enabled: false,
9195
9267
  ranks: [],
9196
9268
  preview_link: null,
9197
9269
  attached_shareables: [],
9198
- created_at: bff.created_at
9270
+ created_at: bff.created_at,
9271
+ settings: {
9272
+ cta: ctaData ? {
9273
+ enabled: ctaData.enabled ?? void 0,
9274
+ type: ctaData.type ?? void 0,
9275
+ url: ctaData.action_url ?? void 0,
9276
+ button_text: ctaData.button_text ?? void 0,
9277
+ button_color: ctaData.button_color ?? void 0,
9278
+ button_description: ctaData.button_description ?? void 0
9279
+ } : null,
9280
+ seo: seoData ? {
9281
+ title: seoData.title ?? void 0,
9282
+ description: seoData.description ?? void 0,
9283
+ image_url: seoData.image_url ?? void 0,
9284
+ block_crawler: seoData.block_crawler ?? void 0
9285
+ } : null
9286
+ }
9199
9287
  };
9200
9288
  }
9201
9289
  function createMediaAdapter(client) {
@@ -9205,7 +9293,7 @@ function createMediaAdapter(client) {
9205
9293
  return {
9206
9294
  getMedia: async (options) => {
9207
9295
  const pageNumber = options?.page ?? 1;
9208
- const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}|${options?.media_type ?? options?.with_type ?? ""}`;
9296
+ const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}`;
9209
9297
  if (filterKey !== lastFilterKey) {
9210
9298
  cursorByPage.clear();
9211
9299
  lastFilterKey = filterKey;
@@ -9218,7 +9306,6 @@ function createMediaAdapter(client) {
9218
9306
  const response = await portAdapter.listMedia({
9219
9307
  cursor,
9220
9308
  limit: options?.per_page,
9221
- media_type: options?.media_type ?? options?.with_type,
9222
9309
  "filter[title]": options?.search_query,
9223
9310
  sort: bffSort
9224
9311
  });
@@ -9248,18 +9335,44 @@ function createMediaAdapter(client) {
9248
9335
  };
9249
9336
  },
9250
9337
  createMedia: async (mediaData) => {
9338
+ const contentFormat = mediaData.kind === "image" || mediaData.kind === "video" || mediaData.kind === "pdf" || mediaData.kind === "ppt" || mediaData.kind === "link" ? mediaData.kind : void 0;
9251
9339
  return toBffMediumResponse((await portAdapter.createMedia({
9252
9340
  title: mediaData.title ?? "",
9253
9341
  description: mediaData.description,
9254
9342
  media_type: mediaData.media_type ?? "image",
9255
- url: mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0
9343
+ url: mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0,
9344
+ content_format: contentFormat
9256
9345
  })).media);
9257
9346
  },
9258
9347
  updateMedia: async (id, mediaData) => {
9259
- return toBffMediumResponse((await portAdapter.updateMedia(id, {
9348
+ const updateBody = {
9260
9349
  title: mediaData.title,
9261
9350
  description: mediaData.description
9262
- })).media);
9351
+ };
9352
+ if (mediaData.active !== void 0) updateBody.status = mediaData.active ? "active" : "draft";
9353
+ const newUrl = mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0;
9354
+ if (newUrl !== void 0) updateBody.url = newUrl;
9355
+ if (mediaData.kind === "image" || mediaData.kind === "video" || mediaData.kind === "pdf" || mediaData.kind === "ppt" || mediaData.kind === "link") updateBody.content_format = mediaData.kind;
9356
+ if (mediaData.thumbnail_url !== void 0) updateBody.thumbnail_url = mediaData.thumbnail_url;
9357
+ if (mediaData.settings?.cta) {
9358
+ const rawType = mediaData.settings.cta.type;
9359
+ const ctaType = rawType === "link" || rawType === "cart" || rawType === "email" || rawType === "phone" ? rawType : void 0;
9360
+ updateBody.cta = {
9361
+ enabled: mediaData.settings.cta.enabled,
9362
+ type: ctaType,
9363
+ button_text: mediaData.settings.cta.button_text,
9364
+ button_color: mediaData.settings.cta.button_color,
9365
+ button_description: mediaData.settings.cta.button_description,
9366
+ action_url: mediaData.settings.cta.url
9367
+ };
9368
+ }
9369
+ if (mediaData.settings?.seo) updateBody.seo = {
9370
+ title: mediaData.settings.seo.title,
9371
+ description: mediaData.settings.seo.description,
9372
+ image_url: mediaData.settings.seo.image_url,
9373
+ block_crawler: mediaData.settings.seo.block_crawler ?? void 0
9374
+ };
9375
+ return toBffMediumResponse((await portAdapter.updateMedia(id, updateBody)).media);
9263
9376
  },
9264
9377
  deleteMedia: async (id) => {
9265
9378
  await portAdapter.deleteMedia(id);
@@ -9273,7 +9386,7 @@ function mapPlaylist(raw) {
9273
9386
  title: raw.title ?? "",
9274
9387
  description: raw.description ?? null,
9275
9388
  items_count: raw.items_count ?? 0,
9276
- user_id: raw.user_id ?? void 0,
9389
+ user_id: raw.user_id,
9277
9390
  is_favorited: raw.is_favorited,
9278
9391
  image_url: raw.image_url ?? null,
9279
9392
  created_at: raw.created_at ?? "",
@@ -9698,12 +9811,6 @@ function createProductMediaAdapter(source) {
9698
9811
  return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
9699
9812
  } };
9700
9813
  }
9701
- async function toggleFavorite(client, favoriteableId, favoriteableType) {
9702
- return { is_favorited: (await client.post("/api/content/favorites/toggle", {
9703
- favoriteable_id: favoriteableId,
9704
- favoriteable_type: favoriteableType
9705
- })).favorite?.is_favorited ?? false };
9706
- }
9707
9814
  /**
9708
9815
  * Creates a composite ContentDomainApi backed by the portal-tenant Content
9709
9816
  * BFF endpoints. Follows the same pattern as
@@ -9727,6 +9834,17 @@ function createPortalContentDomainApiAdapter(client, productsApi) {
9727
9834
  function createPortalContentPlaylistsAdapter(client) {
9728
9835
  return createRawPlaylistsAdapter(client);
9729
9836
  }
9837
+ /**
9838
+ * Toggles a favorite entry on a given shareable (Medium / Playlist /
9839
+ * Product / etc.) via the portal-tenant BFF's /favorites/toggle endpoint.
9840
+ * Returns the new is_favorited state reported by the backend.
9841
+ */
9842
+ async function toggleFavorite(client, favoriteableId, favoriteableType) {
9843
+ return { is_favorited: (await client.post("/api/content/favorites/toggle", {
9844
+ favoriteable_id: favoriteableId,
9845
+ favoriteable_type: favoriteableType
9846
+ })).favorite?.is_favorited ?? false };
9847
+ }
9730
9848
  //#endregion
9731
9849
  //#region src/content/PortalContentApiProvider.tsx
9732
9850
  const ContentContext = (0, react.createContext)(null);
@@ -9749,14 +9867,17 @@ function PortalContentApiProvider({ children }) {
9749
9867
  const productsApi = require_PortalProductsApiProvider.usePortalProductsApi();
9750
9868
  const contentApi = (0, react.useMemo)(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
9751
9869
  const playlistsAdapter = (0, react.useMemo)(() => createPortalContentPlaylistsAdapter(client), [client]);
9870
+ const mediaProductsAdapter = (0, react.useMemo)(() => createPortalTenantMediaProductsAdapter(client), [client]);
9752
9871
  const filePickerApi = (0, react.useMemo)(() => createFilePickerApiAdapter(client), [client]);
9753
9872
  const ctx = (0, react.useMemo)(() => ({
9754
9873
  productsApi,
9755
9874
  playlistsAdapter,
9875
+ mediaProductsAdapter,
9756
9876
  filePickerApi
9757
9877
  }), [
9758
9878
  productsApi,
9759
9879
  playlistsAdapter,
9880
+ mediaProductsAdapter,
9760
9881
  filePickerApi
9761
9882
  ]);
9762
9883
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentContext.Provider, {
@@ -9811,4 +9932,4 @@ Object.defineProperty(exports, "usePortalContentContext", {
9811
9932
  }
9812
9933
  });
9813
9934
 
9814
- //# sourceMappingURL=PortalContentApiProvider-DyC6LEke.cjs.map
9935
+ //# sourceMappingURL=PortalContentApiProvider-eSOgc4Nv.cjs.map