@scaleflex/widget-unsplash 4.8.6 → 4.8.7

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.8.7](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.8.6...v4.8.7) (2026-03-03)
7
+
8
+ **Note:** Version bump only for package @scaleflex/widget-unsplash
9
+
10
+
11
+
12
+
13
+
6
14
  ## [4.8.6](https://code.scaleflex.cloud/scaleflex/widget/compare/v4.8.5...v4.8.6) (2026-02-25)
7
15
 
8
16
  **Note:** Version bump only for package @scaleflex/widget-unsplash
@@ -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.UNSPLASH,
23
+ initialState: initialState,
24
+ reducers: {
25
+ unsplashCommonStateUpdated: function unsplashCommonStateUpdated(state, action) {
26
+ return _objectSpread(_objectSpread({}, state), action.payload);
27
+ }
28
+ }
29
+ });
30
+ var unsplashCommonStateUpdated = commonSlice.actions.unsplashCommonStateUpdated;
31
+ export { unsplashCommonStateUpdated };
32
+ export var selectUnsplashCommonState = function selectUnsplashCommonState(state) {
33
+ return state[PLUGINS_IDS.UNSPLASH];
34
+ };
35
+ export default commonSlice.reducer;
@@ -0,0 +1,10 @@
1
+ export default {
2
+ unsplashSelectButton: 'Select %{smart_count}',
3
+ unsplashAssetsLabel: 'Assets (%{smart_count})',
4
+ unsplashCancelButton: 'Cancel',
5
+ unsplashNoResultLabel: 'Unfortunately, there are no results for this search',
6
+ searchUnsplachTitle: 'Enter text to search for images',
7
+ searchUnsplachPlaceholder: 'search for images',
8
+ searchUnsplachLabel: 'Search',
9
+ searchUnsplachButton: 'Search for images'
10
+ };
package/lib/index.js ADDED
@@ -0,0 +1,112 @@
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
6
+ 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); } }
7
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ 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); }
10
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
+ 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); }
12
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
13
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
14
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
15
+ 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); }
16
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
17
+ import { Plugin } from '@scaleflex/widget-core';
18
+ import { SearchProvider, Provider, RequestClient } from '@scaleflex/widget-companion-client';
19
+ import SearchProviderView from '@scaleflex/widget-provider-views/lib/components/SearchProviderView';
20
+ import { UnsplashIcon } from '@scaleflex/widget-icons';
21
+ import Translator from '@scaleflex/widget-utils/lib/Translator';
22
+ import Explorer from '@scaleflex/widget-explorer';
23
+ import defaultLocale from './defaultLocale';
24
+ import unsplashReducer, { unsplashCommonStateUpdated } from './common.slice';
25
+ var Unsplash = /*#__PURE__*/function (_Plugin) {
26
+ // static VERSION = packageJson.version
27
+
28
+ function Unsplash(filerobot, opts) {
29
+ var _this;
30
+ _classCallCheck(this, Unsplash);
31
+ _this = _callSuper(this, Unsplash, [filerobot, opts]);
32
+ _this.id = 'Unsplash';
33
+ Provider.initPlugin(_this, opts);
34
+ _this.title = _this.opts.title || 'Unsplash';
35
+ _this.icon = UnsplashIcon;
36
+ _this.defaultLocale = {
37
+ strings: defaultLocale
38
+ };
39
+ var defaultOptions = {};
40
+ _this.opts = _objectSpread(_objectSpread({}, defaultOptions), opts);
41
+ _this.i18nInit();
42
+ _this.onFirstRender = _this.onFirstRender.bind(_this);
43
+ _this.render = _this.render.bind(_this);
44
+ _this.client = new RequestClient(filerobot, {
45
+ companionHeaders: _this.opts.companionHeaders
46
+ });
47
+ _this.provider = new SearchProvider(filerobot, {
48
+ companionUrl: _this.opts.companionUrl,
49
+ companionHeaders: _this.opts.companionHeaders,
50
+ companionCookiesRule: _this.opts.companionCookiesRule,
51
+ provider: 'unsplash',
52
+ pluginId: _this.id
53
+ });
54
+ _this.hostname = _this.client.companionUrl;
55
+ if (!_this.hostname) {
56
+ throw new Error('Companion hostname is required');
57
+ }
58
+ return _this;
59
+ }
60
+ _inherits(Unsplash, _Plugin);
61
+ return _createClass(Unsplash, [{
62
+ key: "i18nInit",
63
+ value: function i18nInit() {
64
+ this.translator = new Translator([this.defaultLocale, this.filerobot.locale]);
65
+ this.i18n = this.translator.translate.bind(this.translator);
66
+ this.i18nArray = this.translator.translateArray.bind(this.translator);
67
+ }
68
+
69
+ // eslint-disable-next-line class-methods-use-this
70
+ }, {
71
+ key: "onFirstRender",
72
+ value: function onFirstRender() {
73
+ // do nothing
74
+ }
75
+ }, {
76
+ key: "render",
77
+ value: function render(state) {
78
+ return this.view.render({
79
+ state: state
80
+ });
81
+ }
82
+ }, {
83
+ key: "setPluginCommonState",
84
+ value: function setPluginCommonState(update) {
85
+ return this.dispatch(unsplashCommonStateUpdated(update));
86
+ }
87
+ }, {
88
+ key: "getPluginReducer",
89
+ value: function getPluginReducer() {
90
+ return unsplashReducer;
91
+ }
92
+ }, {
93
+ key: "install",
94
+ value: function install() {
95
+ if (Explorer) {
96
+ this.view = new SearchProviderView(this, {
97
+ provider: this.provider,
98
+ layoutType: 'unsplash',
99
+ showFilter: false,
100
+ i18n: this.i18n
101
+ });
102
+ this.mount(Explorer, this);
103
+ }
104
+ }
105
+ }, {
106
+ key: "uninstall",
107
+ value: function uninstall() {
108
+ this.unmount();
109
+ }
110
+ }]);
111
+ }(Plugin);
112
+ export { Unsplash as default };
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
- {
2
- "name": "@scaleflex/widget-unsplash",
3
- "description": "Import files from Unsplash, the free stock photography resource",
4
- "version": "4.8.6",
5
- "license": "MIT",
6
- "main": "lib/index.js",
7
- "types": "types/index.d.ts",
8
- "type": "module",
9
- "keywords": [
10
- "file uploader",
11
- "uppy",
12
- "uppy-plugin",
13
- "unsplash"
14
- ],
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "dependencies": {
19
- "@scaleflex/icons": "^3.0.0-beta.11",
20
- "@scaleflex/ui": "^3.0.0-beta.11",
21
- "@scaleflex/widget-common": "^4.8.6"
22
- },
23
- "devDependencies": {
24
- "react": "^19.0.0",
25
- "react-dom": "^19.0.0"
26
- },
27
- "peerDependencies": {
28
- "@scaleflex/widget-core": "^0.0.3",
29
- "@scaleflex/widget-explorer": "^0.0.3",
30
- "react": ">=19.0.0",
31
- "react-dom": ">=19.0.0"
32
- },
33
- "gitHead": "cbb232cc92583c3888556df91ff90b4654e64790"
34
- }
1
+ {
2
+ "name": "@scaleflex/widget-unsplash",
3
+ "description": "Import files from Unsplash, the free stock photography resource",
4
+ "version": "4.8.7",
5
+ "license": "MIT",
6
+ "main": "lib/index.js",
7
+ "types": "types/index.d.ts",
8
+ "type": "module",
9
+ "keywords": [
10
+ "file uploader",
11
+ "uppy",
12
+ "uppy-plugin",
13
+ "unsplash"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "dependencies": {
19
+ "@scaleflex/icons": "^3.0.0-beta.11",
20
+ "@scaleflex/ui": "^3.0.0-beta.11",
21
+ "@scaleflex/widget-common": "^4.8.7"
22
+ },
23
+ "devDependencies": {
24
+ "react": "^19.0.0",
25
+ "react-dom": "^19.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "@scaleflex/widget-core": "^0.0.3",
29
+ "@scaleflex/widget-explorer": "^0.0.3",
30
+ "react": ">=19.0.0",
31
+ "react-dom": ">=19.0.0"
32
+ },
33
+ "gitHead": "712930995f6dfd4a0d874c0638dde61065fd0683"
34
+ }