sceyt-chat-react-uikit 1.6.9-beta.13 → 1.6.9-beta.15

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.
Files changed (3) hide show
  1. package/index.js +280 -19
  2. package/index.modern.js +280 -19
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -603,6 +603,10 @@ function getPlugin(pluginKey) {
603
603
  }
604
604
  return plugin;
605
605
  }
606
+ function loadPlugin(pluginKey, implementation) {
607
+ if (!plugins[pluginKey])
608
+ plugins[pluginKey] = implementation;
609
+ }
606
610
 
607
611
  // src/core/scope.ts
608
612
  var currentScope;
@@ -1119,6 +1123,256 @@ function currentImpl(value) {
1119
1123
  return copy;
1120
1124
  }
1121
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
+
1122
1376
  // src/immer.ts
1123
1377
  var immer = new Immer2();
1124
1378
  var produce = immer.produce;
@@ -18063,23 +18317,23 @@ function getMessagesQuery(action) {
18063
18317
  case 0:
18064
18318
  log.info('getMessagesQuery ... ');
18065
18319
  _context9.p = 1;
18320
+ _context9.n = 2;
18321
+ return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
18322
+ case 2:
18066
18323
  _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;
18067
18324
  if (!(channel.id && !channel.isMockChannel)) {
18068
- _context9.n = 50;
18325
+ _context9.n = 49;
18069
18326
  break;
18070
18327
  }
18071
18328
  SceytChatClient = getClient();
18072
18329
  messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channel.id);
18073
18330
  messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
18074
18331
  messageQueryBuilder.reverse(true);
18075
- _context9.n = 2;
18332
+ _context9.n = 3;
18076
18333
  return effects.call(messageQueryBuilder.build);
18077
- case 2:
18334
+ case 3:
18078
18335
  messageQuery = _context9.v;
18079
18336
  query.messageQuery = messageQuery;
18080
- _context9.n = 3;
18081
- return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
18082
- case 3:
18083
18337
  cachedMessages = getMessagesFromMap(channel.id);
18084
18338
  result = {
18085
18339
  messages: [],
@@ -18357,29 +18611,32 @@ function getMessagesQuery(action) {
18357
18611
  removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
18358
18612
  }
18359
18613
  case 48:
18360
- _context9.n = 49;
18361
- return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
18362
- case 49:
18363
- _context9.n = 51;
18614
+ _context9.n = 50;
18364
18615
  break;
18365
- case 50:
18616
+ case 49:
18366
18617
  if (!channel.isMockChannel) {
18367
- _context9.n = 51;
18618
+ _context9.n = 50;
18368
18619
  break;
18369
18620
  }
18370
- _context9.n = 51;
18621
+ _context9.n = 50;
18371
18622
  return effects.put(setMessagesAC([]));
18372
- case 51:
18373
- _context9.n = 53;
18623
+ case 50:
18624
+ _context9.n = 52;
18374
18625
  break;
18375
- case 52:
18376
- _context9.p = 52;
18626
+ case 51:
18627
+ _context9.p = 51;
18377
18628
  _t9 = _context9.v;
18378
18629
  log.error('error in message query', _t9);
18630
+ case 52:
18631
+ _context9.p = 52;
18632
+ _context9.n = 53;
18633
+ return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
18379
18634
  case 53:
18635
+ return _context9.f(52);
18636
+ case 54:
18380
18637
  return _context9.a(2);
18381
18638
  }
18382
- }, _marked7$1, null, [[1, 52]]);
18639
+ }, _marked7$1, null, [[1, 51, 52, 54]]);
18383
18640
  }
18384
18641
  function loadMoreMessages(action) {
18385
18642
  var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
@@ -19686,6 +19943,7 @@ function rootSaga() {
19686
19943
  }, _marked$6);
19687
19944
  }
19688
19945
 
19946
+ enableMapSet();
19689
19947
  var sagaMiddleware = createSagaMiddleware__default();
