@fluid-app/portal-sdk 0.1.98 → 0.1.99

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 (28) hide show
  1. package/dist/{MessagingScreen-DA62lyrN.mjs → MessagingScreen-BGr41874.mjs} +1 -0
  2. package/dist/{ProductsScreen-C0o1gVNw.mjs → ProductsScreen-6J79mnIB.mjs} +2 -2
  3. package/dist/{ProductsScreen-C0o1gVNw.mjs.map → ProductsScreen-6J79mnIB.mjs.map} +1 -1
  4. package/dist/{ProductsScreen-CigOdDOU.mjs → ProductsScreen-DCPVyEyQ.mjs} +5 -2
  5. package/dist/{ProductsScreen-CL16lwsI.cjs → ProductsScreen-DZnKtPBp.cjs} +2 -2
  6. package/dist/{ProductsScreen-BTrBbxX6.cjs → ProductsScreen-PJ95OcSX.cjs} +2 -2
  7. package/dist/{ProductsScreen-BTrBbxX6.cjs.map → ProductsScreen-PJ95OcSX.cjs.map} +1 -1
  8. package/dist/ShareablesScreen-CVT7u2hN.cjs +398 -0
  9. package/dist/ShareablesScreen-CVT7u2hN.cjs.map +1 -0
  10. package/dist/ShareablesScreen-Cy7w85IH.mjs +380 -0
  11. package/dist/ShareablesScreen-Cy7w85IH.mjs.map +1 -0
  12. package/dist/{ShareablesScreen-DufZz22d.cjs → ShareablesScreen-Dk5EQGMa.cjs} +2 -2
  13. package/dist/{ShareablesScreen-CSLB0ZXS.mjs → ShareablesScreen-jAj9hmif.mjs} +5 -2
  14. package/dist/index.cjs +7 -7
  15. package/dist/index.d.cts.map +1 -1
  16. package/dist/index.d.mts.map +1 -1
  17. package/dist/index.mjs +9 -9
  18. package/dist/{src-D9jWnRlX.mjs → src-BrwLqPPh.mjs} +90 -269
  19. package/dist/src-BrwLqPPh.mjs.map +1 -0
  20. package/dist/{src-C3R03o4d.cjs → src-Dlsw83js.cjs} +95 -268
  21. package/dist/src-Dlsw83js.cjs.map +1 -0
  22. package/package.json +12 -12
  23. package/dist/ShareablesScreen-B9c5Mw5b.mjs +0 -159
  24. package/dist/ShareablesScreen-B9c5Mw5b.mjs.map +0 -1
  25. package/dist/ShareablesScreen-Bldl8tta.cjs +0 -177
  26. package/dist/ShareablesScreen-Bldl8tta.cjs.map +0 -1
  27. package/dist/src-C3R03o4d.cjs.map +0 -1
  28. package/dist/src-D9jWnRlX.mjs.map +0 -1
@@ -1614,6 +1614,20 @@ function MediaDetailScreen({ mediaId, onNavigate: _onNavigate, onBack }) {
1614
1614
  });
1615
1615
  }
1616
1616
  //#endregion
1617
+ //#region ../../file-picker/ui/src/context/FilePickerApiContext.tsx
1618
+ const FilePickerApiContext = (0, react.createContext)(null);
1619
+ function FilePickerApiProvider({ api, children }) {
1620
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerApiContext.Provider, {
1621
+ value: api,
1622
+ children
1623
+ });
1624
+ }
1625
+ function useFilePickerApi() {
1626
+ const ctx = (0, react.useContext)(FilePickerApiContext);
1627
+ if (!ctx) throw new Error("useFilePickerApi must be used within a FilePickerApiProvider");
1628
+ return ctx;
1629
+ }
1630
+ //#endregion
1617
1631
  //#region ../../file-picker/ui/src/context/FilePickerContext.tsx
1618
1632
  const FilePickerContext = (0, react.createContext)(null);
