stream-chat 10.0.0-rc.21 → 10.0.0-rc.22

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 (33) hide show
  1. package/dist/cjs/index.browser.js +308 -216
  2. package/dist/cjs/index.browser.js.map +3 -3
  3. package/dist/cjs/index.node.js +308 -216
  4. package/dist/cjs/index.node.js.map +3 -3
  5. package/dist/esm/index.mjs +311 -219
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/client.d.ts +22 -21
  8. package/dist/types/configuration/types.d.ts +31 -0
  9. package/dist/types/messageComposer/linkPreviewsManager.d.ts +2 -2
  10. package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +14 -0
  11. package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
  12. package/dist/types/pagination/paginators/BasePaginator.d.ts +5 -1
  13. package/dist/types/pagination/paginators/ChannelPaginator.d.ts +2 -0
  14. package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +5 -3
  15. package/dist/types/pagination/paginators/MessagePaginator.d.ts +5 -1
  16. package/dist/types/types.d.ts +1 -39
  17. package/package.json +7 -2
  18. package/src/ChannelManager.ts +7 -0
  19. package/src/EventHandlerPipeline.ts +2 -1
  20. package/src/api-client.ts +14 -8
  21. package/src/channel.ts +10 -0
  22. package/src/client.ts +44 -43
  23. package/src/configuration/keys.ts +5 -0
  24. package/src/configuration/shape.ts +36 -0
  25. package/src/configuration/types.ts +31 -0
  26. package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +30 -0
  27. package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +12 -60
  28. package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
  29. package/src/pagination/paginators/BasePaginator.ts +43 -18
  30. package/src/pagination/paginators/ChannelPaginator.ts +39 -14
  31. package/src/pagination/paginators/MessageIntervalPaginator.ts +17 -11
  32. package/src/pagination/paginators/MessagePaginator.ts +51 -5
  33. package/src/types.ts +1 -40
@@ -1104,7 +1104,7 @@ var TokenManager = class {
1104
1104
  };
1105
1105
 
1106
1106
  // src/api-client.ts
1107
- import { AxiosError } from "axios";
1107
+ import { isAxiosError } from "axios";
1108
1108
 
1109
1109
  // src/upload-utils.ts
1110
1110
  var isWebFile = (value) => typeof Blob !== "undefined" && value instanceof Blob;
@@ -1258,10 +1258,11 @@ var ApiClient = class {
1258
1258
  }