19690
19948
  var store = configureStore({
19691
19949
  reducer: {
@@ -31625,6 +31883,7 @@ var Message$1 = function Message(_ref) {
31625
31883
  }
31626
31884
  if (scrollToNewMessage.scrollToBottom && (message.id === channel.lastMessage.id || !message.id)) {
31627
31885
  dispatch(scrollToNewMessageAC(false, false, false));
31886
+ dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
31628
31887
  }
31629
31888
  } else {
31630
31889
  if (!channel.isLinkedChannel) {
@@ -40366,15 +40625,17 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
40366
40625
  };
40367
40626
  var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
40368
40627
  try {
40628
+ dispatch(scrollToNewMessageAC(true, false, false));
40369
40629
  if (messages.findIndex(function (msg) {
40370
40630
  return msg.id === messageId;
40371
40631
  }) >= 10) {
40632
+ dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
40372
40633
  var repliedMessage = document.getElementById(messageId);
40373
40634
  if (repliedMessage) {
40374
40635
  var scrollRef = document.getElementById('scrollableDiv');
40375
40636
  if (scrollRef) {
40376
40637
  scrollRef.scrollTo({
40377
- top: 0,
40638
+ top: 1000,
40378
40639
  behavior: 'smooth'
40379
40640
  });
40380
40641
  }
package/index.modern.js CHANGED
@@ -580,6 +580,10 @@ function getPlugin(pluginKey) {
580
580
  }
581
581
  return plugin;
582
582
  }
583
+ function loadPlugin(pluginKey, implementation) {
584
+ if (!plugins[pluginKey])
585
+ plugins[pluginKey] = implementation;
586
+ }
583
587
 
584
588
  // src/core/scope.ts
585
589
  var currentScope;
@@ -1096,6 +1100,256 @@ function currentImpl(value) {
1096
1100
  return copy;
1097
1101
  }
1098
1102
 
1103
+ // src/plugins/mapset.ts
1104
+ function enableMapSet() {
1105
+ class DraftMap extends Map {
1106
+ constructor(target, parent) {
1107
+ super();
1108
+ this[DRAFT_STATE] = {
1109
+ type_: 2 /* Map */,
1110
+ parent_: parent,
1111
+ scope_: parent ? parent.scope_ : getCurrentScope(),
1112
+ modified_: false,
1113
+ finalized_: false,
1114
+ copy_: void 0,
1115
+ assigned_: void 0,
1116
+ base_: target,
1117
+ draft_: this,
1118
+ isManual_: false,
1119
+ revoked_: false
1120
+ };
1121
+ }
1122
+ get size() {
1123
+ return latest(this[DRAFT_STATE]).size;
1124
+ }
1125
+ has(key) {
1126
+ return latest(this[DRAFT_STATE]).has(key);
1127
+ }
1128
+ set(key, value) {
1129
+ const state = this[DRAFT_STATE];
1130
+ assertUnrevoked(state);
1131
+ if (!latest(state).has(key) || latest(state).get(key) !== value) {
1132
+ prepareMapCopy(state);
1133
+ markChanged(state);
1134
+ state.assigned_.set(key, true);
1135
+ state.copy_.set(key, value);
1136
+ state.assigned_.set(key, true);
1137
+ }
1138
+ return this;
1139
+ }
1140
+ delete(key) {
1141
+ if (!this.has(key)) {
1142
+ return false;
1143
+ }
1144
+ const state = this[DRAFT_STATE];
1145
+ assertUnrevoked(state);
1146
+ prepareMapCopy(state);
1147
+ markChanged(state);
1148
+ if (state.base_.has(key)) {
1149
+ state.assigned_.set(key, false);
1150
+ } else {
1151
+ state.assigned_.delete(key);
1152
+ }
1153
+ state.copy_.delete(key);
1154
+ return true;
1155
+ }
1156
+ clear() {
1157
+ const state = this[DRAFT_STATE];
1158
+ assertUnrevoked(state);
1159
+ if (latest(state).size) {
1160
+ prepareMapCopy(state);
1161
+ markChanged(state);
1162
+ state.assigned_ = /* @__PURE__ */ new Map();
1163
+ each(state.base_, (key) => {
1164
+ state.assigned_.set(key, false);
1165
+ });
1166
+ state.copy_.clear();
1167
+ }
1168
+ }
1169
+ forEach(cb, thisArg) {
1170
+ const state = this[DRAFT_STATE];
1171
+ latest(state).forEach((_value, key, _map) => {
1172
+ cb.call(thisArg, this.get(key), key, this);
1173
+ });
1174
+ }
1175
+ get(key) {
1176
+ const state = this[DRAFT_STATE];
1177
+ assertUnrevoked(state);
1178
+ const value = latest(state).get(key);
1179
+ if (state.finalized_ || !isDraftable(value)) {
1180
+ return value;
1181
+ }
1182
+ if (value !== state.base_.get(key)) {
1183
+ return value;
1184
+ }
1185
+ const draft = createProxy(value, state);
1186
+ prepareMapCopy(state);
1187
+ state.copy_.set(key, draft);
1188
+ return draft;
1189
+ }
1190
+ keys() {
1191
+ return latest(this[DRAFT_STATE]).keys();
1192
+ }
1193
+ values() {
1194
+ const iterator = this.keys();
1195
+ return {
1196
+ [Symbol.iterator]: () => this.values(),
1197
+ next: () => {
1198
+ const r = iterator.next();
1199
+ if (r.done)
1200
+ return r;
1201
+ const value = this.get(r.value);
1202
+ return {
1203
+ done: false,
1204
+ value
1205
+ };
1206
+ }
1207
+ };
1208
+ }
1209
+ entries() {
1210
+ const iterator = this.keys();
1211
+ return {
1212
+ [Symbol.iterator]: () => this.entries(),
1213
+ next: () => {
1214
+ const r = iterator.next();
1215
+ if (r.done)
1216
+ return r;
1217
+ const value = this.get(r.value);
1218
+ return {
1219
+ done: false,
1220
+ value: [r.value, value]
1221
+ };
1222
+ }
1223
+ };
1224
+ }
1225
+ [(Symbol.iterator)]() {
1226
+ return this.entries();
1227
+ }
1228
+ }
1229
+ function proxyMap_(target, parent) {
1230
+ return new DraftMap(target, parent);
1231
+ }
1232
+ function prepareMapCopy(state) {
1233
+ if (!state.copy_) {
1234
+ state.assigned_ = /* @__PURE__ */ new Map();
1235
+ state.copy_ = new Map(state.base_);
1236
+ }
1237
+ }
1238
+ class DraftSet extends Set {
1239
+ constructor(target, parent) {
1240
+ super();
1241
+ this[DRAFT_STATE] = {
1242
+ type_: 3 /* Set */,
1243
+ parent_: parent,
1244
+ scope_: parent ? parent.scope_ : getCurrentScope(),
1245
+ modified_: false,
1246
+ finalized_: false,
1247
+ copy_: void 0,
1248
+ base_: target,
1249
+ draft_: this,
1250
+ drafts_: /* @__PURE__ */ new Map(),
1251
+ revoked_: false,
1252
+ isManual_: false
1253
+ };
1254
+ }
1255
+ get size() {
1256
+ return latest(this[DRAFT_STATE]).size;
1257
+ }
1258
+ has(value) {
1259
+ const state = this[DRAFT_STATE];
1260
+ assertUnrevoked(state);
1261
+ if (!state.copy_) {
1262
+ return state.base_.has(value);
1263
+ }
1264
+ if (state.copy_.has(value))
1265
+ return true;
1266
+ if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
1267
+ return true;
1268
+ return false;
1269
+ }
1270
+ add(value) {
1271
+ const state = this[DRAFT_STATE];
1272
+ assertUnrevoked(state);
1273
+ if (!this.has(value)) {
1274
+ prepareSetCopy(state);
1275
+ markChanged(state);
1276
+ state.copy_.add(value);
1277
+ }
1278
+ return this;
1279
+ }
1280
+ delete(value) {
1281
+ if (!this.has(value)) {
1282
+ return false;
1283
+ }
1284
+ const state = this[DRAFT_STATE];
1285
+ assertUnrevoked(state);
1286
+ prepareSetCopy(state);
1287
+ markChanged(state);
1288
+ return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
1289
+ /* istanbul ignore next */
1290
+ false
1291
+ ));
1292
+ }
1293
+ clear() {
1294
+ const state = this[DRAFT_STATE];
1295
+ assertUnrevoked(state);
1296
+ if (latest(state).size) {
1297
+ prepareSetCopy(state);
1298
+ markChanged(state);
1299
+ state.copy_.clear();
1300
+ }
1301
+ }
1302
+ values() {
1303
+ const state = this[DRAFT_STATE];
1304
+ assertUnrevoked(state);
1305
+ prepareSetCopy(state);
1306
+ return state.copy_.values();
1307
+ }
1308
+ entries() {
1309
+ const state = this[DRAFT_STATE];
1310
+ assertUnrevoked(state);
1311
+ prepareSetCopy(state);
1312
+ return state.copy_.entries();
1313
+ }
1314
+ keys() {
1315
+ return this.values();
1316
+ }
1317
+ [(Symbol.iterator)]() {
1318
+ return this.values();
1319
+ }
1320
+ forEach(cb, thisArg) {
1321
+ const iterator = this.values();
1322
+ let result = iterator.next();
1323
+ while (!result.done) {
1324
+ cb.call(thisArg, result.value, result.value, this);
1325
+ result = iterator.next();
1326
+ }
1327
+ }
1328
+ }
1329
+ function proxySet_(target, parent) {
1330
+ return new DraftSet(target, parent);
1331
+ }
1332
+ function prepareSetCopy(state) {
1333
+ if (!state.copy_) {
1334
+ state.copy_ = /* @__PURE__ */ new Set();
1335
+ state.base_.forEach((value) => {
1336
+ if (isDraftable(value)) {
1337
+ const draft = createProxy(value, state);
1338
+ state.drafts_.set(value, draft);
1339
+ state.copy_.add(draft);
1340
+ } else {
1341
+ state.copy_.add(value);
1342
+ }
1343
+ });
1344
+ }
1345
+ }
1346
+ function assertUnrevoked(state) {
1347
+ if (state.revoked_)
1348
+ die(3, JSON.stringify(latest(state)));
1349
+ }
1350
+ loadPlugin("MapSet", { proxyMap_, proxySet_ });
1351
+ }
1352
+
1099
1353
  // src/immer.ts
1100
1354
  var immer = new Immer2();
1101
1355
  var produce = immer.produce;
@@ -18042,23 +18296,23 @@ function getMessagesQuery(action) {
18042
18296
  case 0:
18043
18297
  log.info('getMessagesQuery ... ');
18044
18298
  _context9.p = 1;
18299
+ _context9.n = 2;
18300
+ return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
18301
+ case 2:
18045
18302
  _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;
18046
18303
  if (!(channel.id && !channel.isMockChannel)) {
18047
- _context9.n = 50;
18304
+ _context9.n = 49;
18048
18305
  break;
18049
18306
  }
18050
18307
  SceytChatClient = getClient();
18051
18308
  messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channel.id);
18052
18309
  messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
18053
18310
  messageQueryBuilder.reverse(true);
18054
- _context9.n = 2;
18311
+ _context9.n = 3;
18055
18312
  return call(messageQueryBuilder.build);
18056
- case 2:
18313
+ case 3:
18057
18314
  messageQuery = _context9.v;
18058
18315
  query.messageQuery = messageQuery;
18059
- _context9.n = 3;
18060
- return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
18061
- case 3:
18062
18316
  cachedMessages = getMessagesFromMap(channel.id);
18063
18317
  result = {
18064
18318
  messages: [],
@@ -18336,29 +18590,32 @@ function getMessagesQuery(action) {
18336
18590
  removePendingMessageFromMap(channel === null || channel === void 0 ? void 0 : channel.id, mes.tid || mes.id);
18337
18591
  }
18338
18592
  case 48:
18339
- _context9.n = 49;
18340
- return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
18341
- case 49:
18342
- _context9.n = 51;
18593
+ _context9.n = 50;
18343
18594
  break;
18344
- case 50:
18595
+ case 49:
18345
18596
  if (!channel.isMockChannel) {
18346
- _context9.n = 51;
18597
+ _context9.n = 50;
18347
18598
  break;
18348
18599
  }
18349
- _context9.n = 51;
18600
+ _context9.n = 50;
18350
18601
  return put(setMessagesAC([]));
18351
- case 51:
18352
- _context9.n = 53;
18602
+ case 50:
18603
+ _context9.n = 52;
18353
18604
  break;
18354
- case 52:
18355
- _context9.p = 52;
18605
+ case 51:
18606
+ _context9.p = 51;
18356
18607
  _t9 = _context9.v;
18357
18608
  log.error('error in message query', _t9);
18609
+ case 52:
18610
+ _context9.p = 52;
18611
+ _context9.n = 53;
18612
+ return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
18358
18613
  case 53:
18614
+ return _context9.f(52);
18615
+ case 54:
18359
18616
  return _context9.a(2);
18360
18617
  }
18361
- }, _marked7$1, null, [[1, 52]]);
18618
+ }, _marked7$1, null, [[1, 51, 52, 54]]);
18362
18619
  }
