@fluid-app/portal-sdk 0.1.181 → 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 (54) hide show
  1. package/dist/{FluidProvider-XHTzXe-E.cjs → FluidProvider-CX2WZMLJ.cjs} +12 -3
  2. package/dist/FluidProvider-CX2WZMLJ.cjs.map +1 -0
  3. package/dist/{FluidProvider-Bjlw3uIJ.mjs → FluidProvider-CxTAbzER.mjs} +12 -3
  4. package/dist/FluidProvider-CxTAbzER.mjs.map +1 -0
  5. package/dist/{MessagingScreen-CxWUaN04.mjs → MessagingScreen-DGB7agVV.mjs} +2 -2
  6. package/dist/{MessagingScreen-CxWUaN04.mjs.map → MessagingScreen-DGB7agVV.mjs.map} +1 -1
  7. package/dist/{MessagingScreen-D35g9qBs.cjs → MessagingScreen-R9yqOP_e.cjs} +2 -2
  8. package/dist/{MessagingScreen-BcpCwuYL.cjs → MessagingScreen-hdB0BzpO.cjs} +2 -2
  9. package/dist/{MessagingScreen-BcpCwuYL.cjs.map → MessagingScreen-hdB0BzpO.cjs.map} +1 -1
  10. package/dist/{PortalContentApiProvider-D15sSN1l.mjs → PortalContentApiProvider-C5BcaBSL.mjs} +148 -28
  11. package/dist/PortalContentApiProvider-C5BcaBSL.mjs.map +1 -0
  12. package/dist/{PortalContentApiProvider-BBGpjTFn.cjs → PortalContentApiProvider-eSOgc4Nv.cjs} +148 -28
  13. package/dist/PortalContentApiProvider-eSOgc4Nv.cjs.map +1 -0
  14. package/dist/PortalProductsApiProvider-BALswRao.mjs.map +1 -1
  15. package/dist/PortalProductsApiProvider-Duj-EjQj.cjs.map +1 -1
  16. package/dist/{ProductsScreen-DjzkmBOS.cjs → ProductsScreen-C2mx-086.cjs} +2 -2
  17. package/dist/{ProductsScreen-C0KlCDt_.mjs → ProductsScreen-CIT--Mnq.mjs} +2 -2
  18. package/dist/{ProductsScreen-CWqkme1L.cjs → ProductsScreen-CJPwyXvT.cjs} +2 -2
  19. package/dist/{ProductsScreen-CWqkme1L.cjs.map → ProductsScreen-CJPwyXvT.cjs.map} +1 -1
  20. package/dist/{ProductsScreen-BnS0MbzY.mjs → ProductsScreen-P4n3OFln.mjs} +2 -2
  21. package/dist/{ProductsScreen-BnS0MbzY.mjs.map → ProductsScreen-P4n3OFln.mjs.map} +1 -1
  22. package/dist/{ProfileScreen-C9Tixtim.cjs → ProfileScreen-CpQ5GpTs.cjs} +2 -2
  23. package/dist/{ProfileScreen-C9Tixtim.cjs.map → ProfileScreen-CpQ5GpTs.cjs.map} +1 -1
  24. package/dist/{ProfileScreen-i8LfufEA.cjs → ProfileScreen-D0CUvLHq.cjs} +2 -2
  25. package/dist/{ProfileScreen-BLp5rnYR.mjs → ProfileScreen-DzhxfhqL.mjs} +2 -2
  26. package/dist/{ProfileScreen-BLp5rnYR.mjs.map → ProfileScreen-DzhxfhqL.mjs.map} +1 -1
  27. package/dist/{ShareablesScreen-svmMjJII.mjs → ShareablesScreen-BII-fIRD.mjs} +27 -22
  28. package/dist/ShareablesScreen-BII-fIRD.mjs.map +1 -0
  29. package/dist/{ShareablesScreen-_S-OESoe.mjs → ShareablesScreen-BLNcb2M-.mjs} +2 -3
  30. package/dist/{ShareablesScreen-B_tGIt_X.cjs → ShareablesScreen-CBrJ8Vzm.cjs} +27 -22
  31. package/dist/ShareablesScreen-CBrJ8Vzm.cjs.map +1 -0
  32. package/dist/{ShareablesScreen-BZG-rFuT.cjs → ShareablesScreen-C_KC7Ey1.cjs} +2 -3
  33. package/dist/{ShopScreen-ChzQkJ1u.mjs → ShopScreen-1k9PZ8qQ.mjs} +2 -2
  34. package/dist/{ShopScreen-ChzQkJ1u.mjs.map → ShopScreen-1k9PZ8qQ.mjs.map} +1 -1
  35. package/dist/{ShopScreen-BeuMn_38.cjs → ShopScreen-B9EmEprQ.cjs} +2 -2
  36. package/dist/{ShopScreen-GBG7PGT3.cjs → ShopScreen-BkwsMZ6V.cjs} +2 -2
  37. package/dist/{ShopScreen-GBG7PGT3.cjs.map → ShopScreen-BkwsMZ6V.cjs.map} +1 -1
  38. package/dist/index.cjs +17 -17
  39. package/dist/index.d.cts.map +1 -1
  40. package/dist/index.d.mts.map +1 -1
  41. package/dist/index.mjs +17 -17
  42. package/dist/{portal_tenant_content-C8DCQLR3.mjs → portal_tenant_content-DgM42X08.mjs} +48 -5
  43. package/dist/portal_tenant_content-DgM42X08.mjs.map +1 -0
  44. package/dist/{portal_tenant_content-Bq8PD-Sz.cjs → portal_tenant_content-Dwmo8XZ-.cjs} +71 -4
  45. package/dist/portal_tenant_content-Dwmo8XZ-.cjs.map +1 -0
  46. package/package.json +16 -16
  47. package/dist/FluidProvider-Bjlw3uIJ.mjs.map +0 -1
  48. package/dist/FluidProvider-XHTzXe-E.cjs.map +0 -1
  49. package/dist/PortalContentApiProvider-BBGpjTFn.cjs.map +0 -1
  50. package/dist/PortalContentApiProvider-D15sSN1l.mjs.map +0 -1
  51. package/dist/ShareablesScreen-B_tGIt_X.cjs.map +0 -1
  52. package/dist/ShareablesScreen-svmMjJII.mjs.map +0 -1
  53. package/dist/portal_tenant_content-Bq8PD-Sz.cjs.map +0 -1
  54. package/dist/portal_tenant_content-C8DCQLR3.mjs.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-Bq8PD-Sz.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");
