@proveanything/smartlinks-utils-ui 1.13.11 → 1.13.13
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/ErrorBoundary-J9iKgF_H.d.ts +40 -0
- package/dist/{chunk-7RWLFKHC.js → chunk-I3T36FSI.js} +28 -12
- package/dist/chunk-I3T36FSI.js.map +1 -0
- package/dist/{chunk-A4YZYKWT.js → chunk-JNCRSL2H.js} +6 -6
- package/dist/chunk-JNCRSL2H.js.map +1 -0
- package/dist/{chunk-3RRHM4LP.js → chunk-XASZS7EA.js} +131 -4
- package/dist/chunk-XASZS7EA.js.map +1 -0
- package/dist/components/AssetPicker/index.js +1 -1
- package/dist/components/ConditionsEditor/index.js +1 -1
- package/dist/components/RecordsAdmin/index.d.ts +1 -0
- package/dist/components/RecordsAdmin/index.js +13 -9
- package/dist/components/RecordsAdmin/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3RRHM4LP.js.map +0 -1
- package/dist/chunk-7RWLFKHC.js.map +0 -1
- package/dist/chunk-A4YZYKWT.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ErrorBoundaryProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* Optional label used in the default fallback message — e.g.
|
|
7
|
+
* `label="editor"` renders "This editor couldn't be rendered."
|
|
8
|
+
*/
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Custom fallback. Either a node or a render function. When using the
|
|
12
|
+
* function form, call `reset()` to clear the error and remount children.
|
|
13
|
+
*/
|
|
14
|
+
fallback?: ReactNode | ((info: {
|
|
15
|
+
error: Error;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
}) => ReactNode);
|
|
18
|
+
/**
|
|
19
|
+
* Fires when the boundary catches. Use to forward to telemetry.
|
|
20
|
+
*/
|
|
21
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
22
|
+
/**
|
|
23
|
+
* When any value in this array changes (shallow compare), the boundary
|
|
24
|
+
* clears its error state. Use to auto-recover on navigation.
|
|
25
|
+
*/
|
|
26
|
+
resetKeys?: ReadonlyArray<unknown>;
|
|
27
|
+
}
|
|
28
|
+
interface State {
|
|
29
|
+
error: Error | null;
|
|
30
|
+
}
|
|
31
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
|
|
32
|
+
state: State;
|
|
33
|
+
static getDerivedStateFromError(error: Error): State;
|
|
34
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
35
|
+
componentDidUpdate(prev: ErrorBoundaryProps): void;
|
|
36
|
+
reset: () => void;
|
|
37
|
+
render(): ReactNode;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { ErrorBoundary as E, type ErrorBoundaryProps as a };
|
|
@@ -32,17 +32,33 @@ function useAssets({ scope, accept, pageSize, appId, listAppId }) {
|
|
|
32
32
|
setLoading(true);
|
|
33
33
|
setError(null);
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const collectionId = scope.collectionId;
|
|
36
|
+
const productId = scope.productId;
|
|
37
|
+
const proofId = scope.proofId;
|
|
38
|
+
const assetType = accept?.startsWith("image/") ? "Image" : accept?.startsWith("video/") ? "Video" : accept?.startsWith("audio/") ? "Audio" : void 0;
|
|
39
|
+
const adminList = SL.asset.listAdmin;
|
|
40
|
+
let items = [];
|
|
41
|
+
if (adminList) {
|
|
42
|
+
const res = await adminList({
|
|
43
|
+
collectionId,
|
|
44
|
+
...productId ? { productId } : {},
|
|
45
|
+
...proofId ? { proofId } : {},
|
|
46
|
+
...listAppId ? { appId: listAppId } : {},
|
|
47
|
+
...assetType ? { assetType } : {},
|
|
48
|
+
...pageSize ? { limit: pageSize } : {}
|
|
49
|
+
});
|
|
50
|
+
items = Array.isArray(res) ? res : res?.data ?? [];
|
|
51
|
+
} else {
|
|
52
|
+
const res = await SL.asset.list({
|
|
53
|
+
scope,
|
|
54
|
+
mimeTypePrefix: accept,
|
|
55
|
+
limit: pageSize,
|
|
56
|
+
...listAppId ? { appId: listAppId } : {}
|
|
57
|
+
});
|
|
58
|
+
items = res;
|
|
59
|
+
}
|
|
44
60
|
if (mountedRef.current) {
|
|
45
|
-
setAssets(
|
|
61
|
+
setAssets(items);
|
|
46
62
|
}
|
|
47
63
|
} catch (err) {
|
|
48
64
|
if (mountedRef.current) {
|
|
@@ -4097,5 +4113,5 @@ var AssetPicker = (props) => {
|
|
|
4097
4113
|
assertStylesLoaded();
|
|
4098
4114
|
|
|
4099
4115
|
export { ASSET_MIME_FILTERS, AssetPicker, useAppRegistry, useAssets };
|
|
4100
|
-
//# sourceMappingURL=chunk-
|
|
4101
|
-
//# sourceMappingURL=chunk-
|
|
4116
|
+
//# sourceMappingURL=chunk-I3T36FSI.js.map
|
|
4117
|
+
//# sourceMappingURL=chunk-I3T36FSI.js.map
|