@fluid-app/portal-sdk 0.1.88 → 0.1.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{MessagingScreen-Cni4eaOi.mjs → MessagingScreen-DbXef2ee.mjs} +0 -1
  2. package/dist/{MySiteScreen-YujACNSf.mjs → MySiteScreen-BEl882-5.mjs} +2 -2
  3. package/dist/{MySiteScreen-YujACNSf.mjs.map → MySiteScreen-BEl882-5.mjs.map} +1 -1
  4. package/dist/{MySiteScreen-C4Ut8wxE.cjs → MySiteScreen-DMDOaROq.cjs} +2 -2
  5. package/dist/{MySiteScreen-C4Ut8wxE.cjs.map → MySiteScreen-DMDOaROq.cjs.map} +1 -1
  6. package/dist/{MySiteScreen-D5yvFmK3.cjs → MySiteScreen-Dy1r8mnN.cjs} +2 -2
  7. package/dist/{ProductsScreen-DiaGPT_Q.cjs → ProductsScreen-BIO6jWLT.cjs} +3 -3
  8. package/dist/{ProductsScreen-B2BS6FY_.cjs → ProductsScreen-BQVP1OTk.cjs} +15 -10
  9. package/dist/ProductsScreen-BQVP1OTk.cjs.map +1 -0
  10. package/dist/{ProductsScreen-BPgkn9BH.mjs → ProductsScreen-C2qXwQfN.mjs} +15 -10
  11. package/dist/ProductsScreen-C2qXwQfN.mjs.map +1 -0
  12. package/dist/{ProductsScreen-C5RMR8Mp.mjs → ProductsScreen-CCq96wPT.mjs} +3 -7
  13. package/dist/{ProfileScreen-CMIJfD3w.cjs → ProfileScreen-C6qbR0YJ.cjs} +1 -1
  14. package/dist/{ProfileScreen-COoE756I.mjs → ProfileScreen-DKJrpeMw.mjs} +9 -4
  15. package/dist/{ProfileScreen-COoE756I.mjs.map → ProfileScreen-DKJrpeMw.mjs.map} +1 -1
  16. package/dist/{ProfileScreen-CUBNMPCL.cjs → ProfileScreen-ueK01fjb.cjs} +9 -4
  17. package/dist/{ProfileScreen-CUBNMPCL.cjs.map → ProfileScreen-ueK01fjb.cjs.map} +1 -1
  18. package/dist/{ShareablesScreen-4hhIcSYA.mjs → ShareablesScreen-C1hVCjyE.mjs} +18 -13
  19. package/dist/ShareablesScreen-C1hVCjyE.mjs.map +1 -0
  20. package/dist/{ShareablesScreen-o1VYr_1K.cjs → ShareablesScreen-CDSudtJM.cjs} +18 -13
  21. package/dist/ShareablesScreen-CDSudtJM.cjs.map +1 -0
  22. package/dist/{ShareablesScreen-BxiqE8OR.mjs → ShareablesScreen-DkaKw-gX.mjs} +3 -7
  23. package/dist/{ShareablesScreen-CR3YKwZC.cjs → ShareablesScreen-rw5D509g.cjs} +3 -3
  24. package/dist/{ShopScreen-BVABhBmJ.cjs → ShopScreen-8WqLfyiR.cjs} +1 -1
  25. package/dist/{ShopScreen-CfxPQVZD.mjs → ShopScreen-Bj63FiDO.mjs} +2 -2
  26. package/dist/{ShopScreen-CfxPQVZD.mjs.map → ShopScreen-Bj63FiDO.mjs.map} +1 -1
  27. package/dist/{ShopScreen-D8z0KYfh.cjs → ShopScreen-jb7kYSxf.cjs} +2 -2
  28. package/dist/{ShopScreen-D8z0KYfh.cjs.map → ShopScreen-jb7kYSxf.cjs.map} +1 -1
  29. package/dist/{dist-lO2OG0T5.cjs → dist-BF_4vk1z.cjs} +1 -1
  30. package/dist/{dist-lO2OG0T5.cjs.map → dist-BF_4vk1z.cjs.map} +1 -1
  31. package/dist/index.cjs +17 -17
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts.map +1 -1
  34. package/dist/index.mjs +19 -19
  35. package/dist/{products-CjZof7c2.cjs → products-BKZ1siXg.cjs} +1 -1
  36. package/dist/{products-CjZof7c2.cjs.map → products-BKZ1siXg.cjs.map} +1 -1
  37. package/dist/{products-Dkwd_Bh0.mjs → products-DOO1TBcm.mjs} +1 -1
  38. package/dist/{products-Dkwd_Bh0.mjs.map → products-DOO1TBcm.mjs.map} +1 -1
  39. package/dist/{sortable.esm-CzzU6kIR.mjs → sortable.esm-Cz-CP2N8.mjs} +1 -1
  40. package/dist/{sortable.esm-CzzU6kIR.mjs.map → sortable.esm-Cz-CP2N8.mjs.map} +1 -1
  41. package/dist/{src-bzRRiTN4.cjs → src-BbJs882O.cjs} +58 -41
  42. package/dist/src-BbJs882O.cjs.map +1 -0
  43. package/dist/{src-p8DA1dH0.mjs → src-CN7diUEw.mjs} +102 -50
  44. package/dist/src-CN7diUEw.mjs.map +1 -0
  45. package/dist/{src-BjmyVJoe.mjs → src-Ih5vEO6p.mjs} +57 -44
  46. package/dist/src-Ih5vEO6p.mjs.map +1 -0
  47. package/dist/{src-Dt66UB0B.cjs → src-Zv3-NSUf.cjs} +103 -117
  48. package/dist/src-Zv3-NSUf.cjs.map +1 -0
  49. package/package.json +13 -13
  50. package/dist/ProductsScreen-B2BS6FY_.cjs.map +0 -1
  51. package/dist/ProductsScreen-BPgkn9BH.mjs.map +0 -1
  52. package/dist/ShareablesScreen-4hhIcSYA.mjs.map +0 -1
  53. package/dist/ShareablesScreen-o1VYr_1K.cjs.map +0 -1
  54. package/dist/src-BjmyVJoe.mjs.map +0 -1
  55. package/dist/src-Dt66UB0B.cjs.map +0 -1
  56. package/dist/src-bzRRiTN4.cjs.map +0 -1
  57. package/dist/src-p8DA1dH0.mjs.map +0 -1
