@fluid-app/portal-sdk 0.1.159 → 0.1.161
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/README.md +2 -196
- package/dist/{FluidProvider-Cqf2kmUc.mjs → FluidProvider-B00jTGTH.mjs} +1510 -1624
- package/dist/FluidProvider-B00jTGTH.mjs.map +1 -0
- package/dist/{FluidProvider-Bc-3uN7M.cjs → FluidProvider-BtGi2jJt.cjs} +1458 -1614
- package/dist/FluidProvider-BtGi2jJt.cjs.map +1 -0
- package/dist/{MessagingScreen-BGqIn-c2.cjs → MessagingScreen-BRCUJDDZ.cjs} +2 -2
- package/dist/{MessagingScreen-CbmuvlH6.mjs → MessagingScreen-BWpSXB8Q.mjs} +2 -2
- package/dist/{MessagingScreen-CbmuvlH6.mjs.map → MessagingScreen-BWpSXB8Q.mjs.map} +1 -1
- package/dist/{MessagingScreen-CBPjP4du.cjs → MessagingScreen-C_OLIWCC.cjs} +2 -2
- package/dist/{MessagingScreen-CBPjP4du.cjs.map → MessagingScreen-C_OLIWCC.cjs.map} +1 -1
- package/dist/{MySiteScreen-DSDLDnCN.cjs → MySiteScreen-B90qzZPe.cjs} +2 -2
- package/dist/{MySiteScreen-Cl6nuU99.cjs → MySiteScreen-DLuHDXB1.cjs} +2 -2
- package/dist/{MySiteScreen-Cl6nuU99.cjs.map → MySiteScreen-DLuHDXB1.cjs.map} +1 -1
- package/dist/{MySiteScreen-BT1PBPsH.mjs → MySiteScreen-VaOB-vWk.mjs} +2 -2
- package/dist/{MySiteScreen-BT1PBPsH.mjs.map → MySiteScreen-VaOB-vWk.mjs.map} +1 -1
- package/dist/ProductsScreen-B8OynxlP.cjs +13 -0
- package/dist/{ProductsScreen-4WRrJcvw.mjs → ProductsScreen-CbVSNv1l.mjs} +3 -5
- package/dist/ProductsScreen-CbVSNv1l.mjs.map +1 -0
- package/dist/{ProductsScreen-BCs3YKVk.cjs → ProductsScreen-D1bw4ZIH.cjs} +3 -5
- package/dist/ProductsScreen-D1bw4ZIH.cjs.map +1 -0
- package/dist/ProductsScreen-Pq3j09nI.mjs +11 -0
- package/dist/{ProfileScreen-BgyrIQdL.mjs → ProfileScreen-BCHljkWD.mjs} +2 -2
- package/dist/{ProfileScreen-BgyrIQdL.mjs.map → ProfileScreen-BCHljkWD.mjs.map} +1 -1
- package/dist/{ProfileScreen-B0KNWXpV.cjs → ProfileScreen-Bf-lYNzz.cjs} +2 -2
- package/dist/{ProfileScreen-DLLLRNB2.cjs → ProfileScreen-ksdtbydb.cjs} +2 -2
- package/dist/{ProfileScreen-DLLLRNB2.cjs.map → ProfileScreen-ksdtbydb.cjs.map} +1 -1
- package/dist/{ShareablesScreen-ySSwCVSI.cjs → ShareablesScreen-6wgiwi_9.cjs} +3 -5
- package/dist/ShareablesScreen-6wgiwi_9.cjs.map +1 -0
- package/dist/{ShareablesScreen-B8cmh8JC.mjs → ShareablesScreen-BLCukNTk.mjs} +3 -5
- package/dist/{ShareablesScreen-B8cmh8JC.mjs.map → ShareablesScreen-BLCukNTk.mjs.map} +1 -1
- package/dist/ShareablesScreen-CM9OH-Nx.mjs +11 -0
- package/dist/ShareablesScreen-rmLcUhbL.cjs +13 -0
- package/dist/{ShopScreen-DhMo8bvP.cjs → ShopScreen-8KKwwjka.cjs} +3 -3
- package/dist/{ShopScreen-DhMo8bvP.cjs.map → ShopScreen-8KKwwjka.cjs.map} +1 -1
- package/dist/{ShopScreen-BkvyW0pE.cjs → ShopScreen-CjEbB3Q7.cjs} +2 -2
- package/dist/{ShopScreen-BFFGYwdV.mjs → ShopScreen-Dn5LwwYD.mjs} +3 -3
- package/dist/{ShopScreen-BFFGYwdV.mjs.map → ShopScreen-Dn5LwwYD.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-RScBCcY0.cjs → SubscriptionsScreen-B16wPAoA.cjs} +2 -2
- package/dist/SubscriptionsScreen-B16wPAoA.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-CiNR7JUC.mjs → SubscriptionsScreen-B4cTlgDU.mjs} +2 -2
- package/dist/SubscriptionsScreen-B4cTlgDU.mjs.map +1 -0
- package/dist/{SubscriptionsScreen-DMh-GE6n.cjs → SubscriptionsScreen-nRUMdnx7.cjs} +1 -1
- package/dist/{dist-Bg8UyHyM.cjs → dist-lO2OG0T5.cjs} +1 -1
- package/dist/{dist-Bg8UyHyM.cjs.map → dist-lO2OG0T5.cjs.map} +1 -1
- package/dist/index.cjs +134 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +444 -655
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +444 -655
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +127 -130
- package/dist/index.mjs.map +1 -1
- package/dist/{sortable.esm-Cz-CP2N8.mjs → sortable.esm-DSrWP4x9.mjs} +1 -1
- package/dist/{sortable.esm-Cz-CP2N8.mjs.map → sortable.esm-DSrWP4x9.mjs.map} +1 -1
- package/dist/{use-portal-products-client-BmlUixy4.cjs → use-portal-products-client-BHSBT64s.cjs} +2 -2
- package/dist/use-portal-products-client-BHSBT64s.cjs.map +1 -0
- package/dist/{use-portal-products-client-DQK9nFxT.mjs → use-portal-products-client-tbqk6XUq.mjs} +2 -2
- package/dist/use-portal-products-client-tbqk6XUq.mjs.map +1 -0
- package/dist/{use-portal-shareables-api-KVPj0Jfr.mjs → use-portal-shareables-api-B9B4XTjw.mjs} +107 -201
- package/dist/use-portal-shareables-api-B9B4XTjw.mjs.map +1 -0
- package/dist/{use-portal-shareables-api-D5D6uIJy.cjs → use-portal-shareables-api-MBl0d0eQ.cjs} +106 -206
- package/dist/use-portal-shareables-api-MBl0d0eQ.cjs.map +1 -0
- package/package.json +13 -13
- package/dist/FluidProvider-Bc-3uN7M.cjs.map +0 -1
- package/dist/FluidProvider-Cqf2kmUc.mjs.map +0 -1
- package/dist/ProductsScreen-4WRrJcvw.mjs.map +0 -1
- package/dist/ProductsScreen-BCs3YKVk.cjs.map +0 -1
- package/dist/ProductsScreen-BR9TN4So.cjs +0 -48
- package/dist/ProductsScreen-Da6eWJ_c.mjs +0 -46
- package/dist/ShareablesScreen-DW0wCYOj.mjs +0 -46
- package/dist/ShareablesScreen-DbPJOtCF.cjs +0 -48
- package/dist/ShareablesScreen-ySSwCVSI.cjs.map +0 -1
- package/dist/SubscriptionsScreen-CiNR7JUC.mjs.map +0 -1
- package/dist/SubscriptionsScreen-RScBCcY0.cjs.map +0 -1
- package/dist/use-portal-products-client-BmlUixy4.cjs.map +0 -1
- package/dist/use-portal-products-client-DQK9nFxT.mjs.map +0 -1
- package/dist/use-portal-shareables-api-D5D6uIJy.cjs.map +0 -1
- package/dist/use-portal-shareables-api-KVPj0Jfr.mjs.map +0 -1
package/dist/{use-portal-shareables-api-D5D6uIJy.cjs → use-portal-shareables-api-MBl0d0eQ.cjs}
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_FluidProvider = require("./FluidProvider-Bc-3uN7M.cjs");
|
|
3
2
|
const require_PortalTenantClientProvider = require("./PortalTenantClientProvider-C4Gnq5tJ.cjs");
|
|
4
3
|
const require_src = require("./src-Bm9zqmV3.cjs");
|
|
5
4
|
const require_ScreenHeaderContext = require("./ScreenHeaderContext-DRIKmM2G.cjs");
|
|
@@ -7,8 +6,8 @@ const require_dist$3 = require("./dist-thaj08s5.cjs");
|
|
|
7
6
|
const require_es = require("./es-xQF-WIMq.cjs");
|
|
8
7
|
const require_SearchSort = require("./SearchSort--3bVTMB4.cjs");
|
|
9
8
|
const require_dist$4 = require("./dist-BSKQ_GoC.cjs");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
const require_dist$5 = require("./dist-lO2OG0T5.cjs");
|
|
10
|
+
const require_use_portal_products_client = require("./use-portal-products-client-BHSBT64s.cjs");
|
|
12
11
|
let react = require("react");
|
|
13
12
|
react = require_chunk.__toESM(react);
|
|
14
13
|
let _tanstack_react_query = require("@tanstack/react-query");
|
|
@@ -28,7 +27,7 @@ function ShareablesCoreProvider({ config, children }) {
|
|
|
28
27
|
function useShareablesClient() {
|
|
29
28
|
const ctx = (0, react.useContext)(ShareablesCoreContext);
|
|
30
29
|
if (!ctx) throw new Error("useShareablesClient must be used within a ShareablesCoreProvider");
|
|
31
|
-
return ctx.client;
|
|
30
|
+
return ctx.client ?? null;
|
|
32
31
|
}
|
|
33
32
|
function useShareablesUser() {
|
|
34
33
|
const ctx = (0, react.useContext)(ShareablesCoreContext);
|
|
@@ -566,6 +565,7 @@ function ProductsScreen({ countryCode, fetchProducts: fetchPortalProducts, onNav
|
|
|
566
565
|
countryCode
|
|
567
566
|
],
|
|
568
567
|
queryFn: async ({ pageParam = 1 }) => {
|
|
568
|
+
if (!client) throw new Error("Unreachable: client is null");
|
|
569
569
|
return (await listProducts(client, {
|
|
570
570
|
page: pageParam,
|
|
571
571
|
per_page: PAGE_SIZE$3,
|
|
@@ -581,7 +581,7 @@ function ProductsScreen({ countryCode, fetchProducts: fetchPortalProducts, onNav
|
|
|
581
581
|
},
|
|
582
582
|
getNextPageParam: (lastPage, allPages) => lastPage.length === PAGE_SIZE$3 ? allPages.length + 1 : void 0,
|
|
583
583
|
initialPageParam: 1,
|
|
584
|
-
enabled: !fetchPortalProducts
|
|
584
|
+
enabled: !fetchPortalProducts && !!client
|
|
585
585
|
});
|
|
586
586
|
const usePortal = !!fetchPortalProducts;
|
|
587
587
|
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage, error } = usePortal ? portalQuery : legacyQuery;
|
|
@@ -1158,8 +1158,11 @@ function ProductDetailScreen({ productId, countryCode, fetchProduct: fetchPortal
|
|
|
1158
1158
|
});
|
|
1159
1159
|
const { data: legacyProductResponse, isLoading: isLoadingLegacyProduct } = (0, _tanstack_react_query.useQuery)({
|
|
1160
1160
|
queryKey: ["product", productId],
|
|
1161
|
-
queryFn: () =>
|
|
1162
|
-
|
|
1161
|
+
queryFn: () => {
|
|
1162
|
+
if (!client) throw new Error("Unreachable: client is null");
|
|
1163
|
+
return getProduct(client, productId, { country_code: countryCode });
|
|
1164
|
+
},
|
|
1165
|
+
enabled: !fetchPortalProduct && !!client
|
|
1163
1166
|
});
|
|
1164
1167
|
const isLoadingProduct = fetchPortalProduct ? isLoadingPortalProduct : isLoadingLegacyProduct;
|
|
1165
1168
|
const { data: productMediaResponse, isLoading: isLoadingMedia, error: mediaError } = (0, _tanstack_react_query.useQuery)({
|
|
@@ -8867,36 +8870,6 @@ function ProductsApp({ countryCode, companyLogoUrl, fetchProducts, fetchProduct,
|
|
|
8867
8870
|
});
|
|
8868
8871
|
}
|
|
8869
8872
|
//#endregion
|
|
8870
|
-
//#region src/account/use-account-clients.ts
|
|
8871
|
-
/**
|
|
8872
|
-
* Ensures baseUrl ends with /api.
|
|
8873
|
-
* Uncovered endpoints (e.g. /countries, points ledgers) use paths without the
|
|
8874
|
-
* /api prefix, so the base URL must include it.
|
|
8875
|
-
*/
|
|
8876
|
-
function withApiPrefix(baseUrl) {
|
|
8877
|
-
const base = baseUrl.replace(/\/+$/, "");
|
|
8878
|
-
return base.endsWith("/api") ? base : `${base}/api`;
|
|
8879
|
-
}
|
|
8880
|
-
/**
|
|
8881
|
-
* Generic SDK fetch client for endpoints not covered by domain-specific clients
|
|
8882
|
-
* (e.g. /countries, /v202506/customers/:id/points_ledgers).
|
|
8883
|
-
*
|
|
8884
|
-
* **Documented exception to the `usePortalTenantClient()` rule.**
|
|
8885
|
-
* This client requires `/api` in the base URL because its consumers
|
|
8886
|
-
* (products-api-client, shareables-core) call paths like `/company/v1/products`
|
|
8887
|
-
* and `/user_companies/:id/favorites/toggle.json` that are served under the
|
|
8888
|
-
* `/api` prefix. The shared portal-tenant client intentionally omits `/api`
|
|
8889
|
-
* because generated BFF namespace functions already include it in their paths.
|
|
8890
|
-
*/
|
|
8891
|
-
function useSdkClient() {
|
|
8892
|
-
const { config } = require_FluidProvider.useFluidContext();
|
|
8893
|
-
return (0, react.useMemo)(() => require_FluidProvider.createFetchClient({
|
|
8894
|
-
baseUrl: withApiPrefix(config.baseUrl),
|
|
8895
|
-
onAuthError: config.onAuthError,
|
|
8896
|
-
credentials: "include"
|
|
8897
|
-
}), [config.baseUrl, config.onAuthError]);
|
|
8898
|
-
}
|
|
8899
|
-
//#endregion
|
|
8900
8873
|
//#region ../../api-clients/portal-tenant-content/src/namespaces/portal_tenant_content.ts
|
|
8901
8874
|
/**
|
|
8902
8875
|
* List media (own uploads and company media)
|
|
@@ -9132,11 +9105,7 @@ async function dam_assets_discard(client, code) {
|
|
|
9132
9105
|
return client.patch(`/api/content/dam/assets/${code}/discard`);
|
|
9133
9106
|
}
|
|
9134
9107
|
//#endregion
|
|
9135
|
-
//#region
|
|
9136
|
-
/**
|
|
9137
|
-
* Maps a BFF media object to the port's Media shape, providing defaults
|
|
9138
|
-
* for optional fields returned by the generated client.
|
|
9139
|
-
*/
|
|
9108
|
+
//#region src/adapters/shareables-api-adapter.ts
|
|
9140
9109
|
function mapMedia(raw) {
|
|
9141
9110
|
return {
|
|
9142
9111
|
id: raw.id ?? 0,
|
|
@@ -9150,10 +9119,7 @@ function mapMedia(raw) {
|
|
|
9150
9119
|
updated_at: raw.updated_at ?? ""
|
|
9151
9120
|
};
|
|
9152
9121
|
}
|
|
9153
|
-
|
|
9154
|
-
* Maps the BFF meta envelope to the port's ApiMeta shape.
|
|
9155
|
-
*/
|
|
9156
|
-
function mapMeta$3(raw) {
|
|
9122
|
+
function mapMediaMeta(raw) {
|
|
9157
9123
|
return {
|
|
9158
9124
|
request_id: raw?.request_id ?? null,
|
|
9159
9125
|
timestamp: raw?.timestamp ?? "",
|
|
@@ -9167,10 +9133,6 @@ function mapMeta$3(raw) {
|
|
|
9167
9133
|
}
|
|
9168
9134
|
/**
|
|
9169
9135
|
* Creates a ContentMediaApi adapter backed by the portal-tenant content BFF.
|
|
9170
|
-
*
|
|
9171
|
-
* Maps the generated portal-tenant-content namespace functions to the abstract
|
|
9172
|
-
* ContentMediaApi port, closing over the FetchClient so consumers don't need
|
|
9173
|
-
* to pass it per-call.
|
|
9174
9136
|
*/
|
|
9175
9137
|
function createPortalTenantMediaAdapter(client) {
|
|
9176
9138
|
return {
|
|
@@ -9184,47 +9146,47 @@ function createPortalTenantMediaAdapter(client) {
|
|
|
9184
9146
|
});
|
|
9185
9147
|
return {
|
|
9186
9148
|
media: (response.media ?? []).map(mapMedia),
|
|
9187
|
-
meta:
|
|
9149
|
+
meta: mapMediaMeta(response.meta)
|
|
9188
9150
|
};
|
|
9189
9151
|
},
|
|
9190
9152
|
createMedia: async (body) => {
|
|
9191
9153
|
const response = await media_create(client, { media: body });
|
|
9192
9154
|
return {
|
|
9193
9155
|
media: mapMedia(response.media ?? {}),
|
|
9194
|
-
meta:
|
|
9156
|
+
meta: mapMediaMeta(response.meta)
|
|
9195
9157
|
};
|
|
9196
9158
|
},
|
|
9197
9159
|
getMedia: async (id) => {
|
|
9198
9160
|
const response = await media_show(client, id);
|
|
9199
9161
|
return {
|
|
9200
9162
|
media: mapMedia(response.media ?? {}),
|
|
9201
|
-
meta:
|
|
9163
|
+
meta: mapMediaMeta(response.meta)
|
|
9202
9164
|
};
|
|
9203
9165
|
},
|
|
9204
9166
|
updateMedia: async (id, body) => {
|
|
9205
9167
|
const response = await media_update(client, id, { media: body });
|
|
9206
9168
|
return {
|
|
9207
9169
|
media: mapMedia(response.media ?? {}),
|
|
9208
|
-
meta:
|
|
9170
|
+
meta: mapMediaMeta(response.meta)
|
|
9209
9171
|
};
|
|
9210
9172
|
},
|
|
9211
9173
|
deleteMedia: async (id) => {
|
|
9212
9174
|
const response = await media_destroy(client, id);
|
|
9213
9175
|
return {
|
|
9214
9176
|
media: { id: response.media?.id ?? 0 },
|
|
9215
|
-
meta:
|
|
9177
|
+
meta: mapMediaMeta(response.meta)
|
|
9216
9178
|
};
|
|
9217
9179
|
}
|
|
9218
9180
|
};
|
|
9219
9181
|
}
|
|
9220
|
-
function mediaKindFromType
|
|
9182
|
+
function mediaKindFromType(mediaType) {
|
|
9221
9183
|
if (mediaType === "video") return "video";
|
|
9222
9184
|
if (mediaType === "image") return "image";
|
|
9223
9185
|
if (mediaType === "document" || mediaType === "pdf") return "pdf";
|
|
9224
9186
|
return null;
|
|
9225
9187
|
}
|
|
9226
9188
|
function toBffMediumResponse(bff) {
|
|
9227
|
-
const kind = mediaKindFromType
|
|
9189
|
+
const kind = mediaKindFromType(bff.media_type);
|
|
9228
9190
|
const isVideo = bff.media_type === "video";
|
|
9229
9191
|
const isPdf = bff.media_type === "pdf" || bff.media_type === "document";
|
|
9230
9192
|
return {
|
|
@@ -9342,11 +9304,6 @@ function createPortalTenantMediaShareablesAdapter(client) {
|
|
|
9342
9304
|
}
|
|
9343
9305
|
};
|
|
9344
9306
|
}
|
|
9345
|
-
//#endregion
|
|
9346
|
-
//#region ../../shareables/api-client/src/portal-tenant-playlists-adapter.ts
|
|
9347
|
-
/**
|
|
9348
|
-
* Maps a BFF playlist object to the port's Playlist shape.
|
|
9349
|
-
*/
|
|
9350
9307
|
function mapPlaylist(raw) {
|
|
9351
9308
|
return {
|
|
9352
9309
|
id: raw.id ?? 0,
|
|
@@ -9360,9 +9317,6 @@ function mapPlaylist(raw) {
|
|
|
9360
9317
|
updated_at: raw.updated_at ?? ""
|
|
9361
9318
|
};
|
|
9362
9319
|
}
|
|
9363
|
-
/**
|
|
9364
|
-
* Maps a BFF playlist item to the port's PlaylistItem shape.
|
|
9365
|
-
*/
|
|
9366
9320
|
function mapPlaylistItem(raw) {
|
|
9367
9321
|
return {
|
|
9368
9322
|
id: raw.id ?? 0,
|
|
@@ -9376,10 +9330,7 @@ function mapPlaylistItem(raw) {
|
|
|
9376
9330
|
created_at: raw.created_at ?? ""
|
|
9377
9331
|
};
|
|
9378
9332
|
}
|
|
9379
|
-
|
|
9380
|
-
* Maps the BFF meta envelope to the port's ApiMeta shape.
|
|
9381
|
-
*/
|
|
9382
|
-
function mapMeta$2(raw) {
|
|
9333
|
+
function mapPlaylistsMeta(raw) {
|
|
9383
9334
|
return {
|
|
9384
9335
|
request_id: raw?.request_id ?? null,
|
|
9385
9336
|
timestamp: raw?.timestamp ?? "",
|
|
@@ -9393,10 +9344,6 @@ function mapMeta$2(raw) {
|
|
|
9393
9344
|
}
|
|
9394
9345
|
/**
|
|
9395
9346
|
* Creates a ContentPlaylistsApi adapter backed by the portal-tenant content BFF.
|
|
9396
|
-
*
|
|
9397
|
-
* Maps the generated portal-tenant-content namespace functions to the abstract
|
|
9398
|
-
* ContentPlaylistsApi port, closing over the FetchClient so consumers don't
|
|
9399
|
-
* need to pass it per-call.
|
|
9400
9347
|
*/
|
|
9401
9348
|
function createPortalTenantPlaylistsAdapter(client) {
|
|
9402
9349
|
return {
|
|
@@ -9409,35 +9356,35 @@ function createPortalTenantPlaylistsAdapter(client) {
|
|
|
9409
9356
|
});
|
|
9410
9357
|
return {
|
|
9411
9358
|
playlists: (response.playlists ?? []).map(mapPlaylist),
|
|
9412
|
-
meta:
|
|
9359
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9413
9360
|
};
|
|
9414
9361
|
},
|
|
9415
9362
|
createPlaylist: async (body) => {
|
|
9416
9363
|
const response = await playlists_create(client, { playlist: body });
|
|
9417
9364
|
return {
|
|
9418
9365
|
playlist: mapPlaylist(response.playlist ?? {}),
|
|
9419
|
-
meta:
|
|
9366
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9420
9367
|
};
|
|
9421
9368
|
},
|
|
9422
9369
|
getPlaylist: async (id) => {
|
|
9423
9370
|
const response = await playlists_show(client, id);
|
|
9424
9371
|
return {
|
|
9425
9372
|
playlist: mapPlaylist(response.playlist ?? {}),
|
|
9426
|
-
meta:
|
|
9373
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9427
9374
|
};
|
|
9428
9375
|
},
|
|
9429
9376
|
updatePlaylist: async (id, body) => {
|
|
9430
9377
|
const response = await playlists_update(client, id, { playlist: body });
|
|
9431
9378
|
return {
|
|
9432
9379
|
playlist: mapPlaylist(response.playlist ?? {}),
|
|
9433
|
-
meta:
|
|
9380
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9434
9381
|
};
|
|
9435
9382
|
},
|
|
9436
9383
|
deletePlaylist: async (id) => {
|
|
9437
9384
|
const response = await playlists_destroy(client, id);
|
|
9438
9385
|
return {
|
|
9439
9386
|
playlist: { id: response.playlist?.id ?? 0 },
|
|
9440
|
-
meta:
|
|
9387
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9441
9388
|
};
|
|
9442
9389
|
},
|
|
9443
9390
|
listPlaylistItems: async (playlistId, params) => {
|
|
@@ -9447,31 +9394,25 @@ function createPortalTenantPlaylistsAdapter(client) {
|
|
|
9447
9394
|
});
|
|
9448
9395
|
return {
|
|
9449
9396
|
playlist_items: (response.playlist_items ?? []).map(mapPlaylistItem),
|
|
9450
|
-
meta:
|
|
9397
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9451
9398
|
};
|
|
9452
9399
|
},
|
|
9453
9400
|
addPlaylistItem: async (playlistId, body) => {
|
|
9454
9401
|
const response = await playlists_items_add(client, playlistId, { item: body });
|
|
9455
9402
|
return {
|
|
9456
9403
|
playlist_item: mapPlaylistItem(response.playlist_item ?? {}),
|
|
9457
|
-
meta:
|
|
9404
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9458
9405
|
};
|
|
9459
9406
|
},
|
|
9460
9407
|
removePlaylistItem: async (playlistId, itemId) => {
|
|
9461
9408
|
const response = await playlists_items_remove(client, playlistId, itemId);
|
|
9462
9409
|
return {
|
|
9463
9410
|
playlist_item: { id: response.playlist_item?.id ?? 0 },
|
|
9464
|
-
meta:
|
|
9411
|
+
meta: mapPlaylistsMeta(response.meta)
|
|
9465
9412
|
};
|
|
9466
9413
|
}
|
|
9467
9414
|
};
|
|
9468
9415
|
}
|
|
9469
|
-
function mediaKindFromType(mediaType) {
|
|
9470
|
-
if (mediaType === "video") return "video";
|
|
9471
|
-
if (mediaType === "image") return "image";
|
|
9472
|
-
if (mediaType === "document" || mediaType === "pdf") return "pdf";
|
|
9473
|
-
return null;
|
|
9474
|
-
}
|
|
9475
9416
|
function toBffPlaylist(bff, items) {
|
|
9476
9417
|
return {
|
|
9477
9418
|
id: bff.id,
|
|
@@ -9596,11 +9537,80 @@ function createPortalTenantPlaylistsShareablesAdapter(client) {
|
|
|
9596
9537
|
}
|
|
9597
9538
|
};
|
|
9598
9539
|
}
|
|
9599
|
-
|
|
9600
|
-
|
|
9540
|
+
function isShareableType(value) {
|
|
9541
|
+
return value === "media" || value === "product" || value === "library" || value === "page";
|
|
9542
|
+
}
|
|
9543
|
+
function mapShare(raw) {
|
|
9544
|
+
return {
|
|
9545
|
+
id: raw.id ?? 0,
|
|
9546
|
+
url: raw.url ?? "",
|
|
9547
|
+
shareable_type: isShareableType(raw.shareable_type) ? raw.shareable_type : "media",
|
|
9548
|
+
shareable_id: raw.shareable_id ?? 0,
|
|
9549
|
+
created_at: raw.created_at ?? ""
|
|
9550
|
+
};
|
|
9551
|
+
}
|
|
9552
|
+
function mapSharesMeta(raw) {
|
|
9553
|
+
return {
|
|
9554
|
+
request_id: raw?.request_id ?? null,
|
|
9555
|
+
timestamp: raw?.timestamp ?? "",
|
|
9556
|
+
pagination: raw?.pagination ? {
|
|
9557
|
+
cursor: raw.pagination.cursor ?? null,
|
|
9558
|
+
limit: raw.pagination.limit,
|
|
9559
|
+
next_cursor: raw.pagination.next_cursor ?? null,
|
|
9560
|
+
prev_cursor: raw.pagination.prev_cursor ?? null
|
|
9561
|
+
} : void 0
|
|
9562
|
+
};
|
|
9563
|
+
}
|
|
9564
|
+
/**
|
|
9565
|
+
* Creates a ContentSharesApi adapter backed by the portal-tenant content BFF.
|
|
9566
|
+
*/
|
|
9567
|
+
function createPortalTenantSharesAdapter(client) {
|
|
9568
|
+
return {
|
|
9569
|
+
listShares: async (params) => {
|
|
9570
|
+
const response = await shares_list(client, {
|
|
9571
|
+
"page[cursor]": params?.cursor,
|
|
9572
|
+
"page[limit]": params?.limit
|
|
9573
|
+
});
|
|
9574
|
+
return {
|
|
9575
|
+
shares: (response.shares ?? []).map(mapShare),
|
|
9576
|
+
meta: mapSharesMeta(response.meta)
|
|
9577
|
+
};
|
|
9578
|
+
},
|
|
9579
|
+
createShare: async (body) => {
|
|
9580
|
+
const response = await shares_create(client, { share: body });
|
|
9581
|
+
return {
|
|
9582
|
+
share: mapShare(response.share ?? {}),
|
|
9583
|
+
meta: mapSharesMeta(response.meta)
|
|
9584
|
+
};
|
|
9585
|
+
}
|
|
9586
|
+
};
|
|
9587
|
+
}
|
|
9588
|
+
const SHAREABLE_TYPE_MAP = {
|
|
9589
|
+
Medium: "media",
|
|
9590
|
+
media: "media",
|
|
9591
|
+
Product: "product",
|
|
9592
|
+
product: "product",
|
|
9593
|
+
Library: "library",
|
|
9594
|
+
library: "library",
|
|
9595
|
+
Page: "page",
|
|
9596
|
+
page: "page"
|
|
9597
|
+
};
|
|
9601
9598
|
/**
|
|
9602
|
-
*
|
|
9599
|
+
* Creates a ShareablesApi["share"]-compatible adapter backed by the
|
|
9600
|
+
* portal-tenant content BFF. Maps legacy model names to BFF shareable types.
|
|
9603
9601
|
*/
|
|
9602
|
+
function createPortalTenantSharesShareablesAdapter(client) {
|
|
9603
|
+
const portAdapter = createPortalTenantSharesAdapter(client);
|
|
9604
|
+
return { createShareLink: async (input) => {
|
|
9605
|
+
if (!input.relateableId) throw new Error("Cannot create share link without a relateableId");
|
|
9606
|
+
const shareableType = SHAREABLE_TYPE_MAP[input.relateableType];
|
|
9607
|
+
if (!shareableType) throw new Error(`Unknown shareable type: "${input.relateableType}"`);
|
|
9608
|
+
return (await portAdapter.createShare({
|
|
9609
|
+
shareable_type: shareableType,
|
|
9610
|
+
shareable_id: input.relateableId
|
|
9611
|
+
})).share.url;
|
|
9612
|
+
} };
|
|
9613
|
+
}
|
|
9604
9614
|
function mapDamAsset(raw) {
|
|
9605
9615
|
return {
|
|
9606
9616
|
id: raw.id ?? 0,
|
|
@@ -9616,9 +9626,6 @@ function mapDamAsset(raw) {
|
|
|
9616
9626
|
updated_at: raw.updated_at ?? ""
|
|
9617
9627
|
};
|
|
9618
9628
|
}
|
|
9619
|
-
/**
|
|
9620
|
-
* Maps a BFF DAM asset path to the port's DamAssetPath shape.
|
|
9621
|
-
*/
|
|
9622
9629
|
function mapDamAssetPath(raw) {
|
|
9623
9630
|
return {
|
|
9624
9631
|
id: raw.id ?? 0,
|
|
@@ -9627,10 +9634,7 @@ function mapDamAssetPath(raw) {
|
|
|
9627
9634
|
created_at: raw.created_at ?? ""
|
|
9628
9635
|
};
|
|
9629
9636
|
}
|
|
9630
|
-
|
|
9631
|
-
* Maps the BFF meta envelope to the port's ApiMeta shape.
|
|
9632
|
-
*/
|
|
9633
|
-
function mapMeta$1(raw) {
|
|
9637
|
+
function mapDamAssetsMeta(raw) {
|
|
9634
9638
|
return {
|
|
9635
9639
|
request_id: raw?.request_id ?? null,
|
|
9636
9640
|
timestamp: raw?.timestamp ?? "",
|
|
@@ -9644,10 +9648,6 @@ function mapMeta$1(raw) {
|
|
|
9644
9648
|
}
|
|
9645
9649
|
/**
|
|
9646
9650
|
* Creates a ContentDamAssetsApi adapter backed by the portal-tenant content BFF.
|
|
9647
|
-
*
|
|
9648
|
-
* Maps the generated portal-tenant-content namespace functions to the abstract
|
|
9649
|
-
* ContentDamAssetsApi port, closing over the FetchClient so consumers don't
|
|
9650
|
-
* need to pass it per-call.
|
|
9651
9651
|
*/
|
|
9652
9652
|
function createPortalTenantDamAssetsAdapter(client) {
|
|
9653
9653
|
return {
|
|
@@ -9658,14 +9658,14 @@ function createPortalTenantDamAssetsAdapter(client) {
|
|
|
9658
9658
|
});
|
|
9659
9659
|
return {
|
|
9660
9660
|
assets: (response.assets ?? []).map(mapDamAsset),
|
|
9661
|
-
meta:
|
|
9661
|
+
meta: mapDamAssetsMeta(response.meta)
|
|
9662
9662
|
};
|
|
9663
9663
|
},
|
|
9664
9664
|
createAsset: async (body) => {
|
|
9665
9665
|
const response = await dam_assets_create(client, { asset: body });
|
|
9666
9666
|
return {
|
|
9667
9667
|
asset: mapDamAsset(response.asset ?? {}),
|
|
9668
|
-
meta:
|
|
9668
|
+
meta: mapDamAssetsMeta(response.meta)
|
|
9669
9669
|
};
|
|
9670
9670
|
},
|
|
9671
9671
|
listAssetPaths: async (assetCode, params) => {
|
|
@@ -9675,14 +9675,14 @@ function createPortalTenantDamAssetsAdapter(client) {
|
|
|
9675
9675
|
});
|
|
9676
9676
|
return {
|
|
9677
9677
|
asset_paths: (response.asset_paths ?? []).map(mapDamAssetPath),
|
|
9678
|
-
meta:
|
|
9678
|
+
meta: mapDamAssetsMeta(response.meta)
|
|
9679
9679
|
};
|
|
9680
9680
|
},
|
|
9681
9681
|
createAssetPath: async (assetCode, body) => {
|
|
9682
9682
|
const response = await dam_asset_paths_create(client, assetCode, { asset_path: body });
|
|
9683
9683
|
return {
|
|
9684
9684
|
asset_path: mapDamAssetPath(response.asset_path ?? {}),
|
|
9685
|
-
meta:
|
|
9685
|
+
meta: mapDamAssetsMeta(response.meta)
|
|
9686
9686
|
};
|
|
9687
9687
|
}
|
|
9688
9688
|
};
|
|
@@ -9733,100 +9733,6 @@ function createPortalTenantFilesShareablesAdapter(client) {
|
|
|
9733
9733
|
};
|
|
9734
9734
|
} };
|
|
9735
9735
|
}
|
|
9736
|
-
//#endregion
|
|
9737
|
-
//#region ../../shareables/api-client/src/portal-tenant-shares-adapter.ts
|
|
9738
|
-
/**
|
|
9739
|
-
* Narrows an unknown string to a valid ShareableType at runtime.
|
|
9740
|
-
*/
|
|
9741
|
-
function isShareableType(value) {
|
|
9742
|
-
return value === "media" || value === "product" || value === "library" || value === "page";
|
|
9743
|
-
}
|
|
9744
|
-
/**
|
|
9745
|
-
* Maps a BFF share to the port's Share shape.
|
|
9746
|
-
*/
|
|
9747
|
-
function mapShare(raw) {
|
|
9748
|
-
return {
|
|
9749
|
-
id: raw.id ?? 0,
|
|
9750
|
-
url: raw.url ?? "",
|
|
9751
|
-
shareable_type: isShareableType(raw.shareable_type) ? raw.shareable_type : "media",
|
|
9752
|
-
shareable_id: raw.shareable_id ?? 0,
|
|
9753
|
-
created_at: raw.created_at ?? ""
|
|
9754
|
-
};
|
|
9755
|
-
}
|
|
9756
|
-
/**
|
|
9757
|
-
* Maps the BFF meta envelope to the port's ApiMeta shape.
|
|
9758
|
-
*/
|
|
9759
|
-
function mapMeta(raw) {
|
|
9760
|
-
return {
|
|
9761
|
-
request_id: raw?.request_id ?? null,
|
|
9762
|
-
timestamp: raw?.timestamp ?? "",
|
|
9763
|
-
pagination: raw?.pagination ? {
|
|
9764
|
-
cursor: raw.pagination.cursor ?? null,
|
|
9765
|
-
limit: raw.pagination.limit,
|
|
9766
|
-
next_cursor: raw.pagination.next_cursor ?? null,
|
|
9767
|
-
prev_cursor: raw.pagination.prev_cursor ?? null
|
|
9768
|
-
} : void 0
|
|
9769
|
-
};
|
|
9770
|
-
}
|
|
9771
|
-
/**
|
|
9772
|
-
* Creates a ContentSharesApi adapter backed by the portal-tenant content BFF.
|
|
9773
|
-
*
|
|
9774
|
-
* Maps the generated portal-tenant-content namespace functions to the abstract
|
|
9775
|
-
* ContentSharesApi port, closing over the FetchClient so consumers don't need
|
|
9776
|
-
* to pass it per-call.
|
|
9777
|
-
*/
|
|
9778
|
-
function createPortalTenantSharesAdapter(client) {
|
|
9779
|
-
return {
|
|
9780
|
-
listShares: async (params) => {
|
|
9781
|
-
const response = await shares_list(client, {
|
|
9782
|
-
"page[cursor]": params?.cursor,
|
|
9783
|
-
"page[limit]": params?.limit
|
|
9784
|
-
});
|
|
9785
|
-
return {
|
|
9786
|
-
shares: (response.shares ?? []).map(mapShare),
|
|
9787
|
-
meta: mapMeta(response.meta)
|
|
9788
|
-
};
|
|
9789
|
-
},
|
|
9790
|
-
createShare: async (body) => {
|
|
9791
|
-
const response = await shares_create(client, { share: body });
|
|
9792
|
-
return {
|
|
9793
|
-
share: mapShare(response.share ?? {}),
|
|
9794
|
-
meta: mapMeta(response.meta)
|
|
9795
|
-
};
|
|
9796
|
-
}
|
|
9797
|
-
};
|
|
9798
|
-
}
|
|
9799
|
-
/**
|
|
9800
|
-
* Maps legacy Rails model names (used by the UI) to BFF shareable_type values.
|
|
9801
|
-
*/
|
|
9802
|
-
const SHAREABLE_TYPE_MAP = {
|
|
9803
|
-
Medium: "media",
|
|
9804
|
-
media: "media",
|
|
9805
|
-
Product: "product",
|
|
9806
|
-
product: "product",
|
|
9807
|
-
Library: "library",
|
|
9808
|
-
library: "library",
|
|
9809
|
-
Page: "page",
|
|
9810
|
-
page: "page"
|
|
9811
|
-
};
|
|
9812
|
-
/**
|
|
9813
|
-
* Creates a ShareablesApi["share"]-compatible adapter backed by the
|
|
9814
|
-
* portal-tenant content BFF. Maps legacy model names to BFF shareable types.
|
|
9815
|
-
*/
|
|
9816
|
-
function createPortalTenantSharesShareablesAdapter(client) {
|
|
9817
|
-
const portAdapter = createPortalTenantSharesAdapter(client);
|
|
9818
|
-
return { createShareLink: async (input) => {
|
|
9819
|
-
if (!input.relateableId) throw new Error("Cannot create share link without a relateableId");
|
|
9820
|
-
const shareableType = SHAREABLE_TYPE_MAP[input.relateableType];
|
|
9821
|
-
if (!shareableType) throw new Error(`Unknown shareable type: "${input.relateableType}"`);
|
|
9822
|
-
return (await portAdapter.createShare({
|
|
9823
|
-
shareable_type: shareableType,
|
|
9824
|
-
shareable_id: input.relateableId
|
|
9825
|
-
})).share.url;
|
|
9826
|
-
} };
|
|
9827
|
-
}
|
|
9828
|
-
//#endregion
|
|
9829
|
-
//#region ../../shareables/api-client/src/portal-tenant-product-media-adapter.ts
|
|
9830
9736
|
function mapProductMedia(raw) {
|
|
9831
9737
|
const isVideo = raw.media_type === "video";
|
|
9832
9738
|
const isPdf = raw.media_type === "pdf" || raw.media_type === "document";
|
|
@@ -9954,11 +9860,5 @@ Object.defineProperty(exports, "usePortalShareablesApi", {
|
|
|
9954
9860
|
return usePortalShareablesApi;
|
|
9955
9861
|
}
|
|
9956
9862
|
});
|
|
9957
|
-
Object.defineProperty(exports, "useSdkClient", {
|
|
9958
|
-
enumerable: true,
|
|
9959
|
-
get: function() {
|
|
9960
|
-
return useSdkClient;
|
|
9961
|
-
}
|
|
9962
|
-
});
|
|
9963
9863
|
|
|
9964
|
-
//# sourceMappingURL=use-portal-shareables-api-
|
|
9864
|
+
//# sourceMappingURL=use-portal-shareables-api-MBl0d0eQ.cjs.map
|