@connectedxm/client 0.1.9 → 0.1.20
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 +99 -159
- package/dist/index.mjs +99 -159
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -919,6 +919,10 @@ interface NotificationPreferences {
|
|
|
919
919
|
chatPush: boolean;
|
|
920
920
|
chatUnreadPush: boolean;
|
|
921
921
|
chatUnreadEmail: boolean;
|
|
922
|
+
organizationAnnouncementEmail: boolean;
|
|
923
|
+
organizationAnnouncementPush: boolean;
|
|
924
|
+
communityAnnouncementEmail: boolean;
|
|
925
|
+
communityAnnouncementPush: boolean;
|
|
922
926
|
eventAnnouncementEmail: boolean;
|
|
923
927
|
eventAnnouncementPush: boolean;
|
|
924
928
|
}
|
|
@@ -2238,7 +2242,6 @@ declare const CancelSubscription: ({ subscriptionId, clientApiParams, queryClien
|
|
|
2238
2242
|
declare const useCancelSubscription: (options?: Omit<MutationOptions<Awaited<ReturnType<typeof CancelSubscription>>, Omit<CancelSubscriptionParams, "queryClient" | "clientApiParams">>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectedXMResponse<null>, axios.AxiosError<ConnectedXMResponse<null>, any>, Omit<CancelSubscriptionParams, "queryClient" | "clientApiParams">, unknown>;
|
|
2239
2243
|
|
|
2240
2244
|
interface CreateSubscriptionParams extends MutationParams {
|
|
2241
|
-
subscriptionId: string;
|
|
2242
2245
|
productId: string;
|
|
2243
2246
|
priceId: string;
|
|
2244
2247
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -919,6 +919,10 @@ interface NotificationPreferences {
|
|
|
919
919
|
chatPush: boolean;
|
|
920
920
|
chatUnreadPush: boolean;
|
|
921
921
|
chatUnreadEmail: boolean;
|
|
922
|
+
organizationAnnouncementEmail: boolean;
|
|
923
|
+
organizationAnnouncementPush: boolean;
|
|
924
|
+
communityAnnouncementEmail: boolean;
|
|
925
|
+
communityAnnouncementPush: boolean;
|
|
922
926
|
eventAnnouncementEmail: boolean;
|
|
923
927
|
eventAnnouncementPush: boolean;
|
|
924
928
|
}
|
|
@@ -2238,7 +2242,6 @@ declare const CancelSubscription: ({ subscriptionId, clientApiParams, queryClien
|
|
|
2238
2242
|
declare const useCancelSubscription: (options?: Omit<MutationOptions<Awaited<ReturnType<typeof CancelSubscription>>, Omit<CancelSubscriptionParams, "queryClient" | "clientApiParams">>, "mutationFn">) => _tanstack_react_query.UseMutationResult<ConnectedXMResponse<null>, axios.AxiosError<ConnectedXMResponse<null>, any>, Omit<CancelSubscriptionParams, "queryClient" | "clientApiParams">, unknown>;
|
|
2239
2243
|
|
|
2240
2244
|
interface CreateSubscriptionParams extends MutationParams {
|
|
2241
|
-
subscriptionId: string;
|
|
2242
2245
|
productId: string;
|
|
2243
2246
|
priceId: string;
|
|
2244
2247
|
}
|
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);
|
|
@@ -6596,63 +6564,35 @@ var useSelfCheckinRegistration = (options = {}) => {
|
|
|
6596
6564
|
};
|
|
6597
6565
|
|
|
6598
6566
|
// src/mutations/activities/optimistic/UpdateComments.ts
|
|
6567
|
+
var import_immer4 = require("immer");
|
|
6599
6568
|
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
|
-
});
|
|
6569
|
+
queryClient.setQueryData(
|
|
6570
|
+
KEY,
|
|
6571
|
+
(originalData) => (0, import_immer4.produce)(originalData, (draft) => {
|
|
6572
|
+
if (!draft?.data) {
|
|
6573
|
+
return;
|
|
6574
|
+
}
|
|
6575
|
+
draft.data._count.comments += increment ? 1 : -1;
|
|
6576
|
+
draft.data.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6577
|
+
})
|
|
6578
|
+
);
|
|
6618
6579
|
};
|
|
6619
6580
|
var UpdateCommentsInfinite = (increment, queryClient, KEY, activityId) => {
|
|
6620
6581
|
queryClient.setQueriesData(
|
|
6621
|
-
{
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
(data) => {
|
|
6626
|
-
if (!data?.pages || data?.pages?.length === 0) {
|
|
6627
|
-
return data;
|
|
6582
|
+
{ queryKey: KEY, exact: false },
|
|
6583
|
+
(originalData) => (0, import_immer4.produce)(originalData, (draft) => {
|
|
6584
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
6585
|
+
return;
|
|
6628
6586
|
}
|
|
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;
|
|
6587
|
+
for (const page of draft.pages) {
|
|
6588
|
+
for (const activity of page.data) {
|
|
6589
|
+
if (activity.id === activityId) {
|
|
6590
|
+
activity._count.comments += increment ? 1 : -1;
|
|
6591
|
+
activity.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6643
6592
|
}
|
|
6644
6593
|
}
|
|
6645
6594
|
}
|
|
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
|
-
}
|
|
6595
|
+
})
|
|
6656
6596
|
);
|
|
6657
6597
|
};
|
|
6658
6598
|
|
|
@@ -6668,7 +6608,7 @@ var SelfCreateActivity = async ({
|
|
|
6668
6608
|
if (activity.commentedId) {
|
|
6669
6609
|
UpdateCommentsSingle(true, queryClient, [
|
|
6670
6610
|
...ACTIVITY_QUERY_KEY(activity.commentedId),
|
|
6671
|
-
clientApiParams.locale
|
|
6611
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
6672
6612
|
]);
|
|
6673
6613
|
UpdateCommentsInfinite(
|
|
6674
6614
|
true,
|
|
@@ -6683,51 +6623,51 @@ var SelfCreateActivity = async ({
|
|
|
6683
6623
|
`/self/activities`,
|
|
6684
6624
|
{
|
|
6685
6625
|
activity,
|
|
6686
|
-
|
|
6687
|
-
videoUri: videoUri
|
|
6626
|
+
imageUri: base64Image ?? void 0,
|
|
6627
|
+
videoUri: videoUri ?? void 0
|
|
6688
6628
|
}
|
|
6689
6629
|
);
|
|
6690
6630
|
if (queryClient && data.status === "ok") {
|
|
6691
6631
|
let nested = false;
|
|
6692
|
-
if (
|
|
6632
|
+
if (activity.commentedId) {
|
|
6693
6633
|
nested = true;
|
|
6694
6634
|
AppendInfiniteQuery(
|
|
6695
6635
|
queryClient,
|
|
6696
6636
|
[
|
|
6697
|
-
...ACTIVITY_COMMENTS_QUERY_KEY(
|
|
6637
|
+
...ACTIVITY_COMMENTS_QUERY_KEY(activity.commentedId),
|
|
6698
6638
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6699
6639
|
],
|
|
6700
6640
|
data.data
|
|
6701
6641
|
);
|
|
6702
6642
|
}
|
|
6703
|
-
if (
|
|
6643
|
+
if (activity.contentId) {
|
|
6704
6644
|
nested = true;
|
|
6705
6645
|
AppendInfiniteQuery(
|
|
6706
6646
|
queryClient,
|
|
6707
6647
|
[
|
|
6708
|
-
...CONTENT_ACTIVITIES_QUERY_KEY(
|
|
6648
|
+
...CONTENT_ACTIVITIES_QUERY_KEY(activity.contentId),
|
|
6709
6649
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6710
6650
|
],
|
|
6711
6651
|
data.data
|
|
6712
6652
|
);
|
|
6713
6653
|
}
|
|
6714
|
-
if (
|
|
6654
|
+
if (activity.eventId) {
|
|
6715
6655
|
nested = true;
|
|
6716
6656
|
AppendInfiniteQuery(
|
|
6717
6657
|
queryClient,
|
|
6718
6658
|
[
|
|
6719
|
-
...EVENT_ACTIVITIES_QUERY_KEY(
|
|
6659
|
+
...EVENT_ACTIVITIES_QUERY_KEY(activity.eventId),
|
|
6720
6660
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6721
6661
|
],
|
|
6722
6662
|
data.data
|
|
6723
6663
|
);
|
|
6724
6664
|
}
|
|
6725
|
-
if (
|
|
6665
|
+
if (activity.communityId) {
|
|
6726
6666
|
nested = true;
|
|
6727
6667
|
AppendInfiniteQuery(
|
|
6728
6668
|
queryClient,
|
|
6729
6669
|
[
|
|
6730
|
-
...COMMUNITY_ACTIVITIES_QUERY_KEY(
|
|
6670
|
+
...COMMUNITY_ACTIVITIES_QUERY_KEY(activity.communityId),
|
|
6731
6671
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6732
6672
|
],
|
|
6733
6673
|
data.data
|
|
@@ -6892,7 +6832,7 @@ var UpdateSelfEventListing = async ({
|
|
|
6892
6832
|
`/self/events/listings/${eventId}`,
|
|
6893
6833
|
{
|
|
6894
6834
|
event,
|
|
6895
|
-
image: base64
|
|
6835
|
+
image: base64 ?? void 0
|
|
6896
6836
|
}
|
|
6897
6837
|
);
|
|
6898
6838
|
if (queryClient && data.status === "ok") {
|
package/dist/index.mjs
CHANGED
|
@@ -4324,58 +4324,36 @@ var useUnfollowAccount = (options = {}) => {
|
|
|
4324
4324
|
};
|
|
4325
4325
|
|
|
4326
4326
|
// src/mutations/activities/optimistic/UpdateReshares.ts
|
|
4327
|
+
import { produce as produce2 } from "immer";
|
|
4327
4328
|
var UpdateResharesSingle = (increment, queryClient, KEY) => {
|
|
4328
|
-
queryClient.setQueryData(
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
...data._count,
|
|
4339
|
-
reshares: increment ? data._count.reshares + 1 : data._count.reshares - 1
|
|
4340
|
-
},
|
|
4341
|
-
reshares: increment ? [{}] : void 0
|
|
4342
|
-
}
|
|
4343
|
-
};
|
|
4344
|
-
}
|
|
4345
|
-
});
|
|
4329
|
+
queryClient.setQueryData(
|
|
4330
|
+
KEY,
|
|
4331
|
+
(originalData) => produce2(originalData, (draft) => {
|
|
4332
|
+
if (!draft?.data) {
|
|
4333
|
+
return;
|
|
4334
|
+
}
|
|
4335
|
+
draft.data._count.reshares += increment ? 1 : -1;
|
|
4336
|
+
draft.data.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4337
|
+
})
|
|
4338
|
+
);
|
|
4346
4339
|
};
|
|
4347
4340
|
var UpdateResharesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4348
|
-
queryClient.setQueriesData(
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
pageIndex = x;
|
|
4361
|
-
activityIndex = y;
|
|
4362
|
-
}
|
|
4363
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
4364
|
-
resharePageIndex = x;
|
|
4365
|
-
reshareActivityIndex = y;
|
|
4341
|
+
queryClient.setQueriesData(
|
|
4342
|
+
{ queryKey: KEY, exact: false },
|
|
4343
|
+
(originalData) => produce2(originalData, (draft) => {
|
|
4344
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4345
|
+
return;
|
|
4346
|
+
}
|
|
4347
|
+
for (const page of draft.pages) {
|
|
4348
|
+
for (const activity of page.data) {
|
|
4349
|
+
if (activity.id === activityId) {
|
|
4350
|
+
activity._count.reshares += increment ? 1 : -1;
|
|
4351
|
+
activity.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4352
|
+
}
|
|
4366
4353
|
}
|
|
4367
4354
|
}
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
|
-
pages[pageIndex].data[activityIndex]._count.reshares = increment ? pages?.[pageIndex]?.data[activityIndex]._count.reshares + 1 : pages?.[pageIndex]?.data[activityIndex]._count.reshares - 1;
|
|
4371
|
-
pages[pageIndex].data[activityIndex].reshares = increment ? [{}] : void 0;
|
|
4372
|
-
}
|
|
4373
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
4374
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.reshares = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares - 1;
|
|
4375
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.reshares = increment ? [{}] : void 0;
|
|
4376
|
-
}
|
|
4377
|
-
return { ...data, pages };
|
|
4378
|
-
});
|
|
4355
|
+
})
|
|
4356
|
+
);
|
|
4379
4357
|
};
|
|
4380
4358
|
|
|
4381
4359
|
// src/mutations/activities/useDeleteReshare.ts
|
|
@@ -4385,7 +4363,10 @@ var DeleteReshare = async ({
|
|
|
4385
4363
|
queryClient
|
|
4386
4364
|
}) => {
|
|
4387
4365
|
if (queryClient) {
|
|
4388
|
-
UpdateResharesSingle(false, queryClient,
|
|
4366
|
+
UpdateResharesSingle(false, queryClient, [
|
|
4367
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4368
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4369
|
+
]);
|
|
4389
4370
|
UpdateResharesInfinite(
|
|
4390
4371
|
false,
|
|
4391
4372
|
queryClient,
|
|
@@ -4404,58 +4385,36 @@ var useDeleteReshare = (options = {}) => {
|
|
|
4404
4385
|
};
|
|
4405
4386
|
|
|
4406
4387
|
// src/mutations/activities/optimistic/UpdateLikes.ts
|
|
4388
|
+
import { produce as produce3 } from "immer";
|
|
4407
4389
|
var UpdateLikesSingle = (increment, queryClient, KEY) => {
|
|
4408
|
-
queryClient.setQueryData(
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
...data._count,
|
|
4419
|
-
likes: increment ? data._count.likes + 1 : data._count.likes - 1
|
|
4420
|
-
},
|
|
4421
|
-
likes: increment ? [{}] : void 0
|
|
4422
|
-
}
|
|
4423
|
-
};
|
|
4424
|
-
}
|
|
4425
|
-
});
|
|
4390
|
+
queryClient.setQueryData(
|
|
4391
|
+
KEY,
|
|
4392
|
+
(originalData) => produce3(originalData, (draft) => {
|
|
4393
|
+
if (!draft?.data) {
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
draft.data._count.likes += increment ? 1 : -1;
|
|
4397
|
+
draft.data.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4398
|
+
})
|
|
4399
|
+
);
|
|
4426
4400
|
};
|
|
4427
4401
|
var UpdateLikesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4428
|
-
queryClient.setQueriesData(
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
pageIndex = x;
|
|
4441
|
-
activityIndex = y;
|
|
4442
|
-
}
|
|
4443
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
4444
|
-
resharePageIndex = x;
|
|
4445
|
-
reshareActivityIndex = y;
|
|
4402
|
+
queryClient.setQueriesData(
|
|
4403
|
+
{ queryKey: KEY, exact: false },
|
|
4404
|
+
(originalData) => produce3(originalData, (draft) => {
|
|
4405
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4406
|
+
return;
|
|
4407
|
+
}
|
|
4408
|
+
for (const page of draft.pages) {
|
|
4409
|
+
for (const activity of page.data) {
|
|
4410
|
+
if (activity.id === activityId) {
|
|
4411
|
+
activity._count.likes += increment ? 1 : -1;
|
|
4412
|
+
activity.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4413
|
+
}
|
|
4446
4414
|
}
|
|
4447
4415
|
}
|
|
4448
|
-
}
|
|
4449
|
-
|
|
4450
|
-
pages[pageIndex].data[activityIndex]._count.likes = increment ? pages?.[pageIndex]?.data[activityIndex]._count.likes + 1 : pages?.[pageIndex]?.data[activityIndex]._count.likes - 1;
|
|
4451
|
-
pages[pageIndex].data[activityIndex].likes = increment ? [{}] : void 0;
|
|
4452
|
-
}
|
|
4453
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
4454
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.likes = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes - 1;
|
|
4455
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.likes = increment ? [{}] : void 0;
|
|
4456
|
-
}
|
|
4457
|
-
return { ...data, pages };
|
|
4458
|
-
});
|
|
4416
|
+
})
|
|
4417
|
+
);
|
|
4459
4418
|
};
|
|
4460
4419
|
|
|
4461
4420
|
// src/mutations/activities/useLikeActivity.ts
|
|
@@ -4465,7 +4424,10 @@ var LikeActivity = async ({
|
|
|
4465
4424
|
queryClient
|
|
4466
4425
|
}) => {
|
|
4467
4426
|
if (queryClient) {
|
|
4468
|
-
UpdateLikesSingle(true, queryClient,
|
|
4427
|
+
UpdateLikesSingle(true, queryClient, [
|
|
4428
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4429
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4430
|
+
]);
|
|
4469
4431
|
UpdateLikesInfinite(true, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
4470
4432
|
}
|
|
4471
4433
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -4485,7 +4447,10 @@ var ReshareActivity = async ({
|
|
|
4485
4447
|
clientApiParams
|
|
4486
4448
|
}) => {
|
|
4487
4449
|
if (queryClient) {
|
|
4488
|
-
UpdateResharesSingle(true, queryClient,
|
|
4450
|
+
UpdateResharesSingle(true, queryClient, [
|
|
4451
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4452
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4453
|
+
]);
|
|
4489
4454
|
UpdateResharesInfinite(
|
|
4490
4455
|
true,
|
|
4491
4456
|
queryClient,
|
|
@@ -4513,7 +4478,10 @@ var UnlikeActivity = async ({
|
|
|
4513
4478
|
queryClient
|
|
4514
4479
|
}) => {
|
|
4515
4480
|
if (queryClient) {
|
|
4516
|
-
UpdateLikesSingle(false, queryClient,
|
|
4481
|
+
UpdateLikesSingle(false, queryClient, [
|
|
4482
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4483
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4484
|
+
]);
|
|
4517
4485
|
UpdateLikesInfinite(false, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
4518
4486
|
}
|
|
4519
4487
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -6030,63 +5998,35 @@ var useSelfCheckinRegistration = (options = {}) => {
|
|
|
6030
5998
|
};
|
|
6031
5999
|
|
|
6032
6000
|
// src/mutations/activities/optimistic/UpdateComments.ts
|
|
6001
|
+
import { produce as produce4 } from "immer";
|
|
6033
6002
|
var UpdateCommentsSingle = (increment, queryClient, KEY) => {
|
|
6034
|
-
queryClient.setQueryData(
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
...data._count,
|
|
6045
|
-
comments: increment ? data._count.comments + 1 : data._count.comments - 1
|
|
6046
|
-
},
|
|
6047
|
-
comments: increment ? [{}] : void 0
|
|
6048
|
-
}
|
|
6049
|
-
};
|
|
6050
|
-
}
|
|
6051
|
-
});
|
|
6003
|
+
queryClient.setQueryData(
|
|
6004
|
+
KEY,
|
|
6005
|
+
(originalData) => produce4(originalData, (draft) => {
|
|
6006
|
+
if (!draft?.data) {
|
|
6007
|
+
return;
|
|
6008
|
+
}
|
|
6009
|
+
draft.data._count.comments += increment ? 1 : -1;
|
|
6010
|
+
draft.data.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6011
|
+
})
|
|
6012
|
+
);
|
|
6052
6013
|
};
|
|
6053
6014
|
var UpdateCommentsInfinite = (increment, queryClient, KEY, activityId) => {
|
|
6054
6015
|
queryClient.setQueriesData(
|
|
6055
|
-
{
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
(data) => {
|
|
6060
|
-
if (!data?.pages || data?.pages?.length === 0) {
|
|
6061
|
-
return data;
|
|
6016
|
+
{ queryKey: KEY, exact: false },
|
|
6017
|
+
(originalData) => produce4(originalData, (draft) => {
|
|
6018
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
6019
|
+
return;
|
|
6062
6020
|
}
|
|
6063
|
-
const
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
for (let x = 0; x < pages?.length; x++) {
|
|
6069
|
-
for (let y = 0; y < pages?.[x]?.data?.length; y++) {
|
|
6070
|
-
if (pages?.[x]?.data?.[y]?.id === activityId) {
|
|
6071
|
-
pageIndex = x;
|
|
6072
|
-
activityIndex = y;
|
|
6073
|
-
}
|
|
6074
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
6075
|
-
resharePageIndex = x;
|
|
6076
|
-
reshareActivityIndex = y;
|
|
6021
|
+
for (const page of draft.pages) {
|
|
6022
|
+
for (const activity of page.data) {
|
|
6023
|
+
if (activity.id === activityId) {
|
|
6024
|
+
activity._count.comments += increment ? 1 : -1;
|
|
6025
|
+
activity.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6077
6026
|
}
|
|
6078
6027
|
}
|
|
6079
6028
|
}
|
|
6080
|
-
|
|
6081
|
-
pages[pageIndex].data[activityIndex]._count.comments = increment ? pages?.[pageIndex]?.data[activityIndex]._count.comments + 1 : pages?.[pageIndex]?.data[activityIndex]._count.comments - 1;
|
|
6082
|
-
pages[pageIndex].data[activityIndex].comments = increment ? [{}] : void 0;
|
|
6083
|
-
}
|
|
6084
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
6085
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.comments = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments - 1;
|
|
6086
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.comments = increment ? [{}] : void 0;
|
|
6087
|
-
}
|
|
6088
|
-
return { ...data, pages };
|
|
6089
|
-
}
|
|
6029
|
+
})
|
|
6090
6030
|
);
|
|
6091
6031
|
};
|
|
6092
6032
|
|
|
@@ -6102,7 +6042,7 @@ var SelfCreateActivity = async ({
|
|
|
6102
6042
|
if (activity.commentedId) {
|
|
6103
6043
|
UpdateCommentsSingle(true, queryClient, [
|
|
6104
6044
|
...ACTIVITY_QUERY_KEY(activity.commentedId),
|
|
6105
|
-
clientApiParams.locale
|
|
6045
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
6106
6046
|
]);
|
|
6107
6047
|
UpdateCommentsInfinite(
|
|
6108
6048
|
true,
|
|
@@ -6117,51 +6057,51 @@ var SelfCreateActivity = async ({
|
|
|
6117
6057
|
`/self/activities`,
|
|
6118
6058
|
{
|
|
6119
6059
|
activity,
|
|
6120
|
-
|
|
6121
|
-
videoUri: videoUri
|
|
6060
|
+
imageUri: base64Image ?? void 0,
|
|
6061
|
+
videoUri: videoUri ?? void 0
|
|
6122
6062
|
}
|
|
6123
6063
|
);
|
|
6124
6064
|
if (queryClient && data.status === "ok") {
|
|
6125
6065
|
let nested = false;
|
|
6126
|
-
if (
|
|
6066
|
+
if (activity.commentedId) {
|
|
6127
6067
|
nested = true;
|
|
6128
6068
|
AppendInfiniteQuery(
|
|
6129
6069
|
queryClient,
|
|
6130
6070
|
[
|
|
6131
|
-
...ACTIVITY_COMMENTS_QUERY_KEY(
|
|
6071
|
+
...ACTIVITY_COMMENTS_QUERY_KEY(activity.commentedId),
|
|
6132
6072
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6133
6073
|
],
|
|
6134
6074
|
data.data
|
|
6135
6075
|
);
|
|
6136
6076
|
}
|
|
6137
|
-
if (
|
|
6077
|
+
if (activity.contentId) {
|
|
6138
6078
|
nested = true;
|
|
6139
6079
|
AppendInfiniteQuery(
|
|
6140
6080
|
queryClient,
|
|
6141
6081
|
[
|
|
6142
|
-
...CONTENT_ACTIVITIES_QUERY_KEY(
|
|
6082
|
+
...CONTENT_ACTIVITIES_QUERY_KEY(activity.contentId),
|
|
6143
6083
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6144
6084
|
],
|
|
6145
6085
|
data.data
|
|
6146
6086
|
);
|
|
6147
6087
|
}
|
|
6148
|
-
if (
|
|
6088
|
+
if (activity.eventId) {
|
|
6149
6089
|
nested = true;
|
|
6150
6090
|
AppendInfiniteQuery(
|
|
6151
6091
|
queryClient,
|
|
6152
6092
|
[
|
|
6153
|
-
...EVENT_ACTIVITIES_QUERY_KEY(
|
|
6093
|
+
...EVENT_ACTIVITIES_QUERY_KEY(activity.eventId),
|
|
6154
6094
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6155
6095
|
],
|
|
6156
6096
|
data.data
|
|
6157
6097
|
);
|
|
6158
6098
|
}
|
|
6159
|
-
if (
|
|
6099
|
+
if (activity.communityId) {
|
|
6160
6100
|
nested = true;
|
|
6161
6101
|
AppendInfiniteQuery(
|
|
6162
6102
|
queryClient,
|
|
6163
6103
|
[
|
|
6164
|
-
...COMMUNITY_ACTIVITIES_QUERY_KEY(
|
|
6104
|
+
...COMMUNITY_ACTIVITIES_QUERY_KEY(activity.communityId),
|
|
6165
6105
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6166
6106
|
],
|
|
6167
6107
|
data.data
|
|
@@ -6326,7 +6266,7 @@ var UpdateSelfEventListing = async ({
|
|
|
6326
6266
|
`/self/events/listings/${eventId}`,
|
|
6327
6267
|
{
|
|
6328
6268
|
event,
|
|
6329
|
-
image: base64
|
|
6269
|
+
image: base64 ?? void 0
|
|
6330
6270
|
}
|
|
6331
6271
|
);
|
|
6332
6272
|
if (queryClient && data.status === "ok") {
|