@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
  import { t as useDropzone } from "./es-I9usCQT-.mjs";
2
- import { C as shares_list, S as shares_create, _ as playlists_items_list, a as dam_assets_discard, b as playlists_show, c as media_create, d as media_show, f as media_update, g as playlists_items_add, h as playlists_destroy, i as dam_assets_destroy, l as media_destroy, m as playlists_create, n as dam_asset_paths_list, o as dam_assets_list, r as dam_assets_create, s as dam_query, t as dam_asset_paths_create, u as media_list, v as playlists_items_remove, x as playlists_update, y as playlists_list } from "./portal_tenant_content-DSG9lqzg.mjs";
2
+ import { C as playlists_show, E as shares_list, S as playlists_list, T as shares_create, _ as playlists_create, a as dam_assets_discard, b as playlists_items_list, c as media_create, d as media_products_add, f as media_products_list, h as media_update, i as dam_assets_destroy, l as media_destroy, m as media_show, n as dam_asset_paths_list, o as dam_assets_list, p as media_products_remove, r as dam_assets_create, s as dam_query, t as dam_asset_paths_create, u as media_list, v as playlists_destroy, w as playlists_update, x as playlists_items_remove, y as playlists_items_add } from "./portal_tenant_content-DgM42X08.mjs";
3
3
  import { n as usePortalTenantClient } from "./PortalTenantClientProvider-4ZmY6hac.mjs";
4
4
  import { $ as DropdownMenuSubTrigger, A as SelectTrigger, B as FormItem, Ct as CardContent, D as Select, Dt as Checkbox, E as Separator, G as DropdownMenuContent, H as FormMessage, Jt as BreadcrumbLink, K as DropdownMenuItem, Kt as Breadcrumb, L as Form, O as SelectContent, P as Input, Q as DropdownMenuSubContent, Qt as Badge, R as FormControl, U as Label, V as FormLabel, W as DropdownMenu, X as DropdownMenuSeparator, Xt as BreadcrumbPage, Yt as BreadcrumbList, Z as DropdownMenuSub, Zt as BreadcrumbSeparator, _n as useZodForm, at as DialogFooter, b as Skeleton, ct as DialogPortal, dn as Content, dt as PopoverContent, et as DropdownMenuTrigger, ft as PopoverTrigger, g as Spinner, i as TooltipTrigger, it as DialogDescription, j as SelectValue, k as SelectItem, lt as DialogTitle, m as Switch, n as TooltipContent, ot as DialogHeader, qt as BreadcrumbItem, r as TooltipProvider, rt as DialogContent, st as DialogOverlay, t as Tooltip, tt as Dialog, un as Button, ut as Popover, vn as cn, xt as Card, y as Slider, z as FormField } from "./src-BZbWkXOU.mjs";
5
5
  import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-FYyYk97y.mjs";
@@ -9078,10 +9078,25 @@ function mapMedia(raw) {
9078
9078
  id: raw.id ?? 0,
9079
9079
  title: raw.title ?? "",
9080
9080
  description: raw.description ?? null,
9081
- media_type: raw.content_format ?? "",
9081
+ content_format: raw.content_format ?? null,
9082
+ status: raw.status ?? "active",
9082
9083
  url: raw.url ?? null,
9083
9084
  thumbnail_url: raw.thumbnail_url ?? null,
9084
9085
  owner_type: raw.owner_type ?? "",
9086
+ cta: raw.cta ? {
9087
+ enabled: raw.cta.enabled ?? null,
9088
+ type: raw.cta.type ?? null,
9089
+ button_text: raw.cta.button_text ?? null,
9090
+ button_color: raw.cta.button_color ?? null,
9091
+ button_description: raw.cta.button_description ?? null,
9092
+ action_url: raw.cta.action_url ?? null
9093
+ } : null,
9094
+ seo: raw.seo ? {
9095
+ title: raw.seo.title ?? null,
9096
+ description: raw.seo.description ?? null,
9097
+ image_url: raw.seo.image_url ?? null,
9098
+ block_crawler: raw.seo.block_crawler ?? null
9099
+ } : null,
9085
9100
  created_at: raw.created_at ?? "",
9086
9101
  updated_at: raw.updated_at ?? ""
9087
9102
  };
@@ -9142,6 +9157,60 @@ function createRawMediaAdapter(client) {
9142
9157
  }
9143
9158
  };
9144
9159
  }
