@scaleflex/widget-instagram 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 scaleflex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @scaleflex/widget-instagram
2
+
3
+ [![Plugins][plugins-image]](#plugins)
4
+ [![Website][filerobot-image]][sfx-url]
5
+ [![Version][filerobot-version]][version-url]
6
+ [![Scaleflex team][made-by-image]][sfx-url]
7
+ [![License][license-image]][license-url]
8
+ [![CodeSandbox][codeSandbox-image]][codeSandbox-url]
9
+
10
+
11
+ <div align='center'>
12
+ <img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://cdn.scaleflex.com/plugins/filerobot-widget/assets/filerobot_widget_logo_with_fire.png?vh=b2ff09" width="140"/>
13
+ </div>
14
+
15
+ The Instagram [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) lets users import photos from their Instagram account.
16
+
17
+ ## Usage
18
+
19
+ ### NPM
20
+
21
+ ```bash
22
+ npm install --save @scaleflex/widget-instagram
23
+ ```
24
+ ### YARN
25
+
26
+ ```bash
27
+ yarn add @scaleflex/widget-instagram
28
+ ```
29
+
30
+ then
31
+
32
+ ```js
33
+ import Instagram from '@scaleflex/widget-instagram'
34
+ ...
35
+ ...
36
+ ...
37
+ scaleflexWidget.use(Instagram, propertiesObject)
38
+ ```
39
+
40
+ ### CDN
41
+
42
+ The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Instagram`
43
+
44
+ ```js
45
+ const Instagram = window.ScaleflexWidget.Instagram
46
+ ...
47
+ ...
48
+ ...
49
+ scaleflexWidget.use(Instagram, propertiesObject)
50
+ ```
51
+
52
+ ## Properties
53
+
54
+ ### `title`
55
+
56
+ <u>Type:</u> `string`
57
+
58
+ <u>Default:</u> `'Instagram'`
59
+
60
+ The title/label that would be shown & used for the plugin.
61
+
62
+ ### `companionHeaders`
63
+
64
+ <u>Type:</u> `null` | `object`
65
+
66
+ <u>Default:</u> `null`
67
+
68
+ If you need to pass additional headers for in companion requests then pass them in this property.
69
+
70
+ <!-- Variables -->
71
+
72
+ [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-instagram
73
+ [license-url]: https://opensource.org/licenses/MIT
74
+ [sfx-url]: https://www.scaleflex.com/
75
+ [version-url]: https://www.npmjs.com/package/@scaleflex/widget-instagram
76
+ [codeSandbox-url]: https://codesandbox.io/s/filerobot-widget-v3-c5l9th
77
+
78
+ [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
79
+ [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
80
+ [made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
81
+ [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
82
+ [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
83
+ [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-instagram?label=Version&style=for-the-badge&logo=npm
@@ -0,0 +1,35 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { createSlice } from '@reduxjs/toolkit';
8
+ import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
9
+
10
+ // If the plugin instantiates a Provider, then we must have a common slice for it, as it will get updated through the provider.
11
+ var initialState = {
12
+ authenticated: false,
13
+ files: [],
14
+ folders: [],
15
+ openedFolders: [],
16
+ selectedFolders: {},
17
+ activeRow: -1,
18
+ filterInput: '',
19
+ isSearchVisible: false
20
+ };
21
+ var commonSlice = createSlice({
22
+ name: PLUGINS_IDS.INSTAGRAM,
23
+ initialState: initialState,
24
+ reducers: {
25
+ instagramCommonStateUpdated: function instagramCommonStateUpdated(state, action) {
26
+ return _objectSpread(_objectSpread({}, state), action.payload);
27
+ }
28
+ }
29
+ });
30
+ var instagramCommonStateUpdated = commonSlice.actions.instagramCommonStateUpdated;
31
+ export { instagramCommonStateUpdated };
32
+ export var selectInstagramCommonState = function selectInstagramCommonState(state) {
33
+ return state[PLUGINS_IDS.INSTAGRAM];
34
+ };
35
+ export default commonSlice.reducer;
package/lib/index.js ADDED
@@ -0,0 +1,94 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
8
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
9
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
10
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
12
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
13
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
14
+ import { Plugin } from '@scaleflex/widget-core';
15
+ import Explorer from '@scaleflex/widget-explorer';
16
+ import { Provider } from '@scaleflex/widget-companion-client';
17
+ import ProviderViews from '@scaleflex/widget-provider-views';
18
+ import { InstagramIcon } from '@scaleflex/widget-icons';
19
+ import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
20
+ import instagramReducer, { instagramCommonStateUpdated } from './common.slice';
21
+ // TODO: find a way to show version of the current plugin
22
+ // why solution below isn't good?
23
+ // first import doesn't work with webpack 5 as it was deprecated
24
+ // second import fixes webpack 5 issue as it was mentioned in their docs
25
+ // but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
26
+ // https://github.com/axelpale/genversion
27
+ // https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
28
+ // https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
29
+ // import { version } from '../package.json'
30
+ // import packageInfo from '../package.json'
31
+ var Instagram = /*#__PURE__*/function (_Plugin) {
32
+ // static VERSION = packageInfo.version
33
+
34
+ function Instagram(filerobot) {
35
+ var _this;
36
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
37
+ _classCallCheck(this, Instagram);
38
+ _this = _callSuper(this, Instagram, [filerobot, opts]);
39
+ _this.id = PLUGINS_IDS.INSTAGRAM;
40
+ Provider.initPlugin(_this, opts);
41
+ _this.title = _this.opts.title || 'Instagram';
42
+ _this.icon = InstagramIcon;
43
+ _this.provider = new Provider(filerobot, {
44
+ companionHeaders: _this.opts.companionHeaders,
45
+ provider: 'instagram',
46
+ pluginId: _this.id
47
+ });
48
+ _this.onFirstRender = _this.onFirstRender.bind(_this);
49
+ _this.render = _this.render.bind(_this);
50
+ return _this;
51
+ }
52
+ _inherits(Instagram, _Plugin);
53
+ return _createClass(Instagram, [{
54
+ key: "install",
55
+ value: function install() {
56
+ this.view = new ProviderViews(this, {
57
+ provider: this.provider,
58
+ layoutType: 'grid',
59
+ showTitles: false,
60
+ showFilter: false,
61
+ showBreadcrumbs: false
62
+ });
63
+ if (Explorer) {
64
+ this.mount(Explorer, this);
65
+ }
66
+ }
67
+ }, {
68
+ key: "uninstall",
69
+ value: function uninstall() {
70
+ this.unmount();
71
+ }
72
+ }, {
73
+ key: "setPluginCommonState",
74
+ value: function setPluginCommonState(update) {
75
+ return this.dispatch(instagramCommonStateUpdated(update));
76
+ }
77
+ }, {
78
+ key: "getPluginReducer",
79
+ value: function getPluginReducer() {
80
+ return instagramReducer;
81
+ }
82
+ }, {
83
+ key: "onFirstRender",
84
+ value: function onFirstRender() {
85
+ this.view.getFolder('recent');
86
+ }
87
+ }, {
88
+ key: "render",
89
+ value: function render(state) {
90
+ return this.view.render(state);
91
+ }
92
+ }]);
93
+ }(Plugin);
94
+ export { Instagram as default };
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@scaleflex/widget-instagram",
3
+ "description": "Import photos and videos from Instagram, into Scaleflex.",
4
+ "version": "0.0.1",
5
+ "license": "MIT",
6
+ "main": "lib/index.js",
7
+ "types": "types/index.d.ts",
8
+ "dependencies": {
9
+ "@scaleflex/widget-companion-client": "^0.0.1",
10
+ "@scaleflex/widget-icons": "^0.0.1",
11
+ "@scaleflex/widget-provider-views": "^0.0.1",
12
+ "@scaleflex/widget-utils": "^0.0.1"
13
+ },
14
+ "devDependencies": {
15
+ "react": "^19.0.0",
16
+ "react-dom": "^19.0.0"
17
+ },
18
+ "peerDependencies": {
19
+ "@reduxjs/toolkit": "^1.9.5",
20
+ "@scaleflex/widget-core": "^0.0.0",
21
+ "@scaleflex/widget-explorer": "^0.0.0",
22
+ "react": ">=19.0.0",
23
+ "react-dom": ">=19.0.0",
24
+ "react-redux": "^8.1.1"
25
+ },
26
+ "files": [
27
+ "/dist",
28
+ "/lib",
29
+ "/types"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "gitHead": "64ea82e745b7deda36d6794863350e6671e9010d"
35
+ }
@@ -0,0 +1,16 @@
1
+ import Filerobot = require("@scaleflex/widget-core");
2
+ import CompanionClient = require("@scaleflex/widget-companion-client");
3
+
4
+ declare module Instagram {
5
+ interface InstagramOptions
6
+ extends Filerobot.PluginOptions,
7
+ CompanionClient.PublicProviderOptions {
8
+ replaceTargetContent?: boolean;
9
+ target?: Filerobot.PluginTarget;
10
+ storage?: CompanionClient.TokenStorage;
11
+ }
12
+ }
13
+
14
+ declare class Instagram extends Filerobot.Plugin<Instagram.InstagramOptions> {}
15
+
16
+ export = Instagram;