@sparkstudio/storage-ui 1.0.22 → 1.0.23
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/index.cjs +7 -2
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +216 -0
- package/dist/index.d.ts +216 -0
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -898,7 +898,13 @@ var UploadContainer = ({
|
|
|
898
898
|
{
|
|
899
899
|
className: "w-100 d-flex flex-wrap gap-4 align-content-start",
|
|
900
900
|
style: { minHeight: "140px" },
|
|
901
|
-
children: existingFilesLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
901
|
+
children: existingFilesLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
902
|
+
"div",
|
|
903
|
+
{
|
|
904
|
+
className: "spinner-border text-secondary",
|
|
905
|
+
role: "status"
|
|
906
|
+
}
|
|
907
|
+
) }) : existingFiles.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
902
908
|
"div",
|
|
903
909
|
{
|
|
904
910
|
className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
|
|
@@ -1245,7 +1251,6 @@ function HomeContent() {
|
|
|
1245
1251
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1246
1252
|
SingleFileProcessUploader,
|
|
1247
1253
|
{
|
|
1248
|
-
label: "Upload a file to process",
|
|
1249
1254
|
accept: "*/*",
|
|
1250
1255
|
getPresignedUrl: getPresignedUrlFromApi,
|
|
1251
1256
|
onUploadComplete: (file, s3Url) => {
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../src/index.scss"],"names":[],"mappings":"AAAQ","file":"index.css"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
declare enum ContainerType {
|
|
6
|
+
File = 0,
|
|
7
|
+
Folder = 1,
|
|
8
|
+
Root = 2
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an Auto-generated model for ContainerDTO.
|
|
13
|
+
*/
|
|
14
|
+
interface IContainerDTO {
|
|
15
|
+
Id: string;
|
|
16
|
+
ContainerType: ContainerType;
|
|
17
|
+
Name?: string;
|
|
18
|
+
ContentType?: string;
|
|
19
|
+
PublicUrl?: string;
|
|
20
|
+
CreatedDate: string;
|
|
21
|
+
FileSize: number;
|
|
22
|
+
UserId: string;
|
|
23
|
+
ParentContainerId: string;
|
|
24
|
+
}
|
|
25
|
+
type ContainerDTOInit = Partial<IContainerDTO> & Pick<IContainerDTO, "Id" | "ContainerType" | "CreatedDate" | "FileSize" | "UserId" | "ParentContainerId">;
|
|
26
|
+
declare class ContainerDTO implements IContainerDTO {
|
|
27
|
+
Id: string;
|
|
28
|
+
ContainerType: ContainerType;
|
|
29
|
+
Name?: string;
|
|
30
|
+
ContentType?: string;
|
|
31
|
+
PublicUrl?: string;
|
|
32
|
+
CreatedDate: string;
|
|
33
|
+
FileSize: number;
|
|
34
|
+
UserId: string;
|
|
35
|
+
ParentContainerId: string;
|
|
36
|
+
constructor(init: ContainerDTOInit);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Auto-generated client for the Container controller.
|
|
41
|
+
*/
|
|
42
|
+
declare class Container {
|
|
43
|
+
private baseUrl;
|
|
44
|
+
constructor(baseUrl: string);
|
|
45
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
46
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
47
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
48
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
49
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
50
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
51
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Auto-generated client for the Home controller.
|
|
56
|
+
*/
|
|
57
|
+
declare class Home {
|
|
58
|
+
private baseUrl;
|
|
59
|
+
constructor(baseUrl: string);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
64
|
+
*/
|
|
65
|
+
interface IAWSPresignedUrlDTO {
|
|
66
|
+
PresignedUrl?: string;
|
|
67
|
+
PublicUrl?: string;
|
|
68
|
+
Key?: string;
|
|
69
|
+
}
|
|
70
|
+
type AWSPresignedUrlDTOInit = Partial<IAWSPresignedUrlDTO>;
|
|
71
|
+
declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
72
|
+
PresignedUrl?: string;
|
|
73
|
+
PublicUrl?: string;
|
|
74
|
+
Key?: string;
|
|
75
|
+
constructor(init: AWSPresignedUrlDTOInit);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Represents an Auto-generated model for TemporaryFileDTO.
|
|
80
|
+
*/
|
|
81
|
+
interface ITemporaryFileDTO {
|
|
82
|
+
Name?: string;
|
|
83
|
+
ContentType?: string;
|
|
84
|
+
}
|
|
85
|
+
type TemporaryFileDTOInit = Partial<ITemporaryFileDTO>;
|
|
86
|
+
declare class TemporaryFileDTO implements ITemporaryFileDTO {
|
|
87
|
+
Name?: string;
|
|
88
|
+
ContentType?: string;
|
|
89
|
+
constructor(init: TemporaryFileDTOInit);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Auto-generated client for the S3 controller.
|
|
94
|
+
*/
|
|
95
|
+
declare class S3 {
|
|
96
|
+
private baseUrl;
|
|
97
|
+
constructor(baseUrl: string);
|
|
98
|
+
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
99
|
+
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
100
|
+
GetTemporaryPreSignedUrl(temporaryFileDTO: TemporaryFileDTO): Promise<AWSPresignedUrlDTO>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Auto-generated API client.
|
|
105
|
+
*/
|
|
106
|
+
declare class SparkStudioStorageSDK {
|
|
107
|
+
container: Container;
|
|
108
|
+
home: Home;
|
|
109
|
+
s3: S3;
|
|
110
|
+
constructor(baseUrl: string);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface ContainerUploadPanelProps {
|
|
114
|
+
/** Base URL for the Container API (the SDK you pasted). */
|
|
115
|
+
containerApiBaseUrl: string;
|
|
116
|
+
/** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
|
|
117
|
+
storageApiBaseUrl: string;
|
|
118
|
+
/** Optional parent container – if set, we query children instead of roots. */
|
|
119
|
+
parentContainerId?: string;
|
|
120
|
+
}
|
|
121
|
+
declare const ContainerUploadPanel: React__default.FC<ContainerUploadPanelProps>;
|
|
122
|
+
|
|
123
|
+
interface DesktopFileIconProps {
|
|
124
|
+
name?: string | null;
|
|
125
|
+
sizeBytes?: number | null;
|
|
126
|
+
downloadUrl?: string | null;
|
|
127
|
+
/** Double-click / open action */
|
|
128
|
+
onOpen?: () => void;
|
|
129
|
+
/** Delete action (can be async) */
|
|
130
|
+
onDelete?: () => Promise<void> | void;
|
|
131
|
+
}
|
|
132
|
+
declare const DesktopFileIcon: React__default.FC<DesktopFileIconProps>;
|
|
133
|
+
|
|
134
|
+
interface SingleFileProcessUploaderProps {
|
|
135
|
+
getPresignedUrl: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
136
|
+
onUploadComplete?: (file: File, s3Url: AWSPresignedUrlDTO) => void;
|
|
137
|
+
accept?: string;
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
}
|
|
140
|
+
declare const SingleFileProcessUploader: React__default.FC<SingleFileProcessUploaderProps>;
|
|
141
|
+
|
|
142
|
+
interface UploadContainerProps {
|
|
143
|
+
multiple?: boolean;
|
|
144
|
+
accept?: string;
|
|
145
|
+
onFilesSelected?: (files: FileList) => void;
|
|
146
|
+
existingFiles?: ContainerDTO[];
|
|
147
|
+
existingFilesLoading?: boolean;
|
|
148
|
+
onExistingFileClick?: (file: ContainerDTO) => void;
|
|
149
|
+
/** Called when user chooses "Delete file" from the context menu */
|
|
150
|
+
onDeleteFile?: (file: ContainerDTO) => void;
|
|
151
|
+
autoUpload?: boolean;
|
|
152
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
153
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
154
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
155
|
+
}
|
|
156
|
+
declare const UploadContainer: React__default.FC<UploadContainerProps>;
|
|
157
|
+
|
|
158
|
+
interface UploadDropzoneProps {
|
|
159
|
+
isDragging: boolean;
|
|
160
|
+
onDragOver?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
161
|
+
onDragLeave?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
162
|
+
onDrop?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
163
|
+
className?: string;
|
|
164
|
+
style?: React__default.CSSProperties;
|
|
165
|
+
children?: React__default.ReactNode;
|
|
166
|
+
}
|
|
167
|
+
declare const UploadDropzone: React__default.FC<UploadDropzoneProps>;
|
|
168
|
+
|
|
169
|
+
type UploadStatus = "pending" | "uploading" | "success" | "error";
|
|
170
|
+
interface UploadState {
|
|
171
|
+
id: string;
|
|
172
|
+
file: File;
|
|
173
|
+
progress: number;
|
|
174
|
+
status: UploadStatus;
|
|
175
|
+
error?: string;
|
|
176
|
+
s3Url?: string;
|
|
177
|
+
publicUrl?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface UploadProgressListProps {
|
|
181
|
+
uploads: UploadState[];
|
|
182
|
+
}
|
|
183
|
+
declare const UploadProgressList: React__default.FC<UploadProgressListProps>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Helper: upload a file to a pre-signed S3 URL with progress + retries.
|
|
187
|
+
*/
|
|
188
|
+
declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void, maxRetries?: number): Promise<void>;
|
|
189
|
+
|
|
190
|
+
interface UseContainersOptions {
|
|
191
|
+
apiBaseUrl: string;
|
|
192
|
+
parentId?: string;
|
|
193
|
+
}
|
|
194
|
+
declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
|
|
195
|
+
containers: ContainerDTO[];
|
|
196
|
+
setContainers: React.Dispatch<React.SetStateAction<ContainerDTO[]>>;
|
|
197
|
+
loading: boolean;
|
|
198
|
+
error: Error | null;
|
|
199
|
+
reload: () => Promise<void>;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
interface UseUploadManagerOptions {
|
|
203
|
+
autoUpload?: boolean;
|
|
204
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
205
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
206
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
207
|
+
}
|
|
208
|
+
declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
|
|
209
|
+
uploads: UploadState[];
|
|
210
|
+
startUploadsIfNeeded: (files: FileList) => void;
|
|
211
|
+
resetUploads: () => void;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
215
|
+
|
|
216
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, DesktopFileIcon, type DesktopFileIconProps, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, type ITemporaryFileDTO, S3, SingleFileProcessUploader, type SingleFileProcessUploaderProps, SparkStudioStorageSDK, TemporaryFileDTO, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
declare enum ContainerType {
|
|
6
|
+
File = 0,
|
|
7
|
+
Folder = 1,
|
|
8
|
+
Root = 2
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an Auto-generated model for ContainerDTO.
|
|
13
|
+
*/
|
|
14
|
+
interface IContainerDTO {
|
|
15
|
+
Id: string;
|
|
16
|
+
ContainerType: ContainerType;
|
|
17
|
+
Name?: string;
|
|
18
|
+
ContentType?: string;
|
|
19
|
+
PublicUrl?: string;
|
|
20
|
+
CreatedDate: string;
|
|
21
|
+
FileSize: number;
|
|
22
|
+
UserId: string;
|
|
23
|
+
ParentContainerId: string;
|
|
24
|
+
}
|
|
25
|
+
type ContainerDTOInit = Partial<IContainerDTO> & Pick<IContainerDTO, "Id" | "ContainerType" | "CreatedDate" | "FileSize" | "UserId" | "ParentContainerId">;
|
|
26
|
+
declare class ContainerDTO implements IContainerDTO {
|
|
27
|
+
Id: string;
|
|
28
|
+
ContainerType: ContainerType;
|
|
29
|
+
Name?: string;
|
|
30
|
+
ContentType?: string;
|
|
31
|
+
PublicUrl?: string;
|
|
32
|
+
CreatedDate: string;
|
|
33
|
+
FileSize: number;
|
|
34
|
+
UserId: string;
|
|
35
|
+
ParentContainerId: string;
|
|
36
|
+
constructor(init: ContainerDTOInit);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Auto-generated client for the Container controller.
|
|
41
|
+
*/
|
|
42
|
+
declare class Container {
|
|
43
|
+
private baseUrl;
|
|
44
|
+
constructor(baseUrl: string);
|
|
45
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
46
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
47
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
48
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
49
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
50
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
51
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Auto-generated client for the Home controller.
|
|
56
|
+
*/
|
|
57
|
+
declare class Home {
|
|
58
|
+
private baseUrl;
|
|
59
|
+
constructor(baseUrl: string);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
64
|
+
*/
|
|
65
|
+
interface IAWSPresignedUrlDTO {
|
|
66
|
+
PresignedUrl?: string;
|
|
67
|
+
PublicUrl?: string;
|
|
68
|
+
Key?: string;
|
|
69
|
+
}
|
|
70
|
+
type AWSPresignedUrlDTOInit = Partial<IAWSPresignedUrlDTO>;
|
|
71
|
+
declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
72
|
+
PresignedUrl?: string;
|
|
73
|
+
PublicUrl?: string;
|
|
74
|
+
Key?: string;
|
|
75
|
+
constructor(init: AWSPresignedUrlDTOInit);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Represents an Auto-generated model for TemporaryFileDTO.
|
|
80
|
+
*/
|
|
81
|
+
interface ITemporaryFileDTO {
|
|
82
|
+
Name?: string;
|
|
83
|
+
ContentType?: string;
|
|
84
|
+
}
|
|
85
|
+
type TemporaryFileDTOInit = Partial<ITemporaryFileDTO>;
|
|
86
|
+
declare class TemporaryFileDTO implements ITemporaryFileDTO {
|
|
87
|
+
Name?: string;
|
|
88
|
+
ContentType?: string;
|
|
89
|
+
constructor(init: TemporaryFileDTOInit);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Auto-generated client for the S3 controller.
|
|
94
|
+
*/
|
|
95
|
+
declare class S3 {
|
|
96
|
+
private baseUrl;
|
|
97
|
+
constructor(baseUrl: string);
|
|
98
|
+
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
99
|
+
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
100
|
+
GetTemporaryPreSignedUrl(temporaryFileDTO: TemporaryFileDTO): Promise<AWSPresignedUrlDTO>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Auto-generated API client.
|
|
105
|
+
*/
|
|
106
|
+
declare class SparkStudioStorageSDK {
|
|
107
|
+
container: Container;
|
|
108
|
+
home: Home;
|
|
109
|
+
s3: S3;
|
|
110
|
+
constructor(baseUrl: string);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface ContainerUploadPanelProps {
|
|
114
|
+
/** Base URL for the Container API (the SDK you pasted). */
|
|
115
|
+
containerApiBaseUrl: string;
|
|
116
|
+
/** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
|
|
117
|
+
storageApiBaseUrl: string;
|
|
118
|
+
/** Optional parent container – if set, we query children instead of roots. */
|
|
119
|
+
parentContainerId?: string;
|
|
120
|
+
}
|
|
121
|
+
declare const ContainerUploadPanel: React__default.FC<ContainerUploadPanelProps>;
|
|
122
|
+
|
|
123
|
+
interface DesktopFileIconProps {
|
|
124
|
+
name?: string | null;
|
|
125
|
+
sizeBytes?: number | null;
|
|
126
|
+
downloadUrl?: string | null;
|
|
127
|
+
/** Double-click / open action */
|
|
128
|
+
onOpen?: () => void;
|
|
129
|
+
/** Delete action (can be async) */
|
|
130
|
+
onDelete?: () => Promise<void> | void;
|
|
131
|
+
}
|
|
132
|
+
declare const DesktopFileIcon: React__default.FC<DesktopFileIconProps>;
|
|
133
|
+
|
|
134
|
+
interface SingleFileProcessUploaderProps {
|
|
135
|
+
getPresignedUrl: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
136
|
+
onUploadComplete?: (file: File, s3Url: AWSPresignedUrlDTO) => void;
|
|
137
|
+
accept?: string;
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
}
|
|
140
|
+
declare const SingleFileProcessUploader: React__default.FC<SingleFileProcessUploaderProps>;
|
|
141
|
+
|
|
142
|
+
interface UploadContainerProps {
|
|
143
|
+
multiple?: boolean;
|
|
144
|
+
accept?: string;
|
|
145
|
+
onFilesSelected?: (files: FileList) => void;
|
|
146
|
+
existingFiles?: ContainerDTO[];
|
|
147
|
+
existingFilesLoading?: boolean;
|
|
148
|
+
onExistingFileClick?: (file: ContainerDTO) => void;
|
|
149
|
+
/** Called when user chooses "Delete file" from the context menu */
|
|
150
|
+
onDeleteFile?: (file: ContainerDTO) => void;
|
|
151
|
+
autoUpload?: boolean;
|
|
152
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
153
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
154
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
155
|
+
}
|
|
156
|
+
declare const UploadContainer: React__default.FC<UploadContainerProps>;
|
|
157
|
+
|
|
158
|
+
interface UploadDropzoneProps {
|
|
159
|
+
isDragging: boolean;
|
|
160
|
+
onDragOver?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
161
|
+
onDragLeave?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
162
|
+
onDrop?: (e: React__default.DragEvent<HTMLDivElement>) => void;
|
|
163
|
+
className?: string;
|
|
164
|
+
style?: React__default.CSSProperties;
|
|
165
|
+
children?: React__default.ReactNode;
|
|
166
|
+
}
|
|
167
|
+
declare const UploadDropzone: React__default.FC<UploadDropzoneProps>;
|
|
168
|
+
|
|
169
|
+
type UploadStatus = "pending" | "uploading" | "success" | "error";
|
|
170
|
+
interface UploadState {
|
|
171
|
+
id: string;
|
|
172
|
+
file: File;
|
|
173
|
+
progress: number;
|
|
174
|
+
status: UploadStatus;
|
|
175
|
+
error?: string;
|
|
176
|
+
s3Url?: string;
|
|
177
|
+
publicUrl?: string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface UploadProgressListProps {
|
|
181
|
+
uploads: UploadState[];
|
|
182
|
+
}
|
|
183
|
+
declare const UploadProgressList: React__default.FC<UploadProgressListProps>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Helper: upload a file to a pre-signed S3 URL with progress + retries.
|
|
187
|
+
*/
|
|
188
|
+
declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void, maxRetries?: number): Promise<void>;
|
|
189
|
+
|
|
190
|
+
interface UseContainersOptions {
|
|
191
|
+
apiBaseUrl: string;
|
|
192
|
+
parentId?: string;
|
|
193
|
+
}
|
|
194
|
+
declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
|
|
195
|
+
containers: ContainerDTO[];
|
|
196
|
+
setContainers: React.Dispatch<React.SetStateAction<ContainerDTO[]>>;
|
|
197
|
+
loading: boolean;
|
|
198
|
+
error: Error | null;
|
|
199
|
+
reload: () => Promise<void>;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
interface UseUploadManagerOptions {
|
|
203
|
+
autoUpload?: boolean;
|
|
204
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
205
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
206
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
207
|
+
}
|
|
208
|
+
declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
|
|
209
|
+
uploads: UploadState[];
|
|
210
|
+
startUploadsIfNeeded: (files: FileList) => void;
|
|
211
|
+
resetUploads: () => void;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
215
|
+
|
|
216
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, DesktopFileIcon, type DesktopFileIconProps, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, type ITemporaryFileDTO, S3, SingleFileProcessUploader, type SingleFileProcessUploaderProps, SparkStudioStorageSDK, TemporaryFileDTO, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };
|
package/dist/index.js
CHANGED
|
@@ -865,7 +865,13 @@ var UploadContainer = ({
|
|
|
865
865
|
{
|
|
866
866
|
className: "w-100 d-flex flex-wrap gap-4 align-content-start",
|
|
867
867
|
style: { minHeight: "140px" },
|
|
868
|
-
children: existingFilesLoading ? /* @__PURE__ */ jsx4("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ jsx4(
|
|
868
|
+
children: existingFilesLoading ? /* @__PURE__ */ jsx4("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ jsx4(
|
|
869
|
+
"div",
|
|
870
|
+
{
|
|
871
|
+
className: "spinner-border text-secondary",
|
|
872
|
+
role: "status"
|
|
873
|
+
}
|
|
874
|
+
) }) : existingFiles.length === 0 ? /* @__PURE__ */ jsxs3(
|
|
869
875
|
"div",
|
|
870
876
|
{
|
|
871
877
|
className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
|
|
@@ -1217,7 +1223,6 @@ function HomeContent() {
|
|
|
1217
1223
|
/* @__PURE__ */ jsx7(
|
|
1218
1224
|
SingleFileProcessUploader,
|
|
1219
1225
|
{
|
|
1220
|
-
label: "Upload a file to process",
|
|
1221
1226
|
accept: "*/*",
|
|
1222
1227
|
getPresignedUrl: getPresignedUrlFromApi,
|
|
1223
1228
|
onUploadComplete: (file, s3Url) => {
|