UNPKG

@uploadcare/file-uploader

Version:

Building blocks for Uploadcare products integration

40 lines (34 loc) 1.13 kB
// @ts-check import { Queue } from '@uploadcare/upload-client'; export const blockCtx = () => ({}); /** @param {import('./Block').Block} fnCtx */ export const activityBlockCtx = (fnCtx) => ({ ...blockCtx(), '*currentActivity': null, '*currentActivityParams': {}, '*history': [], '*historyBack': null, '*closeModal': () => { fnCtx.modalManager.close(fnCtx.$['*currentActivity']); fnCtx.set$({ '*currentActivity': null, }); }, }); /** @param {import('./Block').Block} fnCtx */ export const uploaderBlockCtx = (fnCtx) => ({ ...activityBlockCtx(fnCtx), '*commonProgress': 0, '*uploadList': [], '*uploadQueue': new Queue(1), /** @type {import('../types').OutputErrorCollection[]} */ '*collectionErrors': [], /** @type {import('../types').OutputCollectionState | null} */ '*collectionState': null, /** @type {import('@uploadcare/upload-client').UploadcareGroup | null} */ '*groupInfo': null, /** @type {Set<string>} */ '*uploadTrigger': new Set(), /** @type {import('./managers/SecureUploadsManager.js').SecureUploadsManager | null} */ '*secureUploadsManager': null, });