@uploadcare/file-uploader 1.21.0-alpha.3 → 1.22.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.
Files changed (264) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -2
  3. package/abstract/ActivityBlock.d.ts +0 -1
  4. package/abstract/ActivityBlock.d.ts.map +1 -1
  5. package/abstract/ActivityBlock.js +1 -1
  6. package/abstract/Block.d.ts +13 -2
  7. package/abstract/Block.d.ts.map +1 -1
  8. package/abstract/Block.js +35 -3
  9. package/abstract/CTX.d.ts +4 -4
  10. package/abstract/CTX.d.ts.map +1 -1
  11. package/abstract/CTX.js +2 -2
  12. package/abstract/SolutionBlock.d.ts +2 -2
  13. package/abstract/UploaderBlock.d.ts +9 -5
  14. package/abstract/UploaderBlock.d.ts.map +1 -1
  15. package/abstract/UploaderBlock.js +50 -13
  16. package/abstract/UploaderPublicApi.d.ts +2 -2
  17. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  18. package/abstract/UploaderPublicApi.js +4 -4
  19. package/abstract/l10nProcessor.js +1 -1
  20. package/abstract/{LocaleManager.d.ts → managers/LocaleManager.d.ts} +8 -8
  21. package/abstract/{LocaleManager.d.ts.map → managers/LocaleManager.d.ts.map} +1 -1
  22. package/abstract/{LocaleManager.js → managers/LocaleManager.js} +8 -8
  23. package/abstract/{ModalManager.d.ts → managers/ModalManager.d.ts} +7 -7
  24. package/abstract/{ModalManager.d.ts.map → managers/ModalManager.d.ts.map} +1 -1
  25. package/abstract/{ModalManager.js → managers/ModalManager.js} +4 -3
  26. package/abstract/managers/SecureUploadsManager.d.ts +22 -0
  27. package/abstract/{SecureUploadsManager.d.ts.map → managers/SecureUploadsManager.d.ts.map} +1 -1
  28. package/abstract/{SecureUploadsManager.js → managers/SecureUploadsManager.js} +9 -5
  29. package/abstract/managers/TelemetryManager.d.ts +71 -0
  30. package/abstract/managers/TelemetryManager.d.ts.map +1 -0
  31. package/abstract/managers/TelemetryManager.js +218 -0
  32. package/abstract/{ValidationManager.d.ts → managers/ValidationManager.d.ts} +7 -7
  33. package/abstract/managers/ValidationManager.d.ts.map +1 -0
  34. package/abstract/{ValidationManager.js → managers/ValidationManager.js} +16 -14
  35. package/abstract/{a11y.d.ts → managers/a11y.d.ts} +2 -2
  36. package/abstract/managers/a11y.d.ts.map +1 -0
  37. package/abstract/{a11y.js → managers/a11y.js} +1 -1
  38. package/blocks/CameraSource/CameraSource.d.ts +2 -2
  39. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  40. package/blocks/CameraSource/CameraSource.js +15 -3
  41. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +2 -1
  42. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
  43. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +20 -5
  44. package/blocks/CloudImageEditor/src/CropFrame.js +3 -3
  45. package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +14 -0
  46. package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +1 -0
  47. package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.js +140 -0
  48. package/blocks/CloudImageEditor/src/EditorButtonControl.js +1 -1
  49. package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
  50. package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +9 -1
  51. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
  52. package/blocks/CloudImageEditor/src/EditorFilterControl.js +7 -1
  53. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +1 -1
  54. package/blocks/CloudImageEditor/src/EditorImageCropper.js +3 -3
  55. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +1 -1
  56. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -1
  57. package/blocks/CloudImageEditor/src/EditorOperationControl.js +9 -3
  58. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +19 -7
  59. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
  60. package/blocks/CloudImageEditor/src/EditorToolbar.js +88 -21
  61. package/blocks/CloudImageEditor/src/css/common.css +69 -7
  62. package/blocks/CloudImageEditor/src/index.d.ts +1 -0
  63. package/blocks/CloudImageEditor/src/index.js +1 -0
  64. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +2 -1
  65. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +1 -1
  66. package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +74 -8
  67. package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +2 -0
  68. package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts.map +1 -0
  69. package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.js +35 -0
  70. package/blocks/CloudImageEditor/src/state.d.ts +2 -2
  71. package/blocks/CloudImageEditor/src/state.d.ts.map +1 -1
  72. package/blocks/CloudImageEditor/src/state.js +2 -2
  73. package/blocks/CloudImageEditor/src/svg-sprite.d.ts +1 -1
  74. package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -1
  75. package/blocks/CloudImageEditor/src/svg-sprite.js +1 -1
  76. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +2 -2
  77. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
  78. package/blocks/CloudImageEditor/src/toolbar-constants.js +3 -2
  79. package/blocks/CloudImageEditor/src/types.d.ts +2 -0
  80. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
  81. package/blocks/CloudImageEditor/src/types.js +9 -1
  82. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +11 -0
  83. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +1 -0
  84. package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +11 -0
  85. package/blocks/Config/Config.d.ts.map +1 -1
  86. package/blocks/Config/Config.js +6 -1
  87. package/blocks/Config/initialConfig.d.ts +1 -0
  88. package/blocks/Config/initialConfig.d.ts.map +1 -1
  89. package/blocks/Config/initialConfig.js +6 -2
  90. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  91. package/blocks/Config/normalizeConfigValue.js +3 -0
  92. package/blocks/Config/side-effects.d.ts +8 -4
  93. package/blocks/Config/side-effects.d.ts.map +1 -1
  94. package/blocks/Config/side-effects.js +115 -21
  95. package/blocks/DropArea/DropArea.d.ts +2 -2
  96. package/blocks/ExternalSource/ExternalSource.d.ts +2 -2
  97. package/blocks/ExternalSource/types.d.ts +0 -3
  98. package/blocks/ExternalSource/types.d.ts.map +1 -1
  99. package/blocks/ExternalSource/types.js +0 -4
  100. package/blocks/FileItem/FileItem.d.ts +2 -3
  101. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  102. package/blocks/FileItem/FileItem.js +20 -18
  103. package/blocks/FileItem/FileItemConfig.d.ts +1 -1
  104. package/blocks/FileItem/FileItemConfig.d.ts.map +1 -1
  105. package/blocks/FileItem/FileItemConfig.js +3 -3
  106. package/blocks/Modal/Modal.d.ts +6 -6
  107. package/blocks/Modal/Modal.d.ts.map +1 -1
  108. package/blocks/Modal/Modal.js +10 -12
  109. package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
  110. package/blocks/SourceBtn/SourceBtn.d.ts +2 -2
  111. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
  112. package/blocks/SourceBtn/SourceBtn.js +0 -8
  113. package/blocks/Thumb/Thumb.d.ts +2 -2
  114. package/blocks/Thumb/Thumb.d.ts.map +1 -1
  115. package/blocks/Thumb/Thumb.js +2 -0
  116. package/blocks/UploadCtxProvider/EventEmitter.d.ts +17 -4
  117. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  118. package/blocks/UploadCtxProvider/EventEmitter.js +14 -2
  119. package/blocks/UploadList/UploadList.d.ts +2 -2
  120. package/blocks/UrlSource/UrlSource.js +3 -1
  121. package/blocks/themes/uc-basic/common.css +4 -0
  122. package/blocks/themes/uc-basic/index.css +0 -1
  123. package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
  124. package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
  125. package/blocks/themes/uc-basic/svg-sprite.js +1 -1
  126. package/env.d.ts +1 -1
  127. package/env.js +1 -1
  128. package/index.d.ts +1 -2
  129. package/index.js +1 -2
  130. package/index.ssr.d.ts +19 -69
  131. package/index.ssr.d.ts.map +1 -1
  132. package/index.ssr.js +44 -143
  133. package/locales/file-uploader/ar.d.ts +4 -0
  134. package/locales/file-uploader/ar.js +4 -0
  135. package/locales/file-uploader/az.d.ts +4 -0
  136. package/locales/file-uploader/az.js +5 -0
  137. package/locales/file-uploader/ca.d.ts +4 -0
  138. package/locales/file-uploader/ca.js +6 -0
  139. package/locales/file-uploader/cs.d.ts +4 -0
  140. package/locales/file-uploader/cs.js +6 -0
  141. package/locales/file-uploader/da.d.ts +4 -0
  142. package/locales/file-uploader/da.js +6 -0
  143. package/locales/file-uploader/de.d.ts +4 -0
  144. package/locales/file-uploader/de.js +6 -0
  145. package/locales/file-uploader/el.d.ts +4 -0
  146. package/locales/file-uploader/el.js +6 -0
  147. package/locales/file-uploader/en.d.ts +4 -3
  148. package/locales/file-uploader/en.js +4 -3
  149. package/locales/file-uploader/es.d.ts +4 -0
  150. package/locales/file-uploader/es.js +6 -0
  151. package/locales/file-uploader/et.d.ts +4 -0
  152. package/locales/file-uploader/et.js +6 -0
  153. package/locales/file-uploader/fi.d.ts +4 -0
  154. package/locales/file-uploader/fi.js +6 -0
  155. package/locales/file-uploader/fr.d.ts +4 -0
  156. package/locales/file-uploader/fr.js +6 -0
  157. package/locales/file-uploader/he.d.ts +4 -0
  158. package/locales/file-uploader/he.js +6 -0
  159. package/locales/file-uploader/hy.d.ts +4 -0
  160. package/locales/file-uploader/hy.js +5 -0
  161. package/locales/file-uploader/is.d.ts +4 -0
  162. package/locales/file-uploader/is.js +6 -0
  163. package/locales/file-uploader/it.d.ts +4 -0
  164. package/locales/file-uploader/it.js +6 -0
  165. package/locales/file-uploader/ja.d.ts +4 -0
  166. package/locales/file-uploader/ja.js +6 -0
  167. package/locales/file-uploader/ka.d.ts +4 -0
  168. package/locales/file-uploader/ka.js +6 -0
  169. package/locales/file-uploader/kk.d.ts +4 -0
  170. package/locales/file-uploader/kk.js +6 -0
  171. package/locales/file-uploader/ko.d.ts +4 -0
  172. package/locales/file-uploader/ko.js +6 -0
  173. package/locales/file-uploader/lv.d.ts +4 -0
  174. package/locales/file-uploader/lv.js +6 -0
  175. package/locales/file-uploader/nb.d.ts +4 -0
  176. package/locales/file-uploader/nb.js +6 -0
  177. package/locales/file-uploader/nl.d.ts +4 -0
  178. package/locales/file-uploader/nl.js +6 -0
  179. package/locales/file-uploader/pl.d.ts +4 -0
  180. package/locales/file-uploader/pl.js +6 -0
  181. package/locales/file-uploader/pt.d.ts +4 -0
  182. package/locales/file-uploader/pt.js +6 -0
  183. package/locales/file-uploader/ro.d.ts +4 -0
  184. package/locales/file-uploader/ro.js +6 -0
  185. package/locales/file-uploader/ru.d.ts +4 -0
  186. package/locales/file-uploader/ru.js +4 -0
  187. package/locales/file-uploader/sk.d.ts +4 -0
  188. package/locales/file-uploader/sk.js +6 -0
  189. package/locales/file-uploader/sr.d.ts +4 -0
  190. package/locales/file-uploader/sr.js +6 -0
  191. package/locales/file-uploader/sv.d.ts +4 -0
  192. package/locales/file-uploader/sv.js +6 -0
  193. package/locales/file-uploader/tr.d.ts +4 -0
  194. package/locales/file-uploader/tr.js +6 -0
  195. package/locales/file-uploader/uk.d.ts +4 -0
  196. package/locales/file-uploader/uk.js +6 -0
  197. package/locales/file-uploader/vi.d.ts +4 -0
  198. package/locales/file-uploader/vi.js +6 -0
  199. package/locales/file-uploader/zh-TW.d.ts +4 -0
  200. package/locales/file-uploader/zh-TW.js +6 -0
  201. package/locales/file-uploader/zh.d.ts +4 -0
  202. package/locales/file-uploader/zh.js +4 -0
  203. package/package.json +8 -8
  204. package/solutions/cloud-image-editor/CloudImageEditor.d.ts +35 -0
  205. package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -1
  206. package/solutions/cloud-image-editor/CloudImageEditor.js +12 -0
  207. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +3 -2
  208. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  209. package/solutions/file-uploader/inline/FileUploaderInline.js +4 -0
  210. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +11 -10
  211. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  212. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +9 -9
  213. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +3 -2
  214. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  215. package/solutions/file-uploader/regular/FileUploaderRegular.js +4 -4
  216. package/types/events.d.ts +1 -1
  217. package/types/exported.d.ts +59 -52
  218. package/types/jsx.d.ts +2 -0
  219. package/utils/isPromiseLike.d.ts +2 -0
  220. package/utils/isPromiseLike.d.ts.map +1 -0
  221. package/utils/isPromiseLike.js +12 -0
  222. package/utils/isPromiseLike.test.d.ts +2 -0
  223. package/utils/isPromiseLike.test.d.ts.map +1 -0
  224. package/utils/isPromiseLike.test.js +20 -0
  225. package/utils/parseCdnUrl.d.ts.map +1 -1
  226. package/utils/parseCdnUrl.js +4 -1
  227. package/utils/parseCdnUrl.test.js +13 -0
  228. package/utils/validators/collection/validateCollectionUploadError.d.ts +2 -2
  229. package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -1
  230. package/utils/validators/collection/validateCollectionUploadError.js +1 -1
  231. package/utils/validators/collection/validateMultiple.d.ts +2 -2
  232. package/utils/validators/collection/validateMultiple.d.ts.map +1 -1
  233. package/utils/validators/collection/validateMultiple.js +1 -1
  234. package/utils/validators/file/validateFileType.d.ts +2 -2
  235. package/utils/validators/file/validateFileType.d.ts.map +1 -1
  236. package/utils/validators/file/validateFileType.js +1 -1
  237. package/utils/validators/file/validateIsImage.d.ts +2 -2
  238. package/utils/validators/file/validateIsImage.d.ts.map +1 -1
  239. package/utils/validators/file/validateIsImage.js +1 -1
  240. package/utils/validators/file/validateMaxSizeLimit.d.ts +2 -2
  241. package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -1
  242. package/utils/validators/file/validateMaxSizeLimit.js +1 -1
  243. package/utils/validators/file/validateUploadError.d.ts +2 -2
  244. package/utils/validators/file/validateUploadError.d.ts.map +1 -1
  245. package/utils/validators/file/validateUploadError.js +1 -1
  246. package/web/file-uploader.iife.min.js +5 -5
  247. package/web/file-uploader.min.js +5 -5
  248. package/web/uc-basic.min.css +1 -1
  249. package/web/uc-cloud-image-editor.min.css +1 -1
  250. package/web/uc-cloud-image-editor.min.js +5 -5
  251. package/web/uc-file-uploader-inline.min.css +1 -1
  252. package/web/uc-file-uploader-inline.min.js +5 -5
  253. package/web/uc-file-uploader-minimal.min.css +1 -1
  254. package/web/uc-file-uploader-minimal.min.js +5 -5
  255. package/web/uc-file-uploader-regular.min.css +1 -1
  256. package/web/uc-file-uploader-regular.min.js +5 -5
  257. package/web/uc-img.min.js +2 -2
  258. package/abstract/SecureUploadsManager.d.ts +0 -22
  259. package/abstract/ValidationManager.d.ts.map +0 -1
  260. package/abstract/a11y.d.ts.map +0 -1
  261. package/blocks/AiGenerateSource/AIGenerateSource.d.ts +0 -47
  262. package/blocks/AiGenerateSource/AIGenerateSource.d.ts.map +0 -1
  263. package/blocks/AiGenerateSource/AIGenerateSource.js +0 -180
  264. package/blocks/AiGenerateSource/ai-generate-source.css +0 -58
