@scaleflex/widget-progress-panel 4.8.4 → 4.8.6

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.
@@ -1,36 +0,0 @@
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 { Reload } from '@scaleflex/icons';
8
- import { useCore } from '@scaleflex/widget-core/lib/hooks';
9
- import Styled from '../ProgressPanel.styled';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- var RetryButton = function RetryButton(_ref) {
12
- var id = _ref.id,
13
- i18n = _ref.i18n;
14
- var _useCore = useCore(),
15
- emit = _useCore.emit;
16
- var handleRetry = function handleRetry() {
17
- emit('activity-retry', {
18
- id: id
19
- });
20
- };
21
- return /*#__PURE__*/_jsx(Styled.ActionButton, {
22
- size: "sm",
23
- color: "primary",
24
- onClick: function onClick() {
25
- return handleRetry();
26
- },
27
- "aria-label": i18n('progressPanelErrorActionTitle'),
28
- title: i18n('progressPanelErrorActionTitle'),
29
- children: function children(iconProps) {
30
- return /*#__PURE__*/_jsx(Reload, _objectSpread(_objectSpread({}, iconProps), {}, {
31
- size: 12
32
- }));
33
- }
34
- });
35
- };
36
- export default RetryButton;
@@ -1,26 +0,0 @@
1
- import { useTheme } from '@scaleflex/ui/theme/hooks';
2
- import { Info } from '@scaleflex/icons';
3
- import { PC } from '@scaleflex/widget-common';
4
- import Styled from '../ProgressPanel.styled';
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- var UploadDelayedNotification = function UploadDelayedNotification(_ref) {
7
- var _theme$palette, _theme$palette2;
8
- var i18n = _ref.i18n;
9
- var theme = useTheme();
10
- return /*#__PURE__*/_jsx(Styled.NotificationContainer, {
11
- children: /*#__PURE__*/_jsx(Styled.ProgressPanelActivityWrapper, {
12
- children: /*#__PURE__*/_jsxs(Styled.NotificationWrapper, {
13
- children: [/*#__PURE__*/_jsx(Info, {
14
- size: 22,
15
- color: theme === null || theme === void 0 ? void 0 : (_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette[PC.Info]
16
- }), /*#__PURE__*/_jsx(Styled.NotificationText, {
17
- children: i18n('uploadDelayedHint')
18
- }), /*#__PURE__*/_jsx(Styled.LoadingIcon, {
19
- size: 22,
20
- color: theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2[PC.AccentPrimary]
21
- })]
22
- })
23
- })
24
- });
25
- };
26
- export default UploadDelayedNotification;
@@ -1,40 +0,0 @@
1
- import { FILE_TYPES_AND_ICONS } from '@scaleflex/widget-utils/lib/constants';
2
- import getFileExtension from '@scaleflex/widget-utils/lib/getFileExtension';
3
- import { useTheme } from '@scaleflex/ui/theme/hooks';
4
- import mimeTypes from '@scaleflex/widget-utils/lib/mimeTypes';
5
- import Styled from '../../ProgressPanel.styled';
6
- import { ACTIVITY_ICONS, PROGRESS_PANEL_FILE_ICONS, PROGRESS_PANEL_FILE_ICON_BY_EXT } from '../../ProgressPanel.constants';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- var ProgressPanelFileIcon = function ProgressPanelFileIcon(_ref) {
9
- var _mimeTypes$extension;
10
- var file = _ref.file,
11
- activity = _ref.activity;
12
- var theme = useTheme();
13
- var _ref2 = activity || {},
14
- _ref2$icon = _ref2.icon,
15
- icon = _ref2$icon === void 0 ? {} : _ref2$icon;
16
- var ActivityIcon = ACTIVITY_ICONS[icon.name];
17
- var themePalette = theme === null || theme === void 0 ? void 0 : theme.palette;
18
- if (ActivityIcon) {
19
- return /*#__PURE__*/_jsx(ActivityIcon, {
20
- size: 22,
21
- color: themePalette[icon.color]
22
- });
23
- }
24
- var extension = getFileExtension(file || activity);
25
- var type = (_mimeTypes$extension = mimeTypes[extension]) === null || _mimeTypes$extension === void 0 ? void 0 : _mimeTypes$extension.split('/')[0];
26
- var fileIcon = PROGRESS_PANEL_FILE_ICONS[type] || PROGRESS_PANEL_FILE_ICON_BY_EXT[extension] || {};
27
- var Icon = fileIcon.icon;
28
- var iconColor = fileIcon.iconColor;
29
- if (Icon) {
30
- return /*#__PURE__*/_jsx(Icon, {
31
- size: 22,
32
- color: themePalette[iconColor]
33
- });
34
- }
35
- return /*#__PURE__*/_jsx(Styled.FileIcon, {
36
- alt: "icon",
37
- src: FILE_TYPES_AND_ICONS[extension] || FILE_TYPES_AND_ICONS._default
38
- });
39
- };
40
- export default ProgressPanelFileIcon;
@@ -1,50 +0,0 @@
1
- export default {
2
- progressPanelProcessingHeaderLabel: 'Processing',
3
- progressPanelProcessedHeaderLabel: 'Processed',
4
- progressPanelHeaderItemsText: {
5
- 0: 'item',
6
- 1: 'items'
7
- },
8
- progressPanelEtaLeftText: '%{time} left',
9
- progressPanelActivityCompleteLabel: 'Uploaded',
10
- progressPanelActivityErrorLabel: 'Uploading failed',
11
- progressPanelActivityProgressLabel: 'Uploading',
12
- progressPanelCompleteActionTitle: 'Show file location',
13
- progressPanelVideoActivityCompleteActionTitle: 'Show link',
14
- progressPanelErrorActionTitle: 'Retry',
15
- progressPanelProgressActionTitle: 'Cancel',
16
- progressPanelPauseActionTitle: 'Pause',
17
- progressPanelResumeActionTitle: 'Resume',
18
- progressPanelAssetProcessingTitle: 'Asset is being processed',
19
- uploadDelayedHint: 'It takes few seconds to complete processing, after you can use your uploaded assets.',
20
- progressPanelArchiveCompleteLabel: 'Completed archive',
21
- progressPanelArchiveFailedLabel: 'Failed archive',
22
- progressPanelPreparingArchiveLabel: 'Preparing archive',
23
- progressPanelRestoringArchiveActivityLabel: 'Restoring archiving',
24
- progressPanelDownloadingArchiveLabel: 'Downloading archive',
25
- progressPanelDownloadingActivityLabel: 'Downloading',
26
- progressPanelDownloadingActivityErrorLabel: 'Downloading failed',
27
- progressPanelDownloadingActivityCompleteLabel: 'Downloaded',
28
- progressPanelTranscodeActivityLabel: 'Transcoding',
29
- progressPanelRestoringTranscodeActivityLabel: 'Restoring transcoding',
30
- progressPanelTranscodedActivityLabel: 'Transcoded',
31
- progressPanelTranscodeErrorActivityLabel: 'Transcoding failed',
32
- progressPanelCompressActivityLabel: 'Compressing',
33
- progressPanelRestoringCompressActivityLabel: 'Restoring compression',
34
- progressPanelCompressedActivityLabel: 'Compressed',
35
- progressPanelCompressErrorActivityLabel: 'Compressing failed',
36
- progressPanelConvertActivityLabel: 'Converting',
37
- progressPanelRestoringConvertActivityLabel: 'Restoring conversion',
38
- progressPanelConvertedActivityLabel: 'Converted',
39
- progressPanelConvertErrorActivityLabel: 'Converting failed',
40
- progressPanelPreparingCsvActivityLabel: 'Preparing CSV',
41
- progressPanelProcessingCsvActivityLabel: 'Processing CSV',
42
- progressPanelProcessingCsvActivityErrorLabel: 'Processing CSV failed',
43
- progressPanelProcessedCsvActivityLabel: 'Processed CSV',
44
- progressPanelActivityFontProgressLabel: 'Installing font(s)',
45
- progressPanelActivityFontCompleteLabel: 'Font installed',
46
- progressPanelActivityFontErrorLabel: 'Font already installed',
47
- progressPanelPreparingVideoLabel: 'Processing',
48
- progressPanelVideoFailedLabel: 'Processing failed',
49
- progressPanelVideoCompletedLabel: 'Processed'
50
- };
package/lib/index.js DELETED
@@ -1,120 +0,0 @@
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
- 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); } }
6
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
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
- 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; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
- 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); }
17
- import { createElement } from 'react';
18
- import { Plugin } from '@scaleflex/widget-core';
19
- import Translator from '@scaleflex/widget-utils/lib/Translator';
20
- import { PLUGINS_IDS, EVENTS } from '@scaleflex/widget-utils/lib/constants';
21
- import progressPanelReducer, { addActivity as _addActivity, selectProgressPanelUploadingActivitiesIds } from './progressPanel.slice';
22
- import ProgressPanelUI from './components/ProgressPanel';
23
- import defaultLocale from './defaultLocale';
24
- import { getSavedActivities } from './utils/locallySavedActivities';
25
-
26
- // TODO: find a way to show version of the current plugin
27
- // why solution below isn't good?
28
- // first import doesn't work with webpack 5 as it was deprecated
29
- // second import fixes webpack 5 issue as it was mentioned in their docs
30
- // but it exposes our package.json to the client and it is mentioned as security rist in mutiple places
31
- // https://github.com/axelpale/genversion
32
- // https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version
33
- // https://stackoverflow.com/questions/9153571/is-there-a-way-to-get-version-from-package-json-in-nodejs-code/10855054#10855054
34
- // import { version } from '../package.json'
35
- // import packageInfo from '../package.json'
36
- var ProgressPanel = /*#__PURE__*/function (_Plugin) {
37
- // static VERSION = packageInfo.version
38
-
39
- function ProgressPanel(filerobot) {
40
- var _this;
41
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
42
- _classCallCheck(this, ProgressPanel);
43
- _this = _callSuper(this, ProgressPanel, [filerobot, opts]);
44
- _defineProperty(_this, "addTarget", function () {
45
- return _this.el;
46
- });
47
- _defineProperty(_this, "render", function (props) {
48
- return /*#__PURE__*/createElement(ProgressPanelUI, _objectSpread(_objectSpread({}, props), {}, {
49
- i18n: _this.i18n
50
- }));
51
- });
52
- _defineProperty(_this, "loadSavedActivities", function (cbk) {
53
- var token = _this.filerobot.opts.container;
54
- var savedActivities = getSavedActivities(token);
55
- if (Array.isArray(savedActivities) && savedActivities.length > 0 && typeof cbk === 'function') {
56
- cbk(savedActivities);
57
- }
58
- });
59
- _defineProperty(_this, "initEvents", function () {
60
- _this.filerobot.on(EVENTS.PROGRESS_PANEL_LOAD_SAVED_ACTIVITIES, _this.loadSavedActivities);
61
- });
62
- _defineProperty(_this, "removeEvents", function () {
63
- _this.filerobot.off(EVENTS.PROGRESS_PANEL_LOAD_SAVED_ACTIVITIES, _this.loadSavedActivities);
64
- });
65
- _this.id = opts.id || PLUGINS_IDS.PROGRESS_PANEL;
66
- _this.title = 'ProgressPanel';
67
- _this.type = 'progressindicator';
68
- _this.defaultLocale = {
69
- strings: defaultLocale
70
- };
71
- _this.i18nInit();
72
- _this.opts = _objectSpread({}, opts);
73
- _this.addActivity = _this.addActivity.bind(_this);
74
- _this.getUploadingActivitiesIds = _this.getUploadingActivitiesIds.bind(_this);
75
- return _this;
76
- }
77
- _inherits(ProgressPanel, _Plugin);
78
- return _createClass(ProgressPanel, [{
79
- key: "i18nInit",
80
- value: function i18nInit() {
81
- this.translator = new Translator([this.defaultLocale, this.filerobot.locale, this.opts.locale]);
82
- this.i18n = this.translator.translate.bind(this.translator);
83
- }
84
- }, {
85
- key: "getPluginReducer",
86
- value: function getPluginReducer() {
87
- return progressPanelReducer;
88
- }
89
- }, {
90
- key: "addActivity",
91
- value: function addActivity(activity) {
92
- return this.dispatch(_addActivity(activity));
93
- }
94
- }, {
95
- key: "getUploadingActivitiesIds",
96
- value: function getUploadingActivitiesIds() {
97
- return selectProgressPanelUploadingActivitiesIds(this.getGlobalState());
98
- }
99
- }, {
100
- key: "install",
101
- value: function install() {
102
- var target = this.opts.target || this.filerobot.getPlugin(PLUGINS_IDS.EXPLORER);
103
- if (target) {
104
- this.mount(target, this);
105
- }
106
- }
107
- }, {
108
- key: "onMount",
109
- value: function onMount() {
110
- this.initEvents();
111
- }
112
- }, {
113
- key: "uninstall",
114
- value: function uninstall() {
115
- this.unmount();
116
- this.removeEvents();
117
- }
118
- }]);
119
- }(Plugin);
120
- export { ProgressPanel as default };