@scaleflex/widget-unsplash 4.0.7 → 4.3.0

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 CHANGED
@@ -1,22 +1,22 @@
1
-
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2020 Transloadit
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2020 Transloadit
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,31 @@
1
- <!-- Variables -->
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://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
13
- </div>
14
-
15
- The Unsplash plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) lets users import files from Unsplash, the free stock photography resource.
16
-
17
-
18
-
19
- [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-unsplash
20
- [license-url]: https://opensource.org/licenses/MIT
21
- [sfx-url]: https://www.scaleflex.com/
22
- [version-url]: https://www.npmjs.com/package/@scaleflex/widget-@scaleflex/widget-unsplash
23
- [codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
24
-
25
- [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
26
- [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
27
- [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
28
- [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
29
- [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
30
- [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-unsplash?label=Version&style=for-the-badge&logo=npm
31
- [codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
1
+ <!-- Variables -->
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://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
13
+ </div>
14
+
15
+ The Unsplash plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) lets users import files from Unsplash, the free stock photography resource.
16
+
17
+
18
+
19
+ [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-unsplash
20
+ [license-url]: https://opensource.org/licenses/MIT
21
+ [sfx-url]: https://www.scaleflex.com/
22
+ [version-url]: https://www.npmjs.com/package/@scaleflex/widget-@scaleflex/widget-unsplash
23
+ [codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
24
+
25
+ [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
26
+ [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
27
+ [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
28
+ [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
29
+ [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
30
+ [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-unsplash?label=Version&style=for-the-badge&logo=npm
31
+ [codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scaleflex/widget-unsplash",
3
3
  "description": "Import files from Unsplash, the free stock photography resource",
4
- "version": "4.0.7",
4
+ "version": "4.3.0",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "types": "types/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@scaleflex/icons": "^3.0.0-beta.11",
20
20
  "@scaleflex/ui": "^3.0.0-beta.11",
21
- "@scaleflex/widget-common": "^4.0.7"
21
+ "@scaleflex/widget-common": "^4.3.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "react": "^19.0.0",
@@ -30,5 +30,5 @@
30
30
  "react": ">=19.0.0",
31
31
  "react-dom": ">=19.0.0"
32
32
  },
33
- "gitHead": "a940492ab76142f7041379f9a8a1d0bc8367214f"
33
+ "gitHead": "712930995f6dfd4a0d874c0638dde61065fd0683"
34
34
  }
@@ -1,33 +1,33 @@
1
- import { createSlice } from '@reduxjs/toolkit'
2
- import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants'
3
-
4
- // If the plugin instantiates a Provider, then we must have a common slice for it, as it will get updated through the provider.
5
- const initialState = {
6
- authenticated: false,
7
- files: [],
8
- folders: [],
9
- openedFolders: [],
10
- selectedFolders: {},
11
- activeRow: -1,
12
- filterInput: '',
13
- isSearchVisible: false
14
- }
15
-
16
- const commonSlice = createSlice({
17
- name: PLUGINS_IDS.UNSPLASH,
18
- initialState,
19
- reducers: {
20
- unsplashCommonStateUpdated (state, action) {
21
- return {
22
- ...state,
23
- ...action.payload
24
- }
25
- }
26
- }
27
- })
28
-
29
- export const { unsplashCommonStateUpdated } = commonSlice.actions
30
-
31
- export const selectUnsplashCommonState = state => state[PLUGINS_IDS.UNSPLASH]
32
-
33
- export default commonSlice.reducer
1
+ import { createSlice } from '@reduxjs/toolkit'
2
+ import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants'
3
+
4
+ // If the plugin instantiates a Provider, then we must have a common slice for it, as it will get updated through the provider.
5
+ const initialState = {
6
+ authenticated: false,
7
+ files: [],
8
+ folders: [],
9
+ openedFolders: [],
10
+ selectedFolders: {},
11
+ activeRow: -1,
12
+ filterInput: '',
13
+ isSearchVisible: false
14
+ }
15
+
16
+ const commonSlice = createSlice({
17
+ name: PLUGINS_IDS.UNSPLASH,
18
+ initialState,
19
+ reducers: {
20
+ unsplashCommonStateUpdated (state, action) {
21
+ return {
22
+ ...state,
23
+ ...action.payload
24
+ }
25
+ }
26
+ }
27
+ })
28
+
29
+ export const { unsplashCommonStateUpdated } = commonSlice.actions
30
+
31
+ export const selectUnsplashCommonState = state => state[PLUGINS_IDS.UNSPLASH]
32
+
33
+ export default commonSlice.reducer
@@ -1,10 +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
- }
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/src/index.js CHANGED
@@ -1,90 +1,90 @@
1
- import { Plugin } from '@scaleflex/widget-core'
2
- import { SearchProvider, Provider, RequestClient } from '@scaleflex/widget-companion-client'
3
- import SearchProviderView from '@scaleflex/widget-provider-views/lib/components/SearchProviderView'
4
- import { UnsplashIcon } from '@scaleflex/widget-icons'
5
- import Translator from '@scaleflex/widget-utils/lib/Translator'
6
- import Explorer from '@scaleflex/widget-explorer'
7
-
8
- import defaultLocale from './defaultLocale'
9
- import unsplashReducer, { unsplashCommonStateUpdated } from './common.slice'
10
-
11
- export default class Unsplash extends Plugin {
12
- // static VERSION = packageJson.version
13
-
14
- constructor (filerobot, opts) {
15
- super(filerobot, opts)
16
- this.id = 'Unsplash'
17
- Provider.initPlugin(this, opts)
18
- this.title = this.opts.title || 'Unsplash'
19
- this.icon = UnsplashIcon
20
-
21
- this.defaultLocale = {
22
- strings: defaultLocale
23
- }
24
-
25
- const defaultOptions = {}
26
-
27
- this.opts = { ...defaultOptions, ...opts }
28
- this.i18nInit()
29
-
30
- this.onFirstRender = this.onFirstRender.bind(this)
31
- this.render = this.render.bind(this)
32
-
33
- this.client = new RequestClient(filerobot, {
34
- companionHeaders: this.opts.companionHeaders
35
- })
36
-
37
- this.provider = new SearchProvider(filerobot, {
38
- companionUrl: this.opts.companionUrl,
39
- companionHeaders: this.opts.companionHeaders,
40
- companionCookiesRule: this.opts.companionCookiesRule,
41
- provider: 'unsplash',
42
- pluginId: this.id
43
- })
44
-
45
- this.hostname = this.client.companionUrl
46
-
47
- if (!this.hostname) {
48
- throw new Error('Companion hostname is required')
49
- }
50
- }
51
-
52
- i18nInit () {
53
- this.translator = new Translator([this.defaultLocale, this.filerobot.locale])
54
- this.i18n = this.translator.translate.bind(this.translator)
55
- this.i18nArray = this.translator.translateArray.bind(this.translator)
56
- }
57
-
58
- // eslint-disable-next-line class-methods-use-this
59
- onFirstRender () {
60
- // do nothing
61
- }
62
-
63
- render (state) {
64
- return this.view.render({ state })
65
- }
66
-
67
- setPluginCommonState (update) {
68
- return this.dispatch(unsplashCommonStateUpdated(update))
69
- }
70
-
71
- getPluginReducer () {
72
- return unsplashReducer
73
- }
74
-
75
- install () {
76
- if (Explorer) {
77
- this.view = new SearchProviderView(this, {
78
- provider: this.provider,
79
- layoutType: 'unsplash',
80
- showFilter: false,
81
- i18n: this.i18n
82
- })
83
- this.mount(Explorer, this)
84
- }
85
- }
86
-
87
- uninstall () {
88
- this.unmount()
89
- }
90
- }
1
+ import { Plugin } from '@scaleflex/widget-core'
2
+ import { SearchProvider, Provider, RequestClient } from '@scaleflex/widget-companion-client'
3
+ import SearchProviderView from '@scaleflex/widget-provider-views/lib/components/SearchProviderView'
4
+ import { UnsplashIcon } from '@scaleflex/widget-icons'
5
+ import Translator from '@scaleflex/widget-utils/lib/Translator'
6
+ import Explorer from '@scaleflex/widget-explorer'
7
+
8
+ import defaultLocale from './defaultLocale'
9
+ import unsplashReducer, { unsplashCommonStateUpdated } from './common.slice'
10
+
11
+ export default class Unsplash extends Plugin {
12
+ // static VERSION = packageJson.version
13
+
14
+ constructor (filerobot, opts) {
15
+ super(filerobot, opts)
16
+ this.id = 'Unsplash'
17
+ Provider.initPlugin(this, opts)
18
+ this.title = this.opts.title || 'Unsplash'
19
+ this.icon = UnsplashIcon
20
+
21
+ this.defaultLocale = {
22
+ strings: defaultLocale
23
+ }
24
+
25
+ const defaultOptions = {}
26
+
27
+ this.opts = { ...defaultOptions, ...opts }
28
+ this.i18nInit()
29
+
30
+ this.onFirstRender = this.onFirstRender.bind(this)
31
+ this.render = this.render.bind(this)
32
+
33
+ this.client = new RequestClient(filerobot, {
34
+ companionHeaders: this.opts.companionHeaders
35
+ })
36
+
37
+ this.provider = new SearchProvider(filerobot, {
38
+ companionUrl: this.opts.companionUrl,
39
+ companionHeaders: this.opts.companionHeaders,
40
+ companionCookiesRule: this.opts.companionCookiesRule,
41
+ provider: 'unsplash',
42
+ pluginId: this.id
43
+ })
44
+
45
+ this.hostname = this.client.companionUrl
46
+
47
+ if (!this.hostname) {
48
+ throw new Error('Companion hostname is required')
49
+ }
50
+ }
51
+
52
+ i18nInit () {
53
+ this.translator = new Translator([this.defaultLocale, this.filerobot.locale])
54
+ this.i18n = this.translator.translate.bind(this.translator)
55
+ this.i18nArray = this.translator.translateArray.bind(this.translator)
56
+ }
57
+
58
+ // eslint-disable-next-line class-methods-use-this
59
+ onFirstRender () {
60
+ // do nothing
61
+ }
62
+
63
+ render (state) {
64
+ return this.view.render({ state })
65
+ }
66
+
67
+ setPluginCommonState (update) {
68
+ return this.dispatch(unsplashCommonStateUpdated(update))
69
+ }
70
+
71
+ getPluginReducer () {
72
+ return unsplashReducer
73
+ }
74
+
75
+ install () {
76
+ if (Explorer) {
77
+ this.view = new SearchProviderView(this, {
78
+ provider: this.provider,
79
+ layoutType: 'unsplash',
80
+ showFilter: false,
81
+ i18n: this.i18n
82
+ })
83
+ this.mount(Explorer, this)
84
+ }
85
+ }
86
+
87
+ uninstall () {
88
+ this.unmount()
89
+ }
90
+ }
package/types/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import Filerobot = require("@scaleflex/widget-core");
2
- import CompanionClient = require("@scaleflex/widget-companion-client");
3
-
4
- declare module Unsplash {
5
- interface UnsplashOptions
6
- extends Filerobot.PluginOptions,
7
- CompanionClient.PublicProviderOptions {
8
- target?: Filerobot.PluginTarget;
9
- title?: string;
10
- }
11
- }
12
-
13
- declare class Unsplash extends Filerobot.Plugin<Unsplash.UnsplashOptions> {}
14
-
15
- export default Unsplash;
1
+ import Filerobot = require("@scaleflex/widget-core");
2
+ import CompanionClient = require("@scaleflex/widget-companion-client");
3
+
4
+ declare module Unsplash {
5
+ interface UnsplashOptions
6
+ extends Filerobot.PluginOptions,
7
+ CompanionClient.PublicProviderOptions {
8
+ target?: Filerobot.PluginTarget;
9
+ title?: string;
10
+ }
11
+ }
12
+
13
+ declare class Unsplash extends Filerobot.Plugin<Unsplash.UnsplashOptions> {}
14
+
15
+ export default Unsplash;