@fluid-app/portal-sdk 0.1.89 → 0.1.91
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/{AppDownloadScreen--gGSPUDm.cjs → AppDownloadScreen-BtvcE4pE.cjs} +2 -2
- package/dist/{AppDownloadScreen--gGSPUDm.cjs.map → AppDownloadScreen-BtvcE4pE.cjs.map} +1 -1
- package/dist/{AppDownloadScreen-CDMvuvsQ.cjs → AppDownloadScreen-Dx2nilnX.cjs} +3 -3
- package/dist/{AppDownloadScreen-Bt--8jSo.mjs → AppDownloadScreen-RX8GSAyq.mjs} +2 -2
- package/dist/{AppDownloadScreen-Bt--8jSo.mjs.map → AppDownloadScreen-RX8GSAyq.mjs.map} +1 -1
- package/dist/{ContactsScreen-BZOjocjS.cjs → ContactsScreen-CKMZIQlF.cjs} +3 -3
- package/dist/{ContactsScreen-21VYWIsO.mjs → ContactsScreen-DOz11uQ_.mjs} +2 -2
- package/dist/{ContactsScreen-21VYWIsO.mjs.map → ContactsScreen-DOz11uQ_.mjs.map} +1 -1
- package/dist/{ContactsScreen-DH3K85c6.cjs → ContactsScreen-DttcI388.cjs} +2 -2
- package/dist/{ContactsScreen-DH3K85c6.cjs.map → ContactsScreen-DttcI388.cjs.map} +1 -1
- package/dist/{FluidProvider-CRiIzR8g.mjs → FluidProvider-Eohedipr.mjs} +3 -3
- package/dist/{FluidProvider-CRiIzR8g.mjs.map → FluidProvider-Eohedipr.mjs.map} +1 -1
- package/dist/{FluidProvider-Cwh9D2D_.cjs → FluidProvider-Sc51VlLw.cjs} +3 -3
- package/dist/{FluidProvider-Cwh9D2D_.cjs.map → FluidProvider-Sc51VlLw.cjs.map} +1 -1
- package/dist/{MessagingScreen-68mp7aIc.mjs → MessagingScreen-CMxjIURw.mjs} +3 -3
- package/dist/{MessagingScreen-68mp7aIc.mjs.map → MessagingScreen-CMxjIURw.mjs.map} +1 -1
- package/dist/{MessagingScreen-BIFFfpwv.cjs → MessagingScreen-CdHBUykK.cjs} +3 -3
- package/dist/{MessagingScreen-DbXef2ee.mjs → MessagingScreen-Cx0bbvfs.mjs} +3 -3
- package/dist/{MessagingScreen-Cljq2xIQ.cjs → MessagingScreen-r67FUDf1.cjs} +3 -3
- package/dist/{MessagingScreen-Cljq2xIQ.cjs.map → MessagingScreen-r67FUDf1.cjs.map} +1 -1
- package/dist/{MySiteScreen-D5yvFmK3.cjs → MySiteScreen-8lZTZzo0.cjs} +4 -4
- package/dist/{MySiteScreen-YujACNSf.mjs → MySiteScreen-BhdmPFar.mjs} +3 -3
- package/dist/{MySiteScreen-YujACNSf.mjs.map → MySiteScreen-BhdmPFar.mjs.map} +1 -1
- package/dist/{MySiteScreen-C4Ut8wxE.cjs → MySiteScreen-Cy7HpS3z.cjs} +3 -3
- package/dist/{MySiteScreen-C4Ut8wxE.cjs.map → MySiteScreen-Cy7HpS3z.cjs.map} +1 -1
- package/dist/{NestedWidget-zn_USrld.cjs → NestedWidget-BXbQcApb.cjs} +1 -1
- package/dist/{NestedWidget-L8ppxJib.mjs → NestedWidget-CzSHHhEl.mjs} +2 -2
- package/dist/NestedWidget-CzSHHhEl.mjs.map +1 -0
- package/dist/{NestedWidget-BGY4LSQq.cjs → NestedWidget-iootjKIl.cjs} +2 -2
- package/dist/NestedWidget-iootjKIl.cjs.map +1 -0
- package/dist/{OrdersScreen-CPJX2XiN.cjs → OrdersScreen-BaqQzT1F.cjs} +3 -3
- package/dist/{OrdersScreen-CPJX2XiN.cjs.map → OrdersScreen-BaqQzT1F.cjs.map} +1 -1
- package/dist/{OrdersScreen-BkxKQpwS.mjs → OrdersScreen-D0TnBQc5.mjs} +3 -3
- package/dist/{OrdersScreen-BkxKQpwS.mjs.map → OrdersScreen-D0TnBQc5.mjs.map} +1 -1
- package/dist/{OrdersScreen-BiuWTsM3.cjs → OrdersScreen-DCOzHNIy.cjs} +3 -3
- package/dist/{ProductsScreen-BPgkn9BH.mjs → ProductsScreen-2pUHZJop.mjs} +17 -12
- package/dist/ProductsScreen-2pUHZJop.mjs.map +1 -0
- package/dist/{ProductsScreen-DY6tKX9Q.mjs → ProductsScreen-2tlHXemg.mjs} +5 -5
- package/dist/{ProductsScreen-DiaGPT_Q.cjs → ProductsScreen-Ch6f5P2w.cjs} +5 -5
- package/dist/{ProductsScreen-B2BS6FY_.cjs → ProductsScreen-ueEJP0MJ.cjs} +17 -12
- package/dist/ProductsScreen-ueEJP0MJ.cjs.map +1 -0
- package/dist/{ProfileScreen-DKJrpeMw.mjs → ProfileScreen-Age0TtEY.mjs} +3 -3
- package/dist/{ProfileScreen-DKJrpeMw.mjs.map → ProfileScreen-Age0TtEY.mjs.map} +1 -1
- package/dist/{ProfileScreen-ueK01fjb.cjs → ProfileScreen-C8fpr9c3.cjs} +3 -3
- package/dist/{ProfileScreen-ueK01fjb.cjs.map → ProfileScreen-C8fpr9c3.cjs.map} +1 -1
- package/dist/{ProfileScreen-C6qbR0YJ.cjs → ProfileScreen-DEtgeBnE.cjs} +3 -3
- package/dist/{ShareablesScreen-o1VYr_1K.cjs → ShareablesScreen-B6uPSvvK.cjs} +21 -16
- package/dist/ShareablesScreen-B6uPSvvK.cjs.map +1 -0
- package/dist/{ShareablesScreen-CR3YKwZC.cjs → ShareablesScreen-CoPFz5ZB.cjs} +5 -5
- package/dist/{ShareablesScreen-BrLq61Q7.mjs → ShareablesScreen-DBdNgtV1.mjs} +5 -5
- package/dist/{ShareablesScreen-4hhIcSYA.mjs → ShareablesScreen-vFbWhVGF.mjs} +21 -16
- package/dist/ShareablesScreen-vFbWhVGF.mjs.map +1 -0
- package/dist/{ShopScreen-D8z0KYfh.cjs → ShopScreen-BKBaNPsG.cjs} +5 -5
- package/dist/{ShopScreen-D8z0KYfh.cjs.map → ShopScreen-BKBaNPsG.cjs.map} +1 -1
- package/dist/{ShopScreen-CfxPQVZD.mjs → ShopScreen-D-TXRWZR.mjs} +5 -5
- package/dist/{ShopScreen-CfxPQVZD.mjs.map → ShopScreen-D-TXRWZR.mjs.map} +1 -1
- package/dist/{ShopScreen-BVABhBmJ.cjs → ShopScreen-DPZSXS99.cjs} +3 -3
- package/dist/{SubscriptionsScreen-BF4NqbpU.cjs → SubscriptionsScreen-BvS7o_XP.cjs} +3 -3
- package/dist/{SubscriptionsScreen-BF4NqbpU.cjs.map → SubscriptionsScreen-BvS7o_XP.cjs.map} +1 -1
- package/dist/{SubscriptionsScreen-BSDYjJvj.mjs → SubscriptionsScreen-CBqgpat5.mjs} +3 -3
- package/dist/{SubscriptionsScreen-BSDYjJvj.mjs.map → SubscriptionsScreen-CBqgpat5.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-BRx_ocC3.cjs → SubscriptionsScreen-IbsNz0Ki.cjs} +3 -3
- package/dist/{dist-lO2OG0T5.cjs → dist-BF_4vk1z.cjs} +1 -1
- package/dist/{dist-lO2OG0T5.cjs.map → dist-BF_4vk1z.cjs.map} +1 -1
- package/dist/index.cjs +37 -37
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +37 -37
- package/dist/{products-CjZof7c2.cjs → products-BKZ1siXg.cjs} +1 -1
- package/dist/{products-CjZof7c2.cjs.map → products-BKZ1siXg.cjs.map} +1 -1
- package/dist/{products-Dkwd_Bh0.mjs → products-DOO1TBcm.mjs} +1 -1
- package/dist/{products-Dkwd_Bh0.mjs.map → products-DOO1TBcm.mjs.map} +1 -1
- package/dist/{sortable.esm-CzzU6kIR.mjs → sortable.esm-Cz-CP2N8.mjs} +1 -1
- package/dist/{sortable.esm-CzzU6kIR.mjs.map → sortable.esm-Cz-CP2N8.mjs.map} +1 -1
- package/dist/{src-bzRRiTN4.cjs → src-BbJs882O.cjs} +58 -41
- package/dist/src-BbJs882O.cjs.map +1 -0
- package/dist/{src-p8DA1dH0.mjs → src-CN7diUEw.mjs} +102 -50
- package/dist/src-CN7diUEw.mjs.map +1 -0
- package/dist/{src-BjmyVJoe.mjs → src-Ih5vEO6p.mjs} +57 -44
- package/dist/src-Ih5vEO6p.mjs.map +1 -0
- package/dist/{src-Dt66UB0B.cjs → src-Zv3-NSUf.cjs} +103 -117
- package/dist/src-Zv3-NSUf.cjs.map +1 -0
- package/dist/{use-account-clients-Bg1xqjMk.mjs → use-account-clients-CSWgrCKK.mjs} +2 -2
- package/dist/{use-account-clients-Bg1xqjMk.mjs.map → use-account-clients-CSWgrCKK.mjs.map} +1 -1
- package/dist/{use-account-clients-BVb_nhg7.cjs → use-account-clients-DaliJYMa.cjs} +2 -2
- package/dist/{use-account-clients-BVb_nhg7.cjs.map → use-account-clients-DaliJYMa.cjs.map} +1 -1
- package/dist/{use-current-user-DFQ8gYkR.cjs → use-current-user-5erIFUd6.cjs} +3 -3
- package/dist/{use-current-user-DFQ8gYkR.cjs.map → use-current-user-5erIFUd6.cjs.map} +1 -1
- package/dist/{use-current-user-DqLNoj-3.mjs → use-current-user-BBQg1iYf.mjs} +3 -3
- package/dist/{use-current-user-DqLNoj-3.mjs.map → use-current-user-BBQg1iYf.mjs.map} +1 -1
- package/dist/{use-customer-account-CY9HqWvJ.mjs → use-customer-account-CRYpHpFM.mjs} +3 -3
- package/dist/{use-customer-account-CY9HqWvJ.mjs.map → use-customer-account-CRYpHpFM.mjs.map} +1 -1
- package/dist/{use-customer-account-D599KeSp.cjs → use-customer-account-Dzdps4By.cjs} +3 -3
- package/dist/{use-customer-account-D599KeSp.cjs.map → use-customer-account-Dzdps4By.cjs.map} +1 -1
- package/dist/{use-fluid-api-DHF7svon.cjs → use-fluid-api-BUitsoDu.cjs} +2 -2
- package/dist/{use-fluid-api-DHF7svon.cjs.map → use-fluid-api-BUitsoDu.cjs.map} +1 -1
- package/dist/{use-fluid-api-CyK8Yoj-.mjs → use-fluid-api-C5ZLs2TP.mjs} +2 -2
- package/dist/{use-fluid-api-CyK8Yoj-.mjs.map → use-fluid-api-C5ZLs2TP.mjs.map} +1 -1
- package/package.json +15 -15
- package/dist/NestedWidget-BGY4LSQq.cjs.map +0 -1
- package/dist/NestedWidget-L8ppxJib.mjs.map +0 -1
- package/dist/ProductsScreen-B2BS6FY_.cjs.map +0 -1
- package/dist/ProductsScreen-BPgkn9BH.mjs.map +0 -1
- package/dist/ShareablesScreen-4hhIcSYA.mjs.map +0 -1
- package/dist/ShareablesScreen-o1VYr_1K.cjs.map +0 -1
- package/dist/src-BjmyVJoe.mjs.map +0 -1
- package/dist/src-Dt66UB0B.cjs.map +0 -1
- package/dist/src-bzRRiTN4.cjs.map +0 -1
- package/dist/src-p8DA1dH0.mjs.map +0 -1
|
@@ -1,52 +1,4 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-ByhMGyNw.mjs";
|
|
2
|
-
//#region ../../shareables/api-client/src/namespaces/playlists.ts
|
|
3
|
-
var playlists_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
-
addItemToPlaylist: () => addItemToPlaylist,
|
|
5
|
-
createPlaylist: () => createPlaylist,
|
|
6
|
-
deletePlaylist: () => deletePlaylist,
|
|
7
|
-
deletePlaylistItem: () => deletePlaylistItem,
|
|
8
|
-
deletePlaylists: () => deletePlaylists,
|
|
9
|
-
getPlaylistById: () => getPlaylistById,
|
|
10
|
-
getPlaylists: () => getPlaylists,
|
|
11
|
-
removeItemsFromPlaylist: () => removeItemsFromPlaylist,
|
|
12
|
-
updatePlaylist: () => updatePlaylist
|
|
13
|
-
});
|
|
14
|
-
const PLAYLISTS_URL = "/v2025-06/playlists";
|
|
15
|
-
async function getPlaylists(client, options) {
|
|
16
|
-
const input = options ? Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0)) : void 0;
|
|
17
|
-
return client.get(PLAYLISTS_URL, input);
|
|
18
|
-
}
|
|
19
|
-
async function getPlaylistById(client, id) {
|
|
20
|
-
return client.get(`${PLAYLISTS_URL}/${id}`);
|
|
21
|
-
}
|
|
22
|
-
async function createPlaylist(client, data) {
|
|
23
|
-
return client.post(PLAYLISTS_URL, data);
|
|
24
|
-
}
|
|
25
|
-
async function updatePlaylist(client, id, data) {
|
|
26
|
-
return client.patch(`${PLAYLISTS_URL}/${id}`, data);
|
|
27
|
-
}
|
|
28
|
-
async function addItemToPlaylist(client, id, data) {
|
|
29
|
-
return client.post(`${PLAYLISTS_URL}/${id}/items`, data);
|
|
30
|
-
}
|
|
31
|
-
async function deletePlaylist(client, id) {
|
|
32
|
-
return client.delete(`${PLAYLISTS_URL}/${id}`);
|
|
33
|
-
}
|
|
34
|
-
async function deletePlaylists(client, ids) {
|
|
35
|
-
return Promise.all(ids.map((id) => deletePlaylist(client, id)));
|
|
36
|
-
}
|
|
37
|
-
async function deletePlaylistItem(client, id, item_ids) {
|
|
38
|
-
return client.request(`${PLAYLISTS_URL}/${id}/items`, {
|
|
39
|
-
method: "DELETE",
|
|
40
|
-
body: item_ids
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async function removeItemsFromPlaylist(client, playlistId, data) {
|
|
44
|
-
return client.request(`${PLAYLISTS_URL}/${playlistId}/items`, {
|
|
45
|
-
method: "DELETE",
|
|
46
|
-
body: data
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
2
|
//#region ../../shareables/api-client/src/namespaces/media.ts
|
|
51
3
|
function transformMediaListItem(item) {
|
|
52
4
|
return {
|
|
@@ -120,6 +72,73 @@ async function createMedia(client, mediaData, repContext) {
|
|
|
120
72
|
if (repContext) return (await client.post("/users/v2025-06/media", mediaData)).medium;
|
|
121
73
|
return (await client.post("/company/media", mediaData)).medium;
|
|
122
74
|
}
|
|
75
|
+
async function updateMedia(client, id, mediaData, language_iso, repContext) {
|
|
76
|
+
if (repContext) return (await client.request(`/users/v2025-06/media/${id}`, {
|
|
77
|
+
method: "PATCH",
|
|
78
|
+
body: mediaData
|
|
79
|
+
})).medium;
|
|
80
|
+
const endpoint = language_iso ? `/company/media/${id}?language_iso=${language_iso}` : `/company/media/${id}`;
|
|
81
|
+
const response = await client.put(endpoint, { medium: mediaData });
|
|
82
|
+
if (response && typeof response === "object" && "data" in response && response.data) return response.data;
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Delete a media item. The API returns a text response, so we use
|
|
87
|
+
* client.delete and ignore the response body.
|
|
88
|
+
*/
|
|
89
|
+
async function deleteMedia(client, id, repContext) {
|
|
90
|
+
if (repContext) await client.delete(`/users/v2025-06/media/${id}`);
|
|
91
|
+
else await client.delete(`/company/media/${id}`);
|
|
92
|
+
return { success: true };
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../../shareables/api-client/src/namespaces/playlists.ts
|
|
96
|
+
var playlists_exports = /* @__PURE__ */ __exportAll({
|
|
97
|
+
addItemToPlaylist: () => addItemToPlaylist,
|
|
98
|
+
createPlaylist: () => createPlaylist,
|
|
99
|
+
deletePlaylist: () => deletePlaylist,
|
|
100
|
+
deletePlaylistItem: () => deletePlaylistItem,
|
|
101
|
+
deletePlaylists: () => deletePlaylists,
|
|
102
|
+
getPlaylistById: () => getPlaylistById,
|
|
103
|
+
getPlaylists: () => getPlaylists,
|
|
104
|
+
removeItemsFromPlaylist: () => removeItemsFromPlaylist,
|
|
105
|
+
updatePlaylist: () => updatePlaylist
|
|
106
|
+
});
|
|
107
|
+
const PLAYLISTS_URL = "/v2025-06/playlists";
|
|
108
|
+
async function getPlaylists(client, options) {
|
|
109
|
+
const input = options ? Object.fromEntries(Object.entries(options).filter(([, value]) => value !== void 0)) : void 0;
|
|
110
|
+
return client.get(PLAYLISTS_URL, input);
|
|
111
|
+
}
|
|
112
|
+
async function getPlaylistById(client, id) {
|
|
113
|
+
return client.get(`${PLAYLISTS_URL}/${id}`);
|
|
114
|
+
}
|
|
115
|
+
async function createPlaylist(client, data) {
|
|
116
|
+
return client.post(PLAYLISTS_URL, data);
|
|
117
|
+
}
|
|
118
|
+
async function updatePlaylist(client, id, data) {
|
|
119
|
+
return client.patch(`${PLAYLISTS_URL}/${id}`, data);
|
|
120
|
+
}
|
|
121
|
+
async function addItemToPlaylist(client, id, data) {
|
|
122
|
+
return client.post(`${PLAYLISTS_URL}/${id}/items`, data);
|
|
123
|
+
}
|
|
124
|
+
async function deletePlaylist(client, id) {
|
|
125
|
+
return client.delete(`${PLAYLISTS_URL}/${id}`);
|
|
126
|
+
}
|
|
127
|
+
async function deletePlaylists(client, ids) {
|
|
128
|
+
return Promise.all(ids.map((id) => deletePlaylist(client, id)));
|
|
129
|
+
}
|
|
130
|
+
async function deletePlaylistItem(client, id, item_ids) {
|
|
131
|
+
return client.request(`${PLAYLISTS_URL}/${id}/items`, {
|
|
132
|
+
method: "DELETE",
|
|
133
|
+
body: item_ids
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async function removeItemsFromPlaylist(client, playlistId, data) {
|
|
137
|
+
return client.request(`${PLAYLISTS_URL}/${playlistId}/items`, {
|
|
138
|
+
method: "DELETE",
|
|
139
|
+
body: data
|
|
140
|
+
});
|
|
141
|
+
}
|
|
123
142
|
//#endregion
|
|
124
143
|
//#region ../../shareables/api-client/src/namespaces/file-resources.ts
|
|
125
144
|
async function getFileResources(client, params) {
|
|
@@ -153,9 +172,42 @@ async function createShareLink(client, input) {
|
|
|
153
172
|
return (await client.post("/shares.json", requestBody)).link;
|
|
154
173
|
}
|
|
155
174
|
//#endregion
|
|
175
|
+
//#region ../../shareables/api-client/src/adapter.ts
|
|
176
|
+
/**
|
|
177
|
+
* Creates a ShareablesApi-compatible adapter backed by the real API client
|
|
178
|
+
* namespace functions. The returned object satisfies the ShareablesApi interface
|
|
179
|
+
* from @fluid-app/shareables-core via structural typing.
|
|
180
|
+
*
|
|
181
|
+
* @param client - The FetchClient instance for making HTTP requests.
|
|
182
|
+
* @param options - Provider-level configuration (e.g. repContext).
|
|
183
|
+
*/
|
|
184
|
+
function createShareablesApiAdapter(client, options) {
|
|
185
|
+
const repContext = options?.repContext ?? false;
|
|
186
|
+
return {
|
|
187
|
+
media: {
|
|
188
|
+
getMedia: (opts) => getMedia(client, opts, repContext),
|
|
189
|
+
getMediaById: (id, language_iso) => getMediaById(client, id, language_iso, repContext),
|
|
190
|
+
createMedia: (mediaData) => createMedia(client, mediaData, repContext),
|
|
191
|
+
updateMedia: (id, mediaData, language_iso) => updateMedia(client, id, mediaData, language_iso, repContext),
|
|
192
|
+
deleteMedia: (id) => deleteMedia(client, id, repContext)
|
|
193
|
+
},
|
|
194
|
+
playlists: {
|
|
195
|
+
getPlaylists: (opts) => getPlaylists(client, opts),
|
|
196
|
+
getPlaylistById: (id) => getPlaylistById(client, id),
|
|
197
|
+
createPlaylist: (data) => createPlaylist(client, data),
|
|
198
|
+
updatePlaylist: (id, data) => updatePlaylist(client, id, data),
|
|
199
|
+
addItemToPlaylist: (id, data) => addItemToPlaylist(client, id, data),
|
|
200
|
+
removeItemsFromPlaylist: (playlistId, data) => removeItemsFromPlaylist(client, playlistId, data)
|
|
201
|
+
},
|
|
202
|
+
fileResources: { getFileResources: (params) => getFileResources(client, params) },
|
|
203
|
+
productMedia: { getProductMedia: (productId) => getProductMedia(client, productId) },
|
|
204
|
+
share: { createShareLink: (input) => createShareLink(client, input) }
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
156
208
|
//#region ../../shareables/api-client/src/index.ts
|
|
157
209
|
var src_exports = /* @__PURE__ */ __exportAll({ playlists: () => playlists_exports });
|
|
158
210
|
//#endregion
|
|
159
|
-
export {
|
|
211
|
+
export { createShareablesApiAdapter as n, src_exports as t };
|
|
160
212
|
|
|
161
|
-
//# sourceMappingURL=src-
|
|
213
|
+
//# sourceMappingURL=src-CN7diUEw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-CN7diUEw.mjs","names":["mediaNs.getMedia","mediaNs.getMediaById","mediaNs.createMedia","mediaNs.updateMedia","mediaNs.deleteMedia","playlistsNs.getPlaylists","playlistsNs.getPlaylistById","playlistsNs.createPlaylist","playlistsNs.updatePlaylist","playlistsNs.addItemToPlaylist","playlistsNs.removeItemsFromPlaylist","fileResourcesNs.getFileResources","productMediaNs.getProductMedia","shareNs.createShareLink"],"sources":["../../../shareables/api-client/src/namespaces/media.ts","../../../shareables/api-client/src/namespaces/playlists.ts","../../../shareables/api-client/src/namespaces/file-resources.ts","../../../shareables/api-client/src/namespaces/product-media.ts","../../../shareables/api-client/src/namespaces/share.ts","../../../shareables/api-client/src/adapter.ts","../../../shareables/api-client/src/index.ts"],"sourcesContent":["import type { FetchClient } from \"../lib/fetch-client\";\nimport type { shareables } from \"../generated/shareables\";\n\n// ============================================================================\n// Media - Helper\n// ============================================================================\n\nfunction transformMediaListItem(\n item: shareables.MediaListItem,\n): shareables.MediumResponse {\n return {\n ...item,\n description: item.description,\n created_at: item.description?.created_at || item.created_at,\n };\n}\n\n// ============================================================================\n// Media - List & Get\n// ============================================================================\n\ninterface RepMediaResponse {\n media: shareables.MediaListItem[];\n meta: {\n request_id: string;\n timestamp: string;\n current_page: number;\n total_pages: number;\n total_count: number;\n };\n}\n\nexport async function getMedia(\n client: FetchClient,\n options: shareables.MediaFilters = {},\n repContext?: boolean,\n): Promise<shareables.MediaListResponseWithMeta> {\n if (repContext) {\n const response = await client.get<RepMediaResponse>(\n \"/users/v2025-06/media\",\n options as Record<string, unknown>,\n );\n\n const transformedItems = response.media.map(transformMediaListItem);\n const perPage = options.per_page || 10;\n\n return {\n data: transformedItems,\n status: \"success\",\n media: transformedItems,\n meta: {\n total_count: response.meta.total_count,\n current: response.meta.current_page,\n per_page: perPage,\n pages: response.meta.total_pages,\n next:\n response.meta.current_page < response.meta.total_pages\n ? response.meta.current_page + 1\n : null,\n previous:\n response.meta.current_page > 1\n ? response.meta.current_page - 1\n : null,\n },\n };\n }\n\n const response = await client.get<shareables.MediaListResponseNew>(\n \"/company/media\",\n options as Record<string, unknown>,\n );\n\n let mediaItems: shareables.MediaListItem[] = [];\n let pagination: shareables.MediaPagination = {\n count: 0,\n previous: null,\n next: null,\n pages: 0,\n per_page: 10,\n current: 1,\n };\n\n response.forEach((item) => {\n if (\"items\" in item && Array.isArray(item.items)) {\n mediaItems = item.items;\n }\n if (\"pagination\" in item && item.pagination?.count) {\n pagination = item.pagination;\n }\n });\n\n const transformedItems = mediaItems.map(transformMediaListItem);\n\n return {\n data: transformedItems,\n status: \"success\",\n media: transformedItems,\n meta: {\n ...pagination,\n total_count: pagination.count || mediaItems.length,\n },\n };\n}\n\nexport async function getMediaById(\n client: FetchClient,\n id: number,\n language_iso?: string,\n repContext?: boolean,\n): Promise<shareables.MediaResponseWithMeta> {\n if (repContext) {\n const response = await client.get<{ medium: shareables.MediumResponse }>(\n `/users/v2025-06/media/${id}`,\n );\n return {\n data: response.medium,\n status: \"success\",\n media: response.medium,\n };\n }\n\n const endpoint = language_iso\n ? `/company/media/${id}?language_iso=${language_iso}`\n : `/company/media/${id}`;\n\n const response = await client.get<shareables.MediumResponse>(endpoint);\n\n return {\n data: response,\n status: \"success\",\n media: response,\n };\n}\n\nexport async function getAnnouncementById(\n client: FetchClient,\n id: number,\n): Promise<shareables.AnnouncementResponse> {\n return client.get(`/company/announcements/${id}`);\n}\n\nexport async function getTrainings(\n client: FetchClient,\n options: {\n category_id?: number;\n page?: number;\n per_page?: number;\n } = {},\n): Promise<shareables.MediaListResponseWithMeta> {\n const params: Record<string, string> = {};\n\n if (options.category_id) {\n params[\"filterrific[with_category_id]\"] = options.category_id.toString();\n }\n if (options.page) {\n params.page = options.page.toString();\n }\n if (options.per_page) {\n params.per_page = options.per_page.toString();\n }\n\n const response = await client.get<shareables.MediaListResponseNew>(\n \"/v1/trainings\",\n params,\n );\n\n let mediaItems: shareables.MediaListItem[] = [];\n let pagination: shareables.MediaPagination = {\n count: 0,\n previous: null,\n next: null,\n pages: 0,\n per_page: 20,\n current: 1,\n };\n\n response.forEach((item) => {\n if (\"items\" in item && Array.isArray(item.items)) {\n mediaItems = item.items;\n }\n if (\"pagination\" in item && item.pagination?.count) {\n pagination = item.pagination;\n }\n });\n\n const transformedItems = mediaItems.map(transformMediaListItem);\n\n return {\n data: transformedItems,\n status: \"success\",\n media: transformedItems,\n meta: {\n ...pagination,\n total_count: pagination.count || mediaItems.length,\n },\n };\n}\n\n// ============================================================================\n// Media - Create\n// ============================================================================\n\nexport async function createMedia(\n client: FetchClient,\n mediaData: shareables.MediumUpdate,\n repContext?: boolean,\n): Promise<shareables.MediumResponse> {\n if (repContext) {\n const response = await client.post<{ medium: shareables.MediumResponse }>(\n \"/users/v2025-06/media\",\n mediaData,\n );\n return response.medium;\n }\n\n const response = await client.post<shareables.NewCreateMediaResponse>(\n \"/company/media\",\n mediaData,\n );\n return response.medium;\n}\n\nexport async function createAnnouncement(\n client: FetchClient,\n announcementData: shareables.AnnouncementUpdate,\n): Promise<shareables.AnnouncementResponse> {\n return client.post(\"/company/announcements\", announcementData);\n}\n\n// ============================================================================\n// Media - Update\n// ============================================================================\n\nexport async function updateMedia(\n client: FetchClient,\n id: number,\n mediaData: shareables.MediumUpdate,\n language_iso?: string,\n repContext?: boolean,\n): Promise<shareables.MediumResponse> {\n if (repContext) {\n const response = await client.request<{\n medium: shareables.MediumResponse;\n }>(`/users/v2025-06/media/${id}`, {\n method: \"PATCH\",\n body: mediaData,\n });\n return response.medium;\n }\n\n const endpoint = language_iso\n ? `/company/media/${id}?language_iso=${language_iso}`\n : `/company/media/${id}`;\n\n const response = await client.put<shareables.MediaResponse>(endpoint, {\n medium: mediaData,\n });\n\n if (\n response &&\n typeof response === \"object\" &&\n \"data\" in response &&\n response.data\n ) {\n return response.data as shareables.MediumResponse;\n }\n return response as shareables.MediumResponse;\n}\n\nexport async function updateAnnouncement(\n client: FetchClient,\n id: number,\n announcementData: shareables.AnnouncementUpdate,\n): Promise<shareables.AnnouncementResponse> {\n const response = await client.put<shareables.AnnouncementResponse>(\n `/company/announcements/${id}`,\n announcementData,\n );\n\n if (\n response &&\n typeof response === \"object\" &&\n \"data\" in response &&\n response.data\n ) {\n return response.data as shareables.AnnouncementResponse;\n }\n return response;\n}\n\n// ============================================================================\n// Media - Delete\n// ============================================================================\n\n/**\n * Delete a media item. The API returns a text response, so we use\n * client.delete and ignore the response body.\n */\nexport async function deleteMedia(\n client: FetchClient,\n id: number,\n repContext?: boolean,\n): Promise<{ success: boolean }> {\n if (repContext) {\n await client.delete(`/users/v2025-06/media/${id}`);\n } else {\n await client.delete(`/company/media/${id}`);\n }\n return { success: true };\n}\n\nexport async function deleteAnnouncement(\n client: FetchClient,\n id: number,\n): Promise<{ success: boolean }> {\n await client.delete(`/company/announcements/${id}`);\n return { success: true };\n}\n\nexport async function bulkDeleteAnnouncements(\n client: FetchClient,\n ids: number[],\n): Promise<{ success: boolean }> {\n await client.request(`/company/announcements/bulk_destroy`, {\n method: \"DELETE\",\n body: { ids },\n });\n return { success: true };\n}\n","import type { FetchClient } from \"../lib/fetch-client\";\nimport type { shareables } from \"../generated/shareables\";\n\nconst PLAYLISTS_URL = \"/v2025-06/playlists\";\n\n// ============================================================================\n// Playlists - List & Get\n// ============================================================================\n\nexport type PlaylistsQuery = {\n \"filter[title]\"?: string;\n \"filter[status]\"?: string;\n \"page[cursor]\"?: string;\n \"page[limit]\"?: number;\n sort?: string;\n};\n\nexport async function getPlaylists(\n client: FetchClient,\n options?: PlaylistsQuery,\n): Promise<shareables.GetPlaylistsResponse> {\n const input = options\n ? Object.fromEntries(\n Object.entries(options).filter(([, value]) => value !== undefined),\n )\n : undefined;\n return client.get(PLAYLISTS_URL, input);\n}\n\nexport async function getPlaylistById(\n client: FetchClient,\n id: number,\n): Promise<shareables.GetPlaylistResponse> {\n return client.get(`${PLAYLISTS_URL}/${id}`);\n}\n\n// ============================================================================\n// Playlists - Create & Update\n// ============================================================================\n\nexport async function createPlaylist(\n client: FetchClient,\n data: shareables.CreatePlaylistInput,\n): Promise<shareables.GetPlaylistResponse> {\n return client.post(PLAYLISTS_URL, data);\n}\n\nexport async function updatePlaylist(\n client: FetchClient,\n id: number,\n data: shareables.UpdatePlaylistInput,\n): Promise<shareables.GetPlaylistResponse> {\n return client.patch(`${PLAYLISTS_URL}/${id}`, data);\n}\n\nexport async function addItemToPlaylist(\n client: FetchClient,\n id: number,\n data: shareables.AddItemToPlaylistInput,\n): Promise<shareables.Playlist> {\n return client.post(`${PLAYLISTS_URL}/${id}/items`, data);\n}\n\n// ============================================================================\n// Playlists - Delete\n// ============================================================================\n\nexport async function deletePlaylist(\n client: FetchClient,\n id: number,\n): Promise<void> {\n return client.delete(`${PLAYLISTS_URL}/${id}`);\n}\n\nexport async function deletePlaylists(\n client: FetchClient,\n ids: number[],\n): Promise<void[]> {\n return Promise.all(ids.map((id) => deletePlaylist(client, id)));\n}\n\nexport async function deletePlaylistItem(\n client: FetchClient,\n id: number,\n item_ids: number[],\n): Promise<{\n deleted_at: string;\n meta: { request_id: string; timestamp: string };\n}> {\n return client.request(`${PLAYLISTS_URL}/${id}/items`, {\n method: \"DELETE\",\n body: item_ids,\n });\n}\n\n// ============================================================================\n// Playlists - Remove Items\n// ============================================================================\n\nexport async function removeItemsFromPlaylist(\n client: FetchClient,\n playlistId: number,\n data: shareables.RemoveItemsFromPlaylistInput,\n): Promise<shareables.Playlist> {\n return client.request(`${PLAYLISTS_URL}/${playlistId}/items`, {\n method: \"DELETE\",\n body: data,\n });\n}\n","import type { FetchClient } from \"../lib/fetch-client\";\nimport type { shareables } from \"../generated/shareables\";\n\n// ============================================================================\n// File Resources - List\n// ============================================================================\n\nexport async function getFileResources(\n client: FetchClient,\n params: {\n search_query?: string;\n pageParam?: string;\n pageSize?: string;\n fileTypes?: string[];\n sizeGreaterThan?: number;\n sizeLessThan?: number;\n sortedBy?: string;\n },\n): Promise<shareables.FileResourcesResponse> {\n const qp = new URLSearchParams({\n ...(params.search_query && { search_query: params.search_query }),\n ...(params.pageParam && { page: params.pageParam }),\n ...(params.pageSize && { per_page: params.pageSize }),\n ...(params.sizeGreaterThan && {\n size_greater_than: params.sizeGreaterThan.toString(),\n }),\n ...(params.sizeLessThan && {\n size_less_than: params.sizeLessThan.toString(),\n }),\n ...(params.sortedBy && { sorted_by: params.sortedBy }),\n });\n params.fileTypes?.forEach((type) => {\n qp.append(\"with_types[]\", type);\n });\n\n return client.get(`/file_resources?${qp.toString()}`);\n}\n\n// ============================================================================\n// File Resources - Create\n// ============================================================================\n\nexport async function createFileResource(\n client: FetchClient,\n data: shareables.CreateFileResourceInput,\n): Promise<shareables.CreateFileResourceResponse> {\n return client.post(\"/file_resources\", data);\n}\n\n// ============================================================================\n// File Resources - Update\n// ============================================================================\n\nexport async function updateFileResource(\n client: FetchClient,\n id: number,\n fileResource: shareables.UpdateFileResourceInput,\n): Promise<shareables.FileResource> {\n return client.patch(`/file_resources/${id}`, {\n id: id.toString(),\n file_resource: fileResource,\n });\n}\n\n// ============================================================================\n// File Resources - Delete\n// ============================================================================\n\nexport async function deleteFileResource(\n client: FetchClient,\n id: number,\n): Promise<{ id: number; meta: { request_id: string; timestamp: string } }> {\n return client.delete(`/file_resources/${id}`);\n}\n","import type { FetchClient } from \"../lib/fetch-client\";\nimport type { shareables } from \"../generated/shareables\";\n\n// ============================================================================\n// Product Media - Get\n// ============================================================================\n\nexport async function getProductMedia(\n client: FetchClient,\n productId: number,\n): Promise<shareables.ProductMediaResponse> {\n return client.get(`/v2025-06/products/${productId}/media`);\n}\n\n// ============================================================================\n// Product Media - Type Guards\n// ============================================================================\n\nexport const isWidgetItem = (\n item: shareables.ModalItem,\n): item is { type: \"widget\"; data: shareables.ShareableItem } => {\n return item.type === \"widget\";\n};\n\nexport const isProductItem = (\n item: shareables.ModalItem,\n): item is { type: \"product\"; data: shareables.ProductRef } => {\n return item.type === \"product\";\n};\n\nexport const isMediaItem = (\n item: shareables.ModalItem,\n): item is { type: \"media\"; data: shareables.ProductMedia } => {\n return item.type === \"media\";\n};\n\n// ============================================================================\n// Product Media - Display Helpers\n// ============================================================================\n\nexport const getDisplayTitle = (item: shareables.ModalItem): string => {\n switch (item.type) {\n case \"widget\":\n return item.data.relateable?.title || item.data.title || \"Untitled\";\n case \"product\":\n return item.data.title;\n case \"media\":\n return item.data.title;\n default:\n return \"Untitled\";\n }\n};\n\nexport const getDisplayImage = (item: shareables.ModalItem): string => {\n switch (item.type) {\n case \"widget\":\n return item.data.relateable?.image_url || item.data.image_url || \"\";\n case \"product\":\n return item.data.image_url || \"\";\n case \"media\":\n return item.data.image_url || \"\";\n default:\n return \"\";\n }\n};\n\nexport const getDisplayVideo = (\n item: shareables.ModalItem,\n): string | undefined => {\n switch (item.type) {\n case \"widget\":\n return item.data.relateable?.video_url || item.data.video || undefined;\n case \"product\":\n return undefined;\n case \"media\":\n return item.data.video_url || undefined;\n default:\n return undefined;\n }\n};\n\ntype DescriptionField = string | { body: string } | null | undefined;\n\nexport const getDisplayDescription = (item: shareables.ModalItem): string => {\n switch (item.type) {\n case \"widget\": {\n const widgetDesc = item.data.relateable?.description as DescriptionField;\n if (typeof widgetDesc === \"object\" && widgetDesc?.body) {\n return widgetDesc.body;\n }\n return (\n (typeof widgetDesc === \"string\" ? widgetDesc : \"\") ||\n item.data.description ||\n \"\"\n );\n }\n case \"product\": {\n const productDesc = item.data.description as DescriptionField;\n if (typeof productDesc === \"object\" && productDesc?.body) {\n return productDesc.body;\n }\n return (\n (typeof productDesc === \"string\" ? productDesc : \"\") ||\n item.data.stripped ||\n \"\"\n );\n }\n case \"media\":\n return item.data.description || \"\";\n default:\n return \"\";\n }\n};\n\nexport const isProductType = (item: shareables.ModalItem): boolean => {\n if (isProductItem(item)) {\n return true;\n }\n\n if (isWidgetItem(item)) {\n const relateableType = item.data.relateable_type?.toLowerCase();\n return (\n relateableType === \"product\" ||\n relateableType === \"products\" ||\n relateableType === \"enrollmentpack\" ||\n relateableType === \"enrollment_packs\"\n );\n }\n\n return false;\n};\n\nexport const getProductIds = (item: shareables.ModalItem): number[] => {\n if (isProductItem(item)) {\n return [item.data.id];\n }\n\n if (isWidgetItem(item)) {\n const data = item.data;\n\n const type = data.relateable_type?.toLowerCase();\n if (\n (type === \"enrollmentpack\" || type === \"enrollment_packs\") &&\n data.relateable\n ) {\n const membershipIds =\n data.relateable.membership_products?.map((p) => p.id) || [];\n const subscriptionIds =\n data.relateable.subscription_products?.map((p) => p.id) || [];\n return [...membershipIds, ...subscriptionIds];\n }\n\n if (data.id && data.id !== 0) {\n return [data.id];\n } else if (data.relateable?.id && typeof data.relateable.id === \"number\") {\n return [data.relateable.id];\n }\n return [];\n }\n\n return [];\n};\n","import type { FetchClient } from \"../lib/fetch-client\";\nimport type { shareables } from \"../generated/shareables\";\n\n// ============================================================================\n// Share - List\n// ============================================================================\n\nexport async function getShares(\n client: FetchClient,\n input?: shareables.GetSharesInput,\n): Promise<shareables.SharesListResponse> {\n return client.get(\"/shares.json\", (input || {}) as Record<string, unknown>);\n}\n\n// ============================================================================\n// Share - Create Link\n// ============================================================================\n\nexport async function createShareLink(\n client: FetchClient,\n input: shareables.CreateShareLinkInput,\n): Promise<string> {\n const requestBody = {\n locale: input.locale,\n relateable_type: input.relateableType,\n ...(input.contactId && { contact_id: input.contactId }),\n ...(input.relateableId && { relateable_id: input.relateableId }),\n };\n\n const result = await client.post<shareables.ShareLinkResponse>(\n \"/shares.json\",\n requestBody,\n );\n\n return result.link;\n}\n","import type { FetchClient } from \"./lib/fetch-client\";\nimport * as mediaNs from \"./namespaces/media\";\nimport * as playlistsNs from \"./namespaces/playlists\";\nimport * as fileResourcesNs from \"./namespaces/file-resources\";\nimport * as productMediaNs from \"./namespaces/product-media\";\nimport * as shareNs from \"./namespaces/share\";\n\n/**\n * Creates a ShareablesApi-compatible adapter backed by the real API client\n * namespace functions. The returned object satisfies the ShareablesApi interface\n * from @fluid-app/shareables-core via structural typing.\n *\n * @param client - The FetchClient instance for making HTTP requests.\n * @param options - Provider-level configuration (e.g. repContext).\n */\nexport function createShareablesApiAdapter(\n client: FetchClient,\n options?: { repContext?: boolean },\n) {\n const repContext = options?.repContext ?? false;\n\n return {\n media: {\n getMedia: (opts?: Parameters<typeof mediaNs.getMedia>[1]) =>\n mediaNs.getMedia(client, opts, repContext),\n getMediaById: (id: number, language_iso?: string) =>\n mediaNs.getMediaById(client, id, language_iso, repContext),\n createMedia: (mediaData: Parameters<typeof mediaNs.createMedia>[1]) =>\n mediaNs.createMedia(client, mediaData, repContext),\n updateMedia: (\n id: number,\n mediaData: Parameters<typeof mediaNs.updateMedia>[2],\n language_iso?: string,\n ) => mediaNs.updateMedia(client, id, mediaData, language_iso, repContext),\n deleteMedia: (id: number) => mediaNs.deleteMedia(client, id, repContext),\n },\n playlists: {\n getPlaylists: (opts?: Parameters<typeof playlistsNs.getPlaylists>[1]) =>\n playlistsNs.getPlaylists(client, opts),\n getPlaylistById: (id: number) => playlistsNs.getPlaylistById(client, id),\n createPlaylist: (\n data: Parameters<typeof playlistsNs.createPlaylist>[1],\n ) => playlistsNs.createPlaylist(client, data),\n updatePlaylist: (\n id: number,\n data: Parameters<typeof playlistsNs.updatePlaylist>[2],\n ) => playlistsNs.updatePlaylist(client, id, data),\n addItemToPlaylist: (\n id: number,\n data: Parameters<typeof playlistsNs.addItemToPlaylist>[2],\n ) => playlistsNs.addItemToPlaylist(client, id, data),\n removeItemsFromPlaylist: (\n playlistId: number,\n data: Parameters<typeof playlistsNs.removeItemsFromPlaylist>[2],\n ) => playlistsNs.removeItemsFromPlaylist(client, playlistId, data),\n },\n fileResources: {\n getFileResources: (\n params: Parameters<typeof fileResourcesNs.getFileResources>[1],\n ) => fileResourcesNs.getFileResources(client, params),\n },\n productMedia: {\n getProductMedia: (productId: number) =>\n productMediaNs.getProductMedia(client, productId),\n },\n share: {\n createShareLink: (input: Parameters<typeof shareNs.createShareLink>[1]) =>\n shareNs.createShareLink(client, input),\n },\n };\n}\n","/**\n * @fluid-app/shareables-api-client\n * Type-safe API client for Fluid shareable content services\n */\n\n// Core fetch client (re-exported from @fluid-app/api-client-core for convenience)\nexport {\n createFetchClient,\n ApiError,\n isApiError,\n type FetchClient,\n type FetchClientConfig,\n type RequestOptions,\n} from \"./lib/fetch-client\";\n\n// Export types\nexport type { shareables } from \"./generated/shareables\";\n\n// Adapter factory for dependency inversion\nexport { createShareablesApiAdapter } from \"./adapter\";\n\n// Export namespace clients\nexport * as playlists from \"./namespaces/playlists\";\nexport * as media from \"./namespaces/media\";\nexport * as fileResources from \"./namespaces/file-resources\";\nexport * as files from \"./namespaces/files\";\nexport * as shareablesWidget from \"./namespaces/shareables\";\nexport * as productMedia from \"./namespaces/product-media\";\nexport * as share from \"./namespaces/share\";\nexport * as publicMedia from \"./namespaces/public-media\";\n"],"mappings":"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"}
|
|
@@ -3,9 +3,8 @@ import { n as useScreenHeaderActions, r as useScreenHeaderBreadcrumbs } from "./
|
|
|
3
3
|
import { a as useEditor, o as Placeholder, r as EditorContent, t as StarterKit } from "./dist-CkIGP8my.mjs";
|
|
4
4
|
import { t as useDropzone } from "./es-Dlib2eNY.mjs";
|
|
5
5
|
import { n as TextAlign, t as Underline } from "./dist-C9vpl_rR.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { a as verticalListSortingStrategy, c as PointerSensor, d as useSensors, f as CSS, i as useSortable, l as closestCenter, n as arrayMove, o as DndContext, r as sortableKeyboardCoordinates, s as KeyboardSensor, t as SortableContext, u as useSensor } from "./sortable.esm-CzzU6kIR.mjs";
|
|
6
|
+
import { n as listProducts, t as getProduct } from "./products-DOO1TBcm.mjs";
|
|
7
|
+
import { a as verticalListSortingStrategy, c as PointerSensor, d as useSensors, f as CSS, i as useSortable, l as closestCenter, n as arrayMove, o as DndContext, r as sortableKeyboardCoordinates, s as KeyboardSensor, t as SortableContext, u as useSensor } from "./sortable.esm-Cz-CP2N8.mjs";
|
|
9
8
|
import React, { PureComponent, createContext, createRef, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
9
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
11
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -88,9 +87,23 @@ const shareablesKeys = {
|
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
89
|
//#endregion
|
|
90
|
+
//#region ../../shareables/core/src/api-context.tsx
|
|
91
|
+
const ShareablesApiContext = createContext(null);
|
|
92
|
+
function ShareablesApiProvider({ api, children }) {
|
|
93
|
+
return /* @__PURE__ */ jsx(ShareablesApiContext.Provider, {
|
|
94
|
+
value: api,
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function useShareablesApi() {
|
|
99
|
+
const ctx = useContext(ShareablesApiContext);
|
|
100
|
+
if (!ctx) throw new Error("useShareablesApi must be used within a ShareablesApiProvider");
|
|
101
|
+
return ctx;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
91
104
|
//#region ../../shareables/core/src/hooks/use-share-link.ts
|
|
92
105
|
function useShareLink(item, shareableType, contactId, locale = "en") {
|
|
93
|
-
const
|
|
106
|
+
const api = useShareablesApi();
|
|
94
107
|
const queryClient = useQueryClient();
|
|
95
108
|
const isIdRequired = shareableType !== "MySite";
|
|
96
109
|
const isValidDatabaseId = item?.id && Number.isInteger(item.id) && item.id > 1;
|
|
@@ -102,12 +115,13 @@ function useShareLink(item, shareableType, contactId, locale = "en") {
|
|
|
102
115
|
if (item?.share_link && !contactId) return item.share_link;
|
|
103
116
|
if (isIdRequired && !item?.id) throw new Error("Something went wrong, please try again.");
|
|
104
117
|
if (isIdRequired && !isValidDatabaseId) throw new Error("Share links are not available for this item.");
|
|
105
|
-
|
|
118
|
+
const input = {
|
|
106
119
|
locale,
|
|
107
120
|
relateableType: shareableType,
|
|
108
121
|
...isIdRequired && item?.id && { relateableId: item.id },
|
|
109
122
|
...contactId && { contactId }
|
|
110
|
-
}
|
|
123
|
+
};
|
|
124
|
+
return await api.share.createShareLink(input);
|
|
111
125
|
},
|
|
112
126
|
enabled: isIdRequired ? Boolean(shouldFetch && item?.id) : true,
|
|
113
127
|
staleTime: 300 * 1e3,
|
|
@@ -129,12 +143,12 @@ function useShareLink(item, shareableType, contactId, locale = "en") {
|
|
|
129
143
|
//#endregion
|
|
130
144
|
//#region ../../shareables/core/src/hooks/use-product-media-counts.ts
|
|
131
145
|
function useProductMediaCount(productId) {
|
|
132
|
-
const
|
|
146
|
+
const api = useShareablesApi();
|
|
133
147
|
return useQuery({
|
|
134
148
|
queryKey: shareablesKeys.productMedia.count(productId),
|
|
135
149
|
queryFn: async () => {
|
|
136
150
|
try {
|
|
137
|
-
return ((await getProductMedia(
|
|
151
|
+
return ((await api.productMedia.getProductMedia(productId)).media || []).length;
|
|
138
152
|
} catch (error) {
|
|
139
153
|
console.warn(`Failed to fetch media count for product ${productId}:`, error);
|
|
140
154
|
return 0;
|
|
@@ -148,12 +162,11 @@ function useProductMediaCount(productId) {
|
|
|
148
162
|
//#endregion
|
|
149
163
|
//#region ../../shareables/core/src/hooks/use-media-mutations.ts
|
|
150
164
|
const useCreateMediaMutation = (options) => {
|
|
151
|
-
const
|
|
165
|
+
const api = useShareablesApi();
|
|
152
166
|
const queryClient = useQueryClient();
|
|
153
|
-
const repContext = useRepContext();
|
|
154
167
|
return useMutation({
|
|
155
168
|
mutationFn: (payload) => {
|
|
156
|
-
return createMedia(
|
|
169
|
+
return api.media.createMedia(payload);
|
|
157
170
|
},
|
|
158
171
|
onSuccess: (data) => {
|
|
159
172
|
queryClient.invalidateQueries({ queryKey: shareablesKeys.media.all });
|
|
@@ -176,11 +189,11 @@ function isCancellationError(error) {
|
|
|
176
189
|
//#endregion
|
|
177
190
|
//#region ../../shareables/core/src/hooks/use-playlist-mutations.ts
|
|
178
191
|
const useAddItemToPlaylistMutation = (options) => {
|
|
179
|
-
const
|
|
192
|
+
const api = useShareablesApi();
|
|
180
193
|
const queryClient = useQueryClient();
|
|
181
194
|
return useMutation({
|
|
182
195
|
mutationFn: ({ playlistId, data }) => {
|
|
183
|
-
return addItemToPlaylist(
|
|
196
|
+
return api.playlists.addItemToPlaylist(playlistId, { items: [data] });
|
|
184
197
|
},
|
|
185
198
|
onMutate: async ({ playlistId, newItem }) => {
|
|
186
199
|
await queryClient.cancelQueries({ queryKey: shareablesKeys.playlists.detail(playlistId) });
|
|
@@ -212,11 +225,11 @@ const useAddItemToPlaylistMutation = (options) => {
|
|
|
212
225
|
});
|
|
213
226
|
};
|
|
214
227
|
const useRemoveItemsFromPlaylistMutation = (options) => {
|
|
215
|
-
const
|
|
228
|
+
const api = useShareablesApi();
|
|
216
229
|
const queryClient = useQueryClient();
|
|
217
230
|
return useMutation({
|
|
218
231
|
mutationFn: ({ playlistId, itemIds }) => {
|
|
219
|
-
return removeItemsFromPlaylist(
|
|
232
|
+
return api.playlists.removeItemsFromPlaylist(playlistId, { item_ids: itemIds });
|
|
220
233
|
},
|
|
221
234
|
onMutate: async ({ playlistId, itemIds }) => {
|
|
222
235
|
await queryClient.cancelQueries({ queryKey: shareablesKeys.playlists.detail(playlistId) });
|
|
@@ -253,11 +266,11 @@ const useRemoveItemsFromPlaylistMutation = (options) => {
|
|
|
253
266
|
});
|
|
254
267
|
};
|
|
255
268
|
const useCreatePlaylistMutation = (options) => {
|
|
256
|
-
const
|
|
269
|
+
const api = useShareablesApi();
|
|
257
270
|
const queryClient = useQueryClient();
|
|
258
271
|
return useMutation({
|
|
259
272
|
mutationFn: (input) => {
|
|
260
|
-
return createPlaylist(
|
|
273
|
+
return api.playlists.createPlaylist(input);
|
|
261
274
|
},
|
|
262
275
|
onSuccess: (createdPlaylist) => {
|
|
263
276
|
queryClient.invalidateQueries({ queryKey: shareablesKeys.playlists.all });
|
|
@@ -271,11 +284,11 @@ const useCreatePlaylistMutation = (options) => {
|
|
|
271
284
|
});
|
|
272
285
|
};
|
|
273
286
|
const useUpdatePlaylistMutation = (options) => {
|
|
274
|
-
const
|
|
287
|
+
const api = useShareablesApi();
|
|
275
288
|
const queryClient = useQueryClient();
|
|
276
289
|
return useMutation({
|
|
277
290
|
mutationFn: ({ playlistId, data }) => {
|
|
278
|
-
return updatePlaylist(
|
|
291
|
+
return api.playlists.updatePlaylist(playlistId, data);
|
|
279
292
|
},
|
|
280
293
|
onSuccess: (_, { playlistId }) => {
|
|
281
294
|
queryClient.invalidateQueries({ queryKey: shareablesKeys.playlists.all });
|
|
@@ -1094,6 +1107,7 @@ var MarketingAssetsGrid_default = React.memo(MarketingAssetsGrid);
|
|
|
1094
1107
|
//#endregion
|
|
1095
1108
|
//#region ../../shareables/ui/src/components/screens/ProductDetailScreen.tsx
|
|
1096
1109
|
function ProductDetailScreen({ productId, countryCode, onNavigate, onBack }) {
|
|
1110
|
+
const api = useShareablesApi();
|
|
1097
1111
|
const client = useShareablesClient();
|
|
1098
1112
|
const { navigate, showToast, onFileDownload } = useShareablesUI();
|
|
1099
1113
|
const [activeTab, setActiveTab] = useState("All");
|
|
@@ -1108,7 +1122,7 @@ function ProductDetailScreen({ productId, countryCode, onNavigate, onBack }) {
|
|
|
1108
1122
|
"public",
|
|
1109
1123
|
productId
|
|
1110
1124
|
],
|
|
1111
|
-
queryFn: () => getProductMedia(
|
|
1125
|
+
queryFn: () => api.productMedia.getProductMedia(Number(productId))
|
|
1112
1126
|
});
|
|
1113
1127
|
const { shareLink, loading: shareLinkLoading, error: shareLinkError } = useShareLink({ id: Number(productId) }, "Product");
|
|
1114
1128
|
const product = productResponse?.product;
|
|
@@ -1286,7 +1300,7 @@ function getMediaKindLabel(kind) {
|
|
|
1286
1300
|
}
|
|
1287
1301
|
}
|
|
1288
1302
|
function MediaListingScreen({ onNavigate }) {
|
|
1289
|
-
const
|
|
1303
|
+
const api = useShareablesApi();
|
|
1290
1304
|
const repContext = useRepContext();
|
|
1291
1305
|
const { navigate, readOnly } = useShareablesUI();
|
|
1292
1306
|
useScreenHeaderActions(useMemo(() => readOnly ? null : /* @__PURE__ */ jsxs(Button, {
|
|
@@ -1315,12 +1329,12 @@ function MediaListingScreen({ onNavigate }) {
|
|
|
1315
1329
|
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage, error } = useInfiniteQuery({
|
|
1316
1330
|
queryKey: shareablesKeys.media.list(debouncedSearch, sortDesc, repContext),
|
|
1317
1331
|
queryFn: async ({ pageParam = 1 }) => {
|
|
1318
|
-
return (await getMedia(
|
|
1332
|
+
return (await api.media.getMedia({
|
|
1319
1333
|
page: pageParam,
|
|
1320
1334
|
per_page: PAGE_SIZE$2,
|
|
1321
1335
|
search_query: debouncedSearch || void 0,
|
|
1322
1336
|
sorted_by: sortDesc ? "title_desc" : "title_asc"
|
|
1323
|
-
}
|
|
1337
|
+
})).media;
|
|
1324
1338
|
},
|
|
1325
1339
|
getNextPageParam: (lastPage, allPages) => lastPage.length === PAGE_SIZE$2 ? allPages.length + 1 : void 0,
|
|
1326
1340
|
initialPageParam: 1
|
|
@@ -1470,13 +1484,13 @@ function getBadgeLabel(kind) {
|
|
|
1470
1484
|
}
|
|
1471
1485
|
}
|
|
1472
1486
|
function MediaDetailScreen({ mediaId, onNavigate: _onNavigate, onBack }) {
|
|
1473
|
-
const
|
|
1487
|
+
const api = useShareablesApi();
|
|
1474
1488
|
const repContext = useRepContext();
|
|
1475
1489
|
const { navigate, showToast, onFileDownload } = useShareablesUI();
|
|
1476
1490
|
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false);
|
|
1477
1491
|
const { data: mediaResponse, isLoading } = useQuery({
|
|
1478
1492
|
queryKey: shareablesKeys.media.detail(Number(mediaId), repContext),
|
|
1479
|
-
queryFn: () => getMediaById(
|
|
1493
|
+
queryFn: () => api.media.getMediaById(Number(mediaId))
|
|
1480
1494
|
});
|
|
1481
1495
|
const { shareLink, loading: shareLinkLoading, error: shareLinkError } = useShareLink({ id: Number(mediaId) }, "Medium");
|
|
1482
1496
|
const mediaItem = mediaResponse?.media;
|
|
@@ -6926,7 +6940,7 @@ function BulkSelectionBar({ selectedCount, totalCount, onSelectAll, onClearSelec
|
|
|
6926
6940
|
const PAGE_SIZE$1 = 12;
|
|
6927
6941
|
const GRID_CLASS$1 = "grid grid-cols-1 gap-8 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4";
|
|
6928
6942
|
function PlaylistsListingScreen(_props) {
|
|
6929
|
-
const
|
|
6943
|
+
const api = useShareablesApi();
|
|
6930
6944
|
const { navigate, showToast, user, onToggleFavorite, onDeletePlaylist, readOnly } = useShareablesUI();
|
|
6931
6945
|
const queryClient = useQueryClient();
|
|
6932
6946
|
useScreenHeaderActions(useMemo(() => readOnly ? null : /* @__PURE__ */ jsxs(Button, {
|
|
@@ -6955,7 +6969,7 @@ function PlaylistsListingScreen(_props) {
|
|
|
6955
6969
|
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage, isFetched, error } = useInfiniteQuery({
|
|
6956
6970
|
queryKey,
|
|
6957
6971
|
queryFn: async ({ pageParam }) => {
|
|
6958
|
-
const response = await getPlaylists(
|
|
6972
|
+
const response = await api.playlists.getPlaylists({
|
|
6959
6973
|
"filter[title]": debouncedSearch || void 0,
|
|
6960
6974
|
"page[cursor]": pageParam,
|
|
6961
6975
|
"page[limit]": PAGE_SIZE$1,
|
|
@@ -7426,7 +7440,7 @@ function PlaylistItemsList({ items, onSelectItem, selectedItemIndex = 0, onNavig
|
|
|
7426
7440
|
//#region ../../shareables/ui/src/components/screens/PlaylistDetailScreen.tsx
|
|
7427
7441
|
const DEFAULT_IMAGE$1 = "https://assets.fluid.app/fluid-admin/images/we-commerce/we-commerce.png";
|
|
7428
7442
|
function PlaylistDetailScreen({ playlistId, onNavigate }) {
|
|
7429
|
-
const
|
|
7443
|
+
const api = useShareablesApi();
|
|
7430
7444
|
const { navigate, showToast, onDeletePlaylist, user, readOnly } = useShareablesUI();
|
|
7431
7445
|
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false);
|
|
7432
7446
|
const [selectedPlaylistItemIndex, setSelectedPlaylistItemIndex] = useState(0);
|
|
@@ -7434,7 +7448,7 @@ function PlaylistDetailScreen({ playlistId, onNavigate }) {
|
|
|
7434
7448
|
const [isDeleting, setIsDeleting] = useState(false);
|
|
7435
7449
|
const { data: playlistResponse, isLoading } = useQuery({
|
|
7436
7450
|
queryKey: shareablesKeys.playlists.detail(Number(playlistId)),
|
|
7437
|
-
queryFn: () => getPlaylistById(
|
|
7451
|
+
queryFn: () => api.playlists.getPlaylistById(Number(playlistId))
|
|
7438
7452
|
});
|
|
7439
7453
|
const { shareLink, loading: shareLinkLoading, error: shareLinkError } = useShareLink({ id: Number(playlistId) }, "Library");
|
|
7440
7454
|
const playlist = playlistResponse?.playlist;
|
|
@@ -8283,8 +8297,7 @@ function computeOrderedItems(items) {
|
|
|
8283
8297
|
}
|
|
8284
8298
|
function PlaylistItemsSection({ playlistId }) {
|
|
8285
8299
|
const { showToast, filePickerClient } = useShareablesUI();
|
|
8286
|
-
const
|
|
8287
|
-
const repContext = useRepContext();
|
|
8300
|
+
const api = useShareablesApi();
|
|
8288
8301
|
const [filePickerOpen, setFilePickerOpen] = useState(false);
|
|
8289
8302
|
const { items: contextItems, updateItems, addItem, removeItem } = usePlaylistItems();
|
|
8290
8303
|
const tableItems = contextItems;
|
|
@@ -8403,13 +8416,12 @@ function PlaylistItemsSection({ playlistId }) {
|
|
|
8403
8416
|
loading: () => "",
|
|
8404
8417
|
dismiss: () => {}
|
|
8405
8418
|
},
|
|
8406
|
-
shareablesClient: { media: { list: (filters) => getMedia(
|
|
8419
|
+
shareablesClient: { media: { list: (filters) => api.media.getMedia(filters ?? {}) } }
|
|
8407
8420
|
};
|
|
8408
8421
|
}, [
|
|
8409
8422
|
filePickerClient,
|
|
8410
8423
|
showToast,
|
|
8411
|
-
|
|
8412
|
-
repContext
|
|
8424
|
+
api
|
|
8413
8425
|
]);
|
|
8414
8426
|
return /* @__PURE__ */ jsxs("div", {
|
|
8415
8427
|
className: "border-border bg-card rounded-lg border p-4",
|
|
@@ -8561,7 +8573,7 @@ function PlaylistOpenGraphPreview({ playlist, playlistShareBaseUrl }) {
|
|
|
8561
8573
|
//#endregion
|
|
8562
8574
|
//#region ../../shareables/ui/src/components/screens/PlaylistCreateScreen.tsx
|
|
8563
8575
|
function PlaylistFormContent({ playlistId, playlist, isEditMode, itemsToUse, onBack, hideHeader, renderHeaderSlot }) {
|
|
8564
|
-
const
|
|
8576
|
+
const api = useShareablesApi();
|
|
8565
8577
|
const { showToast, navigate, user } = useShareablesUI();
|
|
8566
8578
|
const { items: contextItems } = usePlaylistItems();
|
|
8567
8579
|
const { form, updateField, validateForm } = usePlaylistForm();
|
|
@@ -8662,11 +8674,12 @@ function PlaylistFormContent({ playlistId, playlist, isEditMode, itemsToUse, onB
|
|
|
8662
8674
|
...user?.id ? { user_id: user.id } : {}
|
|
8663
8675
|
} })).playlist.id;
|
|
8664
8676
|
if (itemsForSubmission.length > 0) try {
|
|
8665
|
-
|
|
8677
|
+
const itemsData = itemsForSubmission.filter((item) => !!item.relateable_type && typeof item.relateable?.id === "number").map((item, index) => ({
|
|
8666
8678
|
relateable_type: item.relateable_type,
|
|
8667
8679
|
relateable_id: item.relateable.id,
|
|
8668
8680
|
order: index + 1
|
|
8669
|
-
}))
|
|
8681
|
+
}));
|
|
8682
|
+
await api.playlists.addItemToPlaylist(newPlaylistId, { items: itemsData });
|
|
8670
8683
|
} catch (itemError) {
|
|
8671
8684
|
console.error("Error adding items to playlist:", itemError);
|
|
8672
8685
|
showToast({
|
|
@@ -8684,7 +8697,7 @@ function PlaylistFormContent({ playlistId, playlist, isEditMode, itemsToUse, onB
|
|
|
8684
8697
|
createMutation,
|
|
8685
8698
|
updateMutation,
|
|
8686
8699
|
showToast,
|
|
8687
|
-
|
|
8700
|
+
api,
|
|
8688
8701
|
user?.id
|
|
8689
8702
|
]);
|
|
8690
8703
|
const isSaving = createMutation.isPending || updateMutation.isPending;
|
|
@@ -8721,7 +8734,7 @@ function PlaylistFormContent({ playlistId, playlist, isEditMode, itemsToUse, onB
|
|
|
8721
8734
|
] });
|
|
8722
8735
|
}
|
|
8723
8736
|
function PlaylistCreateScreen({ playlistId, onBack, hideHeader, renderHeaderSlot }) {
|
|
8724
|
-
const
|
|
8737
|
+
const api = useShareablesApi();
|
|
8725
8738
|
const isEditMode = !!playlistId;
|
|
8726
8739
|
const { data: playlistResponse, isLoading } = useQuery({
|
|
8727
8740
|
queryKey: playlistId ? shareablesKeys.playlists.detail(parseInt(playlistId, 10)) : [
|
|
@@ -8729,7 +8742,7 @@ function PlaylistCreateScreen({ playlistId, onBack, hideHeader, renderHeaderSlot
|
|
|
8729
8742
|
"detail",
|
|
8730
8743
|
null
|
|
8731
8744
|
],
|
|
8732
|
-
queryFn: () => getPlaylistById(
|
|
8745
|
+
queryFn: () => api.playlists.getPlaylistById(parseInt(playlistId, 10)),
|
|
8733
8746
|
enabled: isEditMode
|
|
8734
8747
|
});
|
|
8735
8748
|
const playlist = playlistResponse?.playlist;
|
|
@@ -8766,7 +8779,7 @@ function formatFileSize(bytes) {
|
|
|
8766
8779
|
}
|
|
8767
8780
|
const DEFAULT_IMAGE = "https://assets.fluid.app/fluid-admin/images/we-commerce/we-commerce.png";
|
|
8768
8781
|
function FilesListingScreen({ onNavigate }) {
|
|
8769
|
-
const
|
|
8782
|
+
const api = useShareablesApi();
|
|
8770
8783
|
const renderImage = useRenderImage();
|
|
8771
8784
|
useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, {
|
|
8772
8785
|
className: "text-lg",
|
|
@@ -8787,7 +8800,7 @@ function FilesListingScreen({ onNavigate }) {
|
|
|
8787
8800
|
const { data, isLoading, isFetchingNextPage, hasNextPage, fetchNextPage, error } = useInfiniteQuery({
|
|
8788
8801
|
queryKey: ["shareables-files", debouncedSearch],
|
|
8789
8802
|
queryFn: async ({ pageParam = 1 }) => {
|
|
8790
|
-
return await getFileResources(
|
|
8803
|
+
return await api.fileResources.getFileResources({
|
|
8791
8804
|
search_query: debouncedSearch || void 0,
|
|
8792
8805
|
pageParam: pageParam.toString(),
|
|
8793
8806
|
pageSize: PAGE_SIZE.toString()
|
|
@@ -8997,6 +9010,6 @@ function ProductsApp({ countryCode, companyLogoUrl, productId: controlledProduct
|
|
|
8997
9010
|
});
|
|
8998
9011
|
}
|
|
8999
9012
|
//#endregion
|
|
9000
|
-
export { ShareablesCoreProvider as i, ShareablesApp as n, ShareablesUIProvider as r, ProductsApp as t };
|
|
9013
|
+
export { ShareablesCoreProvider as a, ShareablesApiProvider as i, ShareablesApp as n, ShareablesUIProvider as r, ProductsApp as t };
|
|
9001
9014
|
|
|
9002
|
-
//# sourceMappingURL=src-
|
|
9015
|
+
//# sourceMappingURL=src-Ih5vEO6p.mjs.map
|