@scaleflex/widget-core 4.1.0 → 4.4.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/CHANGELOG.md +24 -0
- package/package.json +3 -3
- package/dist/style.css +0 -229
- package/dist/style.min.css +0 -1
- package/lib/Client.js +0 -390
- package/lib/Plugin.js +0 -298
- package/lib/Providers.js +0 -112
- package/lib/SassKeyRenewer.js +0 -332
- package/lib/createStore.js +0 -45
- package/lib/defaultLocale.js +0 -75
- package/lib/hooks/index.js +0 -7
- package/lib/hooks/useContextMenu.js +0 -42
- package/lib/hooks/useContextMenuData.js +0 -17
- package/lib/hooks/useCore.js +0 -10
- package/lib/hooks/useModal.js +0 -72
- package/lib/hooks/useModalData.js +0 -7
- package/lib/hooks/usePlugin.js +0 -20
- package/lib/hooks/usePluginsType.js +0 -18
- package/lib/index.js +0 -1932
- package/lib/loggers.js +0 -45
- package/lib/slices/common.slice.js +0 -90
- package/lib/slices/index.js +0 -12
- package/lib/slices/info.slice.js +0 -52
- package/lib/slices/uploads.slice.js +0 -294
- package/lib/slices/user.slice.js +0 -256
- package/lib/supportsUploadProgress.js +0 -42
- package/lib/utils/calculateTotalEta.js +0 -21
package/lib/SassKeyRenewer.js
DELETED
|
@@ -1,332 +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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
9
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
-
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); } }
|
|
11
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
12
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
-
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; }
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
-
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); }
|
|
16
|
-
import { RESPONSE_CODES } from '@scaleflex/widget-utils/lib/constants';
|
|
17
|
-
import { saveUserSassKey, selectUserSessionUuid, userLogout } from './slices/user.slice';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Spec: https://scaleflexhq.atlassian.net/wiki/spaces/SHARED/pages/34570620/Session+handling
|
|
21
|
-
* Task: https://scaleflexhq.atlassian.net/browse/FRA-3494
|
|
22
|
-
*
|
|
23
|
-
* Notice!
|
|
24
|
-
* SassKeyRenewer works only when there is defined a session uuid:
|
|
25
|
-
* - Hub case
|
|
26
|
-
* - standalone Widget with enabled auth
|
|
27
|
-
* Doesn't work for Widget with security template (for this case is used logic to regenerate sass key from sec template user.slice.js:generateUserKey())
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export var TIMER_DELAY_STORAGE_NAME = 'sassKeyRenewerTimerDelay';
|
|
31
|
-
var LAST_RENEW_TIMESTAMP_STORAGE_NAME = 'keyRenewLastUpdateTimestamp';
|
|
32
|
-
var EMPTY_KEY_TIMER_DELAY_STORAGE_NAME = 'sassKeyRenewerEmptyKeyTimerDelay';
|
|
33
|
-
var LOG_ENABLED_STORAGE_NAME = 'sassKeyRenewerLogEnabled';
|
|
34
|
-
var TIMER_DELAY = 60 * 60 * 1000;
|
|
35
|
-
|
|
36
|
-
// If no sass key from renew API, need to send request again in 1min
|
|
37
|
-
var EMPTY_SASS_KEY_TIMER_DELAY = 60 * 1000;
|
|
38
|
-
var SassKeyRenewer = /*#__PURE__*/_createClass(function SassKeyRenewer(filerobot, client) {
|
|
39
|
-
var _this = this;
|
|
40
|
-
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
41
|
-
_classCallCheck(this, SassKeyRenewer);
|
|
42
|
-
_defineProperty(this, "resetProps", function () {
|
|
43
|
-
_this.log('Run resetProps()');
|
|
44
|
-
_this.isSending = false;
|
|
45
|
-
_this.isOffline = false;
|
|
46
|
-
_this.isBrowserTabVisible = true;
|
|
47
|
-
_this.isPaused = false;
|
|
48
|
-
_this.successHandlersQueue = [];
|
|
49
|
-
});
|
|
50
|
-
_defineProperty(this, "reset", function () {
|
|
51
|
-
_this.log('Run reset()');
|
|
52
|
-
_this.resetProps();
|
|
53
|
-
_this.clearTimers();
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "getStorageItemName", function (name) {
|
|
56
|
-
return "".concat(_this.storageNamePrefix || '').concat(name);
|
|
57
|
-
});
|
|
58
|
-
_defineProperty(this, "getItemFromStorage", function (name) {
|
|
59
|
-
return localStorage.getItem(_this.getStorageItemName(name));
|
|
60
|
-
});
|
|
61
|
-
_defineProperty(this, "removeItemFromStorage", function (name) {
|
|
62
|
-
return localStorage.removeItem(_this.getStorageItemName(name));
|
|
63
|
-
});
|
|
64
|
-
_defineProperty(this, "setItemToStorage", function (name, value) {
|
|
65
|
-
return localStorage.setItem(_this.getStorageItemName(name), value);
|
|
66
|
-
});
|
|
67
|
-
_defineProperty(this, "log", function (message) {
|
|
68
|
-
if (_this.opts.logEnabled) {
|
|
69
|
-
var _console;
|
|
70
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
71
|
-
args[_key - 1] = arguments[_key];
|
|
72
|
-
}
|
|
73
|
-
(_console = console).log.apply(_console, ["".concat(_this.opts.namePrefix, "[SassKeyRenewer] ").concat(message || '')].concat(args));
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
_defineProperty(this, "logDir", function () {
|
|
77
|
-
if (_this.opts.logEnabled) {
|
|
78
|
-
var _console2;
|
|
79
|
-
(_console2 = console).dir.apply(_console2, arguments);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
_defineProperty(this, "sendRenewRequestForce", function (successHandler, requestId) {
|
|
83
|
-
_this.log('Run sendRenewRequestForce()', {
|
|
84
|
-
requestId: requestId
|
|
85
|
-
});
|
|
86
|
-
_this.removeItemFromStorage(LAST_RENEW_TIMESTAMP_STORAGE_NAME);
|
|
87
|
-
_this.clearTimers();
|
|
88
|
-
_this.successHandlersQueue = [];
|
|
89
|
-
_this.addSuccessHandlerToTheQueue(function () {
|
|
90
|
-
return _this.sendRenewRequestsWithDelay();
|
|
91
|
-
}, 'sendRenewRequestsWithDelay');
|
|
92
|
-
_this.sendRenewRequest(successHandler, requestId);
|
|
93
|
-
});
|
|
94
|
-
_defineProperty(this, "sendRenewRequest", function (successHandler, requestId) {
|
|
95
|
-
_this.log('Run sendRenewRequest()', {
|
|
96
|
-
requestId: requestId,
|
|
97
|
-
isSending: _this.isSending
|
|
98
|
-
});
|
|
99
|
-
_this.addSuccessHandlerToTheQueue(successHandler, requestId);
|
|
100
|
-
if (_this.isSending) {
|
|
101
|
-
_this.log('Request rejected as previous one is still sending');
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
var state = _this.filerobot.store.getState();
|
|
105
|
-
var sessionUuid = selectUserSessionUuid(state);
|
|
106
|
-
if (!sessionUuid) {
|
|
107
|
-
_this.log('Request rejected as sessionUuid doesn\'t exist');
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// const { securityTemplateId } = this.filerobot?.opts || {} // TODO: Uncomment when it will be supported by BE
|
|
112
|
-
var headers = {};
|
|
113
|
-
if (sessionUuid) {
|
|
114
|
-
headers['X-Session-Token'] = sessionUuid;
|
|
115
|
-
}
|
|
116
|
-
// TODO: Uncomment when it will be supported by BE
|
|
117
|
-
// else if (securityTemplateId) {
|
|
118
|
-
// headers['X-Security-Template'] = securityTemplateId
|
|
119
|
-
// }
|
|
120
|
-
|
|
121
|
-
_this.log('headers', headers, {
|
|
122
|
-
sessionUuid: sessionUuid
|
|
123
|
-
});
|
|
124
|
-
var handleError = function handleError(error) {
|
|
125
|
-
clearTimeout(_this.noKeyResendTimer);
|
|
126
|
-
if (!_this.isPaused) {
|
|
127
|
-
var codesForLogout = [RESPONSE_CODES.ERR_SASS_INVALID, RESPONSE_CODES.KEY_EXPIRED, RESPONSE_CODES.ERR_SESSION_INVALID, RESPONSE_CODES.INVALID_UUID];
|
|
128
|
-
var code = codesForLogout.includes(error === null || error === void 0 ? void 0 : error.code) ? error.code : codesForLogout.includes(error === null || error === void 0 ? void 0 : error.codeLabel) ? error.codeLabel : null;
|
|
129
|
-
_this.log('Sass key renewal error', {
|
|
130
|
-
error: error,
|
|
131
|
-
code: code
|
|
132
|
-
});
|
|
133
|
-
_this.logDir(error);
|
|
134
|
-
if (code) {
|
|
135
|
-
_this.log("Sass key renewal returned code includes in: ".concat(codesForLogout.join('/'), ", need to logout"), headers, {
|
|
136
|
-
sessionUuid: sessionUuid,
|
|
137
|
-
code: code
|
|
138
|
-
});
|
|
139
|
-
_this.unsubscribe();
|
|
140
|
-
_this.filerobot.dispatch(userLogout());
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
_this.log('Handling missing sass key error. Run timer', {
|
|
144
|
-
delay: _this.opts.emptySassKeyTimerDelay
|
|
145
|
-
});
|
|
146
|
-
_this.noKeyResendTimer = setTimeout(function () {
|
|
147
|
-
_this.sendRenewRequest();
|
|
148
|
-
}, _this.opts.emptySassKeyTimerDelay);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
_this.isSending = true;
|
|
152
|
-
var lastRequestTimestamp = Date.now();
|
|
153
|
-
_this.log('Send request key/renew', {
|
|
154
|
-
headers: headers,
|
|
155
|
-
lastRequestTimestamp: lastRequestTimestamp
|
|
156
|
-
});
|
|
157
|
-
_this.setItemToStorage(LAST_RENEW_TIMESTAMP_STORAGE_NAME, lastRequestTimestamp);
|
|
158
|
-
_this.client.post('key/renew', {
|
|
159
|
-
headers: headers
|
|
160
|
-
}).then(function (response) {
|
|
161
|
-
_this.log('Response', response);
|
|
162
|
-
if (response.key) {
|
|
163
|
-
_this.filerobot.dispatch(saveUserSassKey(response.key));
|
|
164
|
-
_this.successHandlersQueue.forEach(function (_ref) {
|
|
165
|
-
var successHandler = _ref.successHandler;
|
|
166
|
-
successHandler(response);
|
|
167
|
-
});
|
|
168
|
-
_this.successHandlersQueue = [];
|
|
169
|
-
} else {
|
|
170
|
-
handleError(response);
|
|
171
|
-
}
|
|
172
|
-
})["catch"](function (error) {
|
|
173
|
-
_this.log('Error', error);
|
|
174
|
-
handleError(error);
|
|
175
|
-
})["finally"](function () {
|
|
176
|
-
_this.isSending = false;
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
/**
|
|
180
|
-
* @param {function} cb - Call back function
|
|
181
|
-
* @param {string} [requestId] - Optional. Should be used in cases when need to cancel previous simil request handler that has same ID.
|
|
182
|
-
*/
|
|
183
|
-
_defineProperty(this, "addSuccessHandlerToTheQueue", function (cb, requestId) {
|
|
184
|
-
_this.log('Run addSuccessHandlerToTheQueue()', {
|
|
185
|
-
cb: cb,
|
|
186
|
-
requestId: requestId
|
|
187
|
-
});
|
|
188
|
-
if (typeof cb === 'function') {
|
|
189
|
-
// Remove similar requests
|
|
190
|
-
if (requestId) {
|
|
191
|
-
var similarRequestIndex = _this.successHandlersQueue.findIndex(function (request) {
|
|
192
|
-
return (request === null || request === void 0 ? void 0 : request.requestId) === requestId;
|
|
193
|
-
});
|
|
194
|
-
if (similarRequestIndex > -1) {
|
|
195
|
-
// Similar request exists in the queue
|
|
196
|
-
_this.log('Remove success handler from queue', {
|
|
197
|
-
similarRequestIndex: similarRequestIndex,
|
|
198
|
-
handler: _this.successHandlersQueue[similarRequestIndex]
|
|
199
|
-
});
|
|
200
|
-
var newSuccessHandlersQueue = _toConsumableArray(_this.successHandlersQueue);
|
|
201
|
-
newSuccessHandlersQueue.splice(similarRequestIndex, 1);
|
|
202
|
-
_this.successHandlersQueue = newSuccessHandlersQueue;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
_this.successHandlersQueue.push({
|
|
206
|
-
requestId: requestId,
|
|
207
|
-
successHandler: cb
|
|
208
|
-
});
|
|
209
|
-
_this.log('Added success handler to queue', _toConsumableArray(_this.successHandlersQueue));
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
// Run refresh request every hour
|
|
213
|
-
_defineProperty(this, "sendRenewRequestsWithDelay", function (_delay) {
|
|
214
|
-
var delay = _delay || _this.opts.timerDelay;
|
|
215
|
-
_this.timer = setTimeout(function () {
|
|
216
|
-
_this.sendRenewRequest(function () {
|
|
217
|
-
return _this.sendRenewRequestsWithDelay();
|
|
218
|
-
}, 'sendRenewRequestsWithDelay');
|
|
219
|
-
}, delay);
|
|
220
|
-
_this.log('Run sendRenewRequestsWithDelay()', {
|
|
221
|
-
delay: delay,
|
|
222
|
-
timer: _this.timer
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
_defineProperty(this, "clearTimers", function () {
|
|
226
|
-
_this.log('Run clearTimers()', {
|
|
227
|
-
timer: _this.timer,
|
|
228
|
-
noKeyResendTimer: _this.noKeyResendTimer
|
|
229
|
-
});
|
|
230
|
-
clearTimeout(_this.timer);
|
|
231
|
-
clearTimeout(_this.noKeyResendTimer);
|
|
232
|
-
});
|
|
233
|
-
_defineProperty(this, "pause", function () {
|
|
234
|
-
_this.log('Paused');
|
|
235
|
-
_this.isSending = false;
|
|
236
|
-
_this.isPaused = true;
|
|
237
|
-
_this.clearTimers();
|
|
238
|
-
});
|
|
239
|
-
_defineProperty(this, "continue", function () {
|
|
240
|
-
_this.isPaused = false;
|
|
241
|
-
_this.log('Continue', {
|
|
242
|
-
isSubscribed: _this.isSubscribed,
|
|
243
|
-
isOffline: _this.isOffline,
|
|
244
|
-
isBrowserTabVisible: _this.isBrowserTabVisible,
|
|
245
|
-
isPaused: _this.isPaused,
|
|
246
|
-
isSending: _this.isSending,
|
|
247
|
-
successHandlersQueue: _this.successHandlersQueue
|
|
248
|
-
});
|
|
249
|
-
if (_this.isSubscribed && !_this.isOffline && _this.isBrowserTabVisible) {
|
|
250
|
-
var lastRequestTimestamp = +(_this.getItemFromStorage(LAST_RENEW_TIMESTAMP_STORAGE_NAME) || 0);
|
|
251
|
-
_this.log('lastRequestTimestamp = ', lastRequestTimestamp);
|
|
252
|
-
if (Number.isFinite(lastRequestTimestamp) && lastRequestTimestamp > 0) {
|
|
253
|
-
var dateNow = Date.now();
|
|
254
|
-
var delayMsec = _this.opts.timerDelay - (dateNow - lastRequestTimestamp);
|
|
255
|
-
_this.log('Delay milliseconds', {
|
|
256
|
-
delayMsec: delayMsec,
|
|
257
|
-
timerDelay: _this.opts.timerDelay,
|
|
258
|
-
lastRequestTimestamp: lastRequestTimestamp,
|
|
259
|
-
dateNow: dateNow
|
|
260
|
-
});
|
|
261
|
-
if (delayMsec > 1000) {
|
|
262
|
-
return _this.sendRenewRequestsWithDelay(delayMsec);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
_this.sendRenewRequest(function () {
|
|
266
|
-
return _this.sendRenewRequestsWithDelay();
|
|
267
|
-
}, 'sendRenewRequestsWithDelay');
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
_defineProperty(this, "onlineHandler", function () {
|
|
271
|
-
_this.log('Online');
|
|
272
|
-
_this.isOffline = false;
|
|
273
|
-
_this["continue"]();
|
|
274
|
-
});
|
|
275
|
-
_defineProperty(this, "offlineHandler", function () {
|
|
276
|
-
_this.log('Offline');
|
|
277
|
-
_this.isOffline = true;
|
|
278
|
-
_this.pause();
|
|
279
|
-
});
|
|
280
|
-
_defineProperty(this, "visibilityChangeHandler", function () {
|
|
281
|
-
if (document.hidden) {
|
|
282
|
-
_this.log('Tab not active');
|
|
283
|
-
_this.isBrowserTabVisible = false;
|
|
284
|
-
_this.pause();
|
|
285
|
-
} else {
|
|
286
|
-
_this.log('Tab active');
|
|
287
|
-
_this.isBrowserTabVisible = true;
|
|
288
|
-
_this["continue"]();
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
_defineProperty(this, "subscribe", function () {
|
|
292
|
-
_this.log('Run subscribe()');
|
|
293
|
-
_this.reset();
|
|
294
|
-
_this.sendRenewRequestsWithDelay();
|
|
295
|
-
if (!_this.isSubscribed) {
|
|
296
|
-
var offlineHandler = _this.offlineHandler.bind(_this);
|
|
297
|
-
var onlineHandler = _this.onlineHandler.bind(_this);
|
|
298
|
-
var visibilityChangeHandler = _this.visibilityChangeHandler.bind(_this);
|
|
299
|
-
_this.log('Add listeners');
|
|
300
|
-
window.addEventListener('offline', offlineHandler);
|
|
301
|
-
window.addEventListener('online', onlineHandler);
|
|
302
|
-
document.addEventListener('visibilitychange', visibilityChangeHandler);
|
|
303
|
-
_this.unsubscribe = function () {
|
|
304
|
-
_this.log('Run unsubscribe()');
|
|
305
|
-
_this.reset();
|
|
306
|
-
_this.isSubscribed = false;
|
|
307
|
-
_this.log('Remove listeners');
|
|
308
|
-
window.removeEventListener('offline', offlineHandler);
|
|
309
|
-
window.removeEventListener('online', onlineHandler);
|
|
310
|
-
document.removeEventListener('visibilitychange', visibilityChangeHandler);
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
_this.isSubscribed = true;
|
|
314
|
-
return _this.unsubscribe.bind(_this);
|
|
315
|
-
});
|
|
316
|
-
this.filerobot = filerobot;
|
|
317
|
-
this.client = client;
|
|
318
|
-
this.timer = null;
|
|
319
|
-
this.noKeyResendTimer = null;
|
|
320
|
-
this.storageNamePrefix = (opts === null || opts === void 0 ? void 0 : opts.namePrefix) || ''; // User for tests only. Solve problem with parallel async tests running when one test override localStorage value for another test.
|
|
321
|
-
this.opts = _objectSpread({
|
|
322
|
-
logEnabled: this.getItemFromStorage(LOG_ENABLED_STORAGE_NAME) === 'true',
|
|
323
|
-
timerDelay: +(this.getItemFromStorage(TIMER_DELAY_STORAGE_NAME) || TIMER_DELAY),
|
|
324
|
-
emptySassKeyTimerDelay: +(this.getItemFromStorage(EMPTY_KEY_TIMER_DELAY_STORAGE_NAME) || EMPTY_SASS_KEY_TIMER_DELAY),
|
|
325
|
-
namePrefix: ''
|
|
326
|
-
}, opts);
|
|
327
|
-
this.isSubscribed = false;
|
|
328
|
-
this.unsubscribe = function () {};
|
|
329
|
-
this.resetProps();
|
|
330
|
-
this.log('Inited');
|
|
331
|
-
});
|
|
332
|
-
export default SassKeyRenewer;
|
package/lib/createStore.js
DELETED
|
@@ -1,45 +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 { combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
|
-
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
9
|
-
import coreReducer from './slices';
|
|
10
|
-
var createRootReducer = function createRootReducer(dynamicReducers) {
|
|
11
|
-
return combineReducers(_objectSpread(_defineProperty({}, PLUGINS_IDS.CORE, coreReducer), dynamicReducers));
|
|
12
|
-
};
|
|
13
|
-
var createStore = function createStore(apiClient) {
|
|
14
|
-
var customMiddlewares = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
15
|
-
var filerobot = arguments.length > 2 ? arguments[2] : undefined;
|
|
16
|
-
var store = configureStore({
|
|
17
|
-
middleware: function middleware(getDefaultMiddleware) {
|
|
18
|
-
return getDefaultMiddleware({
|
|
19
|
-
thunk: {
|
|
20
|
-
extraArgument: {
|
|
21
|
-
apiClient: apiClient,
|
|
22
|
-
filerobot: filerobot
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
// serializableCheck: false // TODO: remove this line after fixing the issue with serializableCheck
|
|
26
|
-
}).concat(customMiddlewares);
|
|
27
|
-
},
|
|
28
|
-
reducer: createRootReducer(),
|
|
29
|
-
devTools: {
|
|
30
|
-
trace: process.env.NODE_ENV === 'development' || process.env.REACT_APP_GITLAB_REVIEW_ENV === 'true',
|
|
31
|
-
traceLimit: 25
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
store.dynamicReducers = {};
|
|
35
|
-
store.injectReducer = function (key, asyncReducer) {
|
|
36
|
-
store.dynamicReducers[key] = asyncReducer;
|
|
37
|
-
store.replaceReducer(createRootReducer(store.dynamicReducers));
|
|
38
|
-
};
|
|
39
|
-
store.removeReducer = function (key) {
|
|
40
|
-
delete store.dynamicReducers[key];
|
|
41
|
-
store.replaceReducer(createRootReducer(store.dynamicReducers));
|
|
42
|
-
};
|
|
43
|
-
return store;
|
|
44
|
-
};
|
|
45
|
-
export default createStore;
|
package/lib/defaultLocale.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
addBulkFilesFailedMessage: {
|
|
3
|
-
0: 'Failed to add %{smart_count} file due to an internal error',
|
|
4
|
-
1: 'Failed to add %{smart_count} files due to internal errors'
|
|
5
|
-
},
|
|
6
|
-
filerobotYouCanOnlyUploadXError: {
|
|
7
|
-
0: 'You can only upload %{smart_count} file',
|
|
8
|
-
1: 'You can only upload %{smart_count} files'
|
|
9
|
-
},
|
|
10
|
-
filerobotYouHaveToAtLeastSelectXError: {
|
|
11
|
-
0: 'You have to select at least %{smart_count} file',
|
|
12
|
-
1: 'You have to select at least %{smart_count} files'
|
|
13
|
-
},
|
|
14
|
-
filerobotExceedsSizeError: 'This file exceeds maximum allowed size of %{size}',
|
|
15
|
-
filerobotFilesExceedsSizeError: 'These files exceed maximum allowed size of %{size}MB',
|
|
16
|
-
filerobotYouCanOnlyUploadFileTypesError: 'You can only upload: %{types}',
|
|
17
|
-
filerobotNoNewAlreadyUploadingError: 'Cannot add new files: already uploading',
|
|
18
|
-
filerobotNoDuplicatesError: 'Cannot add the duplicate file \'%{fileName}\', it already exists',
|
|
19
|
-
filerobotAddedUploadedFilesError: 'Files are already added to the uploads panel, please close it first',
|
|
20
|
-
providerViewCompanionError: 'Connection with Companion failed',
|
|
21
|
-
providerViewCompanionUnauthorizeMessage: 'To unauthorize to your %{provider} account, please go to %{url}',
|
|
22
|
-
filerobotFailedToUploadError: 'Failed to upload %{file}',
|
|
23
|
-
filerobotNoInternetConnectionInfo: 'No Internet connection',
|
|
24
|
-
filerobotConnectedToInternetInfo: 'Connected to the Internet',
|
|
25
|
-
// Strings for remote providers
|
|
26
|
-
foldersViewDragAndDropFilesHereText: 'You can drag & drop files right here',
|
|
27
|
-
foldersViewNoFilesFoundText: 'No files here',
|
|
28
|
-
mutualizedSelectFileNamedLabel: 'Select file %{name}',
|
|
29
|
-
mutualizedUnselectFileNamedLabel: 'Unselect file %{name}',
|
|
30
|
-
mutualizedOpenFolderNamedLabel: 'Open folder %{name}',
|
|
31
|
-
headBarLogOutText: 'Log out',
|
|
32
|
-
explorerTopBarFilterText: 'Filter',
|
|
33
|
-
authViewAuthenticateText: 'Please authenticate with %{pluginName} to select files',
|
|
34
|
-
authViewConnectToButton: 'Connect to %{pluginName}',
|
|
35
|
-
filerobotEmptyFolderAddedMessage: 'No files were added from empty folder',
|
|
36
|
-
filerobotFolderAddedMessage: {
|
|
37
|
-
0: 'Added %{smart_count} file from %{folder}',
|
|
38
|
-
1: 'Added %{smart_count} files from %{folder}'
|
|
39
|
-
},
|
|
40
|
-
remoteUploadTooManyFilesSelectedError: 'Too many files selected. Please speak to Scaleflex Support if you would like to import more than %{limit} files',
|
|
41
|
-
remoteUploadTotalFileSizeTooBigError: 'Total file size is too big. Please speak to Scaleflex Support if you would like to import more than %{limit}',
|
|
42
|
-
remoteUploadPathTooLongError: 'Path to files is too long. Please select the folder or files directly or speak to Scaleflex Support if you would like to replicate a folder structure deeper than %{limit} levels',
|
|
43
|
-
remoteUploadTooManyFoldersSelectedError: 'Too many folders selected for upload. Please reduce the number of folders selected or speak to Scaleflex Support if you would like to import more than %{limit} folders',
|
|
44
|
-
remoteUploadFolderImportProgressMessage: 'Processing...',
|
|
45
|
-
remoteUploadFolderImportProgressFoldersLabel: 'Folders',
|
|
46
|
-
remoteUploadFolderImportProgressFilesLabel: 'Files',
|
|
47
|
-
remoteUploadFolderImportProgressCancelButton: 'Cancel',
|
|
48
|
-
remoteUploadIncludeSubFoldersCheckbox: 'Include subfolders',
|
|
49
|
-
explorerServiceUnknownBackendError: 'Unknown error while communicating with server, try again later',
|
|
50
|
-
foldersViewNameLabel: 'Name',
|
|
51
|
-
listViewTableColHeaderSize: 'Assets',
|
|
52
|
-
mutualizedLastModifyLabel: 'Last modify',
|
|
53
|
-
filerobotNoPermissionsInfo: 'No user permissions, ask your admin to add permissions to your account.',
|
|
54
|
-
filerobotInvalidPermissionError: 'Sorry but you are not permitted to do this operation.',
|
|
55
|
-
filerobotFolderUploadingNotAllowedError: 'Your permissions doesn\'t include uploading to this folder (%{folder}).',
|
|
56
|
-
filerobotRestrictedFileError: 'Can not upload %{file_extension} file',
|
|
57
|
-
explorerValidatingCsvFailureError: 'Validating CSV file failed.',
|
|
58
|
-
explorerUpdateViaCsvModalUploadFailedError: 'Upload failed.',
|
|
59
|
-
explorerExceedsCompressionSizeError: 'Downloading of more than %{size} for simultaneous files is not allowed, retry selecting fewer files.',
|
|
60
|
-
explorerDropFilesHint: 'Drop your files here',
|
|
61
|
-
explorerTopBarAsOriginalText: 'As original',
|
|
62
|
-
explorerTopBarAsCsvText: 'List of assets (CSV)',
|
|
63
|
-
explorerCompressionAllowedOnceWarning: 'Please wait till the current compression is finished & try again.',
|
|
64
|
-
contextMenuDownloadOptionsLabel: 'Transformation',
|
|
65
|
-
commonOptionsNoMetadataAvailableTooltip: 'No metadata available',
|
|
66
|
-
informerSeeDetailsButtonLabel: 'See details',
|
|
67
|
-
informerErrorsModalTitle: 'Error details',
|
|
68
|
-
informerErrorsModalCopyButton: 'Copy',
|
|
69
|
-
informerErrorsModalSuccessCopyMsg: 'Errors copied successfully',
|
|
70
|
-
loaderLoadingLabel: 'Loading',
|
|
71
|
-
mutualizedUnknownErrorMessage: 'Unknown error, make sure you have internet connection or try again later',
|
|
72
|
-
explorerServiceEmptySassKeyHeaderError: 'Required request header is missing',
|
|
73
|
-
explorerServiceExpiredSassKeyHeaderError: 'Your permission credential (SASS key) has expired - please relogin to continue',
|
|
74
|
-
explorerResumableUploadFastestServerError: 'A connection could not be established with the upload servers - please contact support@scaleflex.com'
|
|
75
|
-
};
|
package/lib/hooks/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as usePlugin } from './usePlugin';
|
|
2
|
-
export { default as usePluginsType } from './usePluginsType';
|
|
3
|
-
export { default as useModal } from './useModal';
|
|
4
|
-
export { default as useModalData } from './useModalData';
|
|
5
|
-
export { default as useCore } from './useCore';
|
|
6
|
-
export { default as useContextMenu } from './useContextMenu';
|
|
7
|
-
export { default as useContextMenuData } from './useContextMenuData';
|
|
@@ -1,42 +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 { useCallback, useContext } from 'react';
|
|
8
|
-
import { ContextMenuDispatcherContext } from '../Providers';
|
|
9
|
-
|
|
10
|
-
// data === {
|
|
11
|
-
// isOpen = true/false, - no need to provide it, it gets handled automatically depending on ur provided props or not.
|
|
12
|
-
// event = {}, foldersUuids = [], filesUuids = [], type = CONTEXTMENU_TYPES.FILE,
|
|
13
|
-
// mode = CONTEXTMENU_MODES.AUTO, options = null // options has priority over mode, if there is options mode will be dismissed otherwise mode is used.
|
|
14
|
-
// items = null/[...] // used in case of other items not file/folder, ex. versioning.,
|
|
15
|
-
// itemsPropName = 'items' // used in case u need to provide the items with a different prop name for the context menu's options to work,
|
|
16
|
-
// --- ex. (itemsPropName: 'folders') then instead of `items: [folder1, folder2]`, it would be folders: `[folder1, folder2]`.
|
|
17
|
-
// fromSidebar = false
|
|
18
|
-
// }
|
|
19
|
-
var useContextMenu = function useContextMenu() {
|
|
20
|
-
var setContextMenuData = useContext(ContextMenuDispatcherContext);
|
|
21
|
-
|
|
22
|
-
// any update (object) provided to the context's data will open the context menu
|
|
23
|
-
// any falsy/undefined value will close the context menu
|
|
24
|
-
var updateContextMenuData = useCallback(function () {
|
|
25
|
-
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
-
if (update !== null && update !== void 0 && update.event) {
|
|
27
|
-
update.event.preventDefault();
|
|
28
|
-
update.event.stopPropagation();
|
|
29
|
-
update.event.currentTarget.focus(); // requires tabIndex for non-focusable elements.
|
|
30
|
-
}
|
|
31
|
-
return setContextMenuData(function (prev) {
|
|
32
|
-
var updates = typeof update === 'function' ? update(prev) : update;
|
|
33
|
-
return updates && Object.keys(updates).length > 0 ? _objectSpread(_objectSpread({}, updates), {}, {
|
|
34
|
-
isOpen: true
|
|
35
|
-
}) : {
|
|
36
|
-
isOpen: false
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
}, [setContextMenuData]);
|
|
40
|
-
return updateContextMenuData;
|
|
41
|
-
};
|
|
42
|
-
export default useContextMenu;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { ContextMenuDataContext } from '../Providers';
|
|
3
|
-
|
|
4
|
-
// data === {
|
|
5
|
-
// isOpen = true/false, - no need to provide it, it gets handled automatically depending on ur provided props or not.
|
|
6
|
-
// event = {}, foldersUuids = [], filesUuids = [], type = CONTEXTMENU_TYPES.FILE,
|
|
7
|
-
// mode = CONTEXTMENU_MODES.AUTO, options = null // options has priority over mode, if there is options mode will be dismissed otherwise mode is used.
|
|
8
|
-
// items = null/[...] // used in case of other items not file/folder, ex. versioning.,
|
|
9
|
-
// itemsPropName = 'items' // used in case u need to provide the items with a different prop name for the context menu's options to work,
|
|
10
|
-
// --- ex. (itemsPropName: 'folders') then instead of `items: [folder1, folder2]`, it would be folders: `[folder1, folder2]`.
|
|
11
|
-
// fromSidebar = false
|
|
12
|
-
// }
|
|
13
|
-
var useContextMenuData = function useContextMenuData() {
|
|
14
|
-
var contextMenuData = useContext(ContextMenuDataContext);
|
|
15
|
-
return contextMenuData;
|
|
16
|
-
};
|
|
17
|
-
export default useContextMenuData;
|
package/lib/hooks/useCore.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { FilerobotPackagesContext } from '../Providers';
|
|
3
|
-
var useCore = function useCore() {
|
|
4
|
-
var _useContext = useContext(FilerobotPackagesContext),
|
|
5
|
-
filerobot = _useContext.filerobot;
|
|
6
|
-
return useMemo(function () {
|
|
7
|
-
return filerobot;
|
|
8
|
-
}, [filerobot]);
|
|
9
|
-
};
|
|
10
|
-
export default useCore;
|
package/lib/hooks/useModal.js
DELETED
|
@@ -1,72 +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 { useCallback, useContext } from 'react';
|
|
8
|
-
import { ModalDispatcherContext } from '../Providers';
|
|
9
|
-
|
|
10
|
-
// isHigherLvlModal: if `true`, it will return a function that will return another level of modal's data
|
|
11
|
-
// to be passed to first level/root modal and open moreover higher/another level of modal on top of it.
|
|
12
|
-
// isGlobalHigherLvlModal: if `true` will return a function updated the higher lvl modal data
|
|
13
|
-
var useModal = function useModal() {
|
|
14
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
15
|
-
_ref$isHigherLvlModal = _ref.isHigherLvlModal,
|
|
16
|
-
isHigherLvlModal = _ref$isHigherLvlModal === void 0 ? false : _ref$isHigherLvlModal,
|
|
17
|
-
_ref$isGlobalHigherLv = _ref.isGlobalHigherLvlModal,
|
|
18
|
-
isGlobalHigherLvlModal = _ref$isGlobalHigherLv === void 0 ? false : _ref$isGlobalHigherLv;
|
|
19
|
-
var setModalData = useContext(ModalDispatcherContext);
|
|
20
|
-
|
|
21
|
-
// any update (object) provided to the context's data will open the context menu
|
|
22
|
-
// any falsy/undefined value will close the context menu
|
|
23
|
-
var updateModalData = useCallback(function () {
|
|
24
|
-
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25
|
-
return setModalData(function (prev) {
|
|
26
|
-
var updates = typeof update === 'function' ? update(prev) : update;
|
|
27
|
-
return updates && Object.keys(updates).length > 0 ? _objectSpread(_objectSpread({}, updates), {}, {
|
|
28
|
-
isOpen: true
|
|
29
|
-
}) : {
|
|
30
|
-
isOpen: false
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
}, []);
|
|
34
|
-
var getHigherLvlModalData = useCallback(function (update) {
|
|
35
|
-
var updates = update;
|
|
36
|
-
if (typeof update === 'function') {
|
|
37
|
-
setModalData(function (firstLevelModalState) {
|
|
38
|
-
updates = update(firstLevelModalState);
|
|
39
|
-
return isGlobalHigherLvlModal ? {
|
|
40
|
-
higherLevelModalData: updates
|
|
41
|
-
} : firstLevelModalState;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
var hasUpdates = updates && Object.keys(updates).length > 0;
|
|
45
|
-
if (isGlobalHigherLvlModal) {
|
|
46
|
-
setModalData(function (firstLevelModalState) {
|
|
47
|
-
var _updates;
|
|
48
|
-
if ((_updates = updates) !== null && _updates !== void 0 && _updates.higherLevelModalData) {
|
|
49
|
-
updates = _objectSpread(_objectSpread({}, updates), updates.higherLevelModalData);
|
|
50
|
-
delete updates.higherLevelModalData;
|
|
51
|
-
}
|
|
52
|
-
return _objectSpread(_objectSpread({}, firstLevelModalState), {}, {
|
|
53
|
-
higherLevelModalData: hasUpdates ? _objectSpread(_objectSpread({}, updates), {}, {
|
|
54
|
-
isOpen: true
|
|
55
|
-
}) : undefined
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
updates = {
|
|
59
|
-
higherLevelModalData: _objectSpread(_objectSpread({}, updates), {}, {
|
|
60
|
-
isOpen: true
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return hasUpdates ? _objectSpread(_objectSpread({}, updates), {}, {
|
|
65
|
-
isOpen: true
|
|
66
|
-
}) : {
|
|
67
|
-
isOpen: false
|
|
68
|
-
};
|
|
69
|
-
}, []);
|
|
70
|
-
return isHigherLvlModal || isGlobalHigherLvlModal ? getHigherLvlModalData : updateModalData;
|
|
71
|
-
};
|
|
72
|
-
export default useModal;
|
package/lib/hooks/usePlugin.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from 'react';
|
|
2
|
-
import { FilerobotPackagesContext } from '../Providers';
|
|
3
|
-
var usePlugin = function usePlugin(pluginId) {
|
|
4
|
-
var _useContext = useContext(FilerobotPackagesContext),
|
|
5
|
-
plugins = _useContext.plugins;
|
|
6
|
-
return useMemo(function () {
|
|
7
|
-
var foundPlugin = null;
|
|
8
|
-
Object.keys(plugins).some(function (pluginType) {
|
|
9
|
-
return plugins[pluginType].some(function (plugin) {
|
|
10
|
-
if (plugin.id === pluginId) {
|
|
11
|
-
foundPlugin = plugin;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
return foundPlugin;
|
|
18
|
-
}, [plugins, pluginId]);
|
|
19
|
-
};
|
|
20
|
-
export default usePlugin;
|