@shipstatic/drop 0.1.11 → 0.1.12
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/README.md +1 -0
- package/dist/index.cjs +4 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValidationError } from '@shipstatic/types';
|
|
1
2
|
import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -5,28 +6,24 @@ import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
|
|
|
5
6
|
* Imports types from @shipstatic/types (single source of truth)
|
|
6
7
|
* and defines drop-specific types
|
|
7
8
|
*/
|
|
9
|
+
|
|
8
10
|
declare const FILE_STATUSES: {
|
|
9
|
-
readonly PENDING: "pending";
|
|
10
11
|
readonly PROCESSING: "processing";
|
|
11
|
-
readonly VALIDATION_FAILED: "validation_failed";
|
|
12
|
-
readonly PROCESSING_ERROR: "processing_error";
|
|
13
|
-
readonly EMPTY_FILE: "empty_file";
|
|
14
|
-
readonly READY: "ready";
|
|
15
12
|
readonly UPLOADING: "uploading";
|
|
16
13
|
readonly COMPLETE: "complete";
|
|
17
14
|
readonly ERROR: "error";
|
|
15
|
+
readonly PENDING: "pending";
|
|
16
|
+
readonly PROCESSING_ERROR: "processing_error";
|
|
17
|
+
readonly EMPTY_FILE: "empty_file";
|
|
18
|
+
readonly VALIDATION_FAILED: "validation_failed";
|
|
19
|
+
readonly READY: "ready";
|
|
18
20
|
};
|
|
19
21
|
type FileStatus = (typeof FILE_STATUSES)[keyof typeof FILE_STATUSES];
|
|
20
22
|
/**
|
|
21
23
|
* Client-side error structure
|
|
22
24
|
* Matches ValidationError from @shipstatic/ship for consistency
|
|
23
25
|
*/
|
|
24
|
-
|
|
25
|
-
error: string;
|
|
26
|
-
details: string;
|
|
27
|
-
errors?: string[];
|
|
28
|
-
isClientError: true;
|
|
29
|
-
}
|
|
26
|
+
type ClientError = ValidationError;
|
|
30
27
|
/**
|
|
31
28
|
* Processed file entry ready for upload
|
|
32
29
|
* Contains both the File object and UI-specific metadata
|
|
@@ -103,6 +100,7 @@ interface DropReturn {
|
|
|
103
100
|
status: {
|
|
104
101
|
title: string;
|
|
105
102
|
details: string;
|
|
103
|
+
errors?: string[];
|
|
106
104
|
} | null;
|
|
107
105
|
/** Get props to spread on dropzone element (handles drag & drop) */
|
|
108
106
|
getDropzoneProps: () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValidationError } from '@shipstatic/types';
|
|
1
2
|
import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -5,28 +6,24 @@ import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
|
|
|
5
6
|
* Imports types from @shipstatic/types (single source of truth)
|
|
6
7
|
* and defines drop-specific types
|
|
7
8
|
*/
|
|
9
|
+
|
|
8
10
|
declare const FILE_STATUSES: {
|
|
9
|
-
readonly PENDING: "pending";
|
|
10
11
|
readonly PROCESSING: "processing";
|
|
11
|
-
readonly VALIDATION_FAILED: "validation_failed";
|
|
12
|
-
readonly PROCESSING_ERROR: "processing_error";
|
|
13
|
-
readonly EMPTY_FILE: "empty_file";
|
|
14
|
-
readonly READY: "ready";
|
|
15
12
|
readonly UPLOADING: "uploading";
|
|
16
13
|
readonly COMPLETE: "complete";
|
|
17
14
|
readonly ERROR: "error";
|
|
15
|
+
readonly PENDING: "pending";
|
|
16
|
+
readonly PROCESSING_ERROR: "processing_error";
|
|
17
|
+
readonly EMPTY_FILE: "empty_file";
|
|
18
|
+
readonly VALIDATION_FAILED: "validation_failed";
|
|
19
|
+
readonly READY: "ready";
|
|
18
20
|
};
|
|
19
21
|
type FileStatus = (typeof FILE_STATUSES)[keyof typeof FILE_STATUSES];
|
|
20
22
|
/**
|
|
21
23
|
* Client-side error structure
|
|
22
24
|
* Matches ValidationError from @shipstatic/ship for consistency
|
|
23
25
|
*/
|
|
24
|
-
|
|
25
|
-
error: string;
|
|
26
|
-
details: string;
|
|
27
|
-
errors?: string[];
|
|
28
|
-
isClientError: true;
|
|
29
|
-
}
|
|
26
|
+
type ClientError = ValidationError;
|
|
30
27
|
/**
|
|
31
28
|
* Processed file entry ready for upload
|
|
32
29
|
* Contains both the File object and UI-specific metadata
|
|
@@ -103,6 +100,7 @@ interface DropReturn {
|
|
|
103
100
|
status: {
|
|
104
101
|
title: string;
|
|
105
102
|
details: string;
|
|
103
|
+
errors?: string[];
|
|
106
104
|
} | null;
|
|
107
105
|
/** Get props to spread on dropzone element (handles drag & drop) */
|
|
108
106
|
getDropzoneProps: () => {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
2
2
|
import { formatFileSize as formatFileSize$1, getValidFiles, filterJunk, validateFiles } from '@shipstatic/ship';
|
|
3
|
+
import { FileValidationStatus } from '@shipstatic/types';
|
|
3
4
|
|
|
4
5
|
var __create = Object.create;
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
@@ -11775,15 +11776,9 @@ function normalizePath(path) {
|
|
|
11775
11776
|
function isZipFile(file) {
|
|
11776
11777
|
return file.type === "application/zip" || file.type === "application/x-zip-compressed" || file.name.toLowerCase().endsWith(".zip");
|
|
11777
11778
|
}
|
|
11778
|
-
|
|
11779
|
-
// src/types.ts
|
|
11780
11779
|
var FILE_STATUSES = {
|
|
11781
|
-
|
|
11780
|
+
...FileValidationStatus,
|
|
11782
11781
|
PROCESSING: "processing",
|
|
11783
|
-
VALIDATION_FAILED: "validation_failed",
|
|
11784
|
-
PROCESSING_ERROR: "processing_error",
|
|
11785
|
-
EMPTY_FILE: "empty_file",
|
|
11786
|
-
READY: "ready",
|
|
11787
11782
|
UPLOADING: "uploading",
|
|
11788
11783
|
COMPLETE: "complete",
|
|
11789
11784
|
ERROR: "error"
|
|
@@ -11978,6 +11973,7 @@ function useDrop(options) {
|
|
|
11978
11973
|
const noValidError = {
|
|
11979
11974
|
error: "No Valid Files",
|
|
11980
11975
|
details: "None of the provided files could be processed.",
|
|
11976
|
+
errors: [],
|
|
11981
11977
|
isClientError: true
|
|
11982
11978
|
};
|
|
11983
11979
|
setState({
|
|
@@ -11992,6 +11988,7 @@ function useDrop(options) {
|
|
|
11992
11988
|
const processingError = {
|
|
11993
11989
|
error: "Processing Failed",
|
|
11994
11990
|
details: `Failed to process files: ${error instanceof Error ? error.message : String(error)}`,
|
|
11991
|
+
errors: [],
|
|
11995
11992
|
isClientError: true
|
|
11996
11993
|
};
|
|
11997
11994
|
setState((prev) => ({
|