synapse-react-client 4.0.21 → 4.0.22
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/SWC.index.d.ts +1 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/components/CardContainer/CardContainer.d.ts.map +1 -1
- package/dist/components/CardContainer/CardContainer.js +43 -49
- package/dist/components/CardContainer/CardContainer.js.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts +13 -0
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.js +64 -40
- package/dist/components/CardContainerLogic/CardContainerLogic.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.css +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
- package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.scss +0 -1
- package/dist/components/DataGrid/DataGrid.d.ts +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +72 -72
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +209 -206
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts +2 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js +51 -42
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +68 -67
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts +1 -0
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +4 -3
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js +15 -14
- package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts +7 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js +8 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js.map +1 -0
- package/dist/components/Goals/Goals.d.ts +8 -0
- package/dist/components/Goals/Goals.d.ts.map +1 -1
- package/dist/components/Goals/Goals.js +54 -40
- package/dist/components/Goals/Goals.js.map +1 -1
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts +9 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js +69 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts +13 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js +11 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts +5 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.js +7 -0
- package/dist/components/ProjectVisibilityChip/index.js.map +1 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.js +9 -12
- package/dist/components/QueryWrapperPlotNav/RowSetView.js.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.d.ts +7 -15
- package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.js +114 -123
- package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
- package/dist/components/UserCardList/UserCardList.d.ts +2 -20
- package/dist/components/UserCardList/UserCardList.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardList.js +49 -72
- package/dist/components/UserCardList/UserCardList.js.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.d.ts +13 -0
- package/dist/components/UserCardList/UserCardListRotate.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.js +82 -57
- package/dist/components/UserCardList/UserCardListRotate.js.map +1 -1
- package/dist/style/abstracts/_cssVariables.scss +1 -0
- package/dist/style/main.css +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +1 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +3 -0
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/index.js +46 -44
- package/dist/synapse-queries/user/index.js +3 -3
- package/dist/synapse-queries/user/useUserBundle.d.ts +12 -0
- package/dist/synapse-queries/user/useUserBundle.d.ts.map +1 -1
- package/dist/synapse-queries/user/useUserBundle.js +50 -36
- package/dist/synapse-queries/user/useUserBundle.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts +10 -5
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts.map +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js +13 -9
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js.map +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts.map +1 -1
- package/dist/utils/functions/SqlFunctions.js +1 -1
- package/dist/utils/functions/SqlFunctions.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,88 +1,102 @@
|
|
|
1
1
|
import "../../utils/SynapseConstants.js";
|
|
2
2
|
import e from "../../synapse-client/index.js";
|
|
3
3
|
import { useSynapseContext as t } from "../../utils/context/SynapseContext.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getUserProfileWithProfilePicAttached as n } from "../../utils/functions/getUserData.js";
|
|
5
|
+
import { queryOptions as r, useQuery as i, useSuspenseQuery as a } from "@tanstack/react-query";
|
|
5
6
|
//#region src/synapse-queries/user/useUserBundle.ts
|
|
6
|
-
function
|
|
7
|
-
let { accessToken:
|
|
8
|
-
return
|
|
7
|
+
function o(n) {
|
|
8
|
+
let { accessToken: r, keyFactory: a } = t();
|
|
9
|
+
return i({
|
|
9
10
|
...n,
|
|
10
11
|
queryKey: a.getNotificationEmailQueryKey(),
|
|
11
|
-
queryFn: () => e.getNotificationEmail(
|
|
12
|
+
queryFn: () => e.getNotificationEmail(r)
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function s() {
|
|
15
16
|
let { accessToken: n, keyFactory: r } = t();
|
|
16
17
|
return {
|
|
17
18
|
queryKey: r.getCurrentUserProfileQueryKey(),
|
|
18
19
|
queryFn: () => e.getUserProfile(n)
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
let t =
|
|
23
|
-
return
|
|
22
|
+
function c(e) {
|
|
23
|
+
let t = s();
|
|
24
|
+
return i({
|
|
24
25
|
...e,
|
|
25
26
|
...t
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
let t =
|
|
30
|
-
return
|
|
29
|
+
function l(e) {
|
|
30
|
+
let t = s();
|
|
31
|
+
return a({
|
|
31
32
|
...e,
|
|
32
33
|
...t
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
var
|
|
36
|
-
function
|
|
37
|
-
let { accessToken: o, keyFactory: s } = t(), c = s.getUserBundleQueryKey(n,
|
|
38
|
-
return
|
|
36
|
+
var u = 127;
|
|
37
|
+
function d(n, r = u, a) {
|
|
38
|
+
let { accessToken: o, keyFactory: s } = t(), c = s.getUserBundleQueryKey(n, r);
|
|
39
|
+
return i({
|
|
39
40
|
...a,
|
|
40
41
|
queryKey: c,
|
|
41
|
-
queryFn: () => e.getUserBundle(n,
|
|
42
|
+
queryFn: () => e.getUserBundle(n, r, o)
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function f(n = u, r) {
|
|
45
46
|
let { accessToken: a, keyFactory: o } = t(), s = o.getUserBundleQueryKey("current", n);
|
|
46
|
-
return
|
|
47
|
-
...
|
|
47
|
+
return i({
|
|
48
|
+
...r,
|
|
48
49
|
queryKey: s,
|
|
49
50
|
queryFn: () => e.getMyUserBundle(n, a)
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
let { accessToken: i, keyFactory: a } =
|
|
54
|
-
return
|
|
53
|
+
function p(t, n) {
|
|
54
|
+
let { accessToken: i, keyFactory: a } = n;
|
|
55
|
+
return r({
|
|
55
56
|
queryKey: a.getUserProfileQueryKey(t),
|
|
56
57
|
queryFn: () => e.getUserProfileById(t, i)
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
let { accessToken: a, keyFactory: o } = t(), s = `${n}_USER_PROFILE
|
|
61
|
-
return
|
|
62
|
-
...
|
|
63
|
-
...
|
|
60
|
+
function m(n, r) {
|
|
61
|
+
let { accessToken: a, keyFactory: o } = t(), s = `${n}_USER_PROFILE`;
|
|
62
|
+
return i({
|
|
63
|
+
...r,
|
|
64
|
+
...p(n, {
|
|
64
65
|
accessToken: a,
|
|
65
66
|
keyFactory: o
|
|
66
67
|
}),
|
|
67
68
|
queryFn: async () => {
|
|
68
69
|
let t = await e.getUserProfileById(n, a);
|
|
69
70
|
return sessionStorage.setItem(s, JSON.stringify(t)), t;
|
|
70
|
-
}
|
|
71
|
-
placeholderData: c ? JSON.parse(c) : i?.placeholderData
|
|
71
|
+
}
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
let { accessToken: a, keyFactory: o } = t(), s = o.getPrincipalAliasQueryKey(n);
|
|
74
|
+
function h(e, t) {
|
|
76
75
|
return r({
|
|
77
|
-
|
|
76
|
+
queryKey: t.keyFactory.getUserProfilesWithProfilePicAttachedQueryKey(e),
|
|
77
|
+
queryFn: () => n(e)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function g(e, n) {
|
|
81
|
+
let { keyFactory: r } = t();
|
|
82
|
+
return i({
|
|
83
|
+
...h(e, { keyFactory: r }),
|
|
84
|
+
enabled: e.length > 0,
|
|
85
|
+
...n
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function _(n, r) {
|
|
89
|
+
let { accessToken: a, keyFactory: o } = t(), s = o.getPrincipalAliasQueryKey(n);
|
|
90
|
+
return i({
|
|
91
|
+
...r,
|
|
78
92
|
queryKey: s,
|
|
79
93
|
queryFn: async () => (await e.getPrincipalAliasRequest(a, n)).principalId
|
|
80
94
|
});
|
|
81
95
|
}
|
|
82
|
-
function
|
|
83
|
-
return
|
|
96
|
+
function v() {
|
|
97
|
+
return f(void 0, { select: (e) => e.isACTMember });
|
|
84
98
|
}
|
|
85
99
|
//#endregion
|
|
86
|
-
export {
|
|
100
|
+
export { p as getUserProfileQuery, h as getUserProfilesWithProfilePicAttachedQueryOptions, f as useGetCurrentUserBundle, c as useGetCurrentUserProfile, o as useGetNotificationEmail, _ as useGetPrincipalIdForAlias, d as useGetUserBundle, m as useGetUserProfile, g as useGetUserProfilesWithProfilePicAttached, v as useIsCurrentUserACTMember, l as useSuspenseGetCurrentUserProfile };
|
|
87
101
|
|
|
88
102
|
//# sourceMappingURL=useUserBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserBundle.js","names":[],"sources":["../../../src/synapse-queries/user/useUserBundle.ts"],"sourcesContent":["import SynapseClient from '@/synapse-client'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport {\n USER_BUNDLE_MASK_IS_ACT_MEMBER,\n USER_BUNDLE_MASK_IS_AR_REVIEWER,\n USER_BUNDLE_MASK_IS_CERTIFIED,\n USER_BUNDLE_MASK_IS_VERIFIED,\n USER_BUNDLE_MASK_ORCID,\n USER_BUNDLE_MASK_USER_PROFILE,\n USER_BUNDLE_MASK_VERIFICATION_SUBMISSION,\n} from '@/utils/SynapseConstants'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport {\n NotificationEmail,\n PrincipalAliasRequest,\n PrincipalAliasResponse,\n UserBundle,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n queryOptions,\n useQuery,\n UseQueryOptions,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport type { SynapseQueriesContext } from '../types'\n\nexport function useGetNotificationEmail(\n options?: Partial<UseQueryOptions<NotificationEmail, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n return useQuery({\n ...options,\n queryKey: keyFactory.getNotificationEmailQueryKey(),\n queryFn: () => SynapseClient.getNotificationEmail(accessToken),\n })\n}\n\nfunction useGetCurrentUserProfileQueryOptions() {\n const { accessToken, keyFactory } = useSynapseContext()\n const queryKey = keyFactory.getCurrentUserProfileQueryKey()\n return {\n queryKey: queryKey,\n queryFn: () => SynapseClient.getUserProfile(accessToken),\n }\n}\n\nexport function useGetCurrentUserProfile(\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const queryOptions = useGetCurrentUserProfileQueryOptions()\n return useQuery({\n ...options,\n ...queryOptions,\n })\n}\n\nexport function useSuspenseGetCurrentUserProfile(\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const queryOptions = useGetCurrentUserProfileQueryOptions()\n\n return useSuspenseQuery({\n ...options,\n ...queryOptions,\n })\n}\n\nconst ALL_USER_BUNDLE_FIELDS =\n USER_BUNDLE_MASK_USER_PROFILE |\n USER_BUNDLE_MASK_ORCID |\n USER_BUNDLE_MASK_VERIFICATION_SUBMISSION |\n USER_BUNDLE_MASK_IS_CERTIFIED |\n USER_BUNDLE_MASK_IS_VERIFIED |\n USER_BUNDLE_MASK_IS_ACT_MEMBER |\n USER_BUNDLE_MASK_IS_AR_REVIEWER\n\nexport function useGetUserBundle(\n userId: string,\n mask: number = ALL_USER_BUNDLE_FIELDS,\n options?: Partial<UseQueryOptions<UserBundle, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n const queryKey = keyFactory.getUserBundleQueryKey(userId, mask)\n\n return useQuery({\n ...options,\n queryKey: queryKey,\n queryFn: () => SynapseClient.getUserBundle(userId, mask, accessToken),\n })\n}\n\nexport function useGetCurrentUserBundle<TData = UserBundle>(\n mask: number = ALL_USER_BUNDLE_FIELDS,\n options?: Partial<UseQueryOptions<UserBundle, SynapseClientError, TData>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n\n const queryKey = keyFactory.getUserBundleQueryKey('current', mask)\n\n return useQuery({\n ...options,\n queryKey: queryKey,\n queryFn: () => SynapseClient.getMyUserBundle(mask, accessToken),\n })\n}\n\nexport function getUserProfileQuery(\n principalId: string,\n context: Pick<SynapseQueriesContext, 'accessToken' | 'keyFactory'>,\n) {\n const { accessToken, keyFactory } = context\n return queryOptions<UserProfile, SynapseClientError>({\n queryKey: keyFactory.getUserProfileQueryKey(principalId),\n queryFn: () => SynapseClient.getUserProfileById(principalId, accessToken),\n })\n}\n\nexport function useGetUserProfile(\n principalId: string,\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n // We store the profile in a session storage cache used by SWC\n const sessionStorageCacheKey = `${principalId}_USER_PROFILE`\n
|
|
1
|
+
{"version":3,"file":"useUserBundle.js","names":[],"sources":["../../../src/synapse-queries/user/useUserBundle.ts"],"sourcesContent":["import SynapseClient from '@/synapse-client'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { getUserProfileWithProfilePicAttached } from '@/utils/functions/getUserData'\nimport {\n USER_BUNDLE_MASK_IS_ACT_MEMBER,\n USER_BUNDLE_MASK_IS_AR_REVIEWER,\n USER_BUNDLE_MASK_IS_CERTIFIED,\n USER_BUNDLE_MASK_IS_VERIFIED,\n USER_BUNDLE_MASK_ORCID,\n USER_BUNDLE_MASK_USER_PROFILE,\n USER_BUNDLE_MASK_VERIFICATION_SUBMISSION,\n} from '@/utils/SynapseConstants'\nimport { SynapseClientError } from '@sage-bionetworks/synapse-client/util/SynapseClientError'\nimport {\n NotificationEmail,\n PrincipalAliasRequest,\n PrincipalAliasResponse,\n UserBundle,\n UserProfile,\n} from '@sage-bionetworks/synapse-types'\nimport {\n queryOptions,\n useQuery,\n UseQueryOptions,\n useSuspenseQuery,\n} from '@tanstack/react-query'\nimport type { SynapseQueriesContext } from '../types'\n\nexport type UserProfileWithProfilePicList = {\n list: UserProfile[]\n}\n\nexport function useGetNotificationEmail(\n options?: Partial<UseQueryOptions<NotificationEmail, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n return useQuery({\n ...options,\n queryKey: keyFactory.getNotificationEmailQueryKey(),\n queryFn: () => SynapseClient.getNotificationEmail(accessToken),\n })\n}\n\nfunction useGetCurrentUserProfileQueryOptions() {\n const { accessToken, keyFactory } = useSynapseContext()\n const queryKey = keyFactory.getCurrentUserProfileQueryKey()\n return {\n queryKey: queryKey,\n queryFn: () => SynapseClient.getUserProfile(accessToken),\n }\n}\n\nexport function useGetCurrentUserProfile(\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const queryOptions = useGetCurrentUserProfileQueryOptions()\n return useQuery({\n ...options,\n ...queryOptions,\n })\n}\n\nexport function useSuspenseGetCurrentUserProfile(\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const queryOptions = useGetCurrentUserProfileQueryOptions()\n\n return useSuspenseQuery({\n ...options,\n ...queryOptions,\n })\n}\n\nconst ALL_USER_BUNDLE_FIELDS =\n USER_BUNDLE_MASK_USER_PROFILE |\n USER_BUNDLE_MASK_ORCID |\n USER_BUNDLE_MASK_VERIFICATION_SUBMISSION |\n USER_BUNDLE_MASK_IS_CERTIFIED |\n USER_BUNDLE_MASK_IS_VERIFIED |\n USER_BUNDLE_MASK_IS_ACT_MEMBER |\n USER_BUNDLE_MASK_IS_AR_REVIEWER\n\nexport function useGetUserBundle(\n userId: string,\n mask: number = ALL_USER_BUNDLE_FIELDS,\n options?: Partial<UseQueryOptions<UserBundle, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n const queryKey = keyFactory.getUserBundleQueryKey(userId, mask)\n\n return useQuery({\n ...options,\n queryKey: queryKey,\n queryFn: () => SynapseClient.getUserBundle(userId, mask, accessToken),\n })\n}\n\nexport function useGetCurrentUserBundle<TData = UserBundle>(\n mask: number = ALL_USER_BUNDLE_FIELDS,\n options?: Partial<UseQueryOptions<UserBundle, SynapseClientError, TData>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n\n const queryKey = keyFactory.getUserBundleQueryKey('current', mask)\n\n return useQuery({\n ...options,\n queryKey: queryKey,\n queryFn: () => SynapseClient.getMyUserBundle(mask, accessToken),\n })\n}\n\nexport function getUserProfileQuery(\n principalId: string,\n context: Pick<SynapseQueriesContext, 'accessToken' | 'keyFactory'>,\n) {\n const { accessToken, keyFactory } = context\n return queryOptions<UserProfile, SynapseClientError>({\n queryKey: keyFactory.getUserProfileQueryKey(principalId),\n queryFn: () => SynapseClient.getUserProfileById(principalId, accessToken),\n })\n}\n\nexport function useGetUserProfile(\n principalId: string,\n options?: Partial<UseQueryOptions<UserProfile, SynapseClientError>>,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n // We store the profile in a session storage cache used by SWC\n const sessionStorageCacheKey = `${principalId}_USER_PROFILE`\n\n return useQuery({\n ...options,\n ...getUserProfileQuery(principalId, { accessToken, keyFactory }),\n queryFn: async () => {\n const userProfile = await SynapseClient.getUserProfileById(\n principalId,\n accessToken,\n )\n // If the profile is re-fetched, save it to sessionStorage\n sessionStorage.setItem(\n sessionStorageCacheKey,\n JSON.stringify(userProfile),\n )\n return userProfile\n },\n })\n}\n\nexport function getUserProfilesWithProfilePicAttachedQueryOptions(\n principalIds: string[],\n context: Pick<SynapseQueriesContext, 'keyFactory'>,\n) {\n return queryOptions<UserProfileWithProfilePicList, SynapseClientError>({\n queryKey:\n context.keyFactory.getUserProfilesWithProfilePicAttachedQueryKey(\n principalIds,\n ),\n queryFn: () => getUserProfileWithProfilePicAttached(principalIds),\n })\n}\n\nexport function useGetUserProfilesWithProfilePicAttached(\n principalIds: string[],\n options?: Partial<\n UseQueryOptions<UserProfileWithProfilePicList, SynapseClientError>\n >,\n) {\n const { keyFactory } = useSynapseContext()\n return useQuery({\n ...getUserProfilesWithProfilePicAttachedQueryOptions(principalIds, {\n keyFactory,\n }),\n enabled: principalIds.length > 0,\n ...options,\n })\n}\n\nexport function useGetPrincipalIdForAlias(\n request: PrincipalAliasRequest,\n options?: Partial<\n UseQueryOptions<PrincipalAliasResponse['principalId'], SynapseClientError>\n >,\n) {\n const { accessToken, keyFactory } = useSynapseContext()\n\n const queryKey = keyFactory.getPrincipalAliasQueryKey(request)\n\n return useQuery({\n ...options,\n queryKey: queryKey,\n queryFn: async () => {\n return (\n await SynapseClient.getPrincipalAliasRequest(accessToken, request)\n ).principalId\n },\n })\n}\n\nexport function useIsCurrentUserACTMember() {\n return useGetCurrentUserBundle<boolean>(undefined, {\n select: data => data.isACTMember!,\n })\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,EACd,GACA;CACA,IAAM,EAAE,gBAAa,kBAAe,EAAkB;CACtD,OAAO,EAAS;EACd,GAAG;EACH,UAAU,EAAW,6BAA6B;EAClD,eAAe,EAAc,qBAAqB,CAAW;CAC/D,CAAC;AACH;AAEA,SAAS,IAAuC;CAC9C,IAAM,EAAE,gBAAa,kBAAe,EAAkB;CAEtD,OAAO;EACK,UAFK,EAAW,8BAEhB;EACV,eAAe,EAAc,eAAe,CAAW;CACzD;AACF;AAEA,SAAgB,EACd,GACA;CACA,IAAM,IAAe,EAAqC;CAC1D,OAAO,EAAS;EACd,GAAG;EACH,GAAG;CACL,CAAC;AACH;AAEA,SAAgB,EACd,GACA;CACA,IAAM,IAAe,EAAqC;CAE1D,OAAO,EAAiB;EACtB,GAAG;EACH,GAAG;CACL,CAAC;AACH;AAEA,IAAM,IAAA;AASN,SAAgB,EACd,GACA,IAAe,GACf,GACA;CACA,IAAM,EAAE,gBAAa,kBAAe,EAAkB,GAChD,IAAW,EAAW,sBAAsB,GAAQ,CAAI;CAE9D,OAAO,EAAS;EACd,GAAG;EACO;EACV,eAAe,EAAc,cAAc,GAAQ,GAAM,CAAW;CACtE,CAAC;AACH;AAEA,SAAgB,EACd,IAAe,GACf,GACA;CACA,IAAM,EAAE,gBAAa,kBAAe,EAAkB,GAEhD,IAAW,EAAW,sBAAsB,WAAW,CAAI;CAEjE,OAAO,EAAS;EACd,GAAG;EACO;EACV,eAAe,EAAc,gBAAgB,GAAM,CAAW;CAChE,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA;CACA,IAAM,EAAE,gBAAa,kBAAe;CACpC,OAAO,EAA8C;EACnD,UAAU,EAAW,uBAAuB,CAAW;EACvD,eAAe,EAAc,mBAAmB,GAAa,CAAW;CAC1E,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA;CACA,IAAM,EAAE,gBAAa,kBAAe,EAAkB,GAEhD,IAAyB,GAAG,EAAY;CAE9C,OAAO,EAAS;EACd,GAAG;EACH,GAAG,EAAoB,GAAa;GAAE;GAAa;EAAW,CAAC;EAC/D,SAAS,YAAY;GACnB,IAAM,IAAc,MAAM,EAAc,mBACtC,GACA,CACF;GAMA,OAJA,eAAe,QACb,GACA,KAAK,UAAU,CAAW,CAC5B,GACO;EACT;CACF,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GACA;CACA,OAAO,EAAgE;EACrE,UACE,EAAQ,WAAW,8CACjB,CACF;EACF,eAAe,EAAqC,CAAY;CAClE,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GAGA;CACA,IAAM,EAAE,kBAAe,EAAkB;CACzC,OAAO,EAAS;EACd,GAAG,EAAkD,GAAc,EACjE,cACF,CAAC;EACD,SAAS,EAAa,SAAS;EAC/B,GAAG;CACL,CAAC;AACH;AAEA,SAAgB,EACd,GACA,GAGA;CACA,IAAM,EAAE,gBAAa,kBAAe,EAAkB,GAEhD,IAAW,EAAW,0BAA0B,CAAO;CAE7D,OAAO,EAAS;EACd,GAAG;EACO;EACV,SAAS,aAEL,MAAM,EAAc,yBAAyB,GAAa,CAAO,GACjE;CAEN,CAAC;AACH;AAEA,SAAgB,IAA4B;CAC1C,OAAO,EAAiC,KAAA,GAAW,EACjD,SAAQ,MAAQ,EAAK,YACvB,CAAC;AACH"}
|