sceyt-chat-react-uikit 1.6.9-beta.6 → 1.6.9-beta.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/components/AudioRecord/index.d.ts +2 -1
- package/index.js +977 -804
- package/index.modern.js +978 -805
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -47,8 +47,8 @@ var LexicalTypeaheadMenuPlugin = require('@lexical/react/LexicalTypeaheadMenuPlu
|
|
|
47
47
|
var offset = require('@lexical/offset');
|
|
48
48
|
var LexicalHistoryPlugin = require('@lexical/react/LexicalHistoryPlugin');
|
|
49
49
|
|
|
50
|
-
/** A function that accepts a potential "extra argument" value to be injected later,
|
|
51
|
-
* and returns an instance of the thunk middleware that uses that value
|
|
50
|
+
/** A function that accepts a potential "extra argument" value to be injected later,
|
|
51
|
+
* and returns an instance of the thunk middleware that uses that value
|
|
52
52
|
*/
|
|
53
53
|
function createThunkMiddleware(extraArgument) {
|
|
54
54
|
// Standard Redux middleware definition pattern:
|
|
@@ -79,522 +79,522 @@ var thunk = createThunkMiddleware(); // Attach the factory function so users can
|
|
|
79
79
|
|
|
80
80
|
thunk.withExtraArgument = createThunkMiddleware;
|
|
81
81
|
|
|
82
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
83
|
-
var extendStatics = function (d, b) {
|
|
84
|
-
extendStatics = Object.setPrototypeOf ||
|
|
85
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
86
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
87
|
-
return extendStatics(d, b);
|
|
88
|
-
};
|
|
89
|
-
return function (d, b) {
|
|
90
|
-
if (typeof b !== "function" && b !== null)
|
|
91
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
92
|
-
extendStatics(d, b);
|
|
93
|
-
function __() { this.constructor = d; }
|
|
94
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
95
|
-
};
|
|
96
|
-
})();
|
|
97
|
-
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
|
98
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
99
|
-
to[j] = from[i];
|
|
100
|
-
return to;
|
|
101
|
-
};
|
|
102
|
-
var __defProp = Object.defineProperty;
|
|
103
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
104
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
105
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
106
|
-
var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; };
|
|
107
|
-
var __spreadValues = function (a, b) {
|
|
108
|
-
for (var prop in b || (b = {}))
|
|
109
|
-
if (__hasOwnProp.call(b, prop))
|
|
110
|
-
__defNormalProp(a, prop, b[prop]);
|
|
111
|
-
if (__getOwnPropSymbols)
|
|
112
|
-
for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) {
|
|
113
|
-
var prop = _c[_i];
|
|
114
|
-
if (__propIsEnum.call(b, prop))
|
|
115
|
-
__defNormalProp(a, prop, b[prop]);
|
|
116
|
-
}
|
|
117
|
-
return a;
|
|
118
|
-
};
|
|
119
|
-
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () {
|
|
120
|
-
if (arguments.length === 0)
|
|
121
|
-
return void 0;
|
|
122
|
-
if (typeof arguments[0] === "object")
|
|
123
|
-
return redux.compose;
|
|
124
|
-
return redux.compose.apply(null, arguments);
|
|
125
|
-
};
|
|
126
|
-
// src/isPlainObject.ts
|
|
127
|
-
function isPlainObject(value) {
|
|
128
|
-
if (typeof value !== "object" || value === null)
|
|
129
|
-
return false;
|
|
130
|
-
var proto = Object.getPrototypeOf(value);
|
|
131
|
-
if (proto === null)
|
|
132
|
-
return true;
|
|
133
|
-
var baseProto = proto;
|
|
134
|
-
while (Object.getPrototypeOf(baseProto) !== null) {
|
|
135
|
-
baseProto = Object.getPrototypeOf(baseProto);
|
|
136
|
-
}
|
|
137
|
-
return proto === baseProto;
|
|
138
|
-
}
|
|
139
|
-
// src/tsHelpers.ts
|
|
140
|
-
var hasMatchFunction = function (v) {
|
|
141
|
-
return v && typeof v.match === "function";
|
|
142
|
-
};
|
|
143
|
-
function isActionCreator(action) {
|
|
144
|
-
return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
|
145
|
-
}
|
|
146
|
-
// src/actionCreatorInvariantMiddleware.ts
|
|
147
|
-
function getMessage(type) {
|
|
148
|
-
var splitType = type ? ("" + type).split("/") : [];
|
|
149
|
-
var actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
150
|
-
return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
|
|
151
|
-
}
|
|
152
|
-
function createActionCreatorInvariantMiddleware(options) {
|
|
153
|
-
if (options === void 0) { options = {}; }
|
|
154
|
-
if (process.env.NODE_ENV === "production") {
|
|
155
|
-
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
156
|
-
}
|
|
157
|
-
var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
|
|
158
|
-
return function () { return function (next) { return function (action) {
|
|
159
|
-
if (isActionCreator2(action)) {
|
|
160
|
-
console.warn(getMessage(action.type));
|
|
161
|
-
}
|
|
162
|
-
return next(action);
|
|
163
|
-
}; }; };
|
|
164
|
-
}
|
|
165
|
-
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
166
|
-
var elapsed = 0;
|
|
167
|
-
return {
|
|
168
|
-
measureTime: function (fn) {
|
|
169
|
-
var started = Date.now();
|
|
170
|
-
try {
|
|
171
|
-
return fn();
|
|
172
|
-
}
|
|
173
|
-
finally {
|
|
174
|
-
var finished = Date.now();
|
|
175
|
-
elapsed += finished - started;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
warnIfExceeded: function () {
|
|
179
|
-
if (elapsed > maxDelay) {
|
|
180
|
-
console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.");
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
var MiddlewareArray = /** @class */ (function (_super) {
|
|
186
|
-
__extends(MiddlewareArray, _super);
|
|
187
|
-
function MiddlewareArray() {
|
|
188
|
-
var args = [];
|
|
189
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
190
|
-
args[_i] = arguments[_i];
|
|
191
|
-
}
|
|
192
|
-
var _this = _super.apply(this, args) || this;
|
|
193
|
-
Object.setPrototypeOf(_this, MiddlewareArray.prototype);
|
|
194
|
-
return _this;
|
|
195
|
-
}
|
|
196
|
-
Object.defineProperty(MiddlewareArray, Symbol.species, {
|
|
197
|
-
get: function () {
|
|
198
|
-
return MiddlewareArray;
|
|
199
|
-
},
|
|
200
|
-
enumerable: false,
|
|
201
|
-
configurable: true
|
|
202
|
-
});
|
|
203
|
-
MiddlewareArray.prototype.concat = function () {
|
|
204
|
-
var arr = [];
|
|
205
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
206
|
-
arr[_i] = arguments[_i];
|
|
207
|
-
}
|
|
208
|
-
return _super.prototype.concat.apply(this, arr);
|
|
209
|
-
};
|
|
210
|
-
MiddlewareArray.prototype.prepend = function () {
|
|
211
|
-
var arr = [];
|
|
212
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
213
|
-
arr[_i] = arguments[_i];
|
|
214
|
-
}
|
|
215
|
-
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
216
|
-
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
217
|
-
}
|
|
218
|
-
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
|
|
219
|
-
};
|
|
220
|
-
return MiddlewareArray;
|
|
221
|
-
}(Array));
|
|
222
|
-
var EnhancerArray = /** @class */ (function (_super) {
|
|
223
|
-
__extends(EnhancerArray, _super);
|
|
224
|
-
function EnhancerArray() {
|
|
225
|
-
var args = [];
|
|
226
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
227
|
-
args[_i] = arguments[_i];
|
|
228
|
-
}
|
|
229
|
-
var _this = _super.apply(this, args) || this;
|
|
230
|
-
Object.setPrototypeOf(_this, EnhancerArray.prototype);
|
|
231
|
-
return _this;
|
|
232
|
-
}
|
|
233
|
-
Object.defineProperty(EnhancerArray, Symbol.species, {
|
|
234
|
-
get: function () {
|
|
235
|
-
return EnhancerArray;
|
|
236
|
-
},
|
|
237
|
-
enumerable: false,
|
|
238
|
-
configurable: true
|
|
239
|
-
});
|
|
240
|
-
EnhancerArray.prototype.concat = function () {
|
|
241
|
-
var arr = [];
|
|
242
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
243
|
-
arr[_i] = arguments[_i];
|
|
244
|
-
}
|
|
245
|
-
return _super.prototype.concat.apply(this, arr);
|
|
246
|
-
};
|
|
247
|
-
EnhancerArray.prototype.prepend = function () {
|
|
248
|
-
var arr = [];
|
|
249
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
250
|
-
arr[_i] = arguments[_i];
|
|
251
|
-
}
|
|
252
|
-
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
253
|
-
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
254
|
-
}
|
|
255
|
-
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))();
|
|
256
|
-
};
|
|
257
|
-
return EnhancerArray;
|
|
258
|
-
}(Array));
|
|
259
|
-
// src/immutableStateInvariantMiddleware.ts
|
|
260
|
-
var isProduction = process.env.NODE_ENV === "production";
|
|
261
|
-
var prefix = "Invariant failed";
|
|
262
|
-
function invariant(condition, message) {
|
|
263
|
-
if (condition) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
if (isProduction) {
|
|
267
|
-
throw new Error(prefix);
|
|
268
|
-
}
|
|
269
|
-
throw new Error(prefix + ": " + (message || ""));
|
|
270
|
-
}
|
|
271
|
-
function stringify(obj, serializer, indent, decycler) {
|
|
272
|
-
return JSON.stringify(obj, getSerialize(serializer, decycler), indent);
|
|
273
|
-
}
|
|
274
|
-
function getSerialize(serializer, decycler) {
|
|
275
|
-
var stack = [], keys = [];
|
|
276
|
-
if (!decycler)
|
|
277
|
-
decycler = function (_, value) {
|
|
278
|
-
if (stack[0] === value)
|
|
279
|
-
return "[Circular ~]";
|
|
280
|
-
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
281
|
-
};
|
|
282
|
-
return function (key, value) {
|
|
283
|
-
if (stack.length > 0) {
|
|
284
|
-
var thisPos = stack.indexOf(this);
|
|
285
|
-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
286
|
-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
287
|
-
if (~stack.indexOf(value))
|
|
288
|
-
value = decycler.call(this, key, value);
|
|
289
|
-
}
|
|
290
|
-
else
|
|
291
|
-
stack.push(value);
|
|
292
|
-
return serializer == null ? value : serializer.call(this, key, value);
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
function isImmutableDefault(value) {
|
|
296
|
-
return typeof value !== "object" || value == null || Object.isFrozen(value);
|
|
297
|
-
}
|
|
298
|
-
function trackForMutations(isImmutable, ignorePaths, obj) {
|
|
299
|
-
var trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
|
|
300
|
-
return {
|
|
301
|
-
detectMutations: function () {
|
|
302
|
-
return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
|
|
307
|
-
if (ignorePaths === void 0) { ignorePaths = []; }
|
|
308
|
-
if (path === void 0) { path = ""; }
|
|
309
|
-
if (checkedObjects === void 0) { checkedObjects = new Set(); }
|
|
310
|
-
var tracked = { value: obj };
|
|
311
|
-
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
312
|
-
checkedObjects.add(obj);
|
|
313
|
-
tracked.children = {};
|
|
314
|
-
for (var key in obj) {
|
|
315
|
-
var childPath = path ? path + "." + key : key;
|
|
316
|
-
if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return tracked;
|
|
323
|
-
}
|
|
324
|
-
function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) {
|
|
325
|
-
if (ignoredPaths === void 0) { ignoredPaths = []; }
|
|
326
|
-
if (sameParentRef === void 0) { sameParentRef = false; }
|
|
327
|
-
if (path === void 0) { path = ""; }
|
|
328
|
-
var prevObj = trackedProperty ? trackedProperty.value : void 0;
|
|
329
|
-
var sameRef = prevObj === obj;
|
|
330
|
-
if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
|
|
331
|
-
return { wasMutated: true, path: path };
|
|
332
|
-
}
|
|
333
|
-
if (isImmutable(prevObj) || isImmutable(obj)) {
|
|
334
|
-
return { wasMutated: false };
|
|
335
|
-
}
|
|
336
|
-
var keysToDetect = {};
|
|
337
|
-
for (var key in trackedProperty.children) {
|
|
338
|
-
keysToDetect[key] = true;
|
|
339
|
-
}
|
|
340
|
-
for (var key in obj) {
|
|
341
|
-
keysToDetect[key] = true;
|
|
342
|
-
}
|
|
343
|
-
var hasIgnoredPaths = ignoredPaths.length > 0;
|
|
344
|
-
var _loop_1 = function (key) {
|
|
345
|
-
var nestedPath = path ? path + "." + key : key;
|
|
346
|
-
if (hasIgnoredPaths) {
|
|
347
|
-
var hasMatches = ignoredPaths.some(function (ignored) {
|
|
348
|
-
if (ignored instanceof RegExp) {
|
|
349
|
-
return ignored.test(nestedPath);
|
|
350
|
-
}
|
|
351
|
-
return nestedPath === ignored;
|
|
352
|
-
});
|
|
353
|
-
if (hasMatches) {
|
|
354
|
-
return "continue";
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
|
358
|
-
if (result.wasMutated) {
|
|
359
|
-
return { value: result };
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
for (var key in keysToDetect) {
|
|
363
|
-
var state_1 = _loop_1(key);
|
|
364
|
-
if (typeof state_1 === "object")
|
|
365
|
-
return state_1.value;
|
|
366
|
-
}
|
|
367
|
-
return { wasMutated: false };
|
|
368
|
-
}
|
|
369
|
-
function createImmutableStateInvariantMiddleware(options) {
|
|
370
|
-
if (options === void 0) { options = {}; }
|
|
371
|
-
if (process.env.NODE_ENV === "production") {
|
|
372
|
-
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
373
|
-
}
|
|
374
|
-
var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore;
|
|
375
|
-
ignoredPaths = ignoredPaths || ignore;
|
|
376
|
-
var track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
|
377
|
-
return function (_c) {
|
|
378
|
-
var getState = _c.getState;
|
|
379
|
-
var state = getState();
|
|
380
|
-
var tracker = track(state);
|
|
381
|
-
var result;
|
|
382
|
-
return function (next) { return function (action) {
|
|
383
|
-
var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
|
384
|
-
measureUtils.measureTime(function () {
|
|
385
|
-
state = getState();
|
|
386
|
-
result = tracker.detectMutations();
|
|
387
|
-
tracker = track(state);
|
|
388
|
-
invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
|
389
|
-
});
|
|
390
|
-
var dispatchedAction = next(action);
|
|
391
|
-
measureUtils.measureTime(function () {
|
|
392
|
-
state = getState();
|
|
393
|
-
result = tracker.detectMutations();
|
|
394
|
-
tracker = track(state);
|
|
395
|
-
result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
|
396
|
-
});
|
|
397
|
-
measureUtils.warnIfExceeded();
|
|
398
|
-
return dispatchedAction;
|
|
399
|
-
}; };
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
// src/serializableStateInvariantMiddleware.ts
|
|
403
|
-
function isPlain(val) {
|
|
404
|
-
var type = typeof val;
|
|
405
|
-
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
406
|
-
}
|
|
407
|
-
function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) {
|
|
408
|
-
if (path === void 0) { path = ""; }
|
|
409
|
-
if (isSerializable === void 0) { isSerializable = isPlain; }
|
|
410
|
-
if (ignoredPaths === void 0) { ignoredPaths = []; }
|
|
411
|
-
var foundNestedSerializable;
|
|
412
|
-
if (!isSerializable(value)) {
|
|
413
|
-
return {
|
|
414
|
-
keyPath: path || "<root>",
|
|
415
|
-
value: value
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
if (typeof value !== "object" || value === null) {
|
|
419
|
-
return false;
|
|
420
|
-
}
|
|
421
|
-
if (cache == null ? void 0 : cache.has(value))
|
|
422
|
-
return false;
|
|
423
|
-
var entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
|
424
|
-
var hasIgnoredPaths = ignoredPaths.length > 0;
|
|
425
|
-
var _loop_2 = function (key, nestedValue) {
|
|
426
|
-
var nestedPath = path ? path + "." + key : key;
|
|
427
|
-
if (hasIgnoredPaths) {
|
|
428
|
-
var hasMatches = ignoredPaths.some(function (ignored) {
|
|
429
|
-
if (ignored instanceof RegExp) {
|
|
430
|
-
return ignored.test(nestedPath);
|
|
431
|
-
}
|
|
432
|
-
return nestedPath === ignored;
|
|
433
|
-
});
|
|
434
|
-
if (hasMatches) {
|
|
435
|
-
return "continue";
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
if (!isSerializable(nestedValue)) {
|
|
439
|
-
return { value: {
|
|
440
|
-
keyPath: nestedPath,
|
|
441
|
-
value: nestedValue
|
|
442
|
-
} };
|
|
443
|
-
}
|
|
444
|
-
if (typeof nestedValue === "object") {
|
|
445
|
-
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
|
446
|
-
if (foundNestedSerializable) {
|
|
447
|
-
return { value: foundNestedSerializable };
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
452
|
-
var _c = entries_1[_i], key = _c[0], nestedValue = _c[1];
|
|
453
|
-
var state_2 = _loop_2(key, nestedValue);
|
|
454
|
-
if (typeof state_2 === "object")
|
|
455
|
-
return state_2.value;
|
|
456
|
-
}
|
|
457
|
-
if (cache && isNestedFrozen(value))
|
|
458
|
-
cache.add(value);
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
function isNestedFrozen(value) {
|
|
462
|
-
if (!Object.isFrozen(value))
|
|
463
|
-
return false;
|
|
464
|
-
for (var _i = 0, _c = Object.values(value); _i < _c.length; _i++) {
|
|
465
|
-
var nestedValue = _c[_i];
|
|
466
|
-
if (typeof nestedValue !== "object" || nestedValue === null)
|
|
467
|
-
continue;
|
|
468
|
-
if (!isNestedFrozen(nestedValue))
|
|
469
|
-
return false;
|
|
470
|
-
}
|
|
471
|
-
return true;
|
|
472
|
-
}
|
|
473
|
-
function createSerializableStateInvariantMiddleware(options) {
|
|
474
|
-
if (options === void 0) { options = {}; }
|
|
475
|
-
if (process.env.NODE_ENV === "production") {
|
|
476
|
-
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
477
|
-
}
|
|
478
|
-
var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j, _k = options.disableCache, disableCache = _k === void 0 ? false : _k;
|
|
479
|
-
var cache = !disableCache && WeakSet ? new WeakSet() : void 0;
|
|
480
|
-
return function (storeAPI) { return function (next) { return function (action) {
|
|
481
|
-
var result = next(action);
|
|
482
|
-
var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
|
483
|
-
if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
|
|
484
|
-
measureUtils.measureTime(function () {
|
|
485
|
-
var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
|
486
|
-
if (foundActionNonSerializableValue) {
|
|
487
|
-
var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value;
|
|
488
|
-
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
if (!ignoreState) {
|
|
493
|
-
measureUtils.measureTime(function () {
|
|
494
|
-
var state = storeAPI.getState();
|
|
495
|
-
var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
|
|
496
|
-
if (foundStateNonSerializableValue) {
|
|
497
|
-
var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value;
|
|
498
|
-
console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)");
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
measureUtils.warnIfExceeded();
|
|
502
|
-
}
|
|
503
|
-
return result;
|
|
504
|
-
}; }; };
|
|
505
|
-
}
|
|
506
|
-
// src/getDefaultMiddleware.ts
|
|
507
|
-
function isBoolean(x) {
|
|
508
|
-
return typeof x === "boolean";
|
|
509
|
-
}
|
|
510
|
-
function curryGetDefaultMiddleware() {
|
|
511
|
-
return function curriedGetDefaultMiddleware(options) {
|
|
512
|
-
return getDefaultMiddleware(options);
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
function getDefaultMiddleware(options) {
|
|
516
|
-
if (options === void 0) { options = {}; }
|
|
517
|
-
var _c = options.thunk, thunk$1 = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
|
|
518
|
-
var middlewareArray = new MiddlewareArray();
|
|
519
|
-
if (thunk$1) {
|
|
520
|
-
if (isBoolean(thunk$1)) {
|
|
521
|
-
middlewareArray.push(thunk);
|
|
522
|
-
}
|
|
523
|
-
else {
|
|
524
|
-
middlewareArray.push(thunk.withExtraArgument(thunk$1.extraArgument));
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
if (process.env.NODE_ENV !== "production") {
|
|
528
|
-
if (immutableCheck) {
|
|
529
|
-
var immutableOptions = {};
|
|
530
|
-
if (!isBoolean(immutableCheck)) {
|
|
531
|
-
immutableOptions = immutableCheck;
|
|
532
|
-
}
|
|
533
|
-
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
|
534
|
-
}
|
|
535
|
-
if (serializableCheck) {
|
|
536
|
-
var serializableOptions = {};
|
|
537
|
-
if (!isBoolean(serializableCheck)) {
|
|
538
|
-
serializableOptions = serializableCheck;
|
|
539
|
-
}
|
|
540
|
-
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
541
|
-
}
|
|
542
|
-
if (actionCreatorCheck) {
|
|
543
|
-
var actionCreatorOptions = {};
|
|
544
|
-
if (!isBoolean(actionCreatorCheck)) {
|
|
545
|
-
actionCreatorOptions = actionCreatorCheck;
|
|
546
|
-
}
|
|
547
|
-
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return middlewareArray;
|
|
551
|
-
}
|
|
552
|
-
// src/configureStore.ts
|
|
553
|
-
var IS_PRODUCTION = process.env.NODE_ENV === "production";
|
|
554
|
-
function configureStore(options) {
|
|
555
|
-
var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
|
|
556
|
-
var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h;
|
|
557
|
-
var rootReducer;
|
|
558
|
-
if (typeof reducer === "function") {
|
|
559
|
-
rootReducer = reducer;
|
|
560
|
-
}
|
|
561
|
-
else if (isPlainObject(reducer)) {
|
|
562
|
-
rootReducer = redux.combineReducers(reducer);
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');
|
|
566
|
-
}
|
|
567
|
-
var finalMiddleware = middleware;
|
|
568
|
-
if (typeof finalMiddleware === "function") {
|
|
569
|
-
finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware);
|
|
570
|
-
if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {
|
|
571
|
-
throw new Error("when using a middleware builder function, an array of middleware must be returned");
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (!IS_PRODUCTION && finalMiddleware.some(function (item) { return typeof item !== "function"; })) {
|
|
575
|
-
throw new Error("each middleware provided to configureStore must be a function");
|
|
576
|
-
}
|
|
577
|
-
var middlewareEnhancer = redux.applyMiddleware.apply(void 0, finalMiddleware);
|
|
578
|
-
var finalCompose = redux.compose;
|
|
579
|
-
if (devTools) {
|
|
580
|
-
finalCompose = composeWithDevTools(__spreadValues({
|
|
581
|
-
trace: !IS_PRODUCTION
|
|
582
|
-
}, typeof devTools === "object" && devTools));
|
|
583
|
-
}
|
|
584
|
-
var defaultEnhancers = new EnhancerArray(middlewareEnhancer);
|
|
585
|
-
var storeEnhancers = defaultEnhancers;
|
|
586
|
-
if (Array.isArray(enhancers)) {
|
|
587
|
-
storeEnhancers = __spreadArray([middlewareEnhancer], enhancers);
|
|
588
|
-
}
|
|
589
|
-
else if (typeof enhancers === "function") {
|
|
590
|
-
storeEnhancers = enhancers(defaultEnhancers);
|
|
591
|
-
}
|
|
592
|
-
var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
|
|
593
|
-
return redux.createStore(rootReducer, preloadedState, composedEnhancer);
|
|
594
|
-
}
|
|
595
|
-
var promise;
|
|
596
|
-
var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
|
|
597
|
-
throw err;
|
|
82
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
83
|
+
var extendStatics = function (d, b) {
|
|
84
|
+
extendStatics = Object.setPrototypeOf ||
|
|
85
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
86
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
87
|
+
return extendStatics(d, b);
|
|
88
|
+
};
|
|
89
|
+
return function (d, b) {
|
|
90
|
+
if (typeof b !== "function" && b !== null)
|
|
91
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
92
|
+
extendStatics(d, b);
|
|
93
|
+
function __() { this.constructor = d; }
|
|
94
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
95
|
+
};
|
|
96
|
+
})();
|
|
97
|
+
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
|
98
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
99
|
+
to[j] = from[i];
|
|
100
|
+
return to;
|
|
101
|
+
};
|
|
102
|
+
var __defProp = Object.defineProperty;
|
|
103
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
104
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
105
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
106
|
+
var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; };
|
|
107
|
+
var __spreadValues = function (a, b) {
|
|
108
|
+
for (var prop in b || (b = {}))
|
|
109
|
+
if (__hasOwnProp.call(b, prop))
|
|
110
|
+
__defNormalProp(a, prop, b[prop]);
|
|
111
|
+
if (__getOwnPropSymbols)
|
|
112
|
+
for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) {
|
|
113
|
+
var prop = _c[_i];
|
|
114
|
+
if (__propIsEnum.call(b, prop))
|
|
115
|
+
__defNormalProp(a, prop, b[prop]);
|
|
116
|
+
}
|
|
117
|
+
return a;
|
|
118
|
+
};
|
|
119
|
+
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () {
|
|
120
|
+
if (arguments.length === 0)
|
|
121
|
+
return void 0;
|
|
122
|
+
if (typeof arguments[0] === "object")
|
|
123
|
+
return redux.compose;
|
|
124
|
+
return redux.compose.apply(null, arguments);
|
|
125
|
+
};
|
|
126
|
+
// src/isPlainObject.ts
|
|
127
|
+
function isPlainObject(value) {
|
|
128
|
+
if (typeof value !== "object" || value === null)
|
|
129
|
+
return false;
|
|
130
|
+
var proto = Object.getPrototypeOf(value);
|
|
131
|
+
if (proto === null)
|
|
132
|
+
return true;
|
|
133
|
+
var baseProto = proto;
|
|
134
|
+
while (Object.getPrototypeOf(baseProto) !== null) {
|
|
135
|
+
baseProto = Object.getPrototypeOf(baseProto);
|
|
136
|
+
}
|
|
137
|
+
return proto === baseProto;
|
|
138
|
+
}
|
|
139
|
+
// src/tsHelpers.ts
|
|
140
|
+
var hasMatchFunction = function (v) {
|
|
141
|
+
return v && typeof v.match === "function";
|
|
142
|
+
};
|
|
143
|
+
function isActionCreator(action) {
|
|
144
|
+
return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
|
145
|
+
}
|
|
146
|
+
// src/actionCreatorInvariantMiddleware.ts
|
|
147
|
+
function getMessage(type) {
|
|
148
|
+
var splitType = type ? ("" + type).split("/") : [];
|
|
149
|
+
var actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
150
|
+
return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
|
|
151
|
+
}
|
|
152
|
+
function createActionCreatorInvariantMiddleware(options) {
|
|
153
|
+
if (options === void 0) { options = {}; }
|
|
154
|
+
if (process.env.NODE_ENV === "production") {
|
|
155
|
+
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
156
|
+
}
|
|
157
|
+
var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
|
|
158
|
+
return function () { return function (next) { return function (action) {
|
|
159
|
+
if (isActionCreator2(action)) {
|
|
160
|
+
console.warn(getMessage(action.type));
|
|
161
|
+
}
|
|
162
|
+
return next(action);
|
|
163
|
+
}; }; };
|
|
164
|
+
}
|
|
165
|
+
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
166
|
+
var elapsed = 0;
|
|
167
|
+
return {
|
|
168
|
+
measureTime: function (fn) {
|
|
169
|
+
var started = Date.now();
|
|
170
|
+
try {
|
|
171
|
+
return fn();
|
|
172
|
+
}
|
|
173
|
+
finally {
|
|
174
|
+
var finished = Date.now();
|
|
175
|
+
elapsed += finished - started;
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
warnIfExceeded: function () {
|
|
179
|
+
if (elapsed > maxDelay) {
|
|
180
|
+
console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
var MiddlewareArray = /** @class */ (function (_super) {
|
|
186
|
+
__extends(MiddlewareArray, _super);
|
|
187
|
+
function MiddlewareArray() {
|
|
188
|
+
var args = [];
|
|
189
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
190
|
+
args[_i] = arguments[_i];
|
|
191
|
+
}
|
|
192
|
+
var _this = _super.apply(this, args) || this;
|
|
193
|
+
Object.setPrototypeOf(_this, MiddlewareArray.prototype);
|
|
194
|
+
return _this;
|
|
195
|
+
}
|
|
196
|
+
Object.defineProperty(MiddlewareArray, Symbol.species, {
|
|
197
|
+
get: function () {
|
|
198
|
+
return MiddlewareArray;
|
|
199
|
+
},
|
|
200
|
+
enumerable: false,
|
|
201
|
+
configurable: true
|
|
202
|
+
});
|
|
203
|
+
MiddlewareArray.prototype.concat = function () {
|
|
204
|
+
var arr = [];
|
|
205
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
206
|
+
arr[_i] = arguments[_i];
|
|
207
|
+
}
|
|
208
|
+
return _super.prototype.concat.apply(this, arr);
|
|
209
|
+
};
|
|
210
|
+
MiddlewareArray.prototype.prepend = function () {
|
|
211
|
+
var arr = [];
|
|
212
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
213
|
+
arr[_i] = arguments[_i];
|
|
214
|
+
}
|
|
215
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
216
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
217
|
+
}
|
|
218
|
+
return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
|
|
219
|
+
};
|
|
220
|
+
return MiddlewareArray;
|
|
221
|
+
}(Array));
|
|
222
|
+
var EnhancerArray = /** @class */ (function (_super) {
|
|
223
|
+
__extends(EnhancerArray, _super);
|
|
224
|
+
function EnhancerArray() {
|
|
225
|
+
var args = [];
|
|
226
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
227
|
+
args[_i] = arguments[_i];
|
|
228
|
+
}
|
|
229
|
+
var _this = _super.apply(this, args) || this;
|
|
230
|
+
Object.setPrototypeOf(_this, EnhancerArray.prototype);
|
|
231
|
+
return _this;
|
|
232
|
+
}
|
|
233
|
+
Object.defineProperty(EnhancerArray, Symbol.species, {
|
|
234
|
+
get: function () {
|
|
235
|
+
return EnhancerArray;
|
|
236
|
+
},
|
|
237
|
+
enumerable: false,
|
|
238
|
+
configurable: true
|
|
239
|
+
});
|
|
240
|
+
EnhancerArray.prototype.concat = function () {
|
|
241
|
+
var arr = [];
|
|
242
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
243
|
+
arr[_i] = arguments[_i];
|
|
244
|
+
}
|
|
245
|
+
return _super.prototype.concat.apply(this, arr);
|
|
246
|
+
};
|
|
247
|
+
EnhancerArray.prototype.prepend = function () {
|
|
248
|
+
var arr = [];
|
|
249
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
250
|
+
arr[_i] = arguments[_i];
|
|
251
|
+
}
|
|
252
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
253
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
254
|
+
}
|
|
255
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))();
|
|
256
|
+
};
|
|
257
|
+
return EnhancerArray;
|
|
258
|
+
}(Array));
|
|
259
|
+
// src/immutableStateInvariantMiddleware.ts
|
|
260
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
261
|
+
var prefix = "Invariant failed";
|
|
262
|
+
function invariant(condition, message) {
|
|
263
|
+
if (condition) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (isProduction) {
|
|
267
|
+
throw new Error(prefix);
|
|
268
|
+
}
|
|
269
|
+
throw new Error(prefix + ": " + (message || ""));
|
|
270
|
+
}
|
|
271
|
+
function stringify(obj, serializer, indent, decycler) {
|
|
272
|
+
return JSON.stringify(obj, getSerialize(serializer, decycler), indent);
|
|
273
|
+
}
|
|
274
|
+
function getSerialize(serializer, decycler) {
|
|
275
|
+
var stack = [], keys = [];
|
|
276
|
+
if (!decycler)
|
|
277
|
+
decycler = function (_, value) {
|
|
278
|
+
if (stack[0] === value)
|
|
279
|
+
return "[Circular ~]";
|
|
280
|
+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
281
|
+
};
|
|
282
|
+
return function (key, value) {
|
|
283
|
+
if (stack.length > 0) {
|
|
284
|
+
var thisPos = stack.indexOf(this);
|
|
285
|
+
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
286
|
+
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
287
|
+
if (~stack.indexOf(value))
|
|
288
|
+
value = decycler.call(this, key, value);
|
|
289
|
+
}
|
|
290
|
+
else
|
|
291
|
+
stack.push(value);
|
|
292
|
+
return serializer == null ? value : serializer.call(this, key, value);
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function isImmutableDefault(value) {
|
|
296
|
+
return typeof value !== "object" || value == null || Object.isFrozen(value);
|
|
297
|
+
}
|
|
298
|
+
function trackForMutations(isImmutable, ignorePaths, obj) {
|
|
299
|
+
var trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
|
|
300
|
+
return {
|
|
301
|
+
detectMutations: function () {
|
|
302
|
+
return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
|
|
307
|
+
if (ignorePaths === void 0) { ignorePaths = []; }
|
|
308
|
+
if (path === void 0) { path = ""; }
|
|
309
|
+
if (checkedObjects === void 0) { checkedObjects = new Set(); }
|
|
310
|
+
var tracked = { value: obj };
|
|
311
|
+
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
312
|
+
checkedObjects.add(obj);
|
|
313
|
+
tracked.children = {};
|
|
314
|
+
for (var key in obj) {
|
|
315
|
+
var childPath = path ? path + "." + key : key;
|
|
316
|
+
if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return tracked;
|
|
323
|
+
}
|
|
324
|
+
function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) {
|
|
325
|
+
if (ignoredPaths === void 0) { ignoredPaths = []; }
|
|
326
|
+
if (sameParentRef === void 0) { sameParentRef = false; }
|
|
327
|
+
if (path === void 0) { path = ""; }
|
|
328
|
+
var prevObj = trackedProperty ? trackedProperty.value : void 0;
|
|
329
|
+
var sameRef = prevObj === obj;
|
|
330
|
+
if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
|
|
331
|
+
return { wasMutated: true, path: path };
|
|
332
|
+
}
|
|
333
|
+
if (isImmutable(prevObj) || isImmutable(obj)) {
|
|
334
|
+
return { wasMutated: false };
|
|
335
|
+
}
|
|
336
|
+
var keysToDetect = {};
|
|
337
|
+
for (var key in trackedProperty.children) {
|
|
338
|
+
keysToDetect[key] = true;
|
|
339
|
+
}
|
|
340
|
+
for (var key in obj) {
|
|
341
|
+
keysToDetect[key] = true;
|
|
342
|
+
}
|
|
343
|
+
var hasIgnoredPaths = ignoredPaths.length > 0;
|
|
344
|
+
var _loop_1 = function (key) {
|
|
345
|
+
var nestedPath = path ? path + "." + key : key;
|
|
346
|
+
if (hasIgnoredPaths) {
|
|
347
|
+
var hasMatches = ignoredPaths.some(function (ignored) {
|
|
348
|
+
if (ignored instanceof RegExp) {
|
|
349
|
+
return ignored.test(nestedPath);
|
|
350
|
+
}
|
|
351
|
+
return nestedPath === ignored;
|
|
352
|
+
});
|
|
353
|
+
if (hasMatches) {
|
|
354
|
+
return "continue";
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
|
358
|
+
if (result.wasMutated) {
|
|
359
|
+
return { value: result };
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
for (var key in keysToDetect) {
|
|
363
|
+
var state_1 = _loop_1(key);
|
|
364
|
+
if (typeof state_1 === "object")
|
|
365
|
+
return state_1.value;
|
|
366
|
+
}
|
|
367
|
+
return { wasMutated: false };
|
|
368
|
+
}
|
|
369
|
+
function createImmutableStateInvariantMiddleware(options) {
|
|
370
|
+
if (options === void 0) { options = {}; }
|
|
371
|
+
if (process.env.NODE_ENV === "production") {
|
|
372
|
+
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
373
|
+
}
|
|
374
|
+
var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore;
|
|
375
|
+
ignoredPaths = ignoredPaths || ignore;
|
|
376
|
+
var track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
|
377
|
+
return function (_c) {
|
|
378
|
+
var getState = _c.getState;
|
|
379
|
+
var state = getState();
|
|
380
|
+
var tracker = track(state);
|
|
381
|
+
var result;
|
|
382
|
+
return function (next) { return function (action) {
|
|
383
|
+
var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
|
384
|
+
measureUtils.measureTime(function () {
|
|
385
|
+
state = getState();
|
|
386
|
+
result = tracker.detectMutations();
|
|
387
|
+
tracker = track(state);
|
|
388
|
+
invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
|
389
|
+
});
|
|
390
|
+
var dispatchedAction = next(action);
|
|
391
|
+
measureUtils.measureTime(function () {
|
|
392
|
+
state = getState();
|
|
393
|
+
result = tracker.detectMutations();
|
|
394
|
+
tracker = track(state);
|
|
395
|
+
result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
|
396
|
+
});
|
|
397
|
+
measureUtils.warnIfExceeded();
|
|
398
|
+
return dispatchedAction;
|
|
399
|
+
}; };
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
// src/serializableStateInvariantMiddleware.ts
|
|
403
|
+
function isPlain(val) {
|
|
404
|
+
var type = typeof val;
|
|
405
|
+
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
406
|
+
}
|
|
407
|
+
function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) {
|
|
408
|
+
if (path === void 0) { path = ""; }
|
|
409
|
+
if (isSerializable === void 0) { isSerializable = isPlain; }
|
|
410
|
+
if (ignoredPaths === void 0) { ignoredPaths = []; }
|
|
411
|
+
var foundNestedSerializable;
|
|
412
|
+
if (!isSerializable(value)) {
|
|
413
|
+
return {
|
|
414
|
+
keyPath: path || "<root>",
|
|
415
|
+
value: value
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
if (typeof value !== "object" || value === null) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
if (cache == null ? void 0 : cache.has(value))
|
|
422
|
+
return false;
|
|
423
|
+
var entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
|
424
|
+
var hasIgnoredPaths = ignoredPaths.length > 0;
|
|
425
|
+
var _loop_2 = function (key, nestedValue) {
|
|
426
|
+
var nestedPath = path ? path + "." + key : key;
|
|
427
|
+
if (hasIgnoredPaths) {
|
|
428
|
+
var hasMatches = ignoredPaths.some(function (ignored) {
|
|
429
|
+
if (ignored instanceof RegExp) {
|
|
430
|
+
return ignored.test(nestedPath);
|
|
431
|
+
}
|
|
432
|
+
return nestedPath === ignored;
|
|
433
|
+
});
|
|
434
|
+
if (hasMatches) {
|
|
435
|
+
return "continue";
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (!isSerializable(nestedValue)) {
|
|
439
|
+
return { value: {
|
|
440
|
+
keyPath: nestedPath,
|
|
441
|
+
value: nestedValue
|
|
442
|
+
} };
|
|
443
|
+
}
|
|
444
|
+
if (typeof nestedValue === "object") {
|
|
445
|
+
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
|
446
|
+
if (foundNestedSerializable) {
|
|
447
|
+
return { value: foundNestedSerializable };
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
452
|
+
var _c = entries_1[_i], key = _c[0], nestedValue = _c[1];
|
|
453
|
+
var state_2 = _loop_2(key, nestedValue);
|
|
454
|
+
if (typeof state_2 === "object")
|
|
455
|
+
return state_2.value;
|
|
456
|
+
}
|
|
457
|
+
if (cache && isNestedFrozen(value))
|
|
458
|
+
cache.add(value);
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
function isNestedFrozen(value) {
|
|
462
|
+
if (!Object.isFrozen(value))
|
|
463
|
+
return false;
|
|
464
|
+
for (var _i = 0, _c = Object.values(value); _i < _c.length; _i++) {
|
|
465
|
+
var nestedValue = _c[_i];
|
|
466
|
+
if (typeof nestedValue !== "object" || nestedValue === null)
|
|
467
|
+
continue;
|
|
468
|
+
if (!isNestedFrozen(nestedValue))
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
function createSerializableStateInvariantMiddleware(options) {
|
|
474
|
+
if (options === void 0) { options = {}; }
|
|
475
|
+
if (process.env.NODE_ENV === "production") {
|
|
476
|
+
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
477
|
+
}
|
|
478
|
+
var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j, _k = options.disableCache, disableCache = _k === void 0 ? false : _k;
|
|
479
|
+
var cache = !disableCache && WeakSet ? new WeakSet() : void 0;
|
|
480
|
+
return function (storeAPI) { return function (next) { return function (action) {
|
|
481
|
+
var result = next(action);
|
|
482
|
+
var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
|
483
|
+
if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
|
|
484
|
+
measureUtils.measureTime(function () {
|
|
485
|
+
var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
|
486
|
+
if (foundActionNonSerializableValue) {
|
|
487
|
+
var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value;
|
|
488
|
+
console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
if (!ignoreState) {
|
|
493
|
+
measureUtils.measureTime(function () {
|
|
494
|
+
var state = storeAPI.getState();
|
|
495
|
+
var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
|
|
496
|
+
if (foundStateNonSerializableValue) {
|
|
497
|
+
var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value;
|
|
498
|
+
console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)");
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
measureUtils.warnIfExceeded();
|
|
502
|
+
}
|
|
503
|
+
return result;
|
|
504
|
+
}; }; };
|
|
505
|
+
}
|
|
506
|
+
// src/getDefaultMiddleware.ts
|
|
507
|
+
function isBoolean(x) {
|
|
508
|
+
return typeof x === "boolean";
|
|
509
|
+
}
|
|
510
|
+
function curryGetDefaultMiddleware() {
|
|
511
|
+
return function curriedGetDefaultMiddleware(options) {
|
|
512
|
+
return getDefaultMiddleware(options);
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function getDefaultMiddleware(options) {
|
|
516
|
+
if (options === void 0) { options = {}; }
|
|
517
|
+
var _c = options.thunk, thunk$1 = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
|
|
518
|
+
var middlewareArray = new MiddlewareArray();
|
|
519
|
+
if (thunk$1) {
|
|
520
|
+
if (isBoolean(thunk$1)) {
|
|
521
|
+
middlewareArray.push(thunk);
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
middlewareArray.push(thunk.withExtraArgument(thunk$1.extraArgument));
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (process.env.NODE_ENV !== "production") {
|
|
528
|
+
if (immutableCheck) {
|
|
529
|
+
var immutableOptions = {};
|
|
530
|
+
if (!isBoolean(immutableCheck)) {
|
|
531
|
+
immutableOptions = immutableCheck;
|
|
532
|
+
}
|
|
533
|
+
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
|
534
|
+
}
|
|
535
|
+
if (serializableCheck) {
|
|
536
|
+
var serializableOptions = {};
|
|
537
|
+
if (!isBoolean(serializableCheck)) {
|
|
538
|
+
serializableOptions = serializableCheck;
|
|
539
|
+
}
|
|
540
|
+
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
541
|
+
}
|
|
542
|
+
if (actionCreatorCheck) {
|
|
543
|
+
var actionCreatorOptions = {};
|
|
544
|
+
if (!isBoolean(actionCreatorCheck)) {
|
|
545
|
+
actionCreatorOptions = actionCreatorCheck;
|
|
546
|
+
}
|
|
547
|
+
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return middlewareArray;
|
|
551
|
+
}
|
|
552
|
+
// src/configureStore.ts
|
|
553
|
+
var IS_PRODUCTION = process.env.NODE_ENV === "production";
|
|
554
|
+
function configureStore(options) {
|
|
555
|
+
var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
|
|
556
|
+
var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h;
|
|
557
|
+
var rootReducer;
|
|
558
|
+
if (typeof reducer === "function") {
|
|
559
|
+
rootReducer = reducer;
|
|
560
|
+
}
|
|
561
|
+
else if (isPlainObject(reducer)) {
|
|
562
|
+
rootReducer = redux.combineReducers(reducer);
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');
|
|
566
|
+
}
|
|
567
|
+
var finalMiddleware = middleware;
|
|
568
|
+
if (typeof finalMiddleware === "function") {
|
|
569
|
+
finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware);
|
|
570
|
+
if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {
|
|
571
|
+
throw new Error("when using a middleware builder function, an array of middleware must be returned");
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (!IS_PRODUCTION && finalMiddleware.some(function (item) { return typeof item !== "function"; })) {
|
|
575
|
+
throw new Error("each middleware provided to configureStore must be a function");
|
|
576
|
+
}
|
|
577
|
+
var middlewareEnhancer = redux.applyMiddleware.apply(void 0, finalMiddleware);
|
|
578
|
+
var finalCompose = redux.compose;
|
|
579
|
+
if (devTools) {
|
|
580
|
+
finalCompose = composeWithDevTools(__spreadValues({
|
|
581
|
+
trace: !IS_PRODUCTION
|
|
582
|
+
}, typeof devTools === "object" && devTools));
|
|
583
|
+
}
|
|
584
|
+
var defaultEnhancers = new EnhancerArray(middlewareEnhancer);
|
|
585
|
+
var storeEnhancers = defaultEnhancers;
|
|
586
|
+
if (Array.isArray(enhancers)) {
|
|
587
|
+
storeEnhancers = __spreadArray([middlewareEnhancer], enhancers);
|
|
588
|
+
}
|
|
589
|
+
else if (typeof enhancers === "function") {
|
|
590
|
+
storeEnhancers = enhancers(defaultEnhancers);
|
|
591
|
+
}
|
|
592
|
+
var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
|
|
593
|
+
return redux.createStore(rootReducer, preloadedState, composedEnhancer);
|
|
594
|
+
}
|
|
595
|
+
var promise;
|
|
596
|
+
var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
|
|
597
|
+
throw err;
|
|
598
598
|
}, 0); }); };
|
|
599
599
|
|
|
600
600
|
function _arrayLikeToArray(r, a) {
|
|
@@ -8336,15 +8336,25 @@ var getPendingMessagesMap = function getPendingMessagesMap() {
|
|
|
8336
8336
|
return pendingMessagesMap;
|
|
8337
8337
|
};
|
|
8338
8338
|
var draftMessagesMap = {};
|
|
8339
|
+
var audioRecordingMap = {};
|
|
8339
8340
|
var getDraftMessageFromMap = function getDraftMessageFromMap(channelId) {
|
|
8340
8341
|
return draftMessagesMap[channelId];
|
|
8341
8342
|
};
|
|
8343
|
+
var getAudioRecordingFromMap = function getAudioRecordingFromMap(channelId) {
|
|
8344
|
+
return audioRecordingMap[channelId];
|
|
8345
|
+
};
|
|
8342
8346
|
var checkDraftMessagesIsEmpty = function checkDraftMessagesIsEmpty() {
|
|
8343
8347
|
return Object.keys(draftMessagesMap).length === 0;
|
|
8344
8348
|
};
|
|
8349
|
+
var setAudioRecordingToMap = function setAudioRecordingToMap(channelId, audioRecording) {
|
|
8350
|
+
audioRecordingMap[channelId] = audioRecording;
|
|
8351
|
+
};
|
|
8345
8352
|
var removeDraftMessageFromMap = function removeDraftMessageFromMap(channelId) {
|
|
8346
8353
|
delete draftMessagesMap[channelId];
|
|
8347
8354
|
};
|
|
8355
|
+
var removeAudioRecordingFromMap = function removeAudioRecordingFromMap(channelId) {
|
|
8356
|
+
delete audioRecordingMap[channelId];
|
|
8357
|
+
};
|
|
8348
8358
|
var setDraftMessageToMap = function setDraftMessageToMap(channelId, draftMessage) {
|
|
8349
8359
|
draftMessagesMap[channelId] = draftMessage;
|
|
8350
8360
|
};
|
|
@@ -19625,11 +19635,14 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
|
|
|
19625
19635
|
typingOrRecording = _ref2.typingOrRecording,
|
|
19626
19636
|
channel = _ref2.channel,
|
|
19627
19637
|
isDirectChannel = _ref2.isDirectChannel;
|
|
19638
|
+
var audioRecording = React.useMemo(function () {
|
|
19639
|
+
return getAudioRecordingFromMap(channel.id);
|
|
19640
|
+
}, [channel.id, draftMessageText]);
|
|
19628
19641
|
return /*#__PURE__*/React__default.createElement(MessageTextContainer, null, isTypingOrRecording && (/*#__PURE__*/React__default.createElement(TypingIndicator, null, !isDirectChannel && /*#__PURE__*/React__default.createElement(Points, {
|
|
19629
19642
|
color: textPrimary
|
|
19630
19643
|
}, ":"), typingOrRecording.isTyping ? 'typing' : 'recording', "...")), !isTypingOrRecording && (draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageText, {
|
|
19631
19644
|
color: textSecondary
|
|
19632
|
-
}, draftMessageText)) : lastMessage.state === MESSAGE_STATUS.DELETE ? 'Message was deleted.' : lastMessage.type === 'system' ? (lastMessage.user && (lastMessage.user.id === user.id ? 'You ' : makeUsername(lastMessage.user && contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts))) + " " + (lastMessage.body === 'CC' ? 'created this channel' : lastMessage.body === 'CG' ? 'created this group' : lastMessage.body === 'AM' ? " added " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.slice(0, 5).map(function (mem) {
|
|
19645
|
+
}, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), draftMessageText)) : lastMessage.state === MESSAGE_STATUS.DELETE ? 'Message was deleted.' : lastMessage.type === 'system' ? (lastMessage.user && (lastMessage.user.id === user.id ? 'You ' : makeUsername(lastMessage.user && contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts))) + " " + (lastMessage.body === 'CC' ? 'created this channel' : lastMessage.body === 'CG' ? 'created this group' : lastMessage.body === 'AM' ? " added " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.slice(0, 5).map(function (mem) {
|
|
19633
19646
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
19634
19647
|
})) + " " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.length > 5 ? "and " + (lastMessageMetas.m.length - 5) + " more" : '') : lastMessage.body === 'RM' ? " removed " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.slice(0, 5).map(function (mem) {
|
|
19635
19648
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
@@ -19723,8 +19736,13 @@ var Channel = function Channel(_ref3) {
|
|
|
19723
19736
|
React.useEffect(function () {
|
|
19724
19737
|
if (activeChannel.id !== channel.id) {
|
|
19725
19738
|
var channelDraftMessage = getDraftMessageFromMap(channel.id);
|
|
19726
|
-
|
|
19727
|
-
|
|
19739
|
+
var draftAudioRecording = getAudioRecordingFromMap(channel.id);
|
|
19740
|
+
if (channelDraftMessage || draftAudioRecording) {
|
|
19741
|
+
if (channelDraftMessage) {
|
|
19742
|
+
setDraftMessageText(channelDraftMessage.text);
|
|
19743
|
+
} else if (draftAudioRecording) {
|
|
19744
|
+
setDraftMessageText('Voice');
|
|
19745
|
+
}
|
|
19728
19746
|
} else if (draftMessageText) {
|
|
19729
19747
|
setDraftMessageText(undefined);
|
|
19730
19748
|
}
|
|
@@ -19934,7 +19952,7 @@ var Container$2 = styled__default.div(_templateObject6$1 || (_templateObject6$1
|
|
|
19934
19952
|
var DraftMessageTitle = styled__default.span(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n color: ", ";\n"])), function (props) {
|
|
19935
19953
|
return props.color;
|
|
19936
19954
|
});
|
|
19937
|
-
var DraftMessageText = styled__default.span(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteralLoose(["\n color: ", ";\n"])), function (props) {
|
|
19955
|
+
var DraftMessageText = styled__default.span(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteralLoose(["\n color: ", ";\n display: flex;\n align-items: flex-end;\n gap: 4px;\n"])), function (props) {
|
|
19938
19956
|
return props.color;
|
|
19939
19957
|
});
|
|
19940
19958
|
var LastMessageAuthor = styled__default.div(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n max-width: 120px;\n font-weight: 500;\n color: ", ";\n\n ", "\n & > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n }\n"])), function (props) {
|
|
@@ -33864,9 +33882,77 @@ function SvgRecordButton(props) {
|
|
|
33864
33882
|
var _templateObject$G, _templateObject2$B, _templateObject3$u, _templateObject4$q, _templateObject5$m, _templateObject6$i, _templateObject7$g;
|
|
33865
33883
|
var shouldDraw = false;
|
|
33866
33884
|
var AudioRecord = function AudioRecord(_ref) {
|
|
33867
|
-
var
|
|
33885
|
+
var sendRecordedFile = _ref.sendRecordedFile,
|
|
33886
|
+
setShowRecording = _ref.setShowRecording,
|
|
33887
|
+
showRecording = _ref.showRecording,
|
|
33888
|
+
channelId = _ref.channelId;
|
|
33889
|
+
var _useColor = useColors(),
|
|
33890
|
+
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
33891
|
+
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
|
|
33892
|
+
warningColor = _useColor[THEME_COLORS.WARNING],
|
|
33893
|
+
iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
|
|
33894
|
+
surface1 = _useColor[THEME_COLORS.SURFACE_1];
|
|
33895
|
+
var _useState = React.useState(null),
|
|
33896
|
+
recording = _useState[0],
|
|
33897
|
+
setStartRecording = _useState[1];
|
|
33898
|
+
var _useState2 = React.useState(null),
|
|
33899
|
+
recorder = _useState2[0],
|
|
33900
|
+
setRecorder = _useState2[1];
|
|
33901
|
+
var _useState3 = React.useState(null),
|
|
33902
|
+
recordedFile = _useState3[0],
|
|
33903
|
+
setRecordedFile = _useState3[1];
|
|
33904
|
+
var _useState4 = React.useState(false),
|
|
33905
|
+
recordingIsReadyToPlay = _useState4[0],
|
|
33906
|
+
setRecordingIsReadyToPlay = _useState4[1];
|
|
33907
|
+
var _useState5 = React.useState(0),
|
|
33908
|
+
currentTime = _useState5[0],
|
|
33909
|
+
setCurrentTime = _useState5[1];
|
|
33910
|
+
var _useState6 = React.useState(null),
|
|
33911
|
+
sendingInterval = _useState6[0],
|
|
33912
|
+
setSendingInterval = _useState6[1];
|
|
33913
|
+
var _useState7 = React.useState(''),
|
|
33914
|
+
currentChannelId = _useState7[0],
|
|
33915
|
+
setCurrentChannelId = _useState7[1];
|
|
33916
|
+
var _useState8 = React.useState(false),
|
|
33917
|
+
playAudio = _useState8[0],
|
|
33918
|
+
setPlayAudio = _useState8[1];
|
|
33919
|
+
var wavesurferContainer = React.useRef(null);
|
|
33920
|
+
var recordButtonRef = React.useRef(null);
|
|
33921
|
+
var wavesurfer = React.useRef({});
|
|
33922
|
+
var intervalRef = React.useRef({});
|
|
33923
|
+
var currentRecordedFile = React.useMemo(function () {
|
|
33924
|
+
var current = getAudioRecordingFromMap(currentChannelId) || recordedFile;
|
|
33925
|
+
return current;
|
|
33926
|
+
}, [recordedFile, currentChannelId]);
|
|
33927
|
+
React.useEffect(function () {
|
|
33928
|
+
if (currentRecordedFile) {
|
|
33929
|
+
setRecordedFile(currentRecordedFile);
|
|
33930
|
+
}
|
|
33931
|
+
}, [currentRecordedFile]);
|
|
33932
|
+
var dispatch = reactRedux.useDispatch();
|
|
33933
|
+
var handleStartRecording = function handleStartRecording() {
|
|
33934
|
+
dispatch(sendRecordingAC(true));
|
|
33935
|
+
if (sendingInterval) {
|
|
33936
|
+
clearInterval(sendingInterval);
|
|
33937
|
+
setSendingInterval(null);
|
|
33938
|
+
return;
|
|
33939
|
+
}
|
|
33940
|
+
var interval = setInterval(function () {
|
|
33941
|
+
dispatch(sendRecordingAC(true));
|
|
33942
|
+
}, 1000);
|
|
33943
|
+
setSendingInterval(interval);
|
|
33944
|
+
};
|
|
33945
|
+
var handleStopRecording = function handleStopRecording() {
|
|
33946
|
+
dispatch(sendRecordingAC(false));
|
|
33947
|
+
if (sendingInterval) {
|
|
33948
|
+
clearInterval(sendingInterval);
|
|
33949
|
+
setSendingInterval(null);
|
|
33950
|
+
}
|
|
33951
|
+
};
|
|
33952
|
+
var startRecording = function startRecording(cId) {
|
|
33868
33953
|
try {
|
|
33869
|
-
var
|
|
33954
|
+
var id = cId || currentChannelId;
|
|
33955
|
+
var _temp = _catch(function () {
|
|
33870
33956
|
return Promise.resolve(navigator.permissions.query({
|
|
33871
33957
|
name: 'microphone'
|
|
33872
33958
|
})).then(function (permissionStatus) {
|
|
@@ -33876,18 +33962,27 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33876
33962
|
recordButtonRef.current.style.pointerEvents = 'none';
|
|
33877
33963
|
}
|
|
33878
33964
|
if (recording) {
|
|
33879
|
-
stopRecording(true);
|
|
33880
|
-
} else if (
|
|
33881
|
-
|
|
33965
|
+
stopRecording(true, id, false, recorder);
|
|
33966
|
+
} else if (currentRecordedFile) {
|
|
33967
|
+
var _wavesurfer$current;
|
|
33968
|
+
removeAudioRecordingFromMap(id);
|
|
33882
33969
|
setRecordedFile(null);
|
|
33883
33970
|
setPlayAudio(false);
|
|
33884
|
-
if (wavesurfer.current) {
|
|
33885
|
-
wavesurfer.current.destroy();
|
|
33971
|
+
if ((_wavesurfer$current = wavesurfer.current) !== null && _wavesurfer$current !== void 0 && _wavesurfer$current[id]) {
|
|
33972
|
+
wavesurfer.current[id].destroy();
|
|
33886
33973
|
}
|
|
33887
33974
|
setStartRecording(false);
|
|
33888
33975
|
setShowRecording(false);
|
|
33976
|
+
dispatch(setChannelDraftMessageIsRemovedAC(id));
|
|
33977
|
+
sendRecordedFile(currentRecordedFile, id);
|
|
33889
33978
|
} else {
|
|
33890
33979
|
handleStartRecording();
|
|
33980
|
+
setAudioRecordingToMap(id, {
|
|
33981
|
+
file: null,
|
|
33982
|
+
objectUrl: null,
|
|
33983
|
+
thumb: null,
|
|
33984
|
+
dur: 0
|
|
33985
|
+
});
|
|
33891
33986
|
recorder.start().then(function () {
|
|
33892
33987
|
recordButtonRef.current.style.pointerEvents = 'initial';
|
|
33893
33988
|
setShowRecording(true);
|
|
@@ -33895,8 +33990,8 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33895
33990
|
shouldDraw = true;
|
|
33896
33991
|
var stream = recorder.activeStream;
|
|
33897
33992
|
var obj = {};
|
|
33898
|
-
function init() {
|
|
33899
|
-
obj.canvas = document.getElementById(
|
|
33993
|
+
var init = function init() {
|
|
33994
|
+
obj.canvas = document.getElementById("waveform-" + id);
|
|
33900
33995
|
obj.ctx = obj.canvas.getContext('2d');
|
|
33901
33996
|
obj.width = 360;
|
|
33902
33997
|
obj.height = 28;
|
|
@@ -33904,10 +33999,10 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33904
33999
|
obj.canvas.height = obj.height;
|
|
33905
34000
|
obj.canvas.style.width = obj.width + 'px';
|
|
33906
34001
|
obj.canvas.style.height = obj.height + 'px';
|
|
33907
|
-
}
|
|
34002
|
+
};
|
|
33908
34003
|
var timeOffset = 100;
|
|
33909
34004
|
var now = parseInt(performance.now()) / timeOffset;
|
|
33910
|
-
function loop() {
|
|
34005
|
+
var _loop = function loop() {
|
|
33911
34006
|
if (!shouldDraw) {
|
|
33912
34007
|
obj.x = 0;
|
|
33913
34008
|
obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
|
|
@@ -33935,10 +34030,10 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33935
34030
|
});
|
|
33936
34031
|
}
|
|
33937
34032
|
draw();
|
|
33938
|
-
requestAnimationFrame(
|
|
33939
|
-
}
|
|
34033
|
+
requestAnimationFrame(_loop);
|
|
34034
|
+
};
|
|
33940
34035
|
obj.bars = [];
|
|
33941
|
-
function draw() {
|
|
34036
|
+
var draw = function draw() {
|
|
33942
34037
|
for (var i = 0; i < obj.bars.length; i++) {
|
|
33943
34038
|
var bar = obj.bars[i];
|
|
33944
34039
|
obj.ctx.fillStyle = textSecondary;
|
|
@@ -33948,8 +34043,8 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33948
34043
|
obj.bars.splice(i, 1);
|
|
33949
34044
|
}
|
|
33950
34045
|
}
|
|
33951
|
-
}
|
|
33952
|
-
function soundAllowed(stream) {
|
|
34046
|
+
};
|
|
34047
|
+
var soundAllowed = function soundAllowed(stream) {
|
|
33953
34048
|
var AudioContext = window.AudioContext || window.webkitAudioContext;
|
|
33954
34049
|
var audioContent = new AudioContext();
|
|
33955
34050
|
var streamSource = audioContent.createMediaStreamSource(stream);
|
|
@@ -33958,8 +34053,8 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33958
34053
|
obj.analyser.fftSize = 512;
|
|
33959
34054
|
obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
|
|
33960
34055
|
init();
|
|
33961
|
-
|
|
33962
|
-
}
|
|
34056
|
+
_loop();
|
|
34057
|
+
};
|
|
33963
34058
|
soundAllowed(stream);
|
|
33964
34059
|
})["catch"](function (e) {
|
|
33965
34060
|
handleStopRecording();
|
|
@@ -33971,72 +34066,21 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
33971
34066
|
handleStopRecording();
|
|
33972
34067
|
log.error(e);
|
|
33973
34068
|
});
|
|
33974
|
-
return Promise.resolve(
|
|
34069
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
33975
34070
|
} catch (e) {
|
|
33976
34071
|
return Promise.reject(e);
|
|
33977
34072
|
}
|
|
33978
34073
|
};
|
|
33979
|
-
var
|
|
33980
|
-
setShowRecording = _ref.setShowRecording,
|
|
33981
|
-
showRecording = _ref.showRecording;
|
|
33982
|
-
var _useColor = useColors(),
|
|
33983
|
-
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
33984
|
-
textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
|
|
33985
|
-
warningColor = _useColor[THEME_COLORS.WARNING],
|
|
33986
|
-
iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
|
|
33987
|
-
surface1 = _useColor[THEME_COLORS.SURFACE_1];
|
|
33988
|
-
var _useState = React.useState(null),
|
|
33989
|
-
recording = _useState[0],
|
|
33990
|
-
setStartRecording = _useState[1];
|
|
33991
|
-
var _useState2 = React.useState(null),
|
|
33992
|
-
recorder = _useState2[0],
|
|
33993
|
-
setRecorder = _useState2[1];
|
|
33994
|
-
var _useState3 = React.useState(null),
|
|
33995
|
-
recordedFile = _useState3[0],
|
|
33996
|
-
setRecordedFile = _useState3[1];
|
|
33997
|
-
var _useState4 = React.useState(false),
|
|
33998
|
-
recordingIsReadyToPlay = _useState4[0],
|
|
33999
|
-
setRecordingIsReadyToPlay = _useState4[1];
|
|
34000
|
-
var _useState5 = React.useState(0),
|
|
34001
|
-
currentTime = _useState5[0],
|
|
34002
|
-
setCurrentTime = _useState5[1];
|
|
34003
|
-
var _useState6 = React.useState(null),
|
|
34004
|
-
sendingInterval = _useState6[0],
|
|
34005
|
-
setSendingInterval = _useState6[1];
|
|
34006
|
-
var _useState7 = React.useState(false),
|
|
34007
|
-
playAudio = _useState7[0],
|
|
34008
|
-
setPlayAudio = _useState7[1];
|
|
34009
|
-
var wavesurfer = React.useRef(null);
|
|
34010
|
-
var wavesurferContainer = React.useRef(null);
|
|
34011
|
-
var intervalRef = React.useRef(null);
|
|
34012
|
-
var recordButtonRef = React.useRef(null);
|
|
34013
|
-
var dispatch = reactRedux.useDispatch();
|
|
34014
|
-
var handleStartRecording = function handleStartRecording() {
|
|
34015
|
-
dispatch(sendRecordingAC(true));
|
|
34016
|
-
if (sendingInterval) {
|
|
34017
|
-
clearInterval(sendingInterval);
|
|
34018
|
-
setSendingInterval(null);
|
|
34019
|
-
return;
|
|
34020
|
-
}
|
|
34021
|
-
var interval = setInterval(function () {
|
|
34022
|
-
dispatch(sendRecordingAC(true));
|
|
34023
|
-
}, 1000);
|
|
34024
|
-
setSendingInterval(interval);
|
|
34025
|
-
};
|
|
34026
|
-
var handleStopRecording = function handleStopRecording() {
|
|
34027
|
-
dispatch(sendRecordingAC(false));
|
|
34028
|
-
if (sendingInterval) {
|
|
34029
|
-
clearInterval(sendingInterval);
|
|
34030
|
-
setSendingInterval(null);
|
|
34031
|
-
}
|
|
34032
|
-
};
|
|
34033
|
-
function cancelRecording() {
|
|
34074
|
+
var cancelRecording = React.useCallback(function () {
|
|
34034
34075
|
handleStopRecording();
|
|
34035
|
-
if (
|
|
34076
|
+
if (currentRecordedFile) {
|
|
34077
|
+
var _wavesurfer$current2;
|
|
34078
|
+
removeAudioRecordingFromMap(currentChannelId);
|
|
34079
|
+
dispatch(setChannelDraftMessageIsRemovedAC(currentChannelId));
|
|
34036
34080
|
setRecordedFile(null);
|
|
34037
34081
|
setPlayAudio(false);
|
|
34038
|
-
if (wavesurfer.current) {
|
|
34039
|
-
wavesurfer.current.destroy();
|
|
34082
|
+
if ((_wavesurfer$current2 = wavesurfer.current) !== null && _wavesurfer$current2 !== void 0 && _wavesurfer$current2[currentChannelId]) {
|
|
34083
|
+
wavesurfer.current[currentChannelId].destroy();
|
|
34040
34084
|
}
|
|
34041
34085
|
} else {
|
|
34042
34086
|
shouldDraw = false;
|
|
@@ -34046,13 +34090,128 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34046
34090
|
setStartRecording(false);
|
|
34047
34091
|
setCurrentTime(0);
|
|
34048
34092
|
setShowRecording(false);
|
|
34049
|
-
}
|
|
34050
|
-
function
|
|
34093
|
+
}, [currentRecordedFile, currentChannelId, wavesurfer, setShowRecording, setRecordedFile]);
|
|
34094
|
+
var _initWaveSurfer = function initWaveSurfer(draft, cId, audioRecording, container) {
|
|
34095
|
+
try {
|
|
34096
|
+
var _exit = false;
|
|
34097
|
+
return Promise.resolve(_catch(function () {
|
|
34098
|
+
var _wavesurfer$current3;
|
|
34099
|
+
function _temp3(_result3) {
|
|
34100
|
+
if (_exit) return _result3;
|
|
34101
|
+
if (draft) {
|
|
34102
|
+
return;
|
|
34103
|
+
}
|
|
34104
|
+
wavesurfer.current[id].on('ready', function () {
|
|
34105
|
+
setRecordingIsReadyToPlay(true);
|
|
34106
|
+
var audioDuration = wavesurfer.current[id].getDuration();
|
|
34107
|
+
setCurrentTime(audioDuration);
|
|
34108
|
+
});
|
|
34109
|
+
wavesurfer.current[id].on('finish', function () {
|
|
34110
|
+
setPlayAudio(false);
|
|
34111
|
+
wavesurfer.current[id].seekTo(0);
|
|
34112
|
+
var audioDuration = wavesurfer.current[id].getDuration();
|
|
34113
|
+
setCurrentTime(audioDuration);
|
|
34114
|
+
clearInterval(intervalRef.current[id]);
|
|
34115
|
+
});
|
|
34116
|
+
wavesurfer.current[id].on('pause', function () {
|
|
34117
|
+
setPlayAudio(false);
|
|
34118
|
+
clearInterval(intervalRef.current[id]);
|
|
34119
|
+
});
|
|
34120
|
+
wavesurfer.current[id].on('interaction', function () {
|
|
34121
|
+
var currentTime = wavesurfer.current[id].getCurrentTime();
|
|
34122
|
+
setCurrentTime(currentTime);
|
|
34123
|
+
});
|
|
34124
|
+
}
|
|
34125
|
+
if (draft) {
|
|
34126
|
+
return;
|
|
34127
|
+
}
|
|
34128
|
+
var id = cId || currentChannelId;
|
|
34129
|
+
if ((_wavesurfer$current3 = wavesurfer.current) !== null && _wavesurfer$current3 !== void 0 && _wavesurfer$current3[id]) {
|
|
34130
|
+
setRecordingIsReadyToPlay(true);
|
|
34131
|
+
var audioDuration = wavesurfer.current[id].getDuration();
|
|
34132
|
+
setCurrentTime(audioDuration);
|
|
34133
|
+
}
|
|
34134
|
+
var _temp2 = function (_wavesurfer$current4) {
|
|
34135
|
+
if (!((_wavesurfer$current4 = wavesurfer.current) !== null && _wavesurfer$current4 !== void 0 && _wavesurfer$current4[id])) {
|
|
34136
|
+
var _ref2;
|
|
34137
|
+
var containerElement = wavesurferContainer.current || container;
|
|
34138
|
+
if (!containerElement) {
|
|
34139
|
+
setTimeout(function () {
|
|
34140
|
+
return _initWaveSurfer(draft, cId, audioRecording, container);
|
|
34141
|
+
}, 100);
|
|
34142
|
+
_exit = true;
|
|
34143
|
+
return;
|
|
34144
|
+
}
|
|
34145
|
+
var rect = containerElement.getBoundingClientRect();
|
|
34146
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
34147
|
+
setTimeout(function () {
|
|
34148
|
+
return _initWaveSurfer(draft, cId, audioRecording, container);
|
|
34149
|
+
}, 100);
|
|
34150
|
+
_exit = true;
|
|
34151
|
+
return;
|
|
34152
|
+
}
|
|
34153
|
+
var ws = WaveSurfer.create({
|
|
34154
|
+
container: containerElement,
|
|
34155
|
+
waveColor: textSecondary,
|
|
34156
|
+
progressColor: accentColor,
|
|
34157
|
+
barWidth: 1,
|
|
34158
|
+
barHeight: 2,
|
|
34159
|
+
audioRate: 1,
|
|
34160
|
+
hideScrollbar: true,
|
|
34161
|
+
barRadius: 1.5,
|
|
34162
|
+
cursorWidth: 0,
|
|
34163
|
+
barGap: 2.5,
|
|
34164
|
+
height: 28
|
|
34165
|
+
});
|
|
34166
|
+
var peaks = [];
|
|
34167
|
+
if ((_ref2 = audioRecording || currentRecordedFile) !== null && _ref2 !== void 0 && _ref2.thumb) {
|
|
34168
|
+
var _ref3;
|
|
34169
|
+
var thumbData = (_ref3 = audioRecording || currentRecordedFile) === null || _ref3 === void 0 ? void 0 : _ref3.thumb;
|
|
34170
|
+
if (Array.isArray(thumbData) && thumbData.length > 0) {
|
|
34171
|
+
var maxVal = Math.max.apply(Math, thumbData);
|
|
34172
|
+
if (maxVal > 0 && isFinite(maxVal)) {
|
|
34173
|
+
var dec = maxVal / 100;
|
|
34174
|
+
peaks = thumbData.map(function (peak) {
|
|
34175
|
+
var normalizedPeak = peak / dec / 100;
|
|
34176
|
+
return isFinite(normalizedPeak) ? normalizedPeak : 0;
|
|
34177
|
+
}).filter(function (peak) {
|
|
34178
|
+
return isFinite(peak);
|
|
34179
|
+
});
|
|
34180
|
+
if (peaks.length === 0) {
|
|
34181
|
+
peaks = [];
|
|
34182
|
+
}
|
|
34183
|
+
}
|
|
34184
|
+
}
|
|
34185
|
+
}
|
|
34186
|
+
wavesurfer.current[id] = ws;
|
|
34187
|
+
return _catch(function () {
|
|
34188
|
+
var validPeaks = peaks.length > 0 ? peaks : undefined;
|
|
34189
|
+
return Promise.resolve(wavesurfer.current[id].loadBlob((audioRecording === null || audioRecording === void 0 ? void 0 : audioRecording.file) || (currentRecordedFile === null || currentRecordedFile === void 0 ? void 0 : currentRecordedFile.file), validPeaks)).then(function () {});
|
|
34190
|
+
}, function () {
|
|
34191
|
+
return _catch(function () {
|
|
34192
|
+
return Promise.resolve(wavesurfer.current[id].loadBlob((audioRecording === null || audioRecording === void 0 ? void 0 : audioRecording.file) || (currentRecordedFile === null || currentRecordedFile === void 0 ? void 0 : currentRecordedFile.file))).then(function () {});
|
|
34193
|
+
}, function (fallbackError) {
|
|
34194
|
+
console.error('Failed to load audio completely:', fallbackError);
|
|
34195
|
+
throw fallbackError;
|
|
34196
|
+
});
|
|
34197
|
+
});
|
|
34198
|
+
}
|
|
34199
|
+
}();
|
|
34200
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
34201
|
+
}, function (e) {
|
|
34202
|
+
log.error('Failed to init wavesurfer', e);
|
|
34203
|
+
}));
|
|
34204
|
+
} catch (e) {
|
|
34205
|
+
return Promise.reject(e);
|
|
34206
|
+
}
|
|
34207
|
+
};
|
|
34208
|
+
var stopRecording = React.useCallback(function (send, cId, draft, recorder, container) {
|
|
34051
34209
|
handleStopRecording();
|
|
34052
34210
|
shouldDraw = false;
|
|
34053
|
-
|
|
34054
|
-
|
|
34055
|
-
|
|
34211
|
+
var id = cId || channelId;
|
|
34212
|
+
recorder.stop().getMp3().then(function (_ref4) {
|
|
34213
|
+
var buffer = _ref4[0],
|
|
34214
|
+
blob = _ref4[1];
|
|
34056
34215
|
setCurrentTime(0);
|
|
34057
34216
|
var file = new File(buffer, 'record.mp3', {
|
|
34058
34217
|
type: blob.type,
|
|
@@ -34080,15 +34239,29 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34080
34239
|
objectUrl: objectUrl,
|
|
34081
34240
|
thumb: waveform,
|
|
34082
34241
|
dur: audioBuffer.duration
|
|
34083
|
-
});
|
|
34242
|
+
}, id);
|
|
34084
34243
|
setShowRecording(false);
|
|
34244
|
+
removeAudioRecordingFromMap(id);
|
|
34245
|
+
dispatch(setChannelDraftMessageIsRemovedAC(id));
|
|
34085
34246
|
} else {
|
|
34086
|
-
|
|
34247
|
+
if (!draft) {
|
|
34248
|
+
setRecordedFile({
|
|
34249
|
+
file: file,
|
|
34250
|
+
objectUrl: objectUrl,
|
|
34251
|
+
thumb: waveform,
|
|
34252
|
+
dur: audioBuffer.duration
|
|
34253
|
+
});
|
|
34254
|
+
}
|
|
34255
|
+
var audioRecording = {
|
|
34087
34256
|
file: file,
|
|
34088
34257
|
objectUrl: objectUrl,
|
|
34089
34258
|
thumb: waveform,
|
|
34090
34259
|
dur: audioBuffer.duration
|
|
34091
|
-
}
|
|
34260
|
+
};
|
|
34261
|
+
setAudioRecordingToMap(id, audioRecording);
|
|
34262
|
+
if (draft) {
|
|
34263
|
+
_initWaveSurfer(draft, id, audioRecording, container);
|
|
34264
|
+
}
|
|
34092
34265
|
}
|
|
34093
34266
|
}, function (e) {
|
|
34094
34267
|
log.info('Error decoding audio data: ' + e.err);
|
|
@@ -34099,14 +34272,15 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34099
34272
|
handleStopRecording();
|
|
34100
34273
|
log.error(e);
|
|
34101
34274
|
});
|
|
34102
|
-
}
|
|
34103
|
-
var handlePlayPause = function handlePlayPause() {
|
|
34104
|
-
|
|
34105
|
-
|
|
34275
|
+
}, [sendRecordedFile, setShowRecording, setAudioRecordingToMap, setRecordedFile, handleStopRecording, channelId]);
|
|
34276
|
+
var handlePlayPause = function handlePlayPause(cId) {
|
|
34277
|
+
var _wavesurfer$current5;
|
|
34278
|
+
if ((_wavesurfer$current5 = wavesurfer.current) !== null && _wavesurfer$current5 !== void 0 && _wavesurfer$current5[cId || currentChannelId]) {
|
|
34279
|
+
if (!wavesurfer.current[cId || currentChannelId].isPlaying()) {
|
|
34106
34280
|
setPlayAudio(true);
|
|
34107
34281
|
handleStartRecording();
|
|
34108
|
-
intervalRef.current = setInterval(function () {
|
|
34109
|
-
var currentTime = wavesurfer.current.getCurrentTime();
|
|
34282
|
+
intervalRef.current[cId || currentChannelId] = setInterval(function () {
|
|
34283
|
+
var currentTime = wavesurfer.current[cId || currentChannelId].getCurrentTime();
|
|
34110
34284
|
if (currentTime >= 0) {
|
|
34111
34285
|
setCurrentTime(currentTime);
|
|
34112
34286
|
}
|
|
@@ -34114,7 +34288,7 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34114
34288
|
} else {
|
|
34115
34289
|
handleStopRecording();
|
|
34116
34290
|
}
|
|
34117
|
-
wavesurfer.current.playPause();
|
|
34291
|
+
wavesurfer.current[cId || currentChannelId].playPause();
|
|
34118
34292
|
}
|
|
34119
34293
|
};
|
|
34120
34294
|
React.useEffect(function () {
|
|
@@ -34126,7 +34300,7 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34126
34300
|
setCurrentTime(function (prevState) {
|
|
34127
34301
|
if (prevState.recordingSeconds === MAX_RECORDER_TIME) {
|
|
34128
34302
|
clearInterval(recordingInterval);
|
|
34129
|
-
stopRecording();
|
|
34303
|
+
stopRecording(false, currentChannelId, false, recorder);
|
|
34130
34304
|
return 0;
|
|
34131
34305
|
}
|
|
34132
34306
|
return prevState + 1;
|
|
@@ -34141,132 +34315,133 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34141
34315
|
clearInterval(recordingInterval);
|
|
34142
34316
|
};
|
|
34143
34317
|
}, [recording]);
|
|
34144
|
-
|
|
34145
|
-
if (
|
|
34146
|
-
|
|
34147
|
-
try {
|
|
34148
|
-
try {
|
|
34149
|
-
if (wavesurfer.current) {
|
|
34150
|
-
wavesurfer.current.destroy();
|
|
34151
|
-
}
|
|
34152
|
-
wavesurfer.current = WaveSurfer.create({
|
|
34153
|
-
container: wavesurferContainer.current,
|
|
34154
|
-
waveColor: textSecondary,
|
|
34155
|
-
progressColor: accentColor,
|
|
34156
|
-
barWidth: 1,
|
|
34157
|
-
barHeight: 2,
|
|
34158
|
-
audioRate: 1,
|
|
34159
|
-
hideScrollbar: true,
|
|
34160
|
-
barRadius: 1.5,
|
|
34161
|
-
cursorWidth: 0,
|
|
34162
|
-
barGap: 2.5,
|
|
34163
|
-
height: 28
|
|
34164
|
-
});
|
|
34165
|
-
wavesurfer.current.load(recordedFile.objectUrl);
|
|
34166
|
-
wavesurfer.current.on('ready', function () {
|
|
34167
|
-
setRecordingIsReadyToPlay(true);
|
|
34168
|
-
var audioDuration = wavesurfer.current.getDuration();
|
|
34169
|
-
setCurrentTime(audioDuration);
|
|
34170
|
-
});
|
|
34171
|
-
wavesurfer.current.on('finish', function () {
|
|
34172
|
-
setPlayAudio(false);
|
|
34173
|
-
wavesurfer.current.seekTo(0);
|
|
34174
|
-
var audioDuration = wavesurfer.current.getDuration();
|
|
34175
|
-
setCurrentTime(audioDuration);
|
|
34176
|
-
clearInterval(intervalRef.current);
|
|
34177
|
-
});
|
|
34178
|
-
wavesurfer.current.on('pause', function () {
|
|
34179
|
-
setPlayAudio(false);
|
|
34180
|
-
clearInterval(intervalRef.current);
|
|
34181
|
-
});
|
|
34182
|
-
wavesurfer.current.on('interaction', function () {
|
|
34183
|
-
var currentTime = wavesurfer.current.getCurrentTime();
|
|
34184
|
-
setCurrentTime(currentTime);
|
|
34185
|
-
});
|
|
34186
|
-
} catch (e) {
|
|
34187
|
-
log.error('Failed to init wavesurfer', e);
|
|
34188
|
-
}
|
|
34189
|
-
return Promise.resolve();
|
|
34190
|
-
} catch (e) {
|
|
34191
|
-
return Promise.reject(e);
|
|
34192
|
-
}
|
|
34193
|
-
};
|
|
34194
|
-
initWaveSurfer();
|
|
34318
|
+
React.useEffect(function () {
|
|
34319
|
+
if (currentRecordedFile) {
|
|
34320
|
+
_initWaveSurfer();
|
|
34195
34321
|
} else {
|
|
34322
|
+
var _wavesurfer$current6;
|
|
34196
34323
|
setRecordingIsReadyToPlay(false);
|
|
34197
|
-
|
|
34198
|
-
|
|
34324
|
+
if (intervalRef.current[currentChannelId]) {
|
|
34325
|
+
clearInterval(intervalRef.current[currentChannelId]);
|
|
34326
|
+
intervalRef.current[currentChannelId] = null;
|
|
34327
|
+
}
|
|
34328
|
+
if ((_wavesurfer$current6 = wavesurfer.current) !== null && _wavesurfer$current6 !== void 0 && _wavesurfer$current6[currentChannelId]) {
|
|
34329
|
+
wavesurfer.current[currentChannelId].destroy();
|
|
34330
|
+
wavesurfer.current[currentChannelId] = null;
|
|
34331
|
+
}
|
|
34199
34332
|
}
|
|
34200
34333
|
return function () {
|
|
34201
|
-
|
|
34334
|
+
for (var key in intervalRef.current) {
|
|
34335
|
+
if (intervalRef.current[key]) {
|
|
34336
|
+
clearInterval(intervalRef.current[key]);
|
|
34337
|
+
intervalRef.current[key] = null;
|
|
34338
|
+
}
|
|
34339
|
+
}
|
|
34340
|
+
for (var _key in wavesurfer.current) {
|
|
34341
|
+
if (wavesurfer.current[_key]) {
|
|
34342
|
+
wavesurfer.current[_key].destroy();
|
|
34343
|
+
wavesurfer.current[_key] = null;
|
|
34344
|
+
}
|
|
34345
|
+
}
|
|
34202
34346
|
};
|
|
34203
|
-
}, [
|
|
34347
|
+
}, [currentRecordedFile, currentChannelId]);
|
|
34204
34348
|
React.useEffect(function () {
|
|
34205
|
-
|
|
34206
|
-
|
|
34207
|
-
|
|
34208
|
-
|
|
34209
|
-
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34349
|
+
if (!currentRecordedFile) {
|
|
34350
|
+
(function () {
|
|
34351
|
+
try {
|
|
34352
|
+
var _temp5 = function () {
|
|
34353
|
+
if (!recorder) {
|
|
34354
|
+
var _temp4 = _catch(function () {
|
|
34355
|
+
return Promise.resolve(new Promise(function (resolve) { resolve(_interopNamespace(require('mic-recorder-to-mp3'))); })).then(function (MicRecorderModule) {
|
|
34356
|
+
var MicRecorder = MicRecorderModule["default"];
|
|
34357
|
+
var recorder = new MicRecorder({
|
|
34358
|
+
bitRate: 128
|
|
34359
|
+
});
|
|
34360
|
+
setRecorder(recorder);
|
|
34214
34361
|
});
|
|
34215
|
-
|
|
34362
|
+
}, function (e) {
|
|
34363
|
+
log.error('Failed to init mic-recorder-to-mp3', e);
|
|
34216
34364
|
});
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
|
|
34223
|
-
|
|
34224
|
-
}
|
|
34225
|
-
|
|
34226
|
-
|
|
34227
|
-
})();
|
|
34228
|
-
}, []);
|
|
34365
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
34366
|
+
}
|
|
34367
|
+
}();
|
|
34368
|
+
return _temp5 && _temp5.then ? _temp5.then(function () {}) : void 0;
|
|
34369
|
+
} catch (e) {
|
|
34370
|
+
Promise.reject(e);
|
|
34371
|
+
}
|
|
34372
|
+
})();
|
|
34373
|
+
}
|
|
34374
|
+
}, [currentRecordedFile]);
|
|
34229
34375
|
React.useEffect(function () {
|
|
34230
34376
|
return function () {
|
|
34231
34377
|
handleStopRecording();
|
|
34232
34378
|
};
|
|
34233
34379
|
}, [showRecording]);
|
|
34380
|
+
React.useEffect(function () {
|
|
34381
|
+
if (channelId && (showRecording || currentRecordedFile)) {
|
|
34382
|
+
if (!currentRecordedFile) {
|
|
34383
|
+
stopRecording(false, currentChannelId, true, recorder, wavesurferContainer.current);
|
|
34384
|
+
}
|
|
34385
|
+
if (playAudio) {
|
|
34386
|
+
handlePlayPause(channelId);
|
|
34387
|
+
}
|
|
34388
|
+
for (var key in intervalRef.current) {
|
|
34389
|
+
clearInterval(intervalRef.current[key]);
|
|
34390
|
+
intervalRef.current[key] = null;
|
|
34391
|
+
}
|
|
34392
|
+
for (var _key2 in wavesurfer.current) {
|
|
34393
|
+
var _wavesurfer$current$_;
|
|
34394
|
+
(_wavesurfer$current$_ = wavesurfer.current[_key2]) === null || _wavesurfer$current$_ === void 0 ? void 0 : _wavesurfer$current$_.destroy();
|
|
34395
|
+
wavesurfer.current[_key2] = null;
|
|
34396
|
+
}
|
|
34397
|
+
setShowRecording(false);
|
|
34398
|
+
setStartRecording(false);
|
|
34399
|
+
setPlayAudio(false);
|
|
34400
|
+
setCurrentTime(0);
|
|
34401
|
+
var audioRecording = getAudioRecordingFromMap(channelId);
|
|
34402
|
+
setRecordedFile(audioRecording || null);
|
|
34403
|
+
setRecordingIsReadyToPlay(!!audioRecording);
|
|
34404
|
+
}
|
|
34405
|
+
setCurrentChannelId(channelId);
|
|
34406
|
+
}, [channelId]);
|
|
34234
34407
|
return /*#__PURE__*/React__default.createElement(Container$j, {
|
|
34235
|
-
recording: showRecording
|
|
34236
|
-
}, showRecording && (/*#__PURE__*/React__default.createElement(PlayPause$1, {
|
|
34408
|
+
recording: showRecording || currentRecordedFile
|
|
34409
|
+
}, (showRecording || currentRecordedFile) && (/*#__PURE__*/React__default.createElement(PlayPause$1, {
|
|
34237
34410
|
iconColor: iconPrimary,
|
|
34238
34411
|
onClick: function onClick() {
|
|
34239
34412
|
return cancelRecording();
|
|
34240
34413
|
}
|
|
34241
34414
|
}, /*#__PURE__*/React__default.createElement(SvgClose, null))), /*#__PURE__*/React__default.createElement(AudioWrapper, {
|
|
34242
34415
|
backgroundColor: surface1,
|
|
34243
|
-
recording: recording ||
|
|
34416
|
+
recording: recording || currentRecordedFile
|
|
34244
34417
|
}, recording && (/*#__PURE__*/React__default.createElement(PlayPause$1, {
|
|
34245
34418
|
iconColor: warningColor,
|
|
34246
34419
|
onClick: function onClick() {
|
|
34247
|
-
return stopRecording();
|
|
34420
|
+
return stopRecording(false, currentChannelId, false, recorder);
|
|
34248
34421
|
}
|
|
34249
34422
|
}, /*#__PURE__*/React__default.createElement(SvgStopRecord, null))), /*#__PURE__*/React__default.createElement(Canvas, {
|
|
34250
|
-
hide:
|
|
34251
|
-
id:
|
|
34423
|
+
hide: currentRecordedFile,
|
|
34424
|
+
id: "waveform-" + channelId,
|
|
34252
34425
|
recording: recording
|
|
34253
34426
|
}), recording && /*#__PURE__*/React__default.createElement(Timer$2, {
|
|
34254
34427
|
color: textSecondary
|
|
34255
|
-
}, formatAudioVideoTime(currentTime)), recordingIsReadyToPlay && (/*#__PURE__*/React__default.createElement(PlayPause$1, {
|
|
34428
|
+
}, formatAudioVideoTime(currentTime)), (recordingIsReadyToPlay || currentRecordedFile) && (/*#__PURE__*/React__default.createElement(PlayPause$1, {
|
|
34256
34429
|
iconColor: accentColor,
|
|
34257
|
-
onClick:
|
|
34430
|
+
onClick: function onClick() {
|
|
34431
|
+
return handlePlayPause(channelId);
|
|
34432
|
+
}
|
|
34258
34433
|
}, playAudio ? /*#__PURE__*/React__default.createElement(SvgPauseRecord, null) : /*#__PURE__*/React__default.createElement(SvgPlayRecord, null))), /*#__PURE__*/React__default.createElement(AudioVisualization$1, {
|
|
34259
34434
|
ref: wavesurferContainer,
|
|
34260
|
-
show:
|
|
34261
|
-
}), recordingIsReadyToPlay && /*#__PURE__*/React__default.createElement(Timer$2, {
|
|
34435
|
+
show: currentRecordedFile
|
|
34436
|
+
}), (recordingIsReadyToPlay || currentRecordedFile) && (/*#__PURE__*/React__default.createElement(Timer$2, {
|
|
34262
34437
|
color: textSecondary
|
|
34263
|
-
}, formatAudioVideoTime(currentTime))), /*#__PURE__*/React__default.createElement(RecordIconWrapper, {
|
|
34438
|
+
}, formatAudioVideoTime(currentTime)))), /*#__PURE__*/React__default.createElement(RecordIconWrapper, {
|
|
34264
34439
|
ref: recordButtonRef,
|
|
34265
34440
|
onClick: function onClick() {
|
|
34266
|
-
return startRecording();
|
|
34441
|
+
return startRecording(currentChannelId);
|
|
34267
34442
|
},
|
|
34268
34443
|
iconColor: accentColor
|
|
34269
|
-
}, showRecording ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
|
|
34444
|
+
}, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
|
|
34270
34445
|
};
|
|
34271
34446
|
var Container$j = styled__default.div(_templateObject$G || (_templateObject$G = _taggedTemplateLiteralLoose(["\n width: 32px;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n ", ";\n transition: all 0.3s ease-in-out;\n"])), function (props) {
|
|
34272
34447
|
return props.recording && "width: 400px";
|
|
@@ -34283,14 +34458,14 @@ var AudioWrapper = styled__default.div(_templateObject2$B || (_templateObject2$B
|
|
|
34283
34458
|
var RecordIconWrapper = styled__default.span(_templateObject3$u || (_templateObject3$u = _taggedTemplateLiteralLoose(["\n display: flex;\n cursor: pointer;\n > svg {\n color: ", ";\n }\n"])), function (props) {
|
|
34284
34459
|
return props.iconColor;
|
|
34285
34460
|
});
|
|
34286
|
-
var AudioVisualization$1 = styled__default.div(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n position: absolute;\n opacity: ", ";\n z-index: ", ";\n visibility: ", ";\n width: 300px;\n height: 28px;\n max-width: calc(100% - 100px);\n left: 40px;\n background-color: ", ";\n"])), function (
|
|
34287
|
-
var show =
|
|
34461
|
+
var AudioVisualization$1 = styled__default.div(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n position: absolute;\n opacity: ", ";\n z-index: ", ";\n visibility: ", ";\n width: 300px;\n height: 28px;\n max-width: calc(100% - 100px);\n left: 40px;\n background-color: ", ";\n"])), function (_ref5) {
|
|
34462
|
+
var show = _ref5.show;
|
|
34288
34463
|
return show ? '1' : '0';
|
|
34289
|
-
}, function (
|
|
34290
|
-
var show =
|
|
34464
|
+
}, function (_ref6) {
|
|
34465
|
+
var show = _ref6.show;
|
|
34291
34466
|
return !show && '-1';
|
|
34292
|
-
}, function (
|
|
34293
|
-
var show =
|
|
34467
|
+
}, function (_ref7) {
|
|
34468
|
+
var show = _ref7.show;
|
|
34294
34469
|
return show ? 'visible' : 'hidden';
|
|
34295
34470
|
}, function (props) {
|
|
34296
34471
|
return props.color;
|
|
@@ -34298,14 +34473,14 @@ var AudioVisualization$1 = styled__default.div(_templateObject4$q || (_templateO
|
|
|
34298
34473
|
var PlayPause$1 = styled__default.div(_templateObject5$m || (_templateObject5$m = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n padding: 10px;\n > svg {\n color: ", ";\n }\n"])), function (props) {
|
|
34299
34474
|
return props.iconColor;
|
|
34300
34475
|
});
|
|
34301
|
-
var Canvas = styled__default.canvas(_templateObject6$i || (_templateObject6$i = _taggedTemplateLiteralLoose(["\n height: 28px;\n width: ", ";\n max-width: calc(100% - 110px);\n position: absolute;\n opacity: ", ";\n z-index: ", ";\n left: 42px;\n"])), function (
|
|
34302
|
-
var recording =
|
|
34476
|
+
var Canvas = styled__default.canvas(_templateObject6$i || (_templateObject6$i = _taggedTemplateLiteralLoose(["\n height: 28px;\n width: ", ";\n max-width: calc(100% - 110px);\n position: absolute;\n opacity: ", ";\n z-index: ", ";\n left: 42px;\n"])), function (_ref8) {
|
|
34477
|
+
var recording = _ref8.recording;
|
|
34303
34478
|
return recording ? '300px' : '0';
|
|
34304
|
-
}, function (
|
|
34305
|
-
var hide =
|
|
34479
|
+
}, function (_ref9) {
|
|
34480
|
+
var hide = _ref9.hide;
|
|
34306
34481
|
return hide ? '0' : '1';
|
|
34307
|
-
}, function (
|
|
34308
|
-
var hide =
|
|
34482
|
+
}, function (_ref0) {
|
|
34483
|
+
var hide = _ref0.hide;
|
|
34309
34484
|
return hide && '-1';
|
|
34310
34485
|
});
|
|
34311
34486
|
var Timer$2 = styled__default.div(_templateObject7$g || (_templateObject7$g = _taggedTemplateLiteralLoose(["\n width: 40px;\n font-weight: 400;\n font-size: 16px;\n line-height: 12px;\n color: ", ";\n margin-left: auto;\n"])), function (props) {
|
|
@@ -34509,92 +34684,89 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34509
34684
|
var _useState = React.useState(false),
|
|
34510
34685
|
showRecording = _useState[0],
|
|
34511
34686
|
setShowRecording = _useState[1];
|
|
34512
|
-
var _useState2 = React.useState(null),
|
|
34513
|
-
recordedFile = _useState2[0],
|
|
34514
|
-
setRecordedFile = _useState2[1];
|
|
34515
34687
|
var _usePermissions = usePermissions(activeChannel.userRole),
|
|
34516
34688
|
checkActionPermission = _usePermissions[0];
|
|
34517
|
-
var
|
|
34518
|
-
listenerIsAdded =
|
|
34519
|
-
setListenerIsAdded =
|
|
34689
|
+
var _useState2 = React.useState(false),
|
|
34690
|
+
listenerIsAdded = _useState2[0],
|
|
34691
|
+
setListenerIsAdded = _useState2[1];
|
|
34692
|
+
var _useState3 = React.useState(''),
|
|
34693
|
+
messageText = _useState3[0],
|
|
34694
|
+
setMessageText = _useState3[1];
|
|
34520
34695
|
var _useState4 = React.useState(''),
|
|
34521
|
-
|
|
34522
|
-
|
|
34523
|
-
var _useState5 = React.useState(
|
|
34524
|
-
|
|
34525
|
-
|
|
34526
|
-
var _useState6 = React.useState(
|
|
34527
|
-
|
|
34528
|
-
|
|
34696
|
+
editMessageText = _useState4[0],
|
|
34697
|
+
setEditMessageText = _useState4[1];
|
|
34698
|
+
var _useState5 = React.useState({}),
|
|
34699
|
+
readyVideoAttachments = _useState5[0],
|
|
34700
|
+
setReadyVideoAttachments = _useState5[1];
|
|
34701
|
+
var _useState6 = React.useState(false),
|
|
34702
|
+
showChooseAttachmentType = _useState6[0],
|
|
34703
|
+
setShowChooseAttachmentType = _useState6[1];
|
|
34529
34704
|
var _useState7 = React.useState(false),
|
|
34530
|
-
|
|
34531
|
-
|
|
34705
|
+
isEmojisOpened = _useState7[0],
|
|
34706
|
+
setIsEmojisOpened = _useState7[1];
|
|
34532
34707
|
var _useState8 = React.useState(false),
|
|
34533
|
-
|
|
34534
|
-
|
|
34535
|
-
var _useState9 = React.useState(
|
|
34536
|
-
|
|
34537
|
-
|
|
34708
|
+
emojisInRightSide = _useState8[0],
|
|
34709
|
+
setEmojisInRightSide = _useState8[1];
|
|
34710
|
+
var _useState9 = React.useState(0),
|
|
34711
|
+
emojisPopupLeftPosition = _useState9[0],
|
|
34712
|
+
setEmojisPopupLeftPosition = _useState9[1];
|
|
34538
34713
|
var _useState0 = React.useState(0),
|
|
34539
|
-
|
|
34540
|
-
|
|
34541
|
-
var _useState1 = React.useState(
|
|
34542
|
-
|
|
34543
|
-
|
|
34544
|
-
var _useState10 = React.useState(
|
|
34545
|
-
addAttachmentsInRightSide = _useState10[0],
|
|
34546
|
-
setAddAttachmentsInRightSide = _useState10[1];
|
|
34547
|
-
var _useState11 = React.useState({
|
|
34714
|
+
emojisPopupBottomPosition = _useState0[0],
|
|
34715
|
+
setEmojisPopupBottomPosition = _useState0[1];
|
|
34716
|
+
var _useState1 = React.useState(false),
|
|
34717
|
+
addAttachmentsInRightSide = _useState1[0],
|
|
34718
|
+
setAddAttachmentsInRightSide = _useState1[1];
|
|
34719
|
+
var _useState10 = React.useState({
|
|
34548
34720
|
clear: false
|
|
34549
34721
|
}),
|
|
34550
|
-
shouldClearEditor =
|
|
34551
|
-
setShouldClearEditor =
|
|
34722
|
+
shouldClearEditor = _useState10[0],
|
|
34723
|
+
setShouldClearEditor = _useState10[1];
|
|
34724
|
+
var _useState11 = React.useState([]),
|
|
34725
|
+
messageBodyAttributes = _useState11[0],
|
|
34726
|
+
setMessageBodyAttributes = _useState11[1];
|
|
34552
34727
|
var _useState12 = React.useState([]),
|
|
34553
|
-
|
|
34554
|
-
|
|
34555
|
-
var _useState13 = React.useState(
|
|
34556
|
-
|
|
34557
|
-
|
|
34558
|
-
var _useState14 = React.useState(
|
|
34559
|
-
|
|
34560
|
-
|
|
34561
|
-
var _useState15 = React.useState(
|
|
34562
|
-
|
|
34563
|
-
|
|
34564
|
-
var _useState16 = React.useState(),
|
|
34565
|
-
inputContainerHeight = _useState16[0],
|
|
34566
|
-
setInputContainerHeight = _useState16[1];
|
|
34728
|
+
mentionedMembers = _useState12[0],
|
|
34729
|
+
setMentionedMembers = _useState12[1];
|
|
34730
|
+
var _useState13 = React.useState(''),
|
|
34731
|
+
browser = _useState13[0],
|
|
34732
|
+
setBrowser = _useState13[1];
|
|
34733
|
+
var _useState14 = React.useState(false),
|
|
34734
|
+
mentionsIsOpen = _useState14[0],
|
|
34735
|
+
setMentionsIsOpen = _useState14[1];
|
|
34736
|
+
var _useState15 = React.useState(),
|
|
34737
|
+
inputContainerHeight = _useState15[0],
|
|
34738
|
+
setInputContainerHeight = _useState15[1];
|
|
34567
34739
|
var selectedText = React.useRef(null);
|
|
34740
|
+
var _useState16 = React.useState(),
|
|
34741
|
+
typingTimout = _useState16[0],
|
|
34742
|
+
setTypingTimout = _useState16[1];
|
|
34568
34743
|
var _useState17 = React.useState(),
|
|
34569
|
-
|
|
34570
|
-
|
|
34571
|
-
var _useState18 = React.useState(),
|
|
34572
|
-
|
|
34573
|
-
|
|
34744
|
+
inTypingStateTimout = _useState17[0],
|
|
34745
|
+
setInTypingStateTimout = _useState17[1];
|
|
34746
|
+
var _useState18 = React.useState(false),
|
|
34747
|
+
inTypingState = _useState18[0],
|
|
34748
|
+
setInTypingState = _useState18[1];
|
|
34574
34749
|
var _useState19 = React.useState(false),
|
|
34575
|
-
|
|
34576
|
-
|
|
34577
|
-
var _useState20 = React.useState(
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
var _useState21 = React.useState(
|
|
34581
|
-
|
|
34582
|
-
|
|
34750
|
+
sendMessageIsActive = _useState19[0],
|
|
34751
|
+
setSendMessageIsActive = _useState19[1];
|
|
34752
|
+
var _useState20 = React.useState([]),
|
|
34753
|
+
attachments = _useState20[0],
|
|
34754
|
+
setAttachments = _useState20[1];
|
|
34755
|
+
var _useState21 = React.useState(false),
|
|
34756
|
+
forwardPopupOpen = _useState21[0],
|
|
34757
|
+
setForwardPopupOpen = _useState21[1];
|
|
34583
34758
|
var _useState22 = React.useState(false),
|
|
34584
|
-
|
|
34585
|
-
|
|
34759
|
+
deletePopupOpen = _useState22[0],
|
|
34760
|
+
setDeletePopupOpen = _useState22[1];
|
|
34586
34761
|
var _useState23 = React.useState(false),
|
|
34587
|
-
|
|
34588
|
-
|
|
34589
|
-
var _useState24 = React.useState(
|
|
34590
|
-
|
|
34591
|
-
|
|
34592
|
-
var _useState25 = React.useState('
|
|
34593
|
-
|
|
34594
|
-
|
|
34595
|
-
var _useState26 = React.useState(''),
|
|
34596
|
-
uploadErrorMessage = _useState26[0],
|
|
34597
|
-
setUploadErrorMessage = _useState26[1];
|
|
34762
|
+
isIncomingMessage = _useState23[0],
|
|
34763
|
+
setIsIncomingMessage = _useState23[1];
|
|
34764
|
+
var _useState24 = React.useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
|
|
34765
|
+
mediaExtensions = _useState24[0],
|
|
34766
|
+
setMediaExtensions = _useState24[1];
|
|
34767
|
+
var _useState25 = React.useState(''),
|
|
34768
|
+
uploadErrorMessage = _useState25[0],
|
|
34769
|
+
setUploadErrorMessage = _useState25[1];
|
|
34598
34770
|
var typingOrRecordingIndicator = reactRedux.useSelector(typingOrRecordingIndicatorArraySelector(activeChannel.id));
|
|
34599
34771
|
var contactsMap = reactRedux.useSelector(contactsMapSelector);
|
|
34600
34772
|
var connectionStatus = reactRedux.useSelector(connectionStatusSelector, reactRedux.shallowEqual);
|
|
@@ -34604,15 +34776,15 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34604
34776
|
var messageInputRef = React.useRef(null);
|
|
34605
34777
|
var emojiBtnRef = React.useRef(null);
|
|
34606
34778
|
var addAttachmentsBtnRef = React.useRef(null);
|
|
34607
|
-
var
|
|
34608
|
-
realEditorState =
|
|
34609
|
-
setRealEditorState =
|
|
34610
|
-
var
|
|
34611
|
-
floatingAnchorElem =
|
|
34612
|
-
setFloatingAnchorElem =
|
|
34613
|
-
var
|
|
34614
|
-
isSmallWidthViewport =
|
|
34615
|
-
setIsSmallWidthViewport =
|
|
34779
|
+
var _useState26 = React.useState(),
|
|
34780
|
+
realEditorState = _useState26[0],
|
|
34781
|
+
setRealEditorState = _useState26[1];
|
|
34782
|
+
var _useState27 = React.useState(null),
|
|
34783
|
+
floatingAnchorElem = _useState27[0],
|
|
34784
|
+
setFloatingAnchorElem = _useState27[1];
|
|
34785
|
+
var _useState28 = React.useState(false),
|
|
34786
|
+
isSmallWidthViewport = _useState28[0],
|
|
34787
|
+
setIsSmallWidthViewport = _useState28[1];
|
|
34616
34788
|
var addAttachmentByMenu = showChooseFileAttachment && showChooseMediaAttachment;
|
|
34617
34789
|
function onChange(editorState) {
|
|
34618
34790
|
setRealEditorState(editorState);
|
|
@@ -35330,7 +35502,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35330
35502
|
dispatch(setDraggedAttachmentsAC([], ''));
|
|
35331
35503
|
}
|
|
35332
35504
|
}, [draggedAttachments]);
|
|
35333
|
-
|
|
35505
|
+
var sendRecordedFile = function sendRecordedFile(recordedFile, id) {
|
|
35334
35506
|
if (recordedFile) {
|
|
35335
35507
|
var tid = uuid.v4();
|
|
35336
35508
|
var reader = new FileReader();
|
|
@@ -35370,7 +35542,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35370
35542
|
}],
|
|
35371
35543
|
type: 'text'
|
|
35372
35544
|
};
|
|
35373
|
-
dispatch(sendMessageAC(messageToSend,
|
|
35545
|
+
dispatch(sendMessageAC(messageToSend, id, connectionStatus));
|
|
35374
35546
|
});
|
|
35375
35547
|
} catch (e) {
|
|
35376
35548
|
return Promise.reject(e);
|
|
@@ -35381,7 +35553,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35381
35553
|
};
|
|
35382
35554
|
reader.readAsBinaryString(recordedFile.file);
|
|
35383
35555
|
}
|
|
35384
|
-
}
|
|
35556
|
+
};
|
|
35385
35557
|
React.useEffect(function () {
|
|
35386
35558
|
var updateViewPortWidth = function updateViewPortWidth() {
|
|
35387
35559
|
var isNextSmallWidthViewport = CAN_USE_DOM && window.matchMedia('(max-width: 1025px)').matches;
|
|
@@ -35768,7 +35940,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35768
35940
|
onChange: handleFileUpload,
|
|
35769
35941
|
multiple: true,
|
|
35770
35942
|
type: 'file'
|
|
35771
|
-
}), showRecording ? (/*#__PURE__*/React__default.createElement(AudioCont, null)) : (/*#__PURE__*/React__default.createElement(MessageInputWrapper, {
|
|
35943
|
+
}), showRecording || getAudioRecordingFromMap(activeChannel.id) ? (/*#__PURE__*/React__default.createElement(AudioCont, null)) : (/*#__PURE__*/React__default.createElement(MessageInputWrapper, {
|
|
35772
35944
|
className: 'message_input_wrapper',
|
|
35773
35945
|
borderRadius: messageForReply || messageToEdit ? borderRadiusOnOpenedEditReplyMessage : borderRadius,
|
|
35774
35946
|
ref: inputWrapperRef,
|
|
@@ -35901,9 +36073,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35901
36073
|
iconColor: accentColor,
|
|
35902
36074
|
activeColor: accentColor
|
|
35903
36075
|
}, /*#__PURE__*/React__default.createElement(AudioRecord, {
|
|
35904
|
-
sendRecordedFile:
|
|
36076
|
+
sendRecordedFile: sendRecordedFile,
|
|
35905
36077
|
setShowRecording: setShowRecording,
|
|
35906
|
-
showRecording: showRecording
|
|
36078
|
+
showRecording: showRecording,
|
|
36079
|
+
channelId: activeChannel.id
|
|
35907
36080
|
}))))))))));
|
|
35908
36081
|
};
|
|
35909
36082
|
var SendMessageWrapper = styled__default.div(_templateObject$I || (_templateObject$I = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n position: relative;\n z-index: 15;\n"])), function (props) {
|