9160
+ /**
9161
+ * Creates a ContentMediaProductsApi adapter backed by the portal-tenant content BFF.
9162
+ */
9163
+ function createPortalTenantMediaProductsAdapter(client) {
9164
+ return {
9165
+ listMediaProducts: async (mediumId, params) => {
9166
+ const response = await media_products_list(client, mediumId, {
9167
+ "page[cursor]": params?.cursor,
9168
+ "page[limit]": params?.limit
9169
+ });
9170
+ return {
9171
+ media_products: (response.media_products ?? []).map((p) => ({
9172
+ id: p.id ?? 0,
9173
+ name: p.name,
9174
+ slug: p.slug ?? null,
9175
+ image_url: p.image_url ?? null,
9176
+ price: p.price ?? null,
9177
+ currency: p.currency ?? null,
9178
+ added_at: p.added_at ?? null
9179
+ })),
9180
+ meta: mapMediaMeta(response.meta)
9181
+ };
9182
+ },
9183
+ addMediaProduct: async (mediumId, body) => {
9184
+ const response = await media_products_add(client, mediumId, { product: { id: body.id } });
9185
+ const p = response.media_product ?? {};
9186
+ return {
9187
+ media_product: {
9188
+ id: p.id ?? 0,
9189
+ name: p.name,
9190
+ slug: p.slug ?? null,
9191
+ image_url: p.image_url ?? null,
9192
+ price: p.price ?? null,
9193
+ currency: p.currency ?? null,
9194
+ added_at: p.added_at ?? null
9195
+ },
9196
+ meta: {
9197
+ request_id: response.meta?.request_id ?? null,
9198
+ timestamp: response.meta?.timestamp ?? ""
9199
+ }
9200
+ };
9201
+ },
9202
+ removeMediaProduct: async (mediumId, productId) => {
9203
+ const response = await media_products_remove(client, mediumId, productId);
9204
+ return {
9205
+ media_product: { product_id: response.media_product?.product_id ?? 0 },
9206
+ meta: {
9207
+ request_id: response.meta?.request_id ?? null,
9208
+ timestamp: response.meta?.timestamp ?? ""
9209
+ }
9210
+ };
9211
+ }
9212
+ };
9213
+ }
9145
9214
  function mediaKindFromType(mediaType) {
9146
9215
  if (mediaType === "video") return "video";
9147
9216
  if (mediaType === "image") return "image";
@@ -9149,14 +9218,17 @@ function mediaKindFromType(mediaType) {
9149
9218
  return null;
9150
9219
  }
9151
9220
  function toBffMediumResponse(bff) {
9152
- const kind = mediaKindFromType(bff.media_type);
9153
- const isVideo = bff.media_type === "video";
9154
- const isPdf = bff.media_type === "pdf" || bff.media_type === "document";
9221
+ const kind = bff.content_format ?? null;
9222
+ const isVideo = kind === "video";
9223
+ const isPdf = kind === "pdf";
9224
+ const ctaData = bff.cta;
9225
+ const seoData = bff.seo;
9155
9226
  return {
9156
9227
  id: bff.id,
9157
9228
  user_id: null,
9158
- media_type: bff.media_type,
9159
- media_format: bff.media_type,
9229
+ owner_type: bff.owner_type ?? null,
9230
+ media_type: bff.content_format ?? "image",
9231
+ media_format: bff.content_format ?? "image",
9160
9232
  image_url: !isVideo && !isPdf ? bff.url ?? bff.thumbnail_url ?? null : bff.thumbnail_url ?? null,
9161
9233
  video_url: isVideo ? bff.url ?? null : null,
9162
9234
  pdf_url: isPdf ? bff.url ?? null : null,
@@ -9173,7 +9245,7 @@ function toBffMediumResponse(bff) {
9173
9245
  },
9174
9246
  stripped: bff.description ?? null,
9175
9247
  kind,
9176
- active: true,
9248
+ active: bff.status === "active",
9177
9249
  visibility: null,
9178
9250
  share_link: null,
9179
9251
  views: 0,
@@ -9181,16 +9253,32 @@ function toBffMediumResponse(bff) {
9181
9253
  watch: null,
9182
9254
  video_status: null,
9183
9255
  duration: null,
9184
- cta_url: null,
9185
- cta_button_text: null,
9186
- cta_enabled: false,
9187
- cta_action_type: null,
9256
+ cta_url: ctaData?.action_url ?? null,
9257
+ cta_button_text: ctaData?.button_text ?? null,
9258
+ cta_enabled: ctaData?.enabled ?? false,
9259
+ cta_action_type: ctaData?.type ?? null,
9188
9260
  video_shopping_enabled: false,
9189
9261
  prompts_enabled: false,
9190
9262
  ranks: [],
9191
9263
  preview_link: null,
9192
9264
  attached_shareables: [],
9193
- created_at: bff.created_at
9265
+ created_at: bff.created_at,
9266
+ settings: {
9267
+ cta: ctaData ? {
9268
+ enabled: ctaData.enabled ?? void 0,
9269
+ type: ctaData.type ?? void 0,
9270
+ url: ctaData.action_url ?? void 0,
9271
+ button_text: ctaData.button_text ?? void 0,
9272
+ button_color: ctaData.button_color ?? void 0,
9273
+ button_description: ctaData.button_description ?? void 0
9274
+ } : null,
9275
+ seo: seoData ? {
9276
+ title: seoData.title ?? void 0,
9277
+ description: seoData.description ?? void 0,
9278
+ image_url: seoData.image_url ?? void 0,
9279
+ block_crawler: seoData.block_crawler ?? void 0
9280
+ } : null
9281
+ }
9194
9282
  };
9195
9283
  }
9196
9284
  function createMediaAdapter(client) {
@@ -9200,7 +9288,7 @@ function createMediaAdapter(client) {
9200
9288
  return {
9201
9289
  getMedia: async (options) => {
9202
9290
  const pageNumber = options?.page ?? 1;
9203
- const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}|${options?.media_type ?? options?.with_type ?? ""}`;
9291
+ const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}`;
9204
9292
  if (filterKey !== lastFilterKey) {
9205
9293
  cursorByPage.clear();
9206
9294
  lastFilterKey = filterKey;
@@ -9213,7 +9301,6 @@ function createMediaAdapter(client) {
9213
9301
  const response = await portAdapter.listMedia({
9214
9302
  cursor,
9215
9303
  limit: options?.per_page,
9216
- media_type: options?.media_type ?? options?.with_type,
9217
9304
  "filter[title]": options?.search_query,
9218
9305
  sort: bffSort
9219
9306
  });
@@ -9243,18 +9330,44 @@ function createMediaAdapter(client) {
9243
9330
  };
9244
9331
  },
9245
9332
  createMedia: async (mediaData) => {
9333
+ const contentFormat = mediaData.kind === "image" || mediaData.kind === "video" || mediaData.kind === "pdf" || mediaData.kind === "ppt" || mediaData.kind === "link" ? mediaData.kind : void 0;
9246
9334
  return toBffMediumResponse((await portAdapter.createMedia({
9247
9335
  title: mediaData.title ?? "",
9248
9336
  description: mediaData.description,
9249
9337
  media_type: mediaData.media_type ?? "image",
9250
- url: mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0
9338
+ url: mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0,
9339
+ content_format: contentFormat
9251
9340
  })).media);
9252
9341
  },
9253
9342
  updateMedia: async (id, mediaData) => {
9254
- return toBffMediumResponse((await portAdapter.updateMedia(id, {
9343
+ const updateBody = {
9255
9344
  title: mediaData.title,
9256
9345
  description: mediaData.description
9257
- })).media);
9346
+ };
9347
+ if (mediaData.active !== void 0) updateBody.status = mediaData.active ? "active" : "draft";
9348
+ const newUrl = mediaData.image_url ?? mediaData.video_url ?? mediaData.pdf_url ?? void 0;
9349
+ if (newUrl !== void 0) updateBody.url = newUrl;
9350
+ if (mediaData.kind === "image" || mediaData.kind === "video" || mediaData.kind === "pdf" || mediaData.kind === "ppt" || mediaData.kind === "link") updateBody.content_format = mediaData.kind;
9351
+ if (mediaData.thumbnail_url !== void 0) updateBody.thumbnail_url = mediaData.thumbnail_url;
9352
+ if (mediaData.settings?.cta) {
9353
+ const rawType = mediaData.settings.cta.type;
9354
+ const ctaType = rawType === "link" || rawType === "cart" || rawType === "email" || rawType === "phone" ? rawType : void 0;
9355
+ updateBody.cta = {
9356
+ enabled: mediaData.settings.cta.enabled,
9357
+ type: ctaType,
9358
+ button_text: mediaData.settings.cta.button_text,
9359
+ button_color: mediaData.settings.cta.button_color,
9360
+ button_description: mediaData.settings.cta.button_description,
9361
+ action_url: mediaData.settings.cta.url
9362
+ };
9363
+ }
9364
+ if (mediaData.settings?.seo) updateBody.seo = {
9365
+ title: mediaData.settings.seo.title,
9366
+ description: mediaData.settings.seo.description,
9367
+ image_url: mediaData.settings.seo.image_url,
9368
+ block_crawler: mediaData.settings.seo.block_crawler ?? void 0
9369
+ };
9370
+ return toBffMediumResponse((await portAdapter.updateMedia(id, updateBody)).media);
9258
9371
  },
9259
9372
  deleteMedia: async (id) => {
9260
9373
  await portAdapter.deleteMedia(id);
@@ -9268,7 +9381,7 @@ function mapPlaylist(raw) {
9268
9381
  title: raw.title ?? "",
9269
9382
  description: raw.description ?? null,
9270
9383
  items_count: raw.items_count ?? 0,
9271
- user_id: raw.user_id ?? void 0,
9384
+ user_id: raw.user_id,
9272
9385
  is_favorited: raw.is_favorited,
9273
9386
  image_url: raw.image_url ?? null,
9274
9387
  created_at: raw.created_at ?? "",
@@ -9693,12 +9806,6 @@ function createProductMediaAdapter(source) {
9693
9806
  return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
9694
9807
  } };
9695
9808
  }
9696
- async function toggleFavorite(client, favoriteableId, favoriteableType) {
9697
- return { is_favorited: (await client.post("/api/content/favorites/toggle", {
9698
- favoriteable_id: favoriteableId,
9699
- favoriteable_type: favoriteableType
9700
- })).favorite?.is_favorited ?? false };
9701
- }
9702
9809
  /**
9703
9810
  * Creates a composite ContentDomainApi backed by the portal-tenant Content
9704
9811
  * BFF endpoints. Follows the same pattern as
@@ -9722,6 +9829,17 @@ function createPortalContentDomainApiAdapter(client, productsApi) {
9722
9829
  function createPortalContentPlaylistsAdapter(client) {
9723
9830
  return createRawPlaylistsAdapter(client);
9724
9831
  }
9832
+ /**
9833
+ * Toggles a favorite entry on a given shareable (Medium / Playlist /
9834
+ * Product / etc.) via the portal-tenant BFF's /favorites/toggle endpoint.
9835
+ * Returns the new is_favorited state reported by the backend.
9836
+ */
9837
+ async function toggleFavorite(client, favoriteableId, favoriteableType) {
9838
+ return { is_favorited: (await client.post("/api/content/favorites/toggle", {
9839
+ favoriteable_id: favoriteableId,
9840
+ favoriteable_type: favoriteableType
9841
+ })).favorite?.is_favorited ?? false };
9842
+ }
9725
9843
  //#endregion
9726
9844
  //#region src/content/PortalContentApiProvider.tsx
9727
9845
  const ContentContext = createContext(null);
@@ -9744,14 +9862,17 @@ function PortalContentApiProvider({ children }) {
9744
9862
  const productsApi = usePortalProductsApi();
9745
9863
  const contentApi = useMemo(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
9746
9864
  const playlistsAdapter = useMemo(() => createPortalContentPlaylistsAdapter(client), [client]);
9865
+ const mediaProductsAdapter = useMemo(() => createPortalTenantMediaProductsAdapter(client), [client]);
9747
9866
  const filePickerApi = useMemo(() => createFilePickerApiAdapter(client), [client]);
9748
9867
  const ctx = useMemo(() => ({
9749
9868
  productsApi,
9750
9869
  playlistsAdapter,
9870
+ mediaProductsAdapter,
9751
9871
  filePickerApi
9752
9872
  }), [
9753
9873
  productsApi,
9754
9874
  playlistsAdapter,
9875
+ mediaProductsAdapter,
9755
9876
  filePickerApi
9756
9877
  ]);
9757
9878
  return /* @__PURE__ */ jsx(ContentContext.Provider, {
@@ -9765,4 +9886,4 @@ function PortalContentApiProvider({ children }) {
9765
9886
  //#endregion
9766
9887
  export { ShareablesApp as a, ProductsApp as i, usePortalContentContext as n, ShareablesUIProvider as o, toggleFavorite as r, ShareablesCoreProvider as s, PortalContentApiProvider as t };
9767
9888
 
9768
- //# sourceMappingURL=PortalContentApiProvider--tsJ7o74.mjs.map
9889
+ //# sourceMappingURL=PortalContentApiProvider-C5BcaBSL.mjs.map