@uploadcare/file-uploader 1.24.0-alpha.1 → 1.24.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.js CHANGED
@@ -1216,7 +1216,7 @@ import { TelemetryAPIService } from "@uploadcare/quality-insights";
1216
1216
  import { Queue as Queue2 } from "@uploadcare/upload-client";
1217
1217
 
1218
1218
  // package.json
1219
- var version = "1.24.0-alpha.1";
1219
+ var version = "1.24.0";
1220
1220
 
1221
1221
  // src/env.ts
1222
1222
  var PACKAGE_NAME = "blocks";
@@ -1547,7 +1547,7 @@ var Block = class extends BaseComponent {
1547
1547
  return testId;
1548
1548
  }
1549
1549
  get modalManager() {
1550
- return this.has("*modalManager") && this.$["*modalManager"];
1550
+ return this.has("*modalManager") ? this.$["*modalManager"] : void 0;
1551
1551
  }
1552
1552
  get telemetryManager() {
1553
1553
  if (!this.cfg.qualityInsights) {
@@ -1590,7 +1590,7 @@ var Block = class extends BaseComponent {
1590
1590
  destroyCtxCallback() {
1591
1591
  Data.deleteCtx(this.ctxName);
1592
1592
  this.localeManager?.destroy();
1593
- this.modalManager && this.modalManager?.destroy();
1593
+ this.modalManager?.destroy();
1594
1594
  }
1595
1595
  async proxyUrl(url) {
1596
1596
  if (this.cfg.secureDeliveryProxy && this.cfg.secureDeliveryProxyUrlResolver) {
@@ -1741,7 +1741,7 @@ var ActivityBlock = class _ActivityBlock extends Block {
1741
1741
  }
1742
1742
  }
1743
1743
  _isActivityRegistered() {
1744
- return this.activityType && _ActivityBlock._activityCallbacks.has(this);
1744
+ return !!this.activityType && _ActivityBlock._activityCallbacks.has(this);
1745
1745
  }
1746
1746
  static _activityCallbacks = /* @__PURE__ */ new Map();
1747
1747
  // declare static activities to satisfy type references below
@@ -3511,11 +3511,7 @@ var UploaderPublicApi = class {
3511
3511
  /**
3512
3512
  * TODO: Probably we should not allow user to override `source` property
3513
3513
  */
3514
- addFileFromUrl = (url, {
3515
- silent,
3516
- fileName,
3517
- source
3518
- } = {}) => {
3514
+ addFileFromUrl = (url, { silent, fileName, source } = {}) => {
3519
3515
  const internalId = this._uploadCollection.add({
3520
3516
  externalUrl: url,
3521
3517
  fileName: fileName ?? null,
@@ -3524,11 +3520,7 @@ var UploaderPublicApi = class {
3524
3520
  });
3525
3521
  return this.getOutputItem(internalId);
3526
3522
  };
3527
- addFileFromUuid = (uuid, {
3528
- silent,
3529
- fileName,
3530
- source
3531
- } = {}) => {
3523
+ addFileFromUuid = (uuid, { silent, fileName, source } = {}) => {
3532
3524
  const internalId = this._uploadCollection.add({
3533
3525
  uuid,
3534
3526
  fileName: fileName ?? null,
@@ -3537,11 +3529,7 @@ var UploaderPublicApi = class {
3537
3529
  });
3538
3530
  return this.getOutputItem(internalId);
3539
3531
  };
3540
- addFileFromCdnUrl = (cdnUrl, {
3541
- silent,
3542
- fileName,
3543
- source
3544
- } = {}) => {
3532
+ addFileFromCdnUrl = (cdnUrl, { silent, fileName, source } = {}) => {
3545
3533
  const parsedCdnUrl = parseCdnUrl({
3546
3534
  url: cdnUrl,
3547
3535
  cdnBase: this.cfg.cdnCname
@@ -3603,10 +3591,7 @@ var UploaderPublicApi = class {
3603
3591
  };
3604
3592
  openSystemDialog = (options = {}) => {
3605
3593
  const accept = serializeCsv(
3606
- mergeFileTypes([
3607
- this.cfg.accept ?? "",
3608
- ...this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : []
3609
- ])
3594
+ mergeFileTypes([this.cfg.accept ?? "", ...this.cfg.imgOnly ? IMAGE_ACCEPT_LIST : []])
3610
3595
  );
3611
3596
  const INPUT_ATTR_NAME = "uploadcare-file-input";
3612
3597
  const fileInput = document.createElement("input");
@@ -3624,18 +3609,13 @@ var UploaderPublicApi = class {
3624
3609
  fileInput.multiple = this.cfg.multiple;
3625
3610
  if (options.captureCamera) {
3626
3611
  fileInput.capture = this.cfg.cameraCapture;
3627
- const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(
3628
- this.cfg
3629
- );
3612
+ const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(this.cfg);
3630
3613
  if (options.modeCamera === CameraSourceTypes.PHOTO && isPhotoEnabled) {
3631
3614
  fileInput.accept = BASIC_IMAGE_WILDCARD;
3632
3615
  } else if (options.modeCamera === CameraSourceTypes.VIDEO && isVideoRecordingEnabled) {
3633
3616
  fileInput.accept = BASIC_VIDEO_WILDCARD;
3634
3617
  } else {
3635
- fileInput.accept = [
3636
- BASIC_IMAGE_WILDCARD,
3637
- isVideoRecordingEnabled && BASIC_VIDEO_WILDCARD
3638
- ].filter(Boolean).join(",");
3618
+ fileInput.accept = [BASIC_IMAGE_WILDCARD, isVideoRecordingEnabled && BASIC_VIDEO_WILDCARD].filter(Boolean).join(",");
3639
3619
  }
3640
3620
  } else {
3641
3621
  fileInput.accept = accept;
@@ -3713,9 +3693,7 @@ var UploaderPublicApi = class {
3713
3693
  return;
3714
3694
  }
3715
3695
  if (srcKey === "camera" && browserFeatures.htmlMediaCapture) {
3716
- const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(
3717
- this.cfg
3718
- );
3696
+ const { isPhotoEnabled, isVideoRecordingEnabled } = calcCameraModes(this.cfg);
3719
3697
  if (isPhotoEnabled && isVideoRecordingEnabled) {
3720
3698
  this._ctx.set$({
3721
3699
  "*currentActivity": ActivityBlock.activities.START_FROM
@@ -3773,9 +3751,7 @@ var UploaderPublicApi = class {
3773
3751
  };
3774
3752
  setModalState = (opened) => {
3775
3753
  if (opened && !this._ctx.$["*currentActivity"]) {
3776
- console.warn(
3777
- `Can't open modal without current activity. Please use "setCurrentActivity" method first.`
3778
- );
3754
+ console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);
3779
3755
  return;
3780
3756
  }
3781
3757
  if (opened) {
@@ -4425,9 +4401,7 @@ var CameraSource = class extends UploaderBlock {
4425
4401
  }
4426
4402
  };
4427
4403
  _updateTimer = () => {
4428
- const currentTime = Math.floor(
4429
- (performance.now() - this.$._startTime + this.$._elapsedTime) / 1e3
4430
- );
4404
+ const currentTime = Math.floor((performance.now() - this.$._startTime + this.$._elapsedTime) / 1e3);
4431
4405
  if (typeof this.cfg.maxVideoRecordingDuration === "number" && this.cfg.maxVideoRecordingDuration > 0) {
4432
4406
  const remainingTime = this.cfg.maxVideoRecordingDuration - currentTime;
4433
4407
  if (remainingTime <= 0) {
@@ -4496,22 +4470,16 @@ var CameraSource = class extends UploaderBlock {
4496
4470
  if (this._stream) {
4497
4471
  this._mediaRecorder = new MediaRecorder(this._stream, this._options);
4498
4472
  this._mediaRecorder.start();
4499
- this._mediaRecorder.addEventListener(
4500
- "dataavailable",
4501
- (event) => {
4502
- this._chunks.push(event.data);
4503
- }
4504
- );
4473
+ this._mediaRecorder.addEventListener("dataavailable", (event) => {
4474
+ this._chunks.push(event.data);
4475
+ });
4505
4476
  this._startTimer();
4506
4477
  this.classList.add("uc-recording");
4507
4478
  this._setCameraState(CameraSourceEvents.PLAY);
4508
4479
  }
4509
4480
  } catch (error) {
4510
4481
  console.error("Failed to start recording", error);
4511
- this.telemetryManager.sendEventError(
4512
- error,
4513
- "camera recording. Failed to start recording"
4514
- );
4482
+ this.telemetryManager.sendEventError(error, "camera recording. Failed to start recording");
4515
4483
  }
4516
4484
  };
4517
4485
  _stopRecording = () => {
@@ -4570,10 +4538,7 @@ var CameraSource = class extends UploaderBlock {
4570
4538
  });
4571
4539
  } catch (error) {
4572
4540
  console.error("Failed to preview video", error);
4573
- this.telemetryManager.sendEventError(
4574
- error,
4575
- "camera previewing. Failed to preview video"
4576
- );
4541
+ this.telemetryManager.sendEventError(error, "camera previewing. Failed to preview video");
4577
4542
  }
4578
4543
  };
4579
4544
  _retake = () => {
@@ -4594,12 +4559,7 @@ var CameraSource = class extends UploaderBlock {
4594
4559
  if (!blob2) {
4595
4560
  return;
4596
4561
  }
4597
- const file2 = this._createFile(
4598
- "camera",
4599
- "jpeg",
4600
- DEFAULT_PICTURE_FORMAT,
4601
- blob2
4602
- );
4562
+ const file2 = this._createFile("camera", "jpeg", DEFAULT_PICTURE_FORMAT, blob2);
4603
4563
  this._toSend(file2);
4604
4564
  }, DEFAULT_PICTURE_FORMAT);
4605
4565
  return;
@@ -4760,47 +4720,44 @@ var CameraSource = class extends UploaderBlock {
4760
4720
  (mode) => mode === CameraSourceTypes.PHOTO || mode === CameraSourceTypes.VIDEO
4761
4721
  );
4762
4722
  }
4763
- _setPermissionsState = debounce(
4764
- (state) => {
4765
- this.classList.toggle("uc-initialized", state === "granted");
4766
- const visibleAudio = this._activeTab === CameraSourceTypes.VIDEO && this.cfg.enableAudioRecording;
4767
- const currentIcon = this._activeTab === CameraSourceTypes.PHOTO ? "camera-full" : "video-camera-full";
4768
- if (state === "granted") {
4769
- this.set$({
4770
- videoHidden: false,
4771
- cameraHidden: false,
4772
- tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
4773
- tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
4774
- messageHidden: true,
4775
- timerHidden: true,
4776
- currentIcon,
4777
- audioToggleMicrophoneHidden: !visibleAudio,
4778
- audioSelectHidden: !visibleAudio
4779
- });
4780
- } else if (state === "prompt") {
4781
- this.$.l10nMessage = "camera-permissions-prompt";
4782
- this.set$({
4783
- videoHidden: true,
4784
- cameraHidden: true,
4785
- tabCameraHidden: true,
4786
- messageHidden: false
4787
- });
4788
- this._stopCapture();
4789
- } else {
4790
- this.$.l10nMessage = "camera-permissions-denied";
4791
- this.set$({
4792
- videoHidden: true,
4793
- messageHidden: false,
4794
- tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
4795
- tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
4796
- cameraActionsHidden: true,
4797
- mutableClassButton: "uc-shot-btn uc-camera-action"
4798
- });
4799
- this._stopCapture();
4800
- }
4801
- },
4802
- 300
4803
- );
4723
+ _setPermissionsState = debounce((state) => {
4724
+ this.classList.toggle("uc-initialized", state === "granted");
4725
+ const visibleAudio = this._activeTab === CameraSourceTypes.VIDEO && this.cfg.enableAudioRecording;
4726
+ const currentIcon = this._activeTab === CameraSourceTypes.PHOTO ? "camera-full" : "video-camera-full";
4727
+ if (state === "granted") {
4728
+ this.set$({
4729
+ videoHidden: false,
4730
+ cameraHidden: false,
4731
+ tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
4732
+ tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
4733
+ messageHidden: true,
4734
+ timerHidden: true,
4735
+ currentIcon,
4736
+ audioToggleMicrophoneHidden: !visibleAudio,
4737
+ audioSelectHidden: !visibleAudio
4738
+ });
4739
+ } else if (state === "prompt") {
4740
+ this.$.l10nMessage = "camera-permissions-prompt";
4741
+ this.set$({
4742
+ videoHidden: true,
4743
+ cameraHidden: true,
4744
+ tabCameraHidden: true,
4745
+ messageHidden: false
4746
+ });
4747
+ this._stopCapture();
4748
+ } else {
4749
+ this.$.l10nMessage = "camera-permissions-denied";
4750
+ this.set$({
4751
+ videoHidden: true,
4752
+ messageHidden: false,
4753
+ tabCameraHidden: !this._cameraModes.includes(CameraSourceTypes.PHOTO),
4754
+ tabVideoHidden: !this._cameraModes.includes(CameraSourceTypes.VIDEO),
4755
+ cameraActionsHidden: true,
4756
+ mutableClassButton: "uc-shot-btn uc-camera-action"
4757
+ });
4758
+ this._stopCapture();
4759
+ }
4760
+ }, 300);
4804
4761
  _makeStreamInactive = () => {
4805
4762
  if (!this._stream) return false;
4806
4763
  const audioTracks = this._stream?.getAudioTracks();
@@ -4858,10 +4815,7 @@ var CameraSource = class extends UploaderBlock {
4858
4815
  } catch (error) {
4859
4816
  this._setPermissionsState("denied");
4860
4817
  console.log("Failed to capture camera", error);
4861
- this.telemetryManager.sendEventError(
4862
- error,
4863
- "camera capturing. Failed to capture camera"
4864
- );
4818
+ this.telemetryManager.sendEventError(error, "camera capturing. Failed to capture camera");
4865
4819
  }
4866
4820
  };
4867
4821
  _handlePermissionsChange = () => {
@@ -4877,14 +4831,8 @@ var CameraSource = class extends UploaderBlock {
4877
4831
  response.addEventListener("change", this._handlePermissionsChange);
4878
4832
  }
4879
4833
  } catch (error) {
4880
- console.log(
4881
- "Failed to use permissions API. Fallback to manual request mode.",
4882
- error
4883
- );
4884
- this.telemetryManager.sendEventError(
4885
- error,
4886
- "camera permissions. Failed to use permissions API"
4887
- );
4834
+ console.log("Failed to use permissions API. Fallback to manual request mode.", error);
4835
+ this.telemetryManager.sendEventError(error, "camera permissions. Failed to use permissions API");
4888
4836
  this._capture();
4889
4837
  }
4890
4838
  };
@@ -4899,10 +4847,7 @@ var CameraSource = class extends UploaderBlock {
4899
4847
  await this._getDevices();
4900
4848
  navigator.mediaDevices.addEventListener("devicechange", this._getDevices);
4901
4849
  } catch (error) {
4902
- this.telemetryManager.sendEventError(
4903
- error,
4904
- "camera devices. Failed to get user media"
4905
- );
4850
+ this.telemetryManager.sendEventError(error, "camera devices. Failed to get user media");
4906
4851
  console.log("Failed to get user media", error);
4907
4852
  }
4908
4853
  };
@@ -4932,10 +4877,7 @@ var CameraSource = class extends UploaderBlock {
4932
4877
  }
4933
4878
  this._selectedAudioId = this._audioDevices[0]?.value ?? null;
4934
4879
  } catch (error) {
4935
- this.telemetryManager.sendEventError(
4936
- error,
4937
- "camera devices. Failed to get devices"
4938
- );
4880
+ this.telemetryManager.sendEventError(error, "camera devices. Failed to get devices");
4939
4881
  console.log("Failed to get devices", error);
4940
4882
  }
4941
4883
  };
@@ -4949,9 +4891,7 @@ var CameraSource = class extends UploaderBlock {
4949
4891
  if (this._unsubPermissions) {
4950
4892
  this._unsubPermissions();
4951
4893
  }
4952
- const isChromium = Boolean(
4953
- window.chrome
4954
- );
4894
+ const isChromium = Boolean(window.chrome);
4955
4895
  if (!isChromium) {
4956
4896
  this._setPermissionsState("denied");
4957
4897
  }
@@ -4990,15 +4930,9 @@ var CameraSource = class extends UploaderBlock {
4990
4930
  }
4991
4931
  _destroy() {
4992
4932
  for (const permission of DEFAULT_PERMISSIONS) {
4993
- this._permissionResponses[permission]?.removeEventListener(
4994
- "change",
4995
- this._handlePermissionsChange
4996
- );
4933
+ this._permissionResponses[permission]?.removeEventListener("change", this._handlePermissionsChange);
4997
4934
  }
4998
- navigator.mediaDevices?.removeEventListener(
4999
- "devicechange",
5000
- this._getDevices
5001
- );
4935
+ navigator.mediaDevices?.removeEventListener("devicechange", this._getDevices);
5002
4936
  }
5003
4937
  async destroyCallback() {
5004
4938
  super.destroyCallback();
@@ -6127,9 +6061,7 @@ function batchPreloadImages(list) {
6127
6061
  preloaders.push(preload);
6128
6062
  }
6129
6063
  const images = preloaders.map((preload) => preload.image);
6130
- const promise = Promise.allSettled(
6131
- preloaders.map((preload) => preload.promise)
6132
- );
6064
+ const promise = Promise.allSettled(preloaders.map((preload) => preload.promise));
6133
6065
  const cancel = () => {
6134
6066
  preloaders.forEach((preload) => {
6135
6067
  preload.cancel();
@@ -9247,6 +9179,7 @@ var ExternalSource = class extends UploaderBlock {
9247
9179
  couldSelectAll: false,
9248
9180
  couldDeselectAll: false,
9249
9181
  showSelectionStatus: false,
9182
+ showDoneBtn: false,
9250
9183
  counterText: "",
9251
9184
  doneBtnTextClass: "uc-hidden",
9252
9185
  toolbarVisible: true,
@@ -9358,6 +9291,9 @@ var ExternalSource = class extends UploaderBlock {
9358
9291
  couldDeselectAll: message.selectedCount === message.total,
9359
9292
  selectedList: message.selectedFiles
9360
9293
  });
9294
+ if (!this.$.showDoneBtn && message.isReady) {
9295
+ this.$.showDoneBtn = true;
9296
+ }
9361
9297
  }
9362
9298
  handleIframeLoad() {
9363
9299
  this.applyEmbedCss(this.cfg.externalSourcesEmbedCss);
@@ -9437,7 +9373,8 @@ var ExternalSource = class extends UploaderBlock {
9437
9373
  isDoneBtnEnabled: false,
9438
9374
  couldSelectAll: false,
9439
9375
  couldDeselectAll: false,
9440
- showSelectionStatus: false
9376
+ showSelectionStatus: false,
9377
+ showDoneBtn: false
9441
9378
  });
9442
9379
  }
9443
9380
  };
@@ -9462,7 +9399,11 @@ ExternalSource.template = /* HTML */
9462
9399
  <button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button>
9463
9400
  <button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button>
9464
9401
  </div>
9465
- <button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;">
9402
+ <button
9403
+ type="button"
9404
+ class="uc-done-btn uc-primary-btn"
9405
+ set="onclick: onDone; @disabled: !isDoneBtnEnabled; @hidden: !showDoneBtn"
9406
+ >
9466
9407
  <uc-spinner set="@hidden: isSelectionReady"></uc-spinner>
9467
9408
  <span l10n="done" set="@class: doneBtnTextClass"></span>
9468
9409
  </button>
@@ -11121,6 +11062,7 @@ var Thumb = class extends FileItemConfig {
11121
11062
  }
11122
11063
  return Math.min(size, CDN_MAX_OUTPUT_DIMENSION);
11123
11064
  }
11065
+ // biome-ignore lint/style/noInferrableTypes: Here the type is needed because `_withEntry` could not infer it correctly
11124
11066
  _generateThumbnail = this._withEntry(async (entry, force = false) => {
11125
11067
  const fileInfo = entry.getValue("fileInfo");
11126
11068
  const isImage = entry.getValue("isImage");
package/dist/index.ssr.js CHANGED
@@ -840,7 +840,11 @@ export const ExternalSource = class {
840
840
  <button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button>
841
841
  <button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button>
842
842
  </div>
843
- <button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;">
843
+ <button
844
+ type="button"
845
+ class="uc-done-btn uc-primary-btn"
846
+ set="onclick: onDone; @disabled: !isDoneBtnEnabled; @hidden: !showDoneBtn"
847
+ >
844
848
  <uc-spinner set="@hidden: isSelectionReady"></uc-spinner>
845
849
  <span l10n="done" set="@class: doneBtnTextClass"></span>
846
850
  </button>
@@ -1128,7 +1132,7 @@ export const ModalEvents = {
1128
1132
  DESTROY: "modal:destroy",
1129
1133
  };
1130
1134
  export const PACKAGE_NAME = `blocks`;
1131
- export const PACKAGE_VERSION = `1.24.0-alpha.1`;
1135
+ export const PACKAGE_VERSION = `1.24.0`;
1132
1136
  export const PresenceToggle = class {
1133
1137
  static template = `<slot></slot> `;
1134
1138
  static reg = () => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.24.0-alpha.1",
3
+ "version": "1.24.0",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -46,7 +46,10 @@
46
46
  "browser": "./dist/index.js",
47
47
  "default": "./dist/index.js"
48
48
  },
49
- "./index.css": "./dist/index.css",
49
+ "./index.css": {
50
+ "types": "./types/css.d.ts",
51
+ "default": "./dist/index.css"
52
+ },
50
53
  "./abstract/loadFileUploaderFrom.js": "./dist/abstract/loadFileUploaderFrom.js",
51
54
  "./env": "./dist/env.js",
52
55
  "./web/*": "./web/*",
package/types/css.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare module '*.css' {
2
+ export {};
3
+ }
@@ -5,41 +5,6 @@ import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, F
5
5
  export { Metadata, NetworkError, UploadError, UploadcareError, UploadcareFile, UploadcareGroup } from '@uploadcare/upload-client';
6
6
  import { TelemetryRequest } from '@uploadcare/quality-insights';
7
7
 
8
- declare const ExternalUploadSource: Readonly<{
9
- readonly FACEBOOK: "facebook";
10
- readonly DROPBOX: "dropbox";
11
- readonly GDRIVE: "gdrive";
12
- readonly GPHOTOS: "gphotos";
13
- readonly FLICKR: "flickr";
14
- readonly VK: "vk";
15
- readonly EVERNOTE: "evernote";
16
- readonly BOX: "box";
17
- readonly ONEDRIVE: "onedrive";
18
- readonly HUDDLE: "huddle";
19
- }>;
20
- declare const UploadSource: Readonly<{
21
- readonly FACEBOOK: "facebook";
22
- readonly DROPBOX: "dropbox";
23
- readonly GDRIVE: "gdrive";
24
- readonly GPHOTOS: "gphotos";
25
- readonly FLICKR: "flickr";
26
- readonly VK: "vk";
27
- readonly EVERNOTE: "evernote";
28
- readonly BOX: "box";
29
- readonly ONEDRIVE: "onedrive";
30
- readonly HUDDLE: "huddle";
31
- readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
32
- readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
33
- readonly LOCAL: "local";
34
- readonly DROP_AREA: "drop-area";
35
- readonly CAMERA: "camera";
36
- readonly EXTERNAL: "external";
37
- readonly API: "js-api";
38
- readonly URL: "url";
39
- readonly DRAW: "draw";
40
- }>;
41
- type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
42
-
43
8
  declare class A11y {
44
9
  private _destroyKeyUX;
45
10
  private readonly _scopedWindow;
@@ -180,7 +145,7 @@ declare class Block extends BaseComponent<any> {
180
145
  static StateConsumerScope: string | null;
181
146
  static styleAttrs: string[];
182
147
  protected requireCtxName: boolean;
183
- activityType: any;
148
+ activityType: ActivityType;
184
149
  init$: {};
185
150
  l10n(str: string, variables?: Record<string, string | number>): string;
186
151
  private pluralize;
@@ -477,8 +442,8 @@ declare class ValidationManager {
477
442
  private _getValidatorDescriptorsForEntry;
478
443
  }
479
444
 
480
- type CameraMode = "photo" | "video";
481
- type CameraStatus = "shot" | "retake" | "accept" | "play" | "stop" | "pause" | "resume";
445
+ type CameraMode = 'photo' | 'video';
446
+ type CameraStatus = 'shot' | 'retake' | 'accept' | 'play' | 'stop' | 'pause' | 'resume';
482
447
  declare class CameraSource extends UploaderBlock {
483
448
  couldBeCtxOwner: boolean;
484
449
  activityType: "camera";
@@ -578,12 +543,52 @@ declare class UploadList extends UploaderBlock {
578
543
  destroyCallback(): void;
579
544
  }
580
545
 
546
+ declare const ExternalUploadSource: Readonly<{
547
+ readonly FACEBOOK: "facebook";
548
+ readonly DROPBOX: "dropbox";
549
+ readonly GDRIVE: "gdrive";
550
+ readonly GPHOTOS: "gphotos";
551
+ readonly FLICKR: "flickr";
552
+ readonly VK: "vk";
553
+ readonly EVERNOTE: "evernote";
554
+ readonly BOX: "box";
555
+ readonly ONEDRIVE: "onedrive";
556
+ readonly HUDDLE: "huddle";
557
+ }>;
558
+ declare const UploadSource: Readonly<{
559
+ readonly FACEBOOK: "facebook";
560
+ readonly DROPBOX: "dropbox";
561
+ readonly GDRIVE: "gdrive";
562
+ readonly GPHOTOS: "gphotos";
563
+ readonly FLICKR: "flickr";
564
+ readonly VK: "vk";
565
+ readonly EVERNOTE: "evernote";
566
+ readonly BOX: "box";
567
+ readonly ONEDRIVE: "onedrive";
568
+ readonly HUDDLE: "huddle";
569
+ readonly MOBILE_VIDEO_CAMERA: "mobile-video-camera";
570
+ readonly MOBILE_PHOTO_CAMERA: "mobile-photo-camera";
571
+ readonly LOCAL: "local";
572
+ readonly DROP_AREA: "drop-area";
573
+ readonly CAMERA: "camera";
574
+ readonly EXTERNAL: "external";
575
+ readonly API: "js-api";
576
+ readonly URL: "url";
577
+ readonly DRAW: "draw";
578
+ }>;
579
+ type SourceTypes = (typeof UploadSource)[keyof typeof UploadSource];
580
+
581
581
  declare const CameraSourceTypes: Readonly<{
582
582
  PHOTO: "photo";
583
583
  VIDEO: "video";
584
584
  }>;
585
585
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
586
586
 
587
+ type ApiAddFileCommonOptions = {
588
+ silent?: boolean;
589
+ fileName?: string;
590
+ source?: string;
591
+ };
587
592
  declare class UploaderPublicApi {
588
593
  private _ctx;
589
594
  constructor(ctx: UploaderBlock);
@@ -593,25 +598,10 @@ declare class UploaderPublicApi {
593
598
  /**
594
599
  * TODO: Probably we should not allow user to override `source` property
595
600
  */
596
- addFileFromUrl: (url: string, { silent, fileName, source, }?: {
597
- silent?: boolean;
598
- fileName?: string;
599
- source?: string;
600
- }) => OutputFileEntry<"idle">;
601
- addFileFromUuid: (uuid: string, { silent, fileName, source, }?: {
602
- silent?: boolean;
603
- fileName?: string;
604
- source?: string;
605
- }) => OutputFileEntry<"idle">;
606
- addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source, }?: {
607
- silent?: boolean;
608
- fileName?: string;
609
- source?: string;
610
- }) => OutputFileEntry<"idle">;
611
- addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: {
612
- silent?: boolean;
613
- fileName?: string;
614
- source?: string;
601
+ addFileFromUrl: (url: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
602
+ addFileFromUuid: (uuid: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
603
+ addFileFromCdnUrl: (cdnUrl: string, { silent, fileName, source }?: ApiAddFileCommonOptions) => OutputFileEntry<"idle">;
604
+ addFileFromObject: (file: File, { silent, fileName, source, fullPath, }?: ApiAddFileCommonOptions & {
615
605
  fullPath?: string;
616
606
  }) => OutputFileEntry<"idle">;
617
607
  removeFileByInternalId: (internalId: string) => void;
@@ -2054,4 +2044,4 @@ declare class FileUploaderRegular extends SolutionBlock {
2054
2044
  type KebabCase<T extends string> = T extends `${infer Head} ${infer Tail}` ? `${Lowercase<Head>}-${KebabCase<Tail>}` : Lowercase<T>;
2055
2045
  declare const toKebabCase: <T extends string>(str: T) => KebabCase<T>;
2056
2046
 
2057
- export { ActivityBlock, ActivityHeader, Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PACKAGE_NAME, PACKAGE_VERSION, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UploadCtxProvider, UploadList, UploadSource, UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, loadFileUploaderFrom, toKebabCase };
2047
+ export { ActivityBlock, ActivityHeader, type ApiAddFileCommonOptions, Block, BtnUi, CameraSource, CloudImageEditor, CloudImageEditorActivity, CloudImageEditorBlock, type CollectionValidators, Config, type ConfigAttributesType, type ConfigComplexType, type ConfigPlainType, type ConfigType, Copyright, CropFrame, DropArea, EditorAspectRatioButtonControl, EditorCropButtonControl, EditorFilterControl, EditorFreeformButtonControl, EditorImageCropper, EditorImageFader, EditorOperationControl, EditorScroller, EditorSlider, EditorToolbar, type EventMap, type EventPayload, EventType, ExternalSource, ExternalUploadSource, FileItem, FileUploaderInline, FileUploaderMinimal, FileUploaderRegular, type FileValidator, type FileValidatorDescriptor, type FileValidators, FormInput, type FuncCollectionValidator, type FuncFileValidator, type GroupFlag, Icon, type IconHrefResolver, Img, type KebabCase$1 as KebabCase, type KebabCaseKeys, LineLoaderUi, type LocaleDefinitionOverride, type LowerCase, type LowerCaseKeys, type MetadataCallback, Modal, ModalEvents, type ModalId, type OutputCollectionErrorType, type OutputCollectionState, type OutputCollectionStatus, type OutputCustomErrorType, type OutputError, type OutputErrorCollection, type OutputErrorFile, type OutputErrorTypePayload, type OutputFileEntry, type OutputFileErrorPayload, type OutputFileErrorType, type OutputFileStatus, PACKAGE_NAME, PACKAGE_VERSION, PresenceToggle, ProgressBar, ProgressBarCommon, type SecureDeliveryProxyUrlResolver, type SecureUploadsSignatureAndExpire, type SecureUploadsSignatureResolver, Select, SimpleBtn, SliderUi, SolutionBlock, SourceBtn, SourceList, type SourceTypes, Spinner, StartFrom, Thumb, UploadCtxProvider, UploadList, UploadSource, UploaderBlock, UploaderPublicApi, UrlSource, defineComponents, defineLocale, loadFileUploaderFrom, toKebabCase };