@uppy/facebook
Advanced tools
Comparing version 1.2.2 to 2.0.0-alpha.0
137
lib/index.js
@@ -0,75 +1,75 @@ | ||
"use strict"; | ||
var _class, _temp; | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
const { | ||
UIPlugin | ||
} = require('@uppy/core'); | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | ||
const { | ||
Provider | ||
} = require('@uppy/companion-client'); | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
const { | ||
ProviderViews | ||
} = require('@uppy/provider-views'); | ||
var _require = require('@uppy/core'), | ||
Plugin = _require.Plugin; | ||
const { | ||
h | ||
} = require('preact'); | ||
var _require2 = require('@uppy/companion-client'), | ||
Provider = _require2.Provider; | ||
module.exports = (_temp = _class = class Facebook extends UIPlugin { | ||
constructor(uppy, opts) { | ||
super(uppy, opts); | ||
this.id = this.opts.id || 'Facebook'; | ||
Provider.initPlugin(this, opts); | ||
this.title = this.opts.title || 'Facebook'; | ||
var _require3 = require('@uppy/provider-views'), | ||
ProviderViews = _require3.ProviderViews; | ||
this.icon = () => h("svg", { | ||
"aria-hidden": "true", | ||
focusable: "false", | ||
width: "32", | ||
height: "32", | ||
viewBox: "0 0 32 32" | ||
}, h("g", { | ||
fill: "none", | ||
fillRule: "evenodd" | ||
}, h("rect", { | ||
className: "uppy-ProviderIconBg", | ||
width: "32", | ||
height: "32", | ||
rx: "16", | ||
fill: "#3C5A99" | ||
}), h("path", { | ||
d: "M17.842 26v-8.667h2.653l.398-3.377h-3.051v-2.157c0-.978.248-1.644 1.527-1.644H21V7.132A19.914 19.914 0 0 0 18.623 7c-2.352 0-3.963 1.574-3.963 4.465v2.49H12v3.378h2.66V26h3.182z", | ||
fill: "#FFF", | ||
fillRule: "nonzero" | ||
}))); | ||
var _require4 = require('preact'), | ||
h = _require4.h; | ||
module.exports = (_temp = _class = /*#__PURE__*/function (_Plugin) { | ||
_inheritsLoose(Facebook, _Plugin); | ||
function Facebook(uppy, opts) { | ||
var _this; | ||
_this = _Plugin.call(this, uppy, opts) || this; | ||
_this.id = _this.opts.id || 'Facebook'; | ||
Provider.initPlugin(_assertThisInitialized(_this), opts); | ||
_this.title = _this.opts.title || 'Facebook'; | ||
_this.icon = function () { | ||
return h("svg", { | ||
"aria-hidden": "true", | ||
focusable: "false", | ||
width: "32", | ||
height: "32", | ||
viewBox: "0 0 32 32" | ||
}, h("g", { | ||
fill: "none", | ||
fillRule: "evenodd" | ||
}, h("rect", { | ||
className: "uppy-ProviderIconBg", | ||
width: "32", | ||
height: "32", | ||
rx: "16", | ||
fill: "#3C5A99" | ||
}), h("path", { | ||
d: "M17.842 26v-8.667h2.653l.398-3.377h-3.051v-2.157c0-.978.248-1.644 1.527-1.644H21V7.132A19.914 19.914 0 0 0 18.623 7c-2.352 0-3.963 1.574-3.963 4.465v2.49H12v3.378h2.66V26h3.182z", | ||
fill: "#FFF", | ||
fillRule: "nonzero" | ||
}))); | ||
}; | ||
_this.provider = new Provider(uppy, { | ||
companionUrl: _this.opts.companionUrl, | ||
companionHeaders: _this.opts.companionHeaders || _this.opts.serverHeaders, | ||
companionKeysParams: _this.opts.companionKeysParams, | ||
companionCookiesRule: _this.opts.companionCookiesRule, | ||
this.provider = new Provider(uppy, { | ||
companionUrl: this.opts.companionUrl, | ||
companionHeaders: this.opts.companionHeaders, | ||
companionKeysParams: this.opts.companionKeysParams, | ||
companionCookiesRule: this.opts.companionCookiesRule, | ||
provider: 'facebook', | ||
pluginId: _this.id | ||
pluginId: this.id | ||
}); | ||
_this.onFirstRender = _this.onFirstRender.bind(_assertThisInitialized(_this)); | ||
_this.render = _this.render.bind(_assertThisInitialized(_this)); | ||
return _this; | ||
this.defaultLocale = { | ||
strings: { | ||
pluginNameFacebook: 'Facebook' | ||
} | ||
}; | ||
this.i18nInit(); | ||
this.title = this.i18n('pluginNameFacebook'); | ||
this.onFirstRender = this.onFirstRender.bind(this); | ||
this.render = this.render.bind(this); | ||
} | ||
var _proto = Facebook.prototype; | ||
_proto.install = function install() { | ||
install() { | ||
this.view = new ProviderViews(this, { | ||
provider: this.provider | ||
}); | ||
var target = this.opts.target; | ||
const { | ||
target | ||
} = this.opts; | ||
@@ -79,15 +79,15 @@ if (target) { | ||
} | ||
}; | ||
} | ||
_proto.uninstall = function uninstall() { | ||
uninstall() { | ||
this.view.tearDown(); | ||
this.unmount(); | ||
}; | ||
} | ||
_proto.onFirstRender = function onFirstRender() { | ||
onFirstRender() { | ||
return Promise.all([this.provider.fetchPreAuthToken(), this.view.getFolder()]); | ||
}; | ||
} | ||
_proto.render = function render(state) { | ||
var viewOptions = {}; | ||
render(state) { | ||
const viewOptions = {}; | ||
@@ -101,5 +101,4 @@ if (this.getPluginState().files.length && !this.getPluginState().folders.length) { | ||
return this.view.render(state, viewOptions); | ||
}; | ||
} | ||
return Facebook; | ||
}(Plugin), _class.VERSION = "1.2.2", _temp); | ||
}, _class.VERSION = "2.0.0-alpha.0", _temp); |
{ | ||
"name": "@uppy/facebook", | ||
"description": "Import files from Facebook, into Uppy.", | ||
"version": "1.2.2", | ||
"version": "2.0.0-alpha.0", | ||
"license": "MIT", | ||
@@ -23,6 +23,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/companion-client": "^1.10.2", | ||
"@uppy/provider-views": "^1.12.3", | ||
"@uppy/utils": "^3.6.2", | ||
"preact": "8.2.9" | ||
"@uppy/companion-client": "^2.0.0-alpha.0", | ||
"@uppy/provider-views": "^2.0.0-alpha.0", | ||
"@uppy/utils": "^4.0.0-alpha.0", | ||
"preact": "^10.5.13" | ||
}, | ||
@@ -32,3 +32,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "4b782ffbbb443672843d7b4096956bed3b11d612" | ||
"gitHead": "113b627dd0ef5aa5d198dc309dda05da2117dfe5" | ||
} |
@@ -18,4 +18,4 @@ # @uppy/facebook | ||
```js | ||
const Uppy = require('@uppy/core') | ||
const Facebook = require('@uppy/facebook') | ||
import Uppy from '@uppy/core' | ||
import Facebook from '@uppy/facebook' | ||
@@ -22,0 +22,0 @@ const uppy = new Uppy() |
@@ -1,2 +0,2 @@ | ||
const { Plugin } = require('@uppy/core') | ||
const { UIPlugin } = require('@uppy/core') | ||
const { Provider } = require('@uppy/companion-client') | ||
@@ -6,3 +6,3 @@ const { ProviderViews } = require('@uppy/provider-views') | ||
module.exports = class Facebook extends Plugin { | ||
module.exports = class Facebook extends UIPlugin { | ||
static VERSION = require('../package.json').version | ||
@@ -26,3 +26,3 @@ | ||
companionUrl: this.opts.companionUrl, | ||
companionHeaders: this.opts.companionHeaders || this.opts.serverHeaders, | ||
companionHeaders: this.opts.companionHeaders, | ||
companionKeysParams: this.opts.companionKeysParams, | ||
@@ -34,2 +34,10 @@ companionCookiesRule: this.opts.companionCookiesRule, | ||
this.defaultLocale = { | ||
strings: { | ||
pluginNameFacebook: 'Facebook', | ||
}, | ||
} | ||
this.i18nInit() | ||
this.title = this.i18n('pluginNameFacebook') | ||
this.onFirstRender = this.onFirstRender.bind(this) | ||
@@ -44,3 +52,3 @@ this.render = this.render.bind(this) | ||
const target = this.opts.target | ||
const { target } = this.opts | ||
if (target) { | ||
@@ -47,0 +55,0 @@ this.mount(target, this) |
@@ -1,17 +0,13 @@ | ||
import Uppy = require('@uppy/core') | ||
import CompanionClient = require('@uppy/companion-client') | ||
import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' | ||
import type { PublicProviderOptions, TokenStorage } from '@uppy/companion-client' | ||
declare module Facebook { | ||
interface FacebookOptions | ||
extends Uppy.PluginOptions, | ||
CompanionClient.PublicProviderOptions { | ||
export interface FacebookOptions extends PluginOptions, PublicProviderOptions { | ||
replaceTargetContent?: boolean | ||
target?: Uppy.PluginTarget | ||
target?: PluginTarget | ||
title?: string | ||
storage?: CompanionClient.TokenStorage | ||
} | ||
storage?: TokenStorage | ||
} | ||
declare class Facebook extends Uppy.Plugin<Facebook.FacebookOptions> {} | ||
declare class Facebook extends UIPlugin<FacebookOptions> {} | ||
export = Facebook | ||
export default Facebook |
@@ -1,2 +0,13 @@ | ||
import Facebook = require('../') | ||
// TODO implement | ||
import Uppy from '@uppy/core' | ||
import Facebook from '..' | ||
{ | ||
const uppy = new Uppy() | ||
uppy.use(Facebook, { | ||
companionUrl: '', | ||
companionCookiesRule: 'same-origin', | ||
replaceTargetContent: false, | ||
target: 'body', | ||
title: 'title', | ||
}) | ||
} |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
9
178
14722
1
+ Added@uppy/companion-client@2.2.2(transitive)
+ Added@uppy/core@2.3.4(transitive)
+ Added@uppy/provider-views@2.1.3(transitive)
+ Added@uppy/store-default@2.1.1(transitive)
+ Added@uppy/utils@4.1.3(transitive)
+ Addednanoid@3.3.7(transitive)
+ Addedpreact@10.24.3(transitive)
- Removed@uppy/companion-client@1.10.2(transitive)
- Removed@uppy/provider-views@1.12.3(transitive)
- Removedqs-stringify@1.2.1(transitive)
- Removedquerystringify@2.2.0(transitive)
- Removedrequires-port@1.0.0(transitive)
- Removedurl-parse@1.5.10(transitive)
Updated@uppy/utils@^4.0.0-alpha.0
Updatedpreact@^10.5.13