@@ -92,7 +92,7 @@ const shareablesKeys = {
92
92
  }
93
93
  };
94
94
  //#endregion
95
- //#region ../../shareables/core/src/api-context.tsx
95
+ //#region ../../shareables/core/src/shareables-api-context.tsx
96
96
  const ShareablesApiContext = (0, react.createContext)(null);
97
97
  function ShareablesApiProvider({ value, children }) {
98
98
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShareablesApiContext.Provider, {
@@ -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.media_type ?? "",
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
  };
@@ -9109,7 +9124,6 @@ function createRawMediaAdapter(client) {
9109
9124
  const response = await require_portal_tenant_content.media_list(client, {
9110
9125
  "page[cursor]": params?.cursor,
9111
9126
  "page[limit]": params?.limit,
9112
- media_type: params?.media_type,
9113
9127
  "filter[title]": params?.["filter[title]"],
9114
9128
  sort: params?.sort
9115
9129
  });
@@ -9148,6 +9162,60 @@ function createRawMediaAdapter(client) {
9148
9162
  }
9149
9163
  };
9150
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
+ }
9151
9219
  function mediaKindFromType(mediaType) {
9152
9220
  if (mediaType === "video") return "video";
9153
9221
  if (mediaType === "image") return "image";
@@ -9155,14 +9223,17 @@ function mediaKindFromType(mediaType) {
9155
9223
  return null;
9156
9224
  }
9157
9225
  function toBffMediumResponse(bff) {
9158
- const kind = mediaKindFromType(bff.media_type);
9159
- const isVideo = bff.media_type === "video";
9160
- 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;
9161
9231
  return {
9162
9232
  id: bff.id,
9163
9233
  user_id: null,
9164
- media_type: bff.media_type,
9165
- 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",
9166
9237
  image_url: !isVideo && !isPdf ? bff.url ?? bff.thumbnail_url ?? null : bff.thumbnail_url ?? null,
9167
9238
  video_url: isVideo ? bff.url ?? null : null,
9168
9239
  pdf_url: isPdf ? bff.url ?? null : null,
@@ -9179,7 +9250,7 @@ function toBffMediumResponse(bff) {
9179
9250
  },
9180
9251
  stripped: bff.description ?? null,
9181
9252
  kind,
9182
- active: true,
9253
+ active: bff.status === "active",
9183
9254
  visibility: null,
9184
9255
  share_link: null,
9185
9256
  views: 0,
@@ -9187,16 +9258,32 @@ function toBffMediumResponse(bff) {
9187
9258
  watch: null,
9188
9259
  video_status: null,
9189
9260
  duration: null,
9190
- cta_url: null,
9191
- cta_button_text: null,
9192
- cta_enabled: false,
9193
- 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,
9194
9265
  video_shopping_enabled: false,
9195
9266
  prompts_enabled: false,
9196
9267
  ranks: [],
9197
9268
  preview_link: null,
9198
9269
  attached_shareables: [],
9199
- 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
+ }
9200
9287
  };
9201
9288
  }
9202
9289
  function createMediaAdapter(client) {
@@ -9206,7 +9293,7 @@ function createMediaAdapter(client) {
9206
9293
  return {
9207
9294
  getMedia: async (options) => {
9208
9295
  const pageNumber = options?.page ?? 1;
9209
- const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}|${options?.media_type ?? options?.with_type ?? ""}`;
9296
+ const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}`;
9210
9297
  if (filterKey !== lastFilterKey) {
9211
9298
  cursorByPage.clear();
9212
9299
  lastFilterKey = filterKey;
@@ -9219,7 +9306,6 @@ function createMediaAdapter(client) {
9219
9306
  const response = await portAdapter.listMedia({
9220
9307
  cursor,
9221
9308
  limit: options?.per_page,
9222
- media_type: options?.media_type ?? options?.with_type,
9223
9309
  "filter[title]": options?.search_query,
9224
9310
  sort: bffSort
9225
9311
  });
@@ -9249,18 +9335,44 @@ function createMediaAdapter(client) {
9249
9335
  };
9250
9336
  },
9251
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;
9252
9339
  return toBffMediumResponse((await portAdapter.createMedia({
9253
9340
  title: mediaData.title ?? "",
9254
9341
  description: mediaData.description,
9255
9342
  media_type: mediaData.media_type ?? "image",
9256
- 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
9257
9345
  })).media);
9258
9346
  },
9259
9347
  updateMedia: async (id, mediaData) => {
9260
- return toBffMediumResponse((await portAdapter.updateMedia(id, {
9348
+ const updateBody = {
9261
9349
  title: mediaData.title,
9262
9350
  description: mediaData.description
9263
- })).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);
9264
9376
  },
9265
9377
  deleteMedia: async (id) => {
9266
9378
  await portAdapter.deleteMedia(id);
@@ -9274,7 +9386,7 @@ function mapPlaylist(raw) {
9274
9386
  title: raw.title ?? "",
9275
9387
  description: raw.description ?? null,
9276
9388
  items_count: raw.items_count ?? 0,
9277
- user_id: raw.user_id ?? void 0,
9389
+ user_id: raw.user_id,
9278
9390
  is_favorited: raw.is_favorited,
9279
9391
  image_url: raw.image_url ?? null,
9280
9392
  created_at: raw.created_at ?? "",
@@ -9699,12 +9811,6 @@ function createProductMediaAdapter(source) {
9699
9811
  return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
9700
9812
  } };
9701
9813
  }
9702
- async function toggleFavorite(client, favoriteableId, favoriteableType) {
9703
- return { is_favorited: (await client.post("/api/content/favorites/toggle", {
9704
- favoriteable_id: favoriteableId,
9705
- favoriteable_type: favoriteableType
9706
- })).favorite?.is_favorited ?? false };
9707
- }
9708
9814
  /**
9709
9815
  * Creates a composite ContentDomainApi backed by the portal-tenant Content
9710
9816
  * BFF endpoints. Follows the same pattern as
@@ -9728,6 +9834,17 @@ function createPortalContentDomainApiAdapter(client, productsApi) {
9728
9834
  function createPortalContentPlaylistsAdapter(client) {
9729
9835
  return createRawPlaylistsAdapter(client);
9730
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
+ }
9731
9848
  //#endregion
9732
9849
  //#region src/content/PortalContentApiProvider.tsx
9733
9850
  const ContentContext = (0, react.createContext)(null);
@@ -9750,14 +9867,17 @@ function PortalContentApiProvider({ children }) {
9750
9867
  const productsApi = require_PortalProductsApiProvider.usePortalProductsApi();
9751
9868
  const contentApi = (0, react.useMemo)(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
9752
9869
  const playlistsAdapter = (0, react.useMemo)(() => createPortalContentPlaylistsAdapter(client), [client]);
9870
+ const mediaProductsAdapter = (0, react.useMemo)(() => createPortalTenantMediaProductsAdapter(client), [client]);
9753
9871
  const filePickerApi = (0, react.useMemo)(() => createFilePickerApiAdapter(client), [client]);
9754
9872
  const ctx = (0, react.useMemo)(() => ({
9755
9873
  productsApi,
9756
9874
  playlistsAdapter,
9875
+ mediaProductsAdapter,
9757
9876
  filePickerApi
9758
9877
  }), [
9759
9878
  productsApi,
9760
9879
  playlistsAdapter,
9880
+ mediaProductsAdapter,
9761
9881
  filePickerApi
9762
9882
  ]);
9763
9883
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentContext.Provider, {
@@ -9812,4 +9932,4 @@ Object.defineProperty(exports, "usePortalContentContext", {
9812
9932
  }
9813
9933
  });
9814
9934
 
9815
- //# sourceMappingURL=PortalContentApiProvider-BBGpjTFn.cjs.map
9935
+ //# sourceMappingURL=PortalContentApiProvider-eSOgc4Nv.cjs.map