@@ -10,11 +10,30 @@ var slice = [].slice,
1010 hasProp = { } . hasOwnProperty ;
1111
1212( function ( root , factory ) {
13- var name , ref , results , value ;
13+ var factoryWrapper , name , ref , results , value ;
14+ factoryWrapper = function ( assign , cloneDeep , compact , difference , functions , identity , includes , isArray , isElement , isEmpty , isFunction , isPlainObject , isString , merge , trim ) {
15+ return factory ( {
16+ assign : assign ,
17+ cloneDeep : cloneDeep ,
18+ compact : compact ,
19+ difference : difference ,
20+ functions : functions ,
21+ identity : identity ,
22+ includes : includes ,
23+ isArray : isArray ,
24+ isElement : isElement ,
25+ isEmpty : isEmpty ,
26+ isFunction : isFunction ,
27+ isPlainObject : isPlainObject ,
28+ isString : isString ,
29+ merge : merge ,
30+ trim : trim
31+ } ) ;
32+ } ;
1433 if ( ( typeof define === 'function' ) && define . amd ) {
15- return define ( [ 'lodash' ] , factory ) ;
34+ return define ( [ 'lodash/assign' , 'lodash/cloneDeep' , 'lodash/compact' , 'lodash/difference' , 'lodash/functions' , 'lodash/identity' , 'lodash/includes' , 'lodash/isArray' , 'lodash/isElement' , 'lodash/isEmpty' , 'lodash/isFunction' , 'lodash/isPlainObject' , 'lodash/isString' , 'lodash/merge' , 'lodash/trim' ] , factoryWrapper ) ;
1635 } else if ( typeof exports === 'object' ) {
17- return module . exports = factory ( require ( 'lodash' ) ) ;
36+ return module . exports = factoryWrapper ( require ( 'lodash/assign' ) , require ( 'lodash/cloneDeep' ) , require ( 'lodash/compact' ) , require ( 'lodash/difference' ) , require ( 'lodash/functions' ) , require ( 'lodash/identity' ) , require ( 'lodash/includes' ) , require ( 'lodash/isArray' ) , require ( 'lodash/isElement' ) , require ( 'lodash/isEmpty' ) , require ( 'lodash/isFunction' ) , require ( 'lodash/isPlainObject' ) , require ( 'lodash/isString' ) , require ( 'lodash/merge' ) , require ( 'lodash/trim ') ) ;
1837 } else {
1938 root . cloudinary || ( root . cloudinary = { } ) ;
2039 ref = factory ( _ ) ;
@@ -3560,7 +3579,7 @@ var slice = [].slice,
35603579
35613580 } ) ( HtmlTag ) ;
35623581 Cloudinary = ( function ( ) {
3563- var AKAMAI_SHARED_CDN , CF_SHARED_CDN , DEFAULT_POSTER_OPTIONS , DEFAULT_VIDEO_SOURCE_TYPES , OLD_AKAMAI_SHARED_CDN , SHARED_CDN , VERSION , absolutize , applyBreakpoints , cdnSubdomainNumber , closestAbove , cloudinaryUrlPrefix , defaultBreakpoints , finalizeResourceType , findContainerWidth , maxWidth , updateDpr ;
3582+ var AKAMAI_SHARED_CDN , CF_SHARED_CDN , DEFAULT_POSTER_OPTIONS , DEFAULT_VIDEO_SOURCE_TYPES , OLD_AKAMAI_SHARED_CDN , SEO_TYPES , SHARED_CDN , VERSION , absolutize , applyBreakpoints , cdnSubdomainNumber , closestAbove , cloudinaryUrlPrefix , defaultBreakpoints , finalizeResourceType , findContainerWidth , maxWidth , updateDpr ;
35643583
35653584 VERSION = "2.4.0" ;
35663585
@@ -3579,6 +3598,14 @@ var slice = [].slice,
35793598
35803599 DEFAULT_VIDEO_SOURCE_TYPES = [ 'webm' , 'mp4' , 'ogv' ] ;
35813600
3601+ SEO_TYPES = {
3602+ "image/upload" : "images" ,
3603+ "image/private" : "private_images" ,
3604+ "image/authenticated" : "authenticated_images" ,
3605+ "raw/upload" : "files" ,
3606+ "video/upload" : "videos"
3607+ } ;
3608+
35823609
35833610 /**
35843611 * @const {Object} Cloudinary.DEFAULT_IMAGE_PARAMS
@@ -3686,7 +3713,13 @@ var slice = [].slice,
36863713 */
36873714
36883715 finalizeResourceType = function ( resourceType , type , urlSuffix , useRootPath , shorten ) {
3689- var options ;
3716+ var key , options ;
3717+ if ( resourceType == null ) {
3718+ resourceType = "image" ;
3719+ }
3720+ if ( type == null ) {
3721+ type = "upload" ;
3722+ }
36903723 if ( Util . isPlainObject ( resourceType ) ) {
36913724 options = resourceType ;
36923725 resourceType = options . resource_type ;
@@ -3699,17 +3732,17 @@ var slice = [].slice,
36993732 type = 'upload' ;
37003733 }
37013734 if ( urlSuffix != null ) {
3702- if ( resourceType === 'image' && type === 'upload' ) {
3703- resourceType = "images" ;
3704- type = null ;
3705- } else if ( resourceType === 'image' && type === 'private' ) {
3706- resourceType = 'private_images' ;
3707- type = null ;
3708- } else if ( resourceType === 'raw' && type === 'upload' ) {
3709- resourceType = 'files' ;
3710- type = null ;
3711- } else {
3712- throw new Error ( "URL Suffix only supported for image/upload and raw/upload" ) ;
3735+ resourceType = SEO_TYPES [ resourceType + "/" + type ] ;
3736+ type = null ;
3737+ if ( resourceType == null ) {
3738+ throw new Error ( "URL Suffix only supported for " + ( ( ( function ( ) {
3739+ var results ;
3740+ results = [ ] ;
3741+ for ( key in SEO_TYPES ) {
3742+ results . push ( key ) ;
3743+ }
3744+ return results ;
3745+ } ) ( ) ) . join ( ', ' ) ) ) ;
37133746 }
37143747 }
37153748 if ( useRootPath ) {
@@ -3774,9 +3807,6 @@ var slice = [].slice,
37743807 if ( ! options . cloud_name ) {
37753808 throw 'Unknown cloud_name' ;
37763809 }
3777- if ( options . url_suffix && ! options . private_cdn ) {
3778- throw 'URL Suffix only supported in private CDN' ;
3779- }
37803810 if ( publicId . search ( '/' ) >= 0 && ! publicId . match ( / ^ v [ 0 - 9 ] + / ) && ! publicId . match ( / ^ h t t p s ? : \/ / ) && ! ( ( ref = options . version ) != null ? ref . toString ( ) : void 0 ) ) {
37813811 options . version = 1 ;
37823812 }
0 commit comments