@@ -1,10 +1,10 @@
1
1
  import type { LocaleDefinition } from '../abstract/localeRegistry';
2
2
  import type { complexConfigKeys } from '../blocks/Config/Config';
3
- import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
3
+ import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/managers/ValidationManager';
4
4
  import type { CameraMode } from '../blocks/CameraSource/CameraSource';
5
5
  import type { FilesViewMode } from '../blocks/UploadList/UploadList';
6
6
 
7
- export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
7
+ export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/managers/ValidationManager';
8
8
  export type { UploaderPublicApi } from '../abstract/UploaderPublicApi';
9
9
 
10
10
  export type UploadError = import('@uploadcare/upload-client').UploadError;
@@ -142,6 +142,11 @@ export type ConfigType = {
142
142
  * Set custom CNAME.
143
143
  */
144
144
  cdnCname: string;
145
+
146
+ /**
147
+ * Set CNAME base domain for prefixed CDN URLs.
148
+ */
149
+ cdnCnamePrefixed: string;
145
150
  /**
146
151
  * Set a custom upload URL.
147
152
  */
@@ -295,9 +300,11 @@ export type ConfigType = {
295
300
 
296
301
  cloudImageEditorAutoOpen: boolean;
297
302
 
303
+ qualityInsights: boolean;
304
+
298
305
  cloudImageEditorMaskHref: string | null;
299
306
 
300
- /**
307
+ /**
301
308
  * Adds data-testid attributes to the each block. Needed for testing purposes.
302
309
  * @default false
303
310
  */
@@ -309,8 +316,8 @@ export type ConfigAttributesType = KebabCaseKeys<ConfigPlainType> & LowerCaseKey
309
316
 
310
317
  export type KebabCase<S extends string> = S extends `${infer C}${infer T}`
311
318
  ? T extends Uncapitalize<T>
312
- ? `${Uncapitalize<C>}${KebabCase<T>}`
313
- : `${Uncapitalize<C>}-${KebabCase<T>}`
319
+ ? `${Uncapitalize<C>}${KebabCase<T>}`
320
+ : `${Uncapitalize<C>}-${KebabCase<T>}`
314
321
  : S;
315
322
  export type KebabCaseKeys<T extends Record<string, unknown>> = { [Key in keyof T as KebabCase<Key & string>]: T[Key] };
316
323
  export type LowerCase<S extends string> = Lowercase<S>;
@@ -369,17 +376,17 @@ export type OutputErrorTypePayload = {
369
376
 
370
377
  export type OutputError<T extends OutputFileErrorType | OutputCollectionErrorType> = T extends OutputCustomErrorType
371
378
  ? {
372
- type?: T;
373
- message: string;
374
- payload?: OutputErrorTypePayload[T];
375
- }
379
+ type?: T;
380
+ message: string;
381
+ payload?: OutputErrorTypePayload[T];
382
+ }
376
383
  : T extends keyof OutputErrorTypePayload
377
- ? {
378
- type: T;
379
- message: string;
380
- payload?: OutputErrorTypePayload[T];
381
- }
382
- : never;
384
+ ? {
385
+ type: T;
386
+ message: string;
387
+ payload?: OutputErrorTypePayload[T];
388
+ }
389
+ : never;
383
390
 
384
391
  export type OutputErrorFile = OutputError<OutputFileErrorType>;
385
392
 
@@ -401,7 +408,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
401
408
  fullPath: string | null;
402
409
  source: SourceTypes | null;
403
410
  } & (
404
- | {
411
+ | {
405
412
  status: 'success';
406
413
  fileInfo: UploadcareFile;
407
414
  uuid: string;
@@ -413,7 +420,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
413
420
  isRemoved: false;
414
421
  errors: [];
415
422
  }
416
- | {
423
+ | {
417
424
  status: 'failed';
418
425
  fileInfo: UploadcareFile | null;
419
426
  uuid: string | null;
@@ -425,7 +432,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
425
432
  isRemoved: false;
426
433
  errors: OutputError<OutputFileErrorType>[];
427
434
  }
428
- | {
435
+ | {
429
436
  status: 'uploading';
430
437
  fileInfo: null;
431
438
  uuid: null;
@@ -437,7 +444,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
437
444
  isRemoved: false;
438
445
  errors: [];
439
446
  }
440
- | {
447
+ | {
441
448
  status: 'removed';
442
449
  fileInfo: UploadcareFile | null;
443
450
  uuid: string | null;
@@ -449,7 +456,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
449
456
  isRemoved: true;
450
457
  errors: OutputError<OutputFileErrorType>[];
451
458
  }
452
- | {
459
+ | {
453
460
  status: 'idle';
454
461
  fileInfo: null;
455
462
  uuid: null;
@@ -461,7 +468,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
461
468
  isRemoved: false;
462
469
  errors: [];
463
470
  }
464
- );
471
+ );
465
472
 
466
473
  export type OutputCollectionStatus = 'idle' | 'uploading' | 'success' | 'failed';
467
474
 
@@ -485,43 +492,43 @@ export type OutputCollectionState<
485
492
  } & (TGroupFlag extends 'has-group'
486
493
  ? { group: UploadcareGroup }
487
494
  : TGroupFlag extends 'maybe-has-group'
488
- ? { group: UploadcareGroup | null }
489
- : never) &
495
+ ? { group: UploadcareGroup | null }
496
+ : never) &
490
497
  (
491
498
  | {
492
- status: 'idle';
493
- isFailed: false;
494
- isUploading: false;
495
- isSuccess: false;
496
- errors: [];
497
- allEntries: OutputFileEntry<'idle' | 'success'>[];
498
- }
499
+ status: 'idle';
500
+ isFailed: false;
501
+ isUploading: false;
502
+ isSuccess: false;
503
+ errors: [];
504
+ allEntries: OutputFileEntry<'idle' | 'success'>[];
505
+ }
499
506
  | {
500
- status: 'uploading';
501
- isFailed: false;
502
- isUploading: true;
503
- isSuccess: false;
504
- errors: [];
505
- allEntries: OutputFileEntry[];
506
- }
507
+ status: 'uploading';
508
+ isFailed: false;
509
+ isUploading: true;
510
+ isSuccess: false;
511
+ errors: [];
512
+ allEntries: OutputFileEntry[];
513
+ }
507
514
  | {
508
- status: 'success';
509
- isFailed: false;
510
- isUploading: false;
511
- isSuccess: true;
512
- errors: [];
513
- allEntries: OutputFileEntry<'success'>[];
514
- }
515
+ status: 'success';
516
+ isFailed: false;
517
+ isUploading: false;
518
+ isSuccess: true;
519
+ errors: [];
520
+ allEntries: OutputFileEntry<'success'>[];
521
+ }
515
522
  | {
516
- status: 'failed';
517
- isFailed: true;
518
- isUploading: false;
519
- isSuccess: false;
520
- errors: OutputError<OutputCollectionErrorType>[];
521
- allEntries: OutputFileEntry[];
522
- }
523
+ status: 'failed';
524
+ isFailed: true;
525
+ isUploading: false;
526
+ isSuccess: false;
527
+ errors: OutputError<OutputCollectionErrorType>[];
528
+ allEntries: OutputFileEntry[];
529
+ }
523
530
  );
