@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.
- package/dist/{FluidProvider-XHTzXe-E.cjs → FluidProvider-CX2WZMLJ.cjs} +12 -3
- package/dist/FluidProvider-CX2WZMLJ.cjs.map +1 -0
- package/dist/{FluidProvider-Bjlw3uIJ.mjs → FluidProvider-CxTAbzER.mjs} +12 -3
- package/dist/FluidProvider-CxTAbzER.mjs.map +1 -0
- package/dist/{MessagingScreen-CxWUaN04.mjs → MessagingScreen-DGB7agVV.mjs} +2 -2
- package/dist/{MessagingScreen-CxWUaN04.mjs.map → MessagingScreen-DGB7agVV.mjs.map} +1 -1
- package/dist/{MessagingScreen-D35g9qBs.cjs → MessagingScreen-R9yqOP_e.cjs} +2 -2
- package/dist/{MessagingScreen-BcpCwuYL.cjs → MessagingScreen-hdB0BzpO.cjs} +2 -2
- package/dist/{MessagingScreen-BcpCwuYL.cjs.map → MessagingScreen-hdB0BzpO.cjs.map} +1 -1
- package/dist/{PortalContentApiProvider-D15sSN1l.mjs → PortalContentApiProvider-C5BcaBSL.mjs} +148 -28
- package/dist/PortalContentApiProvider-C5BcaBSL.mjs.map +1 -0
- package/dist/{PortalContentApiProvider-BBGpjTFn.cjs → PortalContentApiProvider-eSOgc4Nv.cjs} +148 -28
- package/dist/PortalContentApiProvider-eSOgc4Nv.cjs.map +1 -0
- package/dist/PortalProductsApiProvider-BALswRao.mjs.map +1 -1
- package/dist/PortalProductsApiProvider-Duj-EjQj.cjs.map +1 -1
- package/dist/{ProductsScreen-DjzkmBOS.cjs → ProductsScreen-C2mx-086.cjs} +2 -2
- package/dist/{ProductsScreen-C0KlCDt_.mjs → ProductsScreen-CIT--Mnq.mjs} +2 -2
- package/dist/{ProductsScreen-CWqkme1L.cjs → ProductsScreen-CJPwyXvT.cjs} +2 -2
- package/dist/{ProductsScreen-CWqkme1L.cjs.map → ProductsScreen-CJPwyXvT.cjs.map} +1 -1
- package/dist/{ProductsScreen-BnS0MbzY.mjs → ProductsScreen-P4n3OFln.mjs} +2 -2
- package/dist/{ProductsScreen-BnS0MbzY.mjs.map → ProductsScreen-P4n3OFln.mjs.map} +1 -1
- package/dist/{ProfileScreen-C9Tixtim.cjs → ProfileScreen-CpQ5GpTs.cjs} +2 -2
- package/dist/{ProfileScreen-C9Tixtim.cjs.map → ProfileScreen-CpQ5GpTs.cjs.map} +1 -1
- package/dist/{ProfileScreen-i8LfufEA.cjs → ProfileScreen-D0CUvLHq.cjs} +2 -2
- package/dist/{ProfileScreen-BLp5rnYR.mjs → ProfileScreen-DzhxfhqL.mjs} +2 -2
- package/dist/{ProfileScreen-BLp5rnYR.mjs.map → ProfileScreen-DzhxfhqL.mjs.map} +1 -1
- package/dist/{ShareablesScreen-svmMjJII.mjs → ShareablesScreen-BII-fIRD.mjs} +27 -22
- package/dist/ShareablesScreen-BII-fIRD.mjs.map +1 -0
- package/dist/{ShareablesScreen-_S-OESoe.mjs → ShareablesScreen-BLNcb2M-.mjs} +2 -3
- package/dist/{ShareablesScreen-B_tGIt_X.cjs → ShareablesScreen-CBrJ8Vzm.cjs} +27 -22
- package/dist/ShareablesScreen-CBrJ8Vzm.cjs.map +1 -0
- package/dist/{ShareablesScreen-BZG-rFuT.cjs → ShareablesScreen-C_KC7Ey1.cjs} +2 -3
- package/dist/{ShopScreen-ChzQkJ1u.mjs → ShopScreen-1k9PZ8qQ.mjs} +2 -2
- package/dist/{ShopScreen-ChzQkJ1u.mjs.map → ShopScreen-1k9PZ8qQ.mjs.map} +1 -1
- package/dist/{ShopScreen-BeuMn_38.cjs → ShopScreen-B9EmEprQ.cjs} +2 -2
- package/dist/{ShopScreen-GBG7PGT3.cjs → ShopScreen-BkwsMZ6V.cjs} +2 -2
- package/dist/{ShopScreen-GBG7PGT3.cjs.map → ShopScreen-BkwsMZ6V.cjs.map} +1 -1
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +17 -17
- package/dist/{portal_tenant_content-C8DCQLR3.mjs → portal_tenant_content-DgM42X08.mjs} +48 -5
- package/dist/portal_tenant_content-DgM42X08.mjs.map +1 -0
- package/dist/{portal_tenant_content-Bq8PD-Sz.cjs → portal_tenant_content-Dwmo8XZ-.cjs} +71 -4
- package/dist/portal_tenant_content-Dwmo8XZ-.cjs.map +1 -0
- package/package.json +16 -16
- package/dist/FluidProvider-Bjlw3uIJ.mjs.map +0 -1
- package/dist/FluidProvider-XHTzXe-E.cjs.map +0 -1
- package/dist/PortalContentApiProvider-BBGpjTFn.cjs.map +0 -1
- package/dist/PortalContentApiProvider-D15sSN1l.mjs.map +0 -1
- package/dist/ShareablesScreen-B_tGIt_X.cjs.map +0 -1
- package/dist/ShareablesScreen-svmMjJII.mjs.map +0 -1
- package/dist/portal_tenant_content-Bq8PD-Sz.cjs.map +0 -1
- package/dist/portal_tenant_content-C8DCQLR3.mjs.map +0 -1
package/dist/{PortalContentApiProvider-D15sSN1l.mjs → PortalContentApiProvider-C5BcaBSL.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as useDropzone } from "./es-I9usCQT-.mjs";
|
|
2
|
-
import {
|
|
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";
|
|
@@ -90,7 +90,7 @@ const shareablesKeys = {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
//#endregion
|
|
93
|
-
//#region ../../shareables/core/src/api-context.tsx
|
|
93
|
+
//#region ../../shareables/core/src/shareables-api-context.tsx
|
|
94
94
|
const ShareablesApiContext = createContext(null);
|
|
95
95
|
function ShareablesApiProvider({ value, children }) {
|
|
96
96
|
return /* @__PURE__ */ jsx(ShareablesApiContext.Provider, {
|
|
@@ -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
|
-
|
|
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
|
};
|
|
@@ -9104,7 +9119,6 @@ function createRawMediaAdapter(client) {
|
|
|
9104
9119
|
const response = await media_list(client, {
|
|
9105
9120
|
"page[cursor]": params?.cursor,
|
|
9106
9121
|
"page[limit]": params?.limit,
|
|
9107
|
-
media_type: params?.media_type,
|
|
9108
9122
|
"filter[title]": params?.["filter[title]"],
|
|
9109
9123
|
sort: params?.sort
|
|
9110
9124
|
});
|
|
@@ -9143,6 +9157,60 @@ function createRawMediaAdapter(client) {
|
|
|
9143
9157
|
}
|
|
9144
9158
|
};
|
|
9145
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
|
+
}
|
|
9146
9214
|
function mediaKindFromType(mediaType) {
|
|
9147
9215
|
if (mediaType === "video") return "video";
|
|
9148
9216
|
if (mediaType === "image") return "image";
|
|
@@ -9150,14 +9218,17 @@ function mediaKindFromType(mediaType) {
|
|
|
9150
9218
|
return null;
|
|
9151
9219
|
}
|
|
9152
9220
|
function toBffMediumResponse(bff) {
|
|
9153
|
-
const kind =
|
|
9154
|
-
const isVideo =
|
|
9155
|
-
const isPdf =
|
|
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;
|
|
9156
9226
|
return {
|
|
9157
9227
|
id: bff.id,
|
|
9158
9228
|
user_id: null,
|
|
9159
|
-
|
|
9160
|
-
|
|
9229
|
+
owner_type: bff.owner_type ?? null,
|
|
9230
|
+
media_type: bff.content_format ?? "image",
|
|
9231
|
+
media_format: bff.content_format ?? "image",
|
|
9161
9232
|
image_url: !isVideo && !isPdf ? bff.url ?? bff.thumbnail_url ?? null : bff.thumbnail_url ?? null,
|
|
9162
9233
|
video_url: isVideo ? bff.url ?? null : null,
|
|
9163
9234
|
pdf_url: isPdf ? bff.url ?? null : null,
|
|
@@ -9174,7 +9245,7 @@ function toBffMediumResponse(bff) {
|
|
|
9174
9245
|
},
|
|
9175
9246
|
stripped: bff.description ?? null,
|
|
9176
9247
|
kind,
|
|
9177
|
-
active:
|
|
9248
|
+
active: bff.status === "active",
|
|
9178
9249
|
visibility: null,
|
|
9179
9250
|
share_link: null,
|
|
9180
9251
|
views: 0,
|
|
@@ -9182,16 +9253,32 @@ function toBffMediumResponse(bff) {
|
|
|
9182
9253
|
watch: null,
|
|
9183
9254
|
video_status: null,
|
|
9184
9255
|
duration: null,
|
|
9185
|
-
cta_url: null,
|
|
9186
|
-
cta_button_text: null,
|
|
9187
|
-
cta_enabled: false,
|
|
9188
|
-
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,
|
|
9189
9260
|
video_shopping_enabled: false,
|
|
9190
9261
|
prompts_enabled: false,
|
|
9191
9262
|
ranks: [],
|
|
9192
9263
|
preview_link: null,
|
|
9193
9264
|
attached_shareables: [],
|
|
9194
|
-
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
|
+
}
|
|
9195
9282
|
};
|
|
9196
9283
|
}
|
|
9197
9284
|
function createMediaAdapter(client) {
|
|
@@ -9201,7 +9288,7 @@ function createMediaAdapter(client) {
|
|
|
9201
9288
|
return {
|
|
9202
9289
|
getMedia: async (options) => {
|
|
9203
9290
|
const pageNumber = options?.page ?? 1;
|
|
9204
|
-
const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}
|
|
9291
|
+
const filterKey = `${options?.search_query ?? ""}|${options?.sorted_by ?? ""}`;
|
|
9205
9292
|
if (filterKey !== lastFilterKey) {
|
|
9206
9293
|
cursorByPage.clear();
|
|
9207
9294
|
lastFilterKey = filterKey;
|
|
@@ -9214,7 +9301,6 @@ function createMediaAdapter(client) {
|
|
|
9214
9301
|
const response = await portAdapter.listMedia({
|
|
9215
9302
|
cursor,
|
|
9216
9303
|
limit: options?.per_page,
|
|
9217
|
-
media_type: options?.media_type ?? options?.with_type,
|
|
9218
9304
|
"filter[title]": options?.search_query,
|
|
9219
9305
|
sort: bffSort
|
|
9220
9306
|
});
|
|
@@ -9244,18 +9330,44 @@ function createMediaAdapter(client) {
|
|
|
9244
9330
|
};
|
|
9245
9331
|
},
|
|
9246
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;
|
|
9247
9334
|
return toBffMediumResponse((await portAdapter.createMedia({
|
|
9248
9335
|
title: mediaData.title ?? "",
|
|
9249
9336
|
description: mediaData.description,
|
|
9250
9337
|
media_type: mediaData.media_type ?? "image",
|
|
9251
|
-
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
|
|
9252
9340
|
})).media);
|
|
9253
9341
|
},
|
|
9254
9342
|
updateMedia: async (id, mediaData) => {
|
|
9255
|
-
|
|
9343
|
+
const updateBody = {
|
|
9256
9344
|
title: mediaData.title,
|
|
9257
9345
|
description: mediaData.description
|
|
9258
|
-
}
|
|
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);
|
|
9259
9371
|
},
|
|
9260
9372
|
deleteMedia: async (id) => {
|
|
9261
9373
|
await portAdapter.deleteMedia(id);
|
|
@@ -9269,7 +9381,7 @@ function mapPlaylist(raw) {
|
|
|
9269
9381
|
title: raw.title ?? "",
|
|
9270
9382
|
description: raw.description ?? null,
|
|
9271
9383
|
items_count: raw.items_count ?? 0,
|
|
9272
|
-
user_id: raw.user_id
|
|
9384
|
+
user_id: raw.user_id,
|
|
9273
9385
|
is_favorited: raw.is_favorited,
|
|
9274
9386
|
image_url: raw.image_url ?? null,
|
|
9275
9387
|
created_at: raw.created_at ?? "",
|
|
@@ -9694,12 +9806,6 @@ function createProductMediaAdapter(source) {
|
|
|
9694
9806
|
return { media: ((await source.getProductMedia(productId)).media ?? []).map(mapProductMedia) };
|
|
9695
9807
|
} };
|
|
9696
9808
|
}
|
|
9697
|
-
async function toggleFavorite(client, favoriteableId, favoriteableType) {
|
|
9698
|
-
return { is_favorited: (await client.post("/api/content/favorites/toggle", {
|
|
9699
|
-
favoriteable_id: favoriteableId,
|
|
9700
|
-
favoriteable_type: favoriteableType
|
|
9701
|
-
})).favorite?.is_favorited ?? false };
|
|
9702
|
-
}
|
|
9703
9809
|
/**
|
|
9704
9810
|
* Creates a composite ContentDomainApi backed by the portal-tenant Content
|
|
9705
9811
|
* BFF endpoints. Follows the same pattern as
|
|
@@ -9723,6 +9829,17 @@ function createPortalContentDomainApiAdapter(client, productsApi) {
|
|
|
9723
9829
|
function createPortalContentPlaylistsAdapter(client) {
|
|
9724
9830
|
return createRawPlaylistsAdapter(client);
|
|
9725
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
|
+
}
|
|
9726
9843
|
//#endregion
|
|
9727
9844
|
//#region src/content/PortalContentApiProvider.tsx
|
|
9728
9845
|
const ContentContext = createContext(null);
|
|
@@ -9745,14 +9862,17 @@ function PortalContentApiProvider({ children }) {
|
|
|
9745
9862
|
const productsApi = usePortalProductsApi();
|
|
9746
9863
|
const contentApi = useMemo(() => createPortalContentDomainApiAdapter(client, productsApi), [client, productsApi]);
|
|
9747
9864
|
const playlistsAdapter = useMemo(() => createPortalContentPlaylistsAdapter(client), [client]);
|
|
9865
|
+
const mediaProductsAdapter = useMemo(() => createPortalTenantMediaProductsAdapter(client), [client]);
|
|
9748
9866
|
const filePickerApi = useMemo(() => createFilePickerApiAdapter(client), [client]);
|
|
9749
9867
|
const ctx = useMemo(() => ({
|
|
9750
9868
|
productsApi,
|
|
9751
9869
|
playlistsAdapter,
|
|
9870
|
+
mediaProductsAdapter,
|
|
9752
9871
|
filePickerApi
|
|
9753
9872
|
}), [
|
|
9754
9873
|
productsApi,
|
|
9755
9874
|
playlistsAdapter,
|
|
9875
|
+
mediaProductsAdapter,
|
|
9756
9876
|
filePickerApi
|
|
9757
9877
|
]);
|
|
9758
9878
|
return /* @__PURE__ */ jsx(ContentContext.Provider, {
|
|
@@ -9766,4 +9886,4 @@ function PortalContentApiProvider({ children }) {
|
|
|
9766
9886
|
//#endregion
|
|
9767
9887
|
export { ShareablesApp as a, ProductsApp as i, usePortalContentContext as n, ShareablesUIProvider as o, toggleFavorite as r, ShareablesCoreProvider as s, PortalContentApiProvider as t };
|
|
9768
9888
|
|
|
9769
|
-
//# sourceMappingURL=PortalContentApiProvider-
|
|
9889
|
+
//# sourceMappingURL=PortalContentApiProvider-C5BcaBSL.mjs.map
|