@uploadcare/file-uploader 1.12.1-alpha.1 → 1.12.1

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.
Files changed (45) hide show
  1. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  2. package/abstract/UploaderPublicApi.js +11 -4
  3. package/blocks/CameraSource/CameraSource.d.ts +22 -12
  4. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  5. package/blocks/CameraSource/CameraSource.js +83 -81
  6. package/blocks/CameraSource/camera-source.css +0 -1
  7. package/blocks/CloudImageEditor/src/lib/parseTabs.js +2 -2
  8. package/blocks/Config/Config.d.ts +3 -3
  9. package/blocks/Config/Config.d.ts.map +1 -1
  10. package/blocks/Config/Config.js +3 -13
  11. package/blocks/Config/initialConfig.d.ts.map +1 -1
  12. package/blocks/Config/initialConfig.js +3 -4
  13. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  14. package/blocks/Config/normalizeConfigValue.js +7 -20
  15. package/blocks/UploadList/upload-list.css +1 -0
  16. package/blocks/utils/comma-separated.d.ts +1 -1
  17. package/blocks/utils/comma-separated.d.ts.map +1 -1
  18. package/blocks/utils/comma-separated.js +2 -5
  19. package/env.d.ts +1 -1
  20. package/env.js +1 -1
  21. package/index.ssr.d.ts +15 -1
  22. package/index.ssr.d.ts.map +1 -1
  23. package/index.ssr.js +15 -6
  24. package/package.json +2 -2
  25. package/types/exported.d.ts +64 -81
  26. package/web/file-uploader.iife.min.js +4 -4
  27. package/web/file-uploader.min.js +4 -4
  28. package/web/uc-basic.min.css +1 -1
  29. package/web/uc-cloud-image-editor.min.js +4 -4
  30. package/web/uc-file-uploader-inline.min.css +1 -1
  31. package/web/uc-file-uploader-inline.min.js +4 -4
  32. package/web/uc-file-uploader-minimal.min.css +1 -1
  33. package/web/uc-file-uploader-minimal.min.js +3 -3
  34. package/web/uc-file-uploader-regular.min.css +1 -1
  35. package/web/uc-file-uploader-regular.min.js +4 -4
  36. package/web/uc-img.min.js +1 -1
  37. package/blocks/CameraSource/constants.d.ts +0 -15
  38. package/blocks/CameraSource/constants.d.ts.map +0 -1
  39. package/blocks/CameraSource/constants.js +0 -17
  40. package/blocks/Config/assertions.d.ts +0 -5
  41. package/blocks/Config/assertions.d.ts.map +0 -1
  42. package/blocks/Config/assertions.js +0 -37
  43. package/blocks/Config/side-effects.d.ts +0 -7
  44. package/blocks/Config/side-effects.d.ts.map +0 -1
  45. package/blocks/Config/side-effects.js +0 -32
@@ -4,8 +4,6 @@ import { initialConfig } from './initialConfig.js';
4
4
  import { sharedConfigKey } from '../../abstract/sharedConfigKey.js';
5
5
  import { toKebabCase } from '../../utils/toKebabCase.js';
6
6
  import { normalizeConfigValue } from './normalizeConfigValue.js';
7
- import { runAssertions } from './assertions.js';
8
- import { runSideEffects } from './side-effects.js';
9
7
 
10
8
  const allConfigKeys = /** @type {(keyof import('../../types').ConfigType)[]} */ ([
11
9
  // "debug" option should go first to be able to print debug messages from the very beginning
@@ -23,7 +21,7 @@ const allConfigKeys = /** @type {(keyof import('../../types').ConfigType)[]} */
23
21
  * 'iconHrefResolver',
24
22
  * 'fileValidators',
25
23
  * 'collectionValidators',
26
- * 'mediaRecorderOptions',
24
+ * 'mediaRecorerOptions',
27
25
  * ]}
28
26
  */