524
531
 
525
532
  export { EventType, EventPayload } from '../blocks/UploadCtxProvider/EventEmitter';
526
533
 
527
- export { };
534
+ export {};
package/types/jsx.d.ts CHANGED
@@ -22,6 +22,8 @@ declare namespace JSX {
22
22
  interface IntrinsicElements {
23
23
  'uc-crop-frame': any;
24
24
  'uc-editor-crop-button-control': any;
25
+ 'uc-editor-aspect-ratio-button-control': any;
26
+ 'uc-editor-freeform-button-control': any;
25
27
  'uc-editor-filter-control': any;
26
28
  'uc-editor-operation-control': any;
27
29
  'uc-editor-image-cropper': any;
@@ -0,0 +1,2 @@
1
+ export function isPromiseLike(value: unknown): value is Promise<any>;
2
+ //# sourceMappingURL=isPromiseLike.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromiseLike.d.ts","sourceRoot":"","sources":["isPromiseLike.js"],"names":[],"mappings":"AAMO,qCAHI,OAAO,GACL,KAAK,gBAAW,CAO5B"}
@@ -0,0 +1,12 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @param {unknown} value
5
+ * @returns {value is Promise}
6
+ */
7
+ export const isPromiseLike = (value) => {
8
+ return (
9
+ value instanceof Promise ||
10
+ Boolean(value && typeof value === 'object' && 'then' in value && typeof value.then === 'function')
11
+ );
12
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPromiseLike.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromiseLike.test.d.ts","sourceRoot":"","sources":["isPromiseLike.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { isPromiseLike } from './isPromiseLike';
2
+ import { expect } from '@esm-bundle/chai';
3
+
4
+ describe('isPromiseLike', () => {
5
+ it('should return true for Promise instances', () => {
6
+ expect(isPromiseLike(Promise.resolve())).to.be.true;
7
+ });
8
+
9
+ it('should return true for thenable objects', () => {
10
+ const thenable = { then: () => {} };
11
+ expect(isPromiseLike(thenable)).to.be.true;
12
+ });
13
+
14
+ it('should return false for non-thenable objects', () => {
15
+ expect(isPromiseLike({})).to.be.false;
16
+ expect(isPromiseLike(null)).to.be.false;
17
+ expect(isPromiseLike(42)).to.be.false;
18
+ expect(isPromiseLike('string')).to.be.false;
19
+ });
20
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"parseCdnUrl.d.ts","sourceRoot":"","sources":["parseCdnUrl.js"],"names":[],"mappings":"AAIO,8CADK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;SAgB3C"}
1
+ {"version":3,"file":"parseCdnUrl.d.ts","sourceRoot":"","sources":["parseCdnUrl.js"],"names":[],"mappings":"AAMO,8CADK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;SAiB3C"}
@@ -1,12 +1,15 @@
1
+ import { DEFAULT_CDN_CNAME } from '../blocks/Config/initialConfig.js';
2
+
1
3
  const uuidRegex = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i;
2
4
  const cdnUrlRegex = new RegExp(`^/?(${uuidRegex.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`, 'i');
3
5
 
4
6
  /** @param {{ url: string; cdnBase: string }} options */
5
7
  export const parseCdnUrl = ({ url, cdnBase }) => {
6
8
  const cdnBaseUrlObj = new URL(cdnBase);
9
+ const fallbackCdnBaseUrlObj = new URL(DEFAULT_CDN_CNAME);
7
10
  const urlObj = new URL(url);
8
11
 
9
- if (cdnBaseUrlObj.host !== urlObj.host) {
12
+ if (cdnBaseUrlObj.host !== urlObj.host && fallbackCdnBaseUrlObj.host !== urlObj.host) {
10
13
  return null;
11
14
  }
12
15
 
@@ -75,4 +75,17 @@ describe('parseCdnUrl', () => {
75
75
  filename: null,
76
76
  });
77
77
  });
78
+
79
+ it('should fallback to ucarecdn.com if cdnBase is not matched', () => {
80
+ expect(
81
+ parseCdnUrl({
82
+ url: 'https://ucarecdn.com/12345678-1234-5678-1234-567812345678/',
83
+ cdnBase: 'https://cdn.example.com',
84
+ }),
85
+ ).to.deep.equal({
86
+ uuid: '12345678-1234-5678-1234-567812345678',
87
+ cdnUrlModifiers: '',
88
+ filename: null,
89
+ });
90
+ });
78
91
  });
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
2
- export const validateCollectionUploadError: import("../../../abstract/ValidationManager.js").FuncCollectionValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncCollectionValidator} */
2
+ export const validateCollectionUploadError: import("../../../abstract/managers/ValidationManager.js").FuncCollectionValidator;
3
3
  //# sourceMappingURL=validateCollectionUploadError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateCollectionUploadError.d.ts","sourceRoot":"","sources":["validateCollectionUploadError.js"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,4CADW,OAAO,wCAAwC,EAAE,uBAAuB,CAQjF"}
1
+ {"version":3,"file":"validateCollectionUploadError.d.ts","sourceRoot":"","sources":["validateCollectionUploadError.js"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,4CADW,OAAO,iDAAiD,EAAE,uBAAuB,CAQ1F"}
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
3
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncCollectionValidator} */
4
4
  export const validateCollectionUploadError = (collection, api) => {
5
5
  if (collection.failedCount > 0) {
6
6
  return {
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
2
- export const validateMultiple: import("../../../abstract/ValidationManager.js").FuncCollectionValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncCollectionValidator} */
2
+ export const validateMultiple: import("../../../abstract/managers/ValidationManager.js").FuncCollectionValidator;
3
3
  //# sourceMappingURL=validateMultiple.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateMultiple.d.ts","sourceRoot":"","sources":["validateMultiple.js"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,+BADW,OAAO,wCAAwC,EAAE,uBAAuB,CAwCjF"}
1
+ {"version":3,"file":"validateMultiple.d.ts","sourceRoot":"","sources":["validateMultiple.js"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,+BADW,OAAO,iDAAiD,EAAE,uBAAuB,CAwC1F"}
@@ -1,6 +1,6 @@
1
1
  //@ts-check
2
2
 
3
- /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
3
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncCollectionValidator} */
4
4
  export const validateMultiple = (collection, api) => {
5
5
  const total = collection.totalCount;
6
6
  const multipleMin = api.cfg.multiple ? api.cfg.multipleMin : 0;
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateFileType: import("../../../abstract/ValidationManager.js").FuncFileValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
2
+ export const validateFileType: import("../../../abstract/managers/ValidationManager.js").FuncFileValidator;
3
3
  //# sourceMappingURL=validateFileType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateFileType.d.ts","sourceRoot":"","sources":["validateFileType.js"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,+BADW,OAAO,wCAAwC,EAAE,iBAAiB,CA0B3E"}
1
+ {"version":3,"file":"validateFileType.d.ts","sourceRoot":"","sources":["validateFileType.js"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,+BADW,OAAO,iDAAiD,EAAE,iBAAiB,CA0BpF"}
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
  import { IMAGE_ACCEPT_LIST, matchExtension, matchMimeType, mergeFileTypes } from '../../fileTypes.js';
3
3
 
4
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
4
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
5
5
  export const validateFileType = (outputEntry, api) => {
6
6
  const imagesOnly = api.cfg.imgOnly;
7
7
  const accept = api.cfg.accept;
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateIsImage: import("../../../abstract/ValidationManager.js").FuncFileValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
2
+ export const validateIsImage: import("../../../abstract/managers/ValidationManager.js").FuncFileValidator;
3
3
  //# sourceMappingURL=validateIsImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateIsImage.d.ts","sourceRoot":"","sources":["validateIsImage.js"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,8BADW,OAAO,wCAAwC,EAAE,iBAAiB,CAsB3E"}
1
+ {"version":3,"file":"validateIsImage.d.ts","sourceRoot":"","sources":["validateIsImage.js"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,8BADW,OAAO,iDAAiD,EAAE,iBAAiB,CAsBpF"}
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
3
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
4
4
  export const validateIsImage = (outputEntry, api) => {
5
5
  const imagesOnly = api.cfg.imgOnly;
6
6
  const isImage = outputEntry.isImage;
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateMaxSizeLimit: import("../../../abstract/ValidationManager.js").FuncFileValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
2
+ export const validateMaxSizeLimit: import("../../../abstract/managers/ValidationManager.js").FuncFileValidator;
3
3
  //# sourceMappingURL=validateMaxSizeLimit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateMaxSizeLimit.d.ts","sourceRoot":"","sources":["validateMaxSizeLimit.js"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,mCADW,OAAO,wCAAwC,EAAE,iBAAiB,CAW3E"}
1
+ {"version":3,"file":"validateMaxSizeLimit.d.ts","sourceRoot":"","sources":["validateMaxSizeLimit.js"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,mCADW,OAAO,iDAAiD,EAAE,iBAAiB,CAWpF"}
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
  import { prettyBytes } from '../../prettyBytes.js';
3
3
 
4
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
4
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
5
5
  export const validateMaxSizeLimit = (outputEntry, api) => {
6
6
  const maxFileSize = api.cfg.maxLocalFileSizeBytes;
7
7
  const fileSize = outputEntry.size;
@@ -1,3 +1,3 @@
1
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateUploadError: import("../../../abstract/ValidationManager.js").FuncFileValidator;
1
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
2
+ export const validateUploadError: import("../../../abstract/managers/ValidationManager.js").FuncFileValidator;
3
3
  //# sourceMappingURL=validateUploadError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateUploadError.d.ts","sourceRoot":"","sources":["validateUploadError.js"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,kCADW,OAAO,wCAAwC,EAAE,iBAAiB,CA4C3E"}
1
+ {"version":3,"file":"validateUploadError.d.ts","sourceRoot":"","sources":["validateUploadError.js"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,kCADW,OAAO,iDAAiD,EAAE,iBAAiB,CA4CpF"}
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
  import { NetworkError, UploadError } from '@uploadcare/upload-client';
3
3
 
4
- /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
4
+ /** @type {import('../../../abstract/managers/ValidationManager.js').FuncFileValidator} */
5
5
  export const validateUploadError = (outputEntry, api) => {
6
6
  const { internalId } = outputEntry;
7
7