@ibanzajoe/uploader 1.1.0 → 1.3.0
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 +186 -27
- package/dist/{chunk-QRUZUI5L.js → chunk-6AJTZNOI.js} +2 -55
- package/dist/chunk-6AJTZNOI.js.map +1 -0
- package/dist/chunk-DJK2SQ5I.js +56 -0
- package/dist/chunk-DJK2SQ5I.js.map +1 -0
- package/dist/{transform-BSPaC9-P.d.cts → client-CUmYuQ7Z.d.cts} +2 -131
- package/dist/{transform-BSPaC9-P.d.ts → client-CUmYuQ7Z.d.ts} +2 -131
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -1
- package/dist/core.d.ts +2 -1
- package/dist/core.js +4 -2
- package/dist/index.cjs +21 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +79 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +54 -0
- package/dist/server.d.ts +54 -0
- package/dist/server.js +26 -0
- package/dist/server.js.map +1 -0
- package/dist/styles.css +2 -2
- package/dist/transform-BTZ0kodO.d.cts +130 -0
- package/dist/transform-BTZ0kodO.d.ts +130 -0
- package/package.json +6 -1
- package/dist/chunk-QRUZUI5L.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { P as PickerResponse, F as FileResult,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeliveryProtection, P as PickerResponse, F as FileResult, d as UploaderClientOptions } from './client-CUmYuQ7Z.cjs';
|
|
2
|
+
export { a as PolicySpec, U as UploadAllOptions, b as UploadOptions, c as UploaderClient } from './client-CUmYuQ7Z.cjs';
|
|
3
|
+
export { C as CropParams, O as OutputParams, Q as QualityParams, R as ResizeParams, a as RotateParams, T as TransformChain, b as TransformOp, c as TransformOpName, d as TransformUrlOptions, e as crop, f as flip, g as flop, o as output, q as quality, r as resize, h as rotate, t as transformUrl, w as withSignedPolicy } from './transform-BTZ0kodO.cjs';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import React__default, { CSSProperties } from 'react';
|
|
5
6
|
|
|
@@ -160,6 +161,17 @@ type SharedPickerProps = {
|
|
|
160
161
|
policy: string;
|
|
161
162
|
signature: string;
|
|
162
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* Client-level default delivery protection applied to every file this picker
|
|
166
|
+
* uploads (`public` | `hotlink` | `signed`). Omitted → the account default
|
|
167
|
+
* configured in the website. Must be permitted by the account's plan.
|
|
168
|
+
*/
|
|
169
|
+
deliveryProtection?: DeliveryProtection;
|
|
170
|
+
/**
|
|
171
|
+
* Client-level default per-file allowed origins (a domain lock for `signed`,
|
|
172
|
+
* or the allowlist for `hotlink`). Omitted → the account allowlist.
|
|
173
|
+
*/
|
|
174
|
+
allowedOrigins?: string[];
|
|
163
175
|
/** File constraint and source options. */
|
|
164
176
|
pickerOptions?: PickerOptions;
|
|
165
177
|
/** Called when all uploads complete. */
|
|
@@ -232,7 +244,7 @@ type PickerOverlayProps = SharedPickerProps & {
|
|
|
232
244
|
/** Inline styles applied to the modal panel. */
|
|
233
245
|
style?: React__default.CSSProperties;
|
|
234
246
|
};
|
|
235
|
-
declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, theme, className, style, }: PickerOverlayProps): React__default.JSX.Element | null;
|
|
247
|
+
declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, deliveryProtection, allowedOrigins, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, theme, className, style, }: PickerOverlayProps): React__default.JSX.Element | null;
|
|
236
248
|
|
|
237
249
|
/**
|
|
238
250
|
* DropPane — inline drag-and-drop upload zone.
|
|
@@ -275,7 +287,7 @@ type DropPaneProps = SharedPickerProps & {
|
|
|
275
287
|
/** Inline styles applied to the root element. */
|
|
276
288
|
style?: React__default.CSSProperties;
|
|
277
289
|
};
|
|
278
|
-
declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, theme, className, style, }: DropPaneProps): React__default.JSX.Element;
|
|
290
|
+
declare function DropPane({ apikey, apiUrl, security, deliveryProtection, allowedOrigins, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, theme, className, style, }: DropPaneProps): React__default.JSX.Element;
|
|
279
291
|
|
|
280
292
|
/**
|
|
281
293
|
* CameraCapture — in-picker webcam capture.
|
|
@@ -389,4 +401,4 @@ type EditImageOptions = {
|
|
|
389
401
|
};
|
|
390
402
|
declare function editImage(file: File, opts?: EditImageOptions): Promise<File>;
|
|
391
403
|
|
|
392
|
-
export { CameraCapture, type CameraCaptureProps, type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UploaderTheme, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, themeToVars, usePicker };
|
|
404
|
+
export { CameraCapture, type CameraCaptureProps, type CropArea, DeliveryProtection, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UploaderTheme, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, themeToVars, usePicker };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { P as PickerResponse, F as FileResult,
|
|
2
|
-
export {
|
|
1
|
+
import { D as DeliveryProtection, P as PickerResponse, F as FileResult, d as UploaderClientOptions } from './client-CUmYuQ7Z.js';
|
|
2
|
+
export { a as PolicySpec, U as UploadAllOptions, b as UploadOptions, c as UploaderClient } from './client-CUmYuQ7Z.js';
|
|
3
|
+
export { C as CropParams, O as OutputParams, Q as QualityParams, R as ResizeParams, a as RotateParams, T as TransformChain, b as TransformOp, c as TransformOpName, d as TransformUrlOptions, e as crop, f as flip, g as flop, o as output, q as quality, r as resize, h as rotate, t as transformUrl, w as withSignedPolicy } from './transform-BTZ0kodO.js';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import React__default, { CSSProperties } from 'react';
|
|
5
6
|
|
|
@@ -160,6 +161,17 @@ type SharedPickerProps = {
|
|
|
160
161
|
policy: string;
|
|
161
162
|
signature: string;
|
|
162
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* Client-level default delivery protection applied to every file this picker
|
|
166
|
+
* uploads (`public` | `hotlink` | `signed`). Omitted → the account default
|
|
167
|
+
* configured in the website. Must be permitted by the account's plan.
|
|
168
|
+
*/
|
|
169
|
+
deliveryProtection?: DeliveryProtection;
|
|
170
|
+
/**
|
|
171
|
+
* Client-level default per-file allowed origins (a domain lock for `signed`,
|
|
172
|
+
* or the allowlist for `hotlink`). Omitted → the account allowlist.
|
|
173
|
+
*/
|
|
174
|
+
allowedOrigins?: string[];
|
|
163
175
|
/** File constraint and source options. */
|
|
164
176
|
pickerOptions?: PickerOptions;
|
|
165
177
|
/** Called when all uploads complete. */
|
|
@@ -232,7 +244,7 @@ type PickerOverlayProps = SharedPickerProps & {
|
|
|
232
244
|
/** Inline styles applied to the modal panel. */
|
|
233
245
|
style?: React__default.CSSProperties;
|
|
234
246
|
};
|
|
235
|
-
declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, theme, className, style, }: PickerOverlayProps): React__default.JSX.Element | null;
|
|
247
|
+
declare function PickerOverlay({ open, onClose, apikey, apiUrl, security, deliveryProtection, allowedOrigins, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, theme, className, style, }: PickerOverlayProps): React__default.JSX.Element | null;
|
|
236
248
|
|
|
237
249
|
/**
|
|
238
250
|
* DropPane — inline drag-and-drop upload zone.
|
|
@@ -275,7 +287,7 @@ type DropPaneProps = SharedPickerProps & {
|
|
|
275
287
|
/** Inline styles applied to the root element. */
|
|
276
288
|
style?: React__default.CSSProperties;
|
|
277
289
|
};
|
|
278
|
-
declare function DropPane({ apikey, apiUrl, security, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, theme, className, style, }: DropPaneProps): React__default.JSX.Element;
|
|
290
|
+
declare function DropPane({ apikey, apiUrl, security, deliveryProtection, allowedOrigins, pickerOptions, onUploadDone, onFileUploadFinished, onFileUploadFailed, onCancel, hint, theme, className, style, }: DropPaneProps): React__default.JSX.Element;
|
|
279
291
|
|
|
280
292
|
/**
|
|
281
293
|
* CameraCapture — in-picker webcam capture.
|
|
@@ -389,4 +401,4 @@ type EditImageOptions = {
|
|
|
389
401
|
};
|
|
390
402
|
declare function editImage(file: File, opts?: EditImageOptions): Promise<File>;
|
|
391
403
|
|
|
392
|
-
export { CameraCapture, type CameraCaptureProps, type CropArea, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UploaderTheme, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, themeToVars, usePicker };
|
|
404
|
+
export { CameraCapture, type CameraCaptureProps, type CropArea, DeliveryProtection, DropPane, type DropPaneProps, type EditImageOptions, FileResult, type Flip, ImageEditor, type ImageEditorProps, type PickerFile, type PickerFileState, type PickerOptions, PickerOverlay, type PickerOverlayProps, PickerResponse, type SharedPickerProps, UploaderClientOptions, type UploaderTheme, type UsePickerOptions, type UsePickerResult, editImage, isCameraSupported, shouldOfferCamera, themeToVars, usePicker };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
UploaderClient
|
|
2
|
+
UploaderClient
|
|
3
|
+
} from "./chunk-6AJTZNOI.js";
|
|
4
|
+
import {
|
|
3
5
|
crop,
|
|
4
6
|
flip,
|
|
5
7
|
flop,
|
|
@@ -9,7 +11,7 @@ import {
|
|
|
9
11
|
rotate,
|
|
10
12
|
transformUrl,
|
|
11
13
|
withSignedPolicy
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DJK2SQ5I.js";
|
|
13
15
|
|
|
14
16
|
// src/react/PickerOverlay.tsx
|
|
15
17
|
import {
|
|
@@ -29,11 +31,22 @@ function nextId() {
|
|
|
29
31
|
function usePicker(opts) {
|
|
30
32
|
const [files, setFiles] = useState([]);
|
|
31
33
|
const clientRef = useRef(null);
|
|
32
|
-
|
|
34
|
+
const clientSigRef = useRef("");
|
|
35
|
+
const clientSig = JSON.stringify({
|
|
36
|
+
apikey: opts.apikey,
|
|
37
|
+
apiUrl: opts.apiUrl ?? null,
|
|
38
|
+
security: opts.security ?? null,
|
|
39
|
+
deliveryProtection: opts.deliveryProtection ?? null,
|
|
40
|
+
allowedOrigins: opts.allowedOrigins ?? null
|
|
41
|
+
});
|
|
42
|
+
if (!clientRef.current || clientSigRef.current !== clientSig) {
|
|
43
|
+
clientSigRef.current = clientSig;
|
|
33
44
|
clientRef.current = new UploaderClient({
|
|
34
45
|
apikey: opts.apikey,
|
|
35
46
|
apiUrl: opts.apiUrl,
|
|
36
|
-
security: opts.security
|
|
47
|
+
security: opts.security,
|
|
48
|
+
deliveryProtection: opts.deliveryProtection,
|
|
49
|
+
allowedOrigins: opts.allowedOrigins
|
|
37
50
|
});
|
|
38
51
|
}
|
|
39
52
|
const addFiles = useCallback(
|
|
@@ -1136,6 +1149,8 @@ function PickerOverlay({
|
|
|
1136
1149
|
apikey,
|
|
1137
1150
|
apiUrl,
|
|
1138
1151
|
security,
|
|
1152
|
+
deliveryProtection,
|
|
1153
|
+
allowedOrigins,
|
|
1139
1154
|
pickerOptions,
|
|
1140
1155
|
onUploadDone,
|
|
1141
1156
|
onFileUploadFinished,
|
|
@@ -1154,6 +1169,8 @@ function PickerOverlay({
|
|
|
1154
1169
|
apikey,
|
|
1155
1170
|
apiUrl,
|
|
1156
1171
|
security,
|
|
1172
|
+
deliveryProtection,
|
|
1173
|
+
allowedOrigins,
|
|
1157
1174
|
pickerOptions,
|
|
1158
1175
|
onUploadDone,
|
|
1159
1176
|
onFileUploadFinished,
|
|
@@ -1436,6 +1453,8 @@ function DropPane({
|
|
|
1436
1453
|
apikey,
|
|
1437
1454
|
apiUrl,
|
|
1438
1455
|
security,
|
|
1456
|
+
deliveryProtection,
|
|
1457
|
+
allowedOrigins,
|
|
1439
1458
|
pickerOptions,
|
|
1440
1459
|
onUploadDone,
|
|
1441
1460
|
onFileUploadFinished,
|
|
@@ -1453,6 +1472,8 @@ function DropPane({
|
|
|
1453
1472
|
apikey,
|
|
1454
1473
|
apiUrl,
|
|
1455
1474
|
security,
|
|
1475
|
+
deliveryProtection,
|
|
1476
|
+
allowedOrigins,
|
|
1456
1477
|
pickerOptions,
|
|
1457
1478
|
onUploadDone,
|
|
1458
1479
|
onFileUploadFinished,
|