@uppy/instagram
Advanced tools
Comparing version 0.27.5 to 0.28.0
@@ -1,3 +0,1 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -89,85 +87,2 @@ | ||
Instagram.prototype.getUsername = function getUsername(data) { | ||
return data.data[0].user.username; | ||
}; | ||
Instagram.prototype.isFolder = function isFolder(item) { | ||
return false; | ||
}; | ||
Instagram.prototype.getItemData = function getItemData(item) { | ||
return item; | ||
}; | ||
Instagram.prototype.getItemIcon = function getItemIcon(item) { | ||
if (!item.images) { | ||
return 'video'; | ||
} | ||
return item.images.low_resolution.url; | ||
}; | ||
Instagram.prototype.getItemSubList = function getItemSubList(item) { | ||
var subItems = []; | ||
item.data.forEach(function (subItem) { | ||
if (subItem.carousel_media) { | ||
subItem.carousel_media.forEach(function (i, index) { | ||
var id = subItem.id, | ||
created_time = subItem.created_time; | ||
var newSubItem = _extends({}, i, { id: id, created_time: created_time }); | ||
newSubItem.carousel_id = index; | ||
subItems.push(newSubItem); | ||
}); | ||
} else { | ||
subItems.push(subItem); | ||
} | ||
}); | ||
return subItems; | ||
}; | ||
Instagram.prototype.getItemName = function getItemName(item) { | ||
if (item && item['created_time']) { | ||
var ext = item.type === 'video' ? 'mp4' : 'jpeg'; | ||
var date = new Date(item['created_time'] * 1000); | ||
date = date.toLocaleDateString([], { | ||
year: 'numeric', | ||
month: 'short', | ||
day: 'numeric', | ||
hour: 'numeric', | ||
minute: 'numeric' | ||
}); | ||
// adding both date and carousel_id, so the name is unique | ||
return 'Instagram ' + date + (item.carousel_id ? ' ' + item.carousel_id : '') + '.' + ext; | ||
} | ||
return ''; | ||
}; | ||
Instagram.prototype.getMimeType = function getMimeType(item) { | ||
return item.type === 'video' ? 'video/mp4' : 'image/jpeg'; | ||
}; | ||
Instagram.prototype.getItemId = function getItemId(item) { | ||
return '' + item.id + (item.carousel_id || ''); | ||
}; | ||
Instagram.prototype.getItemRequestPath = function getItemRequestPath(item) { | ||
var suffix = isNaN(item.carousel_id) ? '' : '?carousel_id=' + item.carousel_id; | ||
return '' + item.id + suffix; | ||
}; | ||
Instagram.prototype.getItemModifiedDate = function getItemModifiedDate(item) { | ||
return item.created_time; | ||
}; | ||
Instagram.prototype.getItemThumbnailUrl = function getItemThumbnailUrl(item) { | ||
return item.images.thumbnail.url; | ||
}; | ||
Instagram.prototype.getNextPagePath = function getNextPagePath() { | ||
var _getPluginState = this.getPluginState(), | ||
files = _getPluginState.files; | ||
return 'recent?max_id=' + this.getItemId(files[files.length - 1]); | ||
}; | ||
Instagram.prototype.render = function render(state) { | ||
@@ -174,0 +89,0 @@ return this.view.render(state); |
{ | ||
"name": "@uppy/instagram", | ||
"description": "Import photos and videos from Instagram, into Uppy.", | ||
"version": "0.27.5", | ||
"version": "0.28.0", | ||
"license": "MIT", | ||
@@ -28,13 +28,13 @@ "main": "lib/index.js", | ||
"@uppy/companion-client": "0.27.2", | ||
"@uppy/provider-views": "0.27.4", | ||
"@uppy/utils": "0.27.1", | ||
"@uppy/provider-views": "0.28.0", | ||
"@uppy/utils": "0.28.0", | ||
"preact": "^8.2.9" | ||
}, | ||
"devDependencies": { | ||
"@uppy/core": "0.27.3" | ||
"@uppy/core": "0.28.0" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^0.27.0" | ||
"@uppy/core": "^0.28.0" | ||
}, | ||
"gitHead": "113d6f09bbe248ca156af87054244cd9e6ee9d8b" | ||
"gitHead": "47a68a6148a41c7b8a1e10e78b6cd6794a53f7e5" | ||
} |
@@ -67,81 +67,2 @@ const { Plugin } = require('@uppy/core') | ||
getUsername (data) { | ||
return data.data[0].user.username | ||
} | ||
isFolder (item) { | ||
return false | ||
} | ||
getItemData (item) { | ||
return item | ||
} | ||
getItemIcon (item) { | ||
if (!item.images) { | ||
return 'video' | ||
} | ||
return item.images.low_resolution.url | ||
} | ||
getItemSubList (item) { | ||
const subItems = [] | ||
item.data.forEach((subItem) => { | ||
if (subItem.carousel_media) { | ||
subItem.carousel_media.forEach((i, index) => { | ||
const { id, created_time } = subItem | ||
const newSubItem = Object.assign({}, i, { id, created_time }) | ||
newSubItem.carousel_id = index | ||
subItems.push(newSubItem) | ||
}) | ||
} else { | ||
subItems.push(subItem) | ||
} | ||
}) | ||
return subItems | ||
} | ||
getItemName (item) { | ||
if (item && item['created_time']) { | ||
const ext = item.type === 'video' ? 'mp4' : 'jpeg' | ||
let date = new Date(item['created_time'] * 1000) | ||
date = date.toLocaleDateString([], { | ||
year: 'numeric', | ||
month: 'short', | ||
day: 'numeric', | ||
hour: 'numeric', | ||
minute: 'numeric' | ||
}) | ||
// adding both date and carousel_id, so the name is unique | ||
return `Instagram ${date}${item.carousel_id ? ' ' + item.carousel_id : ''}.${ext}` | ||
} | ||
return '' | ||
} | ||
getMimeType (item) { | ||
return item.type === 'video' ? 'video/mp4' : 'image/jpeg' | ||
} | ||
getItemId (item) { | ||
return `${item.id}${item.carousel_id || ''}` | ||
} | ||
getItemRequestPath (item) { | ||
const suffix = isNaN(item.carousel_id) ? '' : `?carousel_id=${item.carousel_id}` | ||
return `${item.id}${suffix}` | ||
} | ||
getItemModifiedDate (item) { | ||
return item.created_time | ||
} | ||
getItemThumbnailUrl (item) { | ||
return item.images.thumbnail.url | ||
} | ||
getNextPagePath () { | ||
const { files } = this.getPluginState() | ||
return `recent?max_id=${this.getItemId(files[files.length - 1])}` | ||
} | ||
render (state) { | ||
@@ -148,0 +69,0 @@ return this.view.render(state) |
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
12662
162
+ Added@uppy/core@0.28.0(transitive)
+ Added@uppy/provider-views@0.28.0(transitive)
+ Added@uppy/utils@0.28.0(transitive)
- Removed@uppy/core@0.27.3(transitive)
- Removed@uppy/provider-views@0.27.4(transitive)
- Removed@uppy/utils@0.27.1(transitive)
Updated@uppy/provider-views@0.28.0
Updated@uppy/utils@0.28.0