@filerobot/utils
Advanced tools
Comparing version 0.0.0-beta.18 to 0.0.0-beta.25
@@ -373,4 +373,8 @@ import { VisibilityIcon, CodeIcon, TagsIcon, MetaIcon, DetailsIcon, CommentsIcon, HistoryIcon, BranchesIcon, SimilarityIcon, LinkIcon, ShareFolderIcon, ShareAssetsIcon, CommentsSolidIcon } from '@filerobot/icons'; | ||
var IMAGE_EDITOR_MODES = { | ||
MODIFY: 'MODIFY', | ||
UPLOAD: 'UPLOAD' | ||
DEFAULT: 'default', | ||
// for editing the image and passing the new image data | ||
FILEROBOT: 'filerobot', | ||
// for editing the image and uploading it directly to the filerobot server | ||
CLOUDIMAGE: 'cloudimage' // for editing the image and changing the url through cloudimage | ||
}; | ||
@@ -377,0 +381,0 @@ var STATUS_BAR_STATES = { |
@@ -5,7 +5,6 @@ import { TIME_OPTIONS } from './constants'; | ||
export default (function (file) { | ||
var _file$properties; | ||
var _file$meta, _file$meta2, _file$properties; | ||
var _file$meta = file.meta, | ||
imgWidth = _file$meta.img_w, | ||
imgHeight = _file$meta.img_h; | ||
var imgWidth = file === null || file === void 0 ? void 0 : (_file$meta = file.meta) === null || _file$meta === void 0 ? void 0 : _file$meta.img_w; | ||
var imgHeight = file === null || file === void 0 ? void 0 : (_file$meta2 = file.meta) === null || _file$meta2 === void 0 ? void 0 : _file$meta2.img_h; | ||
var isDefined = imgWidth && imgHeight; | ||
@@ -12,0 +11,0 @@ var uuid = file.uuid; |
/** | ||
* @param {{fields: object}[]} metabaseGroups | ||
* @param {object[]} metaRegionalGroups | ||
* @returns {object} | ||
*/ | ||
function generateMetadataDefaultState(metabaseGroups) { | ||
function generateMetadataDefaultState(metabaseGroups, metaRegionalGroups) { | ||
var defaultMetadata = {}; | ||
@@ -11,7 +12,13 @@ (metabaseGroups || []).forEach(function (group) { | ||
}).forEach(function (field) { | ||
var _metaRegionalGroups$f; | ||
var value = typeof field.default_value !== 'undefined' ? field.default_value : ['tags', 'multi-select'].indexOf(field.type) > -1 ? [] : null; | ||
var fieldRegionalVariants = metaRegionalGroups === null || metaRegionalGroups === void 0 ? void 0 : (_metaRegionalGroups$f = metaRegionalGroups.find(function (group) { | ||
return group.id === (field === null || field === void 0 ? void 0 : field.regional_variants_group_id); | ||
})) === null || _metaRegionalGroups$f === void 0 ? void 0 : _metaRegionalGroups$f.variants; | ||
if (field.regional_variants && Array.isArray(field.regional_variants)) { | ||
if (fieldRegionalVariants && Array.isArray(fieldRegionalVariants)) { | ||
defaultMetadata[field.key] = defaultMetadata[field.key] || {}; | ||
field.regional_variants.forEach(function (regionalVariantKey) { | ||
fieldRegionalVariants.forEach(function (_ref) { | ||
var regionalVariantKey = _ref.key; | ||
defaultMetadata[field.key][regionalVariantKey] = value; | ||
@@ -18,0 +25,0 @@ }); |
@@ -1,3 +0,1 @@ | ||
var _this = this; | ||
import getFileLink from './getFileLink'; | ||
@@ -12,12 +10,13 @@ import downloadFromBlob from './downloadFromBlob'; | ||
xhr.onload = function () { | ||
if (this.status === 200) { | ||
if (xhr.status === 200) { | ||
downloadFromBlob(xhr.response, file.name); | ||
resolve(); | ||
} else { | ||
reject(new Error("Error (" + this.status + "): " + xhr.statusText)); | ||
reject(new Error("Request error (" + xhr.status + ")")); | ||
} | ||
}; | ||
}; // TODO: use Request Error here too | ||
xhr.onerror = function () { | ||
return reject(new Error("Error (" + _this.status + "): " + xhr.statusText)); | ||
return reject(new Error("Request error (" + xhr.status + ") - check your internet connection")); | ||
}; | ||
@@ -24,0 +23,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"types": "types/index.d.ts", | ||
"version": "0.0.0-beta.18", | ||
"version": "0.0.0-beta.25", | ||
"files": [ | ||
@@ -15,3 +15,3 @@ "/dist", | ||
"dependencies": { | ||
"@filerobot/icons": "^0.0.0-beta.18", | ||
"@filerobot/icons": "^0.0.0-beta.25", | ||
"abortcontroller-polyfill": "^1.4.0", | ||
@@ -18,0 +18,0 @@ "lodash.throttle": "^4.1.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125636
2922
94