@connectedxm/client 7.2.10 → 7.2.12
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/index.d.ts +23 -3
- package/dist/index.js +84 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2504,12 +2504,14 @@ interface BaseStreamInput {
|
|
|
2504
2504
|
locale: string;
|
|
2505
2505
|
cloudflareId: string;
|
|
2506
2506
|
webRTC: boolean;
|
|
2507
|
+
webRTCPlaybackUrl: string | null;
|
|
2507
2508
|
}
|
|
2508
2509
|
interface StreamInput extends BaseStreamInput {
|
|
2509
2510
|
eventId: string | null;
|
|
2510
2511
|
groupId: string | null;
|
|
2511
2512
|
sessionId: string | null;
|
|
2512
2513
|
meetingId: string | null;
|
|
2514
|
+
activityId: string | null;
|
|
2513
2515
|
}
|
|
2514
2516
|
|
|
2515
2517
|
interface ClientApiParams {
|
|
@@ -4105,9 +4107,27 @@ interface CreateInterestParams extends MutationParams {
|
|
|
4105
4107
|
declare const CreateInterest: ({ interest, clientApiParams, }: CreateInterestParams) => Promise<ConnectedXMResponse<Interest>>;
|
|
4106
4108
|
declare const useCreateInterest: (options?: Omit<MutationOptions<Awaited<ReturnType<typeof CreateInterest>>, Omit<CreateInterestParams, "queryClient" | "clientApiParams">>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectedXMResponse<Interest>, axios.AxiosError<ConnectedXMResponse<Interest>, any>, Omit<CreateInterestParams, "queryClient" | "clientApiParams">, unknown>;
|
|
4107
4109
|
|
|
4108
|
-
interface
|
|
4110
|
+
interface WSChatMessageCreated {
|
|
4111
|
+
type: "chat.message.created";
|
|
4112
|
+
timestamp: number;
|
|
4113
|
+
body: {
|
|
4114
|
+
channelId: number;
|
|
4115
|
+
message: ChatChannelMessage;
|
|
4116
|
+
};
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
interface WSChatMessageDeleted {
|
|
4120
|
+
type: "chat.message.deleted";
|
|
4121
|
+
timestamp: number;
|
|
4122
|
+
body: {
|
|
4123
|
+
channelId: number;
|
|
4124
|
+
messageId: number;
|
|
4125
|
+
};
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
interface WSChatMessageUpdated {
|
|
4129
|
+
type: "chat.message.updated";
|
|
4109
4130
|
timestamp: number;
|
|
4110
|
-
type: "new-message";
|
|
4111
4131
|
body: {
|
|
4112
4132
|
channelId: number;
|
|
4113
4133
|
message: ChatChannelMessage;
|
|
@@ -4202,7 +4222,7 @@ interface HeartbeatMessage {
|
|
|
4202
4222
|
type: "heartbeat";
|
|
4203
4223
|
}
|
|
4204
4224
|
type SendWSMessage = StreamConnectMessage | StreamDisconnectMessage | HeartbeatMessage;
|
|
4205
|
-
type ReceivedWSMessage =
|
|
4225
|
+
type ReceivedWSMessage = WSChatMessageCreated | WSChatMessageDeleted | WSChatMessageUpdated | WSThreadMessageCreated | WSThreadMessageUpdated | WSThreadMessageDeleted | WSStreamChatCreated | WSStreamChatDeleted | WSStreamChatUpdated | WSStreamConnected | WSStreamDisconnected | WSPulseMessage;
|
|
4206
4226
|
|
|
4207
4227
|
interface ConnectedXMClientContextState {
|
|
4208
4228
|
queryClient: QueryClient;
|
package/dist/index.js
CHANGED
|
@@ -7624,21 +7624,77 @@ var useGetSupportTicketActivityLog = (supportTicketId = "", params = {}, options
|
|
|
7624
7624
|
);
|
|
7625
7625
|
};
|
|
7626
7626
|
|
|
7627
|
-
// src/websockets/chat/
|
|
7628
|
-
var
|
|
7627
|
+
// src/websockets/chat/ChatMessageCreated.ts
|
|
7628
|
+
var ChatMessageCreated = (queryClient, locale, message) => {
|
|
7629
7629
|
const QueryKey4 = [
|
|
7630
7630
|
...SELF_CHAT_CHANNEL_MESSAGES_QUERY_KEY(message.body.channelId.toString()),
|
|
7631
7631
|
...GetBaseInfiniteQueryKeys(locale || "en")
|
|
7632
7632
|
];
|
|
7633
7633
|
const existingMessages = queryClient.getQueryData(QueryKey4);
|
|
7634
7634
|
const exists = existingMessages ? MergeInfinitePages(existingMessages).find(
|
|
7635
|
-
(
|
|
7635
|
+
(msg) => msg.id === message.body.message.id
|
|
7636
7636
|
) : false;
|
|
7637
7637
|
if (!exists) {
|
|
7638
7638
|
AppendInfiniteQuery(queryClient, QueryKey4, message.body.message);
|
|
7639
7639
|
}
|
|
7640
7640
|
};
|
|
7641
|
-
var
|
|
7641
|
+
var ChatMessageCreated_default = ChatMessageCreated;
|
|
7642
|
+
|
|
7643
|
+
// src/websockets/chat/ChatMessageDeleted.ts
|
|
7644
|
+
import { produce as produce2 } from "immer";
|
|
7645
|
+
var ChatMessageDeleted = (queryClient, locale, message) => {
|
|
7646
|
+
const QueryKey4 = [
|
|
7647
|
+
...SELF_CHAT_CHANNEL_MESSAGES_QUERY_KEY(message.body.channelId.toString()),
|
|
7648
|
+
...GetBaseInfiniteQueryKeys(locale || "en")
|
|
7649
|
+
];
|
|
7650
|
+
queryClient.setQueryData(
|
|
7651
|
+
QueryKey4,
|
|
7652
|
+
(oldData) => {
|
|
7653
|
+
return produce2(oldData, (draft) => {
|
|
7654
|
+
if (draft?.pages) {
|
|
7655
|
+
for (const page of draft.pages) {
|
|
7656
|
+
if (page?.data) {
|
|
7657
|
+
page.data = page.data.filter(
|
|
7658
|
+
(msg) => msg.id !== message.body.messageId
|
|
7659
|
+
);
|
|
7660
|
+
}
|
|
7661
|
+
}
|
|
7662
|
+
}
|
|
7663
|
+
});
|
|
7664
|
+
}
|
|
7665
|
+
);
|
|
7666
|
+
};
|
|
7667
|
+
var ChatMessageDeleted_default = ChatMessageDeleted;
|
|
7668
|
+
|
|
7669
|
+
// src/websockets/chat/ChatMessageUpdated.ts
|
|
7670
|
+
import { produce as produce3 } from "immer";
|
|
7671
|
+
var ChatMessageUpdated = (queryClient, locale, message) => {
|
|
7672
|
+
const QueryKey4 = [
|
|
7673
|
+
...SELF_CHAT_CHANNEL_MESSAGES_QUERY_KEY(message.body.channelId.toString()),
|
|
7674
|
+
...GetBaseInfiniteQueryKeys(locale || "en")
|
|
7675
|
+
];
|
|
7676
|
+
queryClient.setQueryData(
|
|
7677
|
+
QueryKey4,
|
|
7678
|
+
(oldData) => {
|
|
7679
|
+
return produce3(oldData, (draft) => {
|
|
7680
|
+
if (draft?.pages) {
|
|
7681
|
+
for (const page of draft.pages) {
|
|
7682
|
+
if (page?.data) {
|
|
7683
|
+
const index = page.data.findIndex(
|
|
7684
|
+
(msg) => msg.id === message.body.message.id
|
|
7685
|
+
);
|
|
7686
|
+
if (index !== -1) {
|
|
7687
|
+
page.data[index] = message.body.message;
|
|
7688
|
+
break;
|
|
7689
|
+
}
|
|
7690
|
+
}
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
});
|
|
7694
|
+
}
|
|
7695
|
+
);
|
|
7696
|
+
};
|
|
7697
|
+
var ChatMessageUpdated_default = ChatMessageUpdated;
|
|
7642
7698
|
|
|
7643
7699
|
// src/websockets/threads/messages/ThreadMessageCreated.ts
|
|
7644
7700
|
var ThreadMessageCreated = (_queryClient, _locale, _message) => {
|
|
@@ -7678,7 +7734,7 @@ var StreamChatCreated = (queryClient, locale, message) => {
|
|
|
7678
7734
|
var StreamChatCreated_default = StreamChatCreated;
|
|
7679
7735
|
|
|
7680
7736
|
// src/websockets/stream/StreamChatDeleted.ts
|
|
7681
|
-
import { produce as
|
|
7737
|
+
import { produce as produce4 } from "immer";
|
|
7682
7738
|
var StreamChatDeleted = (queryClient, locale, message) => {
|
|
7683
7739
|
const QueryKey4 = [
|
|
7684
7740
|
...STREAM_CHAT_MESSAGES_QUERY_KEY(
|
|
@@ -7690,7 +7746,7 @@ var StreamChatDeleted = (queryClient, locale, message) => {
|
|
|
7690
7746
|
queryClient.setQueryData(
|
|
7691
7747
|
QueryKey4,
|
|
7692
7748
|
(oldData) => {
|
|
7693
|
-
return
|
|
7749
|
+
return produce4(oldData, (draft) => {
|
|
7694
7750
|
if (draft?.pages) {
|
|
7695
7751
|
for (const page of draft.pages) {
|
|
7696
7752
|
if (page?.data) {
|
|
@@ -7707,7 +7763,7 @@ var StreamChatDeleted = (queryClient, locale, message) => {
|
|
|
7707
7763
|
var StreamChatDeleted_default = StreamChatDeleted;
|
|
7708
7764
|
|
|
7709
7765
|
// src/websockets/stream/StreamChatUpdated.ts
|
|
7710
|
-
import { produce as
|
|
7766
|
+
import { produce as produce5 } from "immer";
|
|
7711
7767
|
var StreamChatUpdated = (queryClient, locale, message) => {
|
|
7712
7768
|
const QueryKey4 = [
|
|
7713
7769
|
...STREAM_CHAT_MESSAGES_QUERY_KEY(
|
|
@@ -7719,7 +7775,7 @@ var StreamChatUpdated = (queryClient, locale, message) => {
|
|
|
7719
7775
|
queryClient.setQueryData(
|
|
7720
7776
|
QueryKey4,
|
|
7721
7777
|
(oldData) => {
|
|
7722
|
-
return
|
|
7778
|
+
return produce5(oldData, (draft) => {
|
|
7723
7779
|
if (draft?.pages) {
|
|
7724
7780
|
for (const page of draft.pages) {
|
|
7725
7781
|
if (page?.data) {
|
|
@@ -7823,8 +7879,12 @@ var useConnectedWebsocket = (useWebSocket, {
|
|
|
7823
7879
|
};
|
|
7824
7880
|
React.useEffect(() => {
|
|
7825
7881
|
if (!lastWSMessage) return;
|
|
7826
|
-
if (lastWSMessage.type === "
|
|
7827
|
-
|
|
7882
|
+
if (lastWSMessage.type === "chat.message.created") {
|
|
7883
|
+
ChatMessageCreated_default(queryClient, locale, lastWSMessage);
|
|
7884
|
+
} else if (lastWSMessage.type === "chat.message.deleted") {
|
|
7885
|
+
ChatMessageDeleted_default(queryClient, locale, lastWSMessage);
|
|
7886
|
+
} else if (lastWSMessage.type === "chat.message.updated") {
|
|
7887
|
+
ChatMessageUpdated_default(queryClient, locale, lastWSMessage);
|
|
7828
7888
|
} else if (lastWSMessage.type === "thread.message.created") {
|
|
7829
7889
|
ThreadMessageCreated_default(queryClient, locale, lastWSMessage);
|
|
7830
7890
|
} else if (lastWSMessage.type === "thread.message.updated") {
|
|
@@ -8407,7 +8467,7 @@ var useConnectedMutation = (mutation, options) => {
|
|
|
8407
8467
|
var useConnectedMutation_default = useConnectedMutation;
|
|
8408
8468
|
|
|
8409
8469
|
// src/mutations/accounts/useFollowAccount.ts
|
|
8410
|
-
import { produce as
|
|
8470
|
+
import { produce as produce6 } from "immer";
|
|
8411
8471
|
var FollowAccount = async ({
|
|
8412
8472
|
accountId,
|
|
8413
8473
|
clientApiParams,
|
|
@@ -8420,7 +8480,7 @@ var FollowAccount = async ({
|
|
|
8420
8480
|
if (queryClient && data.status === "ok") {
|
|
8421
8481
|
queryClient.setQueryData(
|
|
8422
8482
|
[...ACCOUNT_FOLLOW_STATS_QUERY_KEY(data.data.id), clientApiParams.locale],
|
|
8423
|
-
(prev) =>
|
|
8483
|
+
(prev) => produce6(prev, (data2) => {
|
|
8424
8484
|
if (data2?.data) {
|
|
8425
8485
|
data2.data.followers = data2.data.followers + 1;
|
|
8426
8486
|
}
|
|
@@ -8431,7 +8491,7 @@ var FollowAccount = async ({
|
|
|
8431
8491
|
...ACCOUNT_FOLLOW_STATS_QUERY_KEY(data.data.username),
|
|
8432
8492
|
clientApiParams.locale
|
|
8433
8493
|
],
|
|
8434
|
-
(prev) =>
|
|
8494
|
+
(prev) => produce6(prev, (data2) => {
|
|
8435
8495
|
if (data2?.data) {
|
|
8436
8496
|
data2.data.followers = data2.data.followers + 1;
|
|
8437
8497
|
}
|
|
@@ -8454,7 +8514,7 @@ var useFollowAccount = (options = {}) => {
|
|
|
8454
8514
|
};
|
|
8455
8515
|
|
|
8456
8516
|
// src/mutations/accounts/useUnfollowAccount.ts
|
|
8457
|
-
import { produce as
|
|
8517
|
+
import { produce as produce7 } from "immer";
|
|
8458
8518
|
var UnfollowAccount = async ({
|
|
8459
8519
|
accountId,
|
|
8460
8520
|
clientApiParams,
|
|
@@ -8467,7 +8527,7 @@ var UnfollowAccount = async ({
|
|
|
8467
8527
|
if (queryClient && data.status === "ok") {
|
|
8468
8528
|
queryClient.setQueryData(
|
|
8469
8529
|
[...ACCOUNT_FOLLOW_STATS_QUERY_KEY(data.data.id), clientApiParams.locale],
|
|
8470
|
-
(prev) =>
|
|
8530
|
+
(prev) => produce7(prev, (data2) => {
|
|
8471
8531
|
if (data2?.data) {
|
|
8472
8532
|
data2.data.followers = data2.data.followers - 1;
|
|
8473
8533
|
}
|
|
@@ -8478,7 +8538,7 @@ var UnfollowAccount = async ({
|
|
|
8478
8538
|
...ACCOUNT_FOLLOW_STATS_QUERY_KEY(data.data.username),
|
|
8479
8539
|
clientApiParams.locale
|
|
8480
8540
|
],
|
|
8481
|
-
(prev) =>
|
|
8541
|
+
(prev) => produce7(prev, (data2) => {
|
|
8482
8542
|
if (data2?.data) {
|
|
8483
8543
|
data2.data.followers = data2.data.followers - 1;
|
|
8484
8544
|
}
|
|
@@ -8549,11 +8609,11 @@ var useUnblockAccount = (options = {}) => {
|
|
|
8549
8609
|
};
|
|
8550
8610
|
|
|
8551
8611
|
// src/mutations/activities/optimistic/UpdateComments.ts
|
|
8552
|
-
import { produce as
|
|
8612
|
+
import { produce as produce8 } from "immer";
|
|
8553
8613
|
var UpdateCommentsSingle = (increment, queryClient, KEY) => {
|
|
8554
8614
|
queryClient.setQueryData(
|
|
8555
8615
|
KEY,
|
|
8556
|
-
(originalData) =>
|
|
8616
|
+
(originalData) => produce8(originalData, (draft) => {
|
|
8557
8617
|
if (!draft?.data) {
|
|
8558
8618
|
return;
|
|
8559
8619
|
}
|
|
@@ -8565,7 +8625,7 @@ var UpdateCommentsSingle = (increment, queryClient, KEY) => {
|
|
|
8565
8625
|
var UpdateCommentsInfinite = (increment, queryClient, KEY, activityId) => {
|
|
8566
8626
|
queryClient.setQueriesData(
|
|
8567
8627
|
{ queryKey: KEY, exact: false },
|
|
8568
|
-
(originalData) =>
|
|
8628
|
+
(originalData) => produce8(originalData, (draft) => {
|
|
8569
8629
|
if (!draft?.pages || draft.pages.length === 0) {
|
|
8570
8630
|
return;
|
|
8571
8631
|
}
|
|
@@ -8749,11 +8809,11 @@ var useDeleteActivity = (options = {}) => {
|
|
|
8749
8809
|
};
|
|
8750
8810
|
|
|
8751
8811
|
// src/mutations/activities/optimistic/UpdateLikes.ts
|
|
8752
|
-
import { produce as
|
|
8812
|
+
import { produce as produce9 } from "immer";
|
|
8753
8813
|
var UpdateLikesSingle = (increment, queryClient, KEY) => {
|
|
8754
8814
|
queryClient.setQueryData(
|
|
8755
8815
|
KEY,
|
|
8756
|
-
(originalData) =>
|
|
8816
|
+
(originalData) => produce9(originalData, (draft) => {
|
|
8757
8817
|
if (!draft?.data) {
|
|
8758
8818
|
return;
|
|
8759
8819
|
}
|
|
@@ -8765,7 +8825,7 @@ var UpdateLikesSingle = (increment, queryClient, KEY) => {
|
|
|
8765
8825
|
var UpdateLikesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
8766
8826
|
queryClient.setQueriesData(
|
|
8767
8827
|
{ queryKey: KEY, exact: false },
|
|
8768
|
-
(originalData) =>
|
|
8828
|
+
(originalData) => produce9(originalData, (draft) => {
|
|
8769
8829
|
if (!draft?.pages || draft.pages.length === 0) {
|
|
8770
8830
|
return;
|
|
8771
8831
|
}
|
|
@@ -12258,7 +12318,7 @@ var useCreateStreamChatMessage = (options = {}) => {
|
|
|
12258
12318
|
};
|
|
12259
12319
|
|
|
12260
12320
|
// src/mutations/streams/useUpdateStreamChatMessage.ts
|
|
12261
|
-
import { produce as
|
|
12321
|
+
import { produce as produce10 } from "immer";
|
|
12262
12322
|
var UpdateStreamChatMessage = async ({
|
|
12263
12323
|
streamId,
|
|
12264
12324
|
sessionId,
|
|
@@ -12282,7 +12342,7 @@ var UpdateStreamChatMessage = async ({
|
|
|
12282
12342
|
queryClient.setQueryData(
|
|
12283
12343
|
QueryKey4,
|
|
12284
12344
|
(oldData) => {
|
|
12285
|
-
return
|
|
12345
|
+
return produce10(oldData, (draft) => {
|
|
12286
12346
|
if (draft?.pages) {
|
|
12287
12347
|
for (const page of draft.pages) {
|
|
12288
12348
|
if (page?.data) {
|