@axcode/axcloud-sdk 0.4.0-dev.35742cb → 0.4.0-dev.88ecf17
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/README.md +26 -0
- package/dist/barnsport.d.mts +5 -4
- package/dist/barnsport.d.ts +5 -4
- package/dist/index.d.mts +63 -10
- package/dist/index.d.ts +63 -10
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -2
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.mts +4 -3
- package/dist/public.d.ts +4 -3
- package/dist/{useBarnsport-DHyNF9GM.d.mts → useBarnsport-3NwAFn3h.d.mts} +2 -1
- package/dist/{useBarnsport-DHyNF9GM.d.ts → useBarnsport-3NwAFn3h.d.ts} +2 -1
- package/dist/{useContent-CGI1l3Gs.d.ts → useContent-BULNVLEx.d.ts} +2 -1
- package/dist/{useContent-DLoyqAWH.d.mts → useContent-qNaQd8Xi.d.mts} +2 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -77,6 +77,26 @@ async function submitForm(apiUrl, submission) {
|
|
|
77
77
|
throw primaryError;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
async function getMembershipSections(apiUrl, options) {
|
|
81
|
+
const baseUrl = apiUrl.replace(/\/$/, "");
|
|
82
|
+
const response = await fetch(
|
|
83
|
+
`${baseUrl}/public/membership-sections?site=${encodeURIComponent(options.site)}`,
|
|
84
|
+
{
|
|
85
|
+
method: "GET",
|
|
86
|
+
headers: { "X-Api-Key": options.apiKey },
|
|
87
|
+
signal: options.signal
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
const error = await response.json().catch(() => ({}));
|
|
92
|
+
throw new Error(error.message || `Membership sections request failed (${response.status})`);
|
|
93
|
+
}
|
|
94
|
+
const result = await response.json().catch(() => ({}));
|
|
95
|
+
const sections = Array.isArray(result?.sections) ? result.sections : [];
|
|
96
|
+
return sections.filter(
|
|
97
|
+
(section) => !!section && typeof section.id === "string" && typeof section.name === "string"
|
|
98
|
+
).map(({ id, name }) => ({ id, name }));
|
|
99
|
+
}
|
|
80
100
|
function createFormHelper(config) {
|
|
81
101
|
return {
|
|
82
102
|
/**
|
|
@@ -109,6 +129,14 @@ function createFormHelper(config) {
|
|
|
109
129
|
email,
|
|
110
130
|
data
|
|
111
131
|
}),
|
|
132
|
+
/**
|
|
133
|
+
* List the sections offered in the membership application
|
|
134
|
+
*/
|
|
135
|
+
getMembershipSections: (options = {}) => getMembershipSections(config.apiUrl, {
|
|
136
|
+
apiKey: config.apiKey,
|
|
137
|
+
site: config.site,
|
|
138
|
+
signal: options.signal
|
|
139
|
+
}),
|
|
112
140
|
/**
|
|
113
141
|
* Generic submit function
|
|
114
142
|
*/
|
|
@@ -413,7 +441,8 @@ function useAuth() {
|
|
|
413
441
|
}
|
|
414
442
|
}, [getAccessTokenSilently]);
|
|
415
443
|
const refreshUser = useCallback(async () => {
|
|
416
|
-
await getAccessTokenSilently({ cacheMode: "off" });
|
|
444
|
+
const token = await getAccessTokenSilently({ cacheMode: "off" });
|
|
445
|
+
if (!token) return false;
|
|
417
446
|
const claims = await getIdTokenClaims();
|
|
418
447
|
return claims?.email_verified === true;
|
|
419
448
|
}, [getAccessTokenSilently, getIdTokenClaims]);
|
|
@@ -1537,6 +1566,6 @@ function LinkedAccountsList({
|
|
|
1537
1566
|
] });
|
|
1538
1567
|
}
|
|
1539
1568
|
|
|
1540
|
-
export { AxCloudProvider, LinkedAccountsList, LoginButton, LogoutButton, ModuleGate, ProtectedRoute, castVote, castVoteWithCode, checkEligibility, checkVotingCode, createFormHelper, getBallot, getVotingReceipt, submitForm, useAuth, useAvatar, useBranding, useCodeBallot, useDocumentDownload, useDocuments, useFormStats, useForms, useLinkedAccounts, useLogo, useMedia, useMediaList, useMemberDocumentDownload, useMemberDocumentFolders, useMemberDocuments, useModuleAccess, useMySection, useNews, useOrg, useSections, useUpdateFormSubmission, useUpdateMyProfile, useUser, userHasAllPermissions, userHasAnyPermission, userHasPermission };
|
|
1569
|
+
export { AxCloudProvider, LinkedAccountsList, LoginButton, LogoutButton, ModuleGate, ProtectedRoute, castVote, castVoteWithCode, checkEligibility, checkVotingCode, createFormHelper, getBallot, getMembershipSections, getVotingReceipt, submitForm, useAuth, useAvatar, useBranding, useCodeBallot, useDocumentDownload, useDocuments, useFormStats, useForms, useLinkedAccounts, useLogo, useMedia, useMediaList, useMemberDocumentDownload, useMemberDocumentFolders, useMemberDocuments, useModuleAccess, useMySection, useNews, useOrg, useSections, useUpdateFormSubmission, useUpdateMyProfile, useUser, userHasAllPermissions, userHasAnyPermission, userHasPermission };
|
|
1541
1570
|
//# sourceMappingURL=index.mjs.map
|
|
1542
1571
|
//# sourceMappingURL=index.mjs.map
|