@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.
@@ -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 result = await SL.asset.list({
36
- scope,
37
- mimeTypePrefix: accept,
38
- limit: pageSize,
39
- // Only filter by appId when explicitly requested. When listAppId is undefined,
40
- // we list every asset in the scope — even if uploads are still being stamped
41
- // with `appId`. This is what powers the "All in collection" pill.
42
- ...listAppId ? { appId: listAppId } : {}
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(result);
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-7RWLFKHC.js.map
4101
- //# sourceMappingURL=chunk-7RWLFKHC.js.map
4116
+ //# sourceMappingURL=chunk-I3T36FSI.js.map
4117
+ //# sourceMappingURL=chunk-I3T36FSI.js.map