1259
1259
  populateRequestConfigWithDefaults(additonalConfig) {
1260
1260
  const token = this._getToken();
1261
+ const axiosRequestConfig = this.client.config.getConfig("client")?.axiosRequestConfig;
1261
1262
  return {
1262
1263
  ...additonalConfig,
1263
1264
  headers: {
1264
- ...this.client.options.axiosRequestConfig?.headers,
1265
+ ...axiosRequestConfig?.headers,
1265
1266
  ...additonalConfig.headers,
1266
1267
  Authorization: token,
1267
1268
  "stream-auth-type": this.client.getAuthType(),
@@ -1271,9 +1272,8 @@ var ApiClient = class {
1271
1272
  params: {
1272
1273
  user_id: this.client.userId,
1273
1274
  api_key: this.client.key,
1274
- // TODO: figure out whether this is needed, setting these at a later time (client.options.axiosRequestConfig = {...}) should probably be a setter
1275
- // that updates existing axios instance options instead
1276
- ...this.client.options.axiosRequestConfig?.params,
1275
+ // Read per request, unlike the rest of `axiosRequestConfig`, which the axios instance took at construction.
1276
+ ...axiosRequestConfig?.params,
1277
1277
  ...additonalConfig.params
1278
1278
  }
1279
1279
  };
@@ -1342,7 +1342,7 @@ var ApiClient = class {
1342
1342
  delayBetweenRetries: (attemptNumber) => retryInterval(attemptNumber + 1),
1343
1343
  retryAttempts: 10,
1344
1344
  isRetryable: (error) => {
1345
- if (!(error instanceof AxiosError)) return false;
1345
+ if (!isAxiosError(error)) return false;
1346
1346
  if (error.status === 429 || isTokenExpiredError(error)) return true;
1347
1347
  return false;
1348
1348
  }
@@ -1387,7 +1387,7 @@ var toAxiosRequestConfig = ({
1387
1387
  ...typeof timeout === "number" ? { timeout } : {}
1388
1388
  });
1389
1389
  var errorIsApiError = (error) => {
1390
- if (!(error instanceof AxiosError)) return false;
1390
+ if (!isAxiosError(error)) return false;
1391
1391
  return typeof error.response?.data?.code === "number";
1392
1392
  };
1393
1393
  var isTokenExpiredError = (error) => errorIsApiError(error) && error.response?.data.code === chatCodes.TOKEN_EXPIRED;
@@ -6014,7 +6014,8 @@ var BasePaginator = class {
6014
6014
  */
6015
6015
  locateByItemInInterval({
6016
6016
  item,
6017
- interval
6017
+ interval,
6018
+ plateauScan = true
6018
6019
  }) {
6019
6020
  const ids = interval.itemIds;
6020
6021
  return binarySearch({
@@ -6024,7 +6025,7 @@ var BasePaginator = class {
6024
6025
  itemIdentityEquals: (item1, item2) => this.getItemId(item1) === this.getItemId(item2),
6025
6026
  // items in intervals are not sorted by effectiveComparator
6026
6027
  compare: this.itemOrderComparator.bind(this),
6027
- plateauScan: true
6028
+ plateauScan
6028
6029
  });
6029
6030
  }
6030
6031
  locateIntervalForItem(item) {
@@ -6046,11 +6047,17 @@ var BasePaginator = class {
6046
6047
  return void 0;
6047
6048
  }
6048
6049
  locateByItemInIntervals(item) {
6049
- const interval = this.locateIntervalForItem(item) ?? this.findIntervalHoldingItem(item);
6050
- if (!interval) return void 0;
6051
- const itemLocation = this.locateByItemInInterval({ item, interval });
6052
- if (!itemLocation) return void 0;
6053
- return { interval, ...itemLocation };
6050
+ const locateIn = (interval, plateauScan) => {
6051
+ const location = interval && this.locateByItemInInterval({ item, interval, plateauScan });
6052
+ return interval && location ? { interval, ...location } : void 0;
6053
+ };
6054
+ const boundsInterval = this.locateIntervalForItem(item);
6055
+ if (!this._itemIndex.has(this.getItemId(item)))
6056
+ return locateIn(boundsInterval, false);
6057
+ const inBounds = locateIn(boundsInterval);
6058
+ if (inBounds && inBounds.currentIndex > -1) return inBounds;
6059
+ const holdingInterval = this.findIntervalHoldingItem(item);
6060
+ return holdingInterval ? locateIn(holdingInterval) : inBounds;
6054
6061
  }
6055
6062
  /**
6056
6063
  * Locates the current position of the item and the index at which the item should be inserted
@@ -6716,6 +6723,10 @@ var BasePaginator = class {
6716
6723
  isJumpQueryShape(_queryShape) {
6717
6724
  return false;
6718
6725
  }
6726
+ /** The page size a query's results are measured against when deriving the head/tail flags. */
6727
+ getRequestedPageSize(_queryShape) {
6728
+ return this.pageSize;
6729
+ }
6719
6730
  getStateAfterQuery(stateUpdate, _isFirstPage) {
6720
6731
  const current = this.state.getLatestValue();
6721
6732
  return {
@@ -6819,7 +6830,7 @@ var BasePaginator = class {
6819
6830
  isFirstPage,
6820
6831
  keepPreviousItems,
6821
6832
  queryShape,
6822
- requestedPageSize: this.pageSize,
6833
+ requestedPageSize: this.getRequestedPageSize(queryShape),
6823
6834
  results,
6824
6835
  updateState
6825
6836
  });
@@ -6880,6 +6891,16 @@ var BasePaginator = class {
6880
6891
  stateUpdate.cursor = cursor;
6881
6892
  stateUpdate.hasMoreTail = hasMoreTail;
6882
6893
  stateUpdate.hasMoreHead = hasMoreHead;
6894
+ } else if (this.config.deriveCursor && direction && !isFirstPage) {
6895
+ stateUpdate.cursor = direction === "headward" ? {
6896
+ headward: resolvedHeadward || null,
6897
+ tailward: this.cursor?.tailward ?? null
6898
+ } : {
6899
+ headward: this.cursor?.headward ?? null,
6900
+ tailward: resolvedTailward || null
6901
+ };
6902
+ if (direction === "headward") stateUpdate.hasMoreHead = !!resolvedHeadward;
6903
+ else stateUpdate.hasMoreTail = !!resolvedTailward;
6883
6904
  } else {
6884
6905
  stateUpdate.cursor = {
6885
6906
  tailward: resolvedTailward || null,
@@ -6927,6 +6948,7 @@ var BasePaginator = class {
6927
6948
  }
6928
6949
  const state = this.getStateAfterQuery(stateUpdate, isFirstPage);
6929
6950
  if (updateState) this.state.next(state);
6951
+ else if (this.isLoading) this.state.partialNext({ isLoading: false });
6930
6952
  if (isFirstPage) this.populateOfflineDbAfterQuery({ items: state.items, queryShape });
6931
6953
  return {
6932
6954
  stateCandidate: state,
@@ -7019,6 +7041,12 @@ var FilterBuilder = class {
7019
7041
  };
7020
7042
 
7021
7043
  // src/pagination/paginators/ChannelPaginator.ts
7044
+ var hasSameItems = (current, next) => {
7045
+ if (current === next) return false;
7046
+ if (!current || !next || current.length !== next.length) return false;
7047
+ for (let i = 0; i < next.length; i++) if (current[i] !== next[i]) return false;
7048
+ return true;
7049
+ };
7022
7050
  var DEFAULT_BACKEND_SORT = [
7023
7051
  { direction: -1, field: "last_message_at" },
7024
7052
  { direction: -1, field: "updated_at" }
@@ -7067,11 +7095,8 @@ var hiddenFilterResolver = {
7067
7095
  };
7068
7096
  var lastUpdatedFilterResolver = {
7069
7097
  matchesField: (field) => field === "last_updated",
7070
- resolve: (channel) => {
7071
- const lastMessageAt = channel.messagePaginator.lastMessageAt ?? null;
7072
- const updatedAt = channel.data?.updated_at;
7073
- return lastMessageAt !== null && updatedAt !== void 0 ? Math.max(lastMessageAt, updatedAt) : lastMessageAt ?? updatedAt;
7074
- }
7098
+ // the server uses the creation time for a channel without messages
7099
+ resolve: (channel) => channel.messagePaginator.lastMessageAt ?? channel.data?.created_at
7075
7100
  };
7076
7101
  var membersFilterResolver = {
7077
7102
  matchesField: (field) => field === "members",
@@ -7273,6 +7298,10 @@ var ChannelPaginator = class extends BasePaginator {
7273
7298
  memberUserNameFilterResolver,
7274
7299
  dataFieldFilterResolver
7275
7300
  ]);
7301
+ this.state.addPreprocessor((next, previous) => {
7302
+ if (previous && hasSameItems(previous.items, next.items))
7303
+ next.items = previous.items;
7304
+ });
7276
7305
  }
7277
7306
  /**
7278
7307
  * Builds the comparator for the given sort — the single construction point, so every rebuild (the
@@ -7489,11 +7518,21 @@ var ChannelPaginator = class extends BasePaginator {
7489
7518
  const shouldDeferUntilSynced = !!offlineDb?.getChannelsForQuery && !!this.client.user?.id && !offlineDb.syncManager.isSynced && // Items seeded from the cache are not an already loaded list, so paginating them has to defer too.
7490
7519
  (this._itemsLoadedFromOfflineDB || this.isFirstPageQuery({ queryShape, reset: effectiveParams.reset }));
7491
7520
  if (!shouldDeferUntilSynced) return await super.executeQuery(effectiveParams);
7521
+ if (this._queryAwaitingSync && !this.config.hasPaginationQueryShapeChanged(this._queryAwaitingSync, queryShape)) {
7522
+ return;
7523
+ }
7524
+ this._queryAwaitingSync = queryShape;
7492
7525
  if (!this.isInitialized) {
7493
- const cachedChannels = await this.preloadFirstPageFromOfflineDb({
7494
- ...effectiveParams,
7495
- queryShape
7496
- });
7526
+ let cachedChannels;
7527
+ try {
7528
+ cachedChannels = await this.preloadFirstPageFromOfflineDb({
7529
+ ...effectiveParams,
7530
+ queryShape
7531
+ });
7532
+ } catch (error) {
7533
+ this._queryAwaitingSync = void 0;
7534
+ throw error;
7535
+ }
7497
7536
  if (cachedChannels?.length) {
7498
7537
  this.setItems({ valueOrFactory: cachedChannels, isFirstPage: true });
7499
7538
  this._itemsLoadedFromOfflineDB = true;
@@ -7506,9 +7545,11 @@ var ChannelPaginator = class extends BasePaginator {
7506
7545
  ...this._itemsLoadedFromOfflineDB ? { reset: "yes" } : {}
7507
7546
  };
7508
7547
  if (offlineDb.syncManager.isSynced) {
7548
+ this._queryAwaitingSync = void 0;
7509
7549
  return await super.executeQuery(refreshParams);
7510
7550
  }
7511
7551
  offlineDb.syncManager.scheduleSyncStatusChangeCallback(this.id, async () => {
7552
+ this._queryAwaitingSync = void 0;
7512
7553
  await this.executeQuery(refreshParams);
7513
7554
  });
7514
7555
  }
@@ -7550,6 +7591,7 @@ var ChannelPaginator = class extends BasePaginator {
7550
7591
  resetState() {
7551
7592
  super.resetState();
7552
7593
  this._itemIndex.clear();
7594
+ this._queryAwaitingSync = void 0;
7553
7595
  }
7554
7596
  removeItem(params) {
7555
7597
  const coordinates = super.removeItem(params);
@@ -7575,56 +7617,41 @@ function lowerBound(length, predicate) {
7575
7617
  return lo;
7576
7618
  }
7577
7619
 
7620
+ // src/pagination/cursorDerivation/aroundPaginationFlags.ts
7621
+ var deriveAroundPaginationFlags = ({
7622
+ interval,
7623
+ newerCount,
7624
+ olderCount,
7625
+ pageLength,
7626
+ requestedPageSize
7627
+ }) => {
7628
+ const isPageFull = pageLength >= requestedPageSize;
7629
+ const minShare = Math.floor((olderCount + newerCount) / 2);
7630
+ return {
7631
+ hasMoreHead: !interval.isHead && isPageFull && newerCount >= minShare,
7632
+ hasMoreTail: !interval.isTail && isPageFull && olderCount >= minShare
7633
+ };
7634
+ };
7635
+
7578
7636
  // src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts
7579
7637
  var deriveCreatedAtAroundPaginationFlags = ({
7580
7638
  hasMoreHead,
7581
7639
  hasMoreTail,
7582
7640
  interval,
7583
7641
  page,
7584
- paginator,
7585
7642
  queryShape,
7586
7643
  requestedPageSize
7587
7644
  }) => {
7588
- let flags = { hasMoreHead, hasMoreTail };
7589
- if (!queryShape?.created_at_around) return flags;
7645
+ if (!queryShape?.created_at_around) return { hasMoreHead, hasMoreTail };
7590
7646
  const createdAtAround = dateToNs(new Date(queryShape.created_at_around));
7591
- const [firstPageItem, lastPageItem] = [page[0], page.slice(-1)[0]];
7592
- const isAboveHeadBound = paginator.sortComparator({ created_at: createdAtAround }, lastPageItem) === -1 /* A_PRECEDES_B */;
7593
- const isBelowTailBound = paginator.sortComparator(firstPageItem, { created_at: createdAtAround }) === -1 /* A_PRECEDES_B */;
7594
- const requestedPageSizeNotMet = requestedPageSize > interval.itemIds.length && requestedPageSize > page.length;
7595
- const noMoreMessages = (requestedPageSize > interval.itemIds.length || interval.itemIds.length >= page.length) && requestedPageSize > page.length;
7596
- if (isAboveHeadBound) {
7597
- flags.hasMoreHead = false;
7598
- if (requestedPageSizeNotMet) {
7599
- flags.hasMoreTail = false;
7600
- }
7601
- } else if (isBelowTailBound) {
7602
- flags.hasMoreTail = false;
7603
- if (requestedPageSizeNotMet) {
7604
- flags.hasMoreHead = false;
7605
- }
7606
- } else if (noMoreMessages) {
7607
- flags = { hasMoreHead: false, hasMoreTail: false };
7608
- } else {
7609
- const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [
7610
- firstPageItem?.id && firstPageItem.id === interval.itemIds[0],
7611
- lastPageItem?.id && lastPageItem.id === interval.itemIds.slice(-1)[0]
7612
- ];
7613
- const midPointByCount = Math.floor(page.length / 2);
7614
- const { insertionIndex } = binarySearch({
7615
- needle: { created_at: createdAtAround },
7616
- length: page.length,
7617
- getItemAt: (index) => page[index],
7618
- compare: (a, b) => a.created_at - b.created_at,
7619
- itemIdentityEquals: (a, b) => a.created_at === b.created_at,
7620
- plateauScan: false
7621
- });
7622
- if (insertionIndex !== -1) {
7623
- if (firstPageMsgIsFirstInSet) flags.hasMoreTail = midPointByCount <= insertionIndex;
7624
- if (lastPageMsgIsLastInSet) flags.hasMoreHead = midPointByCount >= insertionIndex;
7625
- }
7626
- }
7627
- return flags;
7647
+ const olderCount = page.filter((item) => item.created_at < createdAtAround).length;
7648
+ return deriveAroundPaginationFlags({
7649
+ interval,
7650
+ newerCount: page.length - olderCount,
7651
+ olderCount,
7652
+ pageLength: page.length,
7653
+ requestedPageSize
7654
+ });
7628
7655
  };
7629
7656
 
7630
7657
  // src/pagination/cursorDerivation/idAroundPaginationFlags.ts
@@ -7636,38 +7663,15 @@ var deriveIdAroundPaginationFlags = ({
7636
7663
  queryShape,
7637
7664
  requestedPageSize
7638
7665
  }) => {
7639
- let flags = { hasMoreHead, hasMoreTail };
7640
- if (!queryShape?.id_around) return flags;
7641
- const { id_around } = queryShape;
7642
- const [firstPageMsg, lastPageMsg] = [page[0], page.slice(-1)[0]];
7643
- const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [
7644
- firstPageMsg?.id === interval.itemIds[0],
7645
- lastPageMsg?.id === interval.itemIds.slice(-1)[0]
7646
- ];
7647
- const midPoint = Math.floor(page.length / 2);
7648
- const noMoreMessages = (requestedPageSize > interval.itemIds.length || interval.itemIds.length >= page.length) && requestedPageSize > page.length;
7649
- if (noMoreMessages) {
7650
- flags = { hasMoreHead: false, hasMoreTail: false };
7651
- } else if (!page[midPoint]) {
7652
- return flags;
7653
- } else if (page[midPoint].id === id_around) {
7654
- flags = { hasMoreHead: true, hasMoreTail: true };
7655
- } else {
7656
- const halves = [page.slice(0, midPoint), page.slice(midPoint)];
7657
- if (firstPageMsgIsFirstInSet) {
7658
- const targetMsg = halves[0].find((message) => message.id === id_around);
7659
- if (targetMsg) {
7660
- flags.hasMoreTail = false;
7661
- }
7662
- }
7663
- if (lastPageMsgIsLastInSet) {
7664
- const targetMsg = halves[1].find((message) => message.id === id_around);
7665
- if (targetMsg) {
7666
- flags.hasMoreHead = false;
7667
- }
7668
- }
7669
- }
7670
- return flags;
7666
+ const targetIndex = page.findIndex((item) => item.id === queryShape?.id_around);
7667
+ if (!queryShape?.id_around || targetIndex === -1) return { hasMoreHead, hasMoreTail };
7668
+ return deriveAroundPaginationFlags({
7669
+ interval,
7670
+ newerCount: page.length - 1 - targetIndex,
7671
+ olderCount: targetIndex,
7672
+ pageLength: page.length,
7673
+ requestedPageSize
7674
+ });
7671
7675
  };
7672
7676
 
7673
7677
  // src/pagination/cursorDerivation/linearPaginationFlags.ts
@@ -7887,7 +7891,9 @@ var MessageIntervalPaginator = class extends BasePaginator {
7887
7891
  };
7888
7892
  } else {
7889
7893
  const result = await this.executeQuery({
7890
- queryShape: { id_around: messageId, limit: pageSize },
7894
+ // Always send a limit, since the replies endpoint ignores `id_around` without one and returns the
7895
+ // newest replies instead.
7896
+ queryShape: { id_around: messageId, limit: pageSize ?? this.pageSize },
7891
7897
  ...watch && { requestOptions: { watch: true } },
7892
7898
  updateState: false
7893
7899
  });
@@ -8162,65 +8168,6 @@ var MessageIntervalPaginator = class extends BasePaginator {
8162
8168
  }
8163
8169
  this.messageFocusSignal.next({ signal: null });
8164
8170
  };
8165
- /**
8166
- * Partial truncation for `channel.truncated` carrying a `truncated_at`: drop every loaded
8167
- * message strictly older than the cutoff (keeping newer ones) across all loaded windows,
8168
- * mirroring the legacy per-message-set pruning. For a full truncation (no `truncated_at`) use
8169
- * {@link MessageIntervalPaginator.clearStateAndCache} instead.
8170
- *
8171
- * Batched and edge-classified: because messages are chronological, each interval is classified by
8172
- * its `tail` (oldest) and `head` (newest) edges, so only the single interval that *straddles* the
8173
- * cutoff is scanned member-by-member — the rest are kept or dropped wholesale. The straddling
8174
- * interval becomes the new global tail (nothing older than the cutoff exists anymore), so its
8175
- * `isTail`/`hasMoreTail` are set; intervals entirely newer keep their flags (unloaded older
8176
- * messages may still sit between them and the cutoff). The active window is re-emitted once.
8177
- */
8178
- this.truncate = ({ truncatedAt }) => {
8179
- const cutoff = truncatedAt;
8180
- if (!Number.isFinite(cutoff)) return;
8181
- const isOld = (item) => {
8182
- const time = getMessageCreatedAtTimestamp(item);
8183
- return time !== null && time < cutoff;
8184
- };
8185
- const removedIds = [];
8186
- const survivingIntervals = [];
8187
- for (const interval of this.itemIntervals) {
8188
- const edges = this.getIntervalPaginationEdges(interval);
8189
- if (!edges || !isOld(edges.tail)) {
8190
- survivingIntervals.push(interval);
8191
- } else if (isOld(edges.head)) {
8192
- removedIds.push(...interval.itemIds);
8193
- } else {
8194
- const ids = interval.itemIds;
8195
- const splitIndex = lowerBound(
8196
- ids.length,
8197
- (index) => !isOld(this._itemIndex.get(ids[index]))
8198
- );
8199
- removedIds.push(...ids.slice(0, splitIndex));
8200
- const kept = ids.slice(splitIndex);
8201
- survivingIntervals.push(
8202
- isLogicalInterval(interval) ? { ...interval, itemIds: kept } : { ...interval, itemIds: kept, isTail: true, hasMoreTail: false }
8203
- );
8204
- }
8205
- }
8206
- if (!removedIds.length) return;
8207
- for (const id of removedIds) this._itemIndex.remove(id);
8208
- this.setIntervals(survivingIntervals);
8209
- const active = this._activeIntervalId ? this._itemIntervals.get(this._activeIntervalId) : void 0;
8210
- if (active && !isLogicalInterval(active)) {
8211
- this.setActiveInterval(active);
8212
- return;
8213
- }
8214
- const anchoredSurvivors = this.itemIntervals.filter(
8215
- (itv) => !isLogicalInterval(itv)
8216
- );
8217
- const fallback = this.getTailIntervalFromSortedIntervals(anchoredSurvivors);
8218
- if (fallback) {
8219
- this.setActiveInterval(fallback);
8220
- } else {
8221
- this.state.partialNext({ items: [] });
8222
- }
8223
- };
8224
8171
  this.applyMessageDeletionForUser = ({
8225
8172
  userId,
8226
8173
  hardDelete = false,
@@ -8278,32 +8225,6 @@ var MessageIntervalPaginator = class extends BasePaginator {
8278
8225
  }
8279
8226
  });
8280
8227
  };
8281
- /**
8282
- * Reflect an updated `user` object onto every cached message authored by that user, mirroring
8283
- * the legacy `ChannelState.updateUserMessages` for the main message list (does not touch
8284
- * `quoted_message.user` — that is not part of the legacy behavior).
8285
- *
8286
- * Batched: a user rename can affect many messages, so this patches the shared item index and
8287
- * re-emits the active window a single time (if it held an affected message) rather than one
8288
- * `ingestItem` re-emit per message.
8289
- */
8290
- this.reflectUserUpdate = (user) => {
8291
- const activeIds = new Set((this.items ?? []).map((m) => this.getItemId(m)));
8292
- let activeAffected = false;
8293
- this.batch(() => {
8294
- for (const message of this._itemIndex.values()) {
8295
- if (message.user?.id !== user.id) continue;
8296
- if (message.user === user) continue;
8297
- this._itemIndex.setOne({ ...message, user });
8298
- if (activeIds.has(this.getItemId(message))) activeAffected = true;
8299
- }
8300
- });
8301
- if (activeAffected) {
8302
- this.state.partialNext({
8303
- items: (this.items ?? []).map((m) => this.getItem(this.getItemId(m)) ?? m)
8304
- });
8305
- }
8306
- };
8307
8228
  /**
8308
8229
  * Map a timestamp to a loaded message — the first message in the latest (head) window whose
8309
8230
  * `created_at` is >= `timestamp` (mirrors the legacy `ChannelState.findMessageByTimestamp`
@@ -8513,6 +8434,10 @@ var MessageIntervalPaginator = class extends BasePaginator {
8513
8434
  isJumpQueryShape(queryShape) {
8514
8435
  return !!queryShape?.id_around || !!queryShape?.created_at_around;
8515
8436
  }
8437
+ /** A jump sends its own `limit`, so its head/tail flags are derived against that, not `pageSize`. */
8438
+ getRequestedPageSize(queryShape) {
8439
+ return queryShape && this.isJumpQueryShape(queryShape) ? queryShape.limit ?? this.pageSize : this.pageSize;
8440
+ }
8516
8441
  /**
8517
8442
  * Whether `page` proves it reached the channel's own oldest message: the caller's request was
8518
8443
  * bounded by this paginator's OWN `pageSize` AND `page` came back shorter than that request.
@@ -8692,6 +8617,91 @@ var MessageIntervalPaginator = class extends BasePaginator {
8692
8617
  this._itemIndex.clear();
8693
8618
  this.clearMessageFocusSignal();
8694
8619
  }
8620
+ /**
8621
+ * Partial truncation for `channel.truncated` carrying a `truncated_at`: drop every loaded
8622
+ * message strictly older than the cutoff (keeping newer ones) across all loaded windows,
8623
+ * mirroring the legacy per-message-set pruning. For a full truncation (no `truncated_at`) use
8624
+ * {@link MessageIntervalPaginator.clearStateAndCache} instead.
8625
+ *
8626
+ * Batched and edge-classified: because messages are chronological, each interval is classified by
8627
+ * its `tail` (oldest) and `head` (newest) edges, so only the single interval that *straddles* the
8628
+ * cutoff is scanned member-by-member — the rest are kept or dropped wholesale. The straddling
8629
+ * interval becomes the new global tail (nothing older than the cutoff exists anymore), so its
8630
+ * `isTail`/`hasMoreTail` are set; intervals entirely newer keep their flags (unloaded older
8631
+ * messages may still sit between them and the cutoff). The active window is re-emitted once.
8632
+ */
8633
+ truncate({ truncatedAt }) {
8634
+ const cutoff = truncatedAt;
8635
+ if (!Number.isFinite(cutoff)) return;
8636
+ const isOld = (item) => {
8637
+ const time = getMessageCreatedAtTimestamp(item);
8638
+ return time !== null && time < cutoff;
8639
+ };
8640
+ const removedIds = [];
8641
+ const survivingIntervals = [];
8642
+ for (const interval of this.itemIntervals) {
8643
+ const edges = this.getIntervalPaginationEdges(interval);
8644
+ if (!edges || !isOld(edges.tail)) {
8645
+ survivingIntervals.push(interval);
8646
+ } else if (isOld(edges.head)) {
8647
+ removedIds.push(...interval.itemIds);
8648
+ } else {
8649
+ const ids = interval.itemIds;
8650
+ const splitIndex = lowerBound(
8651
+ ids.length,
8652
+ (index) => !isOld(this._itemIndex.get(ids[index]))
8653
+ );
8654
+ removedIds.push(...ids.slice(0, splitIndex));
8655
+ const kept = ids.slice(splitIndex);
8656
+ survivingIntervals.push(
8657
+ isLogicalInterval(interval) ? { ...interval, itemIds: kept } : { ...interval, itemIds: kept, isTail: true, hasMoreTail: false }
8658
+ );
8659
+ }
8660
+ }
8661
+ if (!removedIds.length) return;
8662
+ for (const id of removedIds) this._itemIndex.remove(id);
8663
+ this.setIntervals(survivingIntervals);
8664
+ const active = this._activeIntervalId ? this._itemIntervals.get(this._activeIntervalId) : void 0;
8665
+ if (active && !isLogicalInterval(active)) {
8666
+ this.setActiveInterval(active);
8667
+ return;
8668
+ }
8669
+ const anchoredSurvivors = this.itemIntervals.filter(
8670
+ (itv) => !isLogicalInterval(itv)
8671
+ );
8672
+ const fallback = this.getTailIntervalFromSortedIntervals(anchoredSurvivors);
8673
+ if (fallback) {
8674
+ this.setActiveInterval(fallback);
8675
+ } else {
8676
+ this.state.partialNext({ items: [] });
8677
+ }
8678
+ }
8679
+ /**
8680
+ * Reflect an updated `user` object onto every cached message authored by that user, mirroring
8681
+ * the legacy `ChannelState.updateUserMessages` for the main message list (does not touch
8682
+ * `quoted_message.user` — that is not part of the legacy behavior).
8683
+ *
8684
+ * Batched: a user rename can affect many messages, so this patches the shared item index and
8685
+ * re-emits the active window a single time (if it held an affected message) rather than one
8686
+ * `ingestItem` re-emit per message.
8687
+ */
8688
+ reflectUserUpdate(user) {
8689
+ const activeIds = new Set((this.items ?? []).map((m) => this.getItemId(m)));
8690
+ let activeAffected = false;
8691
+ this.batch(() => {
8692
+ for (const message of this._itemIndex.values()) {
8693
+ if (message.user?.id !== user.id) continue;
8694
+ if (message.user === user) continue;
8695
+ this._itemIndex.setOne({ ...message, user });
8696
+ if (activeIds.has(this.getItemId(message))) activeAffected = true;
8697
+ }
8698
+ });
8699
+ if (activeAffected) {
8700
+ this.state.partialNext({
8701
+ items: (this.items ?? []).map((m) => this.getItem(this.getItemId(m)) ?? m)
8702
+ });
8703
+ }
8704
+ }
8695
8705
  getCanonicalQueryItems(items) {
8696
8706
  return [...items].sort(this.itemOrderComparator);
8697
8707
  }
@@ -8735,7 +8745,6 @@ var makeDeriveCursor = (paginator) => (ctx) => {
8735
8745
  return injectCursor(
8736
8746
  deriveCreatedAtAroundPaginationFlags({
8737
8747
  ...ctx,
8738
- paginator,
8739
8748
  page: pageWithPermittedMessages,
8740
8749
  requestedPageSize: requestedPageSizeAfterAdjustment
8741
8750
  })
@@ -8855,7 +8864,7 @@ var MessagePaginator = class extends MessageIntervalPaginator {
8855
8864
  queryShape: {
8856
8865
  // `created_at_around` is a request field and still takes a `Date`.
8857
8866
  created_at_around: nsToDate(lastReadBoundary),
8858
- limit: options?.pageSize
8867
+ limit: options?.pageSize ?? this.pageSize
8859
8868
  },
8860
8869
  updateState: false
8861
8870
  });
@@ -9007,15 +9016,48 @@ var MessagePaginator = class extends MessageIntervalPaginator {
9007
9016
  }
9008
9017
  return interval;
9009
9018
  }
9019
+ onEntitiesChanged(batch) {
9020
+ super.onEntitiesChanged(batch);
9021
+ const { lastMessage } = this.aggregateState.getLatestValue();
9022
+ if (!lastMessage || !batch.changedIds.has(lastMessage.id)) return;
9023
+ const stored = this.getItem(lastMessage.id);
9024
+ if (stored) this.aggregateState.partialNext({ lastMessage: stored });
9025
+ }
9026
+ reflectUserUpdate(user) {
9027
+ super.reflectUserUpdate(user);
9028
+ const { lastMessage } = this.aggregateState.getLatestValue();
9029
+ if (lastMessage?.user?.id !== user.id) return;
9030
+ this.aggregateState.partialNext({ lastMessage: { ...lastMessage, user } });
9031
+ }
9010
9032
  removeItem(params) {
9011
9033
  const removedId = params.id ?? (params.item ? this.getItemId(params.item) : void 0);
9012
- const wasLatest = !!removedId && this.aggregateState.getLatestValue().lastMessage?.id === removedId;
9034
+ const { lastMessage, seededLastMessageAt } = this.aggregateState.getLatestValue();
9035
+ const wasLatest = !!removedId && lastMessage?.id === removedId;
9013
9036
  const result = super.removeItem(params);
9014
9037
  if (wasLatest) {
9015
- this.aggregateState.partialNext({ lastMessage: this.recomputeLastMessage() });
9038
+ const previous = this.recomputeLastMessage();
9039
+ const previousAt = getMessageCreatedAtTimestamp(previous);
9040
+ const removedAt = getMessageCreatedAtTimestamp(lastMessage);
9041
+ const isSeedFromRemovedMessage = seededLastMessageAt !== null && removedAt !== null && seededLastMessageAt <= removedAt;
9042
+ this.aggregateState.partialNext({
9043
+ lastMessage: previous,
9044
+ seededLastMessageAt: isSeedFromRemovedMessage && previousAt !== null ? previousAt : seededLastMessageAt
9045
+ });
9016
9046
  }
9017
9047
  return result;
9018
9048
  }
9049
+ truncate(params) {
9050
+ super.truncate(params);
9051
+ const { lastMessage, seededLastMessageAt } = this.aggregateState.getLatestValue();
9052
+ const isTruncated = (timestamp) => timestamp !== null && timestamp < params.truncatedAt;
9053
+ const isLastMessageTruncated = isTruncated(getMessageCreatedAtTimestamp(lastMessage));
9054
+ const isSeedTruncated = isTruncated(seededLastMessageAt);
9055
+ if (!isLastMessageTruncated && !isSeedTruncated) return;
9056
+ this.aggregateState.partialNext({
9057
+ lastMessage: isLastMessageTruncated ? this.recomputeLastMessage() : lastMessage,
9058
+ seededLastMessageAt: isSeedTruncated ? null : seededLastMessageAt
9059
+ });
9060
+ }
9019
9061
  /**
9020
9062
  * The still-loaded message with the greatest `created_at` that passes
9021
9063
  * {@link shouldAdvanceLastMessage} (skips system / thread-only per config), from the newest-loaded
@@ -16323,6 +16365,9 @@ var Channel = class extends ChannelApi {
16323
16365
  const channel = this;
16324
16366
  logger8.withExtraTags("_handleChannelEvent", this.cid).debug(`Received an event of type "${event.type}".`, { event });
16325
16367
  const channelState = channel.state;
16368
+ if ((event.type === "message.new" || event.type === "notification.message_new") && channel.data?.hidden) {
16369
+ channel.data = { ...channel.data, hidden: false };
16370
+ }
16326
16371
  switch (event.type) {
16327
16372
  case "typing.start":
16328
16373
  if (event.user?.id) {
@@ -16539,6 +16584,7 @@ var Channel = class extends ChannelApi {
16539
16584
  }
16540
16585
  break;
16541
16586
  case "channel.truncated": {
16587
+ if (event.channel) channel.data = { ...channel.data, ...event.channel };
16542
16588
  const truncatedAt = event.channel?.truncated_at;
16543
16589
  if (truncatedAt != null) {
16544
16590
  this._setOwnUnreadCount(this.countUnread(truncatedAt));
@@ -20074,8 +20120,9 @@ var EventHandlerPipeline = class {
20074
20120
  ctx
20075
20121
  });
20076
20122
  if (result?.action === "stop") return;
20077
- } catch {
20123
+ } catch (error) {
20078
20124
  console.error(`[pipeline:${this.id}] handler failed`, {
20125
+ error,
20079
20126
  handlerId: handler.id ?? "unknown",
20080
20127
  handlerIndex: i
20081
20128
  });
@@ -20183,6 +20230,10 @@ var channelTruncatedHandler = {
20183
20230
  handle: reinsertItem,
20184
20231
  id: "ChannelManager:default-handler:channel.truncated"
20185
20232
  };
20233
+ var messageDeletedHandler = {
20234
+ handle: (context) => context.event.hard_delete ? reinsertItem(context) : void 0,
20235
+ id: "ChannelManager:default-handler:message.deleted"
20236
+ };
20186
20237
  var channelVisibleHandler = {
20187
20238
  handle: updateLists,
20188
20239
  id: "ChannelManager:default-handler:channel.visible"
@@ -20921,6 +20972,7 @@ _ChannelManager.defaultEventHandlers = {
20921
20972
  "channel.hidden": [channelHiddenHandler],
20922
20973
  "channel.visible": [channelVisibleHandler],
20923
20974
  "member.updated": [memberUpdatedHandler],
20975
+ "message.deleted": [messageDeletedHandler],
20924
20976
  "message.new": [messageNewHandler],
20925
20977
  "message.read": [readStateChangedHandler],
20926
20978
  "message.read_locally": [readStateChangedHandler],
@@ -22874,6 +22926,11 @@ var CONSTRUCTION_ONLY_CONFIG_PATHS = {
22874
22926
  // `messagePaginator` was silent while the identical field under `channel`/`thread` warned — the same
22875
22927
  // read-once field, warned through one route and not the other.
22876
22928
  messagePaginator: ["initialCursor", "initialOffset", "unreadReferencePolicy"],
22929
+ // Each is consumed while the client is being constructed — the axios instance, the base URL and the
22930
+ // notification manager are built from it — so a value registered once the client exists never
22931
+ // reaches them. `browser` and `persistUserOnConnectionFailure` are read when needed, so they are not
22932
+ // listed.
22933
+ client: ["axiosRequestConfig", "baseURL", "notificationManager"],
22877
22934
  channel: [
22878
22935
  "messagePaginator.initialCursor",
22879
22936
  "messagePaginator.initialOffset",
@@ -24363,16 +24420,16 @@ var StreamChat = class _StreamChat extends ChatApi {
24363
24420
  *
24364
24421
  * @example <caption>initialize the client in user mode</caption>
24365
24422
  * new StreamChat('api_key')
24366
- * @example <caption>initialize the client with options</caption>
24367
- * new StreamChat('api_key', { axiosRequestConfig: { timeout: 5000 } })
24423
+ * @example <caption>initialize the client with configuration</caption>
24424
+ * new StreamChat('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
24368
24425
  *
24369
24426
  * @param key - The API key.
24370
- * @param options - Additional options (optional).
24371
- * @param options.browser - Enforce the client to be in browser mode (optional).
24372
- * @param options.axiosRequestConfig - Axios-level request configuration such as `timeout`,
24373
- * `headers` or `httpsAgent`, spread into the client's axios instance (optional).
24427
+ * @param config - Declarative configuration, the same tree `client.config.set()` takes (optional).
24428
+ * Seeded before anything is built, so it reaches the client's own managers and the fields that are
24429
+ * read once during construction — `client.baseURL`, `client.axiosRequestConfig` and
24430
+ * `client.notificationManager`.
24374
24431
  */
24375
- constructor(key, options = {}) {
24432
+ constructor(key, config) {
24376
24433
  super(new ApiClient());
24377
24434
  /**
24378
24435
  * If true, we will not clean up threads when channel state is in initializing state.
@@ -24419,9 +24476,9 @@ var StreamChat = class _StreamChat extends ChatApi {
24419
24476
  "Use client.disconnect() before trying to connect as a different user. connectUser was called twice."
24420
24477
  );
24421
24478
  }
24422
- if (this.node && !this.options.allowServerSideConnect) {
24479
+ if (this.node && !this.config.getConfig("client")?.allowServerSideConnect) {
24423
24480
  logger19.withExtraTags("connectUser").warn(
24424
- 'Do not use connectUser server-side. connectUser impacts MAU and concurrent connection usage, and therefore your bill. If you have a valid use case, set "allowServerSideConnect: true" in the client options to disable this warning.'
24481
+ "Do not use connectUser server-side. connectUser impacts MAU and concurrent connection usage, and therefore your bill. If you have a valid use case, set `client.allowServerSideConnect: true` in the client configuration to disable this warning."
24425
24482
  );
24426
24483
  }
24427
24484
  const setTokenPromise = this._setToken(user, userTokenOrProvider);
@@ -24436,7 +24493,7 @@ var StreamChat = class _StreamChat extends ChatApi {
24436
24493
  return await setUserPromise;
24437
24494
  } catch (err) {
24438
24495
  if (this.setUserPromise === setUserPromise && this.userId === user.id) {
24439
- if (!this.persistUserOnConnectionFailure) {
24496
+ if (!this.config.getConfig("client")?.persistUserOnConnectionFailure) {
24440
24497
  this.disconnectUser();
24441
24498
  } else if (!isWSFailure(err)) {
24442
24499
  this.closeConnection();
@@ -24611,9 +24668,9 @@ var StreamChat = class _StreamChat extends ChatApi {
24611
24668
  * @returns A promise that resolves when the connection is set up.
24612
24669
  */
24613
24670
  this.connectAnonymousUser = () => {
24614
- if (this.node && !this.options.allowServerSideConnect) {
24671
+ if (this.node && !this.config.getConfig("client")?.allowServerSideConnect) {
24615
24672
  logger19.withExtraTags("connectAnonymousUser").warn(
24616
- 'Do not use connectUser server-side. connectUser impacts MAU and concurrent connection usage, and therefore your bill. If you have a valid use case, set "allowServerSideConnect: true" in the client options to disable this warning.'
24673
+ "Do not use connectUser server-side. connectUser impacts MAU and concurrent connection usage, and therefore your bill. If you have a valid use case, set `client.allowServerSideConnect: true` in the client configuration to disable this warning."
24617
24674
  );
24618
24675
  }
24619
24676
  const anonymousUser = {
@@ -24819,7 +24876,7 @@ var StreamChat = class _StreamChat extends ChatApi {
24819
24876
  return this.userAgent;
24820
24877
  }
24821
24878
  if (!this.cachedUserAgent) {
24822
- const version = "10.0.0-rc.21";
24879
+ const version = "10.0.0-rc.22";
24823
24880
  const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
24824
24881
  const { name: appName, version: appVersion } = this.appIdentifier ?? {};
24825
24882
  const { os, model: deviceModel } = this.deviceIdentifier ?? {};
@@ -24870,6 +24927,8 @@ var StreamChat = class _StreamChat extends ChatApi {
24870
24927
  });
24871
24928
  this.apiClient.client = this;
24872
24929
  this.key = key;
24930
+ if (config) this.config.set(config);
24931
+ const clientConfig = this.config.getConfig("client");
24873
24932
  this.listeners = /* @__PURE__ */ new Map();
24874
24933
  this.state = new ClientState({ client: this });
24875
24934
  this.mutedChannels = [];
@@ -24881,18 +24940,15 @@ var StreamChat = class _StreamChat extends ChatApi {
24881
24940
  });
24882
24941
  this.blockedUsers = new StateStore29({ userIds: [] });
24883
24942
  this.moderation = new Moderation(this);
24884
- this.notifications = options?.notifications ?? new NotificationManager();
24943
+ this.notifications = clientConfig?.notificationManager ?? new NotificationManager();
24885
24944
  this.uploadManager = new UploadManager(this);
24886
- this.browser = options.browser ?? typeof window !== "undefined";
24887
- this.node = !this.browser;
24888
- this.options = { ...options };
24889
24945
  this.axiosInstance = axios3.create({
24890
24946
  timeout: 3e3,
24891
24947
  withCredentials: false,
24892
- ...this.options.axiosRequestConfig,
24948
+ ...clientConfig?.axiosRequestConfig,
24893
24949
  paramsSerializer: axiosParamsSerializer
24894
24950
  });
24895
- this.setBaseURL(this.options.baseURL || "https://chat.stream-io-api.com");
24951
+ this.setBaseURL(clientConfig?.baseURL || "https://chat.stream-io-api.com");
24896
24952
  const streamLocalTestRun = getEnv("STREAM_LOCAL_TEST_RUN");
24897
24953
  const streamLocalTestHost = getEnv("STREAM_LOCAL_TEST_HOST");
24898
24954
  if (streamLocalTestRun) {
@@ -24908,7 +24964,6 @@ var StreamChat = class _StreamChat extends ChatApi {
24908
24964
  this.wsConnection.registerSubscriptions();
24909
24965
  this.wsPromise = null;
24910
24966
  this.setUserPromise = null;
24911
- this.persistUserOnConnectionFailure = this.options?.persistUserOnConnectionFailure;
24912
24967
  this.tokenManager = new TokenManager();
24913
24968
  this.messageStore = new EntityStore({
24914
24969
  getEntityId: (message) => message.id
@@ -24925,9 +24980,18 @@ var StreamChat = class _StreamChat extends ChatApi {
24925
24980
  heldBy: () => this.messageComposerCache.values().map((composer) => composer.channel),
24926
24981
  name: "message-composer-cache"
24927
24982
  });
24928
- if (this.options.config) this.config.set(this.options.config);
24929
24983
  this.wireClientConfiguration();
24930
24984
  }
24985
+ /**
24986
+ * Whether the client runs in a browser. `client.browser` in the configuration when set, otherwise
24987
+ * whether a global `window` exists.
24988
+ */
24989
+ get browser() {
24990
+ return this.config.getConfig("client")?.browser ?? typeof window !== "undefined";
24991
+ }
24992
+ get node() {
24993
+ return !this.browser;
24994
+ }
24931
24995
  get anonymous() {
24932
24996
  return this.tokenManager.isAnonymous;
24933
24997
  }
@@ -25032,23 +25096,21 @@ var StreamChat = class _StreamChat extends ChatApi {
25032
25096
  *
25033
25097
  * This function always returns the same client instance to avoid issues raised by multiple client and WS connections.
25034
25098
  *
25035
- * **After the first call, the client configuration will not change if the key or options parameters change.**
25099
+ * **After the first call, the client configuration will not change if the key or config parameters change.**
25036
25100
  *
25037
25101
  * @example <caption>initialize the client in user mode</caption>
25038
25102
  * StreamChat.getInstance('api_key')
25039
- * @example <caption>initialize the client with options</caption>
25040
- * StreamChat.getInstance('api_key', { axiosRequestConfig: { timeout: 5000 } })
25103
+ * @example <caption>initialize the client with configuration</caption>
25104
+ * StreamChat.getInstance('api_key', { client: { axiosRequestConfig: { timeout: 5000 } } })
25041
25105
  *
25042
25106
  * @param key - The API key.
25043
- * @param options - Additional options (optional).
25044
- * @param options.browser - Enforce the client to be in browser mode (optional).
25045
- * @param options.axiosRequestConfig - Axios-level request configuration such as `timeout`,
25046
- * `headers` or `httpsAgent`, spread into the client's axios instance (optional).
25107
+ * @param config - Declarative configuration, as for the constructor (optional). Ignored once the
25108
+ * instance exists.
25047
25109
  * @returns The shared client instance.
25048
25110
  */
25049
- static getInstance(key, options) {
25111
+ static getInstance(key, config) {
25050
25112
  if (!_StreamChat._instance) {
25051
- _StreamChat._instance = new _StreamChat(key, options);
25113
+ _StreamChat._instance = new _StreamChat(key, config);
25052
25114
  }
25053
25115
  return _StreamChat._instance;
25054
25116
  }
@@ -26234,6 +26296,26 @@ var WS_CONNECTION_FIELDS = {
26234
26296
  }
26235
26297
  };
26236
26298
  var CLIENT_FIELDS = {
26299
+ allowServerSideConnect: {
26300
+ description: "Silences the warning logged when `connectUser` is called server-side, where a connection counts towards MAU and concurrent-connection billing. Was `StreamChatOptions.allowServerSideConnect`.",
26301
+ kind: "value",
26302
+ type: "boolean"
26303
+ },
26304
+ axiosRequestConfig: {
26305
+ description: "Axios-level request configuration \u2014 `timeout`, `headers`, `httpsAgent` and so on. Built into the client's axios instance at construction; `headers` and `params` are also read on every request. Was `StreamChatOptions.axiosRequestConfig`.",
26306
+ kind: "value",
26307
+ type: "object"
26308
+ },
26309
+ baseURL: {
26310
+ description: "Base URL of the API, such as `https://chat-proxy-dublin.stream-io-api.com`. Read at construction. Was `StreamChatOptions.baseURL`.",
26311
+ kind: "value",
26312
+ type: "string"
26313
+ },
26314
+ browser: {
26315
+ description: "Enforces browser (`true`) or Node (`false`) mode; detected from the global `window` when absent. Read live, through `client.browser` and `client.node`. Was `StreamChatOptions.browser`.",
26316
+ kind: "value",
26317
+ type: "boolean"
26318
+ },
26237
26319
  connectionRecovery: {
26238
26320
  description: "Bringing the channels, lists and threads you are reading back in line after a reconnect.",
26239
26321
  fields: CONNECTION_RECOVERY_FIELDS,
@@ -26249,11 +26331,21 @@ var CLIENT_FIELDS = {
26249
26331
  fields: NETWORK_CONNECTION_FIELDS,
26250
26332
  kind: "group"
26251
26333
  },
26334
+ notificationManager: {
26335
+ description: "A pre-built `NotificationManager` to use instead of the client constructing its own, to share one between clients or hand over one that already holds notifications. Read at construction. Was `StreamChatOptions.notifications`.",
26336
+ kind: "value",
26337
+ type: "object"
26338
+ },
26252
26339
  notifications: {
26253
26340
  description: "The client-wide notification (toast) manager.",
26254
26341
  fields: NOTIFICATION_FIELDS,
26255
26342
  kind: "group"
26256
26343
  },
26344
+ persistUserOnConnectionFailure: {
26345
+ description: "Keeps the user on the client when `connectUser` fails, so an application working offline keeps `client.user` and need not call `connectUser` again to retry. Read when a connect fails. Was `StreamChatOptions.persistUserOnConnectionFailure`.",
26346
+ kind: "value",
26347
+ type: "boolean"
26348
+ },
26257
26349
  reminders: {
26258
26350
  description: "Message reminders and their scheduling offsets.",
26259
26351
  fields: REMINDER_FIELDS,
@@ -26489,7 +26581,7 @@ var OfflineError = class extends Error {
26489
26581
  };
26490
26582
 
26491
26583
  // src/offline-support/offline_sync_manager.ts
26492
- import { isAxiosError } from "axios";
26584
+ import { isAxiosError as isAxiosError2 } from "axios";
26493
26585
  var logger20 = chatLoggerSystem.getLogger("offline-db");
26494
26586
  var OfflineDBSyncManager = class {
26495
26587
  constructor({
@@ -26645,7 +26737,7 @@ var OfflineDBSyncManager = class {
26645
26737
  });
26646
26738
  } catch (e) {
26647
26739
  logger20.withExtraTags("syncAndExecutePendingTasks").error("An error occurred while syncing the database.", { error: e });
26648
- if (isAxiosError(e) && e.code === "ECONNABORTED") {
26740
+ if (isAxiosError2(e) && e.code === "ECONNABORTED") {
26649
26741
  return;
26650
26742
  }
26651
26743
  const error = e;