@@ -1,52 +1,4 @@
1
1
  const require_chunk = require("./chunk-9hOWP6kD.cjs");
2
- //#region ../../shareables/api-client/src/namespaces/playlists.ts
3
- var playlists_exports = /* @__PURE__ */ require_chunk.__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__ */ require_chunk.__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,73 +172,46 @@ 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__ */ require_chunk.__exportAll({ playlists: () => playlists_exports });
158
210
  //#endregion
159
- Object.defineProperty(exports, "addItemToPlaylist", {
160
- enumerable: true,
161
- get: function() {
162
- return addItemToPlaylist;
163
- }
164
- });
165
- Object.defineProperty(exports, "createMedia", {
166
- enumerable: true,
167
- get: function() {
168
- return createMedia;
169
- }
170
- });
171
- Object.defineProperty(exports, "createPlaylist", {
211
+ Object.defineProperty(exports, "createShareablesApiAdapter", {
172
212
  enumerable: true,
173
213
  get: function() {
174
- return createPlaylist;
175
- }
176
- });
177
- Object.defineProperty(exports, "createShareLink", {
178
- enumerable: true,
179
- get: function() {
180
- return createShareLink;
181
- }
182
- });
183
- Object.defineProperty(exports, "getFileResources", {
184
- enumerable: true,
185
- get: function() {
186
- return getFileResources;
187
- }
188
- });
189
- Object.defineProperty(exports, "getMedia", {
190
- enumerable: true,
191
- get: function() {
192
- return getMedia;
193
- }
194
- });
195
- Object.defineProperty(exports, "getMediaById", {
196
- enumerable: true,
197
- get: function() {
198
- return getMediaById;
199
- }
200
- });
201
- Object.defineProperty(exports, "getPlaylistById", {
202
- enumerable: true,
203
- get: function() {
204
- return getPlaylistById;
205
- }
206
- });
207
- Object.defineProperty(exports, "getPlaylists", {
208
- enumerable: true,
209
- get: function() {
210
- return getPlaylists;
211
- }
212
- });
213
- Object.defineProperty(exports, "getProductMedia", {
214
- enumerable: true,
215
- get: function() {
216
- return getProductMedia;
217
- }
218
- });
219
- Object.defineProperty(exports, "removeItemsFromPlaylist", {
220
- enumerable: true,
221
- get: function() {
222
- return removeItemsFromPlaylist;
214
+ return createShareablesApiAdapter;
223
215
  }
224
216
  });
225
217
  Object.defineProperty(exports, "src_exports", {
@@ -228,11 +220,5 @@ Object.defineProperty(exports, "src_exports", {
228
220
  return src_exports;
229
221
  }
230
222
  });
231
- Object.defineProperty(exports, "updatePlaylist", {
232
- enumerable: true,
233
- get: function() {
234
- return updatePlaylist;
235
- }
236
- });
237
223
 
238
- //# sourceMappingURL=src-Dt66UB0B.cjs.map
224
+ //# sourceMappingURL=src-Zv3-NSUf.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-Zv3-NSUf.cjs","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":";;AAOA,SAAS,uBACP,MAC2B;AAC3B,QAAO;EACL,GAAG;EACH,aAAa,KAAK;EAClB,YAAY,KAAK,aAAa,cAAc,KAAK;EAClD;;AAkBH,eAAsB,SACpB,QACA,UAAmC,EAAE,EACrC,YAC+C;AAC/C,KAAI,YAAY;EACd,MAAM,WAAW,MAAM,OAAO,IAC5B,yBACA,QACD;EAED,MAAM,mBAAmB,SAAS,MAAM,IAAI,uBAAuB;EACnE,MAAM,UAAU,QAAQ,YAAY;AAEpC,SAAO;GACL,MAAM;GACN,QAAQ;GACR,OAAO;GACP,MAAM;IACJ,aAAa,SAAS,KAAK;IAC3B,SAAS,SAAS,KAAK;IACvB,UAAU;IACV,OAAO,SAAS,KAAK;IACrB,MACE,SAAS,KAAK,eAAe,SAAS,KAAK,cACvC,SAAS,KAAK,eAAe,IAC7B;IACN,UACE,SAAS,KAAK,eAAe,IACzB,SAAS,KAAK,eAAe,IAC7B;IACP;GACF;;CAGH,MAAM,WAAW,MAAM,OAAO,IAC5B,kBACA,QACD;CAED,IAAI,aAAy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;GACxC,kBAAkB,OAAeC,gBAA4B,QAAQ,GAAG;GACxE,iBACE,SACGC,eAA2B,QAAQ,KAAK;GAC7C,iBACE,IACA,SACGC,eAA2B,QAAQ,IAAI,KAAK;GACjD,oBACE,IACA,SACGC,kBAA8B,QAAQ,IAAI,KAAK;GACpD,0BACE,YACA,SACGC,wBAAoC,QAAQ,YAAY,KAAK;GACnE;EACD,eAAe,EACb,mBACE,WACGC,iBAAiC,QAAQ,OAAO,EACtD;EACD,cAAc,EACZ,kBAAkB,cAChBC,gBAA+B,QAAQ,UAAU,EACpD;EACD,OAAO,EACL,kBAAkB,UAChBC,gBAAwB,QAAQ,MAAM,EACzC;EACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/portal-sdk",
3
- "version": "0.1.88",
3
+ "version": "0.1.90",
4
4
  "description": "SDK for building custom Fluid portals",
5
5
  "files": [
6
6
  "dist",
@@ -65,45 +65,45 @@
65
65
  "tsdown": "^0.21.0",
66
66
  "typescript": "^5",
67
67
  "zod": "4.3.5",
68
- "@fluid-app/api-client-core": "0.1.0",
69
68
  "@fluid-app/auth": "0.1.0",
69
+ "@fluid-app/api-client-core": "0.1.0",
70
70
  "@fluid-app/cart-ui": "0.1.12",
71
- "@fluid-app/company-switcher-ui": "0.1.0",
72
71
  "@fluid-app/company-switcher-core": "0.1.0",
72
+ "@fluid-app/company-switcher-ui": "0.1.0",
73
73
  "@fluid-app/contacts-ui": "0.1.0",
74
+ "@fluid-app/fluid-pay-api-client": "0.1.0",
74
75
  "@fluid-app/file-picker-api-client": "0.1.0",
75
76
  "@fluid-app/fluidos-api-client": "0.1.0",
76
- "@fluid-app/fluid-pay-api-client": "0.1.0",
77
77
  "@fluid-app/messaging-api-client": "0.1.0",
78
- "@fluid-app/messaging-core": "0.1.0",
79
78
  "@fluid-app/mysite-ui": "0.1.0",
80
79
  "@fluid-app/orders-api-client": "0.1.0",
81
- "@fluid-app/messaging-ui": "0.1.0",
82
80
  "@fluid-app/orders-core": "0.1.0",
83
- "@fluid-app/orders-ui": "0.1.0",
81
+ "@fluid-app/messaging-core": "0.1.0",
82
+ "@fluid-app/messaging-ui": "0.1.0",
84
83
  "@fluid-app/permissions": "0.1.0",
84
+ "@fluid-app/orders-ui": "0.1.0",
85
85
  "@fluid-app/portal-app-download-ui": "0.1.0",
86
86
  "@fluid-app/portal-core": "0.1.23",
87
87
  "@fluid-app/portal-preview": "0.1.0",
88
88
  "@fluid-app/portal-pro-upgrade-ui": "0.1.0",
89
89
  "@fluid-app/portal-widgets": "0.1.22",
90
+ "@fluid-app/products-api-client": "0.1.0",
90
91
  "@fluid-app/portal-react": "0.1.0",
91
92
  "@fluid-app/products-core": "0.1.0",
92
- "@fluid-app/products-api-client": "0.1.0",
93
- "@fluid-app/profile-core": "0.1.0",
94
93
  "@fluid-app/profile-ui": "0.1.0",
94
+ "@fluid-app/profile-core": "0.1.0",
95
95
  "@fluid-app/query-persister": "0.1.0",
96
96
  "@fluid-app/shareables-api-client": "0.1.0",
97
97
  "@fluid-app/shareables-core": "0.1.0",
98
+ "@fluid-app/shareables-ui": "0.1.0",
98
99
  "@fluid-app/subscriptions-api-client": "0.1.0",
99
- "@fluid-app/subscriptions-core": "0.1.0",
100
- "@fluid-app/subscriptions-ui": "0.1.0",
101
100
  "@fluid-app/shop-ui": "0.1.0",
102
- "@fluid-app/shareables-ui": "0.1.0",
101
+ "@fluid-app/subscriptions-ui": "0.1.0",
102
+ "@fluid-app/subscriptions-core": "0.1.0",
103
103
  "@fluid-app/typescript-config": "0.0.0",
104
104
  "@fluid-app/ui-primitives": "0.1.13",
105
- "@fluid-app/user-contacts-api-client": "0.1.0",
106
105
  "@fluid-app/user-notes-api-client": "0.1.0",
106
+ "@fluid-app/user-contacts-api-client": "0.1.0",
107
107
  "@fluid-app/user-tasks-api-client": "0.1.0"
108
108
  },
109
109
  "peerDependencies": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductsScreen-B2BS6FY_.cjs","names":["useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ProductsApp"],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAeA,4BAAAA,cAAc;CACnC,MAAM,EAAE,MAAM,aAAaC,yBAAAA,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAaC,6BAAAA,kBAAkB;CAGpD,MAAM,aAAA,GAAA,MAAA,eAA0B;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,uBAAA,GAAA,MAAA,cACH,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,cAAA,GAAA,MAAA,mBAA+B;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,cAAA,GAAA,MAAA,gBACG;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,YAAA,GAAA,MAAA,gBACG;EACL,MAAM,WACF;GACE,IAAI,SAAS;GACb,SAAS,SAAS,UACd,EAAE,UAAU,SAAS,QAAQ,UAAU,GACvC;GACL,GACD,KAAA;EACJ,UAAU;EACV,WAAW,SAAiB;AAC1B,YAAS,KAAK;;EAEhB,YAAY,SAGN;AACJ,WAAQ,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAExD,GACD,CAAC,UAAU,SAAS,CACrB;AAED,QACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,iBAAA,GAAA,kBAAA,KAACC,YAAAA,wBAAD;GAAwB,QAAQ;aAC9B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,sBAAD;IAAsB,QAAQ;cAC5B,iBAAA,GAAA,kBAAA,KAACC,YAAAA,aAAD;KACE,aAAa,UAAU,SAAS;KAChC,gBAAgB,UAAU,SAAS;KACxB;KACX,iBAAiB;KACjB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductsScreen-BPgkn9BH.mjs","names":[],"sources":["../src/screens/ProductsScreen.tsx"],"sourcesContent":["import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ProductsApp } from \"@fluid-app/shareables-ui\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\n\ntype ProductsScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\nexport function ProductsScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProductsScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n\n // Extract product ID from slug: \"products/123\" → \"123\"\n const productId = useMemo(() => {\n const match = currentSlug.match(/^products\\/(.+)/);\n return match?.[1] ?? null;\n }, [currentSlug]);\n\n const handleSelectProduct = useCallback(\n (id: string) => {\n navigate(`products/${id}`);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n navigate(\"products\");\n }, [navigate]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n }),\n [domainClient, userData],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n basePath: \"\",\n navigate: (path: string) => {\n navigate(path);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.log(`[Products] ${opts.type}: ${opts.title}`);\n },\n }),\n [userData, navigate],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ProductsApp\n countryCode={userData?.country?.iso}\n companyLogoUrl={userData?.company?.logo_url}\n productId={productId}\n onSelectProduct={handleSelectProduct}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const productsScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProductsScreen\",\n displayName: \"Products Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;AAsBA,SAAgB,eAAe,EAE7B,YACA,WACA,aACA,SACA,cAEA,GAAG,YACsC;CACzC,MAAM,eAAe,cAAc;CACnC,MAAM,EAAE,MAAM,aAAa,gBAAgB;CAC3C,MAAM,EAAE,aAAa,aAAa,kBAAkB;CAGpD,MAAM,YAAY,cAAc;AAE9B,SADc,YAAY,MAAM,kBAAkB,GACnC,MAAM;IACpB,CAAC,YAAY,CAAC;CAEjB,MAAM,sBAAsB,aACzB,OAAe;AACd,WAAS,YAAY,KAAK;IAE5B,CAAC,SAAS,CACX;CAED,MAAM,aAAa,kBAAkB;AACnC,WAAS,WAAW;IACnB,CAAC,SAAS,CAAC;CAEd,MAAM,aAAa,eACV;EACL,QAAQ;EACR,MAAM,WAAW,EAAE,IAAI,SAAS,IAAI,GAAG;EACxC,GACD,CAAC,cAAc,SAAS,CACzB;CAED,MAAM,WAAW,eACR;EACL,MAAM,WACF;GACE,IAAI,SAAS;GACb,SAAS,SAAS,UACd,EAAE,UAAU,SAAS,QAAQ,UAAU,GACvC;GACL,GACD,KAAA;EACJ,UAAU;EACV,WAAW,SAAiB;AAC1B,YAAS,KAAK;;EAEhB,YAAY,SAGN;AACJ,WAAQ,IAAI,cAAc,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAExD,GACD,CAAC,UAAU,SAAS,CACrB;AAED,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,wBAAD;GAAwB,QAAQ;aAC9B,oBAAC,sBAAD;IAAsB,QAAQ;cAC5B,oBAAC,aAAD;KACE,aAAa,UAAU,SAAS;KAChC,gBAAgB,UAAU,SAAS;KACxB;KACX,iBAAiB;KACjB,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,+BAAqD;CAChE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShareablesScreen-4hhIcSYA.mjs","names":[],"sources":["../src/hooks/use-user-type.ts","../../../file-picker/api-client/src/client.ts","../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useFluidAuth } from \"./use-fluid-auth\";\nimport { USER_TYPES, type UserType } from \"../auth/types\";\n\nexport interface UseUserTypeResult {\n userType: UserType | null;\n isCustomer: boolean;\n isRep: boolean;\n isAdmin: boolean;\n}\n\n/**\n * Convenience hook for user-type checks in the portal SDK.\n */\nexport function useUserType(): UseUserTypeResult {\n const { user } = useFluidAuth();\n\n return useMemo(() => {\n const userType = user?.user_type ?? null;\n return {\n userType,\n isCustomer: userType === USER_TYPES.customer,\n isRep: userType === USER_TYPES.rep,\n isAdmin:\n userType === USER_TYPES.admin || userType === USER_TYPES.root_admin,\n };\n }, [user?.user_type]);\n}\n","import type { FetchClientInstance } from \"@fluid-app/api-client-core\";\nimport type { DamAssetCreateResponse } from \"@fluid-app/file-picker-core\";\n\nexport interface DamUploadStrategy {\n uploadFile(params: {\n file: File;\n name: string;\n description?: string;\n tags?: string[];\n onProgress?: (progress: number) => void;\n companyId?: number;\n }): Promise<DamAssetCreateResponse>;\n}\n\nexport interface FilePickerClientConfig {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint?: string; // defaults to \"/api/proxy-url\"\n}\n\nexport interface FilePickerClient {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint: string;\n}\n\nexport function createFilePickerClient(\n config: FilePickerClientConfig,\n): FilePickerClient {\n return {\n fetchClient: config.fetchClient,\n uploadStrategy: config.uploadStrategy,\n unsplashAccessKey: config.unsplashAccessKey,\n proxyEndpoint: config.proxyEndpoint ?? \"/api/proxy-url\",\n };\n}\n","import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { createFilePickerClient } from \"@fluid-app/file-picker-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\nimport { useUserType } from \"../hooks/use-user-type\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n const { isCustomer } = useUserType();\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n // Navigate back to the listing for the current screen\n navigate(`share/${screen}`);\n } else {\n // Navigate to the default shareables screen\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const filePickerClient = useMemo(\n () => createFilePickerClient({ fetchClient: domainClient }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n affiliateId:\n (userData as { affiliate_id?: number } | undefined)?.affiliate_id ??\n null,\n basePath: \"\",\n navigate: (path: string) => {\n // Strip leading slash — cards generate paths like \"/share/product/123\"\n const cleanPath = path.replace(/^\\//, \"\");\n // Ensure share/ prefix — screen components pass relative paths like \"media/new\"\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.warn(`[Shareables] ${opts.type}: ${opts.title}`);\n },\n filePickerClient,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const affiliateId = (userData as { affiliate_id?: number } | undefined)\n ?.affiliate_id;\n if (!affiliateId) throw new Error(\"No affiliate ID\");\n return domainClient.post<{ is_favorited: boolean }>(\n `/user_companies/${affiliateId}/favorites/toggle.json`,\n {\n favoriteable_id: params.favoriteableId,\n favoriteable_type: params.favoriteableType,\n },\n );\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n const { playlists: playlistsApi } =\n await import(\"@fluid-app/shareables-api-client\");\n await playlistsApi.deletePlaylist(domainClient, playlistId);\n },\n readOnly: isCustomer,\n }),\n [userData, navigate, filePickerClient, domainClient, isCustomer],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={userData?.company?.logo_url}\n countryCode={userData?.country?.iso}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;AAcA,SAAgB,cAAiC;CAC/C,MAAM,EAAE,SAAS,cAAc;AAE/B,QAAO,cAAc;EACnB,MAAM,WAAW,MAAM,aAAa;AACpC,SAAO;GACL;GACA,YAAY,aAAa,WAAW;GACpC,OAAO,aAAa,WAAW;GAC/B,SACE,aAAa,WAAW,SAAS,aAAa,WAAW;GAC5D;IACA,CAAC,MAAM,UAAU,CAAC;;;;ACEvB,SAAgB,uBACd,QACkB;AAClB,QAAO;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,mBAAmB,OAAO;EAC1B,eAAe,OAAO,iBAAiB;EACxC;;;;;;;;;;;;;;;;;;ACEH,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAo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EAEpB,YAAY,SAGN;AACJ,WAAQ,KAAK,gBAAgB,KAAK,KAAK,IAAI,KAAK,QAAQ;;EAE1D;EACA,kBAAkB,OAAO,WAGnB;GACJ,MAAM,cAAe,UACjB;AACJ,OAAI,CAAC,YAAa,OAAM,IAAI,MAAM,kBAAkB;AACpD,UAAO,aAAa,KAClB,mBAAmB,YAAY,yBAC/B;IACE,iBAAiB,OAAO;IACxB,mBAAmB,OAAO;IAC3B,CACF;;EAEH,kBAAkB,aACd,KAAA,IACA,OAAO,eAAuB;GAC5B,MAAM,EAAE,WAAW,iBACjB,MAAM,OAAO,sBAAA,MAAA,MAAA,EAAA,EAAA;AACf,SAAM,aAAa,eAAe,cAAc,WAAW;;EAEjE,UAAU;EACX,GACD;EAAC;EAAU;EAAU;EAAkB;EAAc;EAAW,CACjE;AAED,QACE,oBAAC,OAAD;EAAK,GAAI;EAAU,WAAW,UAAU,SAAS,aAAa;YAC5D,oBAAC,wBAAD;GAAwB,QAAQ;aAC9B,oBAAC,sBAAD;IAAsB,QAAQ;cAC5B,oBAAC,eAAD;KACU;KACE;KACF;KACR,gBAAgB,UAAU,SAAS;KACnC,aAAa,UAAU,SAAS;KAChC,YAAY;KACZ,QAAQ;KACR,CAAA;IACmB,CAAA;GACA,CAAA;EACrB,CAAA;;AAIV,MAAa,iCAAuD;CAClE,YAAY;CACZ,aAAa;CACb,YAAY,CAAC;EAAE,IAAI;EAAW,OAAO;EAAW,CAAC;CACjD,QAAQ,EAAE;CACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShareablesScreen-o1VYr_1K.cjs","names":["useFluidAuth","USER_TYPES","useSdkClient","useCurrentUser","useAppNavigation","ShareablesCoreProvider","ShareablesUIProvider","ShareablesApp"],"sources":["../src/hooks/use-user-type.ts","../../../file-picker/api-client/src/client.ts","../src/screens/ShareablesScreen.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useFluidAuth } from \"./use-fluid-auth\";\nimport { USER_TYPES, type UserType } from \"../auth/types\";\n\nexport interface UseUserTypeResult {\n userType: UserType | null;\n isCustomer: boolean;\n isRep: boolean;\n isAdmin: boolean;\n}\n\n/**\n * Convenience hook for user-type checks in the portal SDK.\n */\nexport function useUserType(): UseUserTypeResult {\n const { user } = useFluidAuth();\n\n return useMemo(() => {\n const userType = user?.user_type ?? null;\n return {\n userType,\n isCustomer: userType === USER_TYPES.customer,\n isRep: userType === USER_TYPES.rep,\n isAdmin:\n userType === USER_TYPES.admin || userType === USER_TYPES.root_admin,\n };\n }, [user?.user_type]);\n}\n","import type { FetchClientInstance } from \"@fluid-app/api-client-core\";\nimport type { DamAssetCreateResponse } from \"@fluid-app/file-picker-core\";\n\nexport interface DamUploadStrategy {\n uploadFile(params: {\n file: File;\n name: string;\n description?: string;\n tags?: string[];\n onProgress?: (progress: number) => void;\n companyId?: number;\n }): Promise<DamAssetCreateResponse>;\n}\n\nexport interface FilePickerClientConfig {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint?: string; // defaults to \"/api/proxy-url\"\n}\n\nexport interface FilePickerClient {\n fetchClient: FetchClientInstance;\n uploadStrategy?: DamUploadStrategy;\n unsplashAccessKey?: string;\n proxyEndpoint: string;\n}\n\nexport function createFilePickerClient(\n config: FilePickerClientConfig,\n): FilePickerClient {\n return {\n fetchClient: config.fetchClient,\n uploadStrategy: config.uploadStrategy,\n unsplashAccessKey: config.unsplashAccessKey,\n proxyEndpoint: config.proxyEndpoint ?? \"/api/proxy-url\",\n };\n}\n","import { useCallback, useMemo, type ComponentProps } from \"react\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { ShareablesCoreProvider } from \"@fluid-app/shareables-core\";\nimport { ShareablesUIProvider, ShareablesApp } from \"@fluid-app/shareables-ui\";\nimport { createFilePickerClient } from \"@fluid-app/file-picker-api-client\";\nimport { useCurrentUser } from \"../hooks/use-current-user\";\nimport { useAppNavigation } from \"../shell/AppNavigationContext\";\nimport { useSdkClient } from \"../account/use-account-clients\";\nimport { useUserType } from \"../hooks/use-user-type\";\n\ntype ShareablesScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n};\n\n/**\n * Parse the current shareables sub-route from the full slug.\n *\n * System nav slugs are \"share/products\", \"share/media\", \"share/playlists\".\n * Detail pages append an ID: \"share/products/123\", \"share/media/456\".\n *\n * \"share/products\" → screen=\"products\", detailId=null\n * \"share/products/123\" → screen=\"products\", detailId=\"123\"\n * \"share/media/456\" → screen=\"media\", detailId=\"456\"\n * \"share/playlists\" → screen=\"playlists\", detailId=null\n * \"share/playlists/789\" → screen=\"playlists\", detailId=\"789\"\n * \"share/files\" → screen=\"files\", detailId=null\n * \"share\" → screen=null (default to products)\n */\nfunction parseShareablesRoute(currentSlug: string): {\n screen: string | null;\n detailId: string | null;\n action: string | null;\n} {\n // Strip the \"share\" prefix\n const slugWithoutPrefix = currentSlug.replace(/^share\\/?/, \"\");\n if (!slugWithoutPrefix) {\n return { screen: null, detailId: null, action: null };\n }\n\n const parts = slugWithoutPrefix.split(\"/\");\n const screen = parts[0] || null;\n const detailId = parts[1] || null;\n const action = parts[2] || null;\n return { screen, detailId, action };\n}\n\nexport function ShareablesScreen({\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ShareablesScreenProps): React.JSX.Element {\n const domainClient = useSdkClient();\n const { data: userData } = useCurrentUser();\n const { currentSlug, navigate } = useAppNavigation();\n const { isCustomer } = useUserType();\n\n const { screen, detailId, action } = parseShareablesRoute(currentSlug);\n\n const handleNavigate = useCallback(\n (subScreen: string, id?: string) => {\n const path = id ? `share/${subScreen}/${id}` : `share/${subScreen}`;\n navigate(path);\n },\n [navigate],\n );\n\n const handleBack = useCallback(() => {\n if (detailId && screen) {\n // Navigate back to the listing for the current screen\n navigate(`share/${screen}`);\n } else {\n // Navigate to the default shareables screen\n navigate(\"share/products\");\n }\n }, [navigate, detailId, screen]);\n\n const coreConfig = useMemo(\n () => ({\n client: domainClient,\n user: userData ? { id: userData.id } : null,\n repContext: true,\n }),\n [domainClient, userData],\n );\n\n const filePickerClient = useMemo(\n () => createFilePickerClient({ fetchClient: domainClient }),\n [domainClient],\n );\n\n const uiConfig = useMemo(\n () => ({\n user: userData\n ? {\n id: userData.id,\n company: userData.company\n ? { logo_url: userData.company.logo_url }\n : null,\n }\n : undefined,\n affiliateId:\n (userData as { affiliate_id?: number } | undefined)?.affiliate_id ??\n null,\n basePath: \"\",\n navigate: (path: string) => {\n // Strip leading slash — cards generate paths like \"/share/product/123\"\n const cleanPath = path.replace(/^\\//, \"\");\n // Ensure share/ prefix — screen components pass relative paths like \"media/new\"\n const prefixed = cleanPath.startsWith(\"share/\")\n ? cleanPath\n : `share/${cleanPath}`;\n navigate(prefixed);\n },\n showToast: (opts: {\n title: string;\n type: \"success\" | \"error\" | \"warning\";\n }) => {\n console.warn(`[Shareables] ${opts.type}: ${opts.title}`);\n },\n filePickerClient,\n onToggleFavorite: async (params: {\n favoriteableId: number;\n favoriteableType: string;\n }) => {\n const affiliateId = (userData as { affiliate_id?: number } | undefined)\n ?.affiliate_id;\n if (!affiliateId) throw new Error(\"No affiliate ID\");\n return domainClient.post<{ is_favorited: boolean }>(\n `/user_companies/${affiliateId}/favorites/toggle.json`,\n {\n favoriteable_id: params.favoriteableId,\n favoriteable_type: params.favoriteableType,\n },\n );\n },\n onDeletePlaylist: isCustomer\n ? undefined\n : async (playlistId: number) => {\n const { playlists: playlistsApi } =\n await import(\"@fluid-app/shareables-api-client\");\n await playlistsApi.deletePlaylist(domainClient, playlistId);\n },\n readOnly: isCustomer,\n }),\n [userData, navigate, filePickerClient, domainClient, isCustomer],\n );\n\n return (\n <div {...divProps} className={`h-full ${divProps.className ?? \"\"}`}>\n <ShareablesCoreProvider config={coreConfig}>\n <ShareablesUIProvider config={uiConfig}>\n <ShareablesApp\n screen={screen}\n detailId={detailId}\n action={action}\n companyLogoUrl={userData?.company?.logo_url}\n countryCode={userData?.country?.iso}\n onNavigate={handleNavigate}\n onBack={handleBack}\n />\n </ShareablesUIProvider>\n </ShareablesCoreProvider>\n </div>\n );\n}\n\nexport const shareablesScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ShareablesScreen\",\n displayName: \"Shareables Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,cAAiC;CAC/C,MAAM,EAAE,SAASA,4BAAAA,cAAc;AAE/B,SAAA,GAAA,MAAA,eAAqB;EACnB,MAAM,WAAW,MAAM,aAAa;AACpC,SAAO;GACL;GACA,YAAY,aAAaC,sBAAAA,WAAW;GACpC,OAAO,aAAaA,sBAAAA,WAAW;GAC/B,SACE,aAAaA,sBAAAA,WAAW,SAAS,aAAaA,sBAAAA,WAAW;GAC5D;IACA,CAAC,MAAM,UAAU,CAAC;;;;ACEvB,SAAgB,uBACd,QACkB;AAClB,QAAO;EACL,aAAa,OAAO;EACpB,gBAAgB,OAAO;EACvB,mBAAmB,OAAO;EAC1B,eAAe,OAAO,iBAAiB;EACxC;;;;;;;;;;;;;;;;;;ACEH,SAAS,qBAAqB,aAI5B;CAEA,MAAM,oBAAoB,YAAY,QAAQ,aAAa,GAAG;AAC9D,KAAI,CAAC,kBACH,QAAO;EAAE,QAAQ;EAAM,UAAU;EAAM,QAAQ;EAAM;CAGvD,MAAM,QAAQ,kBAAkB,MAAM,IAAI;AAI1C,QAAO;EAAE,QAHM,MAAM,MAAM;EAGV,UAFA,MAAM,MAAM;EAEF,QADZ,MAAM,MAAM;EACQ;;AAGr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