diff --git a/abstract/CTX.js b/abstract/CTX.js index fd349d240..520a8abc7 100644 --- a/abstract/CTX.js +++ b/abstract/CTX.js @@ -24,7 +24,6 @@ export const uploaderBlockCtx = (fnCtx) => ({ '*commonProgress': 0, '*uploadList': [], '*focusedEntry': null, - '*uploadMetadata': null, '*uploadQueue': new Queue(1), '*uploadCollection': null, /** @type {ReturnType[]} */ diff --git a/abstract/UploaderBlock.js b/abstract/UploaderBlock.js index fadb23975..a43f2290d 100644 --- a/abstract/UploaderBlock.js +++ b/abstract/UploaderBlock.js @@ -13,7 +13,6 @@ import { customUserAgent } from '../blocks/utils/userAgent.js'; import { createCdnUrl, createCdnUrlModifiers } from '../utils/cdn-utils.js'; import { IMAGE_ACCEPT_LIST, fileIsImage, mergeFileTypes } from '../utils/fileTypes.js'; import { stringToArray } from '../utils/stringToArray.js'; -import { warnOnce } from '../utils/warnOnce.js'; import { uploaderBlockCtx } from './CTX.js'; import { TypedCollection } from './TypedCollection.js'; import { buildOutputCollectionState } from './buildOutputCollectionState.js'; @@ -28,32 +27,6 @@ export class UploaderBlock extends ActivityBlock { init$ = uploaderBlockCtx(this); - /** @private */ - __initialUploadMetadata = null; - - /** - * This is Public JS API method. Could be called before block initialization, so we need to delay state interactions - * until block init. - * - * TODO: If we add more public methods, it is better to use the single queue instead of tons of private fields per - * each method. See https://github.com/uploadcare/blocks/pull/162/ - * - * @deprecated Use `metadata` instance property on `lr-config` block instead. - * @param {import('@uploadcare/upload-client').Metadata} metadata - * @public - */ - setUploadMetadata(metadata) { - warnOnce( - 'setUploadMetadata is deprecated. Use `metadata` instance property on `lr-config` block instead. See migration guide: https://uploadcare.com/docs/file-uploader/migration-to-0.25.0/', - ); - if (!this.connectedOnce) { - // @ts-ignore TODO: fix this - this.__initialUploadMetadata = metadata; - } else { - this.$['*uploadMetadata'] = metadata; - } - } - get hasCtxOwner() { return this.hasBlockInCtx((block) => { if (block instanceof UploaderBlock) { @@ -112,10 +85,6 @@ export class UploaderBlock extends ActivityBlock { this.$['*uploadQueue'].concurrency = Number(value) || 1; }); - if (this.__initialUploadMetadata) { - this.$['*uploadMetadata'] = this.__initialUploadMetadata; - } - if (!this.$['*secureUploadsManager']) { this.$['*secureUploadsManager'] = new SecureUploadsManager(this); } @@ -584,7 +553,7 @@ export class UploaderBlock extends ActivityBlock { * @protected */ async getMetadataFor(entryId) { - const configValue = this.cfg.metadata ?? /** @type {import('../types').Metadata} */ (this.$['*uploadMetadata']); + const configValue = this.cfg.metadata || undefined; if (typeof configValue === 'function') { const outputFileEntry = this.getOutputItem(entryId); const metadata = await configValue(outputFileEntry);