29
27
  export const complexConfigKeys = [
@@ -34,7 +32,7 @@ export const complexConfigKeys = [
34
32
  'iconHrefResolver',
35
33
  'fileValidators',
36
34
  'collectionValidators',
37
- 'mediaRecorderOptions',
35
+ 'mediaRecorerOptions',
38
36
  ];
39
37
 
40
38
  /** @type {(key: keyof import('../../types').ConfigType) => key is keyof import('../../types').ConfigComplexType} */
@@ -138,14 +136,6 @@ class ConfigClass extends Block {
138
136
  this._flushValueToState(key, normalizedValue);
139
137
 
140
138
  this.debugPrint(`[uc-config] "${key}"`, normalizedValue);
141
-
142
- runAssertions(this.cfg);
143
- runSideEffects({
144
- key,
145
- value: normalizedValue ?? null,
146
- setValue: this._setValue.bind(this),
147
- getValue: this._getValue.bind(this),
148
- });
149
139
  }
150
140
 
151
141
  /**
@@ -155,7 +145,7 @@ class ConfigClass extends Block {
155
145
  _getValue(key) {
156
146
  const anyThis = /** @type {typeof this & any} */ (this);
157
147
  const localPropName = getLocalPropName(key);
158
- return anyThis[localPropName] ?? this.$[sharedConfigKey(key)];
148
+ return anyThis[localPropName];
159
149
  }
160
150
 
