@connectedxm/client 0.1.9 → 0.1.24
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.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +139 -395
- package/dist/index.mjs +139 -395
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4890,58 +4890,36 @@ var useUnfollowAccount = (options = {}) => {
|
|
|
4890
4890
|
};
|
|
4891
4891
|
|
|
4892
4892
|
// src/mutations/activities/optimistic/UpdateReshares.ts
|
|
4893
|
+
var import_immer2 = require("immer");
|
|
4893
4894
|
var UpdateResharesSingle = (increment, queryClient, KEY) => {
|
|
4894
|
-
queryClient.setQueryData(
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
...data._count,
|
|
4905
|
-
reshares: increment ? data._count.reshares + 1 : data._count.reshares - 1
|
|
4906
|
-
},
|
|
4907
|
-
reshares: increment ? [{}] : void 0
|
|
4908
|
-
}
|
|
4909
|
-
};
|
|
4910
|
-
}
|
|
4911
|
-
});
|
|
4895
|
+
queryClient.setQueryData(
|
|
4896
|
+
KEY,
|
|
4897
|
+
(originalData) => (0, import_immer2.produce)(originalData, (draft) => {
|
|
4898
|
+
if (!draft?.data) {
|
|
4899
|
+
return;
|
|
4900
|
+
}
|
|
4901
|
+
draft.data._count.reshares += increment ? 1 : -1;
|
|
4902
|
+
draft.data.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4903
|
+
})
|
|
4904
|
+
);
|
|
4912
4905
|
};
|
|
4913
4906
|
var UpdateResharesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4914
|
-
queryClient.setQueriesData(
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
pageIndex = x;
|
|
4927
|
-
activityIndex = y;
|
|
4928
|
-
}
|
|
4929
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
4930
|
-
resharePageIndex = x;
|
|
4931
|
-
reshareActivityIndex = y;
|
|
4907
|
+
queryClient.setQueriesData(
|
|
4908
|
+
{ queryKey: KEY, exact: false },
|
|
4909
|
+
(originalData) => (0, import_immer2.produce)(originalData, (draft) => {
|
|
4910
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4911
|
+
return;
|
|
4912
|
+
}
|
|
4913
|
+
for (const page of draft.pages) {
|
|
4914
|
+
for (const activity of page.data) {
|
|
4915
|
+
if (activity.id === activityId) {
|
|
4916
|
+
activity._count.reshares += increment ? 1 : -1;
|
|
4917
|
+
activity.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4918
|
+
}
|
|
4932
4919
|
}
|
|
4933
4920
|
}
|
|
4934
|
-
}
|
|
4935
|
-
|
|
4936
|
-
pages[pageIndex].data[activityIndex]._count.reshares = increment ? pages?.[pageIndex]?.data[activityIndex]._count.reshares + 1 : pages?.[pageIndex]?.data[activityIndex]._count.reshares - 1;
|
|
4937
|
-
pages[pageIndex].data[activityIndex].reshares = increment ? [{}] : void 0;
|
|
4938
|
-
}
|
|
4939
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
4940
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.reshares = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares - 1;
|
|
4941
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.reshares = increment ? [{}] : void 0;
|
|
4942
|
-
}
|
|
4943
|
-
return { ...data, pages };
|
|
4944
|
-
});
|
|
4921
|
+
})
|
|
4922
|
+
);
|
|
4945
4923
|
};
|
|
4946
4924
|
|
|
4947
4925
|
// src/mutations/activities/useDeleteReshare.ts
|
|
@@ -4951,7 +4929,10 @@ var DeleteReshare = async ({
|
|
|
4951
4929
|
queryClient
|
|
4952
4930
|
}) => {
|
|
4953
4931
|
if (queryClient) {
|
|
4954
|
-
UpdateResharesSingle(false, queryClient,
|
|
4932
|
+
UpdateResharesSingle(false, queryClient, [
|
|
4933
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4934
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4935
|
+
]);
|
|
4955
4936
|
UpdateResharesInfinite(
|
|
4956
4937
|
false,
|
|
4957
4938
|
queryClient,
|
|
@@ -4970,58 +4951,36 @@ var useDeleteReshare = (options = {}) => {
|
|
|
4970
4951
|
};
|
|
4971
4952
|
|
|
4972
4953
|
// src/mutations/activities/optimistic/UpdateLikes.ts
|
|
4954
|
+
var import_immer3 = require("immer");
|
|
4973
4955
|
var UpdateLikesSingle = (increment, queryClient, KEY) => {
|
|
4974
|
-
queryClient.setQueryData(
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
...data._count,
|
|
4985
|
-
likes: increment ? data._count.likes + 1 : data._count.likes - 1
|
|
4986
|
-
},
|
|
4987
|
-
likes: increment ? [{}] : void 0
|
|
4988
|
-
}
|
|
4989
|
-
};
|
|
4990
|
-
}
|
|
4991
|
-
});
|
|
4956
|
+
queryClient.setQueryData(
|
|
4957
|
+
KEY,
|
|
4958
|
+
(originalData) => (0, import_immer3.produce)(originalData, (draft) => {
|
|
4959
|
+
if (!draft?.data) {
|
|
4960
|
+
return;
|
|
4961
|
+
}
|
|
4962
|
+
draft.data._count.likes += increment ? 1 : -1;
|
|
4963
|
+
draft.data.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4964
|
+
})
|
|
4965
|
+
);
|
|
4992
4966
|
};
|
|
4993
4967
|
var UpdateLikesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4994
|
-
queryClient.setQueriesData(
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
pageIndex = x;
|
|
5007
|
-
activityIndex = y;
|
|
5008
|
-
}
|
|
5009
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
5010
|
-
resharePageIndex = x;
|
|
5011
|
-
reshareActivityIndex = y;
|
|
4968
|
+
queryClient.setQueriesData(
|
|
4969
|
+
{ queryKey: KEY, exact: false },
|
|
4970
|
+
(originalData) => (0, import_immer3.produce)(originalData, (draft) => {
|
|
4971
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4974
|
+
for (const page of draft.pages) {
|
|
4975
|
+
for (const activity of page.data) {
|
|
4976
|
+
if (activity.id === activityId) {
|
|
4977
|
+
activity._count.likes += increment ? 1 : -1;
|
|
4978
|
+
activity.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4979
|
+
}
|
|
5012
4980
|
}
|
|
5013
4981
|
}
|
|
5014
|
-
}
|
|
5015
|
-
|
|
5016
|
-
pages[pageIndex].data[activityIndex]._count.likes = increment ? pages?.[pageIndex]?.data[activityIndex]._count.likes + 1 : pages?.[pageIndex]?.data[activityIndex]._count.likes - 1;
|
|
5017
|
-
pages[pageIndex].data[activityIndex].likes = increment ? [{}] : void 0;
|
|
5018
|
-
}
|
|
5019
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
5020
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.likes = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes - 1;
|
|
5021
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.likes = increment ? [{}] : void 0;
|
|
5022
|
-
}
|
|
5023
|
-
return { ...data, pages };
|
|
5024
|
-
});
|
|
4982
|
+
})
|
|
4983
|
+
);
|
|
5025
4984
|
};
|
|
5026
4985
|
|
|
5027
4986
|
// src/mutations/activities/useLikeActivity.ts
|
|
@@ -5031,7 +4990,10 @@ var LikeActivity = async ({
|
|
|
5031
4990
|
queryClient
|
|
5032
4991
|
}) => {
|
|
5033
4992
|
if (queryClient) {
|
|
5034
|
-
UpdateLikesSingle(true, queryClient,
|
|
4993
|
+
UpdateLikesSingle(true, queryClient, [
|
|
4994
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4995
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4996
|
+
]);
|
|
5035
4997
|
UpdateLikesInfinite(true, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
5036
4998
|
}
|
|
5037
4999
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -5051,7 +5013,10 @@ var ReshareActivity = async ({
|
|
|
5051
5013
|
clientApiParams
|
|
5052
5014
|
}) => {
|
|
5053
5015
|
if (queryClient) {
|
|
5054
|
-
UpdateResharesSingle(true, queryClient,
|
|
5016
|
+
UpdateResharesSingle(true, queryClient, [
|
|
5017
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
5018
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
5019
|
+
]);
|
|
5055
5020
|
UpdateResharesInfinite(
|
|
5056
5021
|
true,
|
|
5057
5022
|
queryClient,
|
|
@@ -5079,7 +5044,10 @@ var UnlikeActivity = async ({
|
|
|
5079
5044
|
queryClient
|
|
5080
5045
|
}) => {
|
|
5081
5046
|
if (queryClient) {
|
|
5082
|
-
UpdateLikesSingle(false, queryClient,
|
|
5047
|
+
UpdateLikesSingle(false, queryClient, [
|
|
5048
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
5049
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
5050
|
+
]);
|
|
5083
5051
|
UpdateLikesInfinite(false, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
5084
5052
|
}
|
|
5085
5053
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -6109,36 +6077,10 @@ var AddSelfEventListingSession = async ({
|
|
|
6109
6077
|
}
|
|
6110
6078
|
);
|
|
6111
6079
|
if (queryClient && data.status === "ok") {
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6117
|
-
if (event && event.data) {
|
|
6118
|
-
if (event.data?.sessions) {
|
|
6119
|
-
event.data.sessions.push(data.data);
|
|
6120
|
-
} else {
|
|
6121
|
-
event.data.sessions = [data.data];
|
|
6122
|
-
}
|
|
6123
|
-
}
|
|
6124
|
-
return event;
|
|
6125
|
-
}
|
|
6126
|
-
);
|
|
6127
|
-
queryClient.setQueryData(
|
|
6128
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6129
|
-
(oldData) => {
|
|
6130
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6131
|
-
if (event && event.data) {
|
|
6132
|
-
if (event.data?.sessions) {
|
|
6133
|
-
event.data.sessions.push(data.data);
|
|
6134
|
-
} else {
|
|
6135
|
-
event.data.sessions = [data.data];
|
|
6136
|
-
}
|
|
6137
|
-
}
|
|
6138
|
-
return event;
|
|
6139
|
-
}
|
|
6140
|
-
);
|
|
6141
|
-
}
|
|
6080
|
+
queryClient.invalidateQueries({
|
|
6081
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
6082
|
+
});
|
|
6083
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6142
6084
|
}
|
|
6143
6085
|
return data;
|
|
6144
6086
|
};
|
|
@@ -6161,36 +6103,10 @@ var AddSelfEventListingSpeaker = async ({
|
|
|
6161
6103
|
}
|
|
6162
6104
|
);
|
|
6163
6105
|
if (queryClient && data.status === "ok") {
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6169
|
-
if (event && event.data) {
|
|
6170
|
-
if (event.data?.speakers) {
|
|
6171
|
-
event.data.speakers.push(data.data);
|
|
6172
|
-
} else {
|
|
6173
|
-
event.data.speakers = [data.data];
|
|
6174
|
-
}
|
|
6175
|
-
}
|
|
6176
|
-
return event;
|
|
6177
|
-
}
|
|
6178
|
-
);
|
|
6179
|
-
queryClient.setQueryData(
|
|
6180
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6181
|
-
(oldData) => {
|
|
6182
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6183
|
-
if (event && event.data) {
|
|
6184
|
-
if (event.data?.speakers) {
|
|
6185
|
-
event.data.speakers.push(data.data);
|
|
6186
|
-
} else {
|
|
6187
|
-
event.data.speakers = [data.data];
|
|
6188
|
-
}
|
|
6189
|
-
}
|
|
6190
|
-
return event;
|
|
6191
|
-
}
|
|
6192
|
-
);
|
|
6193
|
-
}
|
|
6106
|
+
queryClient.invalidateQueries({
|
|
6107
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
6108
|
+
});
|
|
6109
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6194
6110
|
}
|
|
6195
6111
|
return data;
|
|
6196
6112
|
};
|
|
@@ -6205,36 +6121,6 @@ var AddSelfEventListingSponsor = async ({
|
|
|
6205
6121
|
clientApiParams,
|
|
6206
6122
|
queryClient
|
|
6207
6123
|
}) => {
|
|
6208
|
-
if (queryClient) {
|
|
6209
|
-
queryClient.setQueryData(
|
|
6210
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6211
|
-
(oldData) => {
|
|
6212
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6213
|
-
if (event && event.data) {
|
|
6214
|
-
if (event.data?.sponsors) {
|
|
6215
|
-
event.data.sponsors.push(sponsor);
|
|
6216
|
-
} else {
|
|
6217
|
-
event.data.sponsors = [sponsor];
|
|
6218
|
-
}
|
|
6219
|
-
}
|
|
6220
|
-
return event;
|
|
6221
|
-
}
|
|
6222
|
-
);
|
|
6223
|
-
queryClient.setQueryData(
|
|
6224
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6225
|
-
(oldData) => {
|
|
6226
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
6227
|
-
if (event && event.data) {
|
|
6228
|
-
if (event.data?.sponsors) {
|
|
6229
|
-
event.data.sponsors.push(sponsor);
|
|
6230
|
-
} else {
|
|
6231
|
-
event.data.sponsors = [sponsor];
|
|
6232
|
-
}
|
|
6233
|
-
}
|
|
6234
|
-
return event;
|
|
6235
|
-
}
|
|
6236
|
-
);
|
|
6237
|
-
}
|
|
6238
6124
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6239
6125
|
const { data } = await clientApi.post(
|
|
6240
6126
|
`/self/events/listings/${eventId}/sponsors`,
|
|
@@ -6242,6 +6128,12 @@ var AddSelfEventListingSponsor = async ({
|
|
|
6242
6128
|
sponsorId: sponsor.id
|
|
6243
6129
|
}
|
|
6244
6130
|
);
|
|
6131
|
+
if (queryClient && data.status === "ok") {
|
|
6132
|
+
queryClient.invalidateQueries({
|
|
6133
|
+
queryKey: EVENT_SPONSORS_QUERY_KEY(eventId)
|
|
6134
|
+
});
|
|
6135
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6136
|
+
}
|
|
6245
6137
|
return data;
|
|
6246
6138
|
};
|
|
6247
6139
|
var useAddSelfEventListingSponsor = (options = {}) => {
|
|
@@ -6414,40 +6306,16 @@ var RemoveSelfEventListingSession = async ({
|
|
|
6414
6306
|
clientApiParams,
|
|
6415
6307
|
queryClient
|
|
6416
6308
|
}) => {
|
|
6417
|
-
if (queryClient) {
|
|
6418
|
-
queryClient.setQueryData(
|
|
6419
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6420
|
-
(event) => {
|
|
6421
|
-
if (event && event.data) {
|
|
6422
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6423
|
-
(session) => session.id === sessionId
|
|
6424
|
-
);
|
|
6425
|
-
if (index !== -1 && event.data.sessions) {
|
|
6426
|
-
event.data.sessions.splice(index, 1);
|
|
6427
|
-
}
|
|
6428
|
-
}
|
|
6429
|
-
return event;
|
|
6430
|
-
}
|
|
6431
|
-
);
|
|
6432
|
-
queryClient.setQueryData(
|
|
6433
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6434
|
-
(event) => {
|
|
6435
|
-
if (event && event.data) {
|
|
6436
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6437
|
-
(session) => session.id === sessionId
|
|
6438
|
-
);
|
|
6439
|
-
if (index !== -1 && event.data.sessions) {
|
|
6440
|
-
event.data.sessions.splice(index, 1);
|
|
6441
|
-
}
|
|
6442
|
-
}
|
|
6443
|
-
return event;
|
|
6444
|
-
}
|
|
6445
|
-
);
|
|
6446
|
-
}
|
|
6447
6309
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6448
6310
|
const { data } = await clientApi.delete(
|
|
6449
6311
|
`/self/events/listings/${eventId}/sessions/${sessionId}`
|
|
6450
6312
|
);
|
|
6313
|
+
if (queryClient && data.status === "ok") {
|
|
6314
|
+
queryClient.invalidateQueries({
|
|
6315
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
6316
|
+
});
|
|
6317
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6318
|
+
}
|
|
6451
6319
|
return data;
|
|
6452
6320
|
};
|
|
6453
6321
|
var useRemoveSelfEventListingSession = (options = {}) => {
|
|
@@ -6461,40 +6329,16 @@ var RemoveSelfEventListingSpeaker = async ({
|
|
|
6461
6329
|
clientApiParams,
|
|
6462
6330
|
queryClient
|
|
6463
6331
|
}) => {
|
|
6464
|
-
if (queryClient) {
|
|
6465
|
-
queryClient.setQueryData(
|
|
6466
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6467
|
-
(event) => {
|
|
6468
|
-
if (event && event.data) {
|
|
6469
|
-
const index = event?.data?.speakers?.findIndex(
|
|
6470
|
-
(speaker) => speaker.id === speakerId
|
|
6471
|
-
);
|
|
6472
|
-
if (index !== -1 && event.data.speakers) {
|
|
6473
|
-
event.data.speakers.splice(index, 1);
|
|
6474
|
-
}
|
|
6475
|
-
}
|
|
6476
|
-
return event;
|
|
6477
|
-
}
|
|
6478
|
-
);
|
|
6479
|
-
queryClient.setQueryData(
|
|
6480
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6481
|
-
(event) => {
|
|
6482
|
-
if (event && event.data) {
|
|
6483
|
-
const index = event?.data?.speakers?.findIndex(
|
|
6484
|
-
(speaker) => speaker.id === speakerId
|
|
6485
|
-
);
|
|
6486
|
-
if (index !== -1 && event.data.speakers) {
|
|
6487
|
-
event.data.speakers.splice(index, 1);
|
|
6488
|
-
}
|
|
6489
|
-
}
|
|
6490
|
-
return event;
|
|
6491
|
-
}
|
|
6492
|
-
);
|
|
6493
|
-
}
|
|
6494
6332
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6495
6333
|
const { data } = await clientApi.delete(
|
|
6496
6334
|
`/self/events/listings/${eventId}/speakers/${speakerId}`
|
|
6497
6335
|
);
|
|
6336
|
+
if (queryClient && data.status === "ok") {
|
|
6337
|
+
queryClient.invalidateQueries({
|
|
6338
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
6339
|
+
});
|
|
6340
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6341
|
+
}
|
|
6498
6342
|
return data;
|
|
6499
6343
|
};
|
|
6500
6344
|
var useRemoveSelfEventListingSpeaker = (options = {}) => {
|
|
@@ -6508,40 +6352,16 @@ var RemoveSelfEventListingSponsor = async ({
|
|
|
6508
6352
|
clientApiParams,
|
|
6509
6353
|
queryClient
|
|
6510
6354
|
}) => {
|
|
6511
|
-
if (queryClient) {
|
|
6512
|
-
queryClient.setQueryData(
|
|
6513
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6514
|
-
(event) => {
|
|
6515
|
-
if (event && event.data) {
|
|
6516
|
-
const index = event?.data?.sponsors?.findIndex(
|
|
6517
|
-
(sponsor) => sponsor.id === sponsorId
|
|
6518
|
-
);
|
|
6519
|
-
if (index !== -1 && event.data.sponsors) {
|
|
6520
|
-
event.data.sponsors.splice(index, 1);
|
|
6521
|
-
}
|
|
6522
|
-
}
|
|
6523
|
-
return event;
|
|
6524
|
-
}
|
|
6525
|
-
);
|
|
6526
|
-
queryClient.setQueryData(
|
|
6527
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6528
|
-
(event) => {
|
|
6529
|
-
if (event && event.data) {
|
|
6530
|
-
const index = event?.data?.sponsors?.findIndex(
|
|
6531
|
-
(sponsor) => sponsor.id === sponsorId
|
|
6532
|
-
);
|
|
6533
|
-
if (index !== -1 && event.data.sponsors) {
|
|
6534
|
-
event.data.sponsors.splice(index, 1);
|
|
6535
|
-
}
|
|
6536
|
-
}
|
|
6537
|
-
return event;
|
|
6538
|
-
}
|
|
6539
|
-
);
|
|
6540
|
-
}
|
|
6541
6355
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6542
6356
|
const { data } = await clientApi.delete(
|
|
6543
6357
|
`/self/events/listings/${eventId}/sponsors/${sponsorId}`
|
|
6544
6358
|
);
|
|
6359
|
+
if (queryClient && data.status === "ok") {
|
|
6360
|
+
queryClient.invalidateQueries({
|
|
6361
|
+
queryKey: EVENT_SPONSORS_QUERY_KEY(eventId)
|
|
6362
|
+
});
|
|
6363
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6364
|
+
}
|
|
6545
6365
|
return data;
|
|
6546
6366
|
};
|
|
6547
6367
|
var useRemoveSelfEventListingSponsor = (options = {}) => {
|
|
@@ -6596,63 +6416,35 @@ var useSelfCheckinRegistration = (options = {}) => {
|
|
|
6596
6416
|
};
|
|
6597
6417
|
|
|
6598
6418
|
// src/mutations/activities/optimistic/UpdateComments.ts
|
|
6419
|
+
var import_immer4 = require("immer");
|
|
6599
6420
|
var UpdateCommentsSingle = (increment, queryClient, KEY) => {
|
|
6600
|
-
queryClient.setQueryData(
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
...data._count,
|
|
6611
|
-
comments: increment ? data._count.comments + 1 : data._count.comments - 1
|
|
6612
|
-
},
|
|
6613
|
-
comments: increment ? [{}] : void 0
|
|
6614
|
-
}
|
|
6615
|
-
};
|
|
6616
|
-
}
|
|
6617
|
-
});
|
|
6421
|
+
queryClient.setQueryData(
|
|
6422
|
+
KEY,
|
|
6423
|
+
(originalData) => (0, import_immer4.produce)(originalData, (draft) => {
|
|
6424
|
+
if (!draft?.data) {
|
|
6425
|
+
return;
|
|
6426
|
+
}
|
|
6427
|
+
draft.data._count.comments += increment ? 1 : -1;
|
|
6428
|
+
draft.data.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6429
|
+
})
|
|
6430
|
+
);
|
|
6618
6431
|
};
|
|
6619
6432
|
var UpdateCommentsInfinite = (increment, queryClient, KEY, activityId) => {
|
|
6620
6433
|
queryClient.setQueriesData(
|
|
6621
|
-
{
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
(data) => {
|
|
6626
|
-
if (!data?.pages || data?.pages?.length === 0) {
|
|
6627
|
-
return data;
|
|
6434
|
+
{ queryKey: KEY, exact: false },
|
|
6435
|
+
(originalData) => (0, import_immer4.produce)(originalData, (draft) => {
|
|
6436
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
6437
|
+
return;
|
|
6628
6438
|
}
|
|
6629
|
-
const
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
for (let x = 0; x < pages?.length; x++) {
|
|
6635
|
-
for (let y = 0; y < pages?.[x]?.data?.length; y++) {
|
|
6636
|
-
if (pages?.[x]?.data?.[y]?.id === activityId) {
|
|
6637
|
-
pageIndex = x;
|
|
6638
|
-
activityIndex = y;
|
|
6639
|
-
}
|
|
6640
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
6641
|
-
resharePageIndex = x;
|
|
6642
|
-
reshareActivityIndex = y;
|
|
6439
|
+
for (const page of draft.pages) {
|
|
6440
|
+
for (const activity of page.data) {
|
|
6441
|
+
if (activity.id === activityId) {
|
|
6442
|
+
activity._count.comments += increment ? 1 : -1;
|
|
6443
|
+
activity.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6643
6444
|
}
|
|
6644
6445
|
}
|
|
6645
6446
|
}
|
|
6646
|
-
|
|
6647
|
-
pages[pageIndex].data[activityIndex]._count.comments = increment ? pages?.[pageIndex]?.data[activityIndex]._count.comments + 1 : pages?.[pageIndex]?.data[activityIndex]._count.comments - 1;
|
|
6648
|
-
pages[pageIndex].data[activityIndex].comments = increment ? [{}] : void 0;
|
|
6649
|
-
}
|
|
6650
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
6651
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.comments = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments - 1;
|
|
6652
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.comments = increment ? [{}] : void 0;
|
|
6653
|
-
}
|
|
6654
|
-
return { ...data, pages };
|
|
6655
|
-
}
|
|
6447
|
+
})
|
|
6656
6448
|
);
|
|
6657
6449
|
};
|
|
6658
6450
|
|
|
@@ -6668,7 +6460,7 @@ var SelfCreateActivity = async ({
|
|
|
6668
6460
|
if (activity.commentedId) {
|
|
6669
6461
|
UpdateCommentsSingle(true, queryClient, [
|
|
6670
6462
|
...ACTIVITY_QUERY_KEY(activity.commentedId),
|
|
6671
|
-
clientApiParams.locale
|
|
6463
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
6672
6464
|
]);
|
|
6673
6465
|
UpdateCommentsInfinite(
|
|
6674
6466
|
true,
|
|
@@ -6683,51 +6475,51 @@ var SelfCreateActivity = async ({
|
|
|
6683
6475
|
`/self/activities`,
|
|
6684
6476
|
{
|
|
6685
6477
|
activity,
|
|
6686
|
-
|
|
6687
|
-
videoUri: videoUri
|
|
6478
|
+
imageUri: base64Image ?? void 0,
|
|
6479
|
+
videoUri: videoUri ?? void 0
|
|
6688
6480
|
}
|
|
6689
6481
|
);
|
|
6690
6482
|
if (queryClient && data.status === "ok") {
|
|
6691
6483
|
let nested = false;
|
|
6692
|
-
if (
|
|
6484
|
+
if (activity.commentedId) {
|
|
6693
6485
|
nested = true;
|
|
6694
6486
|
AppendInfiniteQuery(
|
|
6695
6487
|
queryClient,
|
|
6696
6488
|
[
|
|
6697
|
-
...ACTIVITY_COMMENTS_QUERY_KEY(
|
|
6489
|
+
...ACTIVITY_COMMENTS_QUERY_KEY(activity.commentedId),
|
|
6698
6490
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6699
6491
|
],
|
|
6700
6492
|
data.data
|
|
6701
6493
|
);
|
|
6702
6494
|
}
|
|
6703
|
-
if (
|
|
6495
|
+
if (activity.contentId) {
|
|
6704
6496
|
nested = true;
|
|
6705
6497
|
AppendInfiniteQuery(
|
|
6706
6498
|
queryClient,
|
|
6707
6499
|
[
|
|
6708
|
-
...CONTENT_ACTIVITIES_QUERY_KEY(
|
|
6500
|
+
...CONTENT_ACTIVITIES_QUERY_KEY(activity.contentId),
|
|
6709
6501
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6710
6502
|
],
|
|
6711
6503
|
data.data
|
|
6712
6504
|
);
|
|
6713
6505
|
}
|
|
6714
|
-
if (
|
|
6506
|
+
if (activity.eventId) {
|
|
6715
6507
|
nested = true;
|
|
6716
6508
|
AppendInfiniteQuery(
|
|
6717
6509
|
queryClient,
|
|
6718
6510
|
[
|
|
6719
|
-
...EVENT_ACTIVITIES_QUERY_KEY(
|
|
6511
|
+
...EVENT_ACTIVITIES_QUERY_KEY(activity.eventId),
|
|
6720
6512
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6721
6513
|
],
|
|
6722
6514
|
data.data
|
|
6723
6515
|
);
|
|
6724
6516
|
}
|
|
6725
|
-
if (
|
|
6517
|
+
if (activity.communityId) {
|
|
6726
6518
|
nested = true;
|
|
6727
6519
|
AppendInfiniteQuery(
|
|
6728
6520
|
queryClient,
|
|
6729
6521
|
[
|
|
6730
|
-
...COMMUNITY_ACTIVITIES_QUERY_KEY(
|
|
6522
|
+
...COMMUNITY_ACTIVITIES_QUERY_KEY(activity.communityId),
|
|
6731
6523
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6732
6524
|
],
|
|
6733
6525
|
data.data
|
|
@@ -6892,7 +6684,7 @@ var UpdateSelfEventListing = async ({
|
|
|
6892
6684
|
`/self/events/listings/${eventId}`,
|
|
6893
6685
|
{
|
|
6894
6686
|
event,
|
|
6895
|
-
image: base64
|
|
6687
|
+
image: base64 ?? void 0
|
|
6896
6688
|
}
|
|
6897
6689
|
);
|
|
6898
6690
|
if (queryClient && data.status === "ok") {
|
|
@@ -6935,34 +6727,10 @@ var UpdateSelfEventListingSession = async ({
|
|
|
6935
6727
|
}
|
|
6936
6728
|
);
|
|
6937
6729
|
if (queryClient && data.status === "ok") {
|
|
6938
|
-
queryClient.
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6943
|
-
(session2) => session2.id === data.data.id
|
|
6944
|
-
);
|
|
6945
|
-
if (index !== -1 && event.data.sessions) {
|
|
6946
|
-
event.data.sessions[index] = data.data;
|
|
6947
|
-
}
|
|
6948
|
-
}
|
|
6949
|
-
return event;
|
|
6950
|
-
}
|
|
6951
|
-
);
|
|
6952
|
-
queryClient.setQueryData(
|
|
6953
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6954
|
-
(event) => {
|
|
6955
|
-
if (event && event.data) {
|
|
6956
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6957
|
-
(session2) => session2.id === data.data.id
|
|
6958
|
-
);
|
|
6959
|
-
if (index !== -1 && event.data.sessions) {
|
|
6960
|
-
event.data.sessions[index] = data.data;
|
|
6961
|
-
}
|
|
6962
|
-
}
|
|
6963
|
-
return event;
|
|
6964
|
-
}
|
|
6965
|
-
);
|
|
6730
|
+
queryClient.invalidateQueries({
|
|
6731
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
6732
|
+
});
|
|
6733
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6966
6734
|
}
|
|
6967
6735
|
return data;
|
|
6968
6736
|
};
|
|
@@ -6988,34 +6756,10 @@ var UpdateSelfEventListingSpeaker = async ({
|
|
|
6988
6756
|
}
|
|
6989
6757
|
);
|
|
6990
6758
|
if (queryClient && data.status === "ok") {
|
|
6991
|
-
queryClient.
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
const index = event?.data?.speakers?.findIndex(
|
|
6996
|
-
(speaker2) => speaker2.id === data.data.id
|
|
6997
|
-
);
|
|
6998
|
-
if (index !== -1 && event.data.speakers) {
|
|
6999
|
-
event.data.speakers[index] = data.data;
|
|
7000
|
-
}
|
|
7001
|
-
}
|
|
7002
|
-
return event;
|
|
7003
|
-
}
|
|
7004
|
-
);
|
|
7005
|
-
queryClient.setQueryData(
|
|
7006
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
7007
|
-
(event) => {
|
|
7008
|
-
if (event && event.data) {
|
|
7009
|
-
const index = event?.data?.speakers?.findIndex(
|
|
7010
|
-
(speaker2) => speaker2.id === data.data.id
|
|
7011
|
-
);
|
|
7012
|
-
if (index !== -1 && event.data.speakers) {
|
|
7013
|
-
event.data.speakers[index] = data.data;
|
|
7014
|
-
}
|
|
7015
|
-
}
|
|
7016
|
-
return event;
|
|
7017
|
-
}
|
|
7018
|
-
);
|
|
6759
|
+
queryClient.invalidateQueries({
|
|
6760
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
6761
|
+
});
|
|
6762
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
7019
6763
|
}
|
|
7020
6764
|
return data;
|
|
7021
6765
|
};
|