sceyt-chat-react-uikit 1.6.9-beta.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ChannelDetails/index.d.ts +1 -1
- package/components/ChannelDetailsContainer/index.d.ts +2 -1
- package/components/ChannelList/index.d.ts +1 -0
- package/index.js +1359 -525
- package/index.modern.js +1352 -517
- package/package.json +6 -6
package/index.modern.js
CHANGED
|
@@ -2,7 +2,6 @@ import React__default, { createElement as createElement$1, useRef, useEffect, us
|
|
|
2
2
|
import { useSelector, useDispatch, shallowEqual, Provider } from 'react-redux';
|
|
3
3
|
import log from 'loglevel';
|
|
4
4
|
import createSagaMiddleware, { eventChannel } from 'redux-saga';
|
|
5
|
-
import { createStore, isPlainObject as isPlainObject$1, combineReducers, applyMiddleware, compose, isAction } from 'redux';
|
|
6
5
|
import FileSaver from 'file-saver';
|
|
7
6
|
import { select, put, call, take, takeLatest, takeEvery, all } from 'redux-saga/effects';
|
|
8
7
|
import { v4 } from 'uuid';
|
|
@@ -23,6 +22,367 @@ import { useBasicTypeaheadTriggerMatch, LexicalTypeaheadMenuPlugin, MenuOption }
|
|
|
23
22
|
import { $createOffsetView } from '@lexical/offset';
|
|
24
23
|
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
25
24
|
|
|
25
|
+
// src/utils/formatProdErrorMessage.ts
|
|
26
|
+
function formatProdErrorMessage(code) {
|
|
27
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/utils/symbol-observable.ts
|
|
31
|
+
var $$observable = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
|
|
32
|
+
var symbol_observable_default = $$observable;
|
|
33
|
+
|
|
34
|
+
// src/utils/actionTypes.ts
|
|
35
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
36
|
+
var ActionTypes = {
|
|
37
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
38
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
39
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
40
|
+
};
|
|
41
|
+
var actionTypes_default = ActionTypes;
|
|
42
|
+
|
|
43
|
+
// src/utils/isPlainObject.ts
|
|
44
|
+
function isPlainObject(obj) {
|
|
45
|
+
if (typeof obj !== "object" || obj === null)
|
|
46
|
+
return false;
|
|
47
|
+
let proto = obj;
|
|
48
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
49
|
+
proto = Object.getPrototypeOf(proto);
|
|
50
|
+
}
|
|
51
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/utils/kindOf.ts
|
|
55
|
+
function miniKindOf(val) {
|
|
56
|
+
if (val === void 0)
|
|
57
|
+
return "undefined";
|
|
58
|
+
if (val === null)
|
|
59
|
+
return "null";
|
|
60
|
+
const type = typeof val;
|
|
61
|
+
switch (type) {
|
|
62
|
+
case "boolean":
|
|
63
|
+
case "string":
|
|
64
|
+
case "number":
|
|
65
|
+
case "symbol":
|
|
66
|
+
case "function": {
|
|
67
|
+
return type;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(val))
|
|
71
|
+
return "array";
|
|
72
|
+
if (isDate(val))
|
|
73
|
+
return "date";
|
|
74
|
+
if (isError(val))
|
|
75
|
+
return "error";
|
|
76
|
+
const constructorName = ctorName(val);
|
|
77
|
+
switch (constructorName) {
|
|
78
|
+
case "Symbol":
|
|
79
|
+
case "Promise":
|
|
80
|
+
case "WeakMap":
|
|
81
|
+
case "WeakSet":
|
|
82
|
+
case "Map":
|
|
83
|
+
case "Set":
|
|
84
|
+
return constructorName;
|
|
85
|
+
}
|
|
86
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
87
|
+
}
|
|
88
|
+
function ctorName(val) {
|
|
89
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
90
|
+
}
|
|
91
|
+
function isError(val) {
|
|
92
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
93
|
+
}
|
|
94
|
+
function isDate(val) {
|
|
95
|
+
if (val instanceof Date)
|
|
96
|
+
return true;
|
|
97
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
98
|
+
}
|
|
99
|
+
function kindOf(val) {
|
|
100
|
+
let typeOfVal = typeof val;
|
|
101
|
+
if (process.env.NODE_ENV !== "production") {
|
|
102
|
+
typeOfVal = miniKindOf(val);
|
|
103
|
+
}
|
|
104
|
+
return typeOfVal;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/createStore.ts
|
|
108
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
109
|
+
if (typeof reducer !== "function") {
|
|
110
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'`);
|
|
111
|
+
}
|
|
112
|
+
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
|
113
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
|
|
114
|
+
}
|
|
115
|
+
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
116
|
+
enhancer = preloadedState;
|
|
117
|
+
preloadedState = void 0;
|
|
118
|
+
}
|
|
119
|
+
if (typeof enhancer !== "undefined") {
|
|
120
|
+
if (typeof enhancer !== "function") {
|
|
121
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'`);
|
|
122
|
+
}
|
|
123
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
124
|
+
}
|
|
125
|
+
let currentReducer = reducer;
|
|
126
|
+
let currentState = preloadedState;
|
|
127
|
+
let currentListeners = /* @__PURE__ */ new Map();
|
|
128
|
+
let nextListeners = currentListeners;
|
|
129
|
+
let listenerIdCounter = 0;
|
|
130
|
+
let isDispatching = false;
|
|
131
|
+
function ensureCanMutateNextListeners() {
|
|
132
|
+
if (nextListeners === currentListeners) {
|
|
133
|
+
nextListeners = /* @__PURE__ */ new Map();
|
|
134
|
+
currentListeners.forEach((listener, key) => {
|
|
135
|
+
nextListeners.set(key, listener);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function getState() {
|
|
140
|
+
if (isDispatching) {
|
|
141
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
|
|
142
|
+
}
|
|
143
|
+
return currentState;
|
|
144
|
+
}
|
|
145
|
+
function subscribe(listener) {
|
|
146
|
+
if (typeof listener !== "function") {
|
|
147
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : `Expected the listener to be a function. Instead, received: '${kindOf(listener)}'`);
|
|
148
|
+
}
|
|
149
|
+
if (isDispatching) {
|
|
150
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
151
|
+
}
|
|
152
|
+
let isSubscribed = true;
|
|
153
|
+
ensureCanMutateNextListeners();
|
|
154
|
+
const listenerId = listenerIdCounter++;
|
|
155
|
+
nextListeners.set(listenerId, listener);
|
|
156
|
+
return function unsubscribe() {
|
|
157
|
+
if (!isSubscribed) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (isDispatching) {
|
|
161
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
162
|
+
}
|
|
163
|
+
isSubscribed = false;
|
|
164
|
+
ensureCanMutateNextListeners();
|
|
165
|
+
nextListeners.delete(listenerId);
|
|
166
|
+
currentListeners = null;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function dispatch(action) {
|
|
170
|
+
if (!isPlainObject(action)) {
|
|
171
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : `Actions must be plain objects. Instead, the actual type was: '${kindOf(action)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);
|
|
172
|
+
}
|
|
173
|
+
if (typeof action.type === "undefined") {
|
|
174
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
175
|
+
}
|
|
176
|
+
if (typeof action.type !== "string") {
|
|
177
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : `Action "type" property must be a string. Instead, the actual type was: '${kindOf(action.type)}'. Value was: '${action.type}' (stringified)`);
|
|
178
|
+
}
|
|
179
|
+
if (isDispatching) {
|
|
180
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "Reducers may not dispatch actions.");
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
isDispatching = true;
|
|
184
|
+
currentState = currentReducer(currentState, action);
|
|
185
|
+
} finally {
|
|
186
|
+
isDispatching = false;
|
|
187
|
+
}
|
|
188
|
+
const listeners = currentListeners = nextListeners;
|
|
189
|
+
listeners.forEach((listener) => {
|
|
190
|
+
listener();
|
|
191
|
+
});
|
|
192
|
+
return action;
|
|
193
|
+
}
|
|
194
|
+
function replaceReducer(nextReducer) {
|
|
195
|
+
if (typeof nextReducer !== "function") {
|
|
196
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf(nextReducer)}`);
|
|
197
|
+
}
|
|
198
|
+
currentReducer = nextReducer;
|
|
199
|
+
dispatch({
|
|
200
|
+
type: actionTypes_default.REPLACE
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function observable() {
|
|
204
|
+
const outerSubscribe = subscribe;
|
|
205
|
+
return {
|
|
206
|
+
/**
|
|
207
|
+
* The minimal observable subscription method.
|
|
208
|
+
* @param observer Any object that can be used as an observer.
|
|
209
|
+
* The observer object should have a `next` method.
|
|
210
|
+
* @returns An object with an `unsubscribe` method that can
|
|
211
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
212
|
+
* emission of values from the observable.
|
|
213
|
+
*/
|
|
214
|
+
subscribe(observer) {
|
|
215
|
+
if (typeof observer !== "object" || observer === null) {
|
|
216
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : `Expected the observer to be an object. Instead, received: '${kindOf(observer)}'`);
|
|
217
|
+
}
|
|
218
|
+
function observeState() {
|
|
219
|
+
const observerAsObserver = observer;
|
|
220
|
+
if (observerAsObserver.next) {
|
|
221
|
+
observerAsObserver.next(getState());
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
observeState();
|
|
225
|
+
const unsubscribe = outerSubscribe(observeState);
|
|
226
|
+
return {
|
|
227
|
+
unsubscribe
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
[symbol_observable_default]() {
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
dispatch({
|
|
236
|
+
type: actionTypes_default.INIT
|
|
237
|
+
});
|
|
238
|
+
const store = {
|
|
239
|
+
dispatch,
|
|
240
|
+
subscribe,
|
|
241
|
+
getState,
|
|
242
|
+
replaceReducer,
|
|
243
|
+
[symbol_observable_default]: observable
|
|
244
|
+
};
|
|
245
|
+
return store;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// src/utils/warning.ts
|
|
249
|
+
function warning(message) {
|
|
250
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
251
|
+
console.error(message);
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
throw new Error(message);
|
|
255
|
+
} catch (e) {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// src/combineReducers.ts
|
|
260
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
261
|
+
const reducerKeys = Object.keys(reducers);
|
|
262
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
263
|
+
if (reducerKeys.length === 0) {
|
|
264
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
265
|
+
}
|
|
266
|
+
if (!isPlainObject(inputState)) {
|
|
267
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
268
|
+
}
|
|
269
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
270
|
+
unexpectedKeys.forEach((key) => {
|
|
271
|
+
unexpectedKeyCache[key] = true;
|
|
272
|
+
});
|
|
273
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
274
|
+
return;
|
|
275
|
+
if (unexpectedKeys.length > 0) {
|
|
276
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function assertReducerShape(reducers) {
|
|
280
|
+
Object.keys(reducers).forEach((key) => {
|
|
281
|
+
const reducer = reducers[key];
|
|
282
|
+
const initialState = reducer(void 0, {
|
|
283
|
+
type: actionTypes_default.INIT
|
|
284
|
+
});
|
|
285
|
+
if (typeof initialState === "undefined") {
|
|
286
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
287
|
+
}
|
|
288
|
+
if (typeof reducer(void 0, {
|
|
289
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
290
|
+
}) === "undefined") {
|
|
291
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function combineReducers(reducers) {
|
|
296
|
+
const reducerKeys = Object.keys(reducers);
|
|
297
|
+
const finalReducers = {};
|
|
298
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
299
|
+
const key = reducerKeys[i];
|
|
300
|
+
if (process.env.NODE_ENV !== "production") {
|
|
301
|
+
if (typeof reducers[key] === "undefined") {
|
|
302
|
+
warning(`No reducer provided for key "${key}"`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (typeof reducers[key] === "function") {
|
|
306
|
+
finalReducers[key] = reducers[key];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
310
|
+
let unexpectedKeyCache;
|
|
311
|
+
if (process.env.NODE_ENV !== "production") {
|
|
312
|
+
unexpectedKeyCache = {};
|
|
313
|
+
}
|
|
314
|
+
let shapeAssertionError;
|
|
315
|
+
try {
|
|
316
|
+
assertReducerShape(finalReducers);
|
|
317
|
+
} catch (e) {
|
|
318
|
+
shapeAssertionError = e;
|
|
319
|
+
}
|
|
320
|
+
return function combination(state = {}, action) {
|
|
321
|
+
if (shapeAssertionError) {
|
|
322
|
+
throw shapeAssertionError;
|
|
323
|
+
}
|
|
324
|
+
if (process.env.NODE_ENV !== "production") {
|
|
325
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
326
|
+
if (warningMessage) {
|
|
327
|
+
warning(warningMessage);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
let hasChanged = false;
|
|
331
|
+
const nextState = {};
|
|
332
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
333
|
+
const key = finalReducerKeys[i];
|
|
334
|
+
const reducer = finalReducers[key];
|
|
335
|
+
const previousStateForKey = state[key];
|
|
336
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
337
|
+
if (typeof nextStateForKey === "undefined") {
|
|
338
|
+
const actionType = action && action.type;
|
|
339
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
340
|
+
}
|
|
341
|
+
nextState[key] = nextStateForKey;
|
|
342
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
343
|
+
}
|
|
344
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
345
|
+
return hasChanged ? nextState : state;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// src/compose.ts
|
|
350
|
+
function compose(...funcs) {
|
|
351
|
+
if (funcs.length === 0) {
|
|
352
|
+
return (arg) => arg;
|
|
353
|
+
}
|
|
354
|
+
if (funcs.length === 1) {
|
|
355
|
+
return funcs[0];
|
|
356
|
+
}
|
|
357
|
+
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// src/applyMiddleware.ts
|
|
361
|
+
function applyMiddleware(...middlewares) {
|
|
362
|
+
return (createStore2) => (reducer, preloadedState) => {
|
|
363
|
+
const store = createStore2(reducer, preloadedState);
|
|
364
|
+
let dispatch = () => {
|
|
365
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
|
366
|
+
};
|
|
367
|
+
const middlewareAPI = {
|
|
368
|
+
getState: store.getState,
|
|
369
|
+
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
370
|
+
};
|
|
371
|
+
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
372
|
+
dispatch = compose(...chain)(store.dispatch);
|
|
373
|
+
return {
|
|
374
|
+
...store,
|
|
375
|
+
dispatch
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/utils/isAction.ts
|
|
381
|
+
function isAction(action) {
|
|
382
|
+
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
383
|
+
}
|
|
384
|
+
//# sourceMappingURL=redux.mjs.map
|
|
385
|
+
|
|
26
386
|
var __defProp = Object.defineProperty;
|
|
27
387
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
28
388
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -97,10 +457,10 @@ function isDraftable(value) {
|
|
|
97
457
|
var _a;
|
|
98
458
|
if (!value)
|
|
99
459
|
return false;
|
|
100
|
-
return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
|
|
460
|
+
return isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
|
|
101
461
|
}
|
|
102
462
|
var objectCtorString = Object.prototype.constructor.toString();
|
|
103
|
-
function isPlainObject(value) {
|
|
463
|
+
function isPlainObject$1(value) {
|
|
104
464
|
if (!value || typeof value !== "object")
|
|
105
465
|
return false;
|
|
106
466
|
const proto = getPrototypeOf(value);
|
|
@@ -162,7 +522,7 @@ function shallowCopy(base, strict) {
|
|
|
162
522
|
}
|
|
163
523
|
if (Array.isArray(base))
|
|
164
524
|
return Array.prototype.slice.call(base);
|
|
165
|
-
const isPlain = isPlainObject(base);
|
|
525
|
+
const isPlain = isPlainObject$1(base);
|
|
166
526
|
if (strict === true || strict === "class_only" && !isPlain) {
|
|
167
527
|
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
168
528
|
delete descriptors[DRAFT_STATE];
|
|
@@ -220,6 +580,10 @@ function getPlugin(pluginKey) {
|
|
|
220
580
|
}
|
|
221
581
|
return plugin;
|
|
222
582
|
}
|
|
583
|
+
function loadPlugin(pluginKey, implementation) {
|
|
584
|
+
if (!plugins[pluginKey])
|
|
585
|
+
plugins[pluginKey] = implementation;
|
|
586
|
+
}
|
|
223
587
|
|
|
224
588
|
// src/core/scope.ts
|
|
225
589
|
var currentScope;
|
|
@@ -736,6 +1100,256 @@ function currentImpl(value) {
|
|
|
736
1100
|
return copy;
|
|
737
1101
|
}
|
|
738
1102
|
|
|
1103
|
+
// src/plugins/mapset.ts
|
|
1104
|
+
function enableMapSet() {
|
|
1105
|
+
class DraftMap extends Map {
|
|
1106
|
+
constructor(target, parent) {
|
|
1107
|
+
super();
|
|
1108
|
+
this[DRAFT_STATE] = {
|
|
1109
|
+
type_: 2 /* Map */,
|
|
1110
|
+
parent_: parent,
|
|
1111
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1112
|
+
modified_: false,
|
|
1113
|
+
finalized_: false,
|
|
1114
|
+
copy_: void 0,
|
|
1115
|
+
assigned_: void 0,
|
|
1116
|
+
base_: target,
|
|
1117
|
+
draft_: this,
|
|
1118
|
+
isManual_: false,
|
|
1119
|
+
revoked_: false
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
get size() {
|
|
1123
|
+
return latest(this[DRAFT_STATE]).size;
|
|
1124
|
+
}
|
|
1125
|
+
has(key) {
|
|
1126
|
+
return latest(this[DRAFT_STATE]).has(key);
|
|
1127
|
+
}
|
|
1128
|
+
set(key, value) {
|
|
1129
|
+
const state = this[DRAFT_STATE];
|
|
1130
|
+
assertUnrevoked(state);
|
|
1131
|
+
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
1132
|
+
prepareMapCopy(state);
|
|
1133
|
+
markChanged(state);
|
|
1134
|
+
state.assigned_.set(key, true);
|
|
1135
|
+
state.copy_.set(key, value);
|
|
1136
|
+
state.assigned_.set(key, true);
|
|
1137
|
+
}
|
|
1138
|
+
return this;
|
|
1139
|
+
}
|
|
1140
|
+
delete(key) {
|
|
1141
|
+
if (!this.has(key)) {
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
const state = this[DRAFT_STATE];
|
|
1145
|
+
assertUnrevoked(state);
|
|
1146
|
+
prepareMapCopy(state);
|
|
1147
|
+
markChanged(state);
|
|
1148
|
+
if (state.base_.has(key)) {
|
|
1149
|
+
state.assigned_.set(key, false);
|
|
1150
|
+
} else {
|
|
1151
|
+
state.assigned_.delete(key);
|
|
1152
|
+
}
|
|
1153
|
+
state.copy_.delete(key);
|
|
1154
|
+
return true;
|
|
1155
|
+
}
|
|
1156
|
+
clear() {
|
|
1157
|
+
const state = this[DRAFT_STATE];
|
|
1158
|
+
assertUnrevoked(state);
|
|
1159
|
+
if (latest(state).size) {
|
|
1160
|
+
prepareMapCopy(state);
|
|
1161
|
+
markChanged(state);
|
|
1162
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
1163
|
+
each(state.base_, (key) => {
|
|
1164
|
+
state.assigned_.set(key, false);
|
|
1165
|
+
});
|
|
1166
|
+
state.copy_.clear();
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
forEach(cb, thisArg) {
|
|
1170
|
+
const state = this[DRAFT_STATE];
|
|
1171
|
+
latest(state).forEach((_value, key, _map) => {
|
|
1172
|
+
cb.call(thisArg, this.get(key), key, this);
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
get(key) {
|
|
1176
|
+
const state = this[DRAFT_STATE];
|
|
1177
|
+
assertUnrevoked(state);
|
|
1178
|
+
const value = latest(state).get(key);
|
|
1179
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
1180
|
+
return value;
|
|
1181
|
+
}
|
|
1182
|
+
if (value !== state.base_.get(key)) {
|
|
1183
|
+
return value;
|
|
1184
|
+
}
|
|
1185
|
+
const draft = createProxy(value, state);
|
|
1186
|
+
prepareMapCopy(state);
|
|
1187
|
+
state.copy_.set(key, draft);
|
|
1188
|
+
return draft;
|
|
1189
|
+
}
|
|
1190
|
+
keys() {
|
|
1191
|
+
return latest(this[DRAFT_STATE]).keys();
|
|
1192
|
+
}
|
|
1193
|
+
values() {
|
|
1194
|
+
const iterator = this.keys();
|
|
1195
|
+
return {
|
|
1196
|
+
[Symbol.iterator]: () => this.values(),
|
|
1197
|
+
next: () => {
|
|
1198
|
+
const r = iterator.next();
|
|
1199
|
+
if (r.done)
|
|
1200
|
+
return r;
|
|
1201
|
+
const value = this.get(r.value);
|
|
1202
|
+
return {
|
|
1203
|
+
done: false,
|
|
1204
|
+
value
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
entries() {
|
|
1210
|
+
const iterator = this.keys();
|
|
1211
|
+
return {
|
|
1212
|
+
[Symbol.iterator]: () => this.entries(),
|
|
1213
|
+
next: () => {
|
|
1214
|
+
const r = iterator.next();
|
|
1215
|
+
if (r.done)
|
|
1216
|
+
return r;
|
|
1217
|
+
const value = this.get(r.value);
|
|
1218
|
+
return {
|
|
1219
|
+
done: false,
|
|
1220
|
+
value: [r.value, value]
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
[(Symbol.iterator)]() {
|
|
1226
|
+
return this.entries();
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
function proxyMap_(target, parent) {
|
|
1230
|
+
return new DraftMap(target, parent);
|
|
1231
|
+
}
|
|
1232
|
+
function prepareMapCopy(state) {
|
|
1233
|
+
if (!state.copy_) {
|
|
1234
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
1235
|
+
state.copy_ = new Map(state.base_);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
class DraftSet extends Set {
|
|
1239
|
+
constructor(target, parent) {
|
|
1240
|
+
super();
|
|
1241
|
+
this[DRAFT_STATE] = {
|
|
1242
|
+
type_: 3 /* Set */,
|
|
1243
|
+
parent_: parent,
|
|
1244
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1245
|
+
modified_: false,
|
|
1246
|
+
finalized_: false,
|
|
1247
|
+
copy_: void 0,
|
|
1248
|
+
base_: target,
|
|
1249
|
+
draft_: this,
|
|
1250
|
+
drafts_: /* @__PURE__ */ new Map(),
|
|
1251
|
+
revoked_: false,
|
|
1252
|
+
isManual_: false
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
get size() {
|
|
1256
|
+
return latest(this[DRAFT_STATE]).size;
|
|
1257
|
+
}
|
|
1258
|
+
has(value) {
|
|
1259
|
+
const state = this[DRAFT_STATE];
|
|
1260
|
+
assertUnrevoked(state);
|
|
1261
|
+
if (!state.copy_) {
|
|
1262
|
+
return state.base_.has(value);
|
|
1263
|
+
}
|
|
1264
|
+
if (state.copy_.has(value))
|
|
1265
|
+
return true;
|
|
1266
|
+
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
1267
|
+
return true;
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
add(value) {
|
|
1271
|
+
const state = this[DRAFT_STATE];
|
|
1272
|
+
assertUnrevoked(state);
|
|
1273
|
+
if (!this.has(value)) {
|
|
1274
|
+
prepareSetCopy(state);
|
|
1275
|
+
markChanged(state);
|
|
1276
|
+
state.copy_.add(value);
|
|
1277
|
+
}
|
|
1278
|
+
return this;
|
|
1279
|
+
}
|
|
1280
|
+
delete(value) {
|
|
1281
|
+
if (!this.has(value)) {
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
const state = this[DRAFT_STATE];
|
|
1285
|
+
assertUnrevoked(state);
|
|
1286
|
+
prepareSetCopy(state);
|
|
1287
|
+
markChanged(state);
|
|
1288
|
+
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
1289
|
+
/* istanbul ignore next */
|
|
1290
|
+
false
|
|
1291
|
+
));
|
|
1292
|
+
}
|
|
1293
|
+
clear() {
|
|
1294
|
+
const state = this[DRAFT_STATE];
|
|
1295
|
+
assertUnrevoked(state);
|
|
1296
|
+
if (latest(state).size) {
|
|
1297
|
+
prepareSetCopy(state);
|
|
1298
|
+
markChanged(state);
|
|
1299
|
+
state.copy_.clear();
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
values() {
|
|
1303
|
+
const state = this[DRAFT_STATE];
|
|
1304
|
+
assertUnrevoked(state);
|
|
1305
|
+
prepareSetCopy(state);
|
|
1306
|
+
return state.copy_.values();
|
|
1307
|
+
}
|
|
1308
|
+
entries() {
|
|
1309
|
+
const state = this[DRAFT_STATE];
|
|
1310
|
+
assertUnrevoked(state);
|
|
1311
|
+
prepareSetCopy(state);
|
|
1312
|
+
return state.copy_.entries();
|
|
1313
|
+
}
|
|
1314
|
+
keys() {
|
|
1315
|
+
return this.values();
|
|
1316
|
+
}
|
|
1317
|
+
[(Symbol.iterator)]() {
|
|
1318
|
+
return this.values();
|
|
1319
|
+
}
|
|
1320
|
+
forEach(cb, thisArg) {
|
|
1321
|
+
const iterator = this.values();
|
|
1322
|
+
let result = iterator.next();
|
|
1323
|
+
while (!result.done) {
|
|
1324
|
+
cb.call(thisArg, result.value, result.value, this);
|
|
1325
|
+
result = iterator.next();
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
function proxySet_(target, parent) {
|
|
1330
|
+
return new DraftSet(target, parent);
|
|
1331
|
+
}
|
|
1332
|
+
function prepareSetCopy(state) {
|
|
1333
|
+
if (!state.copy_) {
|
|
1334
|
+
state.copy_ = /* @__PURE__ */ new Set();
|
|
1335
|
+
state.base_.forEach((value) => {
|
|
1336
|
+
if (isDraftable(value)) {
|
|
1337
|
+
const draft = createProxy(value, state);
|
|
1338
|
+
state.drafts_.set(value, draft);
|
|
1339
|
+
state.copy_.add(draft);
|
|
1340
|
+
} else {
|
|
1341
|
+
state.copy_.add(value);
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
function assertUnrevoked(state) {
|
|
1347
|
+
if (state.revoked_)
|
|
1348
|
+
die(3, JSON.stringify(latest(state)));
|
|
1349
|
+
}
|
|
1350
|
+
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
1351
|
+
}
|
|
1352
|
+
|
|
739
1353
|
// src/immer.ts
|
|
740
1354
|
var immer = new Immer2();
|
|
741
1355
|
var produce = immer.produce;
|
|
@@ -810,7 +1424,7 @@ function createAction(type, prepareAction) {
|
|
|
810
1424
|
if (prepareAction) {
|
|
811
1425
|
let prepared = prepareAction(...args);
|
|
812
1426
|
if (!prepared) {
|
|
813
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
1427
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(0) : "prepareAction did not return an object");
|
|
814
1428
|
}
|
|
815
1429
|
return __spreadValues$1(__spreadValues$1({
|
|
816
1430
|
type,
|
|
@@ -1019,7 +1633,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1019
1633
|
result = tracker.detectMutations();
|
|
1020
1634
|
tracker = track(state);
|
|
1021
1635
|
if (result.wasMutated) {
|
|
1022
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(19) : `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)`);
|
|
1636
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(19) : `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)`);
|
|
1023
1637
|
}
|
|
1024
1638
|
});
|
|
1025
1639
|
const dispatchedAction = next(action);
|
|
@@ -1028,7 +1642,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1028
1642
|
result = tracker.detectMutations();
|
|
1029
1643
|
tracker = track(state);
|
|
1030
1644
|
if (result.wasMutated) {
|
|
1031
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1645
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1032
1646
|
}
|
|
1033
1647
|
});
|
|
1034
1648
|
measureUtils.warnIfExceeded();
|
|
@@ -1039,7 +1653,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1039
1653
|
}
|
|
1040
1654
|
function isPlain(val) {
|
|
1041
1655
|
const type = typeof val;
|
|
1042
|
-
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject
|
|
1656
|
+
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
1043
1657
|
}
|
|
1044
1658
|
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
|
|
1045
1659
|
let foundNestedSerializable;
|
|
@@ -1277,31 +1891,31 @@ function configureStore(options) {
|
|
|
1277
1891
|
let rootReducer;
|
|
1278
1892
|
if (typeof reducer === "function") {
|
|
1279
1893
|
rootReducer = reducer;
|
|
1280
|
-
} else if (isPlainObject
|
|
1894
|
+
} else if (isPlainObject(reducer)) {
|
|
1281
1895
|
rootReducer = combineReducers(reducer);
|
|
1282
1896
|
} else {
|
|
1283
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
1897
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
1284
1898
|
}
|
|
1285
1899
|
if (process.env.NODE_ENV !== "production" && middleware && typeof middleware !== "function") {
|
|
1286
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "`middleware` field must be a callback");
|
|
1900
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(2) : "`middleware` field must be a callback");
|
|
1287
1901
|
}
|
|
1288
1902
|
let finalMiddleware;
|
|
1289
1903
|
if (typeof middleware === "function") {
|
|
1290
1904
|
finalMiddleware = middleware(getDefaultMiddleware);
|
|
1291
1905
|
if (process.env.NODE_ENV !== "production" && !Array.isArray(finalMiddleware)) {
|
|
1292
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1906
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1293
1907
|
}
|
|
1294
1908
|
} else {
|
|
1295
1909
|
finalMiddleware = getDefaultMiddleware();
|
|
1296
1910
|
}
|
|
1297
1911
|
if (process.env.NODE_ENV !== "production" && finalMiddleware.some((item) => typeof item !== "function")) {
|
|
1298
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "each middleware provided to configureStore must be a function");
|
|
1912
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(4) : "each middleware provided to configureStore must be a function");
|
|
1299
1913
|
}
|
|
1300
1914
|
if (process.env.NODE_ENV !== "production" && duplicateMiddlewareCheck) {
|
|
1301
1915
|
let middlewareReferences = /* @__PURE__ */ new Set();
|
|
1302
1916
|
finalMiddleware.forEach((middleware2) => {
|
|
1303
1917
|
if (middlewareReferences.has(middleware2)) {
|
|
1304
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
|
|
1918
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
|
|
1305
1919
|
}
|
|
1306
1920
|
middlewareReferences.add(middleware2);
|
|
1307
1921
|
});
|
|
@@ -1316,14 +1930,14 @@ function configureStore(options) {
|
|
|
1316
1930
|
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
1317
1931
|
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
1318
1932
|
if (process.env.NODE_ENV !== "production" && enhancers && typeof enhancers !== "function") {
|
|
1319
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "`enhancers` field must be a callback");
|
|
1933
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(5) : "`enhancers` field must be a callback");
|
|
1320
1934
|
}
|
|
1321
1935
|
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
1322
1936
|
if (process.env.NODE_ENV !== "production" && !Array.isArray(storeEnhancers)) {
|
|
1323
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "`enhancers` callback must return an array");
|
|
1937
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(6) : "`enhancers` callback must return an array");
|
|
1324
1938
|
}
|
|
1325
1939
|
if (process.env.NODE_ENV !== "production" && storeEnhancers.some((item) => typeof item !== "function")) {
|
|
1326
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "each enhancer provided to configureStore must be a function");
|
|
1940
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(7) : "each enhancer provided to configureStore must be a function");
|
|
1327
1941
|
}
|
|
1328
1942
|
if (process.env.NODE_ENV !== "production" && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {
|
|
1329
1943
|
console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
@@ -1341,18 +1955,18 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1341
1955
|
addCase(typeOrActionCreator, reducer) {
|
|
1342
1956
|
if (process.env.NODE_ENV !== "production") {
|
|
1343
1957
|
if (actionMatchers.length > 0) {
|
|
1344
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1958
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1345
1959
|
}
|
|
1346
1960
|
if (defaultCaseReducer) {
|
|
1347
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1961
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1348
1962
|
}
|
|
1349
1963
|
}
|
|
1350
1964
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1351
1965
|
if (!type) {
|
|
1352
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1966
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1353
1967
|
}
|
|
1354
1968
|
if (type in actionsMap) {
|
|
1355
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1969
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1356
1970
|
}
|
|
1357
1971
|
actionsMap[type] = reducer;
|
|
1358
1972
|
return builder;
|
|
@@ -1360,7 +1974,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1360
1974
|
addMatcher(matcher, reducer) {
|
|
1361
1975
|
if (process.env.NODE_ENV !== "production") {
|
|
1362
1976
|
if (defaultCaseReducer) {
|
|
1363
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1977
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1364
1978
|
}
|
|
1365
1979
|
}
|
|
1366
1980
|
actionMatchers.push({
|
|
@@ -1372,7 +1986,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1372
1986
|
addDefaultCase(reducer) {
|
|
1373
1987
|
if (process.env.NODE_ENV !== "production") {
|
|
1374
1988
|
if (defaultCaseReducer) {
|
|
1375
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
1989
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(31) : "`builder.addDefaultCase` can only be called once");
|
|
1376
1990
|
}
|
|
1377
1991
|
}
|
|
1378
1992
|
defaultCaseReducer = reducer;
|
|
@@ -1390,7 +2004,7 @@ function isStateFunction(x) {
|
|
|
1390
2004
|
function createReducer(initialState, mapOrBuilderCallback) {
|
|
1391
2005
|
if (process.env.NODE_ENV !== "production") {
|
|
1392
2006
|
if (typeof mapOrBuilderCallback === "object") {
|
|
1393
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
2007
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1394
2008
|
}
|
|
1395
2009
|
}
|
|
1396
2010
|
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
@@ -1457,7 +2071,7 @@ function buildCreateSlice({
|
|
|
1457
2071
|
reducerPath = name
|
|
1458
2072
|
} = options;
|
|
1459
2073
|
if (!name) {
|
|
1460
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
2074
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(11) : "`name` is a required option for createSlice");
|
|
1461
2075
|
}
|
|
1462
2076
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1463
2077
|
if (options.initialState === void 0) {
|
|
@@ -1476,10 +2090,10 @@ function buildCreateSlice({
|
|
|
1476
2090
|
addCase(typeOrActionCreator, reducer2) {
|
|
1477
2091
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1478
2092
|
if (!type) {
|
|
1479
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
|
|
2093
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(12) : "`context.addCase` cannot be called with an empty action type");
|
|
1480
2094
|
}
|
|
1481
2095
|
if (type in context.sliceCaseReducersByType) {
|
|
1482
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
2096
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
1483
2097
|
}
|
|
1484
2098
|
context.sliceCaseReducersByType[type] = reducer2;
|
|
1485
2099
|
return contextMethods;
|
|
@@ -1516,7 +2130,7 @@ function buildCreateSlice({
|
|
|
1516
2130
|
function buildReducer() {
|
|
1517
2131
|
if (process.env.NODE_ENV !== "production") {
|
|
1518
2132
|
if (typeof options.extraReducers === "object") {
|
|
1519
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
2133
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
1520
2134
|
}
|
|
1521
2135
|
}
|
|
1522
2136
|
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
@@ -1555,7 +2169,7 @@ function buildCreateSlice({
|
|
|
1555
2169
|
if (injected) {
|
|
1556
2170
|
sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
1557
2171
|
} else if (process.env.NODE_ENV !== "production") {
|
|
1558
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
2172
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1559
2173
|
}
|
|
1560
2174
|
}
|
|
1561
2175
|
return sliceState;
|
|
@@ -1611,7 +2225,7 @@ function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
|
1611
2225
|
if (injected) {
|
|
1612
2226
|
sliceState = getInitialState();
|
|
1613
2227
|
} else if (process.env.NODE_ENV !== "production") {
|
|
1614
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
2228
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1615
2229
|
}
|
|
1616
2230
|
}
|
|
1617
2231
|
return selector(sliceState, ...args);
|
|
@@ -1659,7 +2273,7 @@ function handleNormalReducerDefinition({
|
|
|
1659
2273
|
let prepareCallback;
|
|
1660
2274
|
if ("reducer" in maybeReducerWithPrepare) {
|
|
1661
2275
|
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
1662
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2276
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
1663
2277
|
}
|
|
1664
2278
|
caseReducer = maybeReducerWithPrepare.reducer;
|
|
1665
2279
|
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
@@ -1679,7 +2293,7 @@ function handleThunkCaseReducerDefinition({
|
|
|
1679
2293
|
reducerName
|
|
1680
2294
|
}, reducerDefinition, context, cAT) {
|
|
1681
2295
|
if (!cAT) {
|
|
1682
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
2296
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
1683
2297
|
}
|
|
1684
2298
|
const {
|
|
1685
2299
|
payloadCreator,
|
|
@@ -1714,7 +2328,7 @@ function noop() {
|
|
|
1714
2328
|
}
|
|
1715
2329
|
|
|
1716
2330
|
// src/formatProdErrorMessage.ts
|
|
1717
|
-
function formatProdErrorMessage(code) {
|
|
2331
|
+
function formatProdErrorMessage$1(code) {
|
|
1718
2332
|
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
1719
2333
|
}
|
|
1720
2334
|
//# sourceMappingURL=redux-toolkit.legacy-esm.js.map
|
|
@@ -2219,182 +2833,205 @@ function _catch(body, recover) {
|
|
|
2219
2833
|
return result;
|
|
2220
2834
|
}
|
|
2221
2835
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2836
|
+
// Asynchronously await a promise and pass the result to a finally continuation
|
|
2837
|
+
function _finallyRethrows(body, finalizer) {
|
|
2838
|
+
try {
|
|
2839
|
+
var result = body();
|
|
2840
|
+
} catch (e) {
|
|
2841
|
+
return finalizer(true, e);
|
|
2842
|
+
}
|
|
2843
|
+
if (result && result.then) {
|
|
2844
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
2845
|
+
}
|
|
2846
|
+
return finalizer(false, result);
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
var openDatabase = function openDatabase(dbName) {
|
|
2850
|
+
return new Promise(function (resolve, reject) {
|
|
2851
|
+
var request = indexedDB.open(dbName);
|
|
2852
|
+
request.onsuccess = function () {
|
|
2853
|
+
return resolve(request.result);
|
|
2232
2854
|
};
|
|
2233
|
-
|
|
2234
|
-
|
|
2855
|
+
request.onerror = function () {
|
|
2856
|
+
return reject(request.error);
|
|
2235
2857
|
};
|
|
2236
|
-
|
|
2237
|
-
|
|
2858
|
+
});
|
|
2859
|
+
};
|
|
2860
|
+
var runUpgrade = function runUpgrade(dbName, onUpgrade) {
|
|
2861
|
+
try {
|
|
2862
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2863
|
+
var nextVersion = db.version + 1;
|
|
2864
|
+
db.close();
|
|
2865
|
+
return new Promise(function (resolve, reject) {
|
|
2866
|
+
var request = indexedDB.open(dbName, nextVersion);
|
|
2867
|
+
request.onupgradeneeded = function () {
|
|
2868
|
+
var upgradeDb = request.result;
|
|
2869
|
+
onUpgrade(upgradeDb);
|
|
2870
|
+
};
|
|
2871
|
+
request.onsuccess = function () {
|
|
2872
|
+
return resolve(request.result);
|
|
2873
|
+
};
|
|
2874
|
+
request.onerror = function () {
|
|
2875
|
+
return reject(request.error);
|
|
2876
|
+
};
|
|
2877
|
+
request.onblocked = function () {
|
|
2878
|
+
log.warn('IndexedDB upgrade blocked; close other tabs to proceed');
|
|
2879
|
+
};
|
|
2880
|
+
});
|
|
2881
|
+
});
|
|
2882
|
+
} catch (e) {
|
|
2883
|
+
return Promise.reject(e);
|
|
2884
|
+
}
|
|
2885
|
+
};
|
|
2886
|
+
var ensureStore = function ensureStore(dbName, storeName, keyPath) {
|
|
2887
|
+
try {
|
|
2888
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2238
2889
|
if (db.objectStoreNames.contains(storeName)) {
|
|
2239
|
-
|
|
2240
|
-
} else {
|
|
2241
|
-
db.close();
|
|
2242
|
-
currentVersion++;
|
|
2243
|
-
_setDataToDB(dbName, storeName, data, keyPath);
|
|
2890
|
+
return db;
|
|
2244
2891
|
}
|
|
2245
|
-
db.
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2892
|
+
db.close();
|
|
2893
|
+
return Promise.resolve(runUpgrade(dbName, function (upgradeDb) {
|
|
2894
|
+
if (!upgradeDb.objectStoreNames.contains(storeName)) {
|
|
2895
|
+
upgradeDb.createObjectStore(storeName, {
|
|
2896
|
+
keyPath: keyPath
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
}));
|
|
2900
|
+
});
|
|
2901
|
+
} catch (e) {
|
|
2902
|
+
return Promise.reject(e);
|
|
2251
2903
|
}
|
|
2252
2904
|
};
|
|
2253
|
-
var
|
|
2905
|
+
var awaitTransaction = function awaitTransaction(tx) {
|
|
2254
2906
|
return new Promise(function (resolve, reject) {
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
var db = event.target.result;
|
|
2258
|
-
var transaction = event.target.transaction;
|
|
2259
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2260
|
-
var objectStore = transaction.objectStore(storeName);
|
|
2261
|
-
var request = objectStore.get(keyPath);
|
|
2262
|
-
request.onsuccess = function (event) {
|
|
2263
|
-
var result = event.target.result;
|
|
2264
|
-
resolve(result || '');
|
|
2265
|
-
};
|
|
2266
|
-
request.onerror = function (event) {
|
|
2267
|
-
log.error('Error retrieving data during upgrade: ', event.target.error);
|
|
2268
|
-
resolve('');
|
|
2269
|
-
};
|
|
2270
|
-
} else {
|
|
2271
|
-
db.createObjectStore(storeName, {
|
|
2272
|
-
keyPath: keyPatName
|
|
2273
|
-
});
|
|
2274
|
-
resolve('');
|
|
2275
|
-
}
|
|
2907
|
+
tx.oncomplete = function () {
|
|
2908
|
+
return resolve();
|
|
2276
2909
|
};
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
currentVersion++;
|
|
2280
|
-
resolve(_getDataFromDB(dbName, storeName, keyPath));
|
|
2281
|
-
} else {
|
|
2282
|
-
reject(event);
|
|
2283
|
-
}
|
|
2910
|
+
tx.onerror = function () {
|
|
2911
|
+
return reject(tx.error);
|
|
2284
2912
|
};
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2288
|
-
var transaction = db.transaction(storeName, 'readonly');
|
|
2289
|
-
var objectStore = transaction.objectStore(storeName);
|
|
2290
|
-
var request = objectStore.get(keyPath);
|
|
2291
|
-
request.onsuccess = function (event) {
|
|
2292
|
-
var result = event.target.result;
|
|
2293
|
-
if (result) {
|
|
2294
|
-
db.close();
|
|
2295
|
-
resolve(result);
|
|
2296
|
-
} else {
|
|
2297
|
-
log.info('No data found for the specified keyPathValue.');
|
|
2298
|
-
db.close();
|
|
2299
|
-
resolve('');
|
|
2300
|
-
}
|
|
2301
|
-
};
|
|
2302
|
-
request.onerror = function (event) {
|
|
2303
|
-
db.close();
|
|
2304
|
-
log.error('Error retrieving data: ', event.target.error);
|
|
2305
|
-
};
|
|
2306
|
-
} else {
|
|
2307
|
-
db.close();
|
|
2308
|
-
resolve('');
|
|
2309
|
-
}
|
|
2913
|
+
tx.onabort = function () {
|
|
2914
|
+
return reject(tx.error);
|
|
2310
2915
|
};
|
|
2311
2916
|
});
|
|
2312
2917
|
};
|
|
2313
|
-
var
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
if (
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2918
|
+
var putWithPossibleOutOfLineKey = function putWithPossibleOutOfLineKey(store, value, keyField) {
|
|
2919
|
+
try {
|
|
2920
|
+
if (store.keyPath !== null) {
|
|
2921
|
+
store.put(value);
|
|
2922
|
+
return;
|
|
2923
|
+
}
|
|
2924
|
+
} catch (e) {}
|
|
2925
|
+
var explicitKey = value === null || value === void 0 ? void 0 : value[keyField];
|
|
2926
|
+
if (explicitKey === undefined || explicitKey === null) {
|
|
2927
|
+
throw new Error("IndexedDB put requires explicit key but value has no '" + keyField + "' field");
|
|
2928
|
+
}
|
|
2929
|
+
store.put(value, explicitKey);
|
|
2930
|
+
};
|
|
2931
|
+
var setDataToDB = function setDataToDB(dbName, storeName, data, keyPath) {
|
|
2932
|
+
try {
|
|
2933
|
+
if (!('indexedDB' in window)) {
|
|
2934
|
+
log.info("This browser doesn't support IndexedDB");
|
|
2935
|
+
return Promise.resolve();
|
|
2936
|
+
}
|
|
2937
|
+
return Promise.resolve(ensureStore(dbName, storeName, keyPath)).then(function (db) {
|
|
2938
|
+
var _temp = _finallyRethrows(function () {
|
|
2939
|
+
var tx = db.transaction(storeName, 'readwrite');
|
|
2940
|
+
var store = tx.objectStore(storeName);
|
|
2941
|
+
data.forEach(function (value) {
|
|
2942
|
+
putWithPossibleOutOfLineKey(store, value, keyPath);
|
|
2943
|
+
});
|
|
2944
|
+
return Promise.resolve(awaitTransaction(tx)).then(function () {});
|
|
2945
|
+
}, function (_wasThrown, _result) {
|
|
2946
|
+
db.close();
|
|
2947
|
+
if (_wasThrown) throw _result;
|
|
2948
|
+
return _result;
|
|
2338
2949
|
});
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2950
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
2951
|
+
});
|
|
2952
|
+
} catch (e) {
|
|
2953
|
+
return Promise.reject(e);
|
|
2954
|
+
}
|
|
2955
|
+
};
|
|
2956
|
+
var getDataFromDB = function getDataFromDB(dbName, storeName, keyPathValue, keyPathName) {
|
|
2957
|
+
try {
|
|
2958
|
+
return Promise.resolve(_catch(function () {
|
|
2959
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2960
|
+
var _exit = false;
|
|
2961
|
+
function _temp5(_result2) {
|
|
2962
|
+
if (_exit) return _result2;
|
|
2963
|
+
var tx = db.transaction(storeName, 'readonly');
|
|
2964
|
+
var objectStore = tx.objectStore(storeName);
|
|
2965
|
+
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
2966
|
+
var request = objectStore.get(keyPathValue);
|
|
2967
|
+
request.onsuccess = function () {
|
|
2968
|
+
return resolve(request.result);
|
|
2969
|
+
};
|
|
2970
|
+
request.onerror = function () {
|
|
2971
|
+
return reject(request.error);
|
|
2972
|
+
};
|
|
2973
|
+
})).then(function (result) {
|
|
2974
|
+
db.close();
|
|
2975
|
+
return result || '';
|
|
2976
|
+
});
|
|
2977
|
+
}
|
|
2978
|
+
var _temp4 = function () {
|
|
2979
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
2980
|
+
var _temp3 = function _temp3() {
|
|
2981
|
+
_exit = true;
|
|
2982
|
+
return '';
|
|
2983
|
+
};
|
|
2984
|
+
db.close();
|
|
2985
|
+
var _temp2 = function () {
|
|
2986
|
+
if (keyPathName) {
|
|
2987
|
+
return Promise.resolve(ensureStore(dbName, storeName, keyPathName)).then(function (upgraded) {
|
|
2988
|
+
upgraded.close();
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
}();
|
|
2992
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
2993
|
+
}
|
|
2994
|
+
}();
|
|
2995
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
2350
2996
|
});
|
|
2351
|
-
}
|
|
2997
|
+
}, function (error) {
|
|
2998
|
+
log.error('Error retrieving data: ', error);
|
|
2999
|
+
return '';
|
|
3000
|
+
}));
|
|
3001
|
+
} catch (e) {
|
|
3002
|
+
return Promise.reject(e);
|
|
2352
3003
|
}
|
|
2353
3004
|
};
|
|
2354
3005
|
var getAllStoreNames = function getAllStoreNames(dbName) {
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
openRequest.onupgradeneeded = function (event) {
|
|
2358
|
-
var db = event.target.result;
|
|
2359
|
-
resolve(Array.from(db.objectStoreNames));
|
|
2360
|
-
};
|
|
2361
|
-
openRequest.onerror = function () {
|
|
2362
|
-
log.error('Indexeddb Error ', openRequest.error);
|
|
2363
|
-
reject(openRequest.error);
|
|
2364
|
-
};
|
|
2365
|
-
openRequest.onsuccess = function (event) {
|
|
2366
|
-
var db = event.target.result;
|
|
3006
|
+
try {
|
|
3007
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2367
3008
|
try {
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
resolve(storeNames);
|
|
2371
|
-
} catch (error) {
|
|
3009
|
+
return Array.from(db.objectStoreNames);
|
|
3010
|
+
} finally {
|
|
2372
3011
|
db.close();
|
|
2373
|
-
reject(error);
|
|
2374
3012
|
}
|
|
2375
|
-
};
|
|
2376
|
-
})
|
|
3013
|
+
});
|
|
3014
|
+
} catch (e) {
|
|
3015
|
+
return Promise.reject(e);
|
|
3016
|
+
}
|
|
2377
3017
|
};
|
|
2378
3018
|
var deleteStore = function deleteStore(dbName, storeName) {
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
var db = event.target.result;
|
|
2383
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2384
|
-
db.deleteObjectStore(storeName);
|
|
2385
|
-
currentVersion++;
|
|
2386
|
-
}
|
|
2387
|
-
};
|
|
2388
|
-
openRequest.onerror = function () {
|
|
2389
|
-
log.error('Indexeddb Error ', openRequest.error);
|
|
2390
|
-
reject(openRequest.error);
|
|
2391
|
-
};
|
|
2392
|
-
openRequest.onsuccess = function (event) {
|
|
2393
|
-
var db = event.target.result;
|
|
3019
|
+
try {
|
|
3020
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
3021
|
+
var shouldDelete = db.objectStoreNames.contains(storeName);
|
|
2394
3022
|
db.close();
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
3023
|
+
if (!shouldDelete) return;
|
|
3024
|
+
return Promise.resolve(runUpgrade(dbName, function (upgradeDb) {
|
|
3025
|
+
if (upgradeDb.objectStoreNames.contains(storeName)) {
|
|
3026
|
+
upgradeDb.deleteObjectStore(storeName);
|
|
3027
|
+
}
|
|
3028
|
+
})).then(function (upgraded) {
|
|
3029
|
+
upgraded.close();
|
|
3030
|
+
});
|
|
3031
|
+
});
|
|
3032
|
+
} catch (e) {
|
|
3033
|
+
return Promise.reject(e);
|
|
3034
|
+
}
|
|
2398
3035
|
};
|
|
2399
3036
|
|
|
2400
3037
|
var METADATA_DB_NAME = 'sceyt-metadata-db';
|
|
@@ -2417,7 +3054,7 @@ var storeMetadata = function storeMetadata(url, metadata) {
|
|
|
2417
3054
|
expiresAt: Date.now() + CACHE_DURATION
|
|
2418
3055
|
});
|
|
2419
3056
|
var _temp = _catch(function () {
|
|
2420
|
-
return Promise.resolve(
|
|
3057
|
+
return Promise.resolve(setDataToDB(METADATA_DB_NAME, currentMonth, [metadataRecord], 'url')).then(function () {});
|
|
2421
3058
|
}, function (error) {
|
|
2422
3059
|
console.error('Failed to store metadata in IndexedDB:', error);
|
|
2423
3060
|
});
|
|
@@ -2465,7 +3102,7 @@ var cleanupOldMonthsMetadata = function cleanupOldMonthsMetadata() {
|
|
|
2465
3102
|
var getMetadata = function getMetadata(url) {
|
|
2466
3103
|
return Promise.resolve(_catch(function () {
|
|
2467
3104
|
var currentMonth = getCurrentMonthKey();
|
|
2468
|
-
return Promise.resolve(
|
|
3105
|
+
return Promise.resolve(getDataFromDB(METADATA_DB_NAME, currentMonth, url, 'url')).then(function (result) {
|
|
2469
3106
|
if (!result || typeof result === 'string') {
|
|
2470
3107
|
return null;
|
|
2471
3108
|
}
|
|
@@ -9390,11 +10027,7 @@ function addMessageToMap(channelId, message) {
|
|
|
9390
10027
|
messagesMap[channelId] = [message];
|
|
9391
10028
|
}
|
|
9392
10029
|
if (message.deliveryStatus === MESSAGE_DELIVERY_STATUS.PENDING) {
|
|
9393
|
-
|
|
9394
|
-
pendingMessagesMap[channelId].push(message);
|
|
9395
|
-
} else {
|
|
9396
|
-
pendingMessagesMap[channelId] = [message];
|
|
9397
|
-
}
|
|
10030
|
+
setPendingMessage(channelId, message);
|
|
9398
10031
|
}
|
|
9399
10032
|
}
|
|
9400
10033
|
function updateMessageOnMap(channelId, updatedMessage) {
|
|
@@ -9417,18 +10050,29 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
9417
10050
|
}
|
|
9418
10051
|
}
|
|
9419
10052
|
}
|
|
10053
|
+
var updatedMessageData = null;
|
|
9420
10054
|
if (messagesMap[channelId]) {
|
|
9421
|
-
messagesMap[channelId]
|
|
10055
|
+
messagesMap[channelId].map(function (mes) {
|
|
9422
10056
|
if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
|
|
9423
10057
|
if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
|
|
9424
|
-
|
|
10058
|
+
updatedMessageData = _extends({}, updatedMessage.params);
|
|
10059
|
+
return updatedMessageData;
|
|
9425
10060
|
} else {
|
|
9426
|
-
|
|
10061
|
+
var _updatedMessage$param;
|
|
10062
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10063
|
+
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10064
|
+
return index === self.findIndex(function (t) {
|
|
10065
|
+
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10066
|
+
});
|
|
10067
|
+
})
|
|
10068
|
+
});
|
|
10069
|
+
return updatedMessage;
|
|
9427
10070
|
}
|
|
9428
10071
|
}
|
|
9429
10072
|
return mes;
|
|
9430
10073
|
});
|
|
9431
10074
|
}
|
|
10075
|
+
return updatedMessageData;
|
|
9432
10076
|
}
|
|
9433
10077
|
function addReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
9434
10078
|
if (messagesMap[channelId]) {
|
|
@@ -9541,6 +10185,24 @@ function removePendingMessageFromMap(channelId, messageId) {
|
|
|
9541
10185
|
});
|
|
9542
10186
|
}
|
|
9543
10187
|
}
|
|
10188
|
+
function updatePendingMessageOnMap(channelId, messageId, updatedMessage) {
|
|
10189
|
+
if (pendingMessagesMap[channelId]) {
|
|
10190
|
+
pendingMessagesMap[channelId] = pendingMessagesMap[channelId].map(function (msg) {
|
|
10191
|
+
if (msg.id === messageId || msg.tid === messageId) {
|
|
10192
|
+
return _extends({}, msg, updatedMessage);
|
|
10193
|
+
}
|
|
10194
|
+
return msg;
|
|
10195
|
+
});
|
|
10196
|
+
}
|
|
10197
|
+
}
|
|
10198
|
+
function getMessageFromPendingMessagesMap(channelId, messageId) {
|
|
10199
|
+
if (pendingMessagesMap[channelId]) {
|
|
10200
|
+
return pendingMessagesMap[channelId].find(function (msg) {
|
|
10201
|
+
return msg.id === messageId || msg.tid === messageId;
|
|
10202
|
+
});
|
|
10203
|
+
}
|
|
10204
|
+
return null;
|
|
10205
|
+
}
|
|
9544
10206
|
function clearMessagesMap() {
|
|
9545
10207
|
messagesMap = {};
|
|
9546
10208
|
}
|
|
@@ -9579,16 +10241,18 @@ var deletePendingMessage = function deletePendingMessage(channelId, message) {
|
|
|
9579
10241
|
var getPendingMessages = function getPendingMessages(channelId) {
|
|
9580
10242
|
return pendingMessagesMap[channelId];
|
|
9581
10243
|
};
|
|
9582
|
-
var
|
|
9583
|
-
|
|
9584
|
-
|
|
10244
|
+
var setPendingMessage = function setPendingMessage(channelId, pendingMessage) {
|
|
10245
|
+
var pendingMessages = getPendingMessages(channelId);
|
|
10246
|
+
if (pendingMessages && pendingMessages !== null && pendingMessages !== void 0 && pendingMessages.length) {
|
|
10247
|
+
if (!(pendingMessages !== null && pendingMessages !== void 0 && pendingMessages.find(function (msg) {
|
|
10248
|
+
return msg.tid === pendingMessage.tid;
|
|
10249
|
+
}))) {
|
|
10250
|
+
pendingMessages.push(pendingMessage);
|
|
10251
|
+
}
|
|
9585
10252
|
} else {
|
|
9586
10253
|
pendingMessagesMap[channelId] = [pendingMessage];
|
|
9587
10254
|
}
|
|
9588
10255
|
};
|
|
9589
|
-
var setPendingMessages = function setPendingMessages(channelId, pendingMessages) {
|
|
9590
|
-
pendingMessagesMap[channelId] = pendingMessages;
|
|
9591
|
-
};
|
|
9592
10256
|
var getPendingMessagesMap = function getPendingMessagesMap() {
|
|
9593
10257
|
return pendingMessagesMap;
|
|
9594
10258
|
};
|
|
@@ -9672,7 +10336,6 @@ var messageSlice = createSlice({
|
|
|
9672
10336
|
reducers: {
|
|
9673
10337
|
addMessage: function addMessage(state, action) {
|
|
9674
10338
|
var message = action.payload.message;
|
|
9675
|
-
log.info('addMessage ... ', message);
|
|
9676
10339
|
state.activeChannelMessages.push(message);
|
|
9677
10340
|
},
|
|
9678
10341
|
deleteMessageFromList: function deleteMessageFromList(state, action) {
|
|
@@ -9790,11 +10453,48 @@ var messageSlice = createSlice({
|
|
|
9790
10453
|
state.activeChannelMessages.push(params);
|
|
9791
10454
|
}
|
|
9792
10455
|
},
|
|
9793
|
-
|
|
10456
|
+
updateMessageAttachment: function updateMessageAttachment(state, action) {
|
|
9794
10457
|
var _action$payload4 = action.payload,
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
10458
|
+
url = _action$payload4.url,
|
|
10459
|
+
messageId = _action$payload4.messageId,
|
|
10460
|
+
params = _action$payload4.params;
|
|
10461
|
+
state.activeChannelMessages = state.activeChannelMessages.map(function (message) {
|
|
10462
|
+
if (message.id === messageId) {
|
|
10463
|
+
for (var index = 0; index < message.attachments.length; index++) {
|
|
10464
|
+
var attachment = message.attachments[index];
|
|
10465
|
+
if (attachment.url === url) {
|
|
10466
|
+
message.attachments[index] = _extends({}, attachment, params);
|
|
10467
|
+
}
|
|
10468
|
+
}
|
|
10469
|
+
}
|
|
10470
|
+
if (message.attachments.length) {
|
|
10471
|
+
var detachedAttachments = message.attachments.map(function (att) {
|
|
10472
|
+
var _att$user, _att$user2;
|
|
10473
|
+
return _extends({}, att, {
|
|
10474
|
+
user: _extends({}, att.user, {
|
|
10475
|
+
metadata: _extends({}, ((_att$user = att.user) === null || _att$user === void 0 ? void 0 : _att$user.metadata) || {}),
|
|
10476
|
+
presence: _extends({}, ((_att$user2 = att.user) === null || _att$user2 === void 0 ? void 0 : _att$user2.presence) || {})
|
|
10477
|
+
})
|
|
10478
|
+
});
|
|
10479
|
+
});
|
|
10480
|
+
updateMessageOnAllMessages(messageId, {
|
|
10481
|
+
attachments: detachedAttachments
|
|
10482
|
+
});
|
|
10483
|
+
updateMessageOnMap(message.channelId, {
|
|
10484
|
+
messageId: messageId,
|
|
10485
|
+
params: {
|
|
10486
|
+
attachments: detachedAttachments
|
|
10487
|
+
}
|
|
10488
|
+
});
|
|
10489
|
+
}
|
|
10490
|
+
return message;
|
|
10491
|
+
});
|
|
10492
|
+
},
|
|
10493
|
+
addReactionToMessage: function addReactionToMessage(state, action) {
|
|
10494
|
+
var _action$payload5 = action.payload,
|
|
10495
|
+
message = _action$payload5.message,
|
|
10496
|
+
reaction = _action$payload5.reaction,
|
|
10497
|
+
isSelf = _action$payload5.isSelf;
|
|
9798
10498
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
9799
10499
|
if (msg.id === message.id) {
|
|
9800
10500
|
var slfReactions = [].concat(msg.userReactions);
|
|
@@ -9814,10 +10514,10 @@ var messageSlice = createSlice({
|
|
|
9814
10514
|
});
|
|
9815
10515
|
},
|
|
9816
10516
|
deleteReactionFromMessage: function deleteReactionFromMessage(state, action) {
|
|
9817
|
-
var _action$
|
|
9818
|
-
reaction = _action$
|
|
9819
|
-
message = _action$
|
|
9820
|
-
isSelf = _action$
|
|
10517
|
+
var _action$payload6 = action.payload,
|
|
10518
|
+
reaction = _action$payload6.reaction,
|
|
10519
|
+
message = _action$payload6.message,
|
|
10520
|
+
isSelf = _action$payload6.isSelf;
|
|
9821
10521
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
9822
10522
|
if (msg.id === message.id) {
|
|
9823
10523
|
var userReactions = msg.userReactions;
|
|
@@ -9866,9 +10566,9 @@ var messageSlice = createSlice({
|
|
|
9866
10566
|
(_state$activeTabAttac = state.activeTabAttachments).push.apply(_state$activeTabAttac, action.payload.attachments);
|
|
9867
10567
|
},
|
|
9868
10568
|
addAttachmentsForPopup: function addAttachmentsForPopup(state, action) {
|
|
9869
|
-
var _action$
|
|
9870
|
-
attachments = _action$
|
|
9871
|
-
direction = _action$
|
|
10569
|
+
var _action$payload7 = action.payload,
|
|
10570
|
+
attachments = _action$payload7.attachments,
|
|
10571
|
+
direction = _action$payload7.direction;
|
|
9872
10572
|
if (direction === 'prev') {
|
|
9873
10573
|
var _state$attachmentsFor;
|
|
9874
10574
|
(_state$attachmentsFor = state.attachmentsForPopup).push.apply(_state$attachmentsFor, attachments);
|
|
@@ -9884,11 +10584,11 @@ var messageSlice = createSlice({
|
|
|
9884
10584
|
state.attachmentForPopupHasNext = action.payload.hasPrev;
|
|
9885
10585
|
},
|
|
9886
10586
|
updateUploadProgress: function updateUploadProgress(state, action) {
|
|
9887
|
-
var _action$
|
|
9888
|
-
uploaded = _action$
|
|
9889
|
-
total = _action$
|
|
9890
|
-
attachmentId = _action$
|
|
9891
|
-
progress = _action$
|
|
10587
|
+
var _action$payload8 = action.payload,
|
|
10588
|
+
uploaded = _action$payload8.uploaded,
|
|
10589
|
+
total = _action$payload8.total,
|
|
10590
|
+
attachmentId = _action$payload8.attachmentId,
|
|
10591
|
+
progress = _action$payload8.progress;
|
|
9892
10592
|
var updateData = {
|
|
9893
10593
|
uploaded: uploaded,
|
|
9894
10594
|
total: total,
|
|
@@ -9912,23 +10612,23 @@ var messageSlice = createSlice({
|
|
|
9912
10612
|
state.messageForReply = action.payload.message;
|
|
9913
10613
|
},
|
|
9914
10614
|
uploadAttachmentCompilation: function uploadAttachmentCompilation(state, action) {
|
|
9915
|
-
var _action$
|
|
9916
|
-
attachmentUploadingState = _action$
|
|
9917
|
-
attachmentId = _action$
|
|
10615
|
+
var _action$payload9 = action.payload,
|
|
10616
|
+
attachmentUploadingState = _action$payload9.attachmentUploadingState,
|
|
10617
|
+
attachmentId = _action$payload9.attachmentId;
|
|
9918
10618
|
state.attachmentsUploadingState[attachmentId] = attachmentUploadingState;
|
|
9919
10619
|
},
|
|
9920
10620
|
setReactionsList: function setReactionsList(state, action) {
|
|
9921
|
-
var _action$
|
|
9922
|
-
reactions = _action$
|
|
9923
|
-
hasNext = _action$
|
|
10621
|
+
var _action$payload0 = action.payload,
|
|
10622
|
+
reactions = _action$payload0.reactions,
|
|
10623
|
+
hasNext = _action$payload0.hasNext;
|
|
9924
10624
|
state.reactionsHasNext = hasNext;
|
|
9925
10625
|
state.reactionsList = [].concat(reactions);
|
|
9926
10626
|
},
|
|
9927
10627
|
addReactionsToList: function addReactionsToList(state, action) {
|
|
9928
10628
|
var _state$reactionsList;
|
|
9929
|
-
var _action$
|
|
9930
|
-
reactions = _action$
|
|
9931
|
-
hasNext = _action$
|
|
10629
|
+
var _action$payload1 = action.payload,
|
|
10630
|
+
reactions = _action$payload1.reactions,
|
|
10631
|
+
hasNext = _action$payload1.hasNext;
|
|
9932
10632
|
state.reactionsHasNext = hasNext;
|
|
9933
10633
|
(_state$reactionsList = state.reactionsList).push.apply(_state$reactionsList, reactions);
|
|
9934
10634
|
},
|
|
@@ -9989,6 +10689,7 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
9989
10689
|
addMessages = _messageSlice$actions.addMessages,
|
|
9990
10690
|
updateMessagesStatus = _messageSlice$actions.updateMessagesStatus,
|
|
9991
10691
|
updateMessage = _messageSlice$actions.updateMessage,
|
|
10692
|
+
updateMessageAttachment = _messageSlice$actions.updateMessageAttachment,
|
|
9992
10693
|
addReactionToMessage = _messageSlice$actions.addReactionToMessage,
|
|
9993
10694
|
deleteReactionFromMessage = _messageSlice$actions.deleteReactionFromMessage,
|
|
9994
10695
|
setHasPrevMessages = _messageSlice$actions.setHasPrevMessages,
|
|
@@ -10303,11 +11004,11 @@ var defaultTheme = {
|
|
|
10303
11004
|
light: '#D9D9DF',
|
|
10304
11005
|
dark: '#303032'
|
|
10305
11006
|
}, _colors[THEME_COLORS.OVERLAY_BACKGROUND] = {
|
|
10306
|
-
light: '
|
|
10307
|
-
dark: '
|
|
11007
|
+
light: '#111539',
|
|
11008
|
+
dark: '#111539'
|
|
10308
11009
|
}, _colors[THEME_COLORS.OVERLAY_BACKGROUND_2] = {
|
|
10309
|
-
light: '
|
|
10310
|
-
dark: '
|
|
11010
|
+
light: '#111539',
|
|
11011
|
+
dark: '#111539'
|
|
10311
11012
|
}, _colors[THEME_COLORS.WARNING] = {
|
|
10312
11013
|
light: '#FA4C56',
|
|
10313
11014
|
dark: '#FA4C56'
|
|
@@ -10392,14 +11093,6 @@ var ThemeReducer = (function (state, _ref) {
|
|
|
10392
11093
|
}
|
|
10393
11094
|
});
|
|
10394
11095
|
|
|
10395
|
-
var reducers = combineReducers({
|
|
10396
|
-
ChannelReducer: ChannelReducer,
|
|
10397
|
-
MessageReducer: MessageReducer,
|
|
10398
|
-
MembersReducer: MembersReducer,
|
|
10399
|
-
ThemeReducer: ThemeReducer,
|
|
10400
|
-
UserReducer: UserReducer
|
|
10401
|
-
});
|
|
10402
|
-
|
|
10403
11096
|
var createChannelAC = function createChannelAC(channelData, dontCreateIfNotExists) {
|
|
10404
11097
|
return {
|
|
10405
11098
|
type: CREATE_CHANNEL,
|
|
@@ -10641,11 +11334,12 @@ var sendTypingAC = function sendTypingAC(state) {
|
|
|
10641
11334
|
}
|
|
10642
11335
|
};
|
|
10643
11336
|
};
|
|
10644
|
-
var sendRecordingAC = function sendRecordingAC(state) {
|
|
11337
|
+
var sendRecordingAC = function sendRecordingAC(state, channelId) {
|
|
10645
11338
|
return {
|
|
10646
11339
|
type: SEND_RECORDING,
|
|
10647
11340
|
payload: {
|
|
10648
|
-
state: state
|
|
11341
|
+
state: state,
|
|
11342
|
+
channelId: channelId
|
|
10649
11343
|
}
|
|
10650
11344
|
};
|
|
10651
11345
|
};
|
|
@@ -11087,6 +11781,13 @@ function setMessagesHasNextAC(hasNext) {
|
|
|
11087
11781
|
hasNext: hasNext
|
|
11088
11782
|
});
|
|
11089
11783
|
}
|
|
11784
|
+
function setUpdateMessageAttachmentAC(url, messageId, params) {
|
|
11785
|
+
return updateMessageAttachment({
|
|
11786
|
+
url: url,
|
|
11787
|
+
messageId: messageId,
|
|
11788
|
+
params: params
|
|
11789
|
+
});
|
|
11790
|
+
}
|
|
11090
11791
|
function updateMessageAC(messageId, params, addIfNotExists) {
|
|
11091
11792
|
return updateMessage({
|
|
11092
11793
|
messageId: messageId,
|
|
@@ -12271,7 +12972,7 @@ var UploadPercent = styled.span(_templateObject38 || (_templateObject38 = _tagge
|
|
|
12271
12972
|
}, function (props) {
|
|
12272
12973
|
return props.fileAttachment || props.isRepliedMessage || props.isDetailsView ? '40px' : '56px';
|
|
12273
12974
|
}, function (props) {
|
|
12274
|
-
return props.backgroundColor + "
|
|
12975
|
+
return props.backgroundColor + "66";
|
|
12275
12976
|
}, function (props) {
|
|
12276
12977
|
return props.borderRadius ? props.borderRadius : props.fileAttachment ? '8px' : props.isRepliedMessage ? '4px' : ' 50%';
|
|
12277
12978
|
}, function (props) {
|
|
@@ -12948,7 +13649,7 @@ function watchForEvents() {
|
|
|
12948
13649
|
};
|
|
12949
13650
|
});
|
|
12950
13651
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
12951
|
-
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _channel1, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId0, _channelUpdateParams, _channel10, _updatedChannel, _channel11, _activeChannelId1, channelExist, _channel12, _channel13, _channel14, _channel15, _channel16, _channel17, _channel18, _groupName5, _channel19, _groupName6, _channel20, members, _activeChannelId10, i, _channel21, _channel22, _channelId2, from, name, status, _t;
|
|
13652
|
+
var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _channel1, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId0, _channelUpdateParams, _channel10, _updatedChannel, _channel11, _activeChannelId1, channelExist, _channel12, _channel13, _channel14, _channel15, _channel16, _channel17, _channel18, _groupName5, _channel19, _groupName6, _channel20, members, _activeChannelId10, i, _channel21, _channel22, _channelId2, from, name, status, _t;
|
|
12952
13653
|
return _regenerator().w(function (_context) {
|
|
12953
13654
|
while (1) switch (_context.n) {
|
|
12954
13655
|
case 0:
|
|
@@ -13434,8 +14135,20 @@ function watchForEvents() {
|
|
|
13434
14135
|
_activeChannelId6 = _context.v;
|
|
13435
14136
|
updateLastMessage = false;
|
|
13436
14137
|
markersMap = {};
|
|
14138
|
+
activeChannelMessages = getMessagesFromMap(_activeChannelId6);
|
|
13437
14139
|
markerList.messageIds.forEach(function (messageId) {
|
|
13438
|
-
|
|
14140
|
+
if (activeChannelMessages !== null && activeChannelMessages !== void 0 && activeChannelMessages.find(function (message) {
|
|
14141
|
+
return message.id === messageId;
|
|
14142
|
+
})) {
|
|
14143
|
+
removePendingMessageFromMap(_activeChannelId6, messageId);
|
|
14144
|
+
} else {
|
|
14145
|
+
var isPendingMessage = getMessageFromPendingMessagesMap(_activeChannelId6, messageId);
|
|
14146
|
+
if (isPendingMessage) {
|
|
14147
|
+
updatePendingMessageOnMap(_activeChannelId6, messageId, {
|
|
14148
|
+
deliveryStatus: markerList.name
|
|
14149
|
+
});
|
|
14150
|
+
}
|
|
14151
|
+
}
|
|
13439
14152
|
markersMap[messageId] = true;
|
|
13440
14153
|
if (_channel6) {
|
|
13441
14154
|
if (_channel6.lastMessage && messageId === _channel6.lastMessage.id && _channel6.lastMessage.deliveryStatus !== MESSAGE_DELIVERY_STATUS.READ) {
|
|
@@ -15592,47 +16305,43 @@ function sendTyping(action) {
|
|
|
15592
16305
|
}, _marked22, null, [[3, 7]]);
|
|
15593
16306
|
}
|
|
15594
16307
|
function sendRecording(action) {
|
|
15595
|
-
var state,
|
|
16308
|
+
var _action$payload, state, channelId, channel, _t24;
|
|
15596
16309
|
return _regenerator().w(function (_context23) {
|
|
15597
16310
|
while (1) switch (_context23.p = _context23.n) {
|
|
15598
16311
|
case 0:
|
|
15599
|
-
|
|
16312
|
+
_action$payload = action.payload, state = _action$payload.state, channelId = _action$payload.channelId;
|
|
15600
16313
|
_context23.n = 1;
|
|
15601
|
-
return call(
|
|
16314
|
+
return call(getChannelFromMap, channelId);
|
|
15602
16315
|
case 1:
|
|
15603
|
-
activeChannelId = _context23.v;
|
|
15604
|
-
_context23.n = 2;
|
|
15605
|
-
return call(getChannelFromMap, activeChannelId);
|
|
15606
|
-
case 2:
|
|
15607
16316
|
channel = _context23.v;
|
|
15608
|
-
_context23.p =
|
|
16317
|
+
_context23.p = 2;
|
|
15609
16318
|
if (!channel) {
|
|
15610
|
-
_context23.n =
|
|
16319
|
+
_context23.n = 5;
|
|
15611
16320
|
break;
|
|
15612
16321
|
}
|
|
15613
16322
|
if (!state) {
|
|
15614
|
-
_context23.n =
|
|
16323
|
+
_context23.n = 4;
|
|
15615
16324
|
break;
|
|
15616
16325
|
}
|
|
15617
|
-
_context23.n =
|
|
16326
|
+
_context23.n = 3;
|
|
15618
16327
|
return call(channel.startRecording);
|
|
15619
|
-
case
|
|
15620
|
-
_context23.n =
|
|
16328
|
+
case 3:
|
|
16329
|
+
_context23.n = 5;
|
|
15621
16330
|
break;
|
|
15622
|
-
case
|
|
15623
|
-
_context23.n =
|
|
16331
|
+
case 4:
|
|
16332
|
+
_context23.n = 5;
|
|
15624
16333
|
return call(channel.stopRecording);
|
|
15625
|
-
case
|
|
15626
|
-
_context23.n =
|
|
16334
|
+
case 5:
|
|
16335
|
+
_context23.n = 7;
|
|
15627
16336
|
break;
|
|
15628
|
-
case
|
|
15629
|
-
_context23.p =
|
|
16337
|
+
case 6:
|
|
16338
|
+
_context23.p = 6;
|
|
15630
16339
|
_t24 = _context23.v;
|
|
15631
16340
|
log.error('ERROR in send recording', _t24);
|
|
15632
|
-
case
|
|
16341
|
+
case 7:
|
|
15633
16342
|
return _context23.a(2);
|
|
15634
16343
|
}
|
|
15635
|
-
}, _marked23, null, [[
|
|
16344
|
+
}, _marked23, null, [[2, 6]]);
|
|
15636
16345
|
}
|
|
15637
16346
|
function clearHistory(action) {
|
|
15638
16347
|
var payload, channelId, channel, activeChannelId, groupName, _t25;
|
|
@@ -16505,13 +17214,7 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
16505
17214
|
})));
|
|
16506
17215
|
addMessageToMap(channel.id, messageToAdd);
|
|
16507
17216
|
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
16508
|
-
|
|
16509
|
-
var hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
16510
|
-
var activeChannelMessages = store.getState().MessageReducer.activeChannelMessages;
|
|
16511
|
-
var isLatestMessageInChannelMessages = activeChannelMessages[activeChannelMessages.length - 1].id === channel.lastMessage.id;
|
|
16512
|
-
if (hasNextMessages || !isLatestMessageInChannelMessages) {
|
|
16513
|
-
store.dispatch(getMessagesAC(channel, true, channel.lastMessage.id, undefined, undefined, false));
|
|
16514
|
-
}
|
|
17217
|
+
setPendingMessage(channel.id, messageToAdd);
|
|
16515
17218
|
store.dispatch(scrollToNewMessageAC(true));
|
|
16516
17219
|
store.dispatch(addMessageAC(messageToAdd));
|
|
16517
17220
|
return Promise.resolve();
|
|
@@ -16613,7 +17316,7 @@ function sendMessage(action) {
|
|
|
16613
17316
|
} else {
|
|
16614
17317
|
var pendingAttachment = getPendingAttachment(attachment.tid);
|
|
16615
17318
|
if (!attachment.cachedUrl) {
|
|
16616
|
-
|
|
17319
|
+
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, updatedAttachment, {
|
|
16617
17320
|
checksum: pendingAttachment.checksum
|
|
16618
17321
|
})], 'checksum');
|
|
16619
17322
|
}
|
|
@@ -16771,7 +17474,7 @@ function sendMessage(action) {
|
|
|
16771
17474
|
});
|
|
16772
17475
|
pendingAttachment = getPendingAttachment(messageAttachment[k].tid);
|
|
16773
17476
|
if (!messageAttachment[k].cachedUrl) {
|
|
16774
|
-
|
|
17477
|
+
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, messageResponse.attachments[k], {
|
|
16775
17478
|
checksum: pendingAttachment.checksum || (pendingAttachment === null || pendingAttachment === void 0 ? void 0 : pendingAttachment.file)
|
|
16776
17479
|
})], 'checksum');
|
|
16777
17480
|
}
|
|
@@ -16850,9 +17553,13 @@ function sendMessage(action) {
|
|
|
16850
17553
|
case 14:
|
|
16851
17554
|
_context2.p = 14;
|
|
16852
17555
|
_t = _context2.v;
|
|
16853
|
-
log.error('Error on uploading attachment',
|
|
17556
|
+
log.error('Error on uploading attachment', messageToSend.tid, _t);
|
|
17557
|
+
if (!(messageToSend.attachments && messageToSend.attachments.length)) {
|
|
17558
|
+
_context2.n = 15;
|
|
17559
|
+
break;
|
|
17560
|
+
}
|
|
16854
17561
|
_context2.n = 15;
|
|
16855
|
-
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL,
|
|
17562
|
+
return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, messageToSend.attachments[0].tid));
|
|
16856
17563
|
case 15:
|
|
16857
17564
|
updateMessageOnMap(channel.id, {
|
|
16858
17565
|
messageId: messageToSend.tid,
|
|
@@ -17167,7 +17874,7 @@ function forwardMessage(action) {
|
|
|
17167
17874
|
if (isCachedChannel) {
|
|
17168
17875
|
addMessageToMap(channelId, pendingMessage);
|
|
17169
17876
|
} else {
|
|
17170
|
-
|
|
17877
|
+
setPendingMessage(channelId, pendingMessage);
|
|
17171
17878
|
}
|
|
17172
17879
|
case 12:
|
|
17173
17880
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
@@ -17247,7 +17954,7 @@ function forwardMessage(action) {
|
|
|
17247
17954
|
}, _marked3$1, null, [[0, 19]]);
|
|
17248
17955
|
}
|
|
17249
17956
|
function resendMessage(action) {
|
|
17250
|
-
var payload, message, connectionState, channelId, channel, customUploader, attachmentCompilation, messageAttachment, messageCopy, handleUploadProgress, uri, filePath, handleUpdateLocalPath, pendingAttachment, thumbnailMetas, fileSize, meta, attachmentMeta, attachmentBuilder, attachmentToSend, messageResponse, messageUpdateData, fileType, messageToUpdate, _messageCopy2, _messageResponse, _messageUpdateData, activeChannelId, _messageToUpdate, _t5, _t6;
|
|
17957
|
+
var payload, message, connectionState, channelId, channel, customUploader, attachmentCompilation, messageAttachment, messageCopy, handleUploadProgress, uri, filePath, handleUpdateLocalPath, pendingAttachment, thumbnailMetas, fileSize, meta, attachmentMeta, attachmentBuilder, attachmentToSend, messageResponse, messageUpdateData, fileType, messageToUpdate, _messageCopy2, _getMessagesFromMap, _messageResponse, _messageUpdateData, isInActiveChannel, activeChannelId, _messageToUpdate, _t5, _t6;
|
|
17251
17958
|
return _regenerator().w(function (_context6) {
|
|
17252
17959
|
while (1) switch (_context6.p = _context6.n) {
|
|
17253
17960
|
case 0:
|
|
@@ -17515,7 +18222,12 @@ function resendMessage(action) {
|
|
|
17515
18222
|
bodyAttributes: _messageResponse.bodyAttributes,
|
|
17516
18223
|
createdAt: _messageResponse.createdAt
|
|
17517
18224
|
};
|
|
17518
|
-
|
|
18225
|
+
isInActiveChannel = (_getMessagesFromMap = getMessagesFromMap(channelId)) === null || _getMessagesFromMap === void 0 ? void 0 : _getMessagesFromMap.find(function (message) {
|
|
18226
|
+
return message.id === _messageCopy2.tid;
|
|
18227
|
+
});
|
|
18228
|
+
if (isInActiveChannel) {
|
|
18229
|
+
removePendingMessageFromMap(channel.id, _messageCopy2.tid);
|
|
18230
|
+
}
|
|
17519
18231
|
_context6.n = 27;
|
|
17520
18232
|
return put(updateMessageAC(_messageCopy2.tid, _messageUpdateData));
|
|
17521
18233
|
case 27:
|
|
@@ -17628,7 +18340,7 @@ function deleteMessage(action) {
|
|
|
17628
18340
|
}, _marked5$1, null, [[0, 5]]);
|
|
17629
18341
|
}
|
|
17630
18342
|
function editMessage(action) {
|
|
17631
|
-
var payload, _message, channelId, channel, editedMessage, messageToUpdate, _t8;
|
|
18343
|
+
var payload, _message, channelId, channel, linkAttachments, anotherAttachments, linkAttachmentsToSend, editedMessage, messageToUpdate, _t8;
|
|
17632
18344
|
return _regenerator().w(function (_context8) {
|
|
17633
18345
|
while (1) switch (_context8.p = _context8.n) {
|
|
17634
18346
|
case 0:
|
|
@@ -17645,6 +18357,21 @@ function editMessage(action) {
|
|
|
17645
18357
|
setChannelInMap(channel);
|
|
17646
18358
|
}
|
|
17647
18359
|
}
|
|
18360
|
+
if (_message.attachments.length > 0) {
|
|
18361
|
+
linkAttachments = _message.attachments.filter(function (att) {
|
|
18362
|
+
return att.type === attachmentTypes.link;
|
|
18363
|
+
});
|
|
18364
|
+
anotherAttachments = _message.attachments.filter(function (att) {
|
|
18365
|
+
return att.type !== attachmentTypes.link;
|
|
18366
|
+
});
|
|
18367
|
+
linkAttachmentsToSend = [];
|
|
18368
|
+
linkAttachments.forEach(function (linkAttachment) {
|
|
18369
|
+
var linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
|
|
18370
|
+
var linkAttachmentToSend = linkAttachmentBuilder.setName(linkAttachment.name).setUpload(linkAttachment.upload).create();
|
|
18371
|
+
linkAttachmentsToSend.push(linkAttachmentToSend);
|
|
18372
|
+
});
|
|
18373
|
+
_message.attachments = [].concat(anotherAttachments, linkAttachmentsToSend);
|
|
18374
|
+
}
|
|
17648
18375
|
_context8.n = 2;
|
|
17649
18376
|
return call(channel.editMessage, _extends({}, _message, {
|
|
17650
18377
|
metadata: isJSON(_message.metadata) ? _message.metadata : JSON.stringify(_message.metadata),
|
|
@@ -17685,15 +18412,17 @@ function editMessage(action) {
|
|
|
17685
18412
|
}, _marked6$1, null, [[0, 5]]);
|
|
17686
18413
|
}
|
|
17687
18414
|
function getMessagesQuery(action) {
|
|
17688
|
-
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, pendingMessages, _messagesMap, filteredPendingMessages,
|
|
18415
|
+
var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, _t9;
|
|
17689
18416
|
return _regenerator().w(function (_context9) {
|
|
17690
18417
|
while (1) switch (_context9.p = _context9.n) {
|
|
17691
18418
|
case 0:
|
|
17692
|
-
|
|
17693
|
-
_context9.
|
|
18419
|
+
_context9.p = 0;
|
|
18420
|
+
_context9.n = 1;
|
|
18421
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
18422
|
+
case 1:
|
|
17694
18423
|
_action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight;
|
|
17695
18424
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
17696
|
-
_context9.n =
|
|
18425
|
+
_context9.n = 47;
|
|
17697
18426
|
break;
|
|
17698
18427
|
}
|
|
17699
18428
|
SceytChatClient = getClient();
|
|
@@ -17705,42 +18434,39 @@ function getMessagesQuery(action) {
|
|
|
17705
18434
|
case 2:
|
|
17706
18435
|
messageQuery = _context9.v;
|
|
17707
18436
|
query.messageQuery = messageQuery;
|
|
17708
|
-
_context9.n = 3;
|
|
17709
|
-
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
17710
|
-
case 3:
|
|
17711
18437
|
cachedMessages = getMessagesFromMap(channel.id);
|
|
17712
18438
|
result = {
|
|
17713
18439
|
messages: [],
|
|
17714
18440
|
hasNext: false
|
|
17715
18441
|
};
|
|
17716
18442
|
if (!loadWithLastMessage) {
|
|
17717
|
-
_context9.n =
|
|
18443
|
+
_context9.n = 13;
|
|
17718
18444
|
break;
|
|
17719
18445
|
}
|
|
17720
18446
|
allMessages = getAllMessages();
|
|
17721
18447
|
havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
|
|
17722
18448
|
if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
|
|
17723
|
-
_context9.n =
|
|
18449
|
+
_context9.n = 8;
|
|
17724
18450
|
break;
|
|
17725
18451
|
}
|
|
17726
18452
|
setHasPrevCached(false);
|
|
17727
18453
|
setAllMessages([]);
|
|
17728
|
-
_context9.n =
|
|
18454
|
+
_context9.n = 3;
|
|
17729
18455
|
return call(messageQuery.loadPreviousMessageId, '0');
|
|
17730
|
-
case
|
|
18456
|
+
case 3:
|
|
17731
18457
|
result = _context9.v;
|
|
17732
18458
|
if (!(result.messages.length === 50)) {
|
|
17733
|
-
_context9.n =
|
|
18459
|
+
_context9.n = 5;
|
|
17734
18460
|
break;
|
|
17735
18461
|
}
|
|
17736
18462
|
messageQuery.limit = 30;
|
|
17737
|
-
_context9.n =
|
|
18463
|
+
_context9.n = 4;
|
|
17738
18464
|
return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17739
|
-
case
|
|
18465
|
+
case 4:
|
|
17740
18466
|
secondResult = _context9.v;
|
|
17741
18467
|
result.messages = [].concat(secondResult.messages, result.messages);
|
|
17742
18468
|
result.hasNext = secondResult.hasNext;
|
|
17743
|
-
case
|
|
18469
|
+
case 5:
|
|
17744
18470
|
sentMessages = [];
|
|
17745
18471
|
if (withDeliveredMessages) {
|
|
17746
18472
|
sentMessages = getFromAllMessagesByMessageId('', '', true);
|
|
@@ -17753,43 +18479,40 @@ function getMessagesQuery(action) {
|
|
|
17753
18479
|
return !messagesMap[msg.tid || ''];
|
|
17754
18480
|
});
|
|
17755
18481
|
result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
|
|
17756
|
-
_context9.n =
|
|
18482
|
+
_context9.n = 6;
|
|
17757
18483
|
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17758
|
-
case
|
|
18484
|
+
case 6:
|
|
17759
18485
|
setMessagesToMap(channel.id, result.messages);
|
|
17760
18486
|
setAllMessages(result.messages);
|
|
17761
|
-
_context9.n =
|
|
18487
|
+
_context9.n = 7;
|
|
17762
18488
|
return put(setMessagesHasPrevAC(true));
|
|
18489
|
+
case 7:
|
|
18490
|
+
_context9.n = 10;
|
|
18491
|
+
break;
|
|
17763
18492
|
case 8:
|
|
18493
|
+
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
17764
18494
|
_context9.n = 9;
|
|
17765
|
-
return put(
|
|
18495
|
+
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17766
18496
|
case 9:
|
|
17767
|
-
_context9.n =
|
|
17768
|
-
|
|
18497
|
+
_context9.n = 10;
|
|
18498
|
+
return put(setMessagesHasPrevAC(true));
|
|
17769
18499
|
case 10:
|
|
17770
|
-
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
17771
18500
|
_context9.n = 11;
|
|
17772
|
-
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17773
|
-
case 11:
|
|
17774
|
-
_context9.n = 12;
|
|
17775
|
-
return put(setMessagesHasPrevAC(true));
|
|
17776
|
-
case 12:
|
|
17777
|
-
_context9.n = 13;
|
|
17778
18501
|
return put(setMessagesHasNextAC(false));
|
|
17779
|
-
case
|
|
18502
|
+
case 11:
|
|
17780
18503
|
setHasNextCached(false);
|
|
17781
18504
|
if (!messageId) {
|
|
17782
|
-
_context9.n =
|
|
18505
|
+
_context9.n = 12;
|
|
17783
18506
|
break;
|
|
17784
18507
|
}
|
|
17785
|
-
_context9.n =
|
|
18508
|
+
_context9.n = 12;
|
|
17786
18509
|
return put(setScrollToMessagesAC(messageId, highlight));
|
|
17787
|
-
case
|
|
18510
|
+
case 12:
|
|
17788
18511
|
_context9.n = 45;
|
|
17789
18512
|
break;
|
|
17790
|
-
case
|
|
18513
|
+
case 13:
|
|
17791
18514
|
if (!messageId) {
|
|
17792
|
-
_context9.n =
|
|
18515
|
+
_context9.n = 25;
|
|
17793
18516
|
break;
|
|
17794
18517
|
}
|
|
17795
18518
|
_allMessages = getAllMessages();
|
|
@@ -17798,164 +18521,174 @@ function getMessagesQuery(action) {
|
|
|
17798
18521
|
});
|
|
17799
18522
|
maxLengthPart = MESSAGES_MAX_LENGTH / 2;
|
|
17800
18523
|
if (!(messageIndex >= maxLengthPart)) {
|
|
17801
|
-
_context9.n =
|
|
18524
|
+
_context9.n = 15;
|
|
17802
18525
|
break;
|
|
17803
18526
|
}
|
|
17804
18527
|
result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
|
|
17805
|
-
_context9.n =
|
|
18528
|
+
_context9.n = 14;
|
|
17806
18529
|
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17807
|
-
case
|
|
18530
|
+
case 14:
|
|
17808
18531
|
setHasPrevCached(messageIndex > maxLengthPart);
|
|
17809
18532
|
setHasNextCached(_allMessages.length > maxLengthPart);
|
|
17810
|
-
_context9.n =
|
|
18533
|
+
_context9.n = 22;
|
|
17811
18534
|
break;
|
|
17812
|
-
case
|
|
18535
|
+
case 15:
|
|
17813
18536
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
17814
18537
|
log.info('load by message id from server ...............', messageId);
|
|
17815
|
-
_context9.n =
|
|
18538
|
+
_context9.n = 16;
|
|
17816
18539
|
return call(messageQuery.loadNearMessageId, messageId);
|
|
17817
|
-
case
|
|
18540
|
+
case 16:
|
|
17818
18541
|
result = _context9.v;
|
|
17819
18542
|
if (!(result.messages.length === 50)) {
|
|
17820
|
-
_context9.n =
|
|
18543
|
+
_context9.n = 19;
|
|
17821
18544
|
break;
|
|
17822
18545
|
}
|
|
17823
18546
|
messageQuery.limit = (MESSAGES_MAX_LENGTH - 50) / 2;
|
|
17824
|
-
_context9.n =
|
|
18547
|
+
_context9.n = 17;
|
|
17825
18548
|
return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17826
|
-
case
|
|
18549
|
+
case 17:
|
|
17827
18550
|
_secondResult = _context9.v;
|
|
17828
18551
|
messageQuery.reverse = false;
|
|
17829
|
-
_context9.n =
|
|
18552
|
+
_context9.n = 18;
|
|
17830
18553
|
return call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
17831
|
-
case
|
|
18554
|
+
case 18:
|
|
17832
18555
|
thirdResult = _context9.v;
|
|
17833
18556
|
result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
|
|
17834
18557
|
result.hasNext = _secondResult.hasNext;
|
|
17835
18558
|
messageQuery.reverse = true;
|
|
17836
|
-
case
|
|
18559
|
+
case 19:
|
|
17837
18560
|
log.info('result from server ....... ', result);
|
|
17838
|
-
_context9.n =
|
|
18561
|
+
_context9.n = 20;
|
|
17839
18562
|
return put(setMessagesHasNextAC(true));
|
|
17840
|
-
case
|
|
17841
|
-
_context9.n =
|
|
18563
|
+
case 20:
|
|
18564
|
+
_context9.n = 21;
|
|
17842
18565
|
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17843
|
-
case
|
|
18566
|
+
case 21:
|
|
17844
18567
|
setAllMessages([].concat(result.messages));
|
|
17845
18568
|
setHasPrevCached(false);
|
|
17846
18569
|
setHasNextCached(false);
|
|
17847
|
-
case
|
|
17848
|
-
_context9.n =
|
|
18570
|
+
case 22:
|
|
18571
|
+
_context9.n = 23;
|
|
17849
18572
|
return put(setScrollToMessagesAC(messageId));
|
|
17850
|
-
case
|
|
18573
|
+
case 23:
|
|
18574
|
+
_context9.n = 24;
|
|
18575
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18576
|
+
case 24:
|
|
17851
18577
|
_context9.n = 45;
|
|
17852
18578
|
break;
|
|
17853
|
-
case
|
|
18579
|
+
case 25:
|
|
17854
18580
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
17855
|
-
_context9.n =
|
|
18581
|
+
_context9.n = 38;
|
|
17856
18582
|
break;
|
|
17857
18583
|
}
|
|
17858
18584
|
setAllMessages([]);
|
|
17859
18585
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
17860
18586
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
17861
|
-
_context9.n =
|
|
18587
|
+
_context9.n = 31;
|
|
17862
18588
|
break;
|
|
17863
18589
|
}
|
|
17864
|
-
_context9.n =
|
|
18590
|
+
_context9.n = 26;
|
|
17865
18591
|
return call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
17866
|
-
case
|
|
18592
|
+
case 26:
|
|
17867
18593
|
result = _context9.v;
|
|
17868
18594
|
if (!(result.messages.length === 50)) {
|
|
17869
|
-
_context9.n =
|
|
18595
|
+
_context9.n = 30;
|
|
17870
18596
|
break;
|
|
17871
18597
|
}
|
|
17872
18598
|
messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
|
|
17873
|
-
_context9.n =
|
|
18599
|
+
_context9.n = 27;
|
|
17874
18600
|
return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17875
|
-
case
|
|
18601
|
+
case 27:
|
|
17876
18602
|
_secondResult2 = _context9.v;
|
|
17877
18603
|
if (!(channel.newMessageCount > 25)) {
|
|
17878
|
-
_context9.n =
|
|
18604
|
+
_context9.n = 29;
|
|
17879
18605
|
break;
|
|
17880
18606
|
}
|
|
17881
18607
|
messageQuery.reverse = false;
|
|
17882
|
-
_context9.n =
|
|
18608
|
+
_context9.n = 28;
|
|
17883
18609
|
return call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
17884
|
-
case
|
|
18610
|
+
case 28:
|
|
17885
18611
|
_thirdResult = _context9.v;
|
|
17886
18612
|
result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
|
|
17887
18613
|
messageQuery.reverse = true;
|
|
17888
|
-
_context9.n =
|
|
18614
|
+
_context9.n = 30;
|
|
17889
18615
|
break;
|
|
17890
|
-
case
|
|
18616
|
+
case 29:
|
|
17891
18617
|
result.messages = [].concat(_secondResult2.messages, result.messages);
|
|
17892
|
-
case
|
|
17893
|
-
_context9.n =
|
|
18618
|
+
case 30:
|
|
18619
|
+
_context9.n = 34;
|
|
17894
18620
|
break;
|
|
17895
|
-
case
|
|
17896
|
-
_context9.n =
|
|
18621
|
+
case 31:
|
|
18622
|
+
_context9.n = 32;
|
|
17897
18623
|
return call(messageQuery.loadPrevious);
|
|
17898
|
-
case
|
|
18624
|
+
case 32:
|
|
17899
18625
|
result = _context9.v;
|
|
17900
18626
|
if (!(result.messages.length === 50)) {
|
|
17901
|
-
_context9.n =
|
|
18627
|
+
_context9.n = 34;
|
|
17902
18628
|
break;
|
|
17903
18629
|
}
|
|
17904
18630
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
17905
|
-
_context9.n =
|
|
18631
|
+
_context9.n = 33;
|
|
17906
18632
|
return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17907
|
-
case
|
|
18633
|
+
case 33:
|
|
17908
18634
|
_secondResult3 = _context9.v;
|
|
17909
18635
|
result.messages = [].concat(_secondResult3.messages, result.messages);
|
|
17910
18636
|
result.hasNext = _secondResult3.hasNext;
|
|
17911
|
-
case
|
|
18637
|
+
case 34:
|
|
17912
18638
|
setMessagesToMap(channel.id, result.messages);
|
|
17913
|
-
_context9.n =
|
|
18639
|
+
_context9.n = 35;
|
|
17914
18640
|
return put(setMessagesHasPrevAC(true));
|
|
17915
|
-
case
|
|
17916
|
-
_context9.n =
|
|
18641
|
+
case 35:
|
|
18642
|
+
_context9.n = 36;
|
|
17917
18643
|
return put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
17918
|
-
case
|
|
18644
|
+
case 36:
|
|
17919
18645
|
setAllMessages([].concat(result.messages));
|
|
17920
|
-
_context9.n =
|
|
18646
|
+
_context9.n = 37;
|
|
17921
18647
|
return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17922
|
-
case
|
|
18648
|
+
case 37:
|
|
17923
18649
|
_context9.n = 45;
|
|
17924
18650
|
break;
|
|
17925
|
-
case
|
|
18651
|
+
case 38:
|
|
17926
18652
|
setAllMessages([]);
|
|
17927
18653
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
17928
|
-
_context9.n =
|
|
18654
|
+
_context9.n = 39;
|
|
17929
18655
|
break;
|
|
17930
18656
|
}
|
|
17931
18657
|
setAllMessages([].concat(cachedMessages));
|
|
17932
|
-
_context9.n =
|
|
18658
|
+
_context9.n = 39;
|
|
17933
18659
|
return put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
|
|
17934
|
-
case
|
|
18660
|
+
case 39:
|
|
17935
18661
|
log.info('load message from server');
|
|
17936
|
-
_context9.n =
|
|
18662
|
+
_context9.n = 40;
|
|
17937
18663
|
return call(messageQuery.loadPrevious);
|
|
17938
|
-
case
|
|
18664
|
+
case 40:
|
|
17939
18665
|
result = _context9.v;
|
|
17940
18666
|
if (!(result.messages.length === 50)) {
|
|
17941
|
-
_context9.n =
|
|
18667
|
+
_context9.n = 42;
|
|
17942
18668
|
break;
|
|
17943
18669
|
}
|
|
17944
18670
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
17945
|
-
_context9.n =
|
|
18671
|
+
_context9.n = 41;
|
|
17946
18672
|
return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17947
|
-
case
|
|
18673
|
+
case 41:
|
|
17948
18674
|
_secondResult4 = _context9.v;
|
|
17949
18675
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
17950
18676
|
result.hasNext = _secondResult4.hasNext;
|
|
17951
|
-
case
|
|
18677
|
+
case 42:
|
|
18678
|
+
updatedMessages = [];
|
|
17952
18679
|
result.messages.forEach(function (msg) {
|
|
17953
|
-
updateMessageOnMap(channel.id, {
|
|
18680
|
+
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
17954
18681
|
messageId: msg.id,
|
|
17955
18682
|
params: msg
|
|
17956
18683
|
});
|
|
17957
|
-
updateMessageOnAllMessages(msg.id, msg);
|
|
18684
|
+
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
18685
|
+
updatedMessages.push(updatedMessage || msg);
|
|
17958
18686
|
});
|
|
18687
|
+
setMessagesToMap(channel.id, updatedMessages);
|
|
18688
|
+
setAllMessages([].concat(updatedMessages));
|
|
18689
|
+
_context9.n = 43;
|
|
18690
|
+
return put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
18691
|
+
case 43:
|
|
17959
18692
|
_context9.n = 44;
|
|
17960
18693
|
return put(setMessagesHasPrevAC(result.hasNext));
|
|
17961
18694
|
case 44:
|
|
@@ -17964,7 +18697,7 @@ function getMessagesQuery(action) {
|
|
|
17964
18697
|
case 45:
|
|
17965
18698
|
pendingMessages = getPendingMessages(channel.id);
|
|
17966
18699
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
17967
|
-
_context9.n =
|
|
18700
|
+
_context9.n = 46;
|
|
17968
18701
|
break;
|
|
17969
18702
|
}
|
|
17970
18703
|
_messagesMap = {};
|
|
@@ -17977,34 +18710,32 @@ function getMessagesQuery(action) {
|
|
|
17977
18710
|
_context9.n = 46;
|
|
17978
18711
|
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
17979
18712
|
case 46:
|
|
17980
|
-
for (index = 0; index < filteredPendingMessages.length; index++) {
|
|
17981
|
-
mes = filteredPendingMessages[index];
|
|
17982
|
-
removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
|
|
17983
|
-
}
|
|
17984
|
-
case 47:
|
|
17985
18713
|
_context9.n = 48;
|
|
17986
|
-
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
17987
|
-
case 48:
|
|
17988
|
-
_context9.n = 50;
|
|
17989
18714
|
break;
|
|
17990
|
-
case
|
|
18715
|
+
case 47:
|
|
17991
18716
|
if (!channel.isMockChannel) {
|
|
17992
|
-
_context9.n =
|
|
18717
|
+
_context9.n = 48;
|
|
17993
18718
|
break;
|
|
17994
18719
|
}
|
|
17995
|
-
_context9.n =
|
|
18720
|
+
_context9.n = 48;
|
|
17996
18721
|
return put(setMessagesAC([]));
|
|
17997
|
-
case
|
|
17998
|
-
_context9.n =
|
|
18722
|
+
case 48:
|
|
18723
|
+
_context9.n = 50;
|
|
17999
18724
|
break;
|
|
18000
|
-
case
|
|
18001
|
-
_context9.p =
|
|
18725
|
+
case 49:
|
|
18726
|
+
_context9.p = 49;
|
|
18002
18727
|
_t9 = _context9.v;
|
|
18003
18728
|
log.error('error in message query', _t9);
|
|
18729
|
+
case 50:
|
|
18730
|
+
_context9.p = 50;
|
|
18731
|
+
_context9.n = 51;
|
|
18732
|
+
return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18733
|
+
case 51:
|
|
18734
|
+
return _context9.f(50);
|
|
18004
18735
|
case 52:
|
|
18005
18736
|
return _context9.a(2);
|
|
18006
18737
|
}
|
|
18007
|
-
}, _marked7$1, null, [[
|
|
18738
|
+
}, _marked7$1, null, [[0, 49, 50, 52]]);
|
|
18008
18739
|
}
|
|
18009
18740
|
function loadMoreMessages(action) {
|
|
18010
18741
|
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
|
|
@@ -19311,9 +20042,16 @@ function rootSaga() {
|
|
|
19311
20042
|
}, _marked$6);
|
|
19312
20043
|
}
|
|
19313
20044
|
|
|
20045
|
+
enableMapSet();
|
|
19314
20046
|
var sagaMiddleware = createSagaMiddleware();
|
|
19315
20047
|
var store = configureStore({
|
|
19316
|
-
reducer:
|
|
20048
|
+
reducer: {
|
|
20049
|
+
ChannelReducer: ChannelReducer,
|
|
20050
|
+
MessageReducer: MessageReducer,
|
|
20051
|
+
MembersReducer: MembersReducer,
|
|
20052
|
+
ThemeReducer: ThemeReducer,
|
|
20053
|
+
UserReducer: UserReducer
|
|
20054
|
+
},
|
|
19317
20055
|
middleware: function middleware(getDefaultMiddleware) {
|
|
19318
20056
|
return getDefaultMiddleware({
|
|
19319
20057
|
thunk: false,
|
|
@@ -20239,7 +20977,15 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
|
|
|
20239
20977
|
color: textPrimary
|
|
20240
20978
|
}, ":"), typingOrRecording.isTyping ? 'typing' : 'recording', "...")), !isTypingOrRecording && (draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageText, {
|
|
20241
20979
|
color: textSecondary
|
|
20242
|
-
}, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null),
|
|
20980
|
+
}, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), MessageTextFormat({
|
|
20981
|
+
text: draftMessageText,
|
|
20982
|
+
message: lastMessage,
|
|
20983
|
+
contactsMap: contactsMap,
|
|
20984
|
+
getFromContacts: getFromContacts,
|
|
20985
|
+
isLastMessage: true,
|
|
20986
|
+
accentColor: accentColor,
|
|
20987
|
+
textSecondary: textSecondary
|
|
20988
|
+
}))) : 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) {
|
|
20243
20989
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
20244
20990
|
})) + " " + (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) {
|
|
20245
20991
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
@@ -20309,11 +21055,14 @@ var Channel = function Channel(_ref3) {
|
|
|
20309
21055
|
var _useState = useState(),
|
|
20310
21056
|
draftMessageText = _useState[0],
|
|
20311
21057
|
setDraftMessageText = _useState[1];
|
|
21058
|
+
var _useState2 = useState(),
|
|
21059
|
+
draftMessage = _useState2[0],
|
|
21060
|
+
setDraftMessage = _useState2[1];
|
|
20312
21061
|
var lastMessage = channel.lastReactedMessage || channel.lastMessage;
|
|
20313
21062
|
var lastMessageMetas = lastMessage && lastMessage.type === 'system' && lastMessage.metadata && (isJSON(lastMessage.metadata) ? JSON.parse(lastMessage.metadata) : lastMessage.metadata);
|
|
20314
|
-
var
|
|
20315
|
-
statusWidth =
|
|
20316
|
-
setStatusWidth =
|
|
21063
|
+
var _useState3 = useState(0),
|
|
21064
|
+
statusWidth = _useState3[0],
|
|
21065
|
+
setStatusWidth = _useState3[1];
|
|
20317
21066
|
var avatarName = channel.subject || (isDirectChannel && directChannelUser ? directChannelUser.firstName || directChannelUser.id : isSelfChannel ? 'Me' : '');
|
|
20318
21067
|
var handleChangeActiveChannel = function handleChangeActiveChannel(chan) {
|
|
20319
21068
|
if (activeChannel.id !== chan.id) {
|
|
@@ -20337,17 +21086,25 @@ var Channel = function Channel(_ref3) {
|
|
|
20337
21086
|
if (channelDraftMessage || draftAudioRecording) {
|
|
20338
21087
|
if (channelDraftMessage) {
|
|
20339
21088
|
setDraftMessageText(channelDraftMessage.text);
|
|
21089
|
+
setDraftMessage({
|
|
21090
|
+
mentionedUsers: channelDraftMessage.mentionedMembers,
|
|
21091
|
+
body: channelDraftMessage.text,
|
|
21092
|
+
bodyAttributes: channelDraftMessage.bodyAttributes
|
|
21093
|
+
});
|
|
20340
21094
|
} else if (draftAudioRecording) {
|
|
20341
21095
|
setDraftMessageText('Voice');
|
|
21096
|
+
setDraftMessage(undefined);
|
|
20342
21097
|
}
|
|
20343
21098
|
} else if (draftMessageText) {
|
|
20344
21099
|
setDraftMessageText(undefined);
|
|
21100
|
+
setDraftMessage(undefined);
|
|
20345
21101
|
}
|
|
20346
21102
|
}
|
|
20347
21103
|
}, [activeChannel.id]);
|
|
20348
21104
|
useEffect(function () {
|
|
20349
21105
|
if (channelDraftIsRemoved && channelDraftIsRemoved === channel.id) {
|
|
20350
21106
|
setDraftMessageText(undefined);
|
|
21107
|
+
setDraftMessage(undefined);
|
|
20351
21108
|
dispatch(setChannelDraftMessageIsRemovedAC());
|
|
20352
21109
|
}
|
|
20353
21110
|
}, [channelDraftIsRemoved]);
|
|
@@ -20375,15 +21132,15 @@ var Channel = function Channel(_ref3) {
|
|
|
20375
21132
|
items: filteredItems,
|
|
20376
21133
|
isTyping: !!filteredItems.find(function (item) {
|
|
20377
21134
|
return item.typingState;
|
|
21135
|
+
}),
|
|
21136
|
+
isRecording: !!filteredItems.find(function (item) {
|
|
21137
|
+
return item.recordingState;
|
|
20378
21138
|
})
|
|
20379
21139
|
};
|
|
20380
21140
|
}, [typingOrRecordingIndicator]);
|
|
20381
|
-
var isTypingOrRecording = useMemo(function () {
|
|
20382
|
-
return typingOrRecording.items.length > 0;
|
|
20383
|
-
}, [typingOrRecording]);
|
|
20384
21141
|
var MessageText = useMemo(function () {
|
|
20385
21142
|
return /*#__PURE__*/React__default.createElement(ChannelMessageText, {
|
|
20386
|
-
isTypingOrRecording:
|
|
21143
|
+
isTypingOrRecording: (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording),
|
|
20387
21144
|
user: user,
|
|
20388
21145
|
contactsMap: contactsMap,
|
|
20389
21146
|
getFromContacts: getFromContacts,
|
|
@@ -20394,10 +21151,10 @@ var Channel = function Channel(_ref3) {
|
|
|
20394
21151
|
textPrimary: textPrimary,
|
|
20395
21152
|
textSecondary: textSecondary,
|
|
20396
21153
|
draftMessageText: draftMessageText,
|
|
20397
|
-
lastMessage: lastMessage,
|
|
21154
|
+
lastMessage: draftMessage || lastMessage,
|
|
20398
21155
|
isDirectChannel: isDirectChannel
|
|
20399
21156
|
});
|
|
20400
|
-
}, [
|
|
21157
|
+
}, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel]);
|
|
20401
21158
|
return /*#__PURE__*/React__default.createElement(Container$2, {
|
|
20402
21159
|
theme: theme,
|
|
20403
21160
|
selectedChannel: channel.id === activeChannel.id,
|
|
@@ -20440,9 +21197,9 @@ var Channel = function Channel(_ref3) {
|
|
|
20440
21197
|
unreadMentions: !!(channel.newMentionCount && channel.newMentionCount > 0),
|
|
20441
21198
|
fontSize: channelLastMessageFontSize,
|
|
20442
21199
|
height: channelLastMessageHeight
|
|
20443
|
-
},
|
|
21200
|
+
}, typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping || typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording ? !isDirectChannel ? (/*#__PURE__*/React__default.createElement(LastMessageAuthor, {
|
|
20444
21201
|
typing: typingOrRecording.isTyping,
|
|
20445
|
-
recording:
|
|
21202
|
+
recording: typingOrRecording.isRecording,
|
|
20446
21203
|
color: textPrimary
|
|
20447
21204
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20448
21205
|
ref: messageAuthorRef
|
|
@@ -20460,11 +21217,11 @@ var Channel = function Channel(_ref3) {
|
|
|
20460
21217
|
color: textPrimary
|
|
20461
21218
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20462
21219
|
ref: messageAuthorRef
|
|
20463
|
-
}, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !
|
|
21220
|
+
}, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id)) : ((typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording)) && draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== 'system') && (/*#__PURE__*/React__default.createElement(Points, {
|
|
20464
21221
|
color: draftMessageText && warningColor || textPrimary
|
|
20465
21222
|
}, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
|
|
20466
21223
|
color: textSecondary,
|
|
20467
|
-
withAttachments: !!(lastMessage && lastMessage.attachments && lastMessage.attachments.length && lastMessage.attachments[0].type !== attachmentTypes.link) && !
|
|
21224
|
+
withAttachments: !!(lastMessage && lastMessage.attachments && lastMessage.attachments.length && lastMessage.attachments[0].type !== attachmentTypes.link) && (!(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) || !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording)),
|
|
20468
21225
|
noBody: lastMessage && !lastMessage.body,
|
|
20469
21226
|
deletedMessage: lastMessage && lastMessage.state === MESSAGE_STATUS.DELETE
|
|
20470
21227
|
}, MessageText)))), /*#__PURE__*/React__default.createElement(ChannelStatus, {
|
|
@@ -20483,7 +21240,7 @@ var Channel = function Channel(_ref3) {
|
|
|
20483
21240
|
}, lastMessage && lastMessage.createdAt && lastMessageDateFormat(lastMessage.createdAt))), /*#__PURE__*/React__default.createElement(UnreadInfo, {
|
|
20484
21241
|
bottom: !(lastMessage || typingOrRecording.items.length > 0 || draftMessageText) ? '5px' : ''
|
|
20485
21242
|
}, !!(channel.newMentionCount && channel.newMentionCount > 0) && (/*#__PURE__*/React__default.createElement(UnreadMentionIconWrapper, {
|
|
20486
|
-
iconColor:
|
|
21243
|
+
iconColor: accentColor,
|
|
20487
21244
|
rightMargin: !!(channel.newMessageCount || channel.unread)
|
|
20488
21245
|
}, /*#__PURE__*/React__default.createElement(SvgUnreadMention, null))), !!(channel.newMessageCount || channel.unread) && (/*#__PURE__*/React__default.createElement(UnreadCount, {
|
|
20489
21246
|
backgroundColor: accentColor,
|
|
@@ -20980,7 +21737,7 @@ var Container$4 = styled.div(_templateObject$8 || (_templateObject$8 = _taggedTe
|
|
|
20980
21737
|
}, function (props) {
|
|
20981
21738
|
return props.height ? props.height + "px" : '0px';
|
|
20982
21739
|
}, function (props) {
|
|
20983
|
-
return props.background + "
|
|
21740
|
+
return props.background + "66";
|
|
20984
21741
|
});
|
|
20985
21742
|
|
|
20986
21743
|
var _templateObject$9, _templateObject2$8, _templateObject3$5, _templateObject4$5, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject0$2, _templateObject1$2;
|
|
@@ -22473,7 +23230,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
22473
23230
|
channelAvatarSize = _ref.channelAvatarSize,
|
|
22474
23231
|
channelAvatarTextSize = _ref.channelAvatarTextSize,
|
|
22475
23232
|
searchChannelInputFontSize = _ref.searchChannelInputFontSize,
|
|
22476
|
-
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize
|
|
23233
|
+
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize,
|
|
23234
|
+
searchChannelsPadding = _ref.searchChannelsPadding;
|
|
22477
23235
|
var _useColor = useColors(),
|
|
22478
23236
|
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
22479
23237
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -22710,7 +23468,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
22710
23468
|
}, /*#__PURE__*/React__default.createElement(ChannelListHeader, {
|
|
22711
23469
|
withCustomList: !!List,
|
|
22712
23470
|
maxWidth: channelListRef.current && ((_channelListRef$curre2 = channelListRef.current) === null || _channelListRef$curre2 === void 0 ? void 0 : _channelListRef$curre2.clientWidth) || 0,
|
|
22713
|
-
borderColor: borderColor
|
|
23471
|
+
borderColor: borderColor,
|
|
23472
|
+
padding: searchChannelsPadding
|
|
22714
23473
|
}, Profile, showSearch && searchChannelsPosition === 'inline' ? (/*#__PURE__*/React__default.createElement(ChannelSearch, {
|
|
22715
23474
|
inline: true,
|
|
22716
23475
|
borderRadius: searchInputBorderRadius,
|
|
@@ -23033,8 +23792,10 @@ var NoData = styled.div(_templateObject8$4 || (_templateObject8$4 = _taggedTempl
|
|
|
23033
23792
|
return props.color;
|
|
23034
23793
|
});
|
|
23035
23794
|
var LoadingWrapper = styled.div(_templateObject9$4 || (_templateObject9$4 = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: calc(50% - 20px);\n top: calc(50% - 20px);\n"])));
|
|
23036
|
-
var ChannelListHeader = styled.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding:
|
|
23795
|
+
var ChannelListHeader = styled.div(_templateObject0$3 || (_templateObject0$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n max-width: ", ";\n padding: ", ";\n padding-left: 22px;\n box-sizing: border-box;\n padding-left: ", ";\n border-right: ", ";\n"])), function (props) {
|
|
23037
23796
|
return props.maxWidth ? props.maxWidth + "px" : 'inherit';
|
|
23797
|
+
}, function (props) {
|
|
23798
|
+
return props.padding || '12px';
|
|
23038
23799
|
}, function (props) {
|
|
23039
23800
|
return props.withoutProfile && '52px';
|
|
23040
23801
|
}, function (props) {
|
|
@@ -23424,7 +24185,7 @@ var Container$a = styled.div(_templateObject$j || (_templateObject$j = _taggedTe
|
|
|
23424
24185
|
}, function (props) {
|
|
23425
24186
|
return props.dateDividerTextColor;
|
|
23426
24187
|
}, function (props) {
|
|
23427
|
-
return props.dateDividerBackgroundColor + "
|
|
24188
|
+
return props.dateDividerBackgroundColor + "66";
|
|
23428
24189
|
}, function (props) {
|
|
23429
24190
|
return props.dateDividerBorderRadius || '14px';
|
|
23430
24191
|
}, function (props) {
|
|
@@ -24060,7 +24821,7 @@ var VolumeSlide = styled.input(_templateObject9$6 || (_templateObject9$6 = _tagg
|
|
|
24060
24821
|
var Progress = styled.input(_templateObject0$5 || (_templateObject0$5 = _taggedTemplateLiteralLoose(["\n -webkit-appearance: none;\n margin-right: 15px;\n width: 100%;\n height: 4px;\n background: rgba(255, 255, 255, 0.6);\n border-radius: 5px;\n background-image: linear-gradient(#fff, #fff);\n //background-size: 70% 100%;\n background-repeat: no-repeat;\n cursor: pointer;\n\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: #fff;\n cursor: pointer;\n box-shadow: 0 0 2px 0 #555;\n transition: all 0.3s ease-in-out;\n }\n &::-moz-range-thumb {\n -webkit-appearance: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: #fff;\n cursor: pointer;\n box-shadow: 0 0 2px 0 #555;\n transition: all 0.3s ease-in-out;\n }\n\n &::-ms-thumb {\n -webkit-appearance: none;\n height: 16px;\n width: 16px;\n border-radius: 50%;\n background: #fff;\n cursor: pointer;\n box-shadow: 0 0 2px 0 #555;\n transition: all 0.3s ease-in-out;\n }\n\n &::-webkit-slider-thumb:hover {\n background: #fff;\n }\n &::-moz-range-thumb:hover {\n background: #fff;\n }\n &::-ms-thumb:hover {\n background: #fff;\n }\n\n &::-webkit-slider-runnable-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n transition: all 0.3s ease-in-out;\n }\n\n &::-moz-range-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n transition: all 0.3s ease-in-out;\n }\n &::-ms-track {\n -webkit-appearance: none;\n box-shadow: none;\n border: none;\n background: transparent;\n transition: all 0.3s ease-in-out;\n }\n"])));
|
|
24061
24822
|
var FullScreenWrapper = styled.div(_templateObject1$3 || (_templateObject1$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n margin-left: 16px;\n cursor: pointer;\n @media (max-width: 768px) {\n margin-left: 12px;\n & > svg {\n width: 18px;\n height: 18px;\n }\n }\n @media (max-width: 480px) {\n margin-left: auto;\n & > svg {\n width: 16px;\n height: 16px;\n }\n }\n"])));
|
|
24062
24823
|
|
|
24063
|
-
var _templateObject$l, _templateObject2$i, _templateObject3$e, _templateObject4$c, _templateObject5$a, _templateObject6$8, _templateObject7$7, _templateObject8$7, _templateObject9$7, _templateObject0$6;
|
|
24824
|
+
var _templateObject$l, _templateObject2$i, _templateObject3$e, _templateObject4$c, _templateObject5$a, _templateObject6$8, _templateObject7$7, _templateObject8$7, _templateObject9$7, _templateObject0$6, _templateObject1$4;
|
|
24064
24825
|
function ForwardMessagePopup(_ref) {
|
|
24065
24826
|
var title = _ref.title,
|
|
24066
24827
|
buttonText = _ref.buttonText,
|
|
@@ -24310,7 +25071,9 @@ function ForwardMessagePopup(_ref) {
|
|
|
24310
25071
|
backgroundColor: 'transparent',
|
|
24311
25072
|
checkedBackgroundColor: accentColor
|
|
24312
25073
|
}));
|
|
24313
|
-
})))
|
|
25074
|
+
}))), !searchedChannels.chats_groups.length && !searchedChannels.channels.length && (/*#__PURE__*/React__default.createElement(NoResults, {
|
|
25075
|
+
color: textSecondary
|
|
25076
|
+
}, "No channels found")))) : channels.map(function (channel) {
|
|
24314
25077
|
var _channel$metadata3;
|
|
24315
25078
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
24316
25079
|
var isSelfChannel = isDirectChannel && ((_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s);
|
|
@@ -24394,6 +25157,9 @@ var SelectedChannelName = styled.span(_templateObject9$7 || (_templateObject9$7
|
|
|
24394
25157
|
return props.color;
|
|
24395
25158
|
});
|
|
24396
25159
|
var StyledSubtractSvg$1 = styled(SvgCross)(_templateObject0$6 || (_templateObject0$6 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-left: 4px;\n transform: translate(2px, 0);\n"])));
|
|
25160
|
+
var NoResults = styled.div(_templateObject1$4 || (_templateObject1$4 = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n line-height: 16px;\n font-weight: 500;\n text-align: center;\n margin-top: 20px;\n color: ", ";\n"])), function (props) {
|
|
25161
|
+
return props.color;
|
|
25162
|
+
});
|
|
24397
25163
|
|
|
24398
25164
|
var _templateObject$m, _templateObject2$j;
|
|
24399
25165
|
var CustomRadio = function CustomRadio(_ref) {
|
|
@@ -24567,7 +25333,7 @@ var DeleteOptionItem = styled.div(_templateObject2$k || (_templateObject2$k = _t
|
|
|
24567
25333
|
return props.color;
|
|
24568
25334
|
});
|
|
24569
25335
|
|
|
24570
|
-
var _templateObject$o, _templateObject2$l, _templateObject3$f, _templateObject4$d, _templateObject5$b, _templateObject6$9, _templateObject7$8, _templateObject8$8, _templateObject9$8, _templateObject0$7, _templateObject1$
|
|
25336
|
+
var _templateObject$o, _templateObject2$l, _templateObject3$f, _templateObject4$d, _templateObject5$b, _templateObject6$9, _templateObject7$8, _templateObject8$8, _templateObject9$8, _templateObject0$7, _templateObject1$5, _templateObject10$2, _templateObject11$2, _templateObject12$2, _templateObject13$2;
|
|
24571
25337
|
var SliderPopup = function SliderPopup(_ref) {
|
|
24572
25338
|
var channel = _ref.channel,
|
|
24573
25339
|
setIsSliderOpen = _ref.setIsSliderOpen,
|
|
@@ -24954,7 +25720,7 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
24954
25720
|
text: '',
|
|
24955
25721
|
styles: {
|
|
24956
25722
|
background: {
|
|
24957
|
-
fill: overlayBackground2 + "
|
|
25723
|
+
fill: overlayBackground2 + "66"
|
|
24958
25724
|
},
|
|
24959
25725
|
path: {
|
|
24960
25726
|
stroke: textOnPrimary,
|
|
@@ -25108,7 +25874,7 @@ var FileSize = styled.span(_templateObject9$8 || (_templateObject9$8 = _taggedTe
|
|
|
25108
25874
|
var UserName = styled.h4(_templateObject0$7 || (_templateObject0$7 = _taggedTemplateLiteralLoose(["\n margin: 0;\n color: ", ";\n font-weight: 500;\n font-size: 15px;\n line-height: 18px;\n letter-spacing: -0.2px;\n"])), function (props) {
|
|
25109
25875
|
return props.color;
|
|
25110
25876
|
});
|
|
25111
|
-
var ActionsWrapper = styled.div(_templateObject1$
|
|
25877
|
+
var ActionsWrapper = styled.div(_templateObject1$5 || (_templateObject1$5 = _taggedTemplateLiteralLoose(["\n display: flex;\n"])));
|
|
25112
25878
|
var IconWrapper = styled.span(_templateObject10$2 || (_templateObject10$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n cursor: pointer;\n color: ", ";\n margin: ", ";\n\n & > svg {\n width: 28px;\n height: 28px;\n }\n\n ", "\n"])), function (props) {
|
|
25113
25879
|
return props.color;
|
|
25114
25880
|
}, function (props) {
|
|
@@ -25209,7 +25975,7 @@ var Container$c = styled.div(_templateObject$p || (_templateObject$p = _taggedTe
|
|
|
25209
25975
|
}, function (props) {
|
|
25210
25976
|
return props.textColor;
|
|
25211
25977
|
}, function (props) {
|
|
25212
|
-
return props.backgroundColor + "
|
|
25978
|
+
return props.backgroundColor + "66";
|
|
25213
25979
|
}, function (props) {
|
|
25214
25980
|
return props.border;
|
|
25215
25981
|
}, function (props) {
|
|
@@ -26176,7 +26942,9 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
26176
26942
|
setLoading(false);
|
|
26177
26943
|
var minutes = Math.floor(video.duration / 60);
|
|
26178
26944
|
var _seconds = Math.floor(video.duration % 60);
|
|
26179
|
-
|
|
26945
|
+
if (!videoCurrentTime) {
|
|
26946
|
+
setVideoCurrentTime(minutes + ":" + (_seconds < 10 ? "0" + _seconds : _seconds));
|
|
26947
|
+
}
|
|
26180
26948
|
if (setVideoIsReadyToSend) {
|
|
26181
26949
|
setVideoIsReadyToSend(file.tid);
|
|
26182
26950
|
}
|
|
@@ -26257,7 +27025,7 @@ var VideoTime = styled.div(_templateObject2$o || (_templateObject2$o = _taggedTe
|
|
|
26257
27025
|
}, function (props) {
|
|
26258
27026
|
return props.isRepliedMessage ? '0 3px' : '4px 6px';
|
|
26259
27027
|
}, function (props) {
|
|
26260
|
-
return props.messageTimeBackgroundColor + "
|
|
27028
|
+
return props.messageTimeBackgroundColor + "66";
|
|
26261
27029
|
}, function (props) {
|
|
26262
27030
|
return props.color;
|
|
26263
27031
|
}, function (props) {
|
|
@@ -28453,7 +29221,7 @@ var Timer$1 = styled.div(_templateObject6$c || (_templateObject6$c = _taggedTemp
|
|
|
28453
29221
|
return props.color;
|
|
28454
29222
|
});
|
|
28455
29223
|
|
|
28456
|
-
var _templateObject$u, _templateObject2$q, _templateObject3$k, _templateObject4$h, _templateObject5$f, _templateObject6$d, _templateObject7$b, _templateObject8$a, _templateObject9$a, _templateObject0$9, _templateObject1$
|
|
29224
|
+
var _templateObject$u, _templateObject2$q, _templateObject3$k, _templateObject4$h, _templateObject5$f, _templateObject6$d, _templateObject7$b, _templateObject8$a, _templateObject9$a, _templateObject0$9, _templateObject1$6, _templateObject10$3, _templateObject11$3;
|
|
28457
29225
|
var Attachment = function Attachment(_ref) {
|
|
28458
29226
|
var attachment = _ref.attachment,
|
|
28459
29227
|
_ref$isPreview = _ref.isPreview,
|
|
@@ -28566,7 +29334,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
28566
29334
|
if (downloadIsCancelled) {
|
|
28567
29335
|
setDownloadIsCancelled(false);
|
|
28568
29336
|
if (customDownloader) {
|
|
28569
|
-
customDownloader(attachment.url, false, function () {
|
|
29337
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29338
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29339
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29340
|
+
setSizeProgress({
|
|
29341
|
+
loaded: progress.loaded || 0,
|
|
29342
|
+
total: progress.total || 0
|
|
29343
|
+
});
|
|
29344
|
+
setProgress(uploadPercent);
|
|
29345
|
+
}, messageType).then(function (url) {
|
|
28570
29346
|
downloadImage(url);
|
|
28571
29347
|
});
|
|
28572
29348
|
} else {
|
|
@@ -28694,23 +29470,35 @@ var Attachment = function Attachment(_ref) {
|
|
|
28694
29470
|
}
|
|
28695
29471
|
}, [attachmentUrl]);
|
|
28696
29472
|
useEffect(function () {
|
|
28697
|
-
if (connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29473
|
+
if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
28698
29474
|
getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
|
|
28699
29475
|
try {
|
|
28700
|
-
if (attachment.type ===
|
|
29476
|
+
if (attachment.type === attachmentTypes.image && !isPreview) {
|
|
28701
29477
|
if (cachedUrl) {
|
|
28702
29478
|
setAttachmentUrl(cachedUrl);
|
|
29479
|
+
dispatch(setUpdateMessageAttachmentAC(attachment.url, attachment.messageId, {
|
|
29480
|
+
attachmentUrl: cachedUrl
|
|
29481
|
+
}));
|
|
28703
29482
|
setIsCached(true);
|
|
28704
29483
|
} else {
|
|
28705
29484
|
setIsCached(false);
|
|
28706
29485
|
setDownloadingFile(true);
|
|
28707
29486
|
if (customDownloader) {
|
|
28708
|
-
customDownloader(attachment.url, false, function () {
|
|
29487
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29488
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29489
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29490
|
+
setSizeProgress({
|
|
29491
|
+
loaded: progress.loaded || 0,
|
|
29492
|
+
total: progress.total || 0
|
|
29493
|
+
});
|
|
29494
|
+
setProgress(uploadPercent);
|
|
29495
|
+
}, messageType).then(function (url) {
|
|
28709
29496
|
try {
|
|
28710
29497
|
downloadImage(url);
|
|
28711
29498
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
28712
29499
|
setAttachmentToCache(attachment.url, response);
|
|
28713
29500
|
setIsCached(true);
|
|
29501
|
+
setDownloadingFile(false);
|
|
28714
29502
|
});
|
|
28715
29503
|
} catch (e) {
|
|
28716
29504
|
return Promise.reject(e);
|
|
@@ -28749,7 +29537,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
28749
29537
|
log.info('error on get attachment url from cache. .. ', e);
|
|
28750
29538
|
if (customDownloader) {
|
|
28751
29539
|
setDownloadingFile(true);
|
|
28752
|
-
customDownloader(attachment.url,
|
|
29540
|
+
customDownloader(attachment.url, true, function (progress) {
|
|
29541
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29542
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29543
|
+
setSizeProgress({
|
|
29544
|
+
loaded: progress.loaded || 0,
|
|
29545
|
+
total: progress.total || 0
|
|
29546
|
+
});
|
|
29547
|
+
setProgress(uploadPercent);
|
|
29548
|
+
}, messageType).then(function (url) {
|
|
28753
29549
|
try {
|
|
28754
29550
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
28755
29551
|
setAttachmentToCache(attachment.url, response);
|
|
@@ -28816,7 +29612,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28816
29612
|
}
|
|
28817
29613
|
}
|
|
28818
29614
|
}, [attachmentsUploadProgress]);
|
|
28819
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, attachment.type ===
|
|
29615
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, attachment.type === attachmentTypes.image ? (/*#__PURE__*/React__default.createElement(AttachmentImgCont, {
|
|
28820
29616
|
draggable: false,
|
|
28821
29617
|
onClick: function onClick() {
|
|
28822
29618
|
return handleMediaItemClick && !isInUploadingState && !downloadingFile && handleMediaItemClick(attachment);
|
|
@@ -28854,7 +29650,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28854
29650
|
imageMinWidth: imageMinWidth,
|
|
28855
29651
|
withPrefix: withPrefix,
|
|
28856
29652
|
borderColor: borderColor
|
|
28857
|
-
}, /*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29653
|
+
}, !isPreview && (isInUploadingState || downloadingFile) && sizeProgress && sizeProgress.loaded < sizeProgress.total && (/*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
28858
29654
|
isRepliedMessage: isRepliedMessage,
|
|
28859
29655
|
isDetailsView: isDetailsView,
|
|
28860
29656
|
backgroundColor: overlayBackground2
|
|
@@ -28871,7 +29667,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28871
29667
|
text: '',
|
|
28872
29668
|
styles: {
|
|
28873
29669
|
background: {
|
|
28874
|
-
fill: overlayBackground2 + "
|
|
29670
|
+
fill: overlayBackground2 + "66"
|
|
28875
29671
|
},
|
|
28876
29672
|
path: {
|
|
28877
29673
|
stroke: textOnPrimary,
|
|
@@ -28884,13 +29680,13 @@ var Attachment = function Attachment(_ref) {
|
|
|
28884
29680
|
}
|
|
28885
29681
|
})), sizeProgress && (/*#__PURE__*/React__default.createElement(SizeProgress, {
|
|
28886
29682
|
color: textOnPrimary
|
|
28887
|
-
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1)))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29683
|
+
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1))))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
28888
29684
|
backgroundColor: background,
|
|
28889
29685
|
color: iconInactive,
|
|
28890
29686
|
onClick: function onClick() {
|
|
28891
29687
|
return handleDeleteSelectedAttachment(attachment.tid);
|
|
28892
29688
|
}
|
|
28893
|
-
})))) : attachment.type ===
|
|
29689
|
+
})))) : attachment.type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isPreview ? (/*#__PURE__*/React__default.createElement(VideoCont, {
|
|
28894
29690
|
onClick: function onClick() {
|
|
28895
29691
|
return handleMediaItemClick && !downloadingFile && !isInUploadingState && (attachmentCompilationState[attachment.tid] ? attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.FAIL || attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING : true) && handleMediaItemClick(attachment);
|
|
28896
29692
|
},
|
|
@@ -28921,7 +29717,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28921
29717
|
text: '',
|
|
28922
29718
|
styles: {
|
|
28923
29719
|
background: {
|
|
28924
|
-
fill: overlayBackground2 + "
|
|
29720
|
+
fill: overlayBackground2 + "66"
|
|
28925
29721
|
},
|
|
28926
29722
|
path: {
|
|
28927
29723
|
stroke: textOnPrimary,
|
|
@@ -28986,7 +29782,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28986
29782
|
React__default.createElement(AttachmentIconCont, {
|
|
28987
29783
|
backgroundColor: accentColor,
|
|
28988
29784
|
className: 'icon-warpper'
|
|
28989
|
-
}, previewFileType && previewFileType ===
|
|
29785
|
+
}, previewFileType && previewFileType === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(VideoPreview, {
|
|
28990
29786
|
file: attachment,
|
|
28991
29787
|
backgroundColor: backgroundColor && backgroundColor !== 'inherit' ? backgroundColor : overlayBackground2,
|
|
28992
29788
|
width: '40px',
|
|
@@ -29028,7 +29824,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29028
29824
|
text: '',
|
|
29029
29825
|
styles: {
|
|
29030
29826
|
background: {
|
|
29031
|
-
fill: overlayBackground2 + "
|
|
29827
|
+
fill: overlayBackground2 + "66"
|
|
29032
29828
|
},
|
|
29033
29829
|
path: {
|
|
29034
29830
|
stroke: textOnPrimary,
|
|
@@ -29120,7 +29916,7 @@ var AttachmentSize = styled.span(_templateObject0$9 || (_templateObject0$9 = _ta
|
|
|
29120
29916
|
}, function (props) {
|
|
29121
29917
|
return props.errorColor;
|
|
29122
29918
|
});
|
|
29123
|
-
var AttachmentFileInfo = styled.div(_templateObject1$
|
|
29919
|
+
var AttachmentFileInfo = styled.div(_templateObject1$6 || (_templateObject1$6 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
|
|
29124
29920
|
return props.isPreview && "line-height: 14px;\n max-width: calc(100% - 44px);\n ";
|
|
29125
29921
|
});
|
|
29126
29922
|
var AttachmentImg$1 = styled.img(_templateObject10$3 || (_templateObject10$3 = _taggedTemplateLiteralLoose(["\n position: ", ";\n border-radius: ", ";\n padding: ", ";\n box-sizing: border-box;\n max-width: 100%;\n max-height: ", ";\n width: ", ";\n height: ", ";\n min-height: ", ";\n min-width: ", ";\n object-fit: cover;\n visibility: ", ";\n z-index: 2;\n"])), function (props) {
|
|
@@ -30200,7 +30996,7 @@ var MessageStatusAndTime = function MessageStatusAndTime(_ref) {
|
|
|
30200
30996
|
}))));
|
|
30201
30997
|
};
|
|
30202
30998
|
var MessageStatusAndTime$1 = /*#__PURE__*/React__default.memo(MessageStatusAndTime, function (prevProps, nextProps) {
|
|
30203
|
-
return prevProps.message.state === nextProps.message.state && prevProps.message.deliveryStatus === nextProps.message.deliveryStatus && prevProps.message.createdAt === nextProps.message.createdAt && prevProps.showMessageTimeAndStatusOnlyOnHover === nextProps.showMessageTimeAndStatusOnlyOnHover && prevProps.messageStatusSize === nextProps.messageStatusSize && prevProps.messageStatusColor === nextProps.messageStatusColor && prevProps.messageReadStatusColor === nextProps.messageReadStatusColor && prevProps.messageStateFontSize === nextProps.messageStateFontSize && prevProps.messageStateColor === nextProps.messageStateColor && prevProps.messageTimeFontSize === nextProps.messageTimeFontSize && prevProps.messageStatusAndTimeLineHeight === nextProps.messageStatusAndTimeLineHeight && prevProps.messageTimeColor === nextProps.messageTimeColor && prevProps.messageTimeVisible === nextProps.messageTimeVisible && prevProps.messageStatusVisible === nextProps.messageStatusVisible && prevProps.ownMessageOnRightSide === nextProps.ownMessageOnRightSide && prevProps.bottomOfMessage === nextProps.bottomOfMessage && prevProps.marginBottom === nextProps.marginBottom && prevProps.messageTimeColorOnAttachment === nextProps.messageTimeColorOnAttachment;
|
|
30999
|
+
return prevProps.message.state === nextProps.message.state && prevProps.message.deliveryStatus === nextProps.message.deliveryStatus && prevProps.message.createdAt === nextProps.message.createdAt && prevProps.showMessageTimeAndStatusOnlyOnHover === nextProps.showMessageTimeAndStatusOnlyOnHover && prevProps.messageStatusSize === nextProps.messageStatusSize && prevProps.messageStatusColor === nextProps.messageStatusColor && prevProps.messageReadStatusColor === nextProps.messageReadStatusColor && prevProps.messageStateFontSize === nextProps.messageStateFontSize && prevProps.messageStateColor === nextProps.messageStateColor && prevProps.messageTimeFontSize === nextProps.messageTimeFontSize && prevProps.messageStatusAndTimeLineHeight === nextProps.messageStatusAndTimeLineHeight && prevProps.messageTimeColor === nextProps.messageTimeColor && prevProps.messageTimeVisible === nextProps.messageTimeVisible && prevProps.messageStatusVisible === nextProps.messageStatusVisible && prevProps.ownMessageOnRightSide === nextProps.ownMessageOnRightSide && prevProps.bottomOfMessage === nextProps.bottomOfMessage && prevProps.marginBottom === nextProps.marginBottom && prevProps.messageTimeColorOnAttachment === nextProps.messageTimeColorOnAttachment && prevProps.withAttachment === nextProps.withAttachment;
|
|
30204
31000
|
});
|
|
30205
31001
|
var MessageStatus = styled.span(_templateObject$z || (_templateObject$z = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n margin-left: 4px;\n text-align: right;\n height: ", ";\n\n & > svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
30206
31002
|
return props.height || '14px';
|
|
@@ -30219,7 +31015,7 @@ var MessageStatusAndTimeContainer = styled.span(_templateObject3$o || (_template
|
|
|
30219
31015
|
}, function (props) {
|
|
30220
31016
|
return props.withAttachment && '4px 6px';
|
|
30221
31017
|
}, function (props) {
|
|
30222
|
-
return props.withAttachment && !props.fileAttachment && props.messageTimeBackgroundColor + "
|
|
31018
|
+
return props.withAttachment && !props.fileAttachment && props.messageTimeBackgroundColor + "66";
|
|
30223
31019
|
}, function (props) {
|
|
30224
31020
|
return props.lineHeight || '14px';
|
|
30225
31021
|
}, function (props) {
|
|
@@ -30263,9 +31059,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30263
31059
|
setMetadata = _useState[1];
|
|
30264
31060
|
var attachment = useMemo(function () {
|
|
30265
31061
|
return attachments.find(function (attachment) {
|
|
30266
|
-
return attachment.type ===
|
|
31062
|
+
return attachment.type === attachmentTypes.link;
|
|
30267
31063
|
});
|
|
30268
|
-
}, [attachments
|
|
31064
|
+
}, [attachments]);
|
|
30269
31065
|
var ogMetadataQueryBuilder = useCallback(function (url) {
|
|
30270
31066
|
try {
|
|
30271
31067
|
var client = getClient();
|
|
@@ -30275,7 +31071,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30275
31071
|
var queryBuilder = new client.MessageLinkOGQueryBuilder(url);
|
|
30276
31072
|
return Promise.resolve(queryBuilder.build()).then(function (query) {
|
|
30277
31073
|
return Promise.resolve(query.loadOGData()).then(function (metadata) {
|
|
30278
|
-
return Promise.resolve(storeMetadata(url.replace('https://', ''), metadata)).then(function () {
|
|
31074
|
+
return Promise.resolve(storeMetadata(url.replace('https://', '').replace('http://', ''), metadata)).then(function () {
|
|
30279
31075
|
setMetadata(metadata);
|
|
30280
31076
|
});
|
|
30281
31077
|
});
|
|
@@ -30294,10 +31090,10 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30294
31090
|
}
|
|
30295
31091
|
}, []);
|
|
30296
31092
|
useEffect(function () {
|
|
30297
|
-
if (attachment !== null && attachment !== void 0 && attachment.id &&
|
|
31093
|
+
if (attachment !== null && attachment !== void 0 && attachment.id && attachment !== null && attachment !== void 0 && attachment.url) {
|
|
30298
31094
|
var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
|
|
30299
31095
|
if (url) {
|
|
30300
|
-
getMetadata(url.replace('https://', '')).then(function (cachedMetadata) {
|
|
31096
|
+
getMetadata(url.replace('https://', '').replace('http://', '')).then(function (cachedMetadata) {
|
|
30301
31097
|
try {
|
|
30302
31098
|
if (cachedMetadata) {
|
|
30303
31099
|
setMetadata(cachedMetadata);
|
|
@@ -30313,7 +31109,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30313
31109
|
});
|
|
30314
31110
|
}
|
|
30315
31111
|
}
|
|
30316
|
-
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url
|
|
31112
|
+
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
30317
31113
|
var ogUrl = useMemo(function () {
|
|
30318
31114
|
var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
|
|
30319
31115
|
var urlObj = validateUrl(url);
|
|
@@ -30324,25 +31120,33 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30324
31120
|
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
30325
31121
|
var showOGMetadata = useMemo(function () {
|
|
30326
31122
|
var _metadata$og, _metadata$og2, _metadata$og2$image, _metadata$og2$image$, _metadata$og3;
|
|
30327
|
-
return state
|
|
31123
|
+
return state !== 'deleted' && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og = metadata.og) === null || _metadata$og === void 0 ? void 0 : _metadata$og.title) && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og2 = metadata.og) === null || _metadata$og2 === void 0 ? void 0 : (_metadata$og2$image = _metadata$og2.image) === null || _metadata$og2$image === void 0 ? void 0 : (_metadata$og2$image$ = _metadata$og2$image[0]) === null || _metadata$og2$image$ === void 0 ? void 0 : _metadata$og2$image$.url) && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og3 = metadata.og) === null || _metadata$og3 === void 0 ? void 0 : _metadata$og3.description) && metadata;
|
|
30328
31124
|
}, [state, metadata]);
|
|
30329
|
-
return /*#__PURE__*/React__default.createElement(OGMetadataContainer,
|
|
31125
|
+
return /*#__PURE__*/React__default.createElement(OGMetadataContainer, {
|
|
31126
|
+
showOGMetadata: !!showOGMetadata
|
|
31127
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
30330
31128
|
onClick: function onClick() {
|
|
30331
31129
|
window.open(attachment === null || attachment === void 0 ? void 0 : attachment.url, '_blank');
|
|
30332
31130
|
}
|
|
30333
31131
|
}, /*#__PURE__*/React__default.createElement(ImageContainer, {
|
|
30334
|
-
showOGMetadata: showOGMetadata
|
|
31132
|
+
showOGMetadata: !!showOGMetadata
|
|
30335
31133
|
}, metadata !== null && metadata !== void 0 && (_metadata$og4 = metadata.og) !== null && _metadata$og4 !== void 0 && (_metadata$og4$image = _metadata$og4.image) !== null && _metadata$og4$image !== void 0 && (_metadata$og4$image$ = _metadata$og4$image[0]) !== null && _metadata$og4$image$ !== void 0 && _metadata$og4$image$.url ? /*#__PURE__*/React__default.createElement(Img, {
|
|
30336
31134
|
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$og5 = metadata.og) === null || _metadata$og5 === void 0 ? void 0 : (_metadata$og5$image = _metadata$og5.image) === null || _metadata$og5$image === void 0 ? void 0 : (_metadata$og5$image$ = _metadata$og5$image[0]) === null || _metadata$og5$image$ === void 0 ? void 0 : _metadata$og5$image$.url,
|
|
30337
31135
|
alt: 'OG metadata image'
|
|
30338
|
-
}) : null), showOGMetadata ?
|
|
31136
|
+
}) : null), showOGMetadata ? (/*#__PURE__*/React__default.createElement(OGText, null, /*#__PURE__*/React__default.createElement(Url, null, ogUrl), metadata !== null && metadata !== void 0 && (_metadata$og6 = metadata.og) !== null && _metadata$og6 !== void 0 && _metadata$og6.title ? (/*#__PURE__*/React__default.createElement(Title, null, metadata !== null && metadata !== void 0 && (_metadata$og7 = metadata.og) !== null && _metadata$og7 !== void 0 && (_metadata$og7$favicon = _metadata$og7.favicon) !== null && _metadata$og7$favicon !== void 0 && _metadata$og7$favicon.url ? /*#__PURE__*/React__default.createElement(Favicon, {
|
|
30339
31137
|
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$og8 = metadata.og) === null || _metadata$og8 === void 0 ? void 0 : (_metadata$og8$favicon = _metadata$og8.favicon) === null || _metadata$og8$favicon === void 0 ? void 0 : _metadata$og8$favicon.url
|
|
30340
|
-
}) : null, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og9 = metadata.og) === null || _metadata$og9 === void 0 ? void 0 : _metadata$og9.title))) : null, metadata !== null && metadata !== void 0 && (_metadata$og0 = metadata.og) !== null && _metadata$og0 !== void 0 && _metadata$og0.description ? /*#__PURE__*/React__default.createElement(Desc, null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og1 = metadata.og) === null || _metadata$og1 === void 0 ? void 0 : _metadata$og1.description) : null))));
|
|
31138
|
+
}) : null, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og9 = metadata.og) === null || _metadata$og9 === void 0 ? void 0 : _metadata$og9.title))) : null, metadata !== null && metadata !== void 0 && (_metadata$og0 = metadata.og) !== null && _metadata$og0 !== void 0 && _metadata$og0.description ? /*#__PURE__*/React__default.createElement(Desc, null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og1 = metadata.og) === null || _metadata$og1 === void 0 ? void 0 : _metadata$og1.description) : null)) : null));
|
|
30341
31139
|
};
|
|
30342
|
-
var OGMetadataContainer = styled.div(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n display: grid;\n grid-template-columns: 1fr;\n background-color: rgba(0, 0, 0, 0.034);\n border-radius: 6px;\n margin-bottom: 0.4rem;\n margin: 0 auto;\n margin-bottom:
|
|
30343
|
-
var ImageContainer = styled.div(_templateObject2$v || (_templateObject2$v = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n max-height: 200px;\n width: 100%;\n height: 200px;\n margin: 0 auto;\n padding: 0.3rem;\n height: ", ";\n transition: height 0.2s ease;\n"])), function (_ref2) {
|
|
31140
|
+
var OGMetadataContainer = styled.div(_templateObject$A || (_templateObject$A = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n display: grid;\n grid-template-columns: 1fr;\n background-color: rgba(0, 0, 0, 0.034);\n border-radius: 6px;\n margin-bottom: 0.4rem;\n margin: 0 auto;\n margin-bottom: ", ";\n &:hover {\n background-color: rgba(0, 0, 0, 0.1);\n cursor: pointer;\n }\n"])), function (_ref2) {
|
|
30344
31141
|
var showOGMetadata = _ref2.showOGMetadata;
|
|
30345
|
-
return
|
|
31142
|
+
return showOGMetadata ? '0.8rem' : '0';
|
|
31143
|
+
});
|
|
31144
|
+
var ImageContainer = styled.div(_templateObject2$v || (_templateObject2$v = _taggedTemplateLiteralLoose(["\n max-width: 100%;\n max-height: 200px;\n width: 100%;\n margin: 0 auto;\n padding: ", ";\n height: ", ";\n transition: height 0.2s ease;\n"])), function (_ref3) {
|
|
31145
|
+
var showOGMetadata = _ref3.showOGMetadata;
|
|
31146
|
+
return showOGMetadata ? '0.3rem' : '0';
|
|
31147
|
+
}, function (_ref4) {
|
|
31148
|
+
var showOGMetadata = _ref4.showOGMetadata;
|
|
31149
|
+
return showOGMetadata ? '200px' : '0';
|
|
30346
31150
|
});
|
|
30347
31151
|
var OGText = styled.div(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n width: 80%;\n padding: 0.5rem;\n margin: 0;\n"])));
|
|
30348
31152
|
var Url = styled.p(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n font-weight: normal;\n font-size: 13px;\n padding: 0;\n margin: 0 0 12px 0;\n color: gray;\n"])));
|
|
@@ -30865,7 +31669,7 @@ var FrequentlyEmojisContainer = styled.div(_templateObject5$i || (_templateObjec
|
|
|
30865
31669
|
return props.rtlDirection && '0';
|
|
30866
31670
|
});
|
|
30867
31671
|
|
|
30868
|
-
var _templateObject$C, _templateObject2$x, _templateObject3$r, _templateObject4$n, _templateObject5$j, _templateObject6$g, _templateObject7$e, _templateObject8$d, _templateObject9$b, _templateObject0$a, _templateObject1$
|
|
31672
|
+
var _templateObject$C, _templateObject2$x, _templateObject3$r, _templateObject4$n, _templateObject5$j, _templateObject6$g, _templateObject7$e, _templateObject8$d, _templateObject9$b, _templateObject0$a, _templateObject1$7, _templateObject10$4, _templateObject11$4, _templateObject12$3;
|
|
30869
31673
|
var Message$1 = function Message(_ref) {
|
|
30870
31674
|
var message = _ref.message,
|
|
30871
31675
|
channel = _ref.channel,
|
|
@@ -31194,7 +31998,6 @@ var Message$1 = function Message(_ref) {
|
|
|
31194
31998
|
if (isVisible && message.incoming && !(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
|
|
31195
31999
|
return marker.name === MESSAGE_DELIVERY_STATUS.READ;
|
|
31196
32000
|
})) && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
31197
|
-
log.info('send displayed marker for message ... ', message);
|
|
31198
32001
|
dispatch(markMessagesAsReadAC(channel.id, [message.id]));
|
|
31199
32002
|
}
|
|
31200
32003
|
};
|
|
@@ -31242,8 +32045,9 @@ var Message$1 = function Message(_ref) {
|
|
|
31242
32045
|
if (!channel.isLinkedChannel) {
|
|
31243
32046
|
setMessageToVisibleMessagesMap(message);
|
|
31244
32047
|
}
|
|
31245
|
-
if (scrollToNewMessage.scrollToBottom) {
|
|
32048
|
+
if (scrollToNewMessage.scrollToBottom && (message.id === channel.lastMessage.id || !message.id)) {
|
|
31246
32049
|
dispatch(scrollToNewMessageAC(false, false, false));
|
|
32050
|
+
dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
31247
32051
|
}
|
|
31248
32052
|
} else {
|
|
31249
32053
|
if (!channel.isLinkedChannel) {
|
|
@@ -31642,7 +32446,7 @@ var ReactionsContainer = styled.div(_templateObject9$b || (_templateObject9$b =
|
|
|
31642
32446
|
var MessageReactionsCont = styled.div(_templateObject0$a || (_templateObject0$a = _taggedTemplateLiteralLoose(["\n position: relative;\n display: inline-flex;\n max-width: 300px;\n direction: ", ";\n cursor: pointer;\n"])), function (props) {
|
|
31643
32447
|
return props.rtlDirection && 'ltr';
|
|
31644
32448
|
});
|
|
31645
|
-
var MessageStatus$1 = styled.span(_templateObject1$
|
|
32449
|
+
var MessageStatus$1 = styled.span(_templateObject1$7 || (_templateObject1$7 = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n align-items: center;\n margin-left: 4px;\n text-align: right;\n height: ", ";\n & > svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
31646
32450
|
return props.height || '14px';
|
|
31647
32451
|
});
|
|
31648
32452
|
var HiddenMessageTime$1 = styled.span(_templateObject10$4 || (_templateObject10$4 = _taggedTemplateLiteralLoose(["\n display: ", ";\n font-weight: 400;\n font-size: ", ";\n color: ", ";\n"])), function (props) {
|
|
@@ -31687,13 +32491,14 @@ var HiddenMessageProperty;
|
|
|
31687
32491
|
HiddenMessageProperty["hideAfterSendMessage"] = "hideAfterSendMessage";
|
|
31688
32492
|
})(HiddenMessageProperty || (HiddenMessageProperty = {}));
|
|
31689
32493
|
|
|
31690
|
-
var _templateObject$D, _templateObject2$y, _templateObject3$s, _templateObject4$o, _templateObject5$k, _templateObject6$h, _templateObject7$f, _templateObject8$e, _templateObject9$c, _templateObject0$b, _templateObject1$
|
|
32494
|
+
var _templateObject$D, _templateObject2$y, _templateObject3$s, _templateObject4$o, _templateObject5$k, _templateObject6$h, _templateObject7$f, _templateObject8$e, _templateObject9$c, _templateObject0$b, _templateObject1$8;
|
|
31691
32495
|
var loadFromServer = false;
|
|
31692
32496
|
var loadDirection = '';
|
|
31693
32497
|
var nextDisable = false;
|
|
31694
32498
|
var prevDisable = false;
|
|
31695
32499
|
var scrollToBottom = false;
|
|
31696
32500
|
var shouldLoadMessages;
|
|
32501
|
+
var loading = false;
|
|
31697
32502
|
var messagesIndexMap = {};
|
|
31698
32503
|
var CreateMessageDateDivider = function CreateMessageDateDivider(_ref) {
|
|
31699
32504
|
var lastIndex = _ref.lastIndex,
|
|
@@ -32003,7 +32808,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32003
32808
|
} else {
|
|
32004
32809
|
if (messagesIndexMap[lastVisibleMessageId] < 15 || forceLoadPrevMessages) {
|
|
32005
32810
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED && !scrollToNewMessage.scrollToBottom && hasPrevMessages) {
|
|
32006
|
-
if (messagesLoading === LOADING_STATE.LOADING || prevDisable) {
|
|
32811
|
+
if (loading || messagesLoading === LOADING_STATE.LOADING || prevDisable) {
|
|
32007
32812
|
shouldLoadMessages = 'prev';
|
|
32008
32813
|
} else {
|
|
32009
32814
|
if (shouldLoadMessages === 'prev') {
|
|
@@ -32020,7 +32825,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32020
32825
|
}
|
|
32021
32826
|
if (messagesIndexMap[lastVisibleMessageId] >= messages.length - 15 || target.scrollTop === 0) {
|
|
32022
32827
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED && !scrollToNewMessage.scrollToBottom && (hasNextMessages || getHasNextCached())) {
|
|
32023
|
-
if (messagesLoading === LOADING_STATE.LOADING || nextDisable) {
|
|
32828
|
+
if (loading || messagesLoading === LOADING_STATE.LOADING || nextDisable) {
|
|
32024
32829
|
shouldLoadMessages = 'next';
|
|
32025
32830
|
} else {
|
|
32026
32831
|
if (shouldLoadMessages === 'next') {
|
|
@@ -32040,7 +32845,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32040
32845
|
} catch (e) {
|
|
32041
32846
|
return Promise.reject(e);
|
|
32042
32847
|
}
|
|
32043
|
-
}, [channel === null || channel === void 0 ? void 0 : (_channel$lastMessage = channel.lastMessage) === null || _channel$lastMessage === void 0 ? void 0 : _channel$lastMessage.id, messages, scrollToMentionedMessage, scrollToNewMessage, messagesLoading, hasPrevMessages, hasNextMessages, messagesIndexMap, lastVisibleMessageId, connectionStatus, shouldLoadMessages, loadDirection, getHasPrevCached, getHasNextCached, scrollToReply]);
|
|
32848
|
+
}, [channel === null || channel === void 0 ? void 0 : (_channel$lastMessage = channel.lastMessage) === null || _channel$lastMessage === void 0 ? void 0 : _channel$lastMessage.id, messages, scrollToMentionedMessage, scrollToNewMessage, messagesLoading, hasPrevMessages, hasNextMessages, messagesIndexMap, lastVisibleMessageId, connectionStatus, shouldLoadMessages, loadDirection, getHasPrevCached, getHasNextCached, scrollToReply, loading, prevDisable, nextDisable]);
|
|
32044
32849
|
var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
|
|
32045
32850
|
try {
|
|
32046
32851
|
prevDisable = true;
|
|
@@ -32080,8 +32885,10 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32080
32885
|
var hasNextCached = getHasNextCached();
|
|
32081
32886
|
if (messagesLoading === LOADING_STATE.LOADED && connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
32082
32887
|
if (direction === MESSAGE_LOAD_DIRECTION.PREV && firstMessageId && (hasPrevMessages || hasPrevCached)) {
|
|
32888
|
+
loading = true;
|
|
32083
32889
|
dispatch(loadMoreMessagesAC(channel.id, limit, direction, firstMessageId, hasPrevMessages));
|
|
32084
32890
|
} else if (direction === MESSAGE_LOAD_DIRECTION.NEXT && lastMessageId && (hasNextMessages || hasNextCached)) {
|
|
32891
|
+
loading = true;
|
|
32085
32892
|
dispatch(loadMoreMessagesAC(channel.id, limit, direction, lastMessageId, hasNextMessages));
|
|
32086
32893
|
}
|
|
32087
32894
|
}
|
|
@@ -32201,7 +33008,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32201
33008
|
}, [messages, channel === null || channel === void 0 ? void 0 : (_channel$lastMessage3 = channel.lastMessage) === null || _channel$lastMessage3 === void 0 ? void 0 : _channel$lastMessage3.id, scrollRef === null || scrollRef === void 0 ? void 0 : (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop, showScrollToNewMessageButton]);
|
|
32202
33009
|
useEffect(function () {
|
|
32203
33010
|
if (scrollToRepliedMessage) {
|
|
32204
|
-
|
|
33011
|
+
loading = false;
|
|
32205
33012
|
scrollRef.current.style.scrollBehavior = 'inherit';
|
|
32206
33013
|
var repliedMessage = document.getElementById(scrollToRepliedMessage);
|
|
32207
33014
|
if (repliedMessage) {
|
|
@@ -32275,7 +33082,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32275
33082
|
clearVisibleMessagesMap();
|
|
32276
33083
|
}
|
|
32277
33084
|
if (channel) {
|
|
32278
|
-
dispatch(getMessagesAC(channel,
|
|
33085
|
+
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
32279
33086
|
}
|
|
32280
33087
|
if (channel.id) {
|
|
32281
33088
|
if (channel.newMessageCount && channel.newMessageCount > 0) {
|
|
@@ -32317,7 +33124,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32317
33124
|
setShouldPreserveScroll(true);
|
|
32318
33125
|
}
|
|
32319
33126
|
}
|
|
32320
|
-
if (
|
|
33127
|
+
if (loading) {
|
|
32321
33128
|
if (loadDirection !== 'next') {
|
|
32322
33129
|
var lastVisibleMessage = document.getElementById(lastVisibleMessageId);
|
|
32323
33130
|
if (lastVisibleMessage) {
|
|
@@ -32327,7 +33134,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32327
33134
|
}
|
|
32328
33135
|
if (loadFromServer) {
|
|
32329
33136
|
setTimeout(function () {
|
|
32330
|
-
|
|
33137
|
+
loading = false;
|
|
32331
33138
|
loadFromServer = false;
|
|
32332
33139
|
nextDisable = false;
|
|
32333
33140
|
if (shouldLoadMessages === 'prev' && messagesIndexMap[lastVisibleMessageId] < 15) {
|
|
@@ -32338,7 +33145,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32338
33145
|
}
|
|
32339
33146
|
}, 50);
|
|
32340
33147
|
} else {
|
|
32341
|
-
|
|
33148
|
+
loading = false;
|
|
32342
33149
|
if (shouldLoadMessages === 'prev') {
|
|
32343
33150
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.PREV, LOAD_MAX_MESSAGE_COUNT);
|
|
32344
33151
|
shouldLoadMessages = '';
|
|
@@ -32355,7 +33162,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32355
33162
|
scrollRef.current.scrollTop = _lastVisibleMessage.offsetTop - scrollRef.current.offsetHeight + _lastVisibleMessage.offsetHeight;
|
|
32356
33163
|
scrollRef.current.style.scrollBehavior = 'smooth';
|
|
32357
33164
|
}
|
|
32358
|
-
|
|
33165
|
+
loading = false;
|
|
32359
33166
|
prevDisable = false;
|
|
32360
33167
|
if (shouldLoadMessages === 'prev') {
|
|
32361
33168
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.PREV, LOAD_MAX_MESSAGE_COUNT);
|
|
@@ -32387,7 +33194,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32387
33194
|
useEffect(function () {
|
|
32388
33195
|
log.info('connection status is changed.. .... ', connectionStatus, 'channel ... ', channel);
|
|
32389
33196
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
32390
|
-
|
|
33197
|
+
loading = false;
|
|
32391
33198
|
prevDisable = false;
|
|
32392
33199
|
nextDisable = false;
|
|
32393
33200
|
clearMessagesMap();
|
|
@@ -32694,7 +33501,7 @@ var MessageTopDate = styled.div(_templateObject4$o || (_templateObject4$o = _tag
|
|
|
32694
33501
|
}, function (props) {
|
|
32695
33502
|
return props.dateDividerTextColor;
|
|
32696
33503
|
}, function (props) {
|
|
32697
|
-
return props.dateDividerBackgroundColor + "
|
|
33504
|
+
return props.dateDividerBackgroundColor + "66";
|
|
32698
33505
|
}, function (props) {
|
|
32699
33506
|
return props.dateDividerBorder;
|
|
32700
33507
|
}, function (props) {
|
|
@@ -32734,7 +33541,7 @@ var NoMessagesContainer = styled.div(_templateObject9$c || (_templateObject9$c =
|
|
|
32734
33541
|
var NoMessagesTitle = styled.h4(_templateObject0$b || (_templateObject0$b = _taggedTemplateLiteralLoose(["\n margin: 12px 0 8px;\n font-family: Inter, sans-serif;\n text-align: center;\n font-size: 20px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n color: ", ";\n"])), function (props) {
|
|
32735
33542
|
return props.color;
|
|
32736
33543
|
});
|
|
32737
|
-
var NoMessagesText = styled.p(_templateObject1$
|
|
33544
|
+
var NoMessagesText = styled.p(_templateObject1$8 || (_templateObject1$8 = _taggedTemplateLiteralLoose(["\n margin: 0;\n text-align: center;\n font-feature-settings:\n 'clig' off,\n 'liga' off;\n font-family: Inter, sans-serif;\n font-size: 15px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n color: ", ";\n"])), function (props) {
|
|
32738
33545
|
return props.color;
|
|
32739
33546
|
});
|
|
32740
33547
|
|
|
@@ -34738,19 +35545,19 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34738
35545
|
}, [currentRecordedFile]);
|
|
34739
35546
|
var dispatch = useDispatch();
|
|
34740
35547
|
var handleStartRecording = function handleStartRecording() {
|
|
34741
|
-
dispatch(sendRecordingAC(true));
|
|
35548
|
+
dispatch(sendRecordingAC(true, currentChannelId));
|
|
34742
35549
|
if (sendingInterval) {
|
|
34743
35550
|
clearInterval(sendingInterval);
|
|
34744
35551
|
setSendingInterval(null);
|
|
34745
35552
|
return;
|
|
34746
35553
|
}
|
|
34747
35554
|
var interval = setInterval(function () {
|
|
34748
|
-
dispatch(sendRecordingAC(true));
|
|
35555
|
+
dispatch(sendRecordingAC(true, currentChannelId));
|
|
34749
35556
|
}, 1000);
|
|
34750
35557
|
setSendingInterval(interval);
|
|
34751
35558
|
};
|
|
34752
35559
|
var handleStopRecording = function handleStopRecording() {
|
|
34753
|
-
dispatch(sendRecordingAC(false));
|
|
35560
|
+
dispatch(sendRecordingAC(false, currentChannelId));
|
|
34754
35561
|
if (sendingInterval) {
|
|
34755
35562
|
clearInterval(sendingInterval);
|
|
34756
35563
|
setSendingInterval(null);
|
|
@@ -34904,10 +35711,9 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34904
35711
|
return Promise.resolve(_catch(function () {
|
|
34905
35712
|
var _wavesurfer$current3;
|
|
34906
35713
|
function _temp3(_result3) {
|
|
35714
|
+
var _wavesurfer$current$i, _wavesurfer$current$i2;
|
|
34907
35715
|
if (_exit) return _result3;
|
|
34908
|
-
|
|
34909
|
-
return;
|
|
34910
|
-
}
|
|
35716
|
+
setCurrentTime(((_wavesurfer$current$i = wavesurfer.current[id]) === null || _wavesurfer$current$i === void 0 ? void 0 : (_wavesurfer$current$i2 = _wavesurfer$current$i.decodedData) === null || _wavesurfer$current$i2 === void 0 ? void 0 : _wavesurfer$current$i2.duration) || 0);
|
|
34911
35717
|
wavesurfer.current[id].on('ready', function () {
|
|
34912
35718
|
setRecordingIsReadyToPlay(true);
|
|
34913
35719
|
var audioDuration = wavesurfer.current[id].getDuration();
|
|
@@ -35019,7 +35825,6 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35019
35825
|
recorder.stop().getMp3().then(function (_ref4) {
|
|
35020
35826
|
var buffer = _ref4[0],
|
|
35021
35827
|
blob = _ref4[1];
|
|
35022
|
-
setCurrentTime(0);
|
|
35023
35828
|
var file = new File(buffer, 'record.mp3', {
|
|
35024
35829
|
type: blob.type,
|
|
35025
35830
|
lastModified: Date.now()
|
|
@@ -35085,15 +35890,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35085
35890
|
if ((_wavesurfer$current5 = wavesurfer.current) !== null && _wavesurfer$current5 !== void 0 && _wavesurfer$current5[cId || currentChannelId]) {
|
|
35086
35891
|
if (!wavesurfer.current[cId || currentChannelId].isPlaying()) {
|
|
35087
35892
|
setPlayAudio(true);
|
|
35088
|
-
handleStartRecording();
|
|
35089
35893
|
intervalRef.current[cId || currentChannelId] = setInterval(function () {
|
|
35090
35894
|
var currentTime = wavesurfer.current[cId || currentChannelId].getCurrentTime();
|
|
35091
35895
|
if (currentTime >= 0) {
|
|
35092
35896
|
setCurrentTime(currentTime);
|
|
35093
35897
|
}
|
|
35094
35898
|
}, 10);
|
|
35095
|
-
} else {
|
|
35096
|
-
handleStopRecording();
|
|
35097
35899
|
}
|
|
35098
35900
|
wavesurfer.current[cId || currentChannelId].playPause();
|
|
35099
35901
|
}
|
|
@@ -35204,11 +36006,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35204
36006
|
setShowRecording(false);
|
|
35205
36007
|
setStartRecording(false);
|
|
35206
36008
|
setPlayAudio(false);
|
|
35207
|
-
setCurrentTime(0);
|
|
35208
36009
|
var audioRecording = getAudioRecordingFromMap(channelId);
|
|
35209
36010
|
setRecordedFile(audioRecording || null);
|
|
35210
36011
|
setRecordingIsReadyToPlay(!!audioRecording);
|
|
35211
36012
|
}
|
|
36013
|
+
setCurrentTime(0);
|
|
36014
|
+
handleStopRecording();
|
|
35212
36015
|
setCurrentChannelId(channelId);
|
|
35213
36016
|
}, [channelId]);
|
|
35214
36017
|
return /*#__PURE__*/React__default.createElement(Container$j, {
|
|
@@ -35323,7 +36126,7 @@ var RecordingAnimation = function RecordingAnimation(_ref2) {
|
|
|
35323
36126
|
}));
|
|
35324
36127
|
};
|
|
35325
36128
|
|
|
35326
|
-
var _templateObject$J, _templateObject2$E, _templateObject3$x, _templateObject4$s, _templateObject5$o, _templateObject6$k, _templateObject7$i, _templateObject8$g, _templateObject9$d, _templateObject0$c, _templateObject1$
|
|
36129
|
+
var _templateObject$J, _templateObject2$E, _templateObject3$x, _templateObject4$s, _templateObject5$o, _templateObject6$k, _templateObject7$i, _templateObject8$g, _templateObject9$d, _templateObject0$c, _templateObject1$9, _templateObject10$5, _templateObject11$5, _templateObject12$4, _templateObject13$3, _templateObject14$2, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$1, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1;
|
|
35327
36130
|
function AutoFocusPlugin(_ref) {
|
|
35328
36131
|
var messageForReply = _ref.messageForReply;
|
|
35329
36132
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
@@ -35753,6 +36556,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35753
36556
|
var handleEditMessage = function handleEditMessage() {
|
|
35754
36557
|
var messageTexToSend = editMessageText.trim();
|
|
35755
36558
|
if (messageTexToSend) {
|
|
36559
|
+
var linkAttachment;
|
|
36560
|
+
if (messageTexToSend) {
|
|
36561
|
+
var linkify = new LinkifyIt();
|
|
36562
|
+
var match = linkify.match(messageTexToSend);
|
|
36563
|
+
if (match) {
|
|
36564
|
+
linkAttachment = {
|
|
36565
|
+
type: attachmentTypes.link,
|
|
36566
|
+
data: match[0].url,
|
|
36567
|
+
upload: false
|
|
36568
|
+
};
|
|
36569
|
+
}
|
|
36570
|
+
}
|
|
35756
36571
|
var mentionedMembersPositions = [];
|
|
35757
36572
|
var mentionMembersToSend = [];
|
|
35758
36573
|
if (mentionedMembers && mentionedMembers.length) {
|
|
@@ -35772,7 +36587,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35772
36587
|
});
|
|
35773
36588
|
}
|
|
35774
36589
|
}
|
|
35775
|
-
var messageToSend = _extends({}, messageToEdit, {
|
|
36590
|
+
var messageToSend = _extends({}, messageToEdit, linkAttachment ? {
|
|
36591
|
+
attachments: [linkAttachment]
|
|
36592
|
+
} : {}, {
|
|
35776
36593
|
metadata: mentionedMembersPositions,
|
|
35777
36594
|
bodyAttributes: messageBodyAttributes,
|
|
35778
36595
|
mentionedUsers: mentionMembersToSend,
|
|
@@ -36232,7 +37049,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36232
37049
|
}
|
|
36233
37050
|
var dataFromDb;
|
|
36234
37051
|
var _temp11 = _catch(function () {
|
|
36235
|
-
return Promise.resolve(
|
|
37052
|
+
return Promise.resolve(getDataFromDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, checksumHash, 'checksum')).then(function (_getDataFromDB) {
|
|
36236
37053
|
dataFromDb = _getDataFromDB;
|
|
36237
37054
|
});
|
|
36238
37055
|
}, function (e) {
|
|
@@ -36439,14 +37256,16 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36439
37256
|
text: messageText,
|
|
36440
37257
|
mentionedMembers: draftMessage.mentionedMembers,
|
|
36441
37258
|
messageForReply: messageForReply,
|
|
36442
|
-
editorState: realEditorState
|
|
37259
|
+
editorState: realEditorState,
|
|
37260
|
+
bodyAttributes: messageBodyAttributes
|
|
36443
37261
|
});
|
|
36444
37262
|
} else {
|
|
36445
37263
|
setDraftMessageToMap(activeChannel.id, {
|
|
36446
37264
|
text: messageText,
|
|
36447
37265
|
mentionedMembers: mentionedMembers,
|
|
36448
37266
|
messageForReply: messageForReply,
|
|
36449
|
-
editorState: realEditorState
|
|
37267
|
+
editorState: realEditorState,
|
|
37268
|
+
bodyAttributes: messageBodyAttributes
|
|
36450
37269
|
});
|
|
36451
37270
|
}
|
|
36452
37271
|
if (!listenerIsAdded) {
|
|
@@ -36467,16 +37286,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36467
37286
|
setDraftMessageToMap(activeChannel.id, {
|
|
36468
37287
|
text: messageText,
|
|
36469
37288
|
mentionedMembers: mentionedMembers,
|
|
36470
|
-
messageForReply: messageForReply
|
|
37289
|
+
messageForReply: messageForReply,
|
|
37290
|
+
bodyAttributes: messageBodyAttributes
|
|
36471
37291
|
});
|
|
36472
37292
|
}
|
|
36473
37293
|
}, [mentionedMembers]);
|
|
36474
37294
|
useEffect(function () {
|
|
36475
37295
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
37296
|
+
var pendingMessagesMap = getPendingMessagesMap();
|
|
37297
|
+
var pendingMessagesMapCopy = JSON.parse(JSON.stringify(pendingMessagesMap));
|
|
36476
37298
|
setTimeout(function () {
|
|
36477
|
-
|
|
36478
|
-
|
|
36479
|
-
pendingMessagesMap[key].forEach(function (msg) {
|
|
37299
|
+
Object.keys(pendingMessagesMapCopy).forEach(function (key) {
|
|
37300
|
+
pendingMessagesMapCopy[key].forEach(function (msg) {
|
|
36480
37301
|
dispatch(resendMessageAC(msg, key, connectionStatus));
|
|
36481
37302
|
});
|
|
36482
37303
|
});
|
|
@@ -36521,7 +37342,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36521
37342
|
setDraftMessageToMap(activeChannel.id, {
|
|
36522
37343
|
text: messageText,
|
|
36523
37344
|
mentionedMembers: mentionedMembers,
|
|
36524
|
-
messageForReply: messageForReply
|
|
37345
|
+
messageForReply: messageForReply,
|
|
37346
|
+
bodyAttributes: messageBodyAttributes
|
|
36525
37347
|
});
|
|
36526
37348
|
}
|
|
36527
37349
|
if (messageForReply && messageToEdit) {
|
|
@@ -36572,16 +37394,21 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36572
37394
|
}
|
|
36573
37395
|
};
|
|
36574
37396
|
}, []);
|
|
36575
|
-
var
|
|
36576
|
-
|
|
37397
|
+
var typingOrRecording = useMemo(function () {
|
|
37398
|
+
var dataValues = typingOrRecordingIndicator ? Object.values(typingOrRecordingIndicator) : [];
|
|
37399
|
+
var filteredItems = dataValues.filter(function (item) {
|
|
36577
37400
|
return item.typingState || item.recordingState;
|
|
36578
|
-
}) : [];
|
|
36579
|
-
}, [typingOrRecordingIndicator]);
|
|
36580
|
-
var isTyping = useMemo(function () {
|
|
36581
|
-
return !!filteredTypingOrRecordingIndicator.find(function (item) {
|
|
36582
|
-
return item.typingState;
|
|
36583
37401
|
});
|
|
36584
|
-
|
|
37402
|
+
return {
|
|
37403
|
+
items: filteredItems,
|
|
37404
|
+
isTyping: !!filteredItems.find(function (item) {
|
|
37405
|
+
return item.typingState;
|
|
37406
|
+
}),
|
|
37407
|
+
isRecording: !!filteredItems.find(function (item) {
|
|
37408
|
+
return item.recordingState;
|
|
37409
|
+
})
|
|
37410
|
+
};
|
|
37411
|
+
}, [typingOrRecordingIndicator]);
|
|
36585
37412
|
var formatTypingIndicatorText = function formatTypingIndicatorText(users, maxShownUsers) {
|
|
36586
37413
|
if (maxShownUsers === void 0) {
|
|
36587
37414
|
maxShownUsers = 3;
|
|
@@ -36590,7 +37417,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36590
37417
|
if (users.length === 1) {
|
|
36591
37418
|
var _user = users[0];
|
|
36592
37419
|
var userName = makeUsername(getFromContacts && _user.from && contactsMap[_user.from.id], _user.from, getFromContacts);
|
|
36593
|
-
return "" + userName + (isTyping ? activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is typing' : '' : activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is recording' : '');
|
|
37420
|
+
return "" + userName + (typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping ? activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is typing' : '' : activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is recording' : '');
|
|
36594
37421
|
}
|
|
36595
37422
|
if (users.length <= maxShownUsers) {
|
|
36596
37423
|
var userNames = users.map(function (user) {
|
|
@@ -36660,8 +37487,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36660
37487
|
}, "Join")) : (activeChannel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || activeChannel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? !(activeChannel.userRole === 'admin' || activeChannel.userRole === 'owner') : activeChannel.type !== DEFAULT_CHANNEL_TYPE.DIRECT && !checkActionPermission('sendMessage')) ? (/*#__PURE__*/React__default.createElement(ReadOnlyCont, {
|
|
36661
37488
|
color: textPrimary,
|
|
36662
37489
|
iconColor: accentColor
|
|
36663
|
-
}, /*#__PURE__*/React__default.createElement(SvgEye, null), " Read only")) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TypingIndicator$1, null,
|
|
36664
|
-
from:
|
|
37490
|
+
}, /*#__PURE__*/React__default.createElement(SvgEye, null), " Read only")) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TypingIndicator$1, null, (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.items.length) > 0 && (CustomTypingIndicator ? (/*#__PURE__*/React__default.createElement(CustomTypingIndicator, {
|
|
37491
|
+
from: typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.items.map(function (item) {
|
|
36665
37492
|
return {
|
|
36666
37493
|
id: item.from.id,
|
|
36667
37494
|
name: item.from.name,
|
|
@@ -36671,7 +37498,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36671
37498
|
})
|
|
36672
37499
|
})) : (/*#__PURE__*/React__default.createElement(TypingIndicatorCont, null, /*#__PURE__*/React__default.createElement(TypingFrom, {
|
|
36673
37500
|
color: textSecondary
|
|
36674
|
-
}, formatTypingIndicatorText(
|
|
37501
|
+
}, formatTypingIndicatorText(typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.items, 3)), typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping ? (/*#__PURE__*/React__default.createElement(TypingAnimation, {
|
|
36675
37502
|
borderColor: iconInactive
|
|
36676
37503
|
}, /*#__PURE__*/React__default.createElement(DotOne, null), /*#__PURE__*/React__default.createElement(DotTwo, null), /*#__PURE__*/React__default.createElement(DotThree, null))) : (/*#__PURE__*/React__default.createElement(RecordingAnimation, {
|
|
36677
37504
|
borderColor: iconInactive
|
|
@@ -36942,7 +37769,7 @@ var AddAttachmentIcon = styled.span(_templateObject0$c || (_templateObject0$c =
|
|
|
36942
37769
|
}, function (props) {
|
|
36943
37770
|
return props.hoverColor;
|
|
36944
37771
|
});
|
|
36945
|
-
var SendMessageInputContainer = styled.div(_templateObject1$
|
|
37772
|
+
var SendMessageInputContainer = styled.div(_templateObject1$9 || (_templateObject1$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-end;\n justify-content: space-between;\n position: relative;\n min-height: ", ";\n box-sizing: border-box;\n border-radius: ", ";\n\n & .dropdown-trigger.open {\n color: #ccc;\n\n & ", " {\n & > svg {\n color: ", ";\n }\n ;\n }\n }\n}\n"])), function (props) {
|
|
36946
37773
|
return props.minHeight || '36px';
|
|
36947
37774
|
}, function (props) {
|
|
36948
37775
|
return props.messageForReply ? '0 0 4px 4px' : '4px';
|
|
@@ -37238,7 +38065,7 @@ function SvgUnpin(props) {
|
|
|
37238
38065
|
})));
|
|
37239
38066
|
}
|
|
37240
38067
|
|
|
37241
|
-
var _templateObject$K, _templateObject2$F, _templateObject3$y, _templateObject4$t, _templateObject5$p, _templateObject6$l, _templateObject7$j, _templateObject8$h, _templateObject9$e, _templateObject0$d, _templateObject1$
|
|
38068
|
+
var _templateObject$K, _templateObject2$F, _templateObject3$y, _templateObject4$t, _templateObject5$p, _templateObject6$l, _templateObject7$j, _templateObject8$h, _templateObject9$e, _templateObject0$d, _templateObject1$a, _templateObject10$6, _templateObject11$6, _templateObject12$5, _templateObject13$4, _templateObject14$3, _templateObject15$3, _templateObject16$3;
|
|
37242
38069
|
var Actions = function Actions(_ref) {
|
|
37243
38070
|
var _channel$metadata;
|
|
37244
38071
|
var setActionsHeight = _ref.setActionsHeight,
|
|
@@ -37717,7 +38544,7 @@ var DefaultStarIcon = styled(SvgStar)(_templateObject7$j || (_templateObject7$j
|
|
|
37717
38544
|
var DefaultUnpinIcon = styled(SvgUnpin)(_templateObject8$h || (_templateObject8$h = _taggedTemplateLiteralLoose([""])));
|
|
37718
38545
|
var DefaultPinIcon = styled(SvgPin)(_templateObject9$e || (_templateObject9$e = _taggedTemplateLiteralLoose([""])));
|
|
37719
38546
|
var DefaultMarkAsRead = styled(SvgMarkAsRead)(_templateObject0$d || (_templateObject0$d = _taggedTemplateLiteralLoose([""])));
|
|
37720
|
-
var DefaultMarkAsUnRead = styled(SvgMarkAsUnRead)(_templateObject1$
|
|
38547
|
+
var DefaultMarkAsUnRead = styled(SvgMarkAsUnRead)(_templateObject1$a || (_templateObject1$a = _taggedTemplateLiteralLoose([""])));
|
|
37721
38548
|
var DefaultBlockIcon = styled(SvgBlockChannel)(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose([""])));
|
|
37722
38549
|
var DefaultReportIcon = styled(SvgReport)(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose([""])));
|
|
37723
38550
|
var DefaultClearIcon = styled(SvgClear)(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose([""])));
|
|
@@ -38441,7 +39268,7 @@ var Files = function Files(_ref) {
|
|
|
38441
39268
|
text: '',
|
|
38442
39269
|
styles: {
|
|
38443
39270
|
background: {
|
|
38444
|
-
fill: overlayBackground2 + "
|
|
39271
|
+
fill: overlayBackground2 + "66"
|
|
38445
39272
|
},
|
|
38446
39273
|
path: {
|
|
38447
39274
|
stroke: accentColor,
|
|
@@ -39263,7 +40090,7 @@ var EditChannel = function EditChannel(_ref) {
|
|
|
39263
40090
|
})));
|
|
39264
40091
|
};
|
|
39265
40092
|
|
|
39266
|
-
var _templateObject$V, _templateObject2$O, _templateObject3$F, _templateObject4$z, _templateObject5$u, _templateObject6$p, _templateObject7$n, _templateObject8$l, _templateObject9$g, _templateObject0$e, _templateObject1$
|
|
40093
|
+
var _templateObject$V, _templateObject2$O, _templateObject3$F, _templateObject4$z, _templateObject5$u, _templateObject6$p, _templateObject7$n, _templateObject8$l, _templateObject9$g, _templateObject0$e, _templateObject1$b, _templateObject10$7;
|
|
39267
40094
|
var Details = function Details(_ref) {
|
|
39268
40095
|
var _activeChannel$metada;
|
|
39269
40096
|
var detailsTitleText = _ref.detailsTitleText,
|
|
@@ -39379,7 +40206,8 @@ var Details = function Details(_ref) {
|
|
|
39379
40206
|
tabItemsLineHeight = _ref.tabItemsLineHeight,
|
|
39380
40207
|
tabItemsMinWidth = _ref.tabItemsMinWidth,
|
|
39381
40208
|
backgroundColor = _ref.backgroundColor,
|
|
39382
|
-
bordersColor = _ref.bordersColor
|
|
40209
|
+
bordersColor = _ref.bordersColor,
|
|
40210
|
+
showPhoneNumber = _ref.showPhoneNumber;
|
|
39383
40211
|
var _useColor = useColors(),
|
|
39384
40212
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
39385
40213
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -39533,7 +40361,7 @@ var Details = function Details(_ref) {
|
|
|
39533
40361
|
color: textSecondary,
|
|
39534
40362
|
fontSize: channelMembersFontSize,
|
|
39535
40363
|
lineHeight: channelMembersLineHeight
|
|
39536
|
-
}, hideUserPresence && directChannelUser && hideUserPresence(directChannelUser) ? '' : directChannelUser && directChannelUser.presence && (directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE ? 'Online' : directChannelUser.presence.lastActiveAt && userLastActiveDateFormat(directChannelUser.presence.lastActiveAt)))) : (/*#__PURE__*/React__default.createElement(SubTitle, {
|
|
40364
|
+
}, showPhoneNumber ? "+" + directChannelUser.id : hideUserPresence && directChannelUser && hideUserPresence(directChannelUser) ? '' : directChannelUser && directChannelUser.presence && (directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE ? 'Online' : directChannelUser.presence.lastActiveAt && userLastActiveDateFormat(directChannelUser.presence.lastActiveAt)))) : (/*#__PURE__*/React__default.createElement(SubTitle, {
|
|
39537
40365
|
color: textSecondary,
|
|
39538
40366
|
fontSize: channelMembersFontSize,
|
|
39539
40367
|
lineHeight: channelMembersLineHeight
|
|
@@ -39695,7 +40523,7 @@ var ChannelName$1 = styled(SectionHeader)(_templateObject0$e || (_templateObject
|
|
|
39695
40523
|
}, function (props) {
|
|
39696
40524
|
return props.uppercase && 'uppercase';
|
|
39697
40525
|
});
|
|
39698
|
-
var ChannelNameWrapper = styled.div(_templateObject1$
|
|
40526
|
+
var ChannelNameWrapper = styled.div(_templateObject1$b || (_templateObject1$b = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
39699
40527
|
var EditButton = styled.span(_templateObject10$7 || (_templateObject10$7 = _taggedTemplateLiteralLoose(["\n margin-left: 6px;\n cursor: pointer;\n color: #b2b6be;\n"])));
|
|
39700
40528
|
|
|
39701
40529
|
var _templateObject$W;
|
|
@@ -39809,7 +40637,8 @@ var ChannelDetailsContainer = function ChannelDetailsContainer(_ref) {
|
|
|
39809
40637
|
tabItemsFontSize = _ref.tabItemsFontSize,
|
|
39810
40638
|
tabItemsLineHeight = _ref.tabItemsLineHeight,
|
|
39811
40639
|
tabItemsMinWidth = _ref.tabItemsMinWidth,
|
|
39812
|
-
bordersColor = _ref.bordersColor
|
|
40640
|
+
bordersColor = _ref.bordersColor,
|
|
40641
|
+
showPhoneNumber = _ref.showPhoneNumber;
|
|
39813
40642
|
var channelDetailsIsOpen = useSelector(channelInfoIsOpenSelector, shallowEqual);
|
|
39814
40643
|
useEffect(function () {
|
|
39815
40644
|
setShowChannelDetails(true);
|
|
@@ -39922,7 +40751,8 @@ var ChannelDetailsContainer = function ChannelDetailsContainer(_ref) {
|
|
|
39922
40751
|
addMemberIcon: addMemberIcon,
|
|
39923
40752
|
tabItemsFontSize: tabItemsFontSize,
|
|
39924
40753
|
tabItemsLineHeight: tabItemsLineHeight,
|
|
39925
|
-
tabItemsMinWidth: tabItemsMinWidth
|
|
40754
|
+
tabItemsMinWidth: tabItemsMinWidth,
|
|
40755
|
+
showPhoneNumber: showPhoneNumber
|
|
39926
40756
|
})));
|
|
39927
40757
|
};
|
|
39928
40758
|
var DetailsWrapper = styled.div(_templateObject$W || (_templateObject$W = _taggedTemplateLiteralLoose([""])));
|
|
@@ -39977,26 +40807,31 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
39977
40807
|
var showScrollToNewMessageButton = useSelector(showScrollToNewMessageButtonSelector);
|
|
39978
40808
|
var messages = useSelector(activeChannelMessagesSelector) || [];
|
|
39979
40809
|
var handleScrollToBottom = function handleScrollToBottom() {
|
|
39980
|
-
|
|
39981
|
-
|
|
40810
|
+
var user = getClient().user;
|
|
40811
|
+
if (channel.lastMessage.user.id !== user.id) {
|
|
40812
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
|
|
40813
|
+
}
|
|
40814
|
+
handleScrollToLastMessage(channel.lastMessage.id);
|
|
39982
40815
|
};
|
|
39983
|
-
var
|
|
40816
|
+
var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
|
|
39984
40817
|
try {
|
|
40818
|
+
dispatch(scrollToNewMessageAC(true, false, false));
|
|
39985
40819
|
if (messages.findIndex(function (msg) {
|
|
39986
40820
|
return msg.id === messageId;
|
|
39987
40821
|
}) >= 10) {
|
|
40822
|
+
dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
39988
40823
|
var repliedMessage = document.getElementById(messageId);
|
|
39989
40824
|
if (repliedMessage) {
|
|
39990
40825
|
var scrollRef = document.getElementById('scrollableDiv');
|
|
39991
40826
|
if (scrollRef) {
|
|
39992
40827
|
scrollRef.scrollTo({
|
|
39993
|
-
top:
|
|
40828
|
+
top: 1000,
|
|
39994
40829
|
behavior: 'smooth'
|
|
39995
40830
|
});
|
|
39996
40831
|
}
|
|
39997
40832
|
}
|
|
39998
40833
|
} else {
|
|
39999
|
-
dispatch(getMessagesAC(channel, true, messageId));
|
|
40834
|
+
dispatch(getMessagesAC(channel, true, messageId, undefined, undefined, false));
|
|
40000
40835
|
}
|
|
40001
40836
|
return Promise.resolve();
|
|
40002
40837
|
} catch (e) {
|