import { IAssetItem } from '../interfaces' ; import { superdeskApi } from '../apis' ; const RENDITION_RESOURCE = 'sams/assets/images/' ; export function getAssetRenditionUrl ( assetId , width ? , height ? , keepProportions = true ) { const { server } = superdeskApi . instance . config ; const baseUrl = RENDITION_RESOURCE + assetId ; const params = { } ; if ( width != null ) { params [ 'width' ] = width ; } if ( height != null ) { params [ 'height' ] = height ; } params [ 'keep_proportions' ] = keepProportions ; const urlParams = ( new URLSearchParams ( params ) ) . toString ( ) ; return server . url + '/' + baseUrl + ( urlParams ? `?${ urlParams }` : '' ) ; }