stream-chat 9.12.0 → 9.13.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/dist/cjs/index.browser.cjs +41 -3
- package/dist/cjs/index.browser.cjs.map +3 -3
- package/dist/cjs/index.node.cjs +42 -3
- package/dist/cjs/index.node.cjs.map +3 -3
- package/dist/esm/index.js +41 -3
- package/dist/esm/index.js.map +3 -3
- package/dist/types/client.d.ts +8 -1
- package/dist/types/types.d.ts +14 -0
- package/package.json +1 -1
- package/src/channel_manager.ts +18 -2
- package/src/client.ts +13 -0
- package/src/offline-support/offline_sync_manager.ts +16 -0
- package/src/types.ts +17 -0
|
@@ -217,6 +217,7 @@ __export(index_exports, {
|
|
|
217
217
|
PollComposerCompositionMiddlewareExecutor: () => PollComposerCompositionMiddlewareExecutor,
|
|
218
218
|
PollComposerStateMiddlewareExecutor: () => PollComposerStateMiddlewareExecutor,
|
|
219
219
|
PollManager: () => PollManager,
|
|
220
|
+
Product: () => Product,
|
|
220
221
|
Reminder: () => Reminder,
|
|
221
222
|
ReminderManager: () => ReminderManager,
|
|
222
223
|
ReminderPaginator: () => ReminderPaginator,
|
|
@@ -5748,6 +5749,13 @@ var PollComposerStateMiddlewareExecutor = class extends MiddlewareExecutor {
|
|
|
5748
5749
|
};
|
|
5749
5750
|
|
|
5750
5751
|
// src/types.ts
|
|
5752
|
+
var Product = /* @__PURE__ */ ((Product2) => {
|
|
5753
|
+
Product2["Chat"] = "chat";
|
|
5754
|
+
Product2["Video"] = "video";
|
|
5755
|
+
Product2["Moderation"] = "moderation";
|
|
5756
|
+
Product2["Feeds"] = "feeds";
|
|
5757
|
+
return Product2;
|
|
5758
|
+
})(Product || {});
|
|
5751
5759
|
var ErrorFromResponse = class extends Error {
|
|
5752
5760
|
constructor(message, {
|
|
5753
5761
|
code,
|
|
@@ -12605,7 +12613,16 @@ var ChannelManager = class extends WithSubscriptions {
|
|
|
12605
12613
|
const wrappedError = new Error(
|
|
12606
12614
|
`Maximum number of retries reached in queryChannels. Last error message is: ${err}`
|
|
12607
12615
|
);
|
|
12608
|
-
this.state.
|
|
12616
|
+
const state = this.state.getLatestValue();
|
|
12617
|
+
const isOfflineSupportEnabledWithChannels = this.client.offlineDb && state.channels.length > 0;
|
|
12618
|
+
this.state.partialNext({
|
|
12619
|
+
error: isOfflineSupportEnabledWithChannels ? void 0 : wrappedError,
|
|
12620
|
+
pagination: {
|
|
12621
|
+
...state.pagination,
|
|
12622
|
+
isLoading: false,
|
|
12623
|
+
isLoadingNext: false
|
|
12624
|
+
}
|
|
12625
|
+
});
|
|
12609
12626
|
return;
|
|
12610
12627
|
}
|
|
12611
12628
|
await sleep(DEFAULT_QUERY_CHANNELS_MS_BETWEEN_RETRIES);
|
|
@@ -12710,7 +12727,11 @@ var ChannelManager = class extends WithSubscriptions {
|
|
|
12710
12727
|
this.client.logger("error", error.message);
|
|
12711
12728
|
this.state.next((currentState) => ({
|
|
12712
12729
|
...currentState,
|
|
12713
|
-
pagination: {
|
|
12730
|
+
pagination: {
|
|
12731
|
+
...currentState.pagination,
|
|
12732
|
+
isLoadingNext: false,
|
|
12733
|
+
isLoading: false
|
|
12734
|
+
}
|
|
12714
12735
|
}));
|
|
12715
12736
|
throw error;
|
|
12716
12737
|
}
|
|
@@ -14962,6 +14983,16 @@ var StreamChat = class _StreamChat {
|
|
|
14962
14983
|
endpoints: endpoints ? endpoints.join(",") : void 0
|
|
14963
14984
|
});
|
|
14964
14985
|
}
|
|
14986
|
+
/**
|
|
14987
|
+
* getHookEvents - Get available events for hooks (webhook, SQS, and SNS)
|
|
14988
|
+
*
|
|
14989
|
+
* @param {Product[]} [products] Optional array of products to filter events by (e.g., [Product.Chat, Product.Video])
|
|
14990
|
+
* @returns {Promise<GetHookEventsResponse>} Response containing available hook events
|
|
14991
|
+
*/
|
|
14992
|
+
async getHookEvents(products) {
|
|
14993
|
+
const params = products && products.length > 0 ? { product: products.join(",") } : {};
|
|
14994
|
+
return await this.get(this.baseURL + "/hook/events", params);
|
|
14995
|
+
}
|
|
14965
14996
|
_addChannelConfig({ cid, config }) {
|
|
14966
14997
|
if (this._cacheEnabled()) {
|
|
14967
14998
|
this.configs[cid] = config;
|
|
@@ -15743,7 +15774,7 @@ var StreamChat = class _StreamChat {
|
|
|
15743
15774
|
if (this.userAgent) {
|
|
15744
15775
|
return this.userAgent;
|
|
15745
15776
|
}
|
|
15746
|
-
const version = "9.
|
|
15777
|
+
const version = "9.13.0";
|
|
15747
15778
|
const clientBundle = "browser-cjs";
|
|
15748
15779
|
let userAgentString = "";
|
|
15749
15780
|
if (this.sdkIdentifier) {
|
|
@@ -17180,6 +17211,13 @@ var OfflineDBSyncManager = class {
|
|
|
17180
17211
|
});
|
|
17181
17212
|
} catch (e) {
|
|
17182
17213
|
console.log("An error has occurred while syncing the DB.", e);
|
|
17214
|
+
if (isAxiosError2(e) && e.code === "ECONNABORTED") {
|
|
17215
|
+
return;
|
|
17216
|
+
}
|
|
17217
|
+
const error = e;
|
|
17218
|
+
if (error.response?.data?.code === 23) {
|
|
17219
|
+
return;
|
|
17220
|
+
}
|
|
17183
17221
|
await this.offlineDb.resetDB();
|
|
17184
17222
|
}
|
|
17185
17223
|
};
|