@connectedxm/client 0.5.7 → 0.5.10
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 +39 -13
- package/dist/index.d.ts +39 -13
- package/dist/index.js +222 -33
- package/dist/index.mjs +210 -32
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -79,20 +79,15 @@ var useIsAccountFollowing = (accountId) => {
|
|
|
79
79
|
return relationships?.data.accounts[accountId] || false;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
// src/hooks/
|
|
83
|
-
var
|
|
82
|
+
// src/hooks/useGroupStatus.ts
|
|
83
|
+
var useGroupStatus = (groupId) => {
|
|
84
84
|
const { data: relationships } = useGetSelfRelationships();
|
|
85
85
|
if (!groupId)
|
|
86
86
|
return false;
|
|
87
87
|
if (!isUUID(groupId)) {
|
|
88
88
|
throw new Error("Invalid groupId. Did you pass in the slug?");
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
if (role) {
|
|
92
|
-
return _role === role;
|
|
93
|
-
} else {
|
|
94
|
-
return _role === "member" || _role === "moderator";
|
|
95
|
-
}
|
|
90
|
+
return relationships?.data.groups[groupId] || false;
|
|
96
91
|
};
|
|
97
92
|
|
|
98
93
|
// src/hooks/useIsEventRegistered.ts
|
|
@@ -962,7 +957,12 @@ var useGetAccountByShareCode = (shareCode = "", options = {}) => {
|
|
|
962
957
|
};
|
|
963
958
|
|
|
964
959
|
// src/queries/groups/useGetGroups.ts
|
|
965
|
-
var GROUPS_QUERY_KEY = () =>
|
|
960
|
+
var GROUPS_QUERY_KEY = (access) => {
|
|
961
|
+
const keys = ["GROUPS"];
|
|
962
|
+
if (access)
|
|
963
|
+
keys.push(access);
|
|
964
|
+
return keys;
|
|
965
|
+
};
|
|
966
966
|
var SET_GROUPS_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
967
967
|
client.setQueryData(
|
|
968
968
|
[
|
|
@@ -977,18 +977,11 @@ var GetGroups = async ({
|
|
|
977
977
|
pageSize,
|
|
978
978
|
orderBy,
|
|
979
979
|
search,
|
|
980
|
-
|
|
980
|
+
access,
|
|
981
981
|
queryClient,
|
|
982
982
|
clientApiParams,
|
|
983
983
|
locale
|
|
984
984
|
}) => {
|
|
985
|
-
if (privateGroups) {
|
|
986
|
-
return {
|
|
987
|
-
status: "ok",
|
|
988
|
-
message: "Groups retreived",
|
|
989
|
-
data: []
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
985
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
993
986
|
const { data } = await clientApi.get(`/groups`, {
|
|
994
987
|
params: {
|
|
@@ -996,7 +989,7 @@ var GetGroups = async ({
|
|
|
996
989
|
pageSize: pageSize || void 0,
|
|
997
990
|
orderBy: orderBy || void 0,
|
|
998
991
|
search: search || void 0,
|
|
999
|
-
|
|
992
|
+
access: access || void 0
|
|
1000
993
|
}
|
|
1001
994
|
});
|
|
1002
995
|
if (queryClient && data.status === "ok") {
|
|
@@ -1009,10 +1002,10 @@ var GetGroups = async ({
|
|
|
1009
1002
|
}
|
|
1010
1003
|
return data;
|
|
1011
1004
|
};
|
|
1012
|
-
var useGetGroups = (params = {}, options = {}) => {
|
|
1005
|
+
var useGetGroups = (access, params = {}, options = {}) => {
|
|
1013
1006
|
return useConnectedInfiniteQuery(
|
|
1014
|
-
GROUPS_QUERY_KEY(),
|
|
1015
|
-
(params2) => GetGroups({ ...params2 }),
|
|
1007
|
+
GROUPS_QUERY_KEY(access),
|
|
1008
|
+
(params2) => GetGroups({ access, ...params2 }),
|
|
1016
1009
|
params,
|
|
1017
1010
|
options
|
|
1018
1011
|
);
|
|
@@ -1859,6 +1852,129 @@ var useGetGroupInvitations = (groupId = "", status, params = {}, options = {}) =
|
|
|
1859
1852
|
);
|
|
1860
1853
|
};
|
|
1861
1854
|
|
|
1855
|
+
// src/queries/groups/useGetGroupsFeatured.ts
|
|
1856
|
+
var GROUPS_FEATURED_QUERY_KEY = () => {
|
|
1857
|
+
return [...GROUPS_QUERY_KEY(), "FEATURED"];
|
|
1858
|
+
};
|
|
1859
|
+
var GetGroupsFeatured = async ({
|
|
1860
|
+
pageParam,
|
|
1861
|
+
pageSize,
|
|
1862
|
+
orderBy,
|
|
1863
|
+
search,
|
|
1864
|
+
queryClient,
|
|
1865
|
+
clientApiParams,
|
|
1866
|
+
locale
|
|
1867
|
+
}) => {
|
|
1868
|
+
const clientApi = await GetClientAPI(clientApiParams);
|
|
1869
|
+
const { data } = await clientApi.get(`/groups/featured`, {
|
|
1870
|
+
params: {
|
|
1871
|
+
page: pageParam || void 0,
|
|
1872
|
+
pageSize: pageSize || void 0,
|
|
1873
|
+
orderBy: orderBy || void 0,
|
|
1874
|
+
search: search || void 0
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
if (queryClient && data.status === "ok") {
|
|
1878
|
+
CacheIndividualQueries(
|
|
1879
|
+
data,
|
|
1880
|
+
queryClient,
|
|
1881
|
+
(groupId) => GROUP_QUERY_KEY(groupId),
|
|
1882
|
+
locale
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
return data;
|
|
1886
|
+
};
|
|
1887
|
+
var useGetGroupsFeatured = (params = {}, options = {}) => {
|
|
1888
|
+
return useConnectedInfiniteQuery(
|
|
1889
|
+
GROUPS_FEATURED_QUERY_KEY(),
|
|
1890
|
+
(params2) => GetGroupsFeatured({ ...params2 }),
|
|
1891
|
+
params,
|
|
1892
|
+
options
|
|
1893
|
+
);
|
|
1894
|
+
};
|
|
1895
|
+
|
|
1896
|
+
// src/queries/groups/useGetGroupsInvited.ts
|
|
1897
|
+
var GROUPS_INVITED_QUERY_KEY = () => {
|
|
1898
|
+
return [...GROUPS_QUERY_KEY(), "INVITED"];
|
|
1899
|
+
};
|
|
1900
|
+
var GetGroupsInvited = async ({
|
|
1901
|
+
pageParam,
|
|
1902
|
+
pageSize,
|
|
1903
|
+
orderBy,
|
|
1904
|
+
search,
|
|
1905
|
+
queryClient,
|
|
1906
|
+
clientApiParams,
|
|
1907
|
+
locale
|
|
1908
|
+
}) => {
|
|
1909
|
+
const clientApi = await GetClientAPI(clientApiParams);
|
|
1910
|
+
const { data } = await clientApi.get(`/groups/invited`, {
|
|
1911
|
+
params: {
|
|
1912
|
+
page: pageParam || void 0,
|
|
1913
|
+
pageSize: pageSize || void 0,
|
|
1914
|
+
orderBy: orderBy || void 0,
|
|
1915
|
+
search: search || void 0
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
if (queryClient && data.status === "ok") {
|
|
1919
|
+
CacheIndividualQueries(
|
|
1920
|
+
data,
|
|
1921
|
+
queryClient,
|
|
1922
|
+
(groupId) => GROUP_QUERY_KEY(groupId),
|
|
1923
|
+
locale
|
|
1924
|
+
);
|
|
1925
|
+
}
|
|
1926
|
+
return data;
|
|
1927
|
+
};
|
|
1928
|
+
var useGetGroupsInvited = (params = {}, options = {}) => {
|
|
1929
|
+
return useConnectedInfiniteQuery(
|
|
1930
|
+
GROUPS_INVITED_QUERY_KEY(),
|
|
1931
|
+
(params2) => GetGroupsInvited({ ...params2 }),
|
|
1932
|
+
params,
|
|
1933
|
+
options
|
|
1934
|
+
);
|
|
1935
|
+
};
|
|
1936
|
+
|
|
1937
|
+
// src/queries/groups/useGetGroupsRequested.ts
|
|
1938
|
+
var GROUPS_REQUESTED_QUERY_KEY = () => {
|
|
1939
|
+
return [...GROUPS_QUERY_KEY(), "REQUESTED"];
|
|
1940
|
+
};
|
|
1941
|
+
var GetGroupsRequested = async ({
|
|
1942
|
+
pageParam,
|
|
1943
|
+
pageSize,
|
|
1944
|
+
orderBy,
|
|
1945
|
+
search,
|
|
1946
|
+
queryClient,
|
|
1947
|
+
clientApiParams,
|
|
1948
|
+
locale
|
|
1949
|
+
}) => {
|
|
1950
|
+
const clientApi = await GetClientAPI(clientApiParams);
|
|
1951
|
+
const { data } = await clientApi.get(`/groups/requested`, {
|
|
1952
|
+
params: {
|
|
1953
|
+
page: pageParam || void 0,
|
|
1954
|
+
pageSize: pageSize || void 0,
|
|
1955
|
+
orderBy: orderBy || void 0,
|
|
1956
|
+
search: search || void 0
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
if (queryClient && data.status === "ok") {
|
|
1960
|
+
CacheIndividualQueries(
|
|
1961
|
+
data,
|
|
1962
|
+
queryClient,
|
|
1963
|
+
(groupId) => GROUP_QUERY_KEY(groupId),
|
|
1964
|
+
locale
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
return data;
|
|
1968
|
+
};
|
|
1969
|
+
var useGetGroupsRequested = (params = {}, options = {}) => {
|
|
1970
|
+
return useConnectedInfiniteQuery(
|
|
1971
|
+
GROUPS_REQUESTED_QUERY_KEY(),
|
|
1972
|
+
(params2) => GetGroupsRequested({ ...params2 }),
|
|
1973
|
+
params,
|
|
1974
|
+
options
|
|
1975
|
+
);
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1862
1978
|
// src/queries/contents/useGetContents.ts
|
|
1863
1979
|
var CONTENTS_QUERY_KEY = () => ["CONTENTS"];
|
|
1864
1980
|
var SET_CONTENTS_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
@@ -6758,13 +6874,12 @@ var useCreateTeamAccount = (options = {}) => {
|
|
|
6758
6874
|
// src/mutations/groups/useAcceptGroupInvitation.ts
|
|
6759
6875
|
var AcceptGroupInvitation = async ({
|
|
6760
6876
|
groupId,
|
|
6761
|
-
invitationId,
|
|
6762
6877
|
clientApiParams,
|
|
6763
6878
|
queryClient
|
|
6764
6879
|
}) => {
|
|
6765
6880
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6766
6881
|
const { data } = await clientApi.post(
|
|
6767
|
-
`/groups/${groupId}/invitations
|
|
6882
|
+
`/groups/${groupId}/invitations/accept`
|
|
6768
6883
|
);
|
|
6769
6884
|
if (queryClient && data.status === "ok") {
|
|
6770
6885
|
queryClient.invalidateQueries({
|
|
@@ -6773,6 +6888,13 @@ var AcceptGroupInvitation = async ({
|
|
|
6773
6888
|
queryClient.invalidateQueries({
|
|
6774
6889
|
queryKey: SELF_NOTIFICATION_COUNT_QUERY_KEY("")
|
|
6775
6890
|
});
|
|
6891
|
+
ADD_SELF_RELATIONSHIP(
|
|
6892
|
+
queryClient,
|
|
6893
|
+
[clientApiParams.locale],
|
|
6894
|
+
"groups",
|
|
6895
|
+
groupId,
|
|
6896
|
+
"member"
|
|
6897
|
+
);
|
|
6776
6898
|
}
|
|
6777
6899
|
return data;
|
|
6778
6900
|
};
|
|
@@ -6788,8 +6910,8 @@ var AcceptGroupRequest = async ({
|
|
|
6788
6910
|
queryClient
|
|
6789
6911
|
}) => {
|
|
6790
6912
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6791
|
-
const { data } = await clientApi.
|
|
6792
|
-
`/groups/${groupId}/requests/${requestId}`
|
|
6913
|
+
const { data } = await clientApi.put(
|
|
6914
|
+
`/groups/${groupId}/requests/${requestId}/accept`
|
|
6793
6915
|
);
|
|
6794
6916
|
if (queryClient && data.status === "ok") {
|
|
6795
6917
|
queryClient.invalidateQueries({
|
|
@@ -6805,6 +6927,30 @@ var useAcceptGroupRequest = (options = {}) => {
|
|
|
6805
6927
|
return useConnectedMutation_default(AcceptGroupRequest, options);
|
|
6806
6928
|
};
|
|
6807
6929
|
|
|
6930
|
+
// src/mutations/groups/useCancelGroupRequest.ts
|
|
6931
|
+
var CancelGroupRequest = async ({
|
|
6932
|
+
groupId,
|
|
6933
|
+
clientApiParams,
|
|
6934
|
+
queryClient
|
|
6935
|
+
}) => {
|
|
6936
|
+
const clientApi = await GetClientAPI(clientApiParams);
|
|
6937
|
+
const { data } = await clientApi.put(
|
|
6938
|
+
`/groups/${groupId}/requests/cancel`
|
|
6939
|
+
);
|
|
6940
|
+
if (queryClient && data.status === "ok") {
|
|
6941
|
+
REMOVE_SELF_RELATIONSHIP(
|
|
6942
|
+
queryClient,
|
|
6943
|
+
[clientApiParams.locale],
|
|
6944
|
+
"groups",
|
|
6945
|
+
groupId
|
|
6946
|
+
);
|
|
6947
|
+
}
|
|
6948
|
+
return data;
|
|
6949
|
+
};
|
|
6950
|
+
var useCancelGroupRequest = (options = {}) => {
|
|
6951
|
+
return useConnectedMutation_default(CancelGroupRequest, options);
|
|
6952
|
+
};
|
|
6953
|
+
|
|
6808
6954
|
// src/mutations/groups/useCreateGroup.ts
|
|
6809
6955
|
var CreateGroup = async ({
|
|
6810
6956
|
group,
|
|
@@ -6867,12 +7013,22 @@ var useCreateGroupInvitations = (options = {}) => {
|
|
|
6867
7013
|
// src/mutations/groups/useCreateGroupRequest.ts
|
|
6868
7014
|
var CreateGroupRequest = async ({
|
|
6869
7015
|
groupId,
|
|
6870
|
-
clientApiParams
|
|
7016
|
+
clientApiParams,
|
|
7017
|
+
queryClient
|
|
6871
7018
|
}) => {
|
|
6872
7019
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6873
7020
|
const { data } = await clientApi.post(
|
|
6874
7021
|
`/groups/${groupId}/requests`
|
|
6875
7022
|
);
|
|
7023
|
+
if (queryClient && data.status === "ok") {
|
|
7024
|
+
ADD_SELF_RELATIONSHIP(
|
|
7025
|
+
queryClient,
|
|
7026
|
+
[clientApiParams.locale],
|
|
7027
|
+
"groups",
|
|
7028
|
+
groupId,
|
|
7029
|
+
"requested"
|
|
7030
|
+
);
|
|
7031
|
+
}
|
|
6876
7032
|
return data;
|
|
6877
7033
|
};
|
|
6878
7034
|
var useCreateGroupRequest = (options = {}) => {
|
|
@@ -6915,7 +7071,7 @@ var CancelGroupInvitation = async ({
|
|
|
6915
7071
|
}) => {
|
|
6916
7072
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
6917
7073
|
const { data } = await clientApi.delete(
|
|
6918
|
-
`/groups/${groupId}/invitations/${invitationId}`
|
|
7074
|
+
`/groups/${groupId}/invitations/${invitationId}/cancel`
|
|
6919
7075
|
);
|
|
6920
7076
|
if (queryClient && data.status === "ok") {
|
|
6921
7077
|
queryClient.invalidateQueries({
|
|
@@ -7013,13 +7169,19 @@ var RejectGroupRequest = async ({
|
|
|
7013
7169
|
}) => {
|
|
7014
7170
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
7015
7171
|
const { data } = await clientApi.put(
|
|
7016
|
-
`/groups/${groupId}/requests/${requestId}`
|
|
7172
|
+
`/groups/${groupId}/requests/${requestId}/reject`
|
|
7017
7173
|
);
|
|
7018
7174
|
if (queryClient && data.status === "ok") {
|
|
7019
7175
|
SET_GROUP_REQUEST_QUERY_DATA(queryClient, [groupId, data.data.id], data);
|
|
7020
7176
|
queryClient.invalidateQueries({
|
|
7021
7177
|
queryKey: GROUP_REQUESTS_QUERY_KEY(groupId)
|
|
7022
7178
|
});
|
|
7179
|
+
REMOVE_SELF_RELATIONSHIP(
|
|
7180
|
+
queryClient,
|
|
7181
|
+
[clientApiParams.locale],
|
|
7182
|
+
"groups",
|
|
7183
|
+
groupId
|
|
7184
|
+
);
|
|
7023
7185
|
}
|
|
7024
7186
|
return data;
|
|
7025
7187
|
};
|
|
@@ -7160,7 +7322,7 @@ var ReinviteGroupInvitation = async ({
|
|
|
7160
7322
|
queryClient
|
|
7161
7323
|
}) => {
|
|
7162
7324
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
7163
|
-
const { data } = await clientApi.
|
|
7325
|
+
const { data } = await clientApi.put(
|
|
7164
7326
|
`/groups/${groupId}/invitations/${invitationId}/reinvite`
|
|
7165
7327
|
);
|
|
7166
7328
|
if (queryClient && data.status === "ok") {
|
|
@@ -7180,13 +7342,12 @@ var useReinviteGroupInvitation = (options = {}) => {
|
|
|
7180
7342
|
// src/mutations/groups/useRejectGroupInvitation.ts
|
|
7181
7343
|
var RejectGroupInvitation = async ({
|
|
7182
7344
|
groupId,
|
|
7183
|
-
invitationId,
|
|
7184
7345
|
clientApiParams,
|
|
7185
7346
|
queryClient
|
|
7186
7347
|
}) => {
|
|
7187
7348
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
7188
7349
|
const { data } = await clientApi.put(
|
|
7189
|
-
`/groups/${groupId}/invitations
|
|
7350
|
+
`/groups/${groupId}/invitations/reject`
|
|
7190
7351
|
);
|
|
7191
7352
|
if (queryClient && data.status === "ok") {
|
|
7192
7353
|
queryClient.invalidateQueries({
|
|
@@ -7195,6 +7356,12 @@ var RejectGroupInvitation = async ({
|
|
|
7195
7356
|
queryClient.invalidateQueries({
|
|
7196
7357
|
queryKey: SELF_NOTIFICATION_COUNT_QUERY_KEY("")
|
|
7197
7358
|
});
|
|
7359
|
+
REMOVE_SELF_RELATIONSHIP(
|
|
7360
|
+
queryClient,
|
|
7361
|
+
[clientApiParams.locale],
|
|
7362
|
+
"groups",
|
|
7363
|
+
groupId
|
|
7364
|
+
);
|
|
7198
7365
|
}
|
|
7199
7366
|
return data;
|
|
7200
7367
|
};
|
|
@@ -7743,6 +7910,7 @@ export {
|
|
|
7743
7910
|
CacheIndividualQueries,
|
|
7744
7911
|
CancelEventRegistration,
|
|
7745
7912
|
CancelGroupInvitation,
|
|
7913
|
+
CancelGroupRequest,
|
|
7746
7914
|
CancelSubscription,
|
|
7747
7915
|
CancelTransfer,
|
|
7748
7916
|
CaptureInvoicePayment,
|
|
@@ -7802,7 +7970,10 @@ export {
|
|
|
7802
7970
|
EventSource,
|
|
7803
7971
|
EventType,
|
|
7804
7972
|
FollowAccount,
|
|
7973
|
+
GROUPS_FEATURED_QUERY_KEY,
|
|
7974
|
+
GROUPS_INVITED_QUERY_KEY,
|
|
7805
7975
|
GROUPS_QUERY_KEY,
|
|
7976
|
+
GROUPS_REQUESTED_QUERY_KEY,
|
|
7806
7977
|
GROUP_ACTIVITIES_QUERY_KEY,
|
|
7807
7978
|
GROUP_ANNOUNCEMENTS_QUERY_KEY,
|
|
7808
7979
|
GROUP_EVENTS_QUERY_KEY,
|
|
@@ -7866,6 +8037,9 @@ export {
|
|
|
7866
8037
|
GetGroupRequests,
|
|
7867
8038
|
GetGroupSponsors,
|
|
7868
8039
|
GetGroups,
|
|
8040
|
+
GetGroupsFeatured,
|
|
8041
|
+
GetGroupsInvited,
|
|
8042
|
+
GetGroupsRequested,
|
|
7869
8043
|
GetInterests,
|
|
7870
8044
|
GetInvoice,
|
|
7871
8045
|
GetLevel,
|
|
@@ -8161,6 +8335,7 @@ export {
|
|
|
8161
8335
|
useAddSelfInterests,
|
|
8162
8336
|
useCancelEventRegistration,
|
|
8163
8337
|
useCancelGroupInvitation,
|
|
8338
|
+
useCancelGroupRequest,
|
|
8164
8339
|
useCancelSubscription,
|
|
8165
8340
|
useCancelTransfer,
|
|
8166
8341
|
useCaptureInvoicePayment,
|
|
@@ -8247,6 +8422,9 @@ export {
|
|
|
8247
8422
|
useGetGroupRequests,
|
|
8248
8423
|
useGetGroupSponsors,
|
|
8249
8424
|
useGetGroups,
|
|
8425
|
+
useGetGroupsFeatured,
|
|
8426
|
+
useGetGroupsInvited,
|
|
8427
|
+
useGetGroupsRequested,
|
|
8250
8428
|
useGetInterests,
|
|
8251
8429
|
useGetInvoice,
|
|
8252
8430
|
useGetLevel,
|
|
@@ -8303,10 +8481,10 @@ export {
|
|
|
8303
8481
|
useGetSeries,
|
|
8304
8482
|
useGetSeriesEvents,
|
|
8305
8483
|
useGetSeriesList,
|
|
8484
|
+
useGroupStatus,
|
|
8306
8485
|
useIsAccountFollowing,
|
|
8307
8486
|
useIsChannelSubscribed,
|
|
8308
8487
|
useIsEventRegistered,
|
|
8309
|
-
useIsGroupMember,
|
|
8310
8488
|
useJoinGroup,
|
|
8311
8489
|
useLeaveGroup,
|
|
8312
8490
|
useLeaveSelfChatChannel,
|