@axcode/axcloud-sdk 0.1.7-dev.87ea138 → 0.1.7-dev.cc5cc69
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 +265 -144
- package/dist/index.d.mts +291 -92
- package/dist/index.d.ts +291 -92
- package/dist/index.js +808 -171
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +799 -174
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/dist/index.d.mts
CHANGED
|
@@ -93,12 +93,57 @@ declare class AxCloudError extends Error {
|
|
|
93
93
|
}
|
|
94
94
|
declare function isAxCloudError(error: unknown): error is AxCloudError;
|
|
95
95
|
|
|
96
|
+
type AnalyticsEventValue = string | number | boolean;
|
|
97
|
+
type AnalyticsEventData = Record<string, AnalyticsEventValue>;
|
|
98
|
+
interface AxCloudAnalyticsOptions {
|
|
99
|
+
/** Site key configured in AxCloud, for example "public-web". */
|
|
100
|
+
siteKey: string;
|
|
101
|
+
/** Analytics is opt-in and disabled unless this is true. */
|
|
102
|
+
enabled?: boolean;
|
|
103
|
+
/** Allow local collection for explicit development tests. */
|
|
104
|
+
trackLocalhost?: boolean;
|
|
105
|
+
/** Override path normalization. Return null to skip a pageview. */
|
|
106
|
+
normalizePath?: (pathname: string) => string | null;
|
|
107
|
+
}
|
|
108
|
+
interface AnalyticsPublicConfig {
|
|
109
|
+
enabled: boolean;
|
|
110
|
+
provider?: 'umami';
|
|
111
|
+
websiteId?: string;
|
|
112
|
+
scriptUrl?: string;
|
|
113
|
+
hostUrl?: string;
|
|
114
|
+
domains?: string[];
|
|
115
|
+
autoTrack?: boolean;
|
|
116
|
+
respectDoNotTrack?: boolean;
|
|
117
|
+
excludeSearch?: boolean;
|
|
118
|
+
excludeHash?: boolean;
|
|
119
|
+
allowedEvents?: string[];
|
|
120
|
+
}
|
|
121
|
+
interface AnalyticsRuntime {
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
ready: boolean;
|
|
124
|
+
track: (eventName: string, data?: AnalyticsEventData) => boolean;
|
|
125
|
+
trackPageView: (pathname?: string) => boolean;
|
|
126
|
+
}
|
|
127
|
+
declare function isLocalAnalyticsHostname(hostname: string): boolean;
|
|
128
|
+
declare function sanitizeAnalyticsPath(pathname: string, customNormalizer?: (pathname: string) => string | null): string | null;
|
|
129
|
+
declare function sanitizeAnalyticsEventData(data: AnalyticsEventData | undefined): AnalyticsEventData | undefined;
|
|
130
|
+
declare function isAllowedAnalyticsEvent(eventName: string, allowedEvents: string[] | undefined): boolean;
|
|
131
|
+
declare function fetchAnalyticsPublicConfig(input: {
|
|
132
|
+
apiUrl: string;
|
|
133
|
+
orgId: string;
|
|
134
|
+
siteKey: string;
|
|
135
|
+
stage: string;
|
|
136
|
+
hostname: string;
|
|
137
|
+
signal?: AbortSignal;
|
|
138
|
+
}): Promise<AnalyticsPublicConfig>;
|
|
139
|
+
|
|
96
140
|
/**
|
|
97
141
|
* AxCloud SDK Types
|
|
98
142
|
*
|
|
99
143
|
* Note: In the future, these types should be auto-generated from the OpenAPI spec.
|
|
100
144
|
* For now, they are manually defined based on the AxCloud API.
|
|
101
145
|
*/
|
|
146
|
+
|
|
102
147
|
type AxCloudModule = 'content' | 'members' | 'sections' | 'training' | 'ai' | 'documents' | 'voting';
|
|
103
148
|
type SystemRole = 'super_admin' | 'org_admin' | 'section_admin' | 'member' | 'viewer';
|
|
104
149
|
type UserRole = SystemRole | 'superadmin' | 'admin' | 'editor';
|
|
@@ -164,6 +209,10 @@ interface User {
|
|
|
164
209
|
name: string;
|
|
165
210
|
firstName?: string;
|
|
166
211
|
lastName?: string;
|
|
212
|
+
/** Organization-specific title/position. Managed by organization administrators. */
|
|
213
|
+
title?: string | null;
|
|
214
|
+
phone?: string | null;
|
|
215
|
+
address?: string | null;
|
|
167
216
|
avatar?: string;
|
|
168
217
|
organizationId: string;
|
|
169
218
|
sectionId?: string;
|
|
@@ -192,6 +241,8 @@ interface Membership {
|
|
|
192
241
|
sectionId?: string;
|
|
193
242
|
section?: Section;
|
|
194
243
|
role: UserRole;
|
|
244
|
+
/** Organization-specific title/position, separate from the access role. */
|
|
245
|
+
title?: string | null;
|
|
195
246
|
status: 'active' | 'pending' | 'suspended' | 'expired';
|
|
196
247
|
joinedAt: string;
|
|
197
248
|
expiresAt?: string;
|
|
@@ -226,7 +277,8 @@ type ContentPublicationState = 'draft' | 'published' | 'archived';
|
|
|
226
277
|
type ContentAudience = 'public' | 'internal' | 'members' | 'section';
|
|
227
278
|
interface ContentItem {
|
|
228
279
|
id: string;
|
|
229
|
-
|
|
280
|
+
/** Present when a consumer needs to distinguish organizations outside its configured provider. */
|
|
281
|
+
organizationId?: string;
|
|
230
282
|
type: string;
|
|
231
283
|
title: string;
|
|
232
284
|
slug: string;
|
|
@@ -245,6 +297,7 @@ interface ContentItem {
|
|
|
245
297
|
};
|
|
246
298
|
status?: ContentPublicationState;
|
|
247
299
|
visibility?: ContentPublicationState;
|
|
300
|
+
/** @deprecated Delivery access is derived from publication metadata and the verified visitor. */
|
|
248
301
|
audience?: ContentAudience;
|
|
249
302
|
sectionId?: string;
|
|
250
303
|
tags?: string[];
|
|
@@ -278,13 +331,19 @@ interface Page extends ContentItem {
|
|
|
278
331
|
template?: string;
|
|
279
332
|
order?: number;
|
|
280
333
|
}
|
|
281
|
-
interface
|
|
334
|
+
interface ContentListResponse<T> {
|
|
282
335
|
items: T[];
|
|
336
|
+
count: number;
|
|
283
337
|
total: number;
|
|
284
338
|
page: number;
|
|
285
339
|
pageSize: number;
|
|
286
340
|
hasMore: boolean;
|
|
341
|
+
nextCursor?: string;
|
|
287
342
|
}
|
|
343
|
+
/** @deprecated Use ContentListResponse. */
|
|
344
|
+
type PaginatedResponse<T> = ContentListResponse<T>;
|
|
345
|
+
type ContentCollectionType = 'news' | 'pages' | 'events';
|
|
346
|
+
type ContentDetailType = 'news' | 'page' | 'event';
|
|
288
347
|
interface AxCloudConfig {
|
|
289
348
|
orgId: string;
|
|
290
349
|
apiUrl: string;
|
|
@@ -292,11 +351,15 @@ interface AxCloudConfig {
|
|
|
292
351
|
stage: string;
|
|
293
352
|
/** API key for public content endpoints (optional - required for public API access) */
|
|
294
353
|
apiKey?: string;
|
|
354
|
+
/** Optional privacy-safe web analytics collection. */
|
|
355
|
+
analytics?: AxCloudAnalyticsOptions;
|
|
295
356
|
auth0: {
|
|
296
357
|
domain: string;
|
|
297
358
|
clientId: string;
|
|
298
359
|
redirectUri: string;
|
|
299
360
|
audience?: string;
|
|
361
|
+
/** Auth0 Organization ID. Use this for invite-only member sites. */
|
|
362
|
+
organization?: string;
|
|
300
363
|
/** Database connection name for password operations. Defaults to 'Username-Password-Authentication' */
|
|
301
364
|
connection?: string;
|
|
302
365
|
};
|
|
@@ -304,13 +367,17 @@ interface AxCloudConfig {
|
|
|
304
367
|
interface ContentQueryOptions {
|
|
305
368
|
page?: number;
|
|
306
369
|
pageSize?: number;
|
|
370
|
+
/** @deprecated Delivery endpoints always return the published snapshot. */
|
|
307
371
|
status?: ContentPublicationState;
|
|
372
|
+
/** @deprecated Delivery endpoints always return the published snapshot. */
|
|
308
373
|
visibility?: ContentPublicationState;
|
|
309
374
|
audience?: ContentAudience;
|
|
375
|
+
/** @deprecated Member section access is derived from the verified token. */
|
|
310
376
|
sectionId?: string;
|
|
311
377
|
search?: string;
|
|
312
|
-
sortBy?:
|
|
378
|
+
sortBy?: 'publishedAt' | 'createdAt' | 'updatedAt' | 'title';
|
|
313
379
|
sortOrder?: 'asc' | 'desc';
|
|
380
|
+
tags?: string[];
|
|
314
381
|
/** Return the requested translation when content has language variants. */
|
|
315
382
|
lang?: string;
|
|
316
383
|
/** Force public endpoint even when authenticated (for public pages) */
|
|
@@ -387,11 +454,35 @@ interface DocumentItem {
|
|
|
387
454
|
created_at: string;
|
|
388
455
|
updated_at: string;
|
|
389
456
|
published_at?: string;
|
|
457
|
+
/** Section IDs this document is scoped to (member endpoint only). */
|
|
458
|
+
section_ids?: string[];
|
|
459
|
+
/** Display name of the member who uploaded the document (member endpoint only). */
|
|
460
|
+
uploaded_by_name?: string;
|
|
461
|
+
/** Folder IDs this document belongs to (member endpoint only). */
|
|
462
|
+
folder_ids?: string[];
|
|
390
463
|
}
|
|
391
464
|
interface DocumentListResponse {
|
|
392
465
|
items: DocumentItem[];
|
|
393
466
|
count: number;
|
|
394
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* A document folder the current member is allowed to see.
|
|
470
|
+
*
|
|
471
|
+
* Members receive folders for their own sections plus org-level folders
|
|
472
|
+
* (`section_id === null`). Returned by the member document-folders endpoint.
|
|
473
|
+
*/
|
|
474
|
+
interface DocumentFolder {
|
|
475
|
+
id: string;
|
|
476
|
+
/** Section this folder belongs to, or `null` for org-level folders. */
|
|
477
|
+
section_id: string | null;
|
|
478
|
+
/** Parent folder for nesting, or `null` for a top-level folder. */
|
|
479
|
+
parent_folder_id: string | null;
|
|
480
|
+
name: string;
|
|
481
|
+
sort_order: number;
|
|
482
|
+
}
|
|
483
|
+
interface DocumentFolderListResponse {
|
|
484
|
+
folders: DocumentFolder[];
|
|
485
|
+
}
|
|
395
486
|
interface SignedDocumentUrl {
|
|
396
487
|
documentId: string;
|
|
397
488
|
url: string;
|
|
@@ -403,6 +494,8 @@ interface DocumentQueryOptions {
|
|
|
403
494
|
search?: string;
|
|
404
495
|
tags?: string[];
|
|
405
496
|
limit?: number;
|
|
497
|
+
/** Restrict results to documents belonging to this folder (member endpoint only). */
|
|
498
|
+
folderId?: string;
|
|
406
499
|
}
|
|
407
500
|
|
|
408
501
|
interface BarnsportMunicipality {
|
|
@@ -416,12 +509,29 @@ interface BarnsportMunicipality {
|
|
|
416
509
|
bounds?: [number, number, number, number];
|
|
417
510
|
};
|
|
418
511
|
}
|
|
512
|
+
interface BarnsportSportArticle {
|
|
513
|
+
short_description?: string;
|
|
514
|
+
what_is_it?: string;
|
|
515
|
+
why_fun?: string;
|
|
516
|
+
good_to_know?: {
|
|
517
|
+
age?: string;
|
|
518
|
+
equipment?: string;
|
|
519
|
+
cost?: string;
|
|
520
|
+
};
|
|
521
|
+
fun_facts?: string[];
|
|
522
|
+
}
|
|
419
523
|
interface BarnsportSport {
|
|
420
524
|
id: string;
|
|
421
525
|
slug: string;
|
|
422
526
|
name: string;
|
|
423
527
|
icon?: string;
|
|
424
528
|
color?: string;
|
|
529
|
+
category?: string;
|
|
530
|
+
is_featured?: boolean;
|
|
531
|
+
hero_image_url?: string;
|
|
532
|
+
short_description?: string;
|
|
533
|
+
/** Present on the single-sport endpoint (GET /public/{orgId}/sports/{slug}). */
|
|
534
|
+
article?: BarnsportSportArticle;
|
|
425
535
|
}
|
|
426
536
|
interface BarnsportActivitySchedule {
|
|
427
537
|
weekday?: number;
|
|
@@ -576,7 +686,10 @@ interface ContentSlotReader {
|
|
|
576
686
|
fields: ContentSlotMap;
|
|
577
687
|
value<T = ContentSlotValue>(key: string, fallback?: T): ContentSlotValue | T;
|
|
578
688
|
text(key: string, fallback?: string): string;
|
|
689
|
+
/** @deprecated HTML is untrusted. Prefer text(), or unsafeHtml() with sanitization. */
|
|
579
690
|
html(key: string, fallback?: string): string;
|
|
691
|
+
/** Returns untrusted CMS HTML. Sanitize it before inserting it into the DOM. */
|
|
692
|
+
unsafeHtml(key: string, fallback?: string): string;
|
|
580
693
|
list(key: string, fallback?: string[]): string[];
|
|
581
694
|
image(key: string, fallback?: ContentSlotImage): ContentSlotImage | undefined;
|
|
582
695
|
}
|
|
@@ -881,11 +994,15 @@ interface AxCloudProviderProps {
|
|
|
881
994
|
stage?: string;
|
|
882
995
|
/** API key for public content endpoints */
|
|
883
996
|
apiKey?: string;
|
|
997
|
+
/** Optional privacy-safe analytics collection through AxCloud. */
|
|
998
|
+
analytics?: AxCloudAnalyticsOptions;
|
|
884
999
|
auth0: {
|
|
885
1000
|
domain: string;
|
|
886
1001
|
clientId: string;
|
|
887
1002
|
redirectUri: string;
|
|
888
1003
|
audience?: string;
|
|
1004
|
+
/** Auth0 Organization ID. Use this for invite-only member sites. */
|
|
1005
|
+
organization?: string;
|
|
889
1006
|
/** Database connection name for password operations. Defaults to 'Username-Password-Authentication' */
|
|
890
1007
|
connection?: string;
|
|
891
1008
|
};
|
|
@@ -907,14 +1024,15 @@ interface AxCloudProviderProps {
|
|
|
907
1024
|
* auth0={{
|
|
908
1025
|
* domain: "auth.axcloud.app",
|
|
909
1026
|
* clientId: "xxx",
|
|
910
|
-
* redirectUri: window.location.origin
|
|
1027
|
+
* redirectUri: window.location.origin,
|
|
1028
|
+
* organization: "org_abc123" // Optional Auth0 Organization ID for invite-only member sites
|
|
911
1029
|
* }}
|
|
912
1030
|
* >
|
|
913
1031
|
* <App />
|
|
914
1032
|
* </AxCloudProvider>
|
|
915
1033
|
* ```
|
|
916
1034
|
*/
|
|
917
|
-
declare function AxCloudProvider({ children, orgId, apiUrl, stage, apiKey, auth0, queryClient, timeout, }: AxCloudProviderProps): react_jsx_runtime.JSX.Element;
|
|
1035
|
+
declare function AxCloudProvider({ children, orgId, apiUrl, stage, apiKey, analytics, auth0, queryClient: providedQueryClient, timeout, }: AxCloudProviderProps): react_jsx_runtime.JSX.Element;
|
|
918
1036
|
|
|
919
1037
|
interface AxCloudContextValue {
|
|
920
1038
|
config: AxCloudConfig;
|
|
@@ -924,20 +1042,43 @@ interface AxCloudContextValue {
|
|
|
924
1042
|
stage: string;
|
|
925
1043
|
/** Whether using public API mode (API key, no auth) */
|
|
926
1044
|
isPublicMode: boolean;
|
|
1045
|
+
/** Auth0 has completed its initial session check. */
|
|
1046
|
+
isAuthLoading?: boolean;
|
|
1047
|
+
/** Whether the current browser session is authenticated. */
|
|
1048
|
+
isAuthenticated?: boolean;
|
|
1049
|
+
/** Auth0 subject used to isolate member-only query caches. */
|
|
1050
|
+
authSubject?: string;
|
|
1051
|
+
/** Remove identity-bound AxCloud query data before logout or account changes. */
|
|
1052
|
+
clearContentCache?: () => void;
|
|
1053
|
+
analytics: AnalyticsRuntime;
|
|
927
1054
|
}
|
|
928
1055
|
declare function useAxCloudContext(): AxCloudContextValue;
|
|
929
1056
|
|
|
1057
|
+
type AnalyticsRuntimeConfig = Pick<AxCloudConfig, 'analytics' | 'apiUrl' | 'orgId' | 'stage'>;
|
|
1058
|
+
declare function useAnalyticsRuntime(config: AnalyticsRuntimeConfig): AnalyticsRuntime;
|
|
1059
|
+
declare function useAnalytics(): AnalyticsRuntime;
|
|
1060
|
+
|
|
930
1061
|
interface AuthUser {
|
|
931
1062
|
id: string;
|
|
932
1063
|
email: string;
|
|
933
1064
|
name: string;
|
|
934
1065
|
avatar?: string;
|
|
1066
|
+
/** Auth0's authoritative email verification claim. */
|
|
1067
|
+
emailVerified?: boolean;
|
|
1068
|
+
}
|
|
1069
|
+
interface EmailVerificationResult {
|
|
1070
|
+
success: boolean;
|
|
1071
|
+
status: 'sent' | 'already_verified' | 'rate_limited' | 'failed';
|
|
1072
|
+
message: string;
|
|
1073
|
+
retryAfterSeconds?: number;
|
|
935
1074
|
}
|
|
936
1075
|
interface UseAuthReturn {
|
|
937
1076
|
isAuthenticated: boolean;
|
|
938
1077
|
isLoading: boolean;
|
|
939
1078
|
error: Error | undefined;
|
|
940
1079
|
user: AuthUser | null;
|
|
1080
|
+
/** True only when Auth0 explicitly reports email_verified=false. */
|
|
1081
|
+
needsEmailVerification: boolean;
|
|
941
1082
|
login: (options?: {
|
|
942
1083
|
returnTo?: string;
|
|
943
1084
|
}) => Promise<void>;
|
|
@@ -946,6 +1087,12 @@ interface UseAuthReturn {
|
|
|
946
1087
|
}) => Promise<void>;
|
|
947
1088
|
getAccessToken: () => Promise<string | undefined>;
|
|
948
1089
|
getAuth0Client: () => Auth0ClientState;
|
|
1090
|
+
/** Refresh Auth0 tokens/profile and return the latest email verification state. */
|
|
1091
|
+
refreshUser: () => Promise<boolean>;
|
|
1092
|
+
/** Send a branded verification email that returns to the current product site. */
|
|
1093
|
+
requestEmailVerification: (options?: {
|
|
1094
|
+
returnTo?: string;
|
|
1095
|
+
}) => Promise<EmailVerificationResult>;
|
|
949
1096
|
/** Request a password reset email for the current user or specified email */
|
|
950
1097
|
requestPasswordReset: (email?: string) => Promise<{
|
|
951
1098
|
success: boolean;
|
|
@@ -996,13 +1143,45 @@ interface Auth0ClientState {
|
|
|
996
1143
|
*/
|
|
997
1144
|
declare function useAuth(): UseAuthReturn;
|
|
998
1145
|
|
|
1146
|
+
interface UserOrganizationSection {
|
|
1147
|
+
id: string;
|
|
1148
|
+
name: string;
|
|
1149
|
+
role: string;
|
|
1150
|
+
}
|
|
1151
|
+
interface UserOrganizationMembership {
|
|
1152
|
+
role: string;
|
|
1153
|
+
roles: string[];
|
|
1154
|
+
title: string | null;
|
|
1155
|
+
status: string | null;
|
|
1156
|
+
joinedAt: string | null;
|
|
1157
|
+
memberSince: string | null;
|
|
1158
|
+
sectionId: string | null;
|
|
1159
|
+
sectionIds: string[];
|
|
1160
|
+
sections: UserOrganizationSection[];
|
|
1161
|
+
}
|
|
999
1162
|
interface UserApiResponse extends User {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1163
|
+
allOrgIds: string[];
|
|
1164
|
+
organizationMemberships: Record<string, UserOrganizationMembership>;
|
|
1165
|
+
effectiveOrganizationId: string | null;
|
|
1166
|
+
isSuperAdmin: boolean;
|
|
1167
|
+
}
|
|
1168
|
+
interface UpdateMyProfileInput {
|
|
1169
|
+
firstName?: string;
|
|
1170
|
+
lastName?: string;
|
|
1171
|
+
phone?: string | null;
|
|
1172
|
+
address?: string | null;
|
|
1173
|
+
}
|
|
1174
|
+
interface MyProfileResponse {
|
|
1175
|
+
user_id: string;
|
|
1176
|
+
email: string;
|
|
1177
|
+
given_name: string;
|
|
1178
|
+
family_name: string;
|
|
1179
|
+
name: string;
|
|
1180
|
+
phone_number: string | null;
|
|
1181
|
+
phone: string | null;
|
|
1182
|
+
address: string | null;
|
|
1183
|
+
location: string | null;
|
|
1184
|
+
updated_at: string;
|
|
1006
1185
|
}
|
|
1007
1186
|
/**
|
|
1008
1187
|
* useUser - Fetch the current authenticated user from AxCloud
|
|
@@ -1038,7 +1217,14 @@ declare function useUser(): {
|
|
|
1038
1217
|
error: Error | null;
|
|
1039
1218
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<UserApiResponse, Error>>;
|
|
1040
1219
|
hasOrgAccess: boolean;
|
|
1041
|
-
roleInOrg:
|
|
1220
|
+
roleInOrg: UserRole | null;
|
|
1221
|
+
organizationMembership: UserOrganizationMembership | null;
|
|
1222
|
+
title: string | null;
|
|
1223
|
+
section: UserOrganizationSection;
|
|
1224
|
+
sections: UserOrganizationSection[];
|
|
1225
|
+
sectionIds: string[];
|
|
1226
|
+
joinedAt: string | null;
|
|
1227
|
+
memberSince: string | null;
|
|
1042
1228
|
isAuthenticated: boolean;
|
|
1043
1229
|
role: UserRole | null;
|
|
1044
1230
|
organizationId: string | null;
|
|
@@ -1046,6 +1232,11 @@ declare function useUser(): {
|
|
|
1046
1232
|
permissions: string[];
|
|
1047
1233
|
isSuperAdmin: boolean;
|
|
1048
1234
|
};
|
|
1235
|
+
/**
|
|
1236
|
+
* Updates the authenticated user's self-service profile fields.
|
|
1237
|
+
* Organization title, email, roles and membership data are intentionally not writable here.
|
|
1238
|
+
*/
|
|
1239
|
+
declare function useUpdateMyProfile(): _tanstack_react_query.UseMutationResult<MyProfileResponse, Error, UpdateMyProfileInput, unknown>;
|
|
1049
1240
|
|
|
1050
1241
|
/**
|
|
1051
1242
|
* Public organization response from /content/public/{orgId}/org
|
|
@@ -1130,112 +1321,58 @@ declare function useOrg(): {
|
|
|
1130
1321
|
};
|
|
1131
1322
|
|
|
1132
1323
|
/**
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
* When authenticated (isPublicMode = false), fetches news visible to members
|
|
1136
|
-
* including public, internal, and members-only content.
|
|
1324
|
+
* Fetch published news visible to the current visitor.
|
|
1137
1325
|
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* ```tsx
|
|
1142
|
-
* function NewsPage() {
|
|
1143
|
-
* const { data: news, isLoading, isError, error } = useNews()
|
|
1144
|
-
*
|
|
1145
|
-
* if (isLoading) return <Spinner />
|
|
1146
|
-
* if (isError) return <Error message={error.message} />
|
|
1147
|
-
*
|
|
1148
|
-
* return (
|
|
1149
|
-
* <ul>
|
|
1150
|
-
* {news.map(item => (
|
|
1151
|
-
* <li key={item.id}>{item.title}</li>
|
|
1152
|
-
* ))}
|
|
1153
|
-
* </ul>
|
|
1154
|
-
* )
|
|
1155
|
-
* }
|
|
1156
|
-
* ```
|
|
1157
|
-
*
|
|
1158
|
-
* @example
|
|
1159
|
-
* // With pagination
|
|
1160
|
-
* ```tsx
|
|
1161
|
-
* const { data, hasMore, refetch } = useNews({
|
|
1162
|
-
* pageSize: 10,
|
|
1163
|
-
* status: 'published'
|
|
1164
|
-
* })
|
|
1165
|
-
* ```
|
|
1326
|
+
* This typed convenience wrapper shares access, cache and pagination behavior
|
|
1327
|
+
* with the generic content hook.
|
|
1166
1328
|
*/
|
|
1167
1329
|
declare function useNews(options?: ContentQueryOptions): {
|
|
1168
1330
|
data: NewsItem[];
|
|
1331
|
+
count: number;
|
|
1169
1332
|
total: number;
|
|
1333
|
+
page: number;
|
|
1334
|
+
pageSize: number;
|
|
1170
1335
|
hasMore: boolean;
|
|
1336
|
+
nextCursor: string | undefined;
|
|
1171
1337
|
isLoading: boolean;
|
|
1338
|
+
isFetching: boolean;
|
|
1172
1339
|
isError: boolean;
|
|
1173
1340
|
error: Error | null;
|
|
1174
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
1341
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ContentListResponse<NewsItem>, Error>>;
|
|
1175
1342
|
};
|
|
1176
1343
|
|
|
1177
1344
|
/**
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
* When authenticated (isPublicMode = false), fetches content visible to members
|
|
1181
|
-
* including public, internal, and members-only content (for supported types).
|
|
1182
|
-
*
|
|
1183
|
-
* When not authenticated (isPublicMode = true), fetches only public content.
|
|
1184
|
-
*
|
|
1185
|
-
* @param contentType - The type of content to fetch (e.g., 'news', 'pages', 'events')
|
|
1186
|
-
* @param options - Query options for filtering and pagination
|
|
1187
|
-
*
|
|
1188
|
-
* @example
|
|
1189
|
-
* ```tsx
|
|
1190
|
-
* // Fetch pages
|
|
1191
|
-
* const { data: pages } = useContent('pages')
|
|
1345
|
+
* Fetch a published content collection.
|
|
1192
1346
|
*
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
*
|
|
1196
|
-
* sortBy: 'startDate'
|
|
1197
|
-
* })
|
|
1198
|
-
* ```
|
|
1347
|
+
* AxCloud owns editorial data and publication. The consuming application owns
|
|
1348
|
+
* layout and rendering. Drafts are intentionally never selectable through
|
|
1349
|
+
* this delivery hook.
|
|
1199
1350
|
*/
|
|
1200
1351
|
declare function useContent<T extends ContentItem = ContentItem>(contentType: string, options?: ContentQueryOptions): {
|
|
1201
1352
|
data: T[];
|
|
1353
|
+
count: number;
|
|
1202
1354
|
total: number;
|
|
1355
|
+
page: number;
|
|
1356
|
+
pageSize: number;
|
|
1203
1357
|
hasMore: boolean;
|
|
1358
|
+
nextCursor: string | undefined;
|
|
1204
1359
|
isLoading: boolean;
|
|
1360
|
+
isFetching: boolean;
|
|
1205
1361
|
isError: boolean;
|
|
1206
1362
|
error: Error | null;
|
|
1207
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
1363
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ContentListResponse<T>, Error>>;
|
|
1208
1364
|
};
|
|
1209
1365
|
interface ContentItemOptions {
|
|
1210
|
-
/** Force public
|
|
1366
|
+
/** Force public delivery even when the visitor is authenticated. */
|
|
1211
1367
|
publicOnly?: boolean;
|
|
1212
1368
|
/** Return the requested translation when content has language variants. */
|
|
1213
1369
|
lang?: string;
|
|
1214
1370
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* useContentItem - Fetch a single content item by ID or slug
|
|
1217
|
-
*
|
|
1218
|
-
* When authenticated (isPublicMode = false), fetches from member endpoint
|
|
1219
|
-
* which can return members-only content (for supported types).
|
|
1220
|
-
*
|
|
1221
|
-
* When not authenticated (isPublicMode = true), fetches only public content.
|
|
1222
|
-
*
|
|
1223
|
-
* @param contentType - The type of content (e.g., 'news', 'pages', 'events')
|
|
1224
|
-
* @param idOrSlug - The content ID or slug
|
|
1225
|
-
* @param options - Optional settings
|
|
1226
|
-
*
|
|
1227
|
-
* @example
|
|
1228
|
-
* ```tsx
|
|
1229
|
-
* // Fetch a page by slug
|
|
1230
|
-
* const { data: page } = useContentItem('pages', 'about-us', { lang: 'sv' })
|
|
1231
|
-
*
|
|
1232
|
-
* // Force public endpoint
|
|
1233
|
-
* const { data: page } = useContentItem('pages', 'about-us', { publicOnly: true })
|
|
1234
|
-
* ```
|
|
1235
|
-
*/
|
|
1371
|
+
/** Fetch one published content item by ID or slug. */
|
|
1236
1372
|
declare function useContentItem<T extends ContentItem = ContentItem>(contentType: string, idOrSlug: string, options?: ContentItemOptions): {
|
|
1237
1373
|
data: _tanstack_react_query.NoInfer<T> | null;
|
|
1238
1374
|
isLoading: boolean;
|
|
1375
|
+
isFetching: boolean;
|
|
1239
1376
|
isError: boolean;
|
|
1240
1377
|
error: Error | null;
|
|
1241
1378
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.NoInfer<T>, Error>>;
|
|
@@ -1244,16 +1381,17 @@ interface PageContentState<T extends ContentItem = ContentItem> extends ContentS
|
|
|
1244
1381
|
page: T | null;
|
|
1245
1382
|
data: T | null;
|
|
1246
1383
|
isLoading: boolean;
|
|
1384
|
+
isFetching: boolean;
|
|
1247
1385
|
isError: boolean;
|
|
1248
1386
|
error: Error | null;
|
|
1249
1387
|
refetch: () => unknown;
|
|
1250
1388
|
}
|
|
1251
1389
|
/**
|
|
1252
|
-
*
|
|
1390
|
+
* Fetch a website page and expose structured template fields.
|
|
1253
1391
|
*
|
|
1254
1392
|
* Use `page.content`/`page.blocks` for article-like rich text pages. Use
|
|
1255
|
-
* `text('hero.title')`, `list('benefits.items')`, etc. for designed website
|
|
1256
|
-
* where the frontend owns layout and AxCloud owns content.
|
|
1393
|
+
* `text('hero.title')`, `list('benefits.items')`, etc. for designed website
|
|
1394
|
+
* templates where the frontend owns layout and AxCloud owns content.
|
|
1257
1395
|
*/
|
|
1258
1396
|
declare function usePageContent<T extends ContentItem = ContentItem>(slug: string, options?: ContentItemOptions): PageContentState<T>;
|
|
1259
1397
|
|
|
@@ -1711,6 +1849,58 @@ declare function useDocumentDownload(documentId: string | undefined): {
|
|
|
1711
1849
|
error: Error | null;
|
|
1712
1850
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SignedDocumentUrl, Error>>;
|
|
1713
1851
|
};
|
|
1852
|
+
/**
|
|
1853
|
+
* List documents the current member is allowed to see.
|
|
1854
|
+
*
|
|
1855
|
+
* Hits the member endpoint (`/documents/members/...`) which is NOT a
|
|
1856
|
+
* `/public/` path, so the core client automatically attaches the member's
|
|
1857
|
+
* `Authorization: Bearer <JWT>` header instead of the public API key.
|
|
1858
|
+
*
|
|
1859
|
+
* Returns public documents plus members/internal documents and section
|
|
1860
|
+
* documents for the member's sections. Items include `section_ids` and
|
|
1861
|
+
* uploader metadata (`uploaded_by_name`, `created_at`).
|
|
1862
|
+
*/
|
|
1863
|
+
declare function useMemberDocuments(options?: DocumentQueryOptions): {
|
|
1864
|
+
documents: DocumentItem[];
|
|
1865
|
+
items: DocumentItem[];
|
|
1866
|
+
count: number;
|
|
1867
|
+
isLoading: boolean;
|
|
1868
|
+
isError: boolean;
|
|
1869
|
+
error: Error | null;
|
|
1870
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DocumentListResponse, Error>>;
|
|
1871
|
+
};
|
|
1872
|
+
/**
|
|
1873
|
+
* List the document folders the current member is allowed to see.
|
|
1874
|
+
*
|
|
1875
|
+
* Hits the member endpoint (`/documents/members/${orgId}/document-folders`),
|
|
1876
|
+
* which is NOT a `/public/` path, so the core client attaches the member's
|
|
1877
|
+
* `Authorization: Bearer <JWT>` header instead of the public API key.
|
|
1878
|
+
*
|
|
1879
|
+
* Returns the member's section folders plus org-level folders
|
|
1880
|
+
* (`section_id === null`). Use the returned folder ids with
|
|
1881
|
+
* `useMemberDocuments({ folderId })` to scope a document list.
|
|
1882
|
+
*/
|
|
1883
|
+
declare function useMemberDocumentFolders(): {
|
|
1884
|
+
folders: DocumentFolder[];
|
|
1885
|
+
isLoading: boolean;
|
|
1886
|
+
isError: boolean;
|
|
1887
|
+
error: Error | null;
|
|
1888
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<DocumentFolderListResponse, Error>>;
|
|
1889
|
+
};
|
|
1890
|
+
/**
|
|
1891
|
+
* Fetch a short-lived signed download URL for a member-accessible document.
|
|
1892
|
+
*/
|
|
1893
|
+
declare function useMemberDocumentDownload(documentId: string | undefined): {
|
|
1894
|
+
url: string | null;
|
|
1895
|
+
documentUrl: string | null;
|
|
1896
|
+
filename: string | null;
|
|
1897
|
+
mimeType: string | null;
|
|
1898
|
+
expiresIn: number | null;
|
|
1899
|
+
isLoading: boolean;
|
|
1900
|
+
isError: boolean;
|
|
1901
|
+
error: Error | null;
|
|
1902
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<SignedDocumentUrl, Error>>;
|
|
1903
|
+
};
|
|
1714
1904
|
|
|
1715
1905
|
declare function useBarnsportMunicipalities(): {
|
|
1716
1906
|
municipalities: BarnsportMunicipality[];
|
|
@@ -1728,6 +1918,15 @@ declare function useBarnsportSports(): {
|
|
|
1728
1918
|
error: Error | null;
|
|
1729
1919
|
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<BarnsportListResponse<BarnsportSport>, Error>>;
|
|
1730
1920
|
};
|
|
1921
|
+
declare function useBarnsportSport(slug: string | undefined): {
|
|
1922
|
+
sport: BarnsportSport | null;
|
|
1923
|
+
isLoading: boolean;
|
|
1924
|
+
isError: boolean;
|
|
1925
|
+
error: Error | null;
|
|
1926
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<{
|
|
1927
|
+
sport: BarnsportSport;
|
|
1928
|
+
}, Error>>;
|
|
1929
|
+
};
|
|
1731
1930
|
declare function useBarnsportActivities(filters?: BarnsportActivitiesFilter): {
|
|
1732
1931
|
activities: BarnsportActivityListItem[];
|
|
1733
1932
|
count: number;
|
|
@@ -1979,4 +2178,4 @@ interface LinkedAccountsListProps {
|
|
|
1979
2178
|
*/
|
|
1980
2179
|
declare function LinkedAccountsList({ providers, showConnectButtons, className, onUnlink, onLinkInitiated, renderIdentity, renderAvailableProvider, }: LinkedAccountsListProps): react_jsx_runtime.JSX.Element;
|
|
1981
2180
|
|
|
1982
|
-
export { type AvailableProvider, AxCloudClient, type AxCloudConfig, AxCloudError, type AxCloudErrorCode, type AxCloudModule, AxCloudProvider, type Ballot, type BallotCandidate, type BallotOption, type BallotSeat, type BarnsportActivitiesFilter, type BarnsportActivity, type BarnsportActivityListItem, type BarnsportActivityLocation, type BarnsportActivityResponse, type BarnsportActivitySchedule, type BarnsportInterestSubmissionRequest, type BarnsportInterestSubmissionResponse, type BarnsportListResponse, type BarnsportMunicipality, type BarnsportRegistrationMethod, type BarnsportSitemapResponse, type BarnsportSitemapUrl, type BarnsportSport, type BaseRole, type CastVoteResult, type CodeEligibility, type ContentItem, type ContentQueryOptions, type ContentSlotImage, type ContentSlotMap, type ContentSlotReader, type ContentSlotValue, type CustomRole, type DocumentAudience, type DocumentItem, type DocumentListResponse, type DocumentQueryOptions, type DocumentSourceProvider, type DocumentStatus, type FormStatsResponse, type FormSubmission, type FormSubmissionRecord, type FormSubmissionResponse, type FormSubmissionsResponse, LinkedAccountsList, type LinkedAccountsListProps, type LinkedIdentity, LoginButton, LogoutButton, type MediaItem, type MediaListResponse, type Membership, ModuleGate, type NewsItem, type Organization, type OrganizationBranding, type OrganizationSettings, type Page, type PageContentState, type PaginatedResponse, ProtectedRoute, type Section, type SectionPermissions, type SignedDocumentUrl, type SignedMediaUrl, type SystemRole, type UseLinkedAccountsReturn, type User, type UserRole, type VoteReceipt, castVote, castVoteWithCode, checkEligibility, checkVotingCode, createClient, createContentSlotReader, createFormHelper, getBallot, getClient, getContentSlotMap, getVotingReceipt, isAxCloudError, submitForm, useAuth, useAvatar, useAxCloudContext, useBarnsportActivities, useBarnsportActivity, useBarnsportMunicipalities, useBarnsportSitemap, useBarnsportSports, useBranding, useCodeBallot, useContent, useContentItem, useDocumentDownload, useDocuments, useFormStats, useForms, useLinkedAccounts, useLogo, useMedia, useMediaList, useModuleAccess, useMySection, useNews, useOrg, usePageContent, useSections, useSubmitBarnsportInterest, useUpdateFormSubmission, useUser, userHasAllPermissions, userHasAnyPermission, userHasPermission };
|
|
2181
|
+
export { type AnalyticsEventData, type AnalyticsEventValue, type AnalyticsPublicConfig, type AnalyticsRuntime, type AnalyticsRuntimeConfig, type Auth0ClientState, type AuthUser, type AvailableProvider, type AxCloudAnalyticsOptions, AxCloudClient, type AxCloudConfig, AxCloudError, type AxCloudErrorCode, type AxCloudModule, AxCloudProvider, type Ballot, type BallotCandidate, type BallotOption, type BallotSeat, type BarnsportActivitiesFilter, type BarnsportActivity, type BarnsportActivityListItem, type BarnsportActivityLocation, type BarnsportActivityResponse, type BarnsportActivitySchedule, type BarnsportInterestSubmissionRequest, type BarnsportInterestSubmissionResponse, type BarnsportListResponse, type BarnsportMunicipality, type BarnsportRegistrationMethod, type BarnsportSitemapResponse, type BarnsportSitemapUrl, type BarnsportSport, type BaseRole, type CastVoteResult, type CodeEligibility, type ContentCollectionType, type ContentDetailType, type ContentItem, type ContentListResponse, type ContentQueryOptions, type ContentSlotImage, type ContentSlotMap, type ContentSlotReader, type ContentSlotValue, type CustomRole, type DocumentAudience, type DocumentFolder, type DocumentFolderListResponse, type DocumentItem, type DocumentListResponse, type DocumentQueryOptions, type DocumentSourceProvider, type DocumentStatus, type EmailVerificationResult, type FormStatsResponse, type FormSubmission, type FormSubmissionRecord, type FormSubmissionResponse, type FormSubmissionsResponse, LinkedAccountsList, type LinkedAccountsListProps, type LinkedIdentity, LoginButton, LogoutButton, type MediaItem, type MediaListResponse, type Membership, ModuleGate, type MyProfileResponse, type NewsItem, type Organization, type OrganizationBranding, type OrganizationSettings, type Page, type PageContentState, type PaginatedResponse, ProtectedRoute, type Section, type SectionPermissions, type SignedDocumentUrl, type SignedMediaUrl, type SystemRole, type UpdateMyProfileInput, type UseAuthReturn, type UseLinkedAccountsReturn, type User, type UserApiResponse, type UserOrganizationMembership, type UserOrganizationSection, type UserRole, type VoteReceipt, castVote, castVoteWithCode, checkEligibility, checkVotingCode, createClient, createContentSlotReader, createFormHelper, fetchAnalyticsPublicConfig, getBallot, getClient, getContentSlotMap, getVotingReceipt, isAllowedAnalyticsEvent, isAxCloudError, isLocalAnalyticsHostname, sanitizeAnalyticsEventData, sanitizeAnalyticsPath, submitForm, useAnalytics, useAnalyticsRuntime, useAuth, useAvatar, useAxCloudContext, useBarnsportActivities, useBarnsportActivity, useBarnsportMunicipalities, useBarnsportSitemap, useBarnsportSport, useBarnsportSports, useBranding, useCodeBallot, useContent, useContentItem, useDocumentDownload, useDocuments, useFormStats, useForms, useLinkedAccounts, useLogo, useMedia, useMediaList, useMemberDocumentDownload, useMemberDocumentFolders, useMemberDocuments, useModuleAccess, useMySection, useNews, useOrg, usePageContent, useSections, useSubmitBarnsportInterest, useUpdateFormSubmission, useUpdateMyProfile, useUser, userHasAllPermissions, userHasAnyPermission, userHasPermission };
|