@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/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
- import { P as PickerResponse, F as FileResult, h as UploaderClientOptions } from './transform-BSPaC9-P.cjs';
2
- export { C as CropParams, D as DeliveryProtection, O as OutputParams, a as PolicySpec, Q as QualityParams, R as ResizeParams, b as RotateParams, T as TransformChain, c as TransformOp, d as TransformOpName, e as TransformUrlOptions, U as UploadAllOptions, f as UploadOptions, g as UploaderClient, i as crop, j as flip, k as flop, o as output, q as quality, r as resize, l as rotate, t as transformUrl, w as withSignedPolicy } from './transform-BSPaC9-P.cjs';
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, h as UploaderClientOptions } from './transform-BSPaC9-P.js';
2
- export { C as CropParams, D as DeliveryProtection, O as OutputParams, a as PolicySpec, Q as QualityParams, R as ResizeParams, b as RotateParams, T as TransformChain, c as TransformOp, d as TransformOpName, e as TransformUrlOptions, U as UploadAllOptions, f as UploadOptions, g as UploaderClient, i as crop, j as flip, k as flop, o as output, q as quality, r as resize, l as rotate, t as transformUrl, w as withSignedPolicy } from './transform-BSPaC9-P.js';
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-QRUZUI5L.js";
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
- if (!clientRef.current || clientRef.current.apikey !== opts.apikey || clientRef.current.apiUrl !== (opts.apiUrl ?? "https://api.uploaderhq.io")) {
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,