@@ -4,7 +4,6 @@ import pRetry, { AbortError } from 'p-retry'
44
55import fetchWithNetworkError from '@uppy/utils/lib/fetchWithNetworkError'
66import ErrorWithCause from '@uppy/utils/lib/ErrorWithCause'
7- import emitSocketProgress from '@uppy/utils/lib/emitSocketProgress'
87import getSocketHost from '@uppy/utils/lib/getSocketHost'
98
109import type Uppy from '@uppy/core'
@@ -81,6 +80,27 @@ async function handleJSONResponse<ResJson>(res: Response): Promise<ResJson> {
8180 throw new HttpError ( { statusCode : res . status , message : errMsg } )
8281}
8382
83+ function emitSocketProgress (
84+ uploader : { uppy : Uppy < any , any > } ,
85+ progressData : {
86+ progress : string // pre-formatted percentage number as a string
87+ bytesTotal : number
88+ bytesUploaded : number
89+ } ,
90+ file : UppyFile < any , any > ,
91+ ) : void {
92+ const { progress, bytesUploaded, bytesTotal } = progressData
93+ if ( progress ) {
94+ uploader . uppy . log ( `Upload progress: ${ progress } ` )
95+ uploader . uppy . emit ( 'upload-progress' , file , {
96+ uploadStarted : file . progress . uploadStarted ?? 0 ,
97+ bytesUploaded,
98+ bytesTotal,
99+ } )
100+ }
101+ }
102+
103+
84104export default class RequestClient < M extends Meta , B extends Body > {
85105 static VERSION = packageJson . version
86106
0 commit comments