161
151
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,uDAAwD;AACxD,+DAAgE;AAChE,sEAAuE;AAEvE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CAmElD"}
1
+ {"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,uDAAwD;AACxD,+DAAgE;AAChE,sEAAuE;AAEvE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CAkElD"}
@@ -68,10 +68,9 @@ export const initialConfig = {
68
68
  fileValidators: [],
69
69
  collectionValidators: [],
70
70
 
71
- cameraModes: 'photo, video',
72
- defaultCameraMode: null,
71
+ defaultCameraMode: 'photo',
73
72
  enableAudioRecording: true,
74
- enableVideoRecording: null,
73
+ enableVideoRecording: true,
75
74
  maxVideoRecordingDuration: null,
76
- mediaRecorderOptions: null,
75
+ mediaRecorerOptions: null,
77
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAiBO,iCADK,OAAO,WAWlB;AAwKM,sGAHI,OAAO,mDAcjB"}
1
+ {"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAeO,iCADK,OAAO,WAWlB;AA6JM,sGAHI,OAAO,mDAcjB"}
@@ -1,7 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- import { CameraSourceTypes } from '../CameraSource/constants.js';
4
- import { deserializeCsv } from '../utils/comma-separated.js';
5
3
  import { initialConfig } from './initialConfig.js';
6
4
 
7
5
  /** @param {unknown} value */
@@ -33,28 +31,18 @@ const asStore = (value) => (value === 'auto' ? value : asBoolean(value));
33
31
  const asCameraCapture = (value) => {
34
32
  const strValue = asString(value);
35
33
  if (strValue !== 'user' && strValue !== 'environment' && strValue !== '') {
36
- throw new Error(`Invalid value: "${strValue}"`);
34
+ throw new Error(`Invalid "cameraCapture" value: "${strValue}"`);
37
35
  }
38
36
  return strValue;
39
37
  };
40
38
 
41
39
  /** @param {unknown} value */
42
- const asCameraMode = (value) => {
40
+ const asCameraTab = (value) => {
43
41
  const strValue = asString(value);
44
- if (!Object.values(CameraSourceTypes).includes(strValue)) {
45
- throw new Error(`Invalid value: "${strValue}"`);
42
+ if (strValue !== 'photo' && strValue !== 'video') {
43
+ throw new Error(`Invalid "CameraTab" value: "${strValue}"`);
46
44
  }
47
- return /** @type {import('../CameraSource/CameraSource.js').CameraMode} */ (strValue);
48
- };
49
-
50
- /** @param {unknown} value */
51
- const asCameraModes = (value) => {
52
- const str = asString(value);
53
- const array = deserializeCsv(str);
54
- if (array.some((item) => !Object.values(CameraSourceTypes).includes(item))) {
55
- throw new Error(`Invalid value: "${JSON.stringify(array)}"`);
56
- }
57
- return str;
45
+ return strValue;
58
46
  };
59
47
 
60
48
  /** @param {unknown} value */
@@ -178,11 +166,10 @@ const mapping = {
178
166
  fileValidators: /** @type {typeof asArray<import('../../types').FileValidators>} */ (asArray),
179
167
  collectionValidators: /** @type {typeof asArray<import('../../types').CollectionValidators>} */ (asArray),
180
168
 
181
- cameraModes: asCameraModes,
182
- defaultCameraMode: asCameraMode,
169
+ defaultCameraMode: asCameraTab,
183
170
  enableAudioRecording: asBoolean,
184
171
  enableVideoRecording: asBoolean,
185
- mediaRecorderOptions: asObject,
172
+ mediaRecorerOptions: asObject,
186
173
 
187
174
  maxVideoRecordingDuration: asNumber,
188
175
  };
@@ -1,4 +1,5 @@
1
1
  uc-upload-list {
2
+ position: relative;
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  width: 100%;
@@ -1,3 +1,3 @@
1
- export function deserializeCsv(value: string): string[];
1
+ export function deserealizeCsv(value: string): string[];
2
2
  export function serializeCsv(value: unknown[]): string;
3
3
  //# sourceMappingURL=comma-separated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"comma-separated.d.ts","sourceRoot":"","sources":["comma-separated.js"],"names":[],"mappings":"AAGO,sCADK,MAAM,YAUjB;AAGM,oCADK,OAAO,EAAE,UAOpB"}
1
+ {"version":3,"file":"comma-separated.d.ts","sourceRoot":"","sources":["comma-separated.js"],"names":[],"mappings":"AAGO,sCADK,MAAM,YAOjB;AAGM,oCADK,OAAO,EAAE,UAOpB"}
@@ -1,15 +1,12 @@
1
1
  // @ts-check
2
2
 
3
3
  /** @param {string} value */
4
- export const deserializeCsv = (value) => {
4
+ export const deserealizeCsv = (value) => {
5
5
  if (!value) {
6
6
  return [];
7
7
  }
8
8
 
9
- return value
10
- .split(',')
11
- .map((item) => item.trim())
12
- .filter(Boolean);
9
+ return value.split(',').map((item) => item.trim());
13
10
  };
14
11
 
15
12
  /** @param {unknown[]} value */
package/env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Do not edit this file manually. It's generated during build process. */
2
2
  export const PACKAGE_NAME: "blocks";
3
- export const PACKAGE_VERSION: "1.12.0";
3
+ export const PACKAGE_VERSION: "1.12.1";
4
4
  //# sourceMappingURL=env.d.ts.map
package/env.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Do not edit this file manually. It's generated during build process. */
2
2
  export const PACKAGE_NAME = 'blocks';
3
- export const PACKAGE_VERSION = '1.12.0';
3
+ export const PACKAGE_VERSION = '1.12.1';
package/index.ssr.d.ts CHANGED
@@ -54,6 +54,20 @@ export const BtnUi: {
54
54
  };
55
55
  export const CameraSource: {
56
56
  new (): {};
57
+ types: {
58
+ PHOTO: string;
59
+ VIDEO: string;
60
+ };
61
+ events: {
62
+ IDLE: string;
63
+ SHOT: string;
64
+ PLAY: string;
65
+ PAUSE: string;
66
+ RESUME: string;
67
+ STOP: string;
68
+ RETAKE: string;
69
+ ACCEPT: string;
70
+ };
57
71
  template: string;
58
72
  extSrcList: {
59
73
  FACEBOOK: string;
@@ -530,7 +544,7 @@ export const Modal: {
530
544
  bindAttributes: () => void;
531
545
  };
532
546
  export const PACKAGE_NAME: "blocks";
533
- export const PACKAGE_VERSION: "1.12.0";
547
+ export const PACKAGE_VERSION: "1.12.1";
534
548
  export const PresenceToggle: {
535
549
  new (): {};
536
550
  template: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.ssr.d.ts","sourceRoot":"","sources":["index.ssr.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;EAcE;AACF;;;;;;;;;;;;;;;EAcE;AACF;;;;;EAIE;AACF;;;;;;EAKE;AACF;;;;;;;;EAYE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0IE;AACF;;;;;;;;EAuCE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CE;AACF;;;;;;;;EAuCE;AACF;;;;;;;EAsGE;AACF;;;;;;;EAaE;AACF;;;;;;;EAME;AACF;;;;;;;;;;;;;;;;EAeE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgEE;AACF;;;;;;;EAWE;AACF;;;;;;;EAWE;AACF;;;;;;;EASE;AACF;;;;;;EAKE;AACF;;;;;;;EAWE;AACF;;;;;;;EAME;AACF;;;;;;;EAWE;AACF;;;;;;;EA2IE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEE;;;;;;;;;;;;;AAaF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFE;AACF;;;;;;EAKE;AACF;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4FE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEE;AACK,yCAAiC;AACjC,qCAA6B;AAC7B,6CAAqC;AACrC,oCAA4B"}
package/index.ssr.js CHANGED
@@ -53,6 +53,17 @@ export const BtnUi = class {
53
53
  static bindAttributes = () => {};
54
54
  };
55
55
  export const CameraSource = class {
56
+ static types = { PHOTO: "photo", VIDEO: "video" };
57
+ static events = {
58
+ IDLE: "idle",
59
+ SHOT: "shot",
60
+ PLAY: "play",
61
+ PAUSE: "pause",
62
+ RESUME: "resume",
63
+ STOP: "stop",
64
+ RETAKE: "retake",
65
+ ACCEPT: "accept",
66
+ };
56
67
  static template = `
57
68
  <uc-activity-header>
58
69
  <button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back">
@@ -107,7 +118,7 @@ export const CameraSource = class {
107
118
  <button
108
119
  data-id="video"
109
120
  type="button"
110
- class="uc-switch uc-mini-btn"
121
+ class="uc-switch uc-mini-btn"
111
122
  set="onclick: onClickTab; @hidden: tabVideoHidden"
112
123
  >
113
124
  <uc-icon name="video-camera"></uc-icon>
@@ -134,8 +145,8 @@ export const CameraSource = class {
134
145
  </button>
135
146
 
136
147
  <div class="uc-select">
137
- <button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicrophoneHidden;">
138
- <uc-icon set="@name:toggleMicrophoneIcon"></uc-icon>
148
+ <button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicorphoneHidden;">
149
+ <uc-icon set="@name:toggleMicorphoneIcon"></uc-icon>
139
150
  </button>
140
151
 
141
152
  <uc-select
@@ -364,7 +375,6 @@ export const Config = class {
364
375
  "user-agent-integration",
365
376
  "locale-name",
366
377
  "secure-uploads-expire-threshold",
367
- "camera-modes",
368
378
  "default-camera-mode",
369
379
  "enable-audio-recording",
370
380
  "enable-video-recording",
@@ -409,7 +419,6 @@ export const Config = class {
409
419
  "useragentintegration",
410
420
  "localename",
411
421
  "secureuploadsexpirethreshold",
412
- "cameramodes",
413
422
  "defaultcameramode",
414
423
  "enableaudiorecording",
415
424
  "enablevideorecording",
@@ -1026,7 +1035,7 @@ export const Modal = class {
1026
1035
  static bindAttributes = () => {};
1027
1036
  };
1028
1037
  export const PACKAGE_NAME = `blocks`;
1029
- export const PACKAGE_VERSION = `1.12.0`;
1038
+ export const PACKAGE_VERSION = `1.12.1`;
1030
1039
  export const PresenceToggle = class {
1031
1040
  static template = `<slot></slot> `;
1032
1041
  static reg = () => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.12.1-alpha.1",
3
+ "version": "1.12.1",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -116,7 +116,7 @@
116
116
  "marked": "^4.3.0",
117
117
  "node-watch": "^0.7.3",
118
118
  "npm-run-all": "^4.1.5",
119
- "playwright": "^1.42.1",
119
+ "playwright": "^1.49.1",
120
120
  "postcss": "^8.4.21",
121
121
  "prettier": "^3.2.4",
122
122
  "prettier-plugin-jsdoc": "1.3.0",
@@ -1,7 +1,6 @@
1
1
  import type { LocaleDefinition } from '../abstract/localeRegistry';
2
2
  import type { complexConfigKeys } from '../blocks/Config/Config';
3
3
  import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
4
- import type { CameraMode } from '../blocks/CameraSource/CameraSource';
5
4
 
6
5
  export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
7
6
  export type { UploaderPublicApi } from '../abstract/UploaderPublicApi';
@@ -22,7 +21,7 @@ export type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatur
22
21
  export type IconHrefResolver = (iconName: string) => string;
23
22
  export type FileValidators = FuncFileValidator[];
24
23
  export type CollectionValidators = FuncCollectionValidator[];
25
- export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes;
24
+ export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes
26
25
 
27
26
  export type ConfigType = {
28
27
  /**
@@ -241,20 +240,11 @@ export type ConfigType = {
241
240
  collectionValidators: CollectionValidators;
242
241
 
243
242
  /**
244
- * The camera modes to enable in the camera modal,
245
- * it is possible to select photo or video capture.
246
- * The first mode is the default mode.
247
- * @default 'photo,video'
248
- */
249
- cameraModes: string;
250
-
251
- /**
252
- * The default tab to open in the camera modal,
243
+ * The default tab to open in the camera modal,
253
244
  * it is possible to select video or photo capture
254
- * @default 'null'
255
- * @deprecated - use `cameraModes` instead
245
+ * @default 'photo'
256
246
  */
257
- defaultCameraMode: CameraMode | null;
247
+ defaultCameraMode: 'photo' | 'video';
258
248
  /**
259
249
  * Enable audio recording.
260
250
  * @default true
@@ -262,22 +252,21 @@ export type ConfigType = {
262
252
  enableAudioRecording: boolean;
263
253
  /**
264
254
  * Enable video recording.
265
- * @deprecated - use `cameraModes` instead
266
- * @default null
255
+ * @default true
267
256
  */
268
- enableVideoRecording: boolean | null;
257
+ enableVideoRecording: boolean;
269
258
 
270
259
  /**
271
260
  * The maximum duration of the video recording in seconds
272
261
  * @default null
273
262
  */
274
- maxVideoRecordingDuration: number | null;
263
+ maxVideoRecordingDuration: number | null
275
264
 
276
265
  /**
277
- * A dictionary object that can contain
266
+ * A dictionary object that can contain
278
267
  * the following properties from MediaRecorderOptions
279
268
  */
280
- mediaRecorderOptions: MediaRecorderOptions | null;
269
+ mediaRecorerOptions: MediaRecorderOptions | null
281
270
  };
282
271
  export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
283
272
  export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;
@@ -285,8 +274,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
285
274
 
286
275
  export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
287
276
  ? T extends Uncapitalize<T>
288
- ? `${Uncapitalize<C>}${KebabCase<T>}`
289
- : `${Uncapitalize<C>}-${KebabCase<T>}`
277
+ ? `${Uncapitalize<C>}${KebabCase<T>}`
278
+ : `${Uncapitalize<C>}-${KebabCase<T>}`
290
279
  : S;
291
280
  export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
292
281
  export type LowerCase<S extends string> = Lowercase<S>;
@@ -294,10 +283,9 @@ export type LowerCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T
294
283
 
295
284
  export type OutputFileStatus = 'idle' | 'uploading' | 'success' | 'failed' | 'removed';
296
285
 
297
- export type OutputCustomErrorType = 'CUSTOM_ERROR';
286
+ export type OutputCustomErrorType = 'CUSTOM_ERROR'
298
287
 
299
- export type OutputFileErrorType =
300
- | OutputCustomErrorType
288
+ export type OutputFileErrorType = OutputCustomErrorType
301
289
  | 'NOT_AN_IMAGE'
302
290
  | 'FORBIDDEN_FILE_TYPE'
303
291
  | 'FILE_SIZE_EXCEEDED'
@@ -305,11 +293,7 @@ export type OutputFileErrorType =
305
293
  | 'NETWORK_ERROR'
306
294
  | 'UNKNOWN_ERROR';
307
295
 
308
- export type OutputCollectionErrorType =
309
- | OutputCustomErrorType
310
- | 'SOME_FILES_HAS_ERRORS'
311
- | 'TOO_MANY_FILES'
312
- | 'TOO_FEW_FILES';
296
+ export type OutputCollectionErrorType = OutputCustomErrorType | 'SOME_FILES_HAS_ERRORS' | 'TOO_MANY_FILES' | 'TOO_FEW_FILES';
313
297
 
314
298
  export type OutputFileErrorPayload = {
315
299
  entry: OutputFileEntry;
@@ -343,23 +327,22 @@ export type OutputErrorTypePayload = {
343
327
  CUSTOM_ERROR: Record<string, unknown>;
344
328
  };
345
329
 
346
- export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType
330
+ export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> =
331
+ T extends OutputCustomErrorType
347
332
  ? {
348
- type?: T;
349
- message: string;
350
- payload?: OutputErrorTypePayload[T];
351
- }
352
- : T extends keyof OutputErrorTypePayload
353
- ? {
354
- type: T;
355
- message: string;
356
- payload?: OutputErrorTypePayload[T];
357
- }
358
- : never;
333
+ type?: T;
334
+ message: string;
335
+ payload?: OutputErrorTypePayload[T];
336
+ }
337
+ : T extends keyof OutputErrorTypePayload ? {
338
+ type: T;
339
+ message: string;
340
+ payload?: OutputErrorTypePayload[T];
341
+ } : never
359
342
 
360
- export type OutputErrorFile = OutputError<OutputFileErrorType>;
343
+ export type OutputErrorFile = OutputError<OutputFileErrorType>
361
344
 
362
- export type OutputErrorCollection = OutputError<OutputCollectionErrorType>;
345
+ export type OutputErrorCollection = OutputError<OutputCollectionErrorType>
363
346
 
364
347
  export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus> = {
365
348
  status: TStatus;
@@ -377,7 +360,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
377
360
  fullPath: string | null;
378
361
  source: SourceTypes | null;
379
362
  } & (
380
- | {
363
+ | {
381
364
  status: 'success';
382
365
  fileInfo: UploadcareFile;
383
366
  uuid: string;
@@ -389,7 +372,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
389
372
  isRemoved: false;
390
373
  errors: [];
391
374
  }
392
- | {
375
+ | {
393
376
  status: 'failed';
394
377
  fileInfo: UploadcareFile | null;
395
378
  uuid: string | null;
@@ -401,7 +384,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
401
384
  isRemoved: false;
402
385
  errors: OutputError<OutputFileErrorType>[];
403
386
  }
404
- | {
387
+ | {
405
388
  status: 'uploading';
406
389
  fileInfo: null;
407
390
  uuid: null;
@@ -413,7 +396,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
413
396
  isRemoved: false;
414
397
  errors: [];
415
398
  }
416
- | {
399
+ | {
417
400
  status: 'removed';
418
401
  fileInfo: UploadcareFile | null;
419
402
  uuid: string | null;
@@ -425,7 +408,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
425
408
  isRemoved: true;
426
409
  errors: OutputError<OutputFileErrorType>[];
427
410
  }
428
- | {
411
+ | {
429
412
  status: 'idle';
430
413
  fileInfo: null;
431
414
  uuid: null;
@@ -437,7 +420,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
437
420
  isRemoved: false;
438
421
  errors: [];
439
422
  }
440
- );
423
+ );
441
424
 
442
425
  export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
443
426
 
@@ -461,43 +444,43 @@ export type OutputCollectionState<
461
444
  } & (TGroupFlag extends 'has-group'
462
445
  ? { group: UploadcareGroup }
463
446
  : TGroupFlag extends 'maybe-has-group'
464
- ? { group: UploadcareGroup | null }
465
- : never) &
447
+ ? { group: UploadcareGroup | null }
448
+ : never) &
466
449
  (
467
450
  | {
468
- status: 'idle';
469
- isFailed: false;
470
- isUploading: false;
471
- isSuccess: false;
472
- errors: [];
473
- allEntries: OutputFileEntry<'idle' | 'success'>[];
474
- }
451
+ status: 'idle';
452
+ isFailed: false;
453
+ isUploading: false;
454
+ isSuccess: false;
455
+ errors: [];
456
+ allEntries: OutputFileEntry<'idle' | 'success'>[];
457
+ }
475
458
  | {
476
- status: 'uploading';
477
- isFailed: false;
478
- isUploading: true;
479
- isSuccess: false;
480
- errors: [];
481
- allEntries: OutputFileEntry[];
482
- }
459
+ status: 'uploading';
460
+ isFailed: false;
461
+ isUploading: true;
462
+ isSuccess: false;
463
+ errors: [];
464
+ allEntries: OutputFileEntry[];
465
+ }
483
466
  | {
484
- status: 'success';
485
- isFailed: false;
486
- isUploading: false;
487
- isSuccess: true;
488
- errors: [];
489
- allEntries: OutputFileEntry<'success'>[];
490
- }
467
+ status: 'success';
468
+ isFailed: false;
469
+ isUploading: false;
470
+ isSuccess: true;
471
+ errors: [];
472
+ allEntries: OutputFileEntry<'success'>[];
473
+ }
491
474
  | {
492
- status: 'failed';
493
- isFailed: true;
494
- isUploading: false;
495
- isSuccess: false;
496
- errors: OutputError<OutputCollectionErrorType>[];
497
- allEntries: OutputFileEntry[];
498
- }
475
+ status: 'failed';
476
+ isFailed: true;
477
+ isUploading: false;
478
+ isSuccess: false;
479
+ errors: OutputError<OutputCollectionErrorType>[];
480
+ allEntries: OutputFileEntry[];
481
+ }
499
482
  );
500
483
 
501
484
  export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
502
485
 
503
- export {};
486
+ export { };