1619
1633
  function FilePickerProvider({ children, value }) {
@@ -1683,106 +1697,16 @@ function UnsplashIcon({ className }) {
1683
1697
  });
1684
1698
  }
1685
1699
  //#endregion
1686
- //#region ../../file-picker/core/src/schemas/dam.ts
1687
- const damVariantSchema = zod.z.object({
1688
- id: zod.z.string(),
1689
- url: zod.z.string().nullable(),
1690
- file_name: zod.z.string(),
1691
- mime_type: zod.z.string(),
1692
- content: zod.z.any().nullable(),
1693
- created_at: zod.z.string(),
1694
- updated_at: zod.z.string(),
1695
- default: zod.z.boolean(),
1696
- is_original: zod.z.boolean(),
1697
- is_text: zod.z.boolean(),
1698
- media_type: zod.z.string(),
1699
- processing_status: zod.z.string(),
1700
- tags: zod.z.array(zod.z.string())
1701
- });
1702
- const damAssetSchema = zod.z.object({
1703
- id: zod.z.number(),
1704
- canonical_path: zod.z.string(),
1705
- category: zod.z.string(),
1706
- code: zod.z.string(),
1707
- company: zod.z.string(),
1708
- created_at: zod.z.string(),
1709
- default_variant_id: zod.z.string(),
1710
- default_variant_url: zod.z.string().optional(),
1711
- description: zod.z.string(),
1712
- name: zod.z.string(),
1713
- updated_at: zod.z.string(),
1714
- variants: zod.z.array(damVariantSchema).optional()
1715
- });
1716
- const damTreeFolderNodeSchema = zod.z.object({
1717
- asset_code: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1718
- name: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1719
- category: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).optional(),
1720
- variants: zod.z.union([zod.z.array(zod.z.unknown()), zod.z.record(zod.z.string(), zod.z.unknown())]).optional()
1721
- }).passthrough();
1722
- const damTreeSchema = zod.z.record(zod.z.string(), zod.z.union([
1723
- zod.z.lazy(() => damTreeSchema),
1724
- damAssetSchema,
1725
- damTreeFolderNodeSchema
1726
- ]));
1727
- const damQueryResponseSchema = zod.z.object({
1728
- path: zod.z.string(),
1729
- tree: damTreeSchema,
1730
- meta: zod.z.object({ next_cursor: zod.z.string().optional() }).optional()
1731
- });
1732
- zod.z.object({ asset: zod.z.object({
1733
- file: zod.z.any(),
1734
- name: zod.z.string(),
1735
- description: zod.z.string().optional(),
1736
- tags: zod.z.string().optional()
1737
- }) });
1738
- const damAssetCreateResponseSchema = zod.z.object({
1739
- asset: damAssetSchema,
1740
- meta: zod.z.object({
1741
- request_id: zod.z.string(),
1742
- timestamp: zod.z.string()
1743
- })
1744
- });
1745
- zod.z.object({
1746
- placeholder_asset: zod.z.object({
1747
- mime_type: zod.z.string(),
1748
- name: zod.z.string().optional(),
1749
- description: zod.z.string().optional()
1750
- }),
1751
- skip_autotagging: zod.z.boolean().optional()
1752
- });
1753
- zod.z.object({
1754
- asset: zod.z.object({
1755
- file: zod.z.any(),
1756
- name: zod.z.string(),
1757
- description: zod.z.string().optional(),
1758
- tags: zod.z.string().optional()
1759
- }).optional(),
1760
- text_asset: zod.z.object({
1761
- file_name: zod.z.string(),
1762
- mime_type: zod.z.string(),
1763
- text: zod.z.string(),
1764
- name: zod.z.string().optional(),
1765
- description: zod.z.string().optional(),
1766
- tags: zod.z.string().optional()
1767
- }).optional(),
1768
- placeholder_asset: zod.z.object({
1769
- mime_type: zod.z.string(),
1770
- name: zod.z.string().optional(),
1771
- description: zod.z.string().optional()
1772
- }).optional(),
1773
- skip_autotagging: zod.z.boolean().optional()
1774
- });
1775
- const damAssetPathCreateResponseSchema = zod.z.object({
1776
- asset: zod.z.object({
1777
- id: zod.z.number(),
1778
- canonical_path: zod.z.string(),
1779
- name: zod.z.string()
1780
- }),
1781
- meta: zod.z.object({
1782
- request_id: zod.z.string(),
1783
- timestamp: zod.z.string()
1784
- })
1785
- });
1700
+ //#region ../../file-picker/core/src/query-keys.ts
1701
+ const damQueryKeys = {
1702
+ all: ["dam"],
1703
+ assets: () => ["dam", "assets"],
1704
+ query: (params) => [
1705
+ "dam",
1706
+ "query",
1707
+ params
1708
+ ]
1709
+ };
1786
1710
  //#endregion
1787
1711
  //#region ../../file-picker/core/src/schemas/file-picker-config.ts
1788
1712
  const filePickerConfigSchema = zod.z.object({
@@ -2516,115 +2440,6 @@ function getSanitizedAssetName(filename) {
2516
2440
  return sanitizedName;
2517
2441
  }
2518
2442
  //#endregion
2519
- //#region ../../file-picker/api-client/src/api/dam-assets.ts
2520
- /**
2521
- * Create a DAM asset. Text files use FormData upload; non-text files
2522
- * delegate to the provided uploadStrategy (e.g. ImageKit).
2523
- * If no uploadStrategy is provided, all files use FormData upload.
2524
- */
2525
- async function createDamAsset(fetchClient, params, uploadStrategy) {
2526
- const mimeType = getFileMimeType(params.file);
2527
- if (mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/xml" || params.file.name.endsWith(".txt") || params.file.name.endsWith(".json") || params.file.name.endsWith(".xml") || params.file.name.endsWith(".csv")) return createDamAssetViaFormData(fetchClient, params);
2528
- if (uploadStrategy) return uploadStrategy.uploadFile(params);
2529
- return createDamAssetViaFormData(fetchClient, params);
2530
- }
2531
- async function createDamAssetViaFormData(fetchClient, params) {
2532
- const formData = new FormData();
2533
- formData.append("asset[file]", params.file);
2534
- formData.append("asset[name]", params.name);
2535
- if (params.description) formData.append("asset[description]", params.description);
2536
- if (params.tags && params.tags.length > 0) formData.append("asset[tags]", params.tags.join(","));
2537
- const response = await fetchClient.requestWithFormData("/dam/assets", formData, { method: "POST" });
2538
- return damAssetCreateResponseSchema.parse(response);
2539
- }
2540
- async function createDamAssetPathForAssets(fetchClient, { asset_paths, code }) {
2541
- const response = await fetchClient.post(`/dam/assets/${code}/asset_paths`, { asset_paths });
2542
- return damAssetPathCreateResponseSchema.parse(response);
2543
- }
2544
- //#endregion
2545
- //#region ../../file-picker/api-client/src/api/dam-query.ts
2546
- async function queryDamAssets(fetchClient, params) {
2547
- const response = await fetchClient.post("/dam/query", params);
2548
- return damQueryResponseSchema.parse(response);
2549
- }
2550
- async function deleteDamAsset(fetchClient, code) {
2551
- return fetchClient.delete(`/dam/assets/${code}`);
2552
- }
2553
- async function discardDamAsset(fetchClient, code) {
2554
- return fetchClient.patch(`/dam/assets/${code}/discard`);
2555
- }
2556
- //#endregion
2557
- //#region ../../file-picker/api-client/src/api/url-proxy.ts
2558
- const urlProxyResponseSchema = zod.z.object({
2559
- data: zod.z.string(),
2560
- contentType: zod.z.string(),
2561
- size: zod.z.number()
2562
- });
2563
- /**
2564
- * Proxy a URL fetch through the backend to bypass CORS restrictions.
2565
- * The backend fetches the file and returns it as base64-encoded data.
2566
- *
2567
- * @param url - The URL to fetch
2568
- * @param proxyEndpoint - The proxy endpoint (defaults to "/api/proxy-url")
2569
- */
2570
- async function proxyUrlFetch(url, proxyEndpoint = "/api/proxy-url") {
2571
- const response = await fetch(proxyEndpoint, {
2572
- method: "POST",
2573
- headers: { "Content-Type": "application/json" },
2574
- body: JSON.stringify({ url })
2575
- });
2576
- if (!response.ok) {
2577
- const errorData = await response.json().catch(() => ({ error: "Failed to proxy URL fetch" }));
2578
- throw new Error(errorData.error || `HTTP ${response.status}`);
2579
- }
2580
- const data = await response.json();
2581
- return urlProxyResponseSchema.parse(data);
2582
- }
2583
- //#endregion
2584
- //#region ../../file-picker/api-client/src/api/unsplash.ts
2585
- const unsplashImageSchema = zod.z.object({
2586
- id: zod.z.string(),
2587
- urls: zod.z.object({
2588
- raw: zod.z.string(),
2589
- full: zod.z.string(),
2590
- regular: zod.z.string(),
2591
- small: zod.z.string(),
2592
- thumb: zod.z.string()
2593
- }),
2594
- alt_description: zod.z.string().nullable(),
2595
- description: zod.z.string().nullable(),
2596
- user: zod.z.object({
2597
- name: zod.z.string(),
2598
- username: zod.z.string()
2599
- }),
2600
- width: zod.z.number(),
2601
- height: zod.z.number()
2602
- });
2603
- const unsplashSearchResponseSchema = zod.z.object({
2604
- results: zod.z.array(unsplashImageSchema),
2605
- total: zod.z.number(),
2606
- total_pages: zod.z.number()
2607
- });
2608
- /**
2609
- * Search Unsplash for photos matching a query.
2610
- */
2611
- async function searchUnsplash(query, accessKey, page = 1, perPage = 20) {
2612
- const response = await fetch(`https://api.unsplash.com/search/photos?query=${encodeURIComponent(query)}&page=${page}&per_page=${perPage}&client_id=${accessKey}`);
2613
- if (!response.ok) throw new Error("Failed to search Unsplash");
2614
- return unsplashSearchResponseSchema.parse(await response.json());
2615
- }
2616
- //#endregion
2617
- //#region ../../file-picker/api-client/src/query-keys.ts
2618
- const damQueryKeys = {
2619
- all: ["dam"],
2620
- assets: () => ["dam", "assets"],
2621
- query: (params) => [
2622
- "dam",
2623
- "query",
2624
- params
2625
- ]
2626
- };
2627
- //#endregion
2628
2443
  //#region ../../file-picker/ui/src/hooks/use-debounced-search.ts
2629
2444
  const useDebouncedSearch = (delay = 300) => {
2630
2445
  const [searchQuery, setSearchQuery] = (0, react.useState)("");
@@ -2696,7 +2511,8 @@ const flattenTree = (tree, basePath = "", depth = 0) => {
2696
2511
  };
2697
2512
  };
2698
2513
  const useDamLibrary = (fileTypeFilter, controlledSearch) => {
2699
- const { apiClient, companyId } = useFilePickerContext();
2514
+ const api = useFilePickerApi();
2515
+ const { companyId } = useFilePickerContext();
2700
2516
  const [currentPath, setCurrentPath] = (0, react.useState)("*");
2701
2517
  const internalSearch = useDebouncedSearch(300);
2702
2518
  const isControlled = controlledSearch !== void 0;
@@ -2731,7 +2547,7 @@ const useDamLibrary = (fileTypeFilter, controlledSearch) => {
2731
2547
  search: debouncedSearchQuery,
2732
2548
  filters: canonicalPathFilters
2733
2549
  }),
2734
- queryFn: ({ pageParam }) => queryDamAssets(apiClient.fetchClient, {
2550
+ queryFn: ({ pageParam }) => api.queryDamAssets({
2735
2551
  path: ltreeQueryPath || "*",
2736
2552
  search: debouncedSearchQuery,
2737
2553
  tags_string: "*",
@@ -3225,7 +3041,8 @@ function getBreadcrumbsFromPath(currentPath) {
3225
3041
  }
3226
3042
  const DamLibrary = (0, react.forwardRef)(({ config, onAssetsSelected, onSelectionChange, onConfirmAndClose, onSearchingChange, showVariants: _showVariants = false, searchQuery: controlledSearchQuery, onSearchChange: controlledSetSearchQuery, thumbnailSize = 100, viewMode = "grid", showNamesOnMedia = true, sortOption, onFoldersChange, previewContainer, previewAsset, onPreviewAssetChange }, ref) => {
3227
3043
  "use no memo";
3228
- const { apiClient, companyId, toast } = useFilePickerContext();
3044
+ const api = useFilePickerApi();
3045
+ const { companyId, toast } = useFilePickerContext();
3229
3046
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
3230
3047
  const controlledSearch = controlledSearchQuery !== void 0 && controlledSetSearchQuery ? {
3231
3048
  searchQuery: controlledSearchQuery,
@@ -3259,7 +3076,7 @@ const DamLibrary = (0, react.forwardRef)(({ config, onAssetsSelected, onSelectio
3259
3076
  const form = require_src.useZodForm(folderSchema, { defaultValues: { folderName: "" } });
3260
3077
  const { mutate, isPending } = (0, _tanstack_react_query.useMutation)({
3261
3078
  mutationFn: (data) => {
3262
- const promises = data.map((params) => createDamAssetPathForAssets(apiClient.fetchClient, params));
3079
+ const promises = data.map((params) => api.createDamAssetPathForAssets(params));
3263
3080
  return Promise.all(promises);
3264
3081
  },
3265
3082
  onSuccess: () => {
@@ -3277,7 +3094,7 @@ const DamLibrary = (0, react.forwardRef)(({ config, onAssetsSelected, onSelectio
3277
3094
  const lastClickedIndexRef = (0, react.useRef)(-1);
3278
3095
  const pendingClickTimeoutRef = (0, react.useRef)(null);
3279
3096
  const { mutate: deleteAssetMutate, isPending: isDeleting } = (0, _tanstack_react_query.useMutation)({
3280
- mutationFn: (assetCode) => deleteDamAsset(apiClient.fetchClient, assetCode),
3097
+ mutationFn: (assetCode) => api.deleteDamAsset(assetCode),
3281
3098
  onSuccess: () => {
3282
3099
  toast.success("Asset deleted successfully");
3283
3100
  queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
@@ -3287,7 +3104,7 @@ const DamLibrary = (0, react.forwardRef)(({ config, onAssetsSelected, onSelectio
3287
3104
  }
3288
3105
  });
3289
3106
  const { mutate: discardAssetMutate, isPending: isDiscarding } = (0, _tanstack_react_query.useMutation)({
3290
- mutationFn: (assetCode) => discardDamAsset(apiClient.fetchClient, assetCode),
3107
+ mutationFn: (assetCode) => api.discardDamAsset(assetCode),
3291
3108
  onSuccess: () => {
3292
3109
  toast.success("Asset discarded successfully");
3293
3110
  queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
@@ -4306,9 +4123,10 @@ const useUnsplashPicker = (options) => {
4306
4123
  const [hasMoreResults, setHasMoreResults] = (0, react.useState)(true);
4307
4124
  const [uploadProgress, setUploadProgress] = (0, react.useState)(/* @__PURE__ */ new Map());
4308
4125
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
4309
- const { apiClient, unsplashAccessKey, apiBaseUrl, toast } = useFilePickerContext();
4126
+ const api = useFilePickerApi();
4127
+ const { apiBaseUrl, toast } = useFilePickerContext();
4310
4128
  const uploadMutation = (0, _tanstack_react_query.useMutation)({
4311
- mutationFn: (params) => createDamAsset(apiClient.fetchClient, params, apiClient.uploadStrategy),
4129
+ mutationFn: (params) => api.createDamAsset(params),
4312
4130
  onSuccess: () => {
4313
4131
  queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
4314
4132
  }
@@ -4325,8 +4143,7 @@ const useUnsplashPicker = (options) => {
4325
4143
  setCurrentPage(1);
4326
4144
  } else setIsLoadingMore(true);
4327
4145
  try {
4328
- if (!unsplashAccessKey) throw new Error("Unsplash Access Key is not configured");
4329
- const data = await searchUnsplash(query, unsplashAccessKey, page);
4146
+ const data = await api.searchUnsplash(query, page);
4330
4147
  setSearchResults((prevResults) => page === 1 ? data.results : [...prevResults, ...data.results]);
4331
4148
  setCurrentPage(page);
4332
4149
  setHasMoreResults(page < data.total_pages);
@@ -4337,7 +4154,7 @@ const useUnsplashPicker = (options) => {
4337
4154
  setIsSearching(false);
4338
4155
  setIsLoadingMore(false);
4339
4156
  }
4340
- }, [unsplashAccessKey, toast]);
4157
+ }, [api, toast]);
4341
4158
  const downloadAndUpload = (0, react.useCallback)(async (image) => {
4342
4159
  const uploadId = `unsplash-${image.id}`;
4343
4160
  const fileName = `unsplash-${image.id}.jpg`;
@@ -4664,9 +4481,10 @@ const UnsplashPicker = ({ config, onFileSelected, searchQuery: controlledSearchQ
4664
4481
  const useUrlUpload = () => {
4665
4482
  const [uploadProgress, setUploadProgress] = (0, react.useState)(/* @__PURE__ */ new Map());
4666
4483
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
4667
- const { apiClient, companyId, apiBaseUrl, toast } = useFilePickerContext();
4484
+ const api = useFilePickerApi();
4485
+ const { companyId, apiBaseUrl, toast } = useFilePickerContext();
4668
4486
  const uploadMutation = (0, _tanstack_react_query.useMutation)({
4669
- mutationFn: (params) => createDamAsset(apiClient.fetchClient, params, apiClient.uploadStrategy),
4487
+ mutationFn: (params) => api.createDamAsset(params),
4670
4488
  onSuccess: () => {
4671
4489
  queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
4672
4490
  }
@@ -4715,7 +4533,7 @@ const useUrlUpload = () => {
4715
4533
  return next;
4716
4534
  });
4717
4535
  try {
4718
- const proxyResponse = await proxyUrlFetch(url, apiClient.proxyEndpoint);
4536
+ const proxyResponse = await api.proxyUrlFetch(url);
4719
4537
  const binaryString = atob(proxyResponse.data);
4720
4538
  const bytes = new Uint8Array(binaryString.length);
4721
4539
  for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
@@ -4809,7 +4627,7 @@ const useUrlUpload = () => {
4809
4627
  uploadMutation,
4810
4628
  companyId,
4811
4629
  apiBaseUrl,
4812
- apiClient.proxyEndpoint,
4630
+ api,
4813
4631
  toast
4814
4632
  ]);
4815
4633
  const clearProgress = (0, react.useCallback)(() => {
@@ -5042,9 +4860,10 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
5042
4860
  const useComputerUpload = () => {
5043
4861
  const [uploadProgress, setUploadProgress] = (0, react.useState)(/* @__PURE__ */ new Map());
5044
4862
  const queryClient = (0, _tanstack_react_query.useQueryClient)();
5045
- const { apiClient, companyId, toast, apiBaseUrl } = useFilePickerContext();
4863
+ const api = useFilePickerApi();
4864
+ const { companyId, toast, apiBaseUrl } = useFilePickerContext();
5046
4865
  const uploadMutation = (0, _tanstack_react_query.useMutation)({
5047
- mutationFn: (params) => createDamAsset(apiClient.fetchClient, params, apiClient.uploadStrategy),
4866
+ mutationFn: (params) => api.createDamAsset(params),
5048
4867
  onSuccess: () => {
5049
4868
  queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
5050
4869
  }
@@ -6520,7 +6339,7 @@ function FilePreview({ result, mediaType }) {
6520
6339
  });
6521
6340
  }
6522
6341
  function MediaCreateScreen({ onNavigate, onBack }) {
6523
- const { navigate, showToast, filePickerClient } = useShareablesUI();
6342
+ const { navigate, showToast, filePickerApi } = useShareablesUI();
6524
6343
  const user = useShareablesUser();
6525
6344
  require_ScreenHeaderContext.useScreenHeaderBreadcrumbs((0, react.useMemo)(() => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Breadcrumb, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.BreadcrumbList, {
6526
6345
  className: "text-lg",
@@ -6612,23 +6431,20 @@ function MediaCreateScreen({ onNavigate, onBack }) {
6612
6431
  if (!title.trim()) setTitle(result.metadata.file_name.replace(/\.[^/.]+$/, ""));
6613
6432
  }, [title]);
6614
6433
  const filePickerContextValue = (0, react.useMemo)(() => {
6615
- if (!filePickerClient) return null;
6616
- return {
6617
- apiClient: filePickerClient,
6618
- toast: {
6619
- success: (msg) => showToast({
6620
- title: msg,
6621
- type: "success"
6622
- }),
6623
- error: (msg, error) => showToast({
6624
- title: error instanceof Error ? `${msg}: ${error.message}` : msg,
6625
- type: "error"
6626
- }),
6627
- loading: () => "",
6628
- dismiss: () => {}
6629
- }
6630
- };
6631
- }, [filePickerClient, showToast]);
6434
+ if (!filePickerApi) return null;
6435
+ return { toast: {
6436
+ success: (msg) => showToast({
6437
+ title: msg,
6438
+ type: "success"
6439
+ }),
6440
+ error: (msg, error) => showToast({
6441
+ title: error instanceof Error ? `${msg}: ${error.message}` : msg,
6442
+ type: "error"
6443
+ }),
6444
+ loading: () => "",
6445
+ dismiss: () => {}
6446
+ } };
6447
+ }, [filePickerApi, showToast]);
6632
6448
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6633
6449
  className: "flex flex-col gap-4 px-4 py-4 md:px-10 md:py-6",
6634
6450
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -6659,7 +6475,7 @@ function MediaCreateScreen({ onNavigate, onBack }) {
6659
6475
  onClick: () => setIsPickerOpen(true),
6660
6476
  variant: "outline",
6661
6477
  className: "flex h-32 w-full flex-col items-center justify-center gap-2 border-dashed",
6662
- disabled: !filePickerClient,
6478
+ disabled: !filePickerApi,
6663
6479
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: "text-muted-foreground h-6 w-6" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6664
6480
  className: "text-muted-foreground text-sm",
6665
6481
  children: "Select File"
@@ -6717,13 +6533,16 @@ function MediaCreateScreen({ onNavigate, onBack }) {
6717
6533
  children: isCreating ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Spinner, { className: "size-4" }) : "Save Media"
6718
6534
  })
6719
6535
  ]
6720
- }), filePickerContextValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerProvider, {
6721
- value: filePickerContextValue,
6722
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePicker, {
6723
- open: isPickerOpen,
6724
- onFilesSelected: handleFilesSelected,
6725
- onClose: () => setIsPickerOpen(false),
6726
- config: { maxFiles: 1 }
6536
+ }), filePickerContextValue && filePickerApi && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerApiProvider, {
6537
+ api: filePickerApi,
6538
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerProvider, {
6539
+ value: filePickerContextValue,
6540
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePicker, {
6541
+ open: isPickerOpen,
6542
+ onFilesSelected: handleFilesSelected,
6543
+ onClose: () => setIsPickerOpen(false),
6544
+ config: { maxFiles: 1 }
6545
+ })
6727
6546
  })
6728
6547
  })]
6729
6548
  });
@@ -8301,7 +8120,7 @@ function computeOrderedItems(items) {
8301
8120
  return result;
8302
8121
  }
8303
8122
  function PlaylistItemsSection({ playlistId }) {
8304
- const { showToast, filePickerClient } = useShareablesUI();
8123
+ const { showToast, filePickerApi } = useShareablesUI();
8305
8124
  const api = useShareablesApi();
8306
8125
  const [filePickerOpen, setFilePickerOpen] = (0, react.useState)(false);
8307
8126
  const { items: contextItems, updateItems, addItem, removeItem } = usePlaylistItems();
@@ -8406,9 +8225,8 @@ function PlaylistItemsSection({ playlistId }) {
8406
8225
  }
8407
8226
  };
8408
8227
  const filePickerContextValue = (0, react.useMemo)(() => {
8409
- if (!filePickerClient) return null;
8228
+ if (!filePickerApi) return null;
8410
8229
  return {
8411
- apiClient: filePickerClient,
8412
8230
  toast: {
8413
8231
  success: (msg) => showToast({
8414
8232
  title: msg,
@@ -8424,7 +8242,7 @@ function PlaylistItemsSection({ playlistId }) {
8424
8242
  shareablesClient: { media: { list: (filters) => api.media.getMedia(filters ?? {}) } }
8425
8243
  };
8426
8244
  }, [
8427
- filePickerClient,
8245
+ filePickerApi,
8428
8246
  showToast,
8429
8247
  api
8430
8248
  ]);
@@ -8451,7 +8269,7 @@ function PlaylistItemsSection({ playlistId }) {
8451
8269
  className: "flex shrink-0 flex-wrap items-center justify-end gap-2",
8452
8270
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
8453
8271
  type: "button",
8454
- disabled: addItemMutation.isPending || !filePickerClient,
8272
+ disabled: addItemMutation.isPending || !filePickerApi,
8455
8273
  variant: "default",
8456
8274
  size: "sm",
8457
8275
  className: "flex min-w-25 items-center gap-2",
@@ -8466,16 +8284,19 @@ function PlaylistItemsSection({ playlistId }) {
8466
8284
  isDeletePending: removeItemMutation.isPending,
8467
8285
  enableReordering: true
8468
8286
  })]
8469
- }), filePickerContextValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerProvider, {
8470
- value: filePickerContextValue,
8471
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePicker, {
8472
- open: filePickerOpen,
8473
- onFilesSelected: (selected) => void handleFilePickerResults(selected),
8474
- onClose: () => setFilePickerOpen(false),
8475
- config: {
8476
- maxFiles: 50,
8477
- allowedMethods: ["media"]
8478
- }
8287
+ }), filePickerContextValue && filePickerApi && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerApiProvider, {
8288
+ api: filePickerApi,
8289
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePickerProvider, {
8290
+ value: filePickerContextValue,
8291
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilePicker, {
8292
+ open: filePickerOpen,
8293
+ onFilesSelected: (selected) => void handleFilePickerResults(selected),
8294
+ onClose: () => setFilePickerOpen(false),
8295
+ config: {
8296
+ maxFiles: 50,
8297
+ allowedMethods: ["media"]
8298
+ }
8299
+ })
8479
8300
  })
8480
8301
  })]
8481
8302
  });
@@ -9045,5 +8866,11 @@ Object.defineProperty(exports, "ShareablesUIProvider", {
9045
8866
  return ShareablesUIProvider;
9046
8867
  }
9047
8868
  });
8869
+ Object.defineProperty(exports, "getFileMimeType", {
8870
+ enumerable: true,
8871
+ get: function() {
8872
+ return getFileMimeType;
8873
+ }
8874
+ });
9048
8875
 
9049
- //# sourceMappingURL=src-C3R03o4d.cjs.map
8876
+ //# sourceMappingURL=src-Dlsw83js.cjs.map