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.js
CHANGED
|
@@ -25,7 +25,6 @@ var reactRedux = require('react-redux');
|
|
|
25
25
|
var log = _interopDefault(require('loglevel'));
|
|
26
26
|
var createSagaMiddleware = require('redux-saga');
|
|
27
27
|
var createSagaMiddleware__default = _interopDefault(createSagaMiddleware);
|
|
28
|
-
var redux = require('redux');
|
|
29
28
|
var FileSaver = _interopDefault(require('file-saver'));
|
|
30
29
|
var effects = require('redux-saga/effects');
|
|
31
30
|
var uuid = require('uuid');
|
|
@@ -47,6 +46,366 @@ var LexicalTypeaheadMenuPlugin = require('@lexical/react/LexicalTypeaheadMenuPlu
|
|
|
47
46
|
var offset = require('@lexical/offset');
|
|
48
47
|
var LexicalHistoryPlugin = require('@lexical/react/LexicalHistoryPlugin');
|
|
49
48
|
|
|
49
|
+
// src/utils/formatProdErrorMessage.ts
|
|
50
|
+
function formatProdErrorMessage(code) {
|
|
51
|
+
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. `;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/utils/symbol-observable.ts
|
|
55
|
+
var $$observable = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
|
|
56
|
+
var symbol_observable_default = $$observable;
|
|
57
|
+
|
|
58
|
+
// src/utils/actionTypes.ts
|
|
59
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
60
|
+
var ActionTypes = {
|
|
61
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
62
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
63
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
64
|
+
};
|
|
65
|
+
var actionTypes_default = ActionTypes;
|
|
66
|
+
|
|
67
|
+
// src/utils/isPlainObject.ts
|
|
68
|
+
function isPlainObject(obj) {
|
|
69
|
+
if (typeof obj !== "object" || obj === null)
|
|
70
|
+
return false;
|
|
71
|
+
let proto = obj;
|
|
72
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
73
|
+
proto = Object.getPrototypeOf(proto);
|
|
74
|
+
}
|
|
75
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/utils/kindOf.ts
|
|
79
|
+
function miniKindOf(val) {
|
|
80
|
+
if (val === void 0)
|
|
81
|
+
return "undefined";
|
|
82
|
+
if (val === null)
|
|
83
|
+
return "null";
|
|
84
|
+
const type = typeof val;
|
|
85
|
+
switch (type) {
|
|
86
|
+
case "boolean":
|
|
87
|
+
case "string":
|
|
88
|
+
case "number":
|
|
89
|
+
case "symbol":
|
|
90
|
+
case "function": {
|
|
91
|
+
return type;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (Array.isArray(val))
|
|
95
|
+
return "array";
|
|
96
|
+
if (isDate(val))
|
|
97
|
+
return "date";
|
|
98
|
+
if (isError(val))
|
|
99
|
+
return "error";
|
|
100
|
+
const constructorName = ctorName(val);
|
|
101
|
+
switch (constructorName) {
|
|
102
|
+
case "Symbol":
|
|
103
|
+
case "Promise":
|
|
104
|
+
case "WeakMap":
|
|
105
|
+
case "WeakSet":
|
|
106
|
+
case "Map":
|
|
107
|
+
case "Set":
|
|
108
|
+
return constructorName;
|
|
109
|
+
}
|
|
110
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
111
|
+
}
|
|
112
|
+
function ctorName(val) {
|
|
113
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
114
|
+
}
|
|
115
|
+
function isError(val) {
|
|
116
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
117
|
+
}
|
|
118
|
+
function isDate(val) {
|
|
119
|
+
if (val instanceof Date)
|
|
120
|
+
return true;
|
|
121
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
122
|
+
}
|
|
123
|
+
function kindOf(val) {
|
|
124
|
+
let typeOfVal = typeof val;
|
|
125
|
+
if (process.env.NODE_ENV !== "production") {
|
|
126
|
+
typeOfVal = miniKindOf(val);
|
|
127
|
+
}
|
|
128
|
+
return typeOfVal;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/createStore.ts
|
|
132
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
133
|
+
if (typeof reducer !== "function") {
|
|
134
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'`);
|
|
135
|
+
}
|
|
136
|
+
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
|
137
|
+
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.");
|
|
138
|
+
}
|
|
139
|
+
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
140
|
+
enhancer = preloadedState;
|
|
141
|
+
preloadedState = void 0;
|
|
142
|
+
}
|
|
143
|
+
if (typeof enhancer !== "undefined") {
|
|
144
|
+
if (typeof enhancer !== "function") {
|
|
145
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'`);
|
|
146
|
+
}
|
|
147
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
148
|
+
}
|
|
149
|
+
let currentReducer = reducer;
|
|
150
|
+
let currentState = preloadedState;
|
|
151
|
+
let currentListeners = /* @__PURE__ */ new Map();
|
|
152
|
+
let nextListeners = currentListeners;
|
|
153
|
+
let listenerIdCounter = 0;
|
|
154
|
+
let isDispatching = false;
|
|
155
|
+
function ensureCanMutateNextListeners() {
|
|
156
|
+
if (nextListeners === currentListeners) {
|
|
157
|
+
nextListeners = /* @__PURE__ */ new Map();
|
|
158
|
+
currentListeners.forEach((listener, key) => {
|
|
159
|
+
nextListeners.set(key, listener);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function getState() {
|
|
164
|
+
if (isDispatching) {
|
|
165
|
+
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.");
|
|
166
|
+
}
|
|
167
|
+
return currentState;
|
|
168
|
+
}
|
|
169
|
+
function subscribe(listener) {
|
|
170
|
+
if (typeof listener !== "function") {
|
|
171
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : `Expected the listener to be a function. Instead, received: '${kindOf(listener)}'`);
|
|
172
|
+
}
|
|
173
|
+
if (isDispatching) {
|
|
174
|
+
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.");
|
|
175
|
+
}
|
|
176
|
+
let isSubscribed = true;
|
|
177
|
+
ensureCanMutateNextListeners();
|
|
178
|
+
const listenerId = listenerIdCounter++;
|
|
179
|
+
nextListeners.set(listenerId, listener);
|
|
180
|
+
return function unsubscribe() {
|
|
181
|
+
if (!isSubscribed) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (isDispatching) {
|
|
185
|
+
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.");
|
|
186
|
+
}
|
|
187
|
+
isSubscribed = false;
|
|
188
|
+
ensureCanMutateNextListeners();
|
|
189
|
+
nextListeners.delete(listenerId);
|
|
190
|
+
currentListeners = null;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function dispatch(action) {
|
|
194
|
+
if (!isPlainObject(action)) {
|
|
195
|
+
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.`);
|
|
196
|
+
}
|
|
197
|
+
if (typeof action.type === "undefined") {
|
|
198
|
+
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.');
|
|
199
|
+
}
|
|
200
|
+
if (typeof action.type !== "string") {
|
|
201
|
+
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)`);
|
|
202
|
+
}
|
|
203
|
+
if (isDispatching) {
|
|
204
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "Reducers may not dispatch actions.");
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
isDispatching = true;
|
|
208
|
+
currentState = currentReducer(currentState, action);
|
|
209
|
+
} finally {
|
|
210
|
+
isDispatching = false;
|
|
211
|
+
}
|
|
212
|
+
const listeners = currentListeners = nextListeners;
|
|
213
|
+
listeners.forEach((listener) => {
|
|
214
|
+
listener();
|
|
215
|
+
});
|
|
216
|
+
return action;
|
|
217
|
+
}
|
|
218
|
+
function replaceReducer(nextReducer) {
|
|
219
|
+
if (typeof nextReducer !== "function") {
|
|
220
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf(nextReducer)}`);
|
|
221
|
+
}
|
|
222
|
+
currentReducer = nextReducer;
|
|
223
|
+
dispatch({
|
|
224
|
+
type: actionTypes_default.REPLACE
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function observable() {
|
|
228
|
+
const outerSubscribe = subscribe;
|
|
229
|
+
return {
|
|
230
|
+
/**
|
|
231
|
+
* The minimal observable subscription method.
|
|
232
|
+
* @param observer Any object that can be used as an observer.
|
|
233
|
+
* The observer object should have a `next` method.
|
|
234
|
+
* @returns An object with an `unsubscribe` method that can
|
|
235
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
236
|
+
* emission of values from the observable.
|
|
237
|
+
*/
|
|
238
|
+
subscribe(observer) {
|
|
239
|
+
if (typeof observer !== "object" || observer === null) {
|
|
240
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : `Expected the observer to be an object. Instead, received: '${kindOf(observer)}'`);
|
|
241
|
+
}
|
|
242
|
+
function observeState() {
|
|
243
|
+
const observerAsObserver = observer;
|
|
244
|
+
if (observerAsObserver.next) {
|
|
245
|
+
observerAsObserver.next(getState());
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
observeState();
|
|
249
|
+
const unsubscribe = outerSubscribe(observeState);
|
|
250
|
+
return {
|
|
251
|
+
unsubscribe
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
[symbol_observable_default]() {
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
dispatch({
|
|
260
|
+
type: actionTypes_default.INIT
|
|
261
|
+
});
|
|
262
|
+
const store = {
|
|
263
|
+
dispatch,
|
|
264
|
+
subscribe,
|
|
265
|
+
getState,
|
|
266
|
+
replaceReducer,
|
|
267
|
+
[symbol_observable_default]: observable
|
|
268
|
+
};
|
|
269
|
+
return store;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/utils/warning.ts
|
|
273
|
+
function warning(message) {
|
|
274
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
275
|
+
console.error(message);
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
throw new Error(message);
|
|
279
|
+
} catch (e) {
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// src/combineReducers.ts
|
|
284
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
285
|
+
const reducerKeys = Object.keys(reducers);
|
|
286
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
287
|
+
if (reducerKeys.length === 0) {
|
|
288
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
289
|
+
}
|
|
290
|
+
if (!isPlainObject(inputState)) {
|
|
291
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
292
|
+
}
|
|
293
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
294
|
+
unexpectedKeys.forEach((key) => {
|
|
295
|
+
unexpectedKeyCache[key] = true;
|
|
296
|
+
});
|
|
297
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
298
|
+
return;
|
|
299
|
+
if (unexpectedKeys.length > 0) {
|
|
300
|
+
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.`;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function assertReducerShape(reducers) {
|
|
304
|
+
Object.keys(reducers).forEach((key) => {
|
|
305
|
+
const reducer = reducers[key];
|
|
306
|
+
const initialState = reducer(void 0, {
|
|
307
|
+
type: actionTypes_default.INIT
|
|
308
|
+
});
|
|
309
|
+
if (typeof initialState === "undefined") {
|
|
310
|
+
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.`);
|
|
311
|
+
}
|
|
312
|
+
if (typeof reducer(void 0, {
|
|
313
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
314
|
+
}) === "undefined") {
|
|
315
|
+
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.`);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function combineReducers(reducers) {
|
|
320
|
+
const reducerKeys = Object.keys(reducers);
|
|
321
|
+
const finalReducers = {};
|
|
322
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
323
|
+
const key = reducerKeys[i];
|
|
324
|
+
if (process.env.NODE_ENV !== "production") {
|
|
325
|
+
if (typeof reducers[key] === "undefined") {
|
|
326
|
+
warning(`No reducer provided for key "${key}"`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (typeof reducers[key] === "function") {
|
|
330
|
+
finalReducers[key] = reducers[key];
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
334
|
+
let unexpectedKeyCache;
|
|
335
|
+
if (process.env.NODE_ENV !== "production") {
|
|
336
|
+
unexpectedKeyCache = {};
|
|
337
|
+
}
|
|
338
|
+
let shapeAssertionError;
|
|
339
|
+
try {
|
|
340
|
+
assertReducerShape(finalReducers);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
shapeAssertionError = e;
|
|
343
|
+
}
|
|
344
|
+
return function combination(state = {}, action) {
|
|
345
|
+
if (shapeAssertionError) {
|
|
346
|
+
throw shapeAssertionError;
|
|
347
|
+
}
|
|
348
|
+
if (process.env.NODE_ENV !== "production") {
|
|
349
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
350
|
+
if (warningMessage) {
|
|
351
|
+
warning(warningMessage);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
let hasChanged = false;
|
|
355
|
+
const nextState = {};
|
|
356
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
357
|
+
const key = finalReducerKeys[i];
|
|
358
|
+
const reducer = finalReducers[key];
|
|
359
|
+
const previousStateForKey = state[key];
|
|
360
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
361
|
+
if (typeof nextStateForKey === "undefined") {
|
|
362
|
+
const actionType = action && action.type;
|
|
363
|
+
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.`);
|
|
364
|
+
}
|
|
365
|
+
nextState[key] = nextStateForKey;
|
|
366
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
367
|
+
}
|
|
368
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
369
|
+
return hasChanged ? nextState : state;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// src/compose.ts
|
|
374
|
+
function compose(...funcs) {
|
|
375
|
+
if (funcs.length === 0) {
|
|
376
|
+
return (arg) => arg;
|
|
377
|
+
}
|
|
378
|
+
if (funcs.length === 1) {
|
|
379
|
+
return funcs[0];
|
|
380
|
+
}
|
|
381
|
+
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// src/applyMiddleware.ts
|
|
385
|
+
function applyMiddleware(...middlewares) {
|
|
386
|
+
return (createStore2) => (reducer, preloadedState) => {
|
|
387
|
+
const store = createStore2(reducer, preloadedState);
|
|
388
|
+
let dispatch = () => {
|
|
389
|
+
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.");
|
|
390
|
+
};
|
|
391
|
+
const middlewareAPI = {
|
|
392
|
+
getState: store.getState,
|
|
393
|
+
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
394
|
+
};
|
|
395
|
+
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
396
|
+
dispatch = compose(...chain)(store.dispatch);
|
|
397
|
+
return {
|
|
398
|
+
...store,
|
|
399
|
+
dispatch
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/utils/isAction.ts
|
|
405
|
+
function isAction(action) {
|
|
406
|
+
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
407
|
+
}
|
|
408
|
+
|
|
50
409
|
var __defProp = Object.defineProperty;
|
|
51
410
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
52
411
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -121,10 +480,10 @@ function isDraftable(value) {
|
|
|
121
480
|
var _a;
|
|
122
481
|
if (!value)
|
|
123
482
|
return false;
|
|
124
|
-
return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
|
|
483
|
+
return isPlainObject$1(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
|
|
125
484
|
}
|
|
126
485
|
var objectCtorString = Object.prototype.constructor.toString();
|
|
127
|
-
function isPlainObject(value) {
|
|
486
|
+
function isPlainObject$1(value) {
|
|
128
487
|
if (!value || typeof value !== "object")
|
|
129
488
|
return false;
|
|
130
489
|
const proto = getPrototypeOf(value);
|
|
@@ -186,7 +545,7 @@ function shallowCopy(base, strict) {
|
|
|
186
545
|
}
|
|
187
546
|
if (Array.isArray(base))
|
|
188
547
|
return Array.prototype.slice.call(base);
|
|
189
|
-
const isPlain = isPlainObject(base);
|
|
548
|
+
const isPlain = isPlainObject$1(base);
|
|
190
549
|
if (strict === true || strict === "class_only" && !isPlain) {
|
|
191
550
|
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
192
551
|
delete descriptors[DRAFT_STATE];
|
|
@@ -244,6 +603,10 @@ function getPlugin(pluginKey) {
|
|
|
244
603
|
}
|
|
245
604
|
return plugin;
|
|
246
605
|
}
|
|
606
|
+
function loadPlugin(pluginKey, implementation) {
|
|
607
|
+
if (!plugins[pluginKey])
|
|
608
|
+
plugins[pluginKey] = implementation;
|
|
609
|
+
}
|
|
247
610
|
|
|
248
611
|
// src/core/scope.ts
|
|
249
612
|
var currentScope;
|
|
@@ -760,6 +1123,256 @@ function currentImpl(value) {
|
|
|
760
1123
|
return copy;
|
|
761
1124
|
}
|
|
762
1125
|
|
|
1126
|
+
// src/plugins/mapset.ts
|
|
1127
|
+
function enableMapSet() {
|
|
1128
|
+
class DraftMap extends Map {
|
|
1129
|
+
constructor(target, parent) {
|
|
1130
|
+
super();
|
|
1131
|
+
this[DRAFT_STATE] = {
|
|
1132
|
+
type_: 2 /* Map */,
|
|
1133
|
+
parent_: parent,
|
|
1134
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1135
|
+
modified_: false,
|
|
1136
|
+
finalized_: false,
|
|
1137
|
+
copy_: void 0,
|
|
1138
|
+
assigned_: void 0,
|
|
1139
|
+
base_: target,
|
|
1140
|
+
draft_: this,
|
|
1141
|
+
isManual_: false,
|
|
1142
|
+
revoked_: false
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
get size() {
|
|
1146
|
+
return latest(this[DRAFT_STATE]).size;
|
|
1147
|
+
}
|
|
1148
|
+
has(key) {
|
|
1149
|
+
return latest(this[DRAFT_STATE]).has(key);
|
|
1150
|
+
}
|
|
1151
|
+
set(key, value) {
|
|
1152
|
+
const state = this[DRAFT_STATE];
|
|
1153
|
+
assertUnrevoked(state);
|
|
1154
|
+
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
1155
|
+
prepareMapCopy(state);
|
|
1156
|
+
markChanged(state);
|
|
1157
|
+
state.assigned_.set(key, true);
|
|
1158
|
+
state.copy_.set(key, value);
|
|
1159
|
+
state.assigned_.set(key, true);
|
|
1160
|
+
}
|
|
1161
|
+
return this;
|
|
1162
|
+
}
|
|
1163
|
+
delete(key) {
|
|
1164
|
+
if (!this.has(key)) {
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
const state = this[DRAFT_STATE];
|
|
1168
|
+
assertUnrevoked(state);
|
|
1169
|
+
prepareMapCopy(state);
|
|
1170
|
+
markChanged(state);
|
|
1171
|
+
if (state.base_.has(key)) {
|
|
1172
|
+
state.assigned_.set(key, false);
|
|
1173
|
+
} else {
|
|
1174
|
+
state.assigned_.delete(key);
|
|
1175
|
+
}
|
|
1176
|
+
state.copy_.delete(key);
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
clear() {
|
|
1180
|
+
const state = this[DRAFT_STATE];
|
|
1181
|
+
assertUnrevoked(state);
|
|
1182
|
+
if (latest(state).size) {
|
|
1183
|
+
prepareMapCopy(state);
|
|
1184
|
+
markChanged(state);
|
|
1185
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
1186
|
+
each(state.base_, (key) => {
|
|
1187
|
+
state.assigned_.set(key, false);
|
|
1188
|
+
});
|
|
1189
|
+
state.copy_.clear();
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
forEach(cb, thisArg) {
|
|
1193
|
+
const state = this[DRAFT_STATE];
|
|
1194
|
+
latest(state).forEach((_value, key, _map) => {
|
|
1195
|
+
cb.call(thisArg, this.get(key), key, this);
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
get(key) {
|
|
1199
|
+
const state = this[DRAFT_STATE];
|
|
1200
|
+
assertUnrevoked(state);
|
|
1201
|
+
const value = latest(state).get(key);
|
|
1202
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
1203
|
+
return value;
|
|
1204
|
+
}
|
|
1205
|
+
if (value !== state.base_.get(key)) {
|
|
1206
|
+
return value;
|
|
1207
|
+
}
|
|
1208
|
+
const draft = createProxy(value, state);
|
|
1209
|
+
prepareMapCopy(state);
|
|
1210
|
+
state.copy_.set(key, draft);
|
|
1211
|
+
return draft;
|
|
1212
|
+
}
|
|
1213
|
+
keys() {
|
|
1214
|
+
return latest(this[DRAFT_STATE]).keys();
|
|
1215
|
+
}
|
|
1216
|
+
values() {
|
|
1217
|
+
const iterator = this.keys();
|
|
1218
|
+
return {
|
|
1219
|
+
[Symbol.iterator]: () => this.values(),
|
|
1220
|
+
next: () => {
|
|
1221
|
+
const r = iterator.next();
|
|
1222
|
+
if (r.done)
|
|
1223
|
+
return r;
|
|
1224
|
+
const value = this.get(r.value);
|
|
1225
|
+
return {
|
|
1226
|
+
done: false,
|
|
1227
|
+
value
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
entries() {
|
|
1233
|
+
const iterator = this.keys();
|
|
1234
|
+
return {
|
|
1235
|
+
[Symbol.iterator]: () => this.entries(),
|
|
1236
|
+
next: () => {
|
|
1237
|
+
const r = iterator.next();
|
|
1238
|
+
if (r.done)
|
|
1239
|
+
return r;
|
|
1240
|
+
const value = this.get(r.value);
|
|
1241
|
+
return {
|
|
1242
|
+
done: false,
|
|
1243
|
+
value: [r.value, value]
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
[(Symbol.iterator)]() {
|
|
1249
|
+
return this.entries();
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
function proxyMap_(target, parent) {
|
|
1253
|
+
return new DraftMap(target, parent);
|
|
1254
|
+
}
|
|
1255
|
+
function prepareMapCopy(state) {
|
|
1256
|
+
if (!state.copy_) {
|
|
1257
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
1258
|
+
state.copy_ = new Map(state.base_);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
class DraftSet extends Set {
|
|
1262
|
+
constructor(target, parent) {
|
|
1263
|
+
super();
|
|
1264
|
+
this[DRAFT_STATE] = {
|
|
1265
|
+
type_: 3 /* Set */,
|
|
1266
|
+
parent_: parent,
|
|
1267
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1268
|
+
modified_: false,
|
|
1269
|
+
finalized_: false,
|
|
1270
|
+
copy_: void 0,
|
|
1271
|
+
base_: target,
|
|
1272
|
+
draft_: this,
|
|
1273
|
+
drafts_: /* @__PURE__ */ new Map(),
|
|
1274
|
+
revoked_: false,
|
|
1275
|
+
isManual_: false
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
get size() {
|
|
1279
|
+
return latest(this[DRAFT_STATE]).size;
|
|
1280
|
+
}
|
|
1281
|
+
has(value) {
|
|
1282
|
+
const state = this[DRAFT_STATE];
|
|
1283
|
+
assertUnrevoked(state);
|
|
1284
|
+
if (!state.copy_) {
|
|
1285
|
+
return state.base_.has(value);
|
|
1286
|
+
}
|
|
1287
|
+
if (state.copy_.has(value))
|
|
1288
|
+
return true;
|
|
1289
|
+
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
1290
|
+
return true;
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
add(value) {
|
|
1294
|
+
const state = this[DRAFT_STATE];
|
|
1295
|
+
assertUnrevoked(state);
|
|
1296
|
+
if (!this.has(value)) {
|
|
1297
|
+
prepareSetCopy(state);
|
|
1298
|
+
markChanged(state);
|
|
1299
|
+
state.copy_.add(value);
|
|
1300
|
+
}
|
|
1301
|
+
return this;
|
|
1302
|
+
}
|
|
1303
|
+
delete(value) {
|
|
1304
|
+
if (!this.has(value)) {
|
|
1305
|
+
return false;
|
|
1306
|
+
}
|
|
1307
|
+
const state = this[DRAFT_STATE];
|
|
1308
|
+
assertUnrevoked(state);
|
|
1309
|
+
prepareSetCopy(state);
|
|
1310
|
+
markChanged(state);
|
|
1311
|
+
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
1312
|
+
/* istanbul ignore next */
|
|
1313
|
+
false
|
|
1314
|
+
));
|
|
1315
|
+
}
|
|
1316
|
+
clear() {
|
|
1317
|
+
const state = this[DRAFT_STATE];
|
|
1318
|
+
assertUnrevoked(state);
|
|
1319
|
+
if (latest(state).size) {
|
|
1320
|
+
prepareSetCopy(state);
|
|
1321
|
+
markChanged(state);
|
|
1322
|
+
state.copy_.clear();
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
values() {
|
|
1326
|
+
const state = this[DRAFT_STATE];
|
|
1327
|
+
assertUnrevoked(state);
|
|
1328
|
+
prepareSetCopy(state);
|
|
1329
|
+
return state.copy_.values();
|
|
1330
|
+
}
|
|
1331
|
+
entries() {
|
|
1332
|
+
const state = this[DRAFT_STATE];
|
|
1333
|
+
assertUnrevoked(state);
|
|
1334
|
+
prepareSetCopy(state);
|
|
1335
|
+
return state.copy_.entries();
|
|
1336
|
+
}
|
|
1337
|
+
keys() {
|
|
1338
|
+
return this.values();
|
|
1339
|
+
}
|
|
1340
|
+
[(Symbol.iterator)]() {
|
|
1341
|
+
return this.values();
|
|
1342
|
+
}
|
|
1343
|
+
forEach(cb, thisArg) {
|
|
1344
|
+
const iterator = this.values();
|
|
1345
|
+
let result = iterator.next();
|
|
1346
|
+
while (!result.done) {
|
|
1347
|
+
cb.call(thisArg, result.value, result.value, this);
|
|
1348
|
+
result = iterator.next();
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
function proxySet_(target, parent) {
|
|
1353
|
+
return new DraftSet(target, parent);
|
|
1354
|
+
}
|
|
1355
|
+
function prepareSetCopy(state) {
|
|
1356
|
+
if (!state.copy_) {
|
|
1357
|
+
state.copy_ = /* @__PURE__ */ new Set();
|
|
1358
|
+
state.base_.forEach((value) => {
|
|
1359
|
+
if (isDraftable(value)) {
|
|
1360
|
+
const draft = createProxy(value, state);
|
|
1361
|
+
state.drafts_.set(value, draft);
|
|
1362
|
+
state.copy_.add(draft);
|
|
1363
|
+
} else {
|
|
1364
|
+
state.copy_.add(value);
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
function assertUnrevoked(state) {
|
|
1370
|
+
if (state.revoked_)
|
|
1371
|
+
die(3, JSON.stringify(latest(state)));
|
|
1372
|
+
}
|
|
1373
|
+
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
1374
|
+
}
|
|
1375
|
+
|
|
763
1376
|
// src/immer.ts
|
|
764
1377
|
var immer = new Immer2();
|
|
765
1378
|
var produce = immer.produce;
|
|
@@ -818,8 +1431,8 @@ var __objRest = (source, exclude) => {
|
|
|
818
1431
|
};
|
|
819
1432
|
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
820
1433
|
if (arguments.length === 0) return void 0;
|
|
821
|
-
if (typeof arguments[0] === "object") return
|
|
822
|
-
return
|
|
1434
|
+
if (typeof arguments[0] === "object") return compose;
|
|
1435
|
+
return compose.apply(null, arguments);
|
|
823
1436
|
};
|
|
824
1437
|
|
|
825
1438
|
// src/tsHelpers.ts
|
|
@@ -833,7 +1446,7 @@ function createAction(type, prepareAction) {
|
|
|
833
1446
|
if (prepareAction) {
|
|
834
1447
|
let prepared = prepareAction(...args);
|
|
835
1448
|
if (!prepared) {
|
|
836
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
1449
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(0) : "prepareAction did not return an object");
|
|
837
1450
|
}
|
|
838
1451
|
return __spreadValues$1(__spreadValues$1({
|
|
839
1452
|
type,
|
|
@@ -851,7 +1464,7 @@ function createAction(type, prepareAction) {
|
|
|
851
1464
|
}
|
|
852
1465
|
actionCreator.toString = () => `${type}`;
|
|
853
1466
|
actionCreator.type = type;
|
|
854
|
-
actionCreator.match = (action) =>
|
|
1467
|
+
actionCreator.match = (action) => isAction(action) && action.type === type;
|
|
855
1468
|
return actionCreator;
|
|
856
1469
|
}
|
|
857
1470
|
function isActionCreator(action) {
|
|
@@ -1042,7 +1655,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1042
1655
|
result = tracker.detectMutations();
|
|
1043
1656
|
tracker = track(state);
|
|
1044
1657
|
if (result.wasMutated) {
|
|
1045
|
-
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)`);
|
|
1658
|
+
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)`);
|
|
1046
1659
|
}
|
|
1047
1660
|
});
|
|
1048
1661
|
const dispatchedAction = next(action);
|
|
@@ -1051,7 +1664,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1051
1664
|
result = tracker.detectMutations();
|
|
1052
1665
|
tracker = track(state);
|
|
1053
1666
|
if (result.wasMutated) {
|
|
1054
|
-
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)`);
|
|
1667
|
+
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)`);
|
|
1055
1668
|
}
|
|
1056
1669
|
});
|
|
1057
1670
|
measureUtils.warnIfExceeded();
|
|
@@ -1062,7 +1675,7 @@ function createImmutableStateInvariantMiddleware(options = {}) {
|
|
|
1062
1675
|
}
|
|
1063
1676
|
function isPlain(val) {
|
|
1064
1677
|
const type = typeof val;
|
|
1065
|
-
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) ||
|
|
1678
|
+
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
1066
1679
|
}
|
|
1067
1680
|
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
|
|
1068
1681
|
let foundNestedSerializable;
|
|
@@ -1132,7 +1745,7 @@ function createSerializableStateInvariantMiddleware(options = {}) {
|
|
|
1132
1745
|
} = options;
|
|
1133
1746
|
const cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
|
|
1134
1747
|
return (storeAPI) => (next) => (action) => {
|
|
1135
|
-
if (!
|
|
1748
|
+
if (!isAction(action)) {
|
|
1136
1749
|
return next(action);
|
|
1137
1750
|
}
|
|
1138
1751
|
const result = next(action);
|
|
@@ -1300,59 +1913,59 @@ function configureStore(options) {
|
|
|
1300
1913
|
let rootReducer;
|
|
1301
1914
|
if (typeof reducer === "function") {
|
|
1302
1915
|
rootReducer = reducer;
|
|
1303
|
-
} else if (
|
|
1304
|
-
rootReducer =
|
|
1916
|
+
} else if (isPlainObject(reducer)) {
|
|
1917
|
+
rootReducer = combineReducers(reducer);
|
|
1305
1918
|
} else {
|
|
1306
|
-
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");
|
|
1919
|
+
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");
|
|
1307
1920
|
}
|
|
1308
1921
|
if (process.env.NODE_ENV !== "production" && middleware && typeof middleware !== "function") {
|
|
1309
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "`middleware` field must be a callback");
|
|
1922
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(2) : "`middleware` field must be a callback");
|
|
1310
1923
|
}
|
|
1311
1924
|
let finalMiddleware;
|
|
1312
1925
|
if (typeof middleware === "function") {
|
|
1313
1926
|
finalMiddleware = middleware(getDefaultMiddleware);
|
|
1314
1927
|
if (process.env.NODE_ENV !== "production" && !Array.isArray(finalMiddleware)) {
|
|
1315
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1928
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1316
1929
|
}
|
|
1317
1930
|
} else {
|
|
1318
1931
|
finalMiddleware = getDefaultMiddleware();
|
|
1319
1932
|
}
|
|
1320
1933
|
if (process.env.NODE_ENV !== "production" && finalMiddleware.some((item) => typeof item !== "function")) {
|
|
1321
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "each middleware provided to configureStore must be a function");
|
|
1934
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(4) : "each middleware provided to configureStore must be a function");
|
|
1322
1935
|
}
|
|
1323
1936
|
if (process.env.NODE_ENV !== "production" && duplicateMiddlewareCheck) {
|
|
1324
1937
|
let middlewareReferences = /* @__PURE__ */ new Set();
|
|
1325
1938
|
finalMiddleware.forEach((middleware2) => {
|
|
1326
1939
|
if (middlewareReferences.has(middleware2)) {
|
|
1327
|
-
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.");
|
|
1940
|
+
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.");
|
|
1328
1941
|
}
|
|
1329
1942
|
middlewareReferences.add(middleware2);
|
|
1330
1943
|
});
|
|
1331
1944
|
}
|
|
1332
|
-
let finalCompose =
|
|
1945
|
+
let finalCompose = compose;
|
|
1333
1946
|
if (devTools) {
|
|
1334
1947
|
finalCompose = composeWithDevTools(__spreadValues$1({
|
|
1335
1948
|
// Enable capture of stack traces for dispatched Redux actions
|
|
1336
1949
|
trace: process.env.NODE_ENV !== "production"
|
|
1337
1950
|
}, typeof devTools === "object" && devTools));
|
|
1338
1951
|
}
|
|
1339
|
-
const middlewareEnhancer =
|
|
1952
|
+
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
1340
1953
|
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
1341
1954
|
if (process.env.NODE_ENV !== "production" && enhancers && typeof enhancers !== "function") {
|
|
1342
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "`enhancers` field must be a callback");
|
|
1955
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(5) : "`enhancers` field must be a callback");
|
|
1343
1956
|
}
|
|
1344
1957
|
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
1345
1958
|
if (process.env.NODE_ENV !== "production" && !Array.isArray(storeEnhancers)) {
|
|
1346
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "`enhancers` callback must return an array");
|
|
1959
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(6) : "`enhancers` callback must return an array");
|
|
1347
1960
|
}
|
|
1348
1961
|
if (process.env.NODE_ENV !== "production" && storeEnhancers.some((item) => typeof item !== "function")) {
|
|
1349
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "each enhancer provided to configureStore must be a function");
|
|
1962
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(7) : "each enhancer provided to configureStore must be a function");
|
|
1350
1963
|
}
|
|
1351
1964
|
if (process.env.NODE_ENV !== "production" && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {
|
|
1352
1965
|
console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
1353
1966
|
}
|
|
1354
1967
|
const composedEnhancer = finalCompose(...storeEnhancers);
|
|
1355
|
-
return
|
|
1968
|
+
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
1356
1969
|
}
|
|
1357
1970
|
|
|
1358
1971
|
// src/mapBuilders.ts
|
|
@@ -1364,18 +1977,18 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1364
1977
|
addCase(typeOrActionCreator, reducer) {
|
|
1365
1978
|
if (process.env.NODE_ENV !== "production") {
|
|
1366
1979
|
if (actionMatchers.length > 0) {
|
|
1367
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1980
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1368
1981
|
}
|
|
1369
1982
|
if (defaultCaseReducer) {
|
|
1370
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1983
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1371
1984
|
}
|
|
1372
1985
|
}
|
|
1373
1986
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1374
1987
|
if (!type) {
|
|
1375
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1988
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1376
1989
|
}
|
|
1377
1990
|
if (type in actionsMap) {
|
|
1378
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1991
|
+
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}'`);
|
|
1379
1992
|
}
|
|
1380
1993
|
actionsMap[type] = reducer;
|
|
1381
1994
|
return builder;
|
|
@@ -1383,7 +1996,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1383
1996
|
addMatcher(matcher, reducer) {
|
|
1384
1997
|
if (process.env.NODE_ENV !== "production") {
|
|
1385
1998
|
if (defaultCaseReducer) {
|
|
1386
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1999
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1387
2000
|
}
|
|
1388
2001
|
}
|
|
1389
2002
|
actionMatchers.push({
|
|
@@ -1395,7 +2008,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1395
2008
|
addDefaultCase(reducer) {
|
|
1396
2009
|
if (process.env.NODE_ENV !== "production") {
|
|
1397
2010
|
if (defaultCaseReducer) {
|
|
1398
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
2011
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(31) : "`builder.addDefaultCase` can only be called once");
|
|
1399
2012
|
}
|
|
1400
2013
|
}
|
|
1401
2014
|
defaultCaseReducer = reducer;
|
|
@@ -1413,7 +2026,7 @@ function isStateFunction(x) {
|
|
|
1413
2026
|
function createReducer(initialState, mapOrBuilderCallback) {
|
|
1414
2027
|
if (process.env.NODE_ENV !== "production") {
|
|
1415
2028
|
if (typeof mapOrBuilderCallback === "object") {
|
|
1416
|
-
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");
|
|
2029
|
+
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");
|
|
1417
2030
|
}
|
|
1418
2031
|
}
|
|
1419
2032
|
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
@@ -1480,7 +2093,7 @@ function buildCreateSlice({
|
|
|
1480
2093
|
reducerPath = name
|
|
1481
2094
|
} = options;
|
|
1482
2095
|
if (!name) {
|
|
1483
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
2096
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(11) : "`name` is a required option for createSlice");
|
|
1484
2097
|
}
|
|
1485
2098
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1486
2099
|
if (options.initialState === void 0) {
|
|
@@ -1499,10 +2112,10 @@ function buildCreateSlice({
|
|
|
1499
2112
|
addCase(typeOrActionCreator, reducer2) {
|
|
1500
2113
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1501
2114
|
if (!type) {
|
|
1502
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
|
|
2115
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(12) : "`context.addCase` cannot be called with an empty action type");
|
|
1503
2116
|
}
|
|
1504
2117
|
if (type in context.sliceCaseReducersByType) {
|
|
1505
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
2118
|
+
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);
|
|
1506
2119
|
}
|
|
1507
2120
|
context.sliceCaseReducersByType[type] = reducer2;
|
|
1508
2121
|
return contextMethods;
|
|
@@ -1539,7 +2152,7 @@ function buildCreateSlice({
|
|
|
1539
2152
|
function buildReducer() {
|
|
1540
2153
|
if (process.env.NODE_ENV !== "production") {
|
|
1541
2154
|
if (typeof options.extraReducers === "object") {
|
|
1542
|
-
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");
|
|
2155
|
+
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");
|
|
1543
2156
|
}
|
|
1544
2157
|
}
|
|
1545
2158
|
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
@@ -1578,7 +2191,7 @@ function buildCreateSlice({
|
|
|
1578
2191
|
if (injected) {
|
|
1579
2192
|
sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
1580
2193
|
} else if (process.env.NODE_ENV !== "production") {
|
|
1581
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
2194
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1582
2195
|
}
|
|
1583
2196
|
}
|
|
1584
2197
|
return sliceState;
|
|
@@ -1634,7 +2247,7 @@ function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
|
1634
2247
|
if (injected) {
|
|
1635
2248
|
sliceState = getInitialState();
|
|
1636
2249
|
} else if (process.env.NODE_ENV !== "production") {
|
|
1637
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
2250
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1638
2251
|
}
|
|
1639
2252
|
}
|
|
1640
2253
|
return selector(sliceState, ...args);
|
|
@@ -1682,7 +2295,7 @@ function handleNormalReducerDefinition({
|
|
|
1682
2295
|
let prepareCallback;
|
|
1683
2296
|
if ("reducer" in maybeReducerWithPrepare) {
|
|
1684
2297
|
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
1685
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2298
|
+
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.");
|
|
1686
2299
|
}
|
|
1687
2300
|
caseReducer = maybeReducerWithPrepare.reducer;
|
|
1688
2301
|
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
@@ -1702,7 +2315,7 @@ function handleThunkCaseReducerDefinition({
|
|
|
1702
2315
|
reducerName
|
|
1703
2316
|
}, reducerDefinition, context, cAT) {
|
|
1704
2317
|
if (!cAT) {
|
|
1705
|
-
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`.");
|
|
2318
|
+
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`.");
|
|
1706
2319
|
}
|
|
1707
2320
|
const {
|
|
1708
2321
|
payloadCreator,
|
|
@@ -1737,7 +2350,7 @@ function noop() {
|
|
|
1737
2350
|
}
|
|
1738
2351
|
|
|
1739
2352
|
// src/formatProdErrorMessage.ts
|
|
1740
|
-
function formatProdErrorMessage(code) {
|
|
2353
|
+
function formatProdErrorMessage$1(code) {
|
|
1741
2354
|
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. `;
|
|
1742
2355
|
}
|
|
1743
2356
|
|
|
@@ -2241,182 +2854,205 @@ function _catch(body, recover) {
|
|
|
2241
2854
|
return result;
|
|
2242
2855
|
}
|
|
2243
2856
|
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2857
|
+
// Asynchronously await a promise and pass the result to a finally continuation
|
|
2858
|
+
function _finallyRethrows(body, finalizer) {
|
|
2859
|
+
try {
|
|
2860
|
+
var result = body();
|
|
2861
|
+
} catch (e) {
|
|
2862
|
+
return finalizer(true, e);
|
|
2863
|
+
}
|
|
2864
|
+
if (result && result.then) {
|
|
2865
|
+
return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
|
|
2866
|
+
}
|
|
2867
|
+
return finalizer(false, result);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
var openDatabase = function openDatabase(dbName) {
|
|
2871
|
+
return new Promise(function (resolve, reject) {
|
|
2872
|
+
var request = indexedDB.open(dbName);
|
|
2873
|
+
request.onsuccess = function () {
|
|
2874
|
+
return resolve(request.result);
|
|
2254
2875
|
};
|
|
2255
|
-
|
|
2256
|
-
|
|
2876
|
+
request.onerror = function () {
|
|
2877
|
+
return reject(request.error);
|
|
2257
2878
|
};
|
|
2258
|
-
|
|
2259
|
-
|
|
2879
|
+
});
|
|
2880
|
+
};
|
|
2881
|
+
var runUpgrade = function runUpgrade(dbName, onUpgrade) {
|
|
2882
|
+
try {
|
|
2883
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2884
|
+
var nextVersion = db.version + 1;
|
|
2885
|
+
db.close();
|
|
2886
|
+
return new Promise(function (resolve, reject) {
|
|
2887
|
+
var request = indexedDB.open(dbName, nextVersion);
|
|
2888
|
+
request.onupgradeneeded = function () {
|
|
2889
|
+
var upgradeDb = request.result;
|
|
2890
|
+
onUpgrade(upgradeDb);
|
|
2891
|
+
};
|
|
2892
|
+
request.onsuccess = function () {
|
|
2893
|
+
return resolve(request.result);
|
|
2894
|
+
};
|
|
2895
|
+
request.onerror = function () {
|
|
2896
|
+
return reject(request.error);
|
|
2897
|
+
};
|
|
2898
|
+
request.onblocked = function () {
|
|
2899
|
+
log.warn('IndexedDB upgrade blocked; close other tabs to proceed');
|
|
2900
|
+
};
|
|
2901
|
+
});
|
|
2902
|
+
});
|
|
2903
|
+
} catch (e) {
|
|
2904
|
+
return Promise.reject(e);
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
var ensureStore = function ensureStore(dbName, storeName, keyPath) {
|
|
2908
|
+
try {
|
|
2909
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2260
2910
|
if (db.objectStoreNames.contains(storeName)) {
|
|
2261
|
-
|
|
2262
|
-
} else {
|
|
2263
|
-
db.close();
|
|
2264
|
-
currentVersion++;
|
|
2265
|
-
_setDataToDB(dbName, storeName, data, keyPath);
|
|
2911
|
+
return db;
|
|
2266
2912
|
}
|
|
2267
|
-
db.
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2913
|
+
db.close();
|
|
2914
|
+
return Promise.resolve(runUpgrade(dbName, function (upgradeDb) {
|
|
2915
|
+
if (!upgradeDb.objectStoreNames.contains(storeName)) {
|
|
2916
|
+
upgradeDb.createObjectStore(storeName, {
|
|
2917
|
+
keyPath: keyPath
|
|
2918
|
+
});
|
|
2919
|
+
}
|
|
2920
|
+
}));
|
|
2921
|
+
});
|
|
2922
|
+
} catch (e) {
|
|
2923
|
+
return Promise.reject(e);
|
|
2273
2924
|
}
|
|
2274
2925
|
};
|
|
2275
|
-
var
|
|
2926
|
+
var awaitTransaction = function awaitTransaction(tx) {
|
|
2276
2927
|
return new Promise(function (resolve, reject) {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
var db = event.target.result;
|
|
2280
|
-
var transaction = event.target.transaction;
|
|
2281
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2282
|
-
var objectStore = transaction.objectStore(storeName);
|
|
2283
|
-
var request = objectStore.get(keyPath);
|
|
2284
|
-
request.onsuccess = function (event) {
|
|
2285
|
-
var result = event.target.result;
|
|
2286
|
-
resolve(result || '');
|
|
2287
|
-
};
|
|
2288
|
-
request.onerror = function (event) {
|
|
2289
|
-
log.error('Error retrieving data during upgrade: ', event.target.error);
|
|
2290
|
-
resolve('');
|
|
2291
|
-
};
|
|
2292
|
-
} else {
|
|
2293
|
-
db.createObjectStore(storeName, {
|
|
2294
|
-
keyPath: keyPatName
|
|
2295
|
-
});
|
|
2296
|
-
resolve('');
|
|
2297
|
-
}
|
|
2928
|
+
tx.oncomplete = function () {
|
|
2929
|
+
return resolve();
|
|
2298
2930
|
};
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
currentVersion++;
|
|
2302
|
-
resolve(_getDataFromDB(dbName, storeName, keyPath));
|
|
2303
|
-
} else {
|
|
2304
|
-
reject(event);
|
|
2305
|
-
}
|
|
2931
|
+
tx.onerror = function () {
|
|
2932
|
+
return reject(tx.error);
|
|
2306
2933
|
};
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2310
|
-
var transaction = db.transaction(storeName, 'readonly');
|
|
2311
|
-
var objectStore = transaction.objectStore(storeName);
|
|
2312
|
-
var request = objectStore.get(keyPath);
|
|
2313
|
-
request.onsuccess = function (event) {
|
|
2314
|
-
var result = event.target.result;
|
|
2315
|
-
if (result) {
|
|
2316
|
-
db.close();
|
|
2317
|
-
resolve(result);
|
|
2318
|
-
} else {
|
|
2319
|
-
log.info('No data found for the specified keyPathValue.');
|
|
2320
|
-
db.close();
|
|
2321
|
-
resolve('');
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
request.onerror = function (event) {
|
|
2325
|
-
db.close();
|
|
2326
|
-
log.error('Error retrieving data: ', event.target.error);
|
|
2327
|
-
};
|
|
2328
|
-
} else {
|
|
2329
|
-
db.close();
|
|
2330
|
-
resolve('');
|
|
2331
|
-
}
|
|
2934
|
+
tx.onabort = function () {
|
|
2935
|
+
return reject(tx.error);
|
|
2332
2936
|
};
|
|
2333
2937
|
});
|
|
2334
2938
|
};
|
|
2335
|
-
var
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
if (
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2939
|
+
var putWithPossibleOutOfLineKey = function putWithPossibleOutOfLineKey(store, value, keyField) {
|
|
2940
|
+
try {
|
|
2941
|
+
if (store.keyPath !== null) {
|
|
2942
|
+
store.put(value);
|
|
2943
|
+
return;
|
|
2944
|
+
}
|
|
2945
|
+
} catch (e) {}
|
|
2946
|
+
var explicitKey = value === null || value === void 0 ? void 0 : value[keyField];
|
|
2947
|
+
if (explicitKey === undefined || explicitKey === null) {
|
|
2948
|
+
throw new Error("IndexedDB put requires explicit key but value has no '" + keyField + "' field");
|
|
2949
|
+
}
|
|
2950
|
+
store.put(value, explicitKey);
|
|
2951
|
+
};
|
|
2952
|
+
var setDataToDB = function setDataToDB(dbName, storeName, data, keyPath) {
|
|
2953
|
+
try {
|
|
2954
|
+
if (!('indexedDB' in window)) {
|
|
2955
|
+
log.info("This browser doesn't support IndexedDB");
|
|
2956
|
+
return Promise.resolve();
|
|
2957
|
+
}
|
|
2958
|
+
return Promise.resolve(ensureStore(dbName, storeName, keyPath)).then(function (db) {
|
|
2959
|
+
var _temp = _finallyRethrows(function () {
|
|
2960
|
+
var tx = db.transaction(storeName, 'readwrite');
|
|
2961
|
+
var store = tx.objectStore(storeName);
|
|
2962
|
+
data.forEach(function (value) {
|
|
2963
|
+
putWithPossibleOutOfLineKey(store, value, keyPath);
|
|
2964
|
+
});
|
|
2965
|
+
return Promise.resolve(awaitTransaction(tx)).then(function () {});
|
|
2966
|
+
}, function (_wasThrown, _result) {
|
|
2967
|
+
db.close();
|
|
2968
|
+
if (_wasThrown) throw _result;
|
|
2969
|
+
return _result;
|
|
2360
2970
|
});
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2971
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
2972
|
+
});
|
|
2973
|
+
} catch (e) {
|
|
2974
|
+
return Promise.reject(e);
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
var getDataFromDB = function getDataFromDB(dbName, storeName, keyPathValue, keyPathName) {
|
|
2978
|
+
try {
|
|
2979
|
+
return Promise.resolve(_catch(function () {
|
|
2980
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2981
|
+
var _exit = false;
|
|
2982
|
+
function _temp5(_result2) {
|
|
2983
|
+
if (_exit) return _result2;
|
|
2984
|
+
var tx = db.transaction(storeName, 'readonly');
|
|
2985
|
+
var objectStore = tx.objectStore(storeName);
|
|
2986
|
+
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
2987
|
+
var request = objectStore.get(keyPathValue);
|
|
2988
|
+
request.onsuccess = function () {
|
|
2989
|
+
return resolve(request.result);
|
|
2990
|
+
};
|
|
2991
|
+
request.onerror = function () {
|
|
2992
|
+
return reject(request.error);
|
|
2993
|
+
};
|
|
2994
|
+
})).then(function (result) {
|
|
2995
|
+
db.close();
|
|
2996
|
+
return result || '';
|
|
2997
|
+
});
|
|
2998
|
+
}
|
|
2999
|
+
var _temp4 = function () {
|
|
3000
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
3001
|
+
var _temp3 = function _temp3() {
|
|
3002
|
+
_exit = true;
|
|
3003
|
+
return '';
|
|
3004
|
+
};
|
|
3005
|
+
db.close();
|
|
3006
|
+
var _temp2 = function () {
|
|
3007
|
+
if (keyPathName) {
|
|
3008
|
+
return Promise.resolve(ensureStore(dbName, storeName, keyPathName)).then(function (upgraded) {
|
|
3009
|
+
upgraded.close();
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
}();
|
|
3013
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
3014
|
+
}
|
|
3015
|
+
}();
|
|
3016
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
2372
3017
|
});
|
|
2373
|
-
}
|
|
3018
|
+
}, function (error) {
|
|
3019
|
+
log.error('Error retrieving data: ', error);
|
|
3020
|
+
return '';
|
|
3021
|
+
}));
|
|
3022
|
+
} catch (e) {
|
|
3023
|
+
return Promise.reject(e);
|
|
2374
3024
|
}
|
|
2375
3025
|
};
|
|
2376
3026
|
var getAllStoreNames = function getAllStoreNames(dbName) {
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
openRequest.onupgradeneeded = function (event) {
|
|
2380
|
-
var db = event.target.result;
|
|
2381
|
-
resolve(Array.from(db.objectStoreNames));
|
|
2382
|
-
};
|
|
2383
|
-
openRequest.onerror = function () {
|
|
2384
|
-
log.error('Indexeddb Error ', openRequest.error);
|
|
2385
|
-
reject(openRequest.error);
|
|
2386
|
-
};
|
|
2387
|
-
openRequest.onsuccess = function (event) {
|
|
2388
|
-
var db = event.target.result;
|
|
3027
|
+
try {
|
|
3028
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
2389
3029
|
try {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
resolve(storeNames);
|
|
2393
|
-
} catch (error) {
|
|
3030
|
+
return Array.from(db.objectStoreNames);
|
|
3031
|
+
} finally {
|
|
2394
3032
|
db.close();
|
|
2395
|
-
reject(error);
|
|
2396
3033
|
}
|
|
2397
|
-
};
|
|
2398
|
-
})
|
|
3034
|
+
});
|
|
3035
|
+
} catch (e) {
|
|
3036
|
+
return Promise.reject(e);
|
|
3037
|
+
}
|
|
2399
3038
|
};
|
|
2400
3039
|
var deleteStore = function deleteStore(dbName, storeName) {
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
var db = event.target.result;
|
|
2405
|
-
if (db.objectStoreNames.contains(storeName)) {
|
|
2406
|
-
db.deleteObjectStore(storeName);
|
|
2407
|
-
currentVersion++;
|
|
2408
|
-
}
|
|
2409
|
-
};
|
|
2410
|
-
openRequest.onerror = function () {
|
|
2411
|
-
log.error('Indexeddb Error ', openRequest.error);
|
|
2412
|
-
reject(openRequest.error);
|
|
2413
|
-
};
|
|
2414
|
-
openRequest.onsuccess = function (event) {
|
|
2415
|
-
var db = event.target.result;
|
|
3040
|
+
try {
|
|
3041
|
+
return Promise.resolve(openDatabase(dbName)).then(function (db) {
|
|
3042
|
+
var shouldDelete = db.objectStoreNames.contains(storeName);
|
|
2416
3043
|
db.close();
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
3044
|
+
if (!shouldDelete) return;
|
|
3045
|
+
return Promise.resolve(runUpgrade(dbName, function (upgradeDb) {
|
|
3046
|
+
if (upgradeDb.objectStoreNames.contains(storeName)) {
|
|
3047
|
+
upgradeDb.deleteObjectStore(storeName);
|
|
3048
|
+
}
|
|
3049
|
+
})).then(function (upgraded) {
|
|
3050
|
+
upgraded.close();
|
|
3051
|
+
});
|
|
3052
|
+
});
|
|
3053
|
+
} catch (e) {
|
|
3054
|
+
return Promise.reject(e);
|
|
3055
|
+
}
|
|
2420
3056
|
};
|
|
2421
3057
|
|
|
2422
3058
|
var METADATA_DB_NAME = 'sceyt-metadata-db';
|
|
@@ -2439,7 +3075,7 @@ var storeMetadata = function storeMetadata(url, metadata) {
|
|
|
2439
3075
|
expiresAt: Date.now() + CACHE_DURATION
|
|
2440
3076
|
});
|
|
2441
3077
|
var _temp = _catch(function () {
|
|
2442
|
-
return Promise.resolve(
|
|
3078
|
+
return Promise.resolve(setDataToDB(METADATA_DB_NAME, currentMonth, [metadataRecord], 'url')).then(function () {});
|
|
2443
3079
|
}, function (error) {
|
|
2444
3080
|
console.error('Failed to store metadata in IndexedDB:', error);
|
|
2445
3081
|
});
|
|
@@ -2487,7 +3123,7 @@ var cleanupOldMonthsMetadata = function cleanupOldMonthsMetadata() {
|
|
|
2487
3123
|
var getMetadata = function getMetadata(url) {
|
|
2488
3124
|
return Promise.resolve(_catch(function () {
|
|
2489
3125
|
var currentMonth = getCurrentMonthKey();
|
|
2490
|
-
return Promise.resolve(
|
|
3126
|
+
return Promise.resolve(getDataFromDB(METADATA_DB_NAME, currentMonth, url, 'url')).then(function (result) {
|
|
2491
3127
|
if (!result || typeof result === 'string') {
|
|
2492
3128
|
return null;
|
|
2493
3129
|
}
|
|
@@ -9412,11 +10048,7 @@ function addMessageToMap(channelId, message) {
|
|
|
9412
10048
|
messagesMap[channelId] = [message];
|
|
9413
10049
|
}
|
|
9414
10050
|
if (message.deliveryStatus === MESSAGE_DELIVERY_STATUS.PENDING) {
|
|
9415
|
-
|
|
9416
|
-
pendingMessagesMap[channelId].push(message);
|
|
9417
|
-
} else {
|
|
9418
|
-
pendingMessagesMap[channelId] = [message];
|
|
9419
|
-
}
|
|
10051
|
+
setPendingMessage(channelId, message);
|
|
9420
10052
|
}
|
|
9421
10053
|
}
|
|
9422
10054
|
function updateMessageOnMap(channelId, updatedMessage) {
|
|
@@ -9439,18 +10071,29 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
9439
10071
|
}
|
|
9440
10072
|
}
|
|
9441
10073
|
}
|
|
10074
|
+
var updatedMessageData = null;
|
|
9442
10075
|
if (messagesMap[channelId]) {
|
|
9443
|
-
messagesMap[channelId]
|
|
10076
|
+
messagesMap[channelId].map(function (mes) {
|
|
9444
10077
|
if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
|
|
9445
10078
|
if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
|
|
9446
|
-
|
|
10079
|
+
updatedMessageData = _extends({}, updatedMessage.params);
|
|
10080
|
+
return updatedMessageData;
|
|
9447
10081
|
} else {
|
|
9448
|
-
|
|
10082
|
+
var _updatedMessage$param;
|
|
10083
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10084
|
+
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10085
|
+
return index === self.findIndex(function (t) {
|
|
10086
|
+
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10087
|
+
});
|
|
10088
|
+
})
|
|
10089
|
+
});
|
|
10090
|
+
return updatedMessage;
|
|
9449
10091
|
}
|
|
9450
10092
|
}
|
|
9451
10093
|
return mes;
|
|
9452
10094
|
});
|
|
9453
10095
|
}
|
|
10096
|
+
return updatedMessageData;
|
|
9454
10097
|
}
|
|
9455
10098
|
function addReactionToMessageOnMap(channelId, message, reaction, isSelf) {
|
|
9456
10099
|
if (messagesMap[channelId]) {
|
|
@@ -9563,6 +10206,24 @@ function removePendingMessageFromMap(channelId, messageId) {
|
|
|
9563
10206
|
});
|
|
9564
10207
|
}
|
|
9565
10208
|
}
|
|
10209
|
+
function updatePendingMessageOnMap(channelId, messageId, updatedMessage) {
|
|
10210
|
+
if (pendingMessagesMap[channelId]) {
|
|
10211
|
+
pendingMessagesMap[channelId] = pendingMessagesMap[channelId].map(function (msg) {
|
|
10212
|
+
if (msg.id === messageId || msg.tid === messageId) {
|
|
10213
|
+
return _extends({}, msg, updatedMessage);
|
|
10214
|
+
}
|
|
10215
|
+
return msg;
|
|
10216
|
+
});
|
|
10217
|
+
}
|
|
10218
|
+
}
|
|
10219
|
+
function getMessageFromPendingMessagesMap(channelId, messageId) {
|
|
10220
|
+
if (pendingMessagesMap[channelId]) {
|
|
10221
|
+
return pendingMessagesMap[channelId].find(function (msg) {
|
|
10222
|
+
return msg.id === messageId || msg.tid === messageId;
|
|
10223
|
+
});
|
|
10224
|
+
}
|
|
10225
|
+
return null;
|
|
10226
|
+
}
|
|
9566
10227
|
function clearMessagesMap() {
|
|
9567
10228
|
messagesMap = {};
|
|
9568
10229
|
}
|
|
@@ -9601,16 +10262,18 @@ var deletePendingMessage = function deletePendingMessage(channelId, message) {
|
|
|
9601
10262
|
var getPendingMessages = function getPendingMessages(channelId) {
|
|
9602
10263
|
return pendingMessagesMap[channelId];
|
|
9603
10264
|
};
|
|
9604
|
-
var
|
|
9605
|
-
|
|
9606
|
-
|
|
10265
|
+
var setPendingMessage = function setPendingMessage(channelId, pendingMessage) {
|
|
10266
|
+
var pendingMessages = getPendingMessages(channelId);
|
|
10267
|
+
if (pendingMessages && pendingMessages !== null && pendingMessages !== void 0 && pendingMessages.length) {
|
|
10268
|
+
if (!(pendingMessages !== null && pendingMessages !== void 0 && pendingMessages.find(function (msg) {
|
|
10269
|
+
return msg.tid === pendingMessage.tid;
|
|
10270
|
+
}))) {
|
|
10271
|
+
pendingMessages.push(pendingMessage);
|
|
10272
|
+
}
|
|
9607
10273
|
} else {
|
|
9608
10274
|
pendingMessagesMap[channelId] = [pendingMessage];
|
|
9609
10275
|
}
|
|
9610
10276
|
};
|
|
9611
|
-
var setPendingMessages = function setPendingMessages(channelId, pendingMessages) {
|
|
9612
|
-
pendingMessagesMap[channelId] = pendingMessages;
|
|
9613
|
-
};
|
|
9614
10277
|
var getPendingMessagesMap = function getPendingMessagesMap() {
|
|
9615
10278
|
return pendingMessagesMap;
|
|
9616
10279
|
};
|
|
@@ -9694,7 +10357,6 @@ var messageSlice = createSlice({
|
|
|
9694
10357
|
reducers: {
|
|
9695
10358
|
addMessage: function addMessage(state, action) {
|
|
9696
10359
|
var message = action.payload.message;
|
|
9697
|
-
log.info('addMessage ... ', message);
|
|
9698
10360
|
state.activeChannelMessages.push(message);
|
|
9699
10361
|
},
|
|
9700
10362
|
deleteMessageFromList: function deleteMessageFromList(state, action) {
|
|
@@ -9812,11 +10474,48 @@ var messageSlice = createSlice({
|
|
|
9812
10474
|
state.activeChannelMessages.push(params);
|
|
9813
10475
|
}
|
|
9814
10476
|
},
|
|
9815
|
-
|
|
10477
|
+
updateMessageAttachment: function updateMessageAttachment(state, action) {
|
|
9816
10478
|
var _action$payload4 = action.payload,
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
10479
|
+
url = _action$payload4.url,
|
|
10480
|
+
messageId = _action$payload4.messageId,
|
|
10481
|
+
params = _action$payload4.params;
|
|
10482
|
+
state.activeChannelMessages = state.activeChannelMessages.map(function (message) {
|
|
10483
|
+
if (message.id === messageId) {
|
|
10484
|
+
for (var index = 0; index < message.attachments.length; index++) {
|
|
10485
|
+
var attachment = message.attachments[index];
|
|
10486
|
+
if (attachment.url === url) {
|
|
10487
|
+
message.attachments[index] = _extends({}, attachment, params);
|
|
10488
|
+
}
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10491
|
+
if (message.attachments.length) {
|
|
10492
|
+
var detachedAttachments = message.attachments.map(function (att) {
|
|
10493
|
+
var _att$user, _att$user2;
|
|
10494
|
+
return _extends({}, att, {
|
|
10495
|
+
user: _extends({}, att.user, {
|
|
10496
|
+
metadata: _extends({}, ((_att$user = att.user) === null || _att$user === void 0 ? void 0 : _att$user.metadata) || {}),
|
|
10497
|
+
presence: _extends({}, ((_att$user2 = att.user) === null || _att$user2 === void 0 ? void 0 : _att$user2.presence) || {})
|
|
10498
|
+
})
|
|
10499
|
+
});
|
|
10500
|
+
});
|
|
10501
|
+
updateMessageOnAllMessages(messageId, {
|
|
10502
|
+
attachments: detachedAttachments
|
|
10503
|
+
});
|
|
10504
|
+
updateMessageOnMap(message.channelId, {
|
|
10505
|
+
messageId: messageId,
|
|
10506
|
+
params: {
|
|
10507
|
+
attachments: detachedAttachments
|
|
10508
|
+
}
|
|
10509
|
+
});
|
|
10510
|
+
}
|
|
10511
|
+
return message;
|
|
10512
|
+
});
|
|
10513
|
+
},
|
|
10514
|
+
addReactionToMessage: function addReactionToMessage(state, action) {
|
|
10515
|
+
var _action$payload5 = action.payload,
|
|
10516
|
+
message = _action$payload5.message,
|
|
10517
|
+
reaction = _action$payload5.reaction,
|
|
10518
|
+
isSelf = _action$payload5.isSelf;
|
|
9820
10519
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
9821
10520
|
if (msg.id === message.id) {
|
|
9822
10521
|
var slfReactions = [].concat(msg.userReactions);
|
|
@@ -9836,10 +10535,10 @@ var messageSlice = createSlice({
|
|
|
9836
10535
|
});
|
|
9837
10536
|
},
|
|
9838
10537
|
deleteReactionFromMessage: function deleteReactionFromMessage(state, action) {
|
|
9839
|
-
var _action$
|
|
9840
|
-
reaction = _action$
|
|
9841
|
-
message = _action$
|
|
9842
|
-
isSelf = _action$
|
|
10538
|
+
var _action$payload6 = action.payload,
|
|
10539
|
+
reaction = _action$payload6.reaction,
|
|
10540
|
+
message = _action$payload6.message,
|
|
10541
|
+
isSelf = _action$payload6.isSelf;
|
|
9843
10542
|
state.activeChannelMessages = state.activeChannelMessages.map(function (msg) {
|
|
9844
10543
|
if (msg.id === message.id) {
|
|
9845
10544
|
var userReactions = msg.userReactions;
|
|
@@ -9888,9 +10587,9 @@ var messageSlice = createSlice({
|
|
|
9888
10587
|
(_state$activeTabAttac = state.activeTabAttachments).push.apply(_state$activeTabAttac, action.payload.attachments);
|
|
9889
10588
|
},
|
|
9890
10589
|
addAttachmentsForPopup: function addAttachmentsForPopup(state, action) {
|
|
9891
|
-
var _action$
|
|
9892
|
-
attachments = _action$
|
|
9893
|
-
direction = _action$
|
|
10590
|
+
var _action$payload7 = action.payload,
|
|
10591
|
+
attachments = _action$payload7.attachments,
|
|
10592
|
+
direction = _action$payload7.direction;
|
|
9894
10593
|
if (direction === 'prev') {
|
|
9895
10594
|
var _state$attachmentsFor;
|
|
9896
10595
|
(_state$attachmentsFor = state.attachmentsForPopup).push.apply(_state$attachmentsFor, attachments);
|
|
@@ -9906,11 +10605,11 @@ var messageSlice = createSlice({
|
|
|
9906
10605
|
state.attachmentForPopupHasNext = action.payload.hasPrev;
|
|
9907
10606
|
},
|
|
9908
10607
|
updateUploadProgress: function updateUploadProgress(state, action) {
|
|
9909
|
-
var _action$
|
|
9910
|
-
uploaded = _action$
|
|
9911
|
-
total = _action$
|
|
9912
|
-
attachmentId = _action$
|
|
9913
|
-
progress = _action$
|
|
10608
|
+
var _action$payload8 = action.payload,
|
|
10609
|
+
uploaded = _action$payload8.uploaded,
|
|
10610
|
+
total = _action$payload8.total,
|
|
10611
|
+
attachmentId = _action$payload8.attachmentId,
|
|
10612
|
+
progress = _action$payload8.progress;
|
|
9914
10613
|
var updateData = {
|
|
9915
10614
|
uploaded: uploaded,
|
|
9916
10615
|
total: total,
|
|
@@ -9934,23 +10633,23 @@ var messageSlice = createSlice({
|
|
|
9934
10633
|
state.messageForReply = action.payload.message;
|
|
9935
10634
|
},
|
|
9936
10635
|
uploadAttachmentCompilation: function uploadAttachmentCompilation(state, action) {
|
|
9937
|
-
var _action$
|
|
9938
|
-
attachmentUploadingState = _action$
|
|
9939
|
-
attachmentId = _action$
|
|
10636
|
+
var _action$payload9 = action.payload,
|
|
10637
|
+
attachmentUploadingState = _action$payload9.attachmentUploadingState,
|
|
10638
|
+
attachmentId = _action$payload9.attachmentId;
|
|
9940
10639
|
state.attachmentsUploadingState[attachmentId] = attachmentUploadingState;
|
|
9941
10640
|
},
|
|
9942
10641
|
setReactionsList: function setReactionsList(state, action) {
|
|
9943
|
-
var _action$
|
|
9944
|
-
reactions = _action$
|
|
9945
|
-
hasNext = _action$
|
|
10642
|
+
var _action$payload0 = action.payload,
|
|
10643
|
+
reactions = _action$payload0.reactions,
|
|
10644
|
+
hasNext = _action$payload0.hasNext;
|
|
9946
10645
|
state.reactionsHasNext = hasNext;
|
|
9947
10646
|
state.reactionsList = [].concat(reactions);
|
|
9948
10647
|
},
|
|
9949
10648
|
addReactionsToList: function addReactionsToList(state, action) {
|
|
9950
10649
|
var _state$reactionsList;
|
|
9951
|
-
var _action$
|
|
9952
|
-
reactions = _action$
|
|
9953
|
-
hasNext = _action$
|
|
10650
|
+
var _action$payload1 = action.payload,
|
|
10651
|
+
reactions = _action$payload1.reactions,
|
|
10652
|
+
hasNext = _action$payload1.hasNext;
|
|
9954
10653
|
state.reactionsHasNext = hasNext;
|
|
9955
10654
|
(_state$reactionsList = state.reactionsList).push.apply(_state$reactionsList, reactions);
|
|
9956
10655
|
},
|
|
@@ -10011,6 +10710,7 @@ var _messageSlice$actions = messageSlice.actions,
|
|
|
10011
10710
|
addMessages = _messageSlice$actions.addMessages,
|
|
10012
10711
|
updateMessagesStatus = _messageSlice$actions.updateMessagesStatus,
|
|
10013
10712
|
updateMessage = _messageSlice$actions.updateMessage,
|
|
10713
|
+
updateMessageAttachment = _messageSlice$actions.updateMessageAttachment,
|
|
10014
10714
|
addReactionToMessage = _messageSlice$actions.addReactionToMessage,
|
|
10015
10715
|
deleteReactionFromMessage = _messageSlice$actions.deleteReactionFromMessage,
|
|
10016
10716
|
setHasPrevMessages = _messageSlice$actions.setHasPrevMessages,
|
|
@@ -10325,11 +11025,11 @@ var defaultTheme = {
|
|
|
10325
11025
|
light: '#D9D9DF',
|
|
10326
11026
|
dark: '#303032'
|
|
10327
11027
|
}, _colors[THEME_COLORS.OVERLAY_BACKGROUND] = {
|
|
10328
|
-
light: '
|
|
10329
|
-
dark: '
|
|
11028
|
+
light: '#111539',
|
|
11029
|
+
dark: '#111539'
|
|
10330
11030
|
}, _colors[THEME_COLORS.OVERLAY_BACKGROUND_2] = {
|
|
10331
|
-
light: '
|
|
10332
|
-
dark: '
|
|
11031
|
+
light: '#111539',
|
|
11032
|
+
dark: '#111539'
|
|
10333
11033
|
}, _colors[THEME_COLORS.WARNING] = {
|
|
10334
11034
|
light: '#FA4C56',
|
|
10335
11035
|
dark: '#FA4C56'
|
|
@@ -10414,14 +11114,6 @@ var ThemeReducer = (function (state, _ref) {
|
|
|
10414
11114
|
}
|
|
10415
11115
|
});
|
|
10416
11116
|
|
|
10417
|
-
var reducers = redux.combineReducers({
|
|
10418
|
-
ChannelReducer: ChannelReducer,
|
|
10419
|
-
MessageReducer: MessageReducer,
|
|
10420
|
-
MembersReducer: MembersReducer,
|
|
10421
|
-
ThemeReducer: ThemeReducer,
|
|
10422
|
-
UserReducer: UserReducer
|
|
10423
|
-
});
|
|
10424
|
-
|
|
10425
11117
|
var createChannelAC = function createChannelAC(channelData, dontCreateIfNotExists) {
|
|
10426
11118
|
return {
|
|
10427
11119
|
type: CREATE_CHANNEL,
|
|
@@ -10663,11 +11355,12 @@ var sendTypingAC = function sendTypingAC(state) {
|
|
|
10663
11355
|
}
|
|
10664
11356
|
};
|
|
10665
11357
|
};
|
|
10666
|
-
var sendRecordingAC = function sendRecordingAC(state) {
|
|
11358
|
+
var sendRecordingAC = function sendRecordingAC(state, channelId) {
|
|
10667
11359
|
return {
|
|
10668
11360
|
type: SEND_RECORDING,
|
|
10669
11361
|
payload: {
|
|
10670
|
-
state: state
|
|
11362
|
+
state: state,
|
|
11363
|
+
channelId: channelId
|
|
10671
11364
|
}
|
|
10672
11365
|
};
|
|
10673
11366
|
};
|
|
@@ -11109,6 +11802,13 @@ function setMessagesHasNextAC(hasNext) {
|
|
|
11109
11802
|
hasNext: hasNext
|
|
11110
11803
|
});
|
|
11111
11804
|
}
|
|
11805
|
+
function setUpdateMessageAttachmentAC(url, messageId, params) {
|
|
11806
|
+
return updateMessageAttachment({
|
|
11807
|
+
url: url,
|
|
11808
|
+
messageId: messageId,
|
|
11809
|
+
params: params
|
|
11810
|
+
});
|
|
11811
|
+
}
|
|
11112
11812
|
function updateMessageAC(messageId, params, addIfNotExists) {
|
|
11113
11813
|
return updateMessage({
|
|
11114
11814
|
messageId: messageId,
|
|
@@ -12293,7 +12993,7 @@ var UploadPercent = styled__default.span(_templateObject38 || (_templateObject38
|
|
|
12293
12993
|
}, function (props) {
|
|
12294
12994
|
return props.fileAttachment || props.isRepliedMessage || props.isDetailsView ? '40px' : '56px';
|
|
12295
12995
|
}, function (props) {
|
|
12296
|
-
return props.backgroundColor + "
|
|
12996
|
+
return props.backgroundColor + "66";
|
|
12297
12997
|
}, function (props) {
|
|
12298
12998
|
return props.borderRadius ? props.borderRadius : props.fileAttachment ? '8px' : props.isRepliedMessage ? '4px' : ' 50%';
|
|
12299
12999
|
}, function (props) {
|
|
@@ -12970,7 +13670,7 @@ function watchForEvents() {
|
|
|
12970
13670
|
};
|
|
12971
13671
|
});
|
|
12972
13672
|
_loop = /*#__PURE__*/_regenerator().m(function _callee() {
|
|
12973
|
-
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;
|
|
13673
|
+
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;
|
|
12974
13674
|
return _regenerator().w(function (_context) {
|
|
12975
13675
|
while (1) switch (_context.n) {
|
|
12976
13676
|
case 0:
|
|
@@ -13456,8 +14156,20 @@ function watchForEvents() {
|
|
|
13456
14156
|
_activeChannelId6 = _context.v;
|
|
13457
14157
|
updateLastMessage = false;
|
|
13458
14158
|
markersMap = {};
|
|
14159
|
+
activeChannelMessages = getMessagesFromMap(_activeChannelId6);
|
|
13459
14160
|
markerList.messageIds.forEach(function (messageId) {
|
|
13460
|
-
|
|
14161
|
+
if (activeChannelMessages !== null && activeChannelMessages !== void 0 && activeChannelMessages.find(function (message) {
|
|
14162
|
+
return message.id === messageId;
|
|
14163
|
+
})) {
|
|
14164
|
+
removePendingMessageFromMap(_activeChannelId6, messageId);
|
|
14165
|
+
} else {
|
|
14166
|
+
var isPendingMessage = getMessageFromPendingMessagesMap(_activeChannelId6, messageId);
|
|
14167
|
+
if (isPendingMessage) {
|
|
14168
|
+
updatePendingMessageOnMap(_activeChannelId6, messageId, {
|
|
14169
|
+
deliveryStatus: markerList.name
|
|
14170
|
+
});
|
|
14171
|
+
}
|
|
14172
|
+
}
|
|
13461
14173
|
markersMap[messageId] = true;
|
|
13462
14174
|
if (_channel6) {
|
|
13463
14175
|
if (_channel6.lastMessage && messageId === _channel6.lastMessage.id && _channel6.lastMessage.deliveryStatus !== MESSAGE_DELIVERY_STATUS.READ) {
|
|
@@ -15614,47 +16326,43 @@ function sendTyping(action) {
|
|
|
15614
16326
|
}, _marked22, null, [[3, 7]]);
|
|
15615
16327
|
}
|
|
15616
16328
|
function sendRecording(action) {
|
|
15617
|
-
var state,
|
|
16329
|
+
var _action$payload, state, channelId, channel, _t24;
|
|
15618
16330
|
return _regenerator().w(function (_context23) {
|
|
15619
16331
|
while (1) switch (_context23.p = _context23.n) {
|
|
15620
16332
|
case 0:
|
|
15621
|
-
|
|
16333
|
+
_action$payload = action.payload, state = _action$payload.state, channelId = _action$payload.channelId;
|
|
15622
16334
|
_context23.n = 1;
|
|
15623
|
-
return effects.call(
|
|
16335
|
+
return effects.call(getChannelFromMap, channelId);
|
|
15624
16336
|
case 1:
|
|
15625
|
-
activeChannelId = _context23.v;
|
|
15626
|
-
_context23.n = 2;
|
|
15627
|
-
return effects.call(getChannelFromMap, activeChannelId);
|
|
15628
|
-
case 2:
|
|
15629
16337
|
channel = _context23.v;
|
|
15630
|
-
_context23.p =
|
|
16338
|
+
_context23.p = 2;
|
|
15631
16339
|
if (!channel) {
|
|
15632
|
-
_context23.n =
|
|
16340
|
+
_context23.n = 5;
|
|
15633
16341
|
break;
|
|
15634
16342
|
}
|
|
15635
16343
|
if (!state) {
|
|
15636
|
-
_context23.n =
|
|
16344
|
+
_context23.n = 4;
|
|
15637
16345
|
break;
|
|
15638
16346
|
}
|
|
15639
|
-
_context23.n =
|
|
16347
|
+
_context23.n = 3;
|
|
15640
16348
|
return effects.call(channel.startRecording);
|
|
15641
|
-
case
|
|
15642
|
-
_context23.n =
|
|
16349
|
+
case 3:
|
|
16350
|
+
_context23.n = 5;
|
|
15643
16351
|
break;
|
|
15644
|
-
case
|
|
15645
|
-
_context23.n =
|
|
16352
|
+
case 4:
|
|
16353
|
+
_context23.n = 5;
|
|
15646
16354
|
return effects.call(channel.stopRecording);
|
|
15647
|
-
case
|
|
15648
|
-
_context23.n =
|
|
16355
|
+
case 5:
|
|
16356
|
+
_context23.n = 7;
|
|
15649
16357
|
break;
|
|
15650
|
-
case
|
|
15651
|
-
_context23.p =
|
|
16358
|
+
case 6:
|
|
16359
|
+
_context23.p = 6;
|
|
15652
16360
|
_t24 = _context23.v;
|
|
15653
16361
|
log.error('ERROR in send recording', _t24);
|
|
15654
|
-
case
|
|
16362
|
+
case 7:
|
|
15655
16363
|
return _context23.a(2);
|
|
15656
16364
|
}
|
|
15657
|
-
}, _marked23, null, [[
|
|
16365
|
+
}, _marked23, null, [[2, 6]]);
|
|
15658
16366
|
}
|
|
15659
16367
|
function clearHistory(action) {
|
|
15660
16368
|
var payload, channelId, channel, activeChannelId, groupName, _t25;
|
|
@@ -16527,13 +17235,7 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
|
|
|
16527
17235
|
})));
|
|
16528
17236
|
addMessageToMap(channel.id, messageToAdd);
|
|
16529
17237
|
addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
|
|
16530
|
-
|
|
16531
|
-
var hasNextMessages = store.getState().MessageReducer.messagesHasNext;
|
|
16532
|
-
var activeChannelMessages = store.getState().MessageReducer.activeChannelMessages;
|
|
16533
|
-
var isLatestMessageInChannelMessages = activeChannelMessages[activeChannelMessages.length - 1].id === channel.lastMessage.id;
|
|
16534
|
-
if (hasNextMessages || !isLatestMessageInChannelMessages) {
|
|
16535
|
-
store.dispatch(getMessagesAC(channel, true, channel.lastMessage.id, undefined, undefined, false));
|
|
16536
|
-
}
|
|
17238
|
+
setPendingMessage(channel.id, messageToAdd);
|
|
16537
17239
|
store.dispatch(scrollToNewMessageAC(true));
|
|
16538
17240
|
store.dispatch(addMessageAC(messageToAdd));
|
|
16539
17241
|
return Promise.resolve();
|
|
@@ -16635,7 +17337,7 @@ function sendMessage(action) {
|
|
|
16635
17337
|
} else {
|
|
16636
17338
|
var pendingAttachment = getPendingAttachment(attachment.tid);
|
|
16637
17339
|
if (!attachment.cachedUrl) {
|
|
16638
|
-
|
|
17340
|
+
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, updatedAttachment, {
|
|
16639
17341
|
checksum: pendingAttachment.checksum
|
|
16640
17342
|
})], 'checksum');
|
|
16641
17343
|
}
|
|
@@ -16793,7 +17495,7 @@ function sendMessage(action) {
|
|
|
16793
17495
|
});
|
|
16794
17496
|
pendingAttachment = getPendingAttachment(messageAttachment[k].tid);
|
|
16795
17497
|
if (!messageAttachment[k].cachedUrl) {
|
|
16796
|
-
|
|
17498
|
+
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, messageResponse.attachments[k], {
|
|
16797
17499
|
checksum: pendingAttachment.checksum || (pendingAttachment === null || pendingAttachment === void 0 ? void 0 : pendingAttachment.file)
|
|
16798
17500
|
})], 'checksum');
|
|
16799
17501
|
}
|
|
@@ -16872,9 +17574,13 @@ function sendMessage(action) {
|
|
|
16872
17574
|
case 14:
|
|
16873
17575
|
_context2.p = 14;
|
|
16874
17576
|
_t = _context2.v;
|
|
16875
|
-
log.error('Error on uploading attachment',
|
|
17577
|
+
log.error('Error on uploading attachment', messageToSend.tid, _t);
|
|
17578
|
+
if (!(messageToSend.attachments && messageToSend.attachments.length)) {
|
|
17579
|
+
_context2.n = 15;
|
|
17580
|
+
break;
|
|
17581
|
+
}
|
|
16876
17582
|
_context2.n = 15;
|
|
16877
|
-
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL,
|
|
17583
|
+
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, messageToSend.attachments[0].tid));
|
|
16878
17584
|
case 15:
|
|
16879
17585
|
updateMessageOnMap(channel.id, {
|
|
16880
17586
|
messageId: messageToSend.tid,
|
|
@@ -17189,7 +17895,7 @@ function forwardMessage(action) {
|
|
|
17189
17895
|
if (isCachedChannel) {
|
|
17190
17896
|
addMessageToMap(channelId, pendingMessage);
|
|
17191
17897
|
} else {
|
|
17192
|
-
|
|
17898
|
+
setPendingMessage(channelId, pendingMessage);
|
|
17193
17899
|
}
|
|
17194
17900
|
case 12:
|
|
17195
17901
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
@@ -17269,7 +17975,7 @@ function forwardMessage(action) {
|
|
|
17269
17975
|
}, _marked3$1, null, [[0, 19]]);
|
|
17270
17976
|
}
|
|
17271
17977
|
function resendMessage(action) {
|
|
17272
|
-
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;
|
|
17978
|
+
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;
|
|
17273
17979
|
return _regenerator().w(function (_context6) {
|
|
17274
17980
|
while (1) switch (_context6.p = _context6.n) {
|
|
17275
17981
|
case 0:
|
|
@@ -17537,7 +18243,12 @@ function resendMessage(action) {
|
|
|
17537
18243
|
bodyAttributes: _messageResponse.bodyAttributes,
|
|
17538
18244
|
createdAt: _messageResponse.createdAt
|
|
17539
18245
|
};
|
|
17540
|
-
|
|
18246
|
+
isInActiveChannel = (_getMessagesFromMap = getMessagesFromMap(channelId)) === null || _getMessagesFromMap === void 0 ? void 0 : _getMessagesFromMap.find(function (message) {
|
|
18247
|
+
return message.id === _messageCopy2.tid;
|
|
18248
|
+
});
|
|
18249
|
+
if (isInActiveChannel) {
|
|
18250
|
+
removePendingMessageFromMap(channel.id, _messageCopy2.tid);
|
|
18251
|
+
}
|
|
17541
18252
|
_context6.n = 27;
|
|
17542
18253
|
return effects.put(updateMessageAC(_messageCopy2.tid, _messageUpdateData));
|
|
17543
18254
|
case 27:
|
|
@@ -17650,7 +18361,7 @@ function deleteMessage(action) {
|
|
|
17650
18361
|
}, _marked5$1, null, [[0, 5]]);
|
|
17651
18362
|
}
|
|
17652
18363
|
function editMessage(action) {
|
|
17653
|
-
var payload, _message, channelId, channel, editedMessage, messageToUpdate, _t8;
|
|
18364
|
+
var payload, _message, channelId, channel, linkAttachments, anotherAttachments, linkAttachmentsToSend, editedMessage, messageToUpdate, _t8;
|
|
17654
18365
|
return _regenerator().w(function (_context8) {
|
|
17655
18366
|
while (1) switch (_context8.p = _context8.n) {
|
|
17656
18367
|
case 0:
|
|
@@ -17667,6 +18378,21 @@ function editMessage(action) {
|
|
|
17667
18378
|
setChannelInMap(channel);
|
|
17668
18379
|
}
|
|
17669
18380
|
}
|
|
18381
|
+
if (_message.attachments.length > 0) {
|
|
18382
|
+
linkAttachments = _message.attachments.filter(function (att) {
|
|
18383
|
+
return att.type === attachmentTypes.link;
|
|
18384
|
+
});
|
|
18385
|
+
anotherAttachments = _message.attachments.filter(function (att) {
|
|
18386
|
+
return att.type !== attachmentTypes.link;
|
|
18387
|
+
});
|
|
18388
|
+
linkAttachmentsToSend = [];
|
|
18389
|
+
linkAttachments.forEach(function (linkAttachment) {
|
|
18390
|
+
var linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
|
|
18391
|
+
var linkAttachmentToSend = linkAttachmentBuilder.setName(linkAttachment.name).setUpload(linkAttachment.upload).create();
|
|
18392
|
+
linkAttachmentsToSend.push(linkAttachmentToSend);
|
|
18393
|
+
});
|
|
18394
|
+
_message.attachments = [].concat(anotherAttachments, linkAttachmentsToSend);
|
|
18395
|
+
}
|
|
17670
18396
|
_context8.n = 2;
|
|
17671
18397
|
return effects.call(channel.editMessage, _extends({}, _message, {
|
|
17672
18398
|
metadata: isJSON(_message.metadata) ? _message.metadata : JSON.stringify(_message.metadata),
|
|
@@ -17707,15 +18433,17 @@ function editMessage(action) {
|
|
|
17707
18433
|
}, _marked6$1, null, [[0, 5]]);
|
|
17708
18434
|
}
|
|
17709
18435
|
function getMessagesQuery(action) {
|
|
17710
|
-
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,
|
|
18436
|
+
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;
|
|
17711
18437
|
return _regenerator().w(function (_context9) {
|
|
17712
18438
|
while (1) switch (_context9.p = _context9.n) {
|
|
17713
18439
|
case 0:
|
|
17714
|
-
|
|
17715
|
-
_context9.
|
|
18440
|
+
_context9.p = 0;
|
|
18441
|
+
_context9.n = 1;
|
|
18442
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
18443
|
+
case 1:
|
|
17716
18444
|
_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;
|
|
17717
18445
|
if (!(channel.id && !channel.isMockChannel)) {
|
|
17718
|
-
_context9.n =
|
|
18446
|
+
_context9.n = 47;
|
|
17719
18447
|
break;
|
|
17720
18448
|
}
|
|
17721
18449
|
SceytChatClient = getClient();
|
|
@@ -17727,42 +18455,39 @@ function getMessagesQuery(action) {
|
|
|
17727
18455
|
case 2:
|
|
17728
18456
|
messageQuery = _context9.v;
|
|
17729
18457
|
query.messageQuery = messageQuery;
|
|
17730
|
-
_context9.n = 3;
|
|
17731
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
17732
|
-
case 3:
|
|
17733
18458
|
cachedMessages = getMessagesFromMap(channel.id);
|
|
17734
18459
|
result = {
|
|
17735
18460
|
messages: [],
|
|
17736
18461
|
hasNext: false
|
|
17737
18462
|
};
|
|
17738
18463
|
if (!loadWithLastMessage) {
|
|
17739
|
-
_context9.n =
|
|
18464
|
+
_context9.n = 13;
|
|
17740
18465
|
break;
|
|
17741
18466
|
}
|
|
17742
18467
|
allMessages = getAllMessages();
|
|
17743
18468
|
havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
|
|
17744
18469
|
if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
|
|
17745
|
-
_context9.n =
|
|
18470
|
+
_context9.n = 8;
|
|
17746
18471
|
break;
|
|
17747
18472
|
}
|
|
17748
18473
|
setHasPrevCached(false);
|
|
17749
18474
|
setAllMessages([]);
|
|
17750
|
-
_context9.n =
|
|
18475
|
+
_context9.n = 3;
|
|
17751
18476
|
return effects.call(messageQuery.loadPreviousMessageId, '0');
|
|
17752
|
-
case
|
|
18477
|
+
case 3:
|
|
17753
18478
|
result = _context9.v;
|
|
17754
18479
|
if (!(result.messages.length === 50)) {
|
|
17755
|
-
_context9.n =
|
|
18480
|
+
_context9.n = 5;
|
|
17756
18481
|
break;
|
|
17757
18482
|
}
|
|
17758
18483
|
messageQuery.limit = 30;
|
|
17759
|
-
_context9.n =
|
|
18484
|
+
_context9.n = 4;
|
|
17760
18485
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17761
|
-
case
|
|
18486
|
+
case 4:
|
|
17762
18487
|
secondResult = _context9.v;
|
|
17763
18488
|
result.messages = [].concat(secondResult.messages, result.messages);
|
|
17764
18489
|
result.hasNext = secondResult.hasNext;
|
|
17765
|
-
case
|
|
18490
|
+
case 5:
|
|
17766
18491
|
sentMessages = [];
|
|
17767
18492
|
if (withDeliveredMessages) {
|
|
17768
18493
|
sentMessages = getFromAllMessagesByMessageId('', '', true);
|
|
@@ -17775,43 +18500,40 @@ function getMessagesQuery(action) {
|
|
|
17775
18500
|
return !messagesMap[msg.tid || ''];
|
|
17776
18501
|
});
|
|
17777
18502
|
result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
|
|
17778
|
-
_context9.n =
|
|
18503
|
+
_context9.n = 6;
|
|
17779
18504
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17780
|
-
case
|
|
18505
|
+
case 6:
|
|
17781
18506
|
setMessagesToMap(channel.id, result.messages);
|
|
17782
18507
|
setAllMessages(result.messages);
|
|
17783
|
-
_context9.n =
|
|
18508
|
+
_context9.n = 7;
|
|
17784
18509
|
return effects.put(setMessagesHasPrevAC(true));
|
|
18510
|
+
case 7:
|
|
18511
|
+
_context9.n = 10;
|
|
18512
|
+
break;
|
|
17785
18513
|
case 8:
|
|
18514
|
+
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
17786
18515
|
_context9.n = 9;
|
|
17787
|
-
return effects.put(
|
|
18516
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17788
18517
|
case 9:
|
|
17789
|
-
_context9.n =
|
|
17790
|
-
|
|
18518
|
+
_context9.n = 10;
|
|
18519
|
+
return effects.put(setMessagesHasPrevAC(true));
|
|
17791
18520
|
case 10:
|
|
17792
|
-
result.messages = getFromAllMessagesByMessageId('', '', true);
|
|
17793
18521
|
_context9.n = 11;
|
|
17794
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17795
|
-
case 11:
|
|
17796
|
-
_context9.n = 12;
|
|
17797
|
-
return effects.put(setMessagesHasPrevAC(true));
|
|
17798
|
-
case 12:
|
|
17799
|
-
_context9.n = 13;
|
|
17800
18522
|
return effects.put(setMessagesHasNextAC(false));
|
|
17801
|
-
case
|
|
18523
|
+
case 11:
|
|
17802
18524
|
setHasNextCached(false);
|
|
17803
18525
|
if (!messageId) {
|
|
17804
|
-
_context9.n =
|
|
18526
|
+
_context9.n = 12;
|
|
17805
18527
|
break;
|
|
17806
18528
|
}
|
|
17807
|
-
_context9.n =
|
|
18529
|
+
_context9.n = 12;
|
|
17808
18530
|
return effects.put(setScrollToMessagesAC(messageId, highlight));
|
|
17809
|
-
case
|
|
18531
|
+
case 12:
|
|
17810
18532
|
_context9.n = 45;
|
|
17811
18533
|
break;
|
|
17812
|
-
case
|
|
18534
|
+
case 13:
|
|
17813
18535
|
if (!messageId) {
|
|
17814
|
-
_context9.n =
|
|
18536
|
+
_context9.n = 25;
|
|
17815
18537
|
break;
|
|
17816
18538
|
}
|
|
17817
18539
|
_allMessages = getAllMessages();
|
|
@@ -17820,164 +18542,174 @@ function getMessagesQuery(action) {
|
|
|
17820
18542
|
});
|
|
17821
18543
|
maxLengthPart = MESSAGES_MAX_LENGTH / 2;
|
|
17822
18544
|
if (!(messageIndex >= maxLengthPart)) {
|
|
17823
|
-
_context9.n =
|
|
18545
|
+
_context9.n = 15;
|
|
17824
18546
|
break;
|
|
17825
18547
|
}
|
|
17826
18548
|
result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
|
|
17827
|
-
_context9.n =
|
|
18549
|
+
_context9.n = 14;
|
|
17828
18550
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17829
|
-
case
|
|
18551
|
+
case 14:
|
|
17830
18552
|
setHasPrevCached(messageIndex > maxLengthPart);
|
|
17831
18553
|
setHasNextCached(_allMessages.length > maxLengthPart);
|
|
17832
|
-
_context9.n =
|
|
18554
|
+
_context9.n = 22;
|
|
17833
18555
|
break;
|
|
17834
|
-
case
|
|
18556
|
+
case 15:
|
|
17835
18557
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
17836
18558
|
log.info('load by message id from server ...............', messageId);
|
|
17837
|
-
_context9.n =
|
|
18559
|
+
_context9.n = 16;
|
|
17838
18560
|
return effects.call(messageQuery.loadNearMessageId, messageId);
|
|
17839
|
-
case
|
|
18561
|
+
case 16:
|
|
17840
18562
|
result = _context9.v;
|
|
17841
18563
|
if (!(result.messages.length === 50)) {
|
|
17842
|
-
_context9.n =
|
|
18564
|
+
_context9.n = 19;
|
|
17843
18565
|
break;
|
|
17844
18566
|
}
|
|
17845
18567
|
messageQuery.limit = (MESSAGES_MAX_LENGTH - 50) / 2;
|
|
17846
|
-
_context9.n =
|
|
18568
|
+
_context9.n = 17;
|
|
17847
18569
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17848
|
-
case
|
|
18570
|
+
case 17:
|
|
17849
18571
|
_secondResult = _context9.v;
|
|
17850
18572
|
messageQuery.reverse = false;
|
|
17851
|
-
_context9.n =
|
|
18573
|
+
_context9.n = 18;
|
|
17852
18574
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
17853
|
-
case
|
|
18575
|
+
case 18:
|
|
17854
18576
|
thirdResult = _context9.v;
|
|
17855
18577
|
result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
|
|
17856
18578
|
result.hasNext = _secondResult.hasNext;
|
|
17857
18579
|
messageQuery.reverse = true;
|
|
17858
|
-
case
|
|
18580
|
+
case 19:
|
|
17859
18581
|
log.info('result from server ....... ', result);
|
|
17860
|
-
_context9.n =
|
|
18582
|
+
_context9.n = 20;
|
|
17861
18583
|
return effects.put(setMessagesHasNextAC(true));
|
|
17862
|
-
case
|
|
17863
|
-
_context9.n =
|
|
18584
|
+
case 20:
|
|
18585
|
+
_context9.n = 21;
|
|
17864
18586
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17865
|
-
case
|
|
18587
|
+
case 21:
|
|
17866
18588
|
setAllMessages([].concat(result.messages));
|
|
17867
18589
|
setHasPrevCached(false);
|
|
17868
18590
|
setHasNextCached(false);
|
|
17869
|
-
case
|
|
17870
|
-
_context9.n =
|
|
18591
|
+
case 22:
|
|
18592
|
+
_context9.n = 23;
|
|
17871
18593
|
return effects.put(setScrollToMessagesAC(messageId));
|
|
17872
|
-
case
|
|
18594
|
+
case 23:
|
|
18595
|
+
_context9.n = 24;
|
|
18596
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18597
|
+
case 24:
|
|
17873
18598
|
_context9.n = 45;
|
|
17874
18599
|
break;
|
|
17875
|
-
case
|
|
18600
|
+
case 25:
|
|
17876
18601
|
if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
|
|
17877
|
-
_context9.n =
|
|
18602
|
+
_context9.n = 38;
|
|
17878
18603
|
break;
|
|
17879
18604
|
}
|
|
17880
18605
|
setAllMessages([]);
|
|
17881
18606
|
messageQuery.limit = MESSAGES_MAX_LENGTH;
|
|
17882
18607
|
if (!Number(channel.lastDisplayedMessageId)) {
|
|
17883
|
-
_context9.n =
|
|
18608
|
+
_context9.n = 31;
|
|
17884
18609
|
break;
|
|
17885
18610
|
}
|
|
17886
|
-
_context9.n =
|
|
18611
|
+
_context9.n = 26;
|
|
17887
18612
|
return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
|
|
17888
|
-
case
|
|
18613
|
+
case 26:
|
|
17889
18614
|
result = _context9.v;
|
|
17890
18615
|
if (!(result.messages.length === 50)) {
|
|
17891
|
-
_context9.n =
|
|
18616
|
+
_context9.n = 30;
|
|
17892
18617
|
break;
|
|
17893
18618
|
}
|
|
17894
18619
|
messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
|
|
17895
|
-
_context9.n =
|
|
18620
|
+
_context9.n = 27;
|
|
17896
18621
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17897
|
-
case
|
|
18622
|
+
case 27:
|
|
17898
18623
|
_secondResult2 = _context9.v;
|
|
17899
18624
|
if (!(channel.newMessageCount > 25)) {
|
|
17900
|
-
_context9.n =
|
|
18625
|
+
_context9.n = 29;
|
|
17901
18626
|
break;
|
|
17902
18627
|
}
|
|
17903
18628
|
messageQuery.reverse = false;
|
|
17904
|
-
_context9.n =
|
|
18629
|
+
_context9.n = 28;
|
|
17905
18630
|
return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
|
|
17906
|
-
case
|
|
18631
|
+
case 28:
|
|
17907
18632
|
_thirdResult = _context9.v;
|
|
17908
18633
|
result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
|
|
17909
18634
|
messageQuery.reverse = true;
|
|
17910
|
-
_context9.n =
|
|
18635
|
+
_context9.n = 30;
|
|
17911
18636
|
break;
|
|
17912
|
-
case
|
|
18637
|
+
case 29:
|
|
17913
18638
|
result.messages = [].concat(_secondResult2.messages, result.messages);
|
|
17914
|
-
case
|
|
17915
|
-
_context9.n =
|
|
18639
|
+
case 30:
|
|
18640
|
+
_context9.n = 34;
|
|
17916
18641
|
break;
|
|
17917
|
-
case
|
|
17918
|
-
_context9.n =
|
|
18642
|
+
case 31:
|
|
18643
|
+
_context9.n = 32;
|
|
17919
18644
|
return effects.call(messageQuery.loadPrevious);
|
|
17920
|
-
case
|
|
18645
|
+
case 32:
|
|
17921
18646
|
result = _context9.v;
|
|
17922
18647
|
if (!(result.messages.length === 50)) {
|
|
17923
|
-
_context9.n =
|
|
18648
|
+
_context9.n = 34;
|
|
17924
18649
|
break;
|
|
17925
18650
|
}
|
|
17926
18651
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
17927
|
-
_context9.n =
|
|
18652
|
+
_context9.n = 33;
|
|
17928
18653
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17929
|
-
case
|
|
18654
|
+
case 33:
|
|
17930
18655
|
_secondResult3 = _context9.v;
|
|
17931
18656
|
result.messages = [].concat(_secondResult3.messages, result.messages);
|
|
17932
18657
|
result.hasNext = _secondResult3.hasNext;
|
|
17933
|
-
case
|
|
18658
|
+
case 34:
|
|
17934
18659
|
setMessagesToMap(channel.id, result.messages);
|
|
17935
|
-
_context9.n =
|
|
18660
|
+
_context9.n = 35;
|
|
17936
18661
|
return effects.put(setMessagesHasPrevAC(true));
|
|
17937
|
-
case
|
|
17938
|
-
_context9.n =
|
|
18662
|
+
case 35:
|
|
18663
|
+
_context9.n = 36;
|
|
17939
18664
|
return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
|
|
17940
|
-
case
|
|
18665
|
+
case 36:
|
|
17941
18666
|
setAllMessages([].concat(result.messages));
|
|
17942
|
-
_context9.n =
|
|
18667
|
+
_context9.n = 37;
|
|
17943
18668
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
|
|
17944
|
-
case
|
|
18669
|
+
case 37:
|
|
17945
18670
|
_context9.n = 45;
|
|
17946
18671
|
break;
|
|
17947
|
-
case
|
|
18672
|
+
case 38:
|
|
17948
18673
|
setAllMessages([]);
|
|
17949
18674
|
if (!(cachedMessages && cachedMessages.length)) {
|
|
17950
|
-
_context9.n =
|
|
18675
|
+
_context9.n = 39;
|
|
17951
18676
|
break;
|
|
17952
18677
|
}
|
|
17953
18678
|
setAllMessages([].concat(cachedMessages));
|
|
17954
|
-
_context9.n =
|
|
18679
|
+
_context9.n = 39;
|
|
17955
18680
|
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
|
|
17956
|
-
case
|
|
18681
|
+
case 39:
|
|
17957
18682
|
log.info('load message from server');
|
|
17958
|
-
_context9.n =
|
|
18683
|
+
_context9.n = 40;
|
|
17959
18684
|
return effects.call(messageQuery.loadPrevious);
|
|
17960
|
-
case
|
|
18685
|
+
case 40:
|
|
17961
18686
|
result = _context9.v;
|
|
17962
18687
|
if (!(result.messages.length === 50)) {
|
|
17963
|
-
_context9.n =
|
|
18688
|
+
_context9.n = 42;
|
|
17964
18689
|
break;
|
|
17965
18690
|
}
|
|
17966
18691
|
messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
|
|
17967
|
-
_context9.n =
|
|
18692
|
+
_context9.n = 41;
|
|
17968
18693
|
return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
|
|
17969
|
-
case
|
|
18694
|
+
case 41:
|
|
17970
18695
|
_secondResult4 = _context9.v;
|
|
17971
18696
|
result.messages = [].concat(_secondResult4.messages, result.messages);
|
|
17972
18697
|
result.hasNext = _secondResult4.hasNext;
|
|
17973
|
-
case
|
|
18698
|
+
case 42:
|
|
18699
|
+
updatedMessages = [];
|
|
17974
18700
|
result.messages.forEach(function (msg) {
|
|
17975
|
-
updateMessageOnMap(channel.id, {
|
|
18701
|
+
var updatedMessage = updateMessageOnMap(channel.id, {
|
|
17976
18702
|
messageId: msg.id,
|
|
17977
18703
|
params: msg
|
|
17978
18704
|
});
|
|
17979
|
-
updateMessageOnAllMessages(msg.id, msg);
|
|
18705
|
+
updateMessageOnAllMessages(msg.id, updatedMessage || msg);
|
|
18706
|
+
updatedMessages.push(updatedMessage || msg);
|
|
17980
18707
|
});
|
|
18708
|
+
setMessagesToMap(channel.id, updatedMessages);
|
|
18709
|
+
setAllMessages([].concat(updatedMessages));
|
|
18710
|
+
_context9.n = 43;
|
|
18711
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
|
|
18712
|
+
case 43:
|
|
17981
18713
|
_context9.n = 44;
|
|
17982
18714
|
return effects.put(setMessagesHasPrevAC(result.hasNext));
|
|
17983
18715
|
case 44:
|
|
@@ -17986,7 +18718,7 @@ function getMessagesQuery(action) {
|
|
|
17986
18718
|
case 45:
|
|
17987
18719
|
pendingMessages = getPendingMessages(channel.id);
|
|
17988
18720
|
if (!(pendingMessages && pendingMessages.length)) {
|
|
17989
|
-
_context9.n =
|
|
18721
|
+
_context9.n = 46;
|
|
17990
18722
|
break;
|
|
17991
18723
|
}
|
|
17992
18724
|
_messagesMap = {};
|
|
@@ -17999,34 +18731,32 @@ function getMessagesQuery(action) {
|
|
|
17999
18731
|
_context9.n = 46;
|
|
18000
18732
|
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
18001
18733
|
case 46:
|
|
18002
|
-
for (index = 0; index < filteredPendingMessages.length; index++) {
|
|
18003
|
-
mes = filteredPendingMessages[index];
|
|
18004
|
-
removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
|
|
18005
|
-
}
|
|
18006
|
-
case 47:
|
|
18007
18734
|
_context9.n = 48;
|
|
18008
|
-
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18009
|
-
case 48:
|
|
18010
|
-
_context9.n = 50;
|
|
18011
18735
|
break;
|
|
18012
|
-
case
|
|
18736
|
+
case 47:
|
|
18013
18737
|
if (!channel.isMockChannel) {
|
|
18014
|
-
_context9.n =
|
|
18738
|
+
_context9.n = 48;
|
|
18015
18739
|
break;
|
|
18016
18740
|
}
|
|
18017
|
-
_context9.n =
|
|
18741
|
+
_context9.n = 48;
|
|
18018
18742
|
return effects.put(setMessagesAC([]));
|
|
18019
|
-
case
|
|
18020
|
-
_context9.n =
|
|
18743
|
+
case 48:
|
|
18744
|
+
_context9.n = 50;
|
|
18021
18745
|
break;
|
|
18022
|
-
case
|
|
18023
|
-
_context9.p =
|
|
18746
|
+
case 49:
|
|
18747
|
+
_context9.p = 49;
|
|
18024
18748
|
_t9 = _context9.v;
|
|
18025
18749
|
log.error('error in message query', _t9);
|
|
18750
|
+
case 50:
|
|
18751
|
+
_context9.p = 50;
|
|
18752
|
+
_context9.n = 51;
|
|
18753
|
+
return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
18754
|
+
case 51:
|
|
18755
|
+
return _context9.f(50);
|
|
18026
18756
|
case 52:
|
|
18027
18757
|
return _context9.a(2);
|
|
18028
18758
|
}
|
|
18029
|
-
}, _marked7$1, null, [[
|
|
18759
|
+
}, _marked7$1, null, [[0, 49, 50, 52]]);
|
|
18030
18760
|
}
|
|
18031
18761
|
function loadMoreMessages(action) {
|
|
18032
18762
|
var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
|
|
@@ -19333,9 +20063,16 @@ function rootSaga() {
|
|
|
19333
20063
|
}, _marked$6);
|
|
19334
20064
|
}
|
|
19335
20065
|
|
|
20066
|
+
enableMapSet();
|
|
19336
20067
|
var sagaMiddleware = createSagaMiddleware__default();
|
|
19337
20068
|
var store = configureStore({
|
|
19338
|
-
reducer:
|
|
20069
|
+
reducer: {
|
|
20070
|
+
ChannelReducer: ChannelReducer,
|
|
20071
|
+
MessageReducer: MessageReducer,
|
|
20072
|
+
MembersReducer: MembersReducer,
|
|
20073
|
+
ThemeReducer: ThemeReducer,
|
|
20074
|
+
UserReducer: UserReducer
|
|
20075
|
+
},
|
|
19339
20076
|
middleware: function middleware(getDefaultMiddleware) {
|
|
19340
20077
|
return getDefaultMiddleware({
|
|
19341
20078
|
thunk: false,
|
|
@@ -20261,7 +20998,15 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
|
|
|
20261
20998
|
color: textPrimary
|
|
20262
20999
|
}, ":"), typingOrRecording.isTyping ? 'typing' : 'recording', "...")), !isTypingOrRecording && (draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageText, {
|
|
20263
21000
|
color: textSecondary
|
|
20264
|
-
}, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null),
|
|
21001
|
+
}, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), MessageTextFormat({
|
|
21002
|
+
text: draftMessageText,
|
|
21003
|
+
message: lastMessage,
|
|
21004
|
+
contactsMap: contactsMap,
|
|
21005
|
+
getFromContacts: getFromContacts,
|
|
21006
|
+
isLastMessage: true,
|
|
21007
|
+
accentColor: accentColor,
|
|
21008
|
+
textSecondary: textSecondary
|
|
21009
|
+
}))) : 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) {
|
|
20265
21010
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
20266
21011
|
})) + " " + (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) {
|
|
20267
21012
|
return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
|
|
@@ -20331,11 +21076,14 @@ var Channel = function Channel(_ref3) {
|
|
|
20331
21076
|
var _useState = React.useState(),
|
|
20332
21077
|
draftMessageText = _useState[0],
|
|
20333
21078
|
setDraftMessageText = _useState[1];
|
|
21079
|
+
var _useState2 = React.useState(),
|
|
21080
|
+
draftMessage = _useState2[0],
|
|
21081
|
+
setDraftMessage = _useState2[1];
|
|
20334
21082
|
var lastMessage = channel.lastReactedMessage || channel.lastMessage;
|
|
20335
21083
|
var lastMessageMetas = lastMessage && lastMessage.type === 'system' && lastMessage.metadata && (isJSON(lastMessage.metadata) ? JSON.parse(lastMessage.metadata) : lastMessage.metadata);
|
|
20336
|
-
var
|
|
20337
|
-
statusWidth =
|
|
20338
|
-
setStatusWidth =
|
|
21084
|
+
var _useState3 = React.useState(0),
|
|
21085
|
+
statusWidth = _useState3[0],
|
|
21086
|
+
setStatusWidth = _useState3[1];
|
|
20339
21087
|
var avatarName = channel.subject || (isDirectChannel && directChannelUser ? directChannelUser.firstName || directChannelUser.id : isSelfChannel ? 'Me' : '');
|
|
20340
21088
|
var handleChangeActiveChannel = function handleChangeActiveChannel(chan) {
|
|
20341
21089
|
if (activeChannel.id !== chan.id) {
|
|
@@ -20359,17 +21107,25 @@ var Channel = function Channel(_ref3) {
|
|
|
20359
21107
|
if (channelDraftMessage || draftAudioRecording) {
|
|
20360
21108
|
if (channelDraftMessage) {
|
|
20361
21109
|
setDraftMessageText(channelDraftMessage.text);
|
|
21110
|
+
setDraftMessage({
|
|
21111
|
+
mentionedUsers: channelDraftMessage.mentionedMembers,
|
|
21112
|
+
body: channelDraftMessage.text,
|
|
21113
|
+
bodyAttributes: channelDraftMessage.bodyAttributes
|
|
21114
|
+
});
|
|
20362
21115
|
} else if (draftAudioRecording) {
|
|
20363
21116
|
setDraftMessageText('Voice');
|
|
21117
|
+
setDraftMessage(undefined);
|
|
20364
21118
|
}
|
|
20365
21119
|
} else if (draftMessageText) {
|
|
20366
21120
|
setDraftMessageText(undefined);
|
|
21121
|
+
setDraftMessage(undefined);
|
|
20367
21122
|
}
|
|
20368
21123
|
}
|
|
20369
21124
|
}, [activeChannel.id]);
|
|
20370
21125
|
React.useEffect(function () {
|
|
20371
21126
|
if (channelDraftIsRemoved && channelDraftIsRemoved === channel.id) {
|
|
20372
21127
|
setDraftMessageText(undefined);
|
|
21128
|
+
setDraftMessage(undefined);
|
|
20373
21129
|
dispatch(setChannelDraftMessageIsRemovedAC());
|
|
20374
21130
|
}
|
|
20375
21131
|
}, [channelDraftIsRemoved]);
|
|
@@ -20397,15 +21153,15 @@ var Channel = function Channel(_ref3) {
|
|
|
20397
21153
|
items: filteredItems,
|
|
20398
21154
|
isTyping: !!filteredItems.find(function (item) {
|
|
20399
21155
|
return item.typingState;
|
|
21156
|
+
}),
|
|
21157
|
+
isRecording: !!filteredItems.find(function (item) {
|
|
21158
|
+
return item.recordingState;
|
|
20400
21159
|
})
|
|
20401
21160
|
};
|
|
20402
21161
|
}, [typingOrRecordingIndicator]);
|
|
20403
|
-
var isTypingOrRecording = React.useMemo(function () {
|
|
20404
|
-
return typingOrRecording.items.length > 0;
|
|
20405
|
-
}, [typingOrRecording]);
|
|
20406
21162
|
var MessageText = React.useMemo(function () {
|
|
20407
21163
|
return /*#__PURE__*/React__default.createElement(ChannelMessageText, {
|
|
20408
|
-
isTypingOrRecording:
|
|
21164
|
+
isTypingOrRecording: (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording),
|
|
20409
21165
|
user: user,
|
|
20410
21166
|
contactsMap: contactsMap,
|
|
20411
21167
|
getFromContacts: getFromContacts,
|
|
@@ -20416,10 +21172,10 @@ var Channel = function Channel(_ref3) {
|
|
|
20416
21172
|
textPrimary: textPrimary,
|
|
20417
21173
|
textSecondary: textSecondary,
|
|
20418
21174
|
draftMessageText: draftMessageText,
|
|
20419
|
-
lastMessage: lastMessage,
|
|
21175
|
+
lastMessage: draftMessage || lastMessage,
|
|
20420
21176
|
isDirectChannel: isDirectChannel
|
|
20421
21177
|
});
|
|
20422
|
-
}, [
|
|
21178
|
+
}, [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]);
|
|
20423
21179
|
return /*#__PURE__*/React__default.createElement(Container$2, {
|
|
20424
21180
|
theme: theme,
|
|
20425
21181
|
selectedChannel: channel.id === activeChannel.id,
|
|
@@ -20462,9 +21218,9 @@ var Channel = function Channel(_ref3) {
|
|
|
20462
21218
|
unreadMentions: !!(channel.newMentionCount && channel.newMentionCount > 0),
|
|
20463
21219
|
fontSize: channelLastMessageFontSize,
|
|
20464
21220
|
height: channelLastMessageHeight
|
|
20465
|
-
},
|
|
21221
|
+
}, typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping || typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording ? !isDirectChannel ? (/*#__PURE__*/React__default.createElement(LastMessageAuthor, {
|
|
20466
21222
|
typing: typingOrRecording.isTyping,
|
|
20467
|
-
recording:
|
|
21223
|
+
recording: typingOrRecording.isRecording,
|
|
20468
21224
|
color: textPrimary
|
|
20469
21225
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20470
21226
|
ref: messageAuthorRef
|
|
@@ -20482,11 +21238,11 @@ var Channel = function Channel(_ref3) {
|
|
|
20482
21238
|
color: textPrimary
|
|
20483
21239
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
20484
21240
|
ref: messageAuthorRef
|
|
20485
|
-
}, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !
|
|
21241
|
+
}, 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, {
|
|
20486
21242
|
color: draftMessageText && warningColor || textPrimary
|
|
20487
21243
|
}, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
|
|
20488
21244
|
color: textSecondary,
|
|
20489
|
-
withAttachments: !!(lastMessage && lastMessage.attachments && lastMessage.attachments.length && lastMessage.attachments[0].type !== attachmentTypes.link) && !
|
|
21245
|
+
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)),
|
|
20490
21246
|
noBody: lastMessage && !lastMessage.body,
|
|
20491
21247
|
deletedMessage: lastMessage && lastMessage.state === MESSAGE_STATUS.DELETE
|
|
20492
21248
|
}, MessageText)))), /*#__PURE__*/React__default.createElement(ChannelStatus, {
|
|
@@ -20505,7 +21261,7 @@ var Channel = function Channel(_ref3) {
|
|
|
20505
21261
|
}, lastMessage && lastMessage.createdAt && lastMessageDateFormat(lastMessage.createdAt))), /*#__PURE__*/React__default.createElement(UnreadInfo, {
|
|
20506
21262
|
bottom: !(lastMessage || typingOrRecording.items.length > 0 || draftMessageText) ? '5px' : ''
|
|
20507
21263
|
}, !!(channel.newMentionCount && channel.newMentionCount > 0) && (/*#__PURE__*/React__default.createElement(UnreadMentionIconWrapper, {
|
|
20508
|
-
iconColor:
|
|
21264
|
+
iconColor: accentColor,
|
|
20509
21265
|
rightMargin: !!(channel.newMessageCount || channel.unread)
|
|
20510
21266
|
}, /*#__PURE__*/React__default.createElement(SvgUnreadMention, null))), !!(channel.newMessageCount || channel.unread) && (/*#__PURE__*/React__default.createElement(UnreadCount, {
|
|
20511
21267
|
backgroundColor: accentColor,
|
|
@@ -21002,7 +21758,7 @@ var Container$4 = styled__default.div(_templateObject$8 || (_templateObject$8 =
|
|
|
21002
21758
|
}, function (props) {
|
|
21003
21759
|
return props.height ? props.height + "px" : '0px';
|
|
21004
21760
|
}, function (props) {
|
|
21005
|
-
return props.background + "
|
|
21761
|
+
return props.background + "66";
|
|
21006
21762
|
});
|
|
21007
21763
|
|
|
21008
21764
|
var _templateObject$9, _templateObject2$8, _templateObject3$5, _templateObject4$5, _templateObject5$3, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject0$2, _templateObject1$2;
|
|
@@ -22495,7 +23251,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
22495
23251
|
channelAvatarSize = _ref.channelAvatarSize,
|
|
22496
23252
|
channelAvatarTextSize = _ref.channelAvatarTextSize,
|
|
22497
23253
|
searchChannelInputFontSize = _ref.searchChannelInputFontSize,
|
|
22498
|
-
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize
|
|
23254
|
+
searchedChannelsTitleFontSize = _ref.searchedChannelsTitleFontSize,
|
|
23255
|
+
searchChannelsPadding = _ref.searchChannelsPadding;
|
|
22499
23256
|
var _useColor = useColors(),
|
|
22500
23257
|
background = _useColor[THEME_COLORS.BACKGROUND],
|
|
22501
23258
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -22732,7 +23489,8 @@ var ChannelList = function ChannelList(_ref) {
|
|
|
22732
23489
|
}, /*#__PURE__*/React__default.createElement(ChannelListHeader, {
|
|
22733
23490
|
withCustomList: !!List,
|
|
22734
23491
|
maxWidth: channelListRef.current && ((_channelListRef$curre2 = channelListRef.current) === null || _channelListRef$curre2 === void 0 ? void 0 : _channelListRef$curre2.clientWidth) || 0,
|
|
22735
|
-
borderColor: borderColor
|
|
23492
|
+
borderColor: borderColor,
|
|
23493
|
+
padding: searchChannelsPadding
|
|
22736
23494
|
}, Profile, showSearch && searchChannelsPosition === 'inline' ? (/*#__PURE__*/React__default.createElement(ChannelSearch, {
|
|
22737
23495
|
inline: true,
|
|
22738
23496
|
borderRadius: searchInputBorderRadius,
|
|
@@ -23055,8 +23813,10 @@ var NoData = styled__default.div(_templateObject8$4 || (_templateObject8$4 = _ta
|
|
|
23055
23813
|
return props.color;
|
|
23056
23814
|
});
|
|
23057
23815
|
var LoadingWrapper = styled__default.div(_templateObject9$4 || (_templateObject9$4 = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: calc(50% - 20px);\n top: calc(50% - 20px);\n"])));
|
|
23058
|
-
var ChannelListHeader = styled__default.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:
|
|
23816
|
+
var ChannelListHeader = styled__default.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) {
|
|
23059
23817
|
return props.maxWidth ? props.maxWidth + "px" : 'inherit';
|
|
23818
|
+
}, function (props) {
|
|
23819
|
+
return props.padding || '12px';
|
|
23060
23820
|
}, function (props) {
|
|
23061
23821
|
return props.withoutProfile && '52px';
|
|
23062
23822
|
}, function (props) {
|
|
@@ -23446,7 +24206,7 @@ var Container$a = styled__default.div(_templateObject$j || (_templateObject$j =
|
|
|
23446
24206
|
}, function (props) {
|
|
23447
24207
|
return props.dateDividerTextColor;
|
|
23448
24208
|
}, function (props) {
|
|
23449
|
-
return props.dateDividerBackgroundColor + "
|
|
24209
|
+
return props.dateDividerBackgroundColor + "66";
|
|
23450
24210
|
}, function (props) {
|
|
23451
24211
|
return props.dateDividerBorderRadius || '14px';
|
|
23452
24212
|
}, function (props) {
|
|
@@ -24082,7 +24842,7 @@ var VolumeSlide = styled__default.input(_templateObject9$6 || (_templateObject9$
|
|
|
24082
24842
|
var Progress = styled__default.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"])));
|
|
24083
24843
|
var FullScreenWrapper = styled__default.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"])));
|
|
24084
24844
|
|
|
24085
|
-
var _templateObject$l, _templateObject2$i, _templateObject3$e, _templateObject4$c, _templateObject5$a, _templateObject6$8, _templateObject7$7, _templateObject8$7, _templateObject9$7, _templateObject0$6;
|
|
24845
|
+
var _templateObject$l, _templateObject2$i, _templateObject3$e, _templateObject4$c, _templateObject5$a, _templateObject6$8, _templateObject7$7, _templateObject8$7, _templateObject9$7, _templateObject0$6, _templateObject1$4;
|
|
24086
24846
|
function ForwardMessagePopup(_ref) {
|
|
24087
24847
|
var title = _ref.title,
|
|
24088
24848
|
buttonText = _ref.buttonText,
|
|
@@ -24332,7 +25092,9 @@ function ForwardMessagePopup(_ref) {
|
|
|
24332
25092
|
backgroundColor: 'transparent',
|
|
24333
25093
|
checkedBackgroundColor: accentColor
|
|
24334
25094
|
}));
|
|
24335
|
-
})))
|
|
25095
|
+
}))), !searchedChannels.chats_groups.length && !searchedChannels.channels.length && (/*#__PURE__*/React__default.createElement(NoResults, {
|
|
25096
|
+
color: textSecondary
|
|
25097
|
+
}, "No channels found")))) : channels.map(function (channel) {
|
|
24336
25098
|
var _channel$metadata3;
|
|
24337
25099
|
var isDirectChannel = channel.type === DEFAULT_CHANNEL_TYPE.DIRECT;
|
|
24338
25100
|
var isSelfChannel = isDirectChannel && ((_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s);
|
|
@@ -24416,6 +25178,9 @@ var SelectedChannelName = styled__default.span(_templateObject9$7 || (_templateO
|
|
|
24416
25178
|
return props.color;
|
|
24417
25179
|
});
|
|
24418
25180
|
var StyledSubtractSvg$1 = styled__default(SvgCross)(_templateObject0$6 || (_templateObject0$6 = _taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin-left: 4px;\n transform: translate(2px, 0);\n"])));
|
|
25181
|
+
var NoResults = styled__default.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) {
|
|
25182
|
+
return props.color;
|
|
25183
|
+
});
|
|
24419
25184
|
|
|
24420
25185
|
var _templateObject$m, _templateObject2$j;
|
|
24421
25186
|
var CustomRadio = function CustomRadio(_ref) {
|
|
@@ -24589,7 +25354,7 @@ var DeleteOptionItem = styled__default.div(_templateObject2$k || (_templateObjec
|
|
|
24589
25354
|
return props.color;
|
|
24590
25355
|
});
|
|
24591
25356
|
|
|
24592
|
-
var _templateObject$o, _templateObject2$l, _templateObject3$f, _templateObject4$d, _templateObject5$b, _templateObject6$9, _templateObject7$8, _templateObject8$8, _templateObject9$8, _templateObject0$7, _templateObject1$
|
|
25357
|
+
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;
|
|
24593
25358
|
var SliderPopup = function SliderPopup(_ref) {
|
|
24594
25359
|
var channel = _ref.channel,
|
|
24595
25360
|
setIsSliderOpen = _ref.setIsSliderOpen,
|
|
@@ -24976,7 +25741,7 @@ var SliderPopup = function SliderPopup(_ref) {
|
|
|
24976
25741
|
text: '',
|
|
24977
25742
|
styles: {
|
|
24978
25743
|
background: {
|
|
24979
|
-
fill: overlayBackground2 + "
|
|
25744
|
+
fill: overlayBackground2 + "66"
|
|
24980
25745
|
},
|
|
24981
25746
|
path: {
|
|
24982
25747
|
stroke: textOnPrimary,
|
|
@@ -25130,7 +25895,7 @@ var FileSize = styled__default.span(_templateObject9$8 || (_templateObject9$8 =
|
|
|
25130
25895
|
var UserName = styled__default.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) {
|
|
25131
25896
|
return props.color;
|
|
25132
25897
|
});
|
|
25133
|
-
var ActionsWrapper = styled__default.div(_templateObject1$
|
|
25898
|
+
var ActionsWrapper = styled__default.div(_templateObject1$5 || (_templateObject1$5 = _taggedTemplateLiteralLoose(["\n display: flex;\n"])));
|
|
25134
25899
|
var IconWrapper = styled__default.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) {
|
|
25135
25900
|
return props.color;
|
|
25136
25901
|
}, function (props) {
|
|
@@ -25231,7 +25996,7 @@ var Container$c = styled__default.div(_templateObject$p || (_templateObject$p =
|
|
|
25231
25996
|
}, function (props) {
|
|
25232
25997
|
return props.textColor;
|
|
25233
25998
|
}, function (props) {
|
|
25234
|
-
return props.backgroundColor + "
|
|
25999
|
+
return props.backgroundColor + "66";
|
|
25235
26000
|
}, function (props) {
|
|
25236
26001
|
return props.border;
|
|
25237
26002
|
}, function (props) {
|
|
@@ -26198,7 +26963,9 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
|
|
|
26198
26963
|
setLoading(false);
|
|
26199
26964
|
var minutes = Math.floor(video.duration / 60);
|
|
26200
26965
|
var _seconds = Math.floor(video.duration % 60);
|
|
26201
|
-
|
|
26966
|
+
if (!videoCurrentTime) {
|
|
26967
|
+
setVideoCurrentTime(minutes + ":" + (_seconds < 10 ? "0" + _seconds : _seconds));
|
|
26968
|
+
}
|
|
26202
26969
|
if (setVideoIsReadyToSend) {
|
|
26203
26970
|
setVideoIsReadyToSend(file.tid);
|
|
26204
26971
|
}
|
|
@@ -26279,7 +27046,7 @@ var VideoTime = styled__default.div(_templateObject2$o || (_templateObject2$o =
|
|
|
26279
27046
|
}, function (props) {
|
|
26280
27047
|
return props.isRepliedMessage ? '0 3px' : '4px 6px';
|
|
26281
27048
|
}, function (props) {
|
|
26282
|
-
return props.messageTimeBackgroundColor + "
|
|
27049
|
+
return props.messageTimeBackgroundColor + "66";
|
|
26283
27050
|
}, function (props) {
|
|
26284
27051
|
return props.color;
|
|
26285
27052
|
}, function (props) {
|
|
@@ -28475,7 +29242,7 @@ var Timer$1 = styled__default.div(_templateObject6$c || (_templateObject6$c = _t
|
|
|
28475
29242
|
return props.color;
|
|
28476
29243
|
});
|
|
28477
29244
|
|
|
28478
|
-
var _templateObject$u, _templateObject2$q, _templateObject3$k, _templateObject4$h, _templateObject5$f, _templateObject6$d, _templateObject7$b, _templateObject8$a, _templateObject9$a, _templateObject0$9, _templateObject1$
|
|
29245
|
+
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;
|
|
28479
29246
|
var Attachment = function Attachment(_ref) {
|
|
28480
29247
|
var attachment = _ref.attachment,
|
|
28481
29248
|
_ref$isPreview = _ref.isPreview,
|
|
@@ -28588,7 +29355,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
28588
29355
|
if (downloadIsCancelled) {
|
|
28589
29356
|
setDownloadIsCancelled(false);
|
|
28590
29357
|
if (customDownloader) {
|
|
28591
|
-
customDownloader(attachment.url, false, function () {
|
|
29358
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29359
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29360
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29361
|
+
setSizeProgress({
|
|
29362
|
+
loaded: progress.loaded || 0,
|
|
29363
|
+
total: progress.total || 0
|
|
29364
|
+
});
|
|
29365
|
+
setProgress(uploadPercent);
|
|
29366
|
+
}, messageType).then(function (url) {
|
|
28592
29367
|
downloadImage(url);
|
|
28593
29368
|
});
|
|
28594
29369
|
} else {
|
|
@@ -28716,23 +29491,35 @@ var Attachment = function Attachment(_ref) {
|
|
|
28716
29491
|
}
|
|
28717
29492
|
}, [attachmentUrl]);
|
|
28718
29493
|
React.useEffect(function () {
|
|
28719
|
-
if (connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
29494
|
+
if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
|
|
28720
29495
|
getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
|
|
28721
29496
|
try {
|
|
28722
|
-
if (attachment.type ===
|
|
29497
|
+
if (attachment.type === attachmentTypes.image && !isPreview) {
|
|
28723
29498
|
if (cachedUrl) {
|
|
28724
29499
|
setAttachmentUrl(cachedUrl);
|
|
29500
|
+
dispatch(setUpdateMessageAttachmentAC(attachment.url, attachment.messageId, {
|
|
29501
|
+
attachmentUrl: cachedUrl
|
|
29502
|
+
}));
|
|
28725
29503
|
setIsCached(true);
|
|
28726
29504
|
} else {
|
|
28727
29505
|
setIsCached(false);
|
|
28728
29506
|
setDownloadingFile(true);
|
|
28729
29507
|
if (customDownloader) {
|
|
28730
|
-
customDownloader(attachment.url, false, function () {
|
|
29508
|
+
customDownloader(attachment.url, false, function (progress) {
|
|
29509
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29510
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29511
|
+
setSizeProgress({
|
|
29512
|
+
loaded: progress.loaded || 0,
|
|
29513
|
+
total: progress.total || 0
|
|
29514
|
+
});
|
|
29515
|
+
setProgress(uploadPercent);
|
|
29516
|
+
}, messageType).then(function (url) {
|
|
28731
29517
|
try {
|
|
28732
29518
|
downloadImage(url);
|
|
28733
29519
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
28734
29520
|
setAttachmentToCache(attachment.url, response);
|
|
28735
29521
|
setIsCached(true);
|
|
29522
|
+
setDownloadingFile(false);
|
|
28736
29523
|
});
|
|
28737
29524
|
} catch (e) {
|
|
28738
29525
|
return Promise.reject(e);
|
|
@@ -28771,7 +29558,15 @@ var Attachment = function Attachment(_ref) {
|
|
|
28771
29558
|
log.info('error on get attachment url from cache. .. ', e);
|
|
28772
29559
|
if (customDownloader) {
|
|
28773
29560
|
setDownloadingFile(true);
|
|
28774
|
-
customDownloader(attachment.url,
|
|
29561
|
+
customDownloader(attachment.url, true, function (progress) {
|
|
29562
|
+
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
29563
|
+
var uploadPercent = loadedRes && loadedRes * 100;
|
|
29564
|
+
setSizeProgress({
|
|
29565
|
+
loaded: progress.loaded || 0,
|
|
29566
|
+
total: progress.total || 0
|
|
29567
|
+
});
|
|
29568
|
+
setProgress(uploadPercent);
|
|
29569
|
+
}, messageType).then(function (url) {
|
|
28775
29570
|
try {
|
|
28776
29571
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
28777
29572
|
setAttachmentToCache(attachment.url, response);
|
|
@@ -28838,7 +29633,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28838
29633
|
}
|
|
28839
29634
|
}
|
|
28840
29635
|
}, [attachmentsUploadProgress]);
|
|
28841
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, attachment.type ===
|
|
29636
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, attachment.type === attachmentTypes.image ? (/*#__PURE__*/React__default.createElement(AttachmentImgCont, {
|
|
28842
29637
|
draggable: false,
|
|
28843
29638
|
onClick: function onClick() {
|
|
28844
29639
|
return handleMediaItemClick && !isInUploadingState && !downloadingFile && handleMediaItemClick(attachment);
|
|
@@ -28876,7 +29671,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28876
29671
|
imageMinWidth: imageMinWidth,
|
|
28877
29672
|
withPrefix: withPrefix,
|
|
28878
29673
|
borderColor: borderColor
|
|
28879
|
-
}, /*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
29674
|
+
}, !isPreview && (isInUploadingState || downloadingFile) && sizeProgress && sizeProgress.loaded < sizeProgress.total && (/*#__PURE__*/React__default.createElement(UploadPercent, {
|
|
28880
29675
|
isRepliedMessage: isRepliedMessage,
|
|
28881
29676
|
isDetailsView: isDetailsView,
|
|
28882
29677
|
backgroundColor: overlayBackground2
|
|
@@ -28893,7 +29688,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28893
29688
|
text: '',
|
|
28894
29689
|
styles: {
|
|
28895
29690
|
background: {
|
|
28896
|
-
fill: overlayBackground2 + "
|
|
29691
|
+
fill: overlayBackground2 + "66"
|
|
28897
29692
|
},
|
|
28898
29693
|
path: {
|
|
28899
29694
|
stroke: textOnPrimary,
|
|
@@ -28906,13 +29701,13 @@ var Attachment = function Attachment(_ref) {
|
|
|
28906
29701
|
}
|
|
28907
29702
|
})), sizeProgress && (/*#__PURE__*/React__default.createElement(SizeProgress, {
|
|
28908
29703
|
color: textOnPrimary
|
|
28909
|
-
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1)))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
29704
|
+
}, bytesToSize(sizeProgress.loaded, 1), " / ", bytesToSize(sizeProgress.total, 1))))))))) : null, isPreview && (/*#__PURE__*/React__default.createElement(RemoveChosenFile, {
|
|
28910
29705
|
backgroundColor: background,
|
|
28911
29706
|
color: iconInactive,
|
|
28912
29707
|
onClick: function onClick() {
|
|
28913
29708
|
return handleDeleteSelectedAttachment(attachment.tid);
|
|
28914
29709
|
}
|
|
28915
|
-
})))) : attachment.type ===
|
|
29710
|
+
})))) : attachment.type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isPreview ? (/*#__PURE__*/React__default.createElement(VideoCont, {
|
|
28916
29711
|
onClick: function onClick() {
|
|
28917
29712
|
return handleMediaItemClick && !downloadingFile && !isInUploadingState && (attachmentCompilationState[attachment.tid] ? attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.FAIL || attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING : true) && handleMediaItemClick(attachment);
|
|
28918
29713
|
},
|
|
@@ -28943,7 +29738,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
28943
29738
|
text: '',
|
|
28944
29739
|
styles: {
|
|
28945
29740
|
background: {
|
|
28946
|
-
fill: overlayBackground2 + "
|
|
29741
|
+
fill: overlayBackground2 + "66"
|
|
28947
29742
|
},
|
|
28948
29743
|
path: {
|
|
28949
29744
|
stroke: textOnPrimary,
|
|
@@ -29008,7 +29803,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29008
29803
|
React__default.createElement(AttachmentIconCont, {
|
|
29009
29804
|
backgroundColor: accentColor,
|
|
29010
29805
|
className: 'icon-warpper'
|
|
29011
|
-
}, previewFileType && previewFileType ===
|
|
29806
|
+
}, previewFileType && previewFileType === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(VideoPreview, {
|
|
29012
29807
|
file: attachment,
|
|
29013
29808
|
backgroundColor: backgroundColor && backgroundColor !== 'inherit' ? backgroundColor : overlayBackground2,
|
|
29014
29809
|
width: '40px',
|
|
@@ -29050,7 +29845,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
29050
29845
|
text: '',
|
|
29051
29846
|
styles: {
|
|
29052
29847
|
background: {
|
|
29053
|
-
fill: overlayBackground2 + "
|
|
29848
|
+
fill: overlayBackground2 + "66"
|
|
29054
29849
|
},
|
|
29055
29850
|
path: {
|
|
29056
29851
|
stroke: textOnPrimary,
|
|
@@ -29142,7 +29937,7 @@ var AttachmentSize = styled__default.span(_templateObject0$9 || (_templateObject
|
|
|
29142
29937
|
}, function (props) {
|
|
29143
29938
|
return props.errorColor;
|
|
29144
29939
|
});
|
|
29145
|
-
var AttachmentFileInfo = styled__default.div(_templateObject1$
|
|
29940
|
+
var AttachmentFileInfo = styled__default.div(_templateObject1$6 || (_templateObject1$6 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
|
|
29146
29941
|
return props.isPreview && "line-height: 14px;\n max-width: calc(100% - 44px);\n ";
|
|
29147
29942
|
});
|
|
29148
29943
|
var AttachmentImg$1 = styled__default.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) {
|
|
@@ -30222,7 +31017,7 @@ var MessageStatusAndTime = function MessageStatusAndTime(_ref) {
|
|
|
30222
31017
|
}))));
|
|
30223
31018
|
};
|
|
30224
31019
|
var MessageStatusAndTime$1 = /*#__PURE__*/React__default.memo(MessageStatusAndTime, function (prevProps, nextProps) {
|
|
30225
|
-
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;
|
|
31020
|
+
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;
|
|
30226
31021
|
});
|
|
30227
31022
|
var MessageStatus = styled__default.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) {
|
|
30228
31023
|
return props.height || '14px';
|
|
@@ -30241,7 +31036,7 @@ var MessageStatusAndTimeContainer = styled__default.span(_templateObject3$o || (
|
|
|
30241
31036
|
}, function (props) {
|
|
30242
31037
|
return props.withAttachment && '4px 6px';
|
|
30243
31038
|
}, function (props) {
|
|
30244
|
-
return props.withAttachment && !props.fileAttachment && props.messageTimeBackgroundColor + "
|
|
31039
|
+
return props.withAttachment && !props.fileAttachment && props.messageTimeBackgroundColor + "66";
|
|
30245
31040
|
}, function (props) {
|
|
30246
31041
|
return props.lineHeight || '14px';
|
|
30247
31042
|
}, function (props) {
|
|
@@ -30285,9 +31080,9 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30285
31080
|
setMetadata = _useState[1];
|
|
30286
31081
|
var attachment = React.useMemo(function () {
|
|
30287
31082
|
return attachments.find(function (attachment) {
|
|
30288
|
-
return attachment.type ===
|
|
31083
|
+
return attachment.type === attachmentTypes.link;
|
|
30289
31084
|
});
|
|
30290
|
-
}, [attachments
|
|
31085
|
+
}, [attachments]);
|
|
30291
31086
|
var ogMetadataQueryBuilder = React.useCallback(function (url) {
|
|
30292
31087
|
try {
|
|
30293
31088
|
var client = getClient();
|
|
@@ -30297,7 +31092,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30297
31092
|
var queryBuilder = new client.MessageLinkOGQueryBuilder(url);
|
|
30298
31093
|
return Promise.resolve(queryBuilder.build()).then(function (query) {
|
|
30299
31094
|
return Promise.resolve(query.loadOGData()).then(function (metadata) {
|
|
30300
|
-
return Promise.resolve(storeMetadata(url.replace('https://', ''), metadata)).then(function () {
|
|
31095
|
+
return Promise.resolve(storeMetadata(url.replace('https://', '').replace('http://', ''), metadata)).then(function () {
|
|
30301
31096
|
setMetadata(metadata);
|
|
30302
31097
|
});
|
|
30303
31098
|
});
|
|
@@ -30316,10 +31111,10 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30316
31111
|
}
|
|
30317
31112
|
}, []);
|
|
30318
31113
|
React.useEffect(function () {
|
|
30319
|
-
if (attachment !== null && attachment !== void 0 && attachment.id &&
|
|
31114
|
+
if (attachment !== null && attachment !== void 0 && attachment.id && attachment !== null && attachment !== void 0 && attachment.url) {
|
|
30320
31115
|
var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
|
|
30321
31116
|
if (url) {
|
|
30322
|
-
getMetadata(url.replace('https://', '')).then(function (cachedMetadata) {
|
|
31117
|
+
getMetadata(url.replace('https://', '').replace('http://', '')).then(function (cachedMetadata) {
|
|
30323
31118
|
try {
|
|
30324
31119
|
if (cachedMetadata) {
|
|
30325
31120
|
setMetadata(cachedMetadata);
|
|
@@ -30335,7 +31130,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30335
31130
|
});
|
|
30336
31131
|
}
|
|
30337
31132
|
}
|
|
30338
|
-
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url
|
|
31133
|
+
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
30339
31134
|
var ogUrl = React.useMemo(function () {
|
|
30340
31135
|
var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
|
|
30341
31136
|
var urlObj = validateUrl(url);
|
|
@@ -30346,25 +31141,33 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
30346
31141
|
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
30347
31142
|
var showOGMetadata = React.useMemo(function () {
|
|
30348
31143
|
var _metadata$og, _metadata$og2, _metadata$og2$image, _metadata$og2$image$, _metadata$og3;
|
|
30349
|
-
return state
|
|
31144
|
+
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;
|
|
30350
31145
|
}, [state, metadata]);
|
|
30351
|
-
return /*#__PURE__*/React__default.createElement(OGMetadataContainer,
|
|
31146
|
+
return /*#__PURE__*/React__default.createElement(OGMetadataContainer, {
|
|
31147
|
+
showOGMetadata: !!showOGMetadata
|
|
31148
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
30352
31149
|
onClick: function onClick() {
|
|
30353
31150
|
window.open(attachment === null || attachment === void 0 ? void 0 : attachment.url, '_blank');
|
|
30354
31151
|
}
|
|
30355
31152
|
}, /*#__PURE__*/React__default.createElement(ImageContainer, {
|
|
30356
|
-
showOGMetadata: showOGMetadata
|
|
31153
|
+
showOGMetadata: !!showOGMetadata
|
|
30357
31154
|
}, 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, {
|
|
30358
31155
|
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,
|
|
30359
31156
|
alt: 'OG metadata image'
|
|
30360
|
-
}) : null), showOGMetadata ?
|
|
31157
|
+
}) : 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, {
|
|
30361
31158
|
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
|
|
30362
|
-
}) : 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))));
|
|
31159
|
+
}) : 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));
|
|
30363
31160
|
};
|
|
30364
|
-
var OGMetadataContainer = styled__default.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:
|
|
30365
|
-
var ImageContainer = styled__default.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) {
|
|
31161
|
+
var OGMetadataContainer = styled__default.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) {
|
|
30366
31162
|
var showOGMetadata = _ref2.showOGMetadata;
|
|
30367
|
-
return
|
|
31163
|
+
return showOGMetadata ? '0.8rem' : '0';
|
|
31164
|
+
});
|
|
31165
|
+
var ImageContainer = styled__default.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) {
|
|
31166
|
+
var showOGMetadata = _ref3.showOGMetadata;
|
|
31167
|
+
return showOGMetadata ? '0.3rem' : '0';
|
|
31168
|
+
}, function (_ref4) {
|
|
31169
|
+
var showOGMetadata = _ref4.showOGMetadata;
|
|
31170
|
+
return showOGMetadata ? '200px' : '0';
|
|
30368
31171
|
});
|
|
30369
31172
|
var OGText = styled__default.div(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n width: 80%;\n padding: 0.5rem;\n margin: 0;\n"])));
|
|
30370
31173
|
var Url = styled__default.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"])));
|
|
@@ -30887,7 +31690,7 @@ var FrequentlyEmojisContainer = styled__default.div(_templateObject5$i || (_temp
|
|
|
30887
31690
|
return props.rtlDirection && '0';
|
|
30888
31691
|
});
|
|
30889
31692
|
|
|
30890
|
-
var _templateObject$C, _templateObject2$x, _templateObject3$r, _templateObject4$n, _templateObject5$j, _templateObject6$g, _templateObject7$e, _templateObject8$d, _templateObject9$b, _templateObject0$a, _templateObject1$
|
|
31693
|
+
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;
|
|
30891
31694
|
var Message$1 = function Message(_ref) {
|
|
30892
31695
|
var message = _ref.message,
|
|
30893
31696
|
channel = _ref.channel,
|
|
@@ -31216,7 +32019,6 @@ var Message$1 = function Message(_ref) {
|
|
|
31216
32019
|
if (isVisible && message.incoming && !(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
|
|
31217
32020
|
return marker.name === MESSAGE_DELIVERY_STATUS.READ;
|
|
31218
32021
|
})) && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
31219
|
-
log.info('send displayed marker for message ... ', message);
|
|
31220
32022
|
dispatch(markMessagesAsReadAC(channel.id, [message.id]));
|
|
31221
32023
|
}
|
|
31222
32024
|
};
|
|
@@ -31264,8 +32066,9 @@ var Message$1 = function Message(_ref) {
|
|
|
31264
32066
|
if (!channel.isLinkedChannel) {
|
|
31265
32067
|
setMessageToVisibleMessagesMap(message);
|
|
31266
32068
|
}
|
|
31267
|
-
if (scrollToNewMessage.scrollToBottom) {
|
|
32069
|
+
if (scrollToNewMessage.scrollToBottom && (message.id === channel.lastMessage.id || !message.id)) {
|
|
31268
32070
|
dispatch(scrollToNewMessageAC(false, false, false));
|
|
32071
|
+
dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
|
|
31269
32072
|
}
|
|
31270
32073
|
} else {
|
|
31271
32074
|
if (!channel.isLinkedChannel) {
|
|
@@ -31664,7 +32467,7 @@ var ReactionsContainer = styled__default.div(_templateObject9$b || (_templateObj
|
|
|
31664
32467
|
var MessageReactionsCont = styled__default.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) {
|
|
31665
32468
|
return props.rtlDirection && 'ltr';
|
|
31666
32469
|
});
|
|
31667
|
-
var MessageStatus$1 = styled__default.span(_templateObject1$
|
|
32470
|
+
var MessageStatus$1 = styled__default.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) {
|
|
31668
32471
|
return props.height || '14px';
|
|
31669
32472
|
});
|
|
31670
32473
|
var HiddenMessageTime$1 = styled__default.span(_templateObject10$4 || (_templateObject10$4 = _taggedTemplateLiteralLoose(["\n display: ", ";\n font-weight: 400;\n font-size: ", ";\n color: ", ";\n"])), function (props) {
|
|
@@ -31709,13 +32512,14 @@ var HiddenMessageProperty;
|
|
|
31709
32512
|
HiddenMessageProperty["hideAfterSendMessage"] = "hideAfterSendMessage";
|
|
31710
32513
|
})(HiddenMessageProperty || (HiddenMessageProperty = {}));
|
|
31711
32514
|
|
|
31712
|
-
var _templateObject$D, _templateObject2$y, _templateObject3$s, _templateObject4$o, _templateObject5$k, _templateObject6$h, _templateObject7$f, _templateObject8$e, _templateObject9$c, _templateObject0$b, _templateObject1$
|
|
32515
|
+
var _templateObject$D, _templateObject2$y, _templateObject3$s, _templateObject4$o, _templateObject5$k, _templateObject6$h, _templateObject7$f, _templateObject8$e, _templateObject9$c, _templateObject0$b, _templateObject1$8;
|
|
31713
32516
|
var loadFromServer = false;
|
|
31714
32517
|
var loadDirection = '';
|
|
31715
32518
|
var nextDisable = false;
|
|
31716
32519
|
var prevDisable = false;
|
|
31717
32520
|
var scrollToBottom = false;
|
|
31718
32521
|
var shouldLoadMessages;
|
|
32522
|
+
var loading = false;
|
|
31719
32523
|
var messagesIndexMap = {};
|
|
31720
32524
|
var CreateMessageDateDivider = function CreateMessageDateDivider(_ref) {
|
|
31721
32525
|
var lastIndex = _ref.lastIndex,
|
|
@@ -32025,7 +32829,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32025
32829
|
} else {
|
|
32026
32830
|
if (messagesIndexMap[lastVisibleMessageId] < 15 || forceLoadPrevMessages) {
|
|
32027
32831
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED && !scrollToNewMessage.scrollToBottom && hasPrevMessages) {
|
|
32028
|
-
if (messagesLoading === LOADING_STATE.LOADING || prevDisable) {
|
|
32832
|
+
if (loading || messagesLoading === LOADING_STATE.LOADING || prevDisable) {
|
|
32029
32833
|
shouldLoadMessages = 'prev';
|
|
32030
32834
|
} else {
|
|
32031
32835
|
if (shouldLoadMessages === 'prev') {
|
|
@@ -32042,7 +32846,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32042
32846
|
}
|
|
32043
32847
|
if (messagesIndexMap[lastVisibleMessageId] >= messages.length - 15 || target.scrollTop === 0) {
|
|
32044
32848
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED && !scrollToNewMessage.scrollToBottom && (hasNextMessages || getHasNextCached())) {
|
|
32045
|
-
if (messagesLoading === LOADING_STATE.LOADING || nextDisable) {
|
|
32849
|
+
if (loading || messagesLoading === LOADING_STATE.LOADING || nextDisable) {
|
|
32046
32850
|
shouldLoadMessages = 'next';
|
|
32047
32851
|
} else {
|
|
32048
32852
|
if (shouldLoadMessages === 'next') {
|
|
@@ -32062,7 +32866,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32062
32866
|
} catch (e) {
|
|
32063
32867
|
return Promise.reject(e);
|
|
32064
32868
|
}
|
|
32065
|
-
}, [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]);
|
|
32869
|
+
}, [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]);
|
|
32066
32870
|
var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
|
|
32067
32871
|
try {
|
|
32068
32872
|
prevDisable = true;
|
|
@@ -32102,8 +32906,10 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32102
32906
|
var hasNextCached = getHasNextCached();
|
|
32103
32907
|
if (messagesLoading === LOADING_STATE.LOADED && connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
32104
32908
|
if (direction === MESSAGE_LOAD_DIRECTION.PREV && firstMessageId && (hasPrevMessages || hasPrevCached)) {
|
|
32909
|
+
loading = true;
|
|
32105
32910
|
dispatch(loadMoreMessagesAC(channel.id, limit, direction, firstMessageId, hasPrevMessages));
|
|
32106
32911
|
} else if (direction === MESSAGE_LOAD_DIRECTION.NEXT && lastMessageId && (hasNextMessages || hasNextCached)) {
|
|
32912
|
+
loading = true;
|
|
32107
32913
|
dispatch(loadMoreMessagesAC(channel.id, limit, direction, lastMessageId, hasNextMessages));
|
|
32108
32914
|
}
|
|
32109
32915
|
}
|
|
@@ -32223,7 +33029,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32223
33029
|
}, [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]);
|
|
32224
33030
|
React.useEffect(function () {
|
|
32225
33031
|
if (scrollToRepliedMessage) {
|
|
32226
|
-
|
|
33032
|
+
loading = false;
|
|
32227
33033
|
scrollRef.current.style.scrollBehavior = 'inherit';
|
|
32228
33034
|
var repliedMessage = document.getElementById(scrollToRepliedMessage);
|
|
32229
33035
|
if (repliedMessage) {
|
|
@@ -32297,7 +33103,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32297
33103
|
clearVisibleMessagesMap();
|
|
32298
33104
|
}
|
|
32299
33105
|
if (channel) {
|
|
32300
|
-
dispatch(getMessagesAC(channel,
|
|
33106
|
+
dispatch(getMessagesAC(channel, undefined, undefined, undefined, true));
|
|
32301
33107
|
}
|
|
32302
33108
|
if (channel.id) {
|
|
32303
33109
|
if (channel.newMessageCount && channel.newMessageCount > 0) {
|
|
@@ -32339,7 +33145,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32339
33145
|
setShouldPreserveScroll(true);
|
|
32340
33146
|
}
|
|
32341
33147
|
}
|
|
32342
|
-
if (
|
|
33148
|
+
if (loading) {
|
|
32343
33149
|
if (loadDirection !== 'next') {
|
|
32344
33150
|
var lastVisibleMessage = document.getElementById(lastVisibleMessageId);
|
|
32345
33151
|
if (lastVisibleMessage) {
|
|
@@ -32349,7 +33155,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32349
33155
|
}
|
|
32350
33156
|
if (loadFromServer) {
|
|
32351
33157
|
setTimeout(function () {
|
|
32352
|
-
|
|
33158
|
+
loading = false;
|
|
32353
33159
|
loadFromServer = false;
|
|
32354
33160
|
nextDisable = false;
|
|
32355
33161
|
if (shouldLoadMessages === 'prev' && messagesIndexMap[lastVisibleMessageId] < 15) {
|
|
@@ -32360,7 +33166,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32360
33166
|
}
|
|
32361
33167
|
}, 50);
|
|
32362
33168
|
} else {
|
|
32363
|
-
|
|
33169
|
+
loading = false;
|
|
32364
33170
|
if (shouldLoadMessages === 'prev') {
|
|
32365
33171
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.PREV, LOAD_MAX_MESSAGE_COUNT);
|
|
32366
33172
|
shouldLoadMessages = '';
|
|
@@ -32377,7 +33183,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32377
33183
|
scrollRef.current.scrollTop = _lastVisibleMessage.offsetTop - scrollRef.current.offsetHeight + _lastVisibleMessage.offsetHeight;
|
|
32378
33184
|
scrollRef.current.style.scrollBehavior = 'smooth';
|
|
32379
33185
|
}
|
|
32380
|
-
|
|
33186
|
+
loading = false;
|
|
32381
33187
|
prevDisable = false;
|
|
32382
33188
|
if (shouldLoadMessages === 'prev') {
|
|
32383
33189
|
handleLoadMoreMessages(MESSAGE_LOAD_DIRECTION.PREV, LOAD_MAX_MESSAGE_COUNT);
|
|
@@ -32409,7 +33215,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
32409
33215
|
React.useEffect(function () {
|
|
32410
33216
|
log.info('connection status is changed.. .... ', connectionStatus, 'channel ... ', channel);
|
|
32411
33217
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
32412
|
-
|
|
33218
|
+
loading = false;
|
|
32413
33219
|
prevDisable = false;
|
|
32414
33220
|
nextDisable = false;
|
|
32415
33221
|
clearMessagesMap();
|
|
@@ -32716,7 +33522,7 @@ var MessageTopDate = styled__default.div(_templateObject4$o || (_templateObject4
|
|
|
32716
33522
|
}, function (props) {
|
|
32717
33523
|
return props.dateDividerTextColor;
|
|
32718
33524
|
}, function (props) {
|
|
32719
|
-
return props.dateDividerBackgroundColor + "
|
|
33525
|
+
return props.dateDividerBackgroundColor + "66";
|
|
32720
33526
|
}, function (props) {
|
|
32721
33527
|
return props.dateDividerBorder;
|
|
32722
33528
|
}, function (props) {
|
|
@@ -32756,7 +33562,7 @@ var NoMessagesContainer = styled__default.div(_templateObject9$c || (_templateOb
|
|
|
32756
33562
|
var NoMessagesTitle = styled__default.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) {
|
|
32757
33563
|
return props.color;
|
|
32758
33564
|
});
|
|
32759
|
-
var NoMessagesText = styled__default.p(_templateObject1$
|
|
33565
|
+
var NoMessagesText = styled__default.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) {
|
|
32760
33566
|
return props.color;
|
|
32761
33567
|
});
|
|
32762
33568
|
|
|
@@ -34760,19 +35566,19 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34760
35566
|
}, [currentRecordedFile]);
|
|
34761
35567
|
var dispatch = reactRedux.useDispatch();
|
|
34762
35568
|
var handleStartRecording = function handleStartRecording() {
|
|
34763
|
-
dispatch(sendRecordingAC(true));
|
|
35569
|
+
dispatch(sendRecordingAC(true, currentChannelId));
|
|
34764
35570
|
if (sendingInterval) {
|
|
34765
35571
|
clearInterval(sendingInterval);
|
|
34766
35572
|
setSendingInterval(null);
|
|
34767
35573
|
return;
|
|
34768
35574
|
}
|
|
34769
35575
|
var interval = setInterval(function () {
|
|
34770
|
-
dispatch(sendRecordingAC(true));
|
|
35576
|
+
dispatch(sendRecordingAC(true, currentChannelId));
|
|
34771
35577
|
}, 1000);
|
|
34772
35578
|
setSendingInterval(interval);
|
|
34773
35579
|
};
|
|
34774
35580
|
var handleStopRecording = function handleStopRecording() {
|
|
34775
|
-
dispatch(sendRecordingAC(false));
|
|
35581
|
+
dispatch(sendRecordingAC(false, currentChannelId));
|
|
34776
35582
|
if (sendingInterval) {
|
|
34777
35583
|
clearInterval(sendingInterval);
|
|
34778
35584
|
setSendingInterval(null);
|
|
@@ -34926,10 +35732,9 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
34926
35732
|
return Promise.resolve(_catch(function () {
|
|
34927
35733
|
var _wavesurfer$current3;
|
|
34928
35734
|
function _temp3(_result3) {
|
|
35735
|
+
var _wavesurfer$current$i, _wavesurfer$current$i2;
|
|
34929
35736
|
if (_exit) return _result3;
|
|
34930
|
-
|
|
34931
|
-
return;
|
|
34932
|
-
}
|
|
35737
|
+
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);
|
|
34933
35738
|
wavesurfer.current[id].on('ready', function () {
|
|
34934
35739
|
setRecordingIsReadyToPlay(true);
|
|
34935
35740
|
var audioDuration = wavesurfer.current[id].getDuration();
|
|
@@ -35041,7 +35846,6 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35041
35846
|
recorder.stop().getMp3().then(function (_ref4) {
|
|
35042
35847
|
var buffer = _ref4[0],
|
|
35043
35848
|
blob = _ref4[1];
|
|
35044
|
-
setCurrentTime(0);
|
|
35045
35849
|
var file = new File(buffer, 'record.mp3', {
|
|
35046
35850
|
type: blob.type,
|
|
35047
35851
|
lastModified: Date.now()
|
|
@@ -35107,15 +35911,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35107
35911
|
if ((_wavesurfer$current5 = wavesurfer.current) !== null && _wavesurfer$current5 !== void 0 && _wavesurfer$current5[cId || currentChannelId]) {
|
|
35108
35912
|
if (!wavesurfer.current[cId || currentChannelId].isPlaying()) {
|
|
35109
35913
|
setPlayAudio(true);
|
|
35110
|
-
handleStartRecording();
|
|
35111
35914
|
intervalRef.current[cId || currentChannelId] = setInterval(function () {
|
|
35112
35915
|
var currentTime = wavesurfer.current[cId || currentChannelId].getCurrentTime();
|
|
35113
35916
|
if (currentTime >= 0) {
|
|
35114
35917
|
setCurrentTime(currentTime);
|
|
35115
35918
|
}
|
|
35116
35919
|
}, 10);
|
|
35117
|
-
} else {
|
|
35118
|
-
handleStopRecording();
|
|
35119
35920
|
}
|
|
35120
35921
|
wavesurfer.current[cId || currentChannelId].playPause();
|
|
35121
35922
|
}
|
|
@@ -35226,11 +36027,12 @@ var AudioRecord = function AudioRecord(_ref) {
|
|
|
35226
36027
|
setShowRecording(false);
|
|
35227
36028
|
setStartRecording(false);
|
|
35228
36029
|
setPlayAudio(false);
|
|
35229
|
-
setCurrentTime(0);
|
|
35230
36030
|
var audioRecording = getAudioRecordingFromMap(channelId);
|
|
35231
36031
|
setRecordedFile(audioRecording || null);
|
|
35232
36032
|
setRecordingIsReadyToPlay(!!audioRecording);
|
|
35233
36033
|
}
|
|
36034
|
+
setCurrentTime(0);
|
|
36035
|
+
handleStopRecording();
|
|
35234
36036
|
setCurrentChannelId(channelId);
|
|
35235
36037
|
}, [channelId]);
|
|
35236
36038
|
return /*#__PURE__*/React__default.createElement(Container$j, {
|
|
@@ -35345,7 +36147,7 @@ var RecordingAnimation = function RecordingAnimation(_ref2) {
|
|
|
35345
36147
|
}));
|
|
35346
36148
|
};
|
|
35347
36149
|
|
|
35348
|
-
var _templateObject$J, _templateObject2$E, _templateObject3$x, _templateObject4$s, _templateObject5$o, _templateObject6$k, _templateObject7$i, _templateObject8$g, _templateObject9$d, _templateObject0$c, _templateObject1$
|
|
36150
|
+
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;
|
|
35349
36151
|
function AutoFocusPlugin(_ref) {
|
|
35350
36152
|
var messageForReply = _ref.messageForReply;
|
|
35351
36153
|
var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
|
|
@@ -35775,6 +36577,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35775
36577
|
var handleEditMessage = function handleEditMessage() {
|
|
35776
36578
|
var messageTexToSend = editMessageText.trim();
|
|
35777
36579
|
if (messageTexToSend) {
|
|
36580
|
+
var linkAttachment;
|
|
36581
|
+
if (messageTexToSend) {
|
|
36582
|
+
var linkify = new LinkifyIt();
|
|
36583
|
+
var match = linkify.match(messageTexToSend);
|
|
36584
|
+
if (match) {
|
|
36585
|
+
linkAttachment = {
|
|
36586
|
+
type: attachmentTypes.link,
|
|
36587
|
+
data: match[0].url,
|
|
36588
|
+
upload: false
|
|
36589
|
+
};
|
|
36590
|
+
}
|
|
36591
|
+
}
|
|
35778
36592
|
var mentionedMembersPositions = [];
|
|
35779
36593
|
var mentionMembersToSend = [];
|
|
35780
36594
|
if (mentionedMembers && mentionedMembers.length) {
|
|
@@ -35794,7 +36608,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35794
36608
|
});
|
|
35795
36609
|
}
|
|
35796
36610
|
}
|
|
35797
|
-
var messageToSend = _extends({}, messageToEdit, {
|
|
36611
|
+
var messageToSend = _extends({}, messageToEdit, linkAttachment ? {
|
|
36612
|
+
attachments: [linkAttachment]
|
|
36613
|
+
} : {}, {
|
|
35798
36614
|
metadata: mentionedMembersPositions,
|
|
35799
36615
|
bodyAttributes: messageBodyAttributes,
|
|
35800
36616
|
mentionedUsers: mentionMembersToSend,
|
|
@@ -36254,7 +37070,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36254
37070
|
}
|
|
36255
37071
|
var dataFromDb;
|
|
36256
37072
|
var _temp11 = _catch(function () {
|
|
36257
|
-
return Promise.resolve(
|
|
37073
|
+
return Promise.resolve(getDataFromDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, checksumHash, 'checksum')).then(function (_getDataFromDB) {
|
|
36258
37074
|
dataFromDb = _getDataFromDB;
|
|
36259
37075
|
});
|
|
36260
37076
|
}, function (e) {
|
|
@@ -36461,14 +37277,16 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36461
37277
|
text: messageText,
|
|
36462
37278
|
mentionedMembers: draftMessage.mentionedMembers,
|
|
36463
37279
|
messageForReply: messageForReply,
|
|
36464
|
-
editorState: realEditorState
|
|
37280
|
+
editorState: realEditorState,
|
|
37281
|
+
bodyAttributes: messageBodyAttributes
|
|
36465
37282
|
});
|
|
36466
37283
|
} else {
|
|
36467
37284
|
setDraftMessageToMap(activeChannel.id, {
|
|
36468
37285
|
text: messageText,
|
|
36469
37286
|
mentionedMembers: mentionedMembers,
|
|
36470
37287
|
messageForReply: messageForReply,
|
|
36471
|
-
editorState: realEditorState
|
|
37288
|
+
editorState: realEditorState,
|
|
37289
|
+
bodyAttributes: messageBodyAttributes
|
|
36472
37290
|
});
|
|
36473
37291
|
}
|
|
36474
37292
|
if (!listenerIsAdded) {
|
|
@@ -36489,16 +37307,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36489
37307
|
setDraftMessageToMap(activeChannel.id, {
|
|
36490
37308
|
text: messageText,
|
|
36491
37309
|
mentionedMembers: mentionedMembers,
|
|
36492
|
-
messageForReply: messageForReply
|
|
37310
|
+
messageForReply: messageForReply,
|
|
37311
|
+
bodyAttributes: messageBodyAttributes
|
|
36493
37312
|
});
|
|
36494
37313
|
}
|
|
36495
37314
|
}, [mentionedMembers]);
|
|
36496
37315
|
React.useEffect(function () {
|
|
36497
37316
|
if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
|
|
37317
|
+
var pendingMessagesMap = getPendingMessagesMap();
|
|
37318
|
+
var pendingMessagesMapCopy = JSON.parse(JSON.stringify(pendingMessagesMap));
|
|
36498
37319
|
setTimeout(function () {
|
|
36499
|
-
|
|
36500
|
-
|
|
36501
|
-
pendingMessagesMap[key].forEach(function (msg) {
|
|
37320
|
+
Object.keys(pendingMessagesMapCopy).forEach(function (key) {
|
|
37321
|
+
pendingMessagesMapCopy[key].forEach(function (msg) {
|
|
36502
37322
|
dispatch(resendMessageAC(msg, key, connectionStatus));
|
|
36503
37323
|
});
|
|
36504
37324
|
});
|
|
@@ -36543,7 +37363,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36543
37363
|
setDraftMessageToMap(activeChannel.id, {
|
|
36544
37364
|
text: messageText,
|
|
36545
37365
|
mentionedMembers: mentionedMembers,
|
|
36546
|
-
messageForReply: messageForReply
|
|
37366
|
+
messageForReply: messageForReply,
|
|
37367
|
+
bodyAttributes: messageBodyAttributes
|
|
36547
37368
|
});
|
|
36548
37369
|
}
|
|
36549
37370
|
if (messageForReply && messageToEdit) {
|
|
@@ -36594,16 +37415,21 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36594
37415
|
}
|
|
36595
37416
|
};
|
|
36596
37417
|
}, []);
|
|
36597
|
-
var
|
|
36598
|
-
|
|
37418
|
+
var typingOrRecording = React.useMemo(function () {
|
|
37419
|
+
var dataValues = typingOrRecordingIndicator ? Object.values(typingOrRecordingIndicator) : [];
|
|
37420
|
+
var filteredItems = dataValues.filter(function (item) {
|
|
36599
37421
|
return item.typingState || item.recordingState;
|
|
36600
|
-
}) : [];
|
|
36601
|
-
}, [typingOrRecordingIndicator]);
|
|
36602
|
-
var isTyping = React.useMemo(function () {
|
|
36603
|
-
return !!filteredTypingOrRecordingIndicator.find(function (item) {
|
|
36604
|
-
return item.typingState;
|
|
36605
37422
|
});
|
|
36606
|
-
|
|
37423
|
+
return {
|
|
37424
|
+
items: filteredItems,
|
|
37425
|
+
isTyping: !!filteredItems.find(function (item) {
|
|
37426
|
+
return item.typingState;
|
|
37427
|
+
}),
|
|
37428
|
+
isRecording: !!filteredItems.find(function (item) {
|
|
37429
|
+
return item.recordingState;
|
|
37430
|
+
})
|
|
37431
|
+
};
|
|
37432
|
+
}, [typingOrRecordingIndicator]);
|
|
36607
37433
|
var formatTypingIndicatorText = function formatTypingIndicatorText(users, maxShownUsers) {
|
|
36608
37434
|
if (maxShownUsers === void 0) {
|
|
36609
37435
|
maxShownUsers = 3;
|
|
@@ -36612,7 +37438,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36612
37438
|
if (users.length === 1) {
|
|
36613
37439
|
var _user = users[0];
|
|
36614
37440
|
var userName = makeUsername(getFromContacts && _user.from && contactsMap[_user.from.id], _user.from, getFromContacts);
|
|
36615
|
-
return "" + userName + (isTyping ? activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is typing' : '' : activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? ' is recording' : '');
|
|
37441
|
+
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' : '');
|
|
36616
37442
|
}
|
|
36617
37443
|
if (users.length <= maxShownUsers) {
|
|
36618
37444
|
var userNames = users.map(function (user) {
|
|
@@ -36682,8 +37508,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36682
37508
|
}, "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, {
|
|
36683
37509
|
color: textPrimary,
|
|
36684
37510
|
iconColor: accentColor
|
|
36685
|
-
}, /*#__PURE__*/React__default.createElement(SvgEye, null), " Read only")) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TypingIndicator$1, null,
|
|
36686
|
-
from:
|
|
37511
|
+
}, /*#__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, {
|
|
37512
|
+
from: typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.items.map(function (item) {
|
|
36687
37513
|
return {
|
|
36688
37514
|
id: item.from.id,
|
|
36689
37515
|
name: item.from.name,
|
|
@@ -36693,7 +37519,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
36693
37519
|
})
|
|
36694
37520
|
})) : (/*#__PURE__*/React__default.createElement(TypingIndicatorCont, null, /*#__PURE__*/React__default.createElement(TypingFrom, {
|
|
36695
37521
|
color: textSecondary
|
|
36696
|
-
}, formatTypingIndicatorText(
|
|
37522
|
+
}, formatTypingIndicatorText(typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.items, 3)), typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping ? (/*#__PURE__*/React__default.createElement(TypingAnimation, {
|
|
36697
37523
|
borderColor: iconInactive
|
|
36698
37524
|
}, /*#__PURE__*/React__default.createElement(DotOne, null), /*#__PURE__*/React__default.createElement(DotTwo, null), /*#__PURE__*/React__default.createElement(DotThree, null))) : (/*#__PURE__*/React__default.createElement(RecordingAnimation, {
|
|
36699
37525
|
borderColor: iconInactive
|
|
@@ -36964,7 +37790,7 @@ var AddAttachmentIcon = styled__default.span(_templateObject0$c || (_templateObj
|
|
|
36964
37790
|
}, function (props) {
|
|
36965
37791
|
return props.hoverColor;
|
|
36966
37792
|
});
|
|
36967
|
-
var SendMessageInputContainer = styled__default.div(_templateObject1$
|
|
37793
|
+
var SendMessageInputContainer = styled__default.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) {
|
|
36968
37794
|
return props.minHeight || '36px';
|
|
36969
37795
|
}, function (props) {
|
|
36970
37796
|
return props.messageForReply ? '0 0 4px 4px' : '4px';
|
|
@@ -37260,7 +38086,7 @@ function SvgUnpin(props) {
|
|
|
37260
38086
|
})));
|
|
37261
38087
|
}
|
|
37262
38088
|
|
|
37263
|
-
var _templateObject$K, _templateObject2$F, _templateObject3$y, _templateObject4$t, _templateObject5$p, _templateObject6$l, _templateObject7$j, _templateObject8$h, _templateObject9$e, _templateObject0$d, _templateObject1$
|
|
38089
|
+
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;
|
|
37264
38090
|
var Actions = function Actions(_ref) {
|
|
37265
38091
|
var _channel$metadata;
|
|
37266
38092
|
var setActionsHeight = _ref.setActionsHeight,
|
|
@@ -37739,7 +38565,7 @@ var DefaultStarIcon = styled__default(SvgStar)(_templateObject7$j || (_templateO
|
|
|
37739
38565
|
var DefaultUnpinIcon = styled__default(SvgUnpin)(_templateObject8$h || (_templateObject8$h = _taggedTemplateLiteralLoose([""])));
|
|
37740
38566
|
var DefaultPinIcon = styled__default(SvgPin)(_templateObject9$e || (_templateObject9$e = _taggedTemplateLiteralLoose([""])));
|
|
37741
38567
|
var DefaultMarkAsRead = styled__default(SvgMarkAsRead)(_templateObject0$d || (_templateObject0$d = _taggedTemplateLiteralLoose([""])));
|
|
37742
|
-
var DefaultMarkAsUnRead = styled__default(SvgMarkAsUnRead)(_templateObject1$
|
|
38568
|
+
var DefaultMarkAsUnRead = styled__default(SvgMarkAsUnRead)(_templateObject1$a || (_templateObject1$a = _taggedTemplateLiteralLoose([""])));
|
|
37743
38569
|
var DefaultBlockIcon = styled__default(SvgBlockChannel)(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose([""])));
|
|
37744
38570
|
var DefaultReportIcon = styled__default(SvgReport)(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose([""])));
|
|
37745
38571
|
var DefaultClearIcon = styled__default(SvgClear)(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose([""])));
|
|
@@ -38463,7 +39289,7 @@ var Files = function Files(_ref) {
|
|
|
38463
39289
|
text: '',
|
|
38464
39290
|
styles: {
|
|
38465
39291
|
background: {
|
|
38466
|
-
fill: overlayBackground2 + "
|
|
39292
|
+
fill: overlayBackground2 + "66"
|
|
38467
39293
|
},
|
|
38468
39294
|
path: {
|
|
38469
39295
|
stroke: accentColor,
|
|
@@ -39285,7 +40111,7 @@ var EditChannel = function EditChannel(_ref) {
|
|
|
39285
40111
|
})));
|
|
39286
40112
|
};
|
|
39287
40113
|
|
|
39288
|
-
var _templateObject$V, _templateObject2$O, _templateObject3$F, _templateObject4$z, _templateObject5$u, _templateObject6$p, _templateObject7$n, _templateObject8$l, _templateObject9$g, _templateObject0$e, _templateObject1$
|
|
40114
|
+
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;
|
|
39289
40115
|
var Details = function Details(_ref) {
|
|
39290
40116
|
var _activeChannel$metada;
|
|
39291
40117
|
var detailsTitleText = _ref.detailsTitleText,
|
|
@@ -39401,7 +40227,8 @@ var Details = function Details(_ref) {
|
|
|
39401
40227
|
tabItemsLineHeight = _ref.tabItemsLineHeight,
|
|
39402
40228
|
tabItemsMinWidth = _ref.tabItemsMinWidth,
|
|
39403
40229
|
backgroundColor = _ref.backgroundColor,
|
|
39404
|
-
bordersColor = _ref.bordersColor
|
|
40230
|
+
bordersColor = _ref.bordersColor,
|
|
40231
|
+
showPhoneNumber = _ref.showPhoneNumber;
|
|
39405
40232
|
var _useColor = useColors(),
|
|
39406
40233
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
39407
40234
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -39555,7 +40382,7 @@ var Details = function Details(_ref) {
|
|
|
39555
40382
|
color: textSecondary,
|
|
39556
40383
|
fontSize: channelMembersFontSize,
|
|
39557
40384
|
lineHeight: channelMembersLineHeight
|
|
39558
|
-
}, 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, {
|
|
40385
|
+
}, 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, {
|
|
39559
40386
|
color: textSecondary,
|
|
39560
40387
|
fontSize: channelMembersFontSize,
|
|
39561
40388
|
lineHeight: channelMembersLineHeight
|
|
@@ -39717,7 +40544,7 @@ var ChannelName$1 = styled__default(SectionHeader)(_templateObject0$e || (_templ
|
|
|
39717
40544
|
}, function (props) {
|
|
39718
40545
|
return props.uppercase && 'uppercase';
|
|
39719
40546
|
});
|
|
39720
|
-
var ChannelNameWrapper = styled__default.div(_templateObject1$
|
|
40547
|
+
var ChannelNameWrapper = styled__default.div(_templateObject1$b || (_templateObject1$b = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: center;\n"])));
|
|
39721
40548
|
var EditButton = styled__default.span(_templateObject10$7 || (_templateObject10$7 = _taggedTemplateLiteralLoose(["\n margin-left: 6px;\n cursor: pointer;\n color: #b2b6be;\n"])));
|
|
39722
40549
|
|
|
39723
40550
|
var _templateObject$W;
|
|
@@ -39831,7 +40658,8 @@ var ChannelDetailsContainer = function ChannelDetailsContainer(_ref) {
|
|
|
39831
40658
|
tabItemsFontSize = _ref.tabItemsFontSize,
|
|
39832
40659
|
tabItemsLineHeight = _ref.tabItemsLineHeight,
|
|
39833
40660
|
tabItemsMinWidth = _ref.tabItemsMinWidth,
|
|
39834
|
-
bordersColor = _ref.bordersColor
|
|
40661
|
+
bordersColor = _ref.bordersColor,
|
|
40662
|
+
showPhoneNumber = _ref.showPhoneNumber;
|
|
39835
40663
|
var channelDetailsIsOpen = reactRedux.useSelector(channelInfoIsOpenSelector, reactRedux.shallowEqual);
|
|
39836
40664
|
React.useEffect(function () {
|
|
39837
40665
|
setShowChannelDetails(true);
|
|
@@ -39944,7 +40772,8 @@ var ChannelDetailsContainer = function ChannelDetailsContainer(_ref) {
|
|
|
39944
40772
|
addMemberIcon: addMemberIcon,
|
|
39945
40773
|
tabItemsFontSize: tabItemsFontSize,
|
|
39946
40774
|
tabItemsLineHeight: tabItemsLineHeight,
|
|
39947
|
-
tabItemsMinWidth: tabItemsMinWidth
|
|
40775
|
+
tabItemsMinWidth: tabItemsMinWidth,
|
|
40776
|
+
showPhoneNumber: showPhoneNumber
|
|
39948
40777
|
})));
|
|
39949
40778
|
};
|
|
39950
40779
|
var DetailsWrapper = styled__default.div(_templateObject$W || (_templateObject$W = _taggedTemplateLiteralLoose([""])));
|
|
@@ -39999,26 +40828,31 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
|
|
|
39999
40828
|
var showScrollToNewMessageButton = reactRedux.useSelector(showScrollToNewMessageButtonSelector);
|
|
40000
40829
|
var messages = reactRedux.useSelector(activeChannelMessagesSelector) || [];
|
|
40001
40830
|
var handleScrollToBottom = function handleScrollToBottom() {
|
|
40002
|
-
|
|
40003
|
-
|
|
40831
|
+
var user = getClient().user;
|
|
40832
|
+
if (channel.lastMessage.user.id !== user.id) {
|
|
40833
|
+
dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
|
|
40834
|
+
}
|
|
40835
|
+
handleScrollToLastMessage(channel.lastMessage.id);
|
|
40004
40836
|
};
|
|
40005
|
-
var
|
|
40837
|
+
var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
|
|
40006
40838
|
try {
|
|
40839
|
+
dispatch(scrollToNewMessageAC(true, false, false));
|
|
40007
40840
|
if (messages.findIndex(function (msg) {
|
|
40008
40841
|
return msg.id === messageId;
|
|
40009
40842
|
}) >= 10) {
|
|
40843
|
+
dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
|
|
40010
40844
|
var repliedMessage = document.getElementById(messageId);
|
|
40011
40845
|
if (repliedMessage) {
|
|
40012
40846
|
var scrollRef = document.getElementById('scrollableDiv');
|
|
40013
40847
|
if (scrollRef) {
|
|
40014
40848
|
scrollRef.scrollTo({
|
|
40015
|
-
top:
|
|
40849
|
+
top: 1000,
|
|
40016
40850
|
behavior: 'smooth'
|
|
40017
40851
|
});
|
|
40018
40852
|
}
|
|
40019
40853
|
}
|
|
40020
40854
|
} else {
|
|
40021
|
-
dispatch(getMessagesAC(channel, true, messageId));
|
|
40855
|
+
dispatch(getMessagesAC(channel, true, messageId, undefined, undefined, false));
|
|
40022
40856
|
}
|
|
40023
40857
|
return Promise.resolve();
|
|
40024
40858
|
} catch (e) {
|