18363
18620
  function loadMoreMessages(action) {
18364
18621
  var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t0;
@@ -19665,6 +19922,7 @@ function rootSaga() {
19665
19922
  }, _marked$6);
19666
19923
  }
19667
19924
 
19925
+ enableMapSet();
19668
19926
  var sagaMiddleware = createSagaMiddleware();
19669
19927
  var store = configureStore({
19670
19928
  reducer: {
@@ -31604,6 +31862,7 @@ var Message$1 = function Message(_ref) {
31604
31862
  }
31605
31863
  if (scrollToNewMessage.scrollToBottom && (message.id === channel.lastMessage.id || !message.id)) {
31606
31864
  dispatch(scrollToNewMessageAC(false, false, false));
31865
+ dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
31607
31866
  }
31608
31867
  } else {
31609
31868
  if (!channel.isLinkedChannel) {
@@ -40345,15 +40604,17 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
40345
40604
  };
40346
40605
  var handleScrollToLastMessage = function handleScrollToLastMessage(messageId) {
40347
40606
  try {
40607
+ dispatch(scrollToNewMessageAC(true, false, false));
40348
40608
  if (messages.findIndex(function (msg) {
40349
40609
  return msg.id === messageId;
40350
40610
  }) >= 10) {
40611
+ dispatch(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
40351
40612
  var repliedMessage = document.getElementById(messageId);
40352
40613
  if (repliedMessage) {
40353
40614
  var scrollRef = document.getElementById('scrollableDiv');
40354
40615
  if (scrollRef) {
40355
40616
  scrollRef.scrollTo({
40356
- top: 0,
40617
+ top: 1000,
40357
40618
  behavior: 'smooth'
40358
40619
  });
40359
40620
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.6.9-beta.13",
3
+ "version": "1.6.9-beta.15",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",