@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.
- package/dist/{MessagingScreen-DA62lyrN.mjs → MessagingScreen-BGr41874.mjs} +1 -0
- package/dist/{ProductsScreen-C0o1gVNw.mjs → ProductsScreen-6J79mnIB.mjs} +2 -2
- package/dist/{ProductsScreen-C0o1gVNw.mjs.map → ProductsScreen-6J79mnIB.mjs.map} +1 -1
- package/dist/{ProductsScreen-CigOdDOU.mjs → ProductsScreen-DCPVyEyQ.mjs} +5 -2
- package/dist/{ProductsScreen-CL16lwsI.cjs → ProductsScreen-DZnKtPBp.cjs} +2 -2
- package/dist/{ProductsScreen-BTrBbxX6.cjs → ProductsScreen-PJ95OcSX.cjs} +2 -2
- package/dist/{ProductsScreen-BTrBbxX6.cjs.map → ProductsScreen-PJ95OcSX.cjs.map} +1 -1
- package/dist/ShareablesScreen-CVT7u2hN.cjs +398 -0
- package/dist/ShareablesScreen-CVT7u2hN.cjs.map +1 -0
- package/dist/ShareablesScreen-Cy7w85IH.mjs +380 -0
- package/dist/ShareablesScreen-Cy7w85IH.mjs.map +1 -0
- package/dist/{ShareablesScreen-DufZz22d.cjs → ShareablesScreen-Dk5EQGMa.cjs} +2 -2
- package/dist/{ShareablesScreen-CSLB0ZXS.mjs → ShareablesScreen-jAj9hmif.mjs} +5 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/{src-D9jWnRlX.mjs → src-BrwLqPPh.mjs} +90 -269
- package/dist/src-BrwLqPPh.mjs.map +1 -0
- package/dist/{src-C3R03o4d.cjs → src-Dlsw83js.cjs} +95 -268
- package/dist/src-Dlsw83js.cjs.map +1 -0
- package/package.json +12 -12
- package/dist/ShareablesScreen-B9c5Mw5b.mjs +0 -159
- package/dist/ShareablesScreen-B9c5Mw5b.mjs.map +0 -1
- package/dist/ShareablesScreen-Bldl8tta.cjs +0 -177
- package/dist/ShareablesScreen-Bldl8tta.cjs.map +0 -1
- package/dist/src-C3R03o4d.cjs.map +0 -1
- package/dist/src-D9jWnRlX.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -37,7 +37,7 @@ import { a as useFluidAuth } from "./use-account-clients-Dsqx0mKw.mjs";
|
|
|
37
37
|
import { i as useScreenHeaderContext, t as ScreenHeaderProvider } from "./ScreenHeaderContext-CrdfLGKk.mjs";
|
|
38
38
|
import { t as useFluidApi } from "./use-fluid-api-CaSYWFuj.mjs";
|
|
39
39
|
import { i as useCompanyScopedQueryKey, n as useCurrentUser, r as createCompanyQueryKey, t as CURRENT_USER_QUERY_KEY } from "./use-current-user-BMI-LR9t.mjs";
|
|
40
|
-
import { n as shareablesScreenPropertySchema, r as useUserType, t as ShareablesScreen } from "./ShareablesScreen-
|
|
40
|
+
import { n as shareablesScreenPropertySchema, r as useUserType, t as ShareablesScreen } from "./ShareablesScreen-Cy7w85IH.mjs";
|
|
41
41
|
import { i as CoreScreenPlaceholder, r as customersScreenPropertySchema, t as CustomersScreen } from "./CustomersScreen-xAauAB-B.mjs";
|
|
42
42
|
import { n as useAppNavigation, t as AppNavigationProvider } from "./AppNavigationContext-Du3Qq0yc.mjs";
|
|
43
43
|
import { r as profileScreenPropertySchema, t as ProfileScreen } from "./ProfileScreen-CUsGRCB7.mjs";
|
|
@@ -49,9 +49,9 @@ import "./src-BakNjVTk.mjs";
|
|
|
49
49
|
import "./dist-oYNtEpKP.mjs";
|
|
50
50
|
import { r as ordersScreenPropertySchema, t as OrdersScreen } from "./OrdersScreen-Djdeji9g.mjs";
|
|
51
51
|
import { r as subscriptionsScreenPropertySchema, t as SubscriptionsScreen } from "./SubscriptionsScreen-C5YWtYfE.mjs";
|
|
52
|
-
import "./src-
|
|
52
|
+
import "./src-BrwLqPPh.mjs";
|
|
53
53
|
import "./sortable.esm-DSrWP4x9.mjs";
|
|
54
|
-
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-
|
|
54
|
+
import { n as productsScreenPropertySchema, t as ProductsScreen } from "./ProductsScreen-6J79mnIB.mjs";
|
|
55
55
|
import { r as mySiteScreenPropertySchema, t as MySiteScreen } from "./MySiteScreen-Bvyx63pT.mjs";
|
|
56
56
|
import { r as shopScreenPropertySchema, t as ShopScreen } from "./ShopScreen-AGvcqUii.mjs";
|
|
57
57
|
import "./UpgradeScreen-CTXUueQY.mjs";
|
|
@@ -3000,12 +3000,12 @@ function AccountManageLayout({ children }) {
|
|
|
3000
3000
|
const ProfileScreen$1 = lazy(() => import("./ProfileScreen-CUsGRCB7.mjs").then((n) => n.n).then((m) => ({ default: m.ProfileScreen })));
|
|
3001
3001
|
const OrdersScreen$1 = lazy(() => import("./OrdersScreen-Djdeji9g.mjs").then((n) => n.n).then((m) => ({ default: m.OrdersScreen })));
|
|
3002
3002
|
const SubscriptionsScreen$1 = lazy(() => import("./SubscriptionsScreen-C5YWtYfE.mjs").then((n) => n.n).then((m) => ({ default: m.SubscriptionsScreen })));
|
|
3003
|
-
const MessagingScreen$1 = lazy(() => import("./MessagingScreen-
|
|
3003
|
+
const MessagingScreen$1 = lazy(() => import("./MessagingScreen-BGr41874.mjs").then((m) => ({ default: m.MessagingScreen })));
|
|
3004
3004
|
const ContactsScreen$1 = lazy(() => import("./ContactsScreen-BGwqGlpV.mjs").then((n) => n.n).then((m) => ({ default: m.ContactsScreen })));
|
|
3005
3005
|
const ShopScreen$1 = lazy(() => import("./ShopScreen-AGvcqUii.mjs").then((n) => n.n).then((m) => ({ default: m.ShopScreen })));
|
|
3006
3006
|
const CustomersScreen$1 = lazy(() => import("./CustomersScreen-xAauAB-B.mjs").then((n) => n.n).then((m) => ({ default: m.CustomersScreen })));
|
|
3007
|
-
const ProductsScreen$1 = lazy(() => import("./ProductsScreen-
|
|
3008
|
-
const ShareablesScreen$1 = lazy(() => import("./ShareablesScreen-
|
|
3007
|
+
const ProductsScreen$1 = lazy(() => import("./ProductsScreen-DCPVyEyQ.mjs").then((m) => ({ default: m.ProductsScreen })));
|
|
3008
|
+
const ShareablesScreen$1 = lazy(() => import("./ShareablesScreen-jAj9hmif.mjs").then((m) => ({ default: m.ShareablesScreen })));
|
|
3009
3009
|
const MySiteScreen$1 = lazy(() => import("./MySiteScreen-Bvyx63pT.mjs").then((n) => n.n).then((m) => ({ default: m.MySiteScreen })));
|
|
3010
3010
|
const UpgradeScreen = lazy(() => import("./UpgradeScreen-CTXUueQY.mjs").then((n) => n.t).then((m) => ({ default: m.UpgradeScreen })));
|
|
3011
3011
|
const AppDownloadScreen = lazy(() => import("./AppDownloadScreen-rO--O0pk.mjs").then((n) => n.t).then((m) => ({ default: m.AppDownloadScreen })));
|
|
@@ -4467,14 +4467,14 @@ function useContact(_contactId) {
|
|
|
4467
4467
|
//#region src/screens/index.ts
|
|
4468
4468
|
const screenPropertySchemas = {
|
|
4469
4469
|
ProfileScreen: () => import("./ProfileScreen-CUsGRCB7.mjs").then((n) => n.n).then((m) => m.profileScreenPropertySchema),
|
|
4470
|
-
MessagingScreen: () => import("./MessagingScreen-
|
|
4470
|
+
MessagingScreen: () => import("./MessagingScreen-BGr41874.mjs").then((m) => m.messagingScreenPropertySchema),
|
|
4471
4471
|
ContactsScreen: () => import("./ContactsScreen-BGwqGlpV.mjs").then((n) => n.n).then((m) => m.contactsScreenPropertySchema),
|
|
4472
4472
|
OrdersScreen: () => import("./OrdersScreen-Djdeji9g.mjs").then((n) => n.n).then((m) => m.ordersScreenPropertySchema),
|
|
4473
4473
|
SubscriptionsScreen: () => import("./SubscriptionsScreen-C5YWtYfE.mjs").then((n) => n.n).then((m) => m.subscriptionsScreenPropertySchema),
|
|
4474
4474
|
CustomersScreen: () => import("./CustomersScreen-xAauAB-B.mjs").then((n) => n.n).then((m) => m.customersScreenPropertySchema),
|
|
4475
|
-
ProductsScreen: () => import("./ProductsScreen-
|
|
4475
|
+
ProductsScreen: () => import("./ProductsScreen-DCPVyEyQ.mjs").then((m) => m.productsScreenPropertySchema),
|
|
4476
4476
|
MySiteScreen: () => import("./MySiteScreen-Bvyx63pT.mjs").then((n) => n.n).then((m) => m.mySiteScreenPropertySchema),
|
|
4477
|
-
ShareablesScreen: () => import("./ShareablesScreen-
|
|
4477
|
+
ShareablesScreen: () => import("./ShareablesScreen-jAj9hmif.mjs").then((m) => m.shareablesScreenPropertySchema),
|
|
4478
4478
|
ShopScreen: () => import("./ShopScreen-AGvcqUii.mjs").then((n) => n.n).then((m) => m.shopScreenPropertySchema),
|
|
4479
4479
|
UpgradeScreen: () => import("./UpgradeScreen-CTXUueQY.mjs").then((n) => n.t).then((m) => m.upgradeScreenPropertySchema),
|
|
4480
4480
|
AppDownloadScreen: () => import("./AppDownloadScreen-rO--O0pk.mjs").then((n) => n.t).then((m) => m.appDownloadScreenPropertySchema)
|
|
@@ -1612,6 +1612,20 @@ function MediaDetailScreen({ mediaId, onNavigate: _onNavigate, onBack }) {
|
|
|
1612
1612
|
});
|
|
1613
1613
|
}
|
|
1614
1614
|
//#endregion
|
|
1615
|
+
//#region ../../file-picker/ui/src/context/FilePickerApiContext.tsx
|
|
1616
|
+
const FilePickerApiContext = createContext(null);
|
|
1617
|
+
function FilePickerApiProvider({ api, children }) {
|
|
1618
|
+
return /* @__PURE__ */ jsx(FilePickerApiContext.Provider, {
|
|
1619
|
+
value: api,
|
|
1620
|
+
children
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
function useFilePickerApi() {
|
|
1624
|
+
const ctx = useContext(FilePickerApiContext);
|
|
1625
|
+
if (!ctx) throw new Error("useFilePickerApi must be used within a FilePickerApiProvider");
|
|
1626
|
+
return ctx;
|
|
1627
|
+
}
|
|
1628
|
+
//#endregion
|
|
1615
1629
|
//#region ../../file-picker/ui/src/context/FilePickerContext.tsx
|
|
1616
1630
|
const FilePickerContext = createContext(null);
|
|
1617
1631
|
function FilePickerProvider({ children, value }) {
|
|
@@ -1681,106 +1695,16 @@ function UnsplashIcon({ className }) {
|
|
|
1681
1695
|
});
|
|
1682
1696
|
}
|
|
1683
1697
|
//#endregion
|
|
1684
|
-
//#region ../../file-picker/core/src/
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
is_original: z.boolean(),
|
|
1695
|
-
is_text: z.boolean(),
|
|
1696
|
-
media_type: z.string(),
|
|
1697
|
-
processing_status: z.string(),
|
|
1698
|
-
tags: z.array(z.string())
|
|
1699
|
-
});
|
|
1700
|
-
const damAssetSchema = z.object({
|
|
1701
|
-
id: z.number(),
|
|
1702
|
-
canonical_path: z.string(),
|
|
1703
|
-
category: z.string(),
|
|
1704
|
-
code: z.string(),
|
|
1705
|
-
company: z.string(),
|
|
1706
|
-
created_at: z.string(),
|
|
1707
|
-
default_variant_id: z.string(),
|
|
1708
|
-
default_variant_url: z.string().optional(),
|
|
1709
|
-
description: z.string(),
|
|
1710
|
-
name: z.string(),
|
|
1711
|
-
updated_at: z.string(),
|
|
1712
|
-
variants: z.array(damVariantSchema).optional()
|
|
1713
|
-
});
|
|
1714
|
-
const damTreeFolderNodeSchema = z.object({
|
|
1715
|
-
asset_code: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
|
|
1716
|
-
name: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
|
|
1717
|
-
category: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
|
|
1718
|
-
variants: z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]).optional()
|
|
1719
|
-
}).passthrough();
|
|
1720
|
-
const damTreeSchema = z.record(z.string(), z.union([
|
|
1721
|
-
z.lazy(() => damTreeSchema),
|
|
1722
|
-
damAssetSchema,
|
|
1723
|
-
damTreeFolderNodeSchema
|
|
1724
|
-
]));
|
|
1725
|
-
const damQueryResponseSchema = z.object({
|
|
1726
|
-
path: z.string(),
|
|
1727
|
-
tree: damTreeSchema,
|
|
1728
|
-
meta: z.object({ next_cursor: z.string().optional() }).optional()
|
|
1729
|
-
});
|
|
1730
|
-
z.object({ asset: z.object({
|
|
1731
|
-
file: z.any(),
|
|
1732
|
-
name: z.string(),
|
|
1733
|
-
description: z.string().optional(),
|
|
1734
|
-
tags: z.string().optional()
|
|
1735
|
-
}) });
|
|
1736
|
-
const damAssetCreateResponseSchema = z.object({
|
|
1737
|
-
asset: damAssetSchema,
|
|
1738
|
-
meta: z.object({
|
|
1739
|
-
request_id: z.string(),
|
|
1740
|
-
timestamp: z.string()
|
|
1741
|
-
})
|
|
1742
|
-
});
|
|
1743
|
-
z.object({
|
|
1744
|
-
placeholder_asset: z.object({
|
|
1745
|
-
mime_type: z.string(),
|
|
1746
|
-
name: z.string().optional(),
|
|
1747
|
-
description: z.string().optional()
|
|
1748
|
-
}),
|
|
1749
|
-
skip_autotagging: z.boolean().optional()
|
|
1750
|
-
});
|
|
1751
|
-
z.object({
|
|
1752
|
-
asset: z.object({
|
|
1753
|
-
file: z.any(),
|
|
1754
|
-
name: z.string(),
|
|
1755
|
-
description: z.string().optional(),
|
|
1756
|
-
tags: z.string().optional()
|
|
1757
|
-
}).optional(),
|
|
1758
|
-
text_asset: z.object({
|
|
1759
|
-
file_name: z.string(),
|
|
1760
|
-
mime_type: z.string(),
|
|
1761
|
-
text: z.string(),
|
|
1762
|
-
name: z.string().optional(),
|
|
1763
|
-
description: z.string().optional(),
|
|
1764
|
-
tags: z.string().optional()
|
|
1765
|
-
}).optional(),
|
|
1766
|
-
placeholder_asset: z.object({
|
|
1767
|
-
mime_type: z.string(),
|
|
1768
|
-
name: z.string().optional(),
|
|
1769
|
-
description: z.string().optional()
|
|
1770
|
-
}).optional(),
|
|
1771
|
-
skip_autotagging: z.boolean().optional()
|
|
1772
|
-
});
|
|
1773
|
-
const damAssetPathCreateResponseSchema = z.object({
|
|
1774
|
-
asset: z.object({
|
|
1775
|
-
id: z.number(),
|
|
1776
|
-
canonical_path: z.string(),
|
|
1777
|
-
name: z.string()
|
|
1778
|
-
}),
|
|
1779
|
-
meta: z.object({
|
|
1780
|
-
request_id: z.string(),
|
|
1781
|
-
timestamp: z.string()
|
|
1782
|
-
})
|
|
1783
|
-
});
|
|
1698
|
+
//#region ../../file-picker/core/src/query-keys.ts
|
|
1699
|
+
const damQueryKeys = {
|
|
1700
|
+
all: ["dam"],
|
|
1701
|
+
assets: () => ["dam", "assets"],
|
|
1702
|
+
query: (params) => [
|
|
1703
|
+
"dam",
|
|
1704
|
+
"query",
|
|
1705
|
+
params
|
|
1706
|
+
]
|
|
1707
|
+
};
|
|
1784
1708
|
//#endregion
|
|
1785
1709
|
//#region ../../file-picker/core/src/schemas/file-picker-config.ts
|
|
1786
1710
|
const filePickerConfigSchema = z.object({
|
|
@@ -2514,115 +2438,6 @@ function getSanitizedAssetName(filename) {
|
|
|
2514
2438
|
return sanitizedName;
|
|
2515
2439
|
}
|
|
2516
2440
|
//#endregion
|
|
2517
|
-
//#region ../../file-picker/api-client/src/api/dam-assets.ts
|
|
2518
|
-
/**
|
|
2519
|
-
* Create a DAM asset. Text files use FormData upload; non-text files
|
|
2520
|
-
* delegate to the provided uploadStrategy (e.g. ImageKit).
|
|
2521
|
-
* If no uploadStrategy is provided, all files use FormData upload.
|
|
2522
|
-
*/
|
|
2523
|
-
async function createDamAsset(fetchClient, params, uploadStrategy) {
|
|
2524
|
-
const mimeType = getFileMimeType(params.file);
|
|
2525
|
-
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);
|
|
2526
|
-
if (uploadStrategy) return uploadStrategy.uploadFile(params);
|
|
2527
|
-
return createDamAssetViaFormData(fetchClient, params);
|
|
2528
|
-
}
|
|
2529
|
-
async function createDamAssetViaFormData(fetchClient, params) {
|
|
2530
|
-
const formData = new FormData();
|
|
2531
|
-
formData.append("asset[file]", params.file);
|
|
2532
|
-
formData.append("asset[name]", params.name);
|
|
2533
|
-
if (params.description) formData.append("asset[description]", params.description);
|
|
2534
|
-
if (params.tags && params.tags.length > 0) formData.append("asset[tags]", params.tags.join(","));
|
|
2535
|
-
const response = await fetchClient.requestWithFormData("/dam/assets", formData, { method: "POST" });
|
|
2536
|
-
return damAssetCreateResponseSchema.parse(response);
|
|
2537
|
-
}
|
|
2538
|
-
async function createDamAssetPathForAssets(fetchClient, { asset_paths, code }) {
|
|
2539
|
-
const response = await fetchClient.post(`/dam/assets/${code}/asset_paths`, { asset_paths });
|
|
2540
|
-
return damAssetPathCreateResponseSchema.parse(response);
|
|
2541
|
-
}
|
|
2542
|
-
//#endregion
|
|
2543
|
-
//#region ../../file-picker/api-client/src/api/dam-query.ts
|
|
2544
|
-
async function queryDamAssets(fetchClient, params) {
|
|
2545
|
-
const response = await fetchClient.post("/dam/query", params);
|
|
2546
|
-
return damQueryResponseSchema.parse(response);
|
|
2547
|
-
}
|
|
2548
|
-
async function deleteDamAsset(fetchClient, code) {
|
|
2549
|
-
return fetchClient.delete(`/dam/assets/${code}`);
|
|
2550
|
-
}
|
|
2551
|
-
async function discardDamAsset(fetchClient, code) {
|
|
2552
|
-
return fetchClient.patch(`/dam/assets/${code}/discard`);
|
|
2553
|
-
}
|
|
2554
|
-
//#endregion
|
|
2555
|
-
//#region ../../file-picker/api-client/src/api/url-proxy.ts
|
|
2556
|
-
const urlProxyResponseSchema = z.object({
|
|
2557
|
-
data: z.string(),
|
|
2558
|
-
contentType: z.string(),
|
|
2559
|
-
size: z.number()
|
|
2560
|
-
});
|
|
2561
|
-
/**
|
|
2562
|
-
* Proxy a URL fetch through the backend to bypass CORS restrictions.
|
|
2563
|
-
* The backend fetches the file and returns it as base64-encoded data.
|
|
2564
|
-
*
|
|
2565
|
-
* @param url - The URL to fetch
|
|
2566
|
-
* @param proxyEndpoint - The proxy endpoint (defaults to "/api/proxy-url")
|
|
2567
|
-
*/
|
|
2568
|
-
async function proxyUrlFetch(url, proxyEndpoint = "/api/proxy-url") {
|
|
2569
|
-
const response = await fetch(proxyEndpoint, {
|
|
2570
|
-
method: "POST",
|
|
2571
|
-
headers: { "Content-Type": "application/json" },
|
|
2572
|
-
body: JSON.stringify({ url })
|
|
2573
|
-
});
|
|
2574
|
-
if (!response.ok) {
|
|
2575
|
-
const errorData = await response.json().catch(() => ({ error: "Failed to proxy URL fetch" }));
|
|
2576
|
-
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
2577
|
-
}
|
|
2578
|
-
const data = await response.json();
|
|
2579
|
-
return urlProxyResponseSchema.parse(data);
|
|
2580
|
-
}
|
|
2581
|
-
//#endregion
|
|
2582
|
-
//#region ../../file-picker/api-client/src/api/unsplash.ts
|
|
2583
|
-
const unsplashImageSchema = z.object({
|
|
2584
|
-
id: z.string(),
|
|
2585
|
-
urls: z.object({
|
|
2586
|
-
raw: z.string(),
|
|
2587
|
-
full: z.string(),
|
|
2588
|
-
regular: z.string(),
|
|
2589
|
-
small: z.string(),
|
|
2590
|
-
thumb: z.string()
|
|
2591
|
-
}),
|
|
2592
|
-
alt_description: z.string().nullable(),
|
|
2593
|
-
description: z.string().nullable(),
|
|
2594
|
-
user: z.object({
|
|
2595
|
-
name: z.string(),
|
|
2596
|
-
username: z.string()
|
|
2597
|
-
}),
|
|
2598
|
-
width: z.number(),
|
|
2599
|
-
height: z.number()
|
|
2600
|
-
});
|
|
2601
|
-
const unsplashSearchResponseSchema = z.object({
|
|
2602
|
-
results: z.array(unsplashImageSchema),
|
|
2603
|
-
total: z.number(),
|
|
2604
|
-
total_pages: z.number()
|
|
2605
|
-
});
|
|
2606
|
-
/**
|
|
2607
|
-
* Search Unsplash for photos matching a query.
|
|
2608
|
-
*/
|
|
2609
|
-
async function searchUnsplash(query, accessKey, page = 1, perPage = 20) {
|
|
2610
|
-
const response = await fetch(`https://api.unsplash.com/search/photos?query=${encodeURIComponent(query)}&page=${page}&per_page=${perPage}&client_id=${accessKey}`);
|
|
2611
|
-
if (!response.ok) throw new Error("Failed to search Unsplash");
|
|
2612
|
-
return unsplashSearchResponseSchema.parse(await response.json());
|
|
2613
|
-
}
|
|
2614
|
-
//#endregion
|
|
2615
|
-
//#region ../../file-picker/api-client/src/query-keys.ts
|
|
2616
|
-
const damQueryKeys = {
|
|
2617
|
-
all: ["dam"],
|
|
2618
|
-
assets: () => ["dam", "assets"],
|
|
2619
|
-
query: (params) => [
|
|
2620
|
-
"dam",
|
|
2621
|
-
"query",
|
|
2622
|
-
params
|
|
2623
|
-
]
|
|
2624
|
-
};
|
|
2625
|
-
//#endregion
|
|
2626
2441
|
//#region ../../file-picker/ui/src/hooks/use-debounced-search.ts
|
|
2627
2442
|
const useDebouncedSearch = (delay = 300) => {
|
|
2628
2443
|
const [searchQuery, setSearchQuery] = useState("");
|
|
@@ -2694,7 +2509,8 @@ const flattenTree = (tree, basePath = "", depth = 0) => {
|
|
|
2694
2509
|
};
|
|
2695
2510
|
};
|
|
2696
2511
|
const useDamLibrary = (fileTypeFilter, controlledSearch) => {
|
|
2697
|
-
const
|
|
2512
|
+
const api = useFilePickerApi();
|
|
2513
|
+
const { companyId } = useFilePickerContext();
|
|
2698
2514
|
const [currentPath, setCurrentPath] = useState("*");
|
|
2699
2515
|
const internalSearch = useDebouncedSearch(300);
|
|
2700
2516
|
const isControlled = controlledSearch !== void 0;
|
|
@@ -2729,7 +2545,7 @@ const useDamLibrary = (fileTypeFilter, controlledSearch) => {
|
|
|
2729
2545
|
search: debouncedSearchQuery,
|
|
2730
2546
|
filters: canonicalPathFilters
|
|
2731
2547
|
}),
|
|
2732
|
-
queryFn: ({ pageParam }) => queryDamAssets(
|
|
2548
|
+
queryFn: ({ pageParam }) => api.queryDamAssets({
|
|
2733
2549
|
path: ltreeQueryPath || "*",
|
|
2734
2550
|
search: debouncedSearchQuery,
|
|
2735
2551
|
tags_string: "*",
|
|
@@ -3223,7 +3039,8 @@ function getBreadcrumbsFromPath(currentPath) {
|
|
|
3223
3039
|
}
|
|
3224
3040
|
const DamLibrary = 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) => {
|
|
3225
3041
|
"use no memo";
|
|
3226
|
-
const
|
|
3042
|
+
const api = useFilePickerApi();
|
|
3043
|
+
const { companyId, toast } = useFilePickerContext();
|
|
3227
3044
|
const queryClient = useQueryClient();
|
|
3228
3045
|
const controlledSearch = controlledSearchQuery !== void 0 && controlledSetSearchQuery ? {
|
|
3229
3046
|
searchQuery: controlledSearchQuery,
|
|
@@ -3257,7 +3074,7 @@ const DamLibrary = forwardRef(({ config, onAssetsSelected, onSelectionChange, on
|
|
|
3257
3074
|
const form = useZodForm(folderSchema, { defaultValues: { folderName: "" } });
|
|
3258
3075
|
const { mutate, isPending } = useMutation({
|
|
3259
3076
|
mutationFn: (data) => {
|
|
3260
|
-
const promises = data.map((params) => createDamAssetPathForAssets(
|
|
3077
|
+
const promises = data.map((params) => api.createDamAssetPathForAssets(params));
|
|
3261
3078
|
return Promise.all(promises);
|
|
3262
3079
|
},
|
|
3263
3080
|
onSuccess: () => {
|
|
@@ -3275,7 +3092,7 @@ const DamLibrary = forwardRef(({ config, onAssetsSelected, onSelectionChange, on
|
|
|
3275
3092
|
const lastClickedIndexRef = useRef(-1);
|
|
3276
3093
|
const pendingClickTimeoutRef = useRef(null);
|
|
3277
3094
|
const { mutate: deleteAssetMutate, isPending: isDeleting } = useMutation({
|
|
3278
|
-
mutationFn: (assetCode) => deleteDamAsset(
|
|
3095
|
+
mutationFn: (assetCode) => api.deleteDamAsset(assetCode),
|
|
3279
3096
|
onSuccess: () => {
|
|
3280
3097
|
toast.success("Asset deleted successfully");
|
|
3281
3098
|
queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
|
|
@@ -3285,7 +3102,7 @@ const DamLibrary = forwardRef(({ config, onAssetsSelected, onSelectionChange, on
|
|
|
3285
3102
|
}
|
|
3286
3103
|
});
|
|
3287
3104
|
const { mutate: discardAssetMutate, isPending: isDiscarding } = useMutation({
|
|
3288
|
-
mutationFn: (assetCode) => discardDamAsset(
|
|
3105
|
+
mutationFn: (assetCode) => api.discardDamAsset(assetCode),
|
|
3289
3106
|
onSuccess: () => {
|
|
3290
3107
|
toast.success("Asset discarded successfully");
|
|
3291
3108
|
queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
|
|
@@ -4304,9 +4121,10 @@ const useUnsplashPicker = (options) => {
|
|
|
4304
4121
|
const [hasMoreResults, setHasMoreResults] = useState(true);
|
|
4305
4122
|
const [uploadProgress, setUploadProgress] = useState(/* @__PURE__ */ new Map());
|
|
4306
4123
|
const queryClient = useQueryClient();
|
|
4307
|
-
const
|
|
4124
|
+
const api = useFilePickerApi();
|
|
4125
|
+
const { apiBaseUrl, toast } = useFilePickerContext();
|
|
4308
4126
|
const uploadMutation = useMutation({
|
|
4309
|
-
mutationFn: (params) => createDamAsset(
|
|
4127
|
+
mutationFn: (params) => api.createDamAsset(params),
|
|
4310
4128
|
onSuccess: () => {
|
|
4311
4129
|
queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
|
|
4312
4130
|
}
|
|
@@ -4323,8 +4141,7 @@ const useUnsplashPicker = (options) => {
|
|
|
4323
4141
|
setCurrentPage(1);
|
|
4324
4142
|
} else setIsLoadingMore(true);
|
|
4325
4143
|
try {
|
|
4326
|
-
|
|
4327
|
-
const data = await searchUnsplash(query, unsplashAccessKey, page);
|
|
4144
|
+
const data = await api.searchUnsplash(query, page);
|
|
4328
4145
|
setSearchResults((prevResults) => page === 1 ? data.results : [...prevResults, ...data.results]);
|
|
4329
4146
|
setCurrentPage(page);
|
|
4330
4147
|
setHasMoreResults(page < data.total_pages);
|
|
@@ -4335,7 +4152,7 @@ const useUnsplashPicker = (options) => {
|
|
|
4335
4152
|
setIsSearching(false);
|
|
4336
4153
|
setIsLoadingMore(false);
|
|
4337
4154
|
}
|
|
4338
|
-
}, [
|
|
4155
|
+
}, [api, toast]);
|
|
4339
4156
|
const downloadAndUpload = useCallback(async (image) => {
|
|
4340
4157
|
const uploadId = `unsplash-${image.id}`;
|
|
4341
4158
|
const fileName = `unsplash-${image.id}.jpg`;
|
|
@@ -4662,9 +4479,10 @@ const UnsplashPicker = ({ config, onFileSelected, searchQuery: controlledSearchQ
|
|
|
4662
4479
|
const useUrlUpload = () => {
|
|
4663
4480
|
const [uploadProgress, setUploadProgress] = useState(/* @__PURE__ */ new Map());
|
|
4664
4481
|
const queryClient = useQueryClient();
|
|
4665
|
-
const
|
|
4482
|
+
const api = useFilePickerApi();
|
|
4483
|
+
const { companyId, apiBaseUrl, toast } = useFilePickerContext();
|
|
4666
4484
|
const uploadMutation = useMutation({
|
|
4667
|
-
mutationFn: (params) => createDamAsset(
|
|
4485
|
+
mutationFn: (params) => api.createDamAsset(params),
|
|
4668
4486
|
onSuccess: () => {
|
|
4669
4487
|
queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
|
|
4670
4488
|
}
|
|
@@ -4713,7 +4531,7 @@ const useUrlUpload = () => {
|
|
|
4713
4531
|
return next;
|
|
4714
4532
|
});
|
|
4715
4533
|
try {
|
|
4716
|
-
const proxyResponse = await proxyUrlFetch(url
|
|
4534
|
+
const proxyResponse = await api.proxyUrlFetch(url);
|
|
4717
4535
|
const binaryString = atob(proxyResponse.data);
|
|
4718
4536
|
const bytes = new Uint8Array(binaryString.length);
|
|
4719
4537
|
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
@@ -4807,7 +4625,7 @@ const useUrlUpload = () => {
|
|
|
4807
4625
|
uploadMutation,
|
|
4808
4626
|
companyId,
|
|
4809
4627
|
apiBaseUrl,
|
|
4810
|
-
|
|
4628
|
+
api,
|
|
4811
4629
|
toast
|
|
4812
4630
|
]);
|
|
4813
4631
|
const clearProgress = useCallback(() => {
|
|
@@ -5040,9 +4858,10 @@ const UrlUpload = ({ config, onFileSelected, enableShareableOption = false, shar
|
|
|
5040
4858
|
const useComputerUpload = () => {
|
|
5041
4859
|
const [uploadProgress, setUploadProgress] = useState(/* @__PURE__ */ new Map());
|
|
5042
4860
|
const queryClient = useQueryClient();
|
|
5043
|
-
const
|
|
4861
|
+
const api = useFilePickerApi();
|
|
4862
|
+
const { companyId, toast, apiBaseUrl } = useFilePickerContext();
|
|
5044
4863
|
const uploadMutation = useMutation({
|
|
5045
|
-
mutationFn: (params) => createDamAsset(
|
|
4864
|
+
mutationFn: (params) => api.createDamAsset(params),
|
|
5046
4865
|
onSuccess: () => {
|
|
5047
4866
|
queryClient.invalidateQueries({ queryKey: damQueryKeys.all });
|
|
5048
4867
|
}
|
|
@@ -6518,7 +6337,7 @@ function FilePreview({ result, mediaType }) {
|
|
|
6518
6337
|
});
|
|
6519
6338
|
}
|
|
6520
6339
|
function MediaCreateScreen({ onNavigate, onBack }) {
|
|
6521
|
-
const { navigate, showToast,
|
|
6340
|
+
const { navigate, showToast, filePickerApi } = useShareablesUI();
|
|
6522
6341
|
const user = useShareablesUser();
|
|
6523
6342
|
useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
|
|
6524
6343
|
className: "text-lg",
|
|
@@ -6610,23 +6429,20 @@ function MediaCreateScreen({ onNavigate, onBack }) {
|
|
|
6610
6429
|
if (!title.trim()) setTitle(result.metadata.file_name.replace(/\.[^/.]+$/, ""));
|
|
6611
6430
|
}, [title]);
|
|
6612
6431
|
const filePickerContextValue = useMemo(() => {
|
|
6613
|
-
if (!
|
|
6614
|
-
return {
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
}
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
}
|
|
6628
|
-
};
|
|
6629
|
-
}, [filePickerClient, showToast]);
|
|
6432
|
+
if (!filePickerApi) return null;
|
|
6433
|
+
return { toast: {
|
|
6434
|
+
success: (msg) => showToast({
|
|
6435
|
+
title: msg,
|
|
6436
|
+
type: "success"
|
|
6437
|
+
}),
|
|
6438
|
+
error: (msg, error) => showToast({
|
|
6439
|
+
title: error instanceof Error ? `${msg}: ${error.message}` : msg,
|
|
6440
|
+
type: "error"
|
|
6441
|
+
}),
|
|
6442
|
+
loading: () => "",
|
|
6443
|
+
dismiss: () => {}
|
|
6444
|
+
} };
|
|
6445
|
+
}, [filePickerApi, showToast]);
|
|
6630
6446
|
return /* @__PURE__ */ jsxs("div", {
|
|
6631
6447
|
className: "flex flex-col gap-4 px-4 py-4 md:px-10 md:py-6",
|
|
6632
6448
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -6657,7 +6473,7 @@ function MediaCreateScreen({ onNavigate, onBack }) {
|
|
|
6657
6473
|
onClick: () => setIsPickerOpen(true),
|
|
6658
6474
|
variant: "outline",
|
|
6659
6475
|
className: "flex h-32 w-full flex-col items-center justify-center gap-2 border-dashed",
|
|
6660
|
-
disabled: !
|
|
6476
|
+
disabled: !filePickerApi,
|
|
6661
6477
|
children: [/* @__PURE__ */ jsx(Upload, { className: "text-muted-foreground h-6 w-6" }), /* @__PURE__ */ jsx("span", {
|
|
6662
6478
|
className: "text-muted-foreground text-sm",
|
|
6663
6479
|
children: "Select File"
|
|
@@ -6715,13 +6531,16 @@ function MediaCreateScreen({ onNavigate, onBack }) {
|
|
|
6715
6531
|
children: isCreating ? /* @__PURE__ */ jsx(Spinner, { className: "size-4" }) : "Save Media"
|
|
6716
6532
|
})
|
|
6717
6533
|
]
|
|
6718
|
-
}), filePickerContextValue && /* @__PURE__ */ jsx(
|
|
6719
|
-
|
|
6720
|
-
children: /* @__PURE__ */ jsx(
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6534
|
+
}), filePickerContextValue && filePickerApi && /* @__PURE__ */ jsx(FilePickerApiProvider, {
|
|
6535
|
+
api: filePickerApi,
|
|
6536
|
+
children: /* @__PURE__ */ jsx(FilePickerProvider, {
|
|
6537
|
+
value: filePickerContextValue,
|
|
6538
|
+
children: /* @__PURE__ */ jsx(FilePicker, {
|
|
6539
|
+
open: isPickerOpen,
|
|
6540
|
+
onFilesSelected: handleFilesSelected,
|
|
6541
|
+
onClose: () => setIsPickerOpen(false),
|
|
6542
|
+
config: { maxFiles: 1 }
|
|
6543
|
+
})
|
|
6725
6544
|
})
|
|
6726
6545
|
})]
|
|
6727
6546
|
});
|
|
@@ -8296,7 +8115,7 @@ function computeOrderedItems(items) {
|
|
|
8296
8115
|
return result;
|
|
8297
8116
|
}
|
|
8298
8117
|
function PlaylistItemsSection({ playlistId }) {
|
|
8299
|
-
const { showToast,
|
|
8118
|
+
const { showToast, filePickerApi } = useShareablesUI();
|
|
8300
8119
|
const api = useShareablesApi();
|
|
8301
8120
|
const [filePickerOpen, setFilePickerOpen] = useState(false);
|
|
8302
8121
|
const { items: contextItems, updateItems, addItem, removeItem } = usePlaylistItems();
|
|
@@ -8401,9 +8220,8 @@ function PlaylistItemsSection({ playlistId }) {
|
|
|
8401
8220
|
}
|
|
8402
8221
|
};
|
|
8403
8222
|
const filePickerContextValue = useMemo(() => {
|
|
8404
|
-
if (!
|
|
8223
|
+
if (!filePickerApi) return null;
|
|
8405
8224
|
return {
|
|
8406
|
-
apiClient: filePickerClient,
|
|
8407
8225
|
toast: {
|
|
8408
8226
|
success: (msg) => showToast({
|
|
8409
8227
|
title: msg,
|
|
@@ -8419,7 +8237,7 @@ function PlaylistItemsSection({ playlistId }) {
|
|
|
8419
8237
|
shareablesClient: { media: { list: (filters) => api.media.getMedia(filters ?? {}) } }
|
|
8420
8238
|
};
|
|
8421
8239
|
}, [
|
|
8422
|
-
|
|
8240
|
+
filePickerApi,
|
|
8423
8241
|
showToast,
|
|
8424
8242
|
api
|
|
8425
8243
|
]);
|
|
@@ -8446,7 +8264,7 @@ function PlaylistItemsSection({ playlistId }) {
|
|
|
8446
8264
|
className: "flex shrink-0 flex-wrap items-center justify-end gap-2",
|
|
8447
8265
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
8448
8266
|
type: "button",
|
|
8449
|
-
disabled: addItemMutation.isPending || !
|
|
8267
|
+
disabled: addItemMutation.isPending || !filePickerApi,
|
|
8450
8268
|
variant: "default",
|
|
8451
8269
|
size: "sm",
|
|
8452
8270
|
className: "flex min-w-25 items-center gap-2",
|
|
@@ -8461,16 +8279,19 @@ function PlaylistItemsSection({ playlistId }) {
|
|
|
8461
8279
|
isDeletePending: removeItemMutation.isPending,
|
|
8462
8280
|
enableReordering: true
|
|
8463
8281
|
})]
|
|
8464
|
-
}), filePickerContextValue && /* @__PURE__ */ jsx(
|
|
8465
|
-
|
|
8466
|
-
children: /* @__PURE__ */ jsx(
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8282
|
+
}), filePickerContextValue && filePickerApi && /* @__PURE__ */ jsx(FilePickerApiProvider, {
|
|
8283
|
+
api: filePickerApi,
|
|
8284
|
+
children: /* @__PURE__ */ jsx(FilePickerProvider, {
|
|
8285
|
+
value: filePickerContextValue,
|
|
8286
|
+
children: /* @__PURE__ */ jsx(FilePicker, {
|
|
8287
|
+
open: filePickerOpen,
|
|
8288
|
+
onFilesSelected: (selected) => void handleFilePickerResults(selected),
|
|
8289
|
+
onClose: () => setFilePickerOpen(false),
|
|
8290
|
+
config: {
|
|
8291
|
+
maxFiles: 50,
|
|
8292
|
+
allowedMethods: ["media"]
|
|
8293
|
+
}
|
|
8294
|
+
})
|
|
8474
8295
|
})
|
|
8475
8296
|
})]
|
|
8476
8297
|
});
|
|
@@ -9010,6 +8831,6 @@ function ProductsApp({ countryCode, companyLogoUrl, productId: controlledProduct
|
|
|
9010
8831
|
});
|
|
9011
8832
|
}
|
|
9012
8833
|
//#endregion
|
|
9013
|
-
export {
|
|
8834
|
+
export { ShareablesApiProvider as a, ShareablesUIProvider as i, ShareablesApp as n, ShareablesCoreProvider as o, getFileMimeType as r, ProductsApp as t };
|
|
9014
8835
|
|
|
9015
|
-
//# sourceMappingURL=src-
|
|
8836
|
+
//# sourceMappingURL=src-BrwLqPPh.mjs.map
|