@axcode/axcloud-sdk 0.2.0-dev.1e6c3d5 → 0.2.0-dev.5dc7e06
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 +67 -0
- package/dist/barnsport.d.mts +39 -0
- package/dist/barnsport.d.ts +39 -0
- package/dist/barnsport.js +73 -0
- package/dist/barnsport.js.map +1 -0
- package/dist/barnsport.mjs +4 -0
- package/dist/barnsport.mjs.map +1 -0
- package/dist/chunk-2IVJTMRB.js +519 -0
- package/dist/chunk-2IVJTMRB.js.map +1 -0
- package/dist/chunk-7IPCZJ5Q.mjs +273 -0
- package/dist/chunk-7IPCZJ5Q.mjs.map +1 -0
- package/dist/chunk-7K5N3DQ4.js +231 -0
- package/dist/chunk-7K5N3DQ4.js.map +1 -0
- package/dist/chunk-CACQMQCJ.mjs +506 -0
- package/dist/chunk-CACQMQCJ.mjs.map +1 -0
- package/dist/chunk-PMMCOWL3.mjs +223 -0
- package/dist/chunk-PMMCOWL3.mjs.map +1 -0
- package/dist/chunk-ZOQAXLCZ.js +290 -0
- package/dist/chunk-ZOQAXLCZ.js.map +1 -0
- package/dist/client-FOpKwe3e.d.mts +75 -0
- package/dist/client-FOpKwe3e.d.ts +75 -0
- package/dist/index.d.mts +41 -819
- package/dist/index.d.ts +41 -819
- package/dist/index.js +130 -889
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -839
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.mts +27 -0
- package/dist/public.d.ts +27 -0
- package/dist/public.js +131 -0
- package/dist/public.js.map +1 -0
- package/dist/public.mjs +99 -0
- package/dist/public.mjs.map +1 -0
- package/dist/useBarnsport-C6uDSuHf.d.mts +583 -0
- package/dist/useBarnsport-C6uDSuHf.d.ts +583 -0
- package/dist/useContent-1WbKvPY4.d.mts +508 -0
- package/dist/useContent-Cl7dvERE.d.ts +508 -0
- package/package.json +15 -5
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { A as AxCloudClient } from './client-FOpKwe3e.js';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
type AnalyticsEventValue = string | number | boolean;
|
|
5
|
+
type AnalyticsEventData = Record<string, AnalyticsEventValue>;
|
|
6
|
+
interface AxCloudAnalyticsOptions {
|
|
7
|
+
/** Site key configured in AxCloud, for example "public-web". */
|
|
8
|
+
siteKey: string;
|
|
9
|
+
/** Analytics is opt-in and disabled unless this is true. */
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
/** Allow local collection for explicit development tests. */
|
|
12
|
+
trackLocalhost?: boolean;
|
|
13
|
+
/** Override path normalization. Return null to skip a pageview. */
|
|
14
|
+
normalizePath?: (pathname: string) => string | null;
|
|
15
|
+
}
|
|
16
|
+
interface AnalyticsPublicConfig {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
provider?: 'umami';
|
|
19
|
+
websiteId?: string;
|
|
20
|
+
scriptUrl?: string;
|
|
21
|
+
hostUrl?: string;
|
|
22
|
+
domains?: string[];
|
|
23
|
+
autoTrack?: boolean;
|
|
24
|
+
respectDoNotTrack?: boolean;
|
|
25
|
+
excludeSearch?: boolean;
|
|
26
|
+
excludeHash?: boolean;
|
|
27
|
+
allowedEvents?: string[];
|
|
28
|
+
}
|
|
29
|
+
interface AnalyticsRuntime {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
ready: boolean;
|
|
32
|
+
track: (eventName: string, data?: AnalyticsEventData) => boolean;
|
|
33
|
+
trackPageView: (pathname?: string) => boolean;
|
|
34
|
+
}
|
|
35
|
+
declare function isLocalAnalyticsHostname(hostname: string): boolean;
|
|
36
|
+
declare function sanitizeAnalyticsPath(pathname: string, customNormalizer?: (pathname: string) => string | null): string | null;
|
|
37
|
+
declare function sanitizeAnalyticsEventData(data: AnalyticsEventData | undefined): AnalyticsEventData | undefined;
|
|
38
|
+
declare function isAllowedAnalyticsEvent(eventName: string, allowedEvents: string[] | undefined): boolean;
|
|
39
|
+
declare function fetchAnalyticsPublicConfig(input: {
|
|
40
|
+
apiUrl: string;
|
|
41
|
+
orgId: string;
|
|
42
|
+
siteKey: string;
|
|
43
|
+
stage: string;
|
|
44
|
+
hostname: string;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}): Promise<AnalyticsPublicConfig>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* AxCloud SDK Types
|
|
50
|
+
*
|
|
51
|
+
* Note: In the future, these types should be auto-generated from the OpenAPI spec.
|
|
52
|
+
* For now, they are manually defined based on the AxCloud API.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
type AxCloudModule = 'content' | 'members' | 'sections' | 'training' | 'ai' | 'documents' | 'voting';
|
|
56
|
+
type SystemRole = 'super_admin' | 'org_admin' | 'section_admin' | 'member' | 'viewer';
|
|
57
|
+
type UserRole = SystemRole | 'superadmin' | 'admin' | 'editor';
|
|
58
|
+
type BaseRole = 'org_admin' | 'section_admin' | 'member' | 'viewer';
|
|
59
|
+
/**
|
|
60
|
+
* Custom role definition
|
|
61
|
+
*/
|
|
62
|
+
interface CustomRole {
|
|
63
|
+
role_id: string;
|
|
64
|
+
org_id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
baseRole: BaseRole;
|
|
68
|
+
permissions?: string[];
|
|
69
|
+
deniedPermissions?: string[];
|
|
70
|
+
effectivePermissions?: string[];
|
|
71
|
+
color?: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
hierarchy: number;
|
|
74
|
+
isSystem: false;
|
|
75
|
+
isActive: boolean;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
interface Organization {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
slug: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
modules: AxCloudModule[];
|
|
85
|
+
settings?: OrganizationSettings;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
updatedAt: string;
|
|
88
|
+
}
|
|
89
|
+
interface OrganizationSettings {
|
|
90
|
+
allowPublicSignup?: boolean;
|
|
91
|
+
requireEmailVerification?: boolean;
|
|
92
|
+
defaultUserRole?: UserRole;
|
|
93
|
+
theme?: {
|
|
94
|
+
primaryColor?: string;
|
|
95
|
+
logo?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface Section {
|
|
99
|
+
id: string;
|
|
100
|
+
organizationId: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
slug: string;
|
|
104
|
+
parentId?: string;
|
|
105
|
+
permissions?: SectionPermissions;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
}
|
|
109
|
+
interface SectionPermissions {
|
|
110
|
+
canViewMembers?: boolean;
|
|
111
|
+
canEditContent?: boolean;
|
|
112
|
+
canManageMembers?: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface User {
|
|
115
|
+
id: string;
|
|
116
|
+
email: string;
|
|
117
|
+
name: string;
|
|
118
|
+
firstName?: string;
|
|
119
|
+
lastName?: string;
|
|
120
|
+
/** Organization-specific title/position. Managed by organization administrators. */
|
|
121
|
+
title?: string | null;
|
|
122
|
+
phone?: string | null;
|
|
123
|
+
address?: string | null;
|
|
124
|
+
avatar?: string;
|
|
125
|
+
organizationId: string;
|
|
126
|
+
sectionId?: string;
|
|
127
|
+
role: UserRole;
|
|
128
|
+
customRole?: CustomRole;
|
|
129
|
+
permissions?: string[];
|
|
130
|
+
metadata?: Record<string, unknown>;
|
|
131
|
+
createdAt: string;
|
|
132
|
+
updatedAt: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Check if user has a specific permission
|
|
136
|
+
*/
|
|
137
|
+
declare function userHasPermission(user: User, permission: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Check if user has any of the specified permissions
|
|
140
|
+
*/
|
|
141
|
+
declare function userHasAnyPermission(user: User, permissions: string[]): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Check if user has all of the specified permissions
|
|
144
|
+
*/
|
|
145
|
+
declare function userHasAllPermissions(user: User, permissions: string[]): boolean;
|
|
146
|
+
interface Membership {
|
|
147
|
+
userId: string;
|
|
148
|
+
organizationId: string;
|
|
149
|
+
sectionId?: string;
|
|
150
|
+
section?: Section;
|
|
151
|
+
role: UserRole;
|
|
152
|
+
/** Organization-specific title/position, separate from the access role. */
|
|
153
|
+
title?: string | null;
|
|
154
|
+
status: 'active' | 'pending' | 'suspended' | 'expired';
|
|
155
|
+
joinedAt: string;
|
|
156
|
+
expiresAt?: string;
|
|
157
|
+
metadata?: Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
interface ContentBlock {
|
|
160
|
+
id: string;
|
|
161
|
+
type: string;
|
|
162
|
+
content?: string;
|
|
163
|
+
url?: string;
|
|
164
|
+
alt?: string;
|
|
165
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
166
|
+
items?: unknown[];
|
|
167
|
+
language?: string;
|
|
168
|
+
caption?: string;
|
|
169
|
+
attributes?: Record<string, unknown>;
|
|
170
|
+
ordered?: boolean;
|
|
171
|
+
author?: string;
|
|
172
|
+
}
|
|
173
|
+
interface ContentTranslation {
|
|
174
|
+
title: string;
|
|
175
|
+
slug: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
blocks: ContentBlock[];
|
|
178
|
+
/** Structured website/template fields for this language. */
|
|
179
|
+
fields?: Record<string, unknown>;
|
|
180
|
+
metaTitle?: string;
|
|
181
|
+
metaDescription?: string;
|
|
182
|
+
keywords?: string[];
|
|
183
|
+
}
|
|
184
|
+
type ContentPublicationState = 'draft' | 'published' | 'archived';
|
|
185
|
+
type ContentAudience = 'public' | 'internal' | 'members' | 'section';
|
|
186
|
+
interface ContentItem {
|
|
187
|
+
id: string;
|
|
188
|
+
/** Present when a consumer needs to distinguish organizations outside its configured provider. */
|
|
189
|
+
organizationId?: string;
|
|
190
|
+
type: string;
|
|
191
|
+
title: string;
|
|
192
|
+
slug: string;
|
|
193
|
+
/** Legacy string content. New AxCloud content uses `blocks`. */
|
|
194
|
+
content?: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
blocks?: ContentBlock[];
|
|
197
|
+
/** Template identifier used by websites, e.g. "home" or "landing". */
|
|
198
|
+
template?: string;
|
|
199
|
+
/** Structured website/template fields. Frontends own layout and read these values by key. */
|
|
200
|
+
fields?: Record<string, unknown>;
|
|
201
|
+
excerpt?: string;
|
|
202
|
+
author?: {
|
|
203
|
+
id: string;
|
|
204
|
+
name: string;
|
|
205
|
+
};
|
|
206
|
+
status?: ContentPublicationState;
|
|
207
|
+
visibility?: ContentPublicationState;
|
|
208
|
+
/** @deprecated Delivery access is derived from publication metadata and the verified visitor. */
|
|
209
|
+
audience?: ContentAudience;
|
|
210
|
+
sectionId?: string;
|
|
211
|
+
tags?: string[];
|
|
212
|
+
lang?: string;
|
|
213
|
+
featuredImage?: string;
|
|
214
|
+
metaTitle?: string;
|
|
215
|
+
metaDescription?: string;
|
|
216
|
+
keywords?: string[];
|
|
217
|
+
translations?: Record<string, ContentTranslation>;
|
|
218
|
+
currentLanguage?: string;
|
|
219
|
+
availableLanguages?: string[];
|
|
220
|
+
seo?: {
|
|
221
|
+
canonical: string;
|
|
222
|
+
hreflang: Array<{
|
|
223
|
+
lang: string;
|
|
224
|
+
href: string;
|
|
225
|
+
}>;
|
|
226
|
+
};
|
|
227
|
+
publishedAt?: string;
|
|
228
|
+
createdAt: string;
|
|
229
|
+
updatedAt: string;
|
|
230
|
+
}
|
|
231
|
+
interface NewsItem extends ContentItem {
|
|
232
|
+
type: 'news';
|
|
233
|
+
featuredImage?: string;
|
|
234
|
+
category?: string;
|
|
235
|
+
tags?: string[];
|
|
236
|
+
}
|
|
237
|
+
interface Page extends ContentItem {
|
|
238
|
+
type: 'page';
|
|
239
|
+
template?: string;
|
|
240
|
+
order?: number;
|
|
241
|
+
}
|
|
242
|
+
interface ContentListResponse<T> {
|
|
243
|
+
items: T[];
|
|
244
|
+
count: number;
|
|
245
|
+
total: number;
|
|
246
|
+
page: number;
|
|
247
|
+
pageSize: number;
|
|
248
|
+
hasMore: boolean;
|
|
249
|
+
nextCursor?: string;
|
|
250
|
+
}
|
|
251
|
+
/** @deprecated Use ContentListResponse. */
|
|
252
|
+
type PaginatedResponse<T> = ContentListResponse<T>;
|
|
253
|
+
type ContentCollectionType = 'news' | 'pages' | 'events';
|
|
254
|
+
type ContentDetailType = 'news' | 'page' | 'event';
|
|
255
|
+
interface AxCloudConfig {
|
|
256
|
+
orgId: string;
|
|
257
|
+
apiUrl: string;
|
|
258
|
+
/** API stage - defaults to 'dev'. Use 'prod' for production. */
|
|
259
|
+
stage: string;
|
|
260
|
+
/** API key for public content endpoints (optional - required for public API access) */
|
|
261
|
+
apiKey?: string;
|
|
262
|
+
/** Optional privacy-safe web analytics collection. */
|
|
263
|
+
analytics?: AxCloudAnalyticsOptions;
|
|
264
|
+
auth0: {
|
|
265
|
+
domain: string;
|
|
266
|
+
clientId: string;
|
|
267
|
+
redirectUri: string;
|
|
268
|
+
audience?: string;
|
|
269
|
+
/** Auth0 Organization ID. Use this for invite-only member sites. */
|
|
270
|
+
organization?: string;
|
|
271
|
+
/** Database connection name for password operations. Defaults to 'Username-Password-Authentication' */
|
|
272
|
+
connection?: string;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
interface ContentQueryOptions {
|
|
276
|
+
page?: number;
|
|
277
|
+
pageSize?: number;
|
|
278
|
+
/** @deprecated Delivery endpoints always return the published snapshot. */
|
|
279
|
+
status?: ContentPublicationState;
|
|
280
|
+
/** @deprecated Delivery endpoints always return the published snapshot. */
|
|
281
|
+
visibility?: ContentPublicationState;
|
|
282
|
+
audience?: ContentAudience;
|
|
283
|
+
/** @deprecated Member section access is derived from the verified token. */
|
|
284
|
+
sectionId?: string;
|
|
285
|
+
search?: string;
|
|
286
|
+
sortBy?: 'publishedAt' | 'createdAt' | 'updatedAt' | 'title';
|
|
287
|
+
sortOrder?: 'asc' | 'desc';
|
|
288
|
+
tags?: string[];
|
|
289
|
+
/** Return the requested translation when content has language variants. */
|
|
290
|
+
lang?: string;
|
|
291
|
+
/** Force public endpoint even when authenticated (for public pages) */
|
|
292
|
+
publicOnly?: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Organization branding information
|
|
296
|
+
*/
|
|
297
|
+
interface OrganizationBranding {
|
|
298
|
+
organizationId: string;
|
|
299
|
+
name: string;
|
|
300
|
+
branding: {
|
|
301
|
+
/** Signed URL for logo (expires in 1 hour) */
|
|
302
|
+
logoUrl: string | null;
|
|
303
|
+
/** Seconds until logoUrl expires */
|
|
304
|
+
logoExpiresIn: number | null;
|
|
305
|
+
/** Primary brand color (hex) */
|
|
306
|
+
primaryColor: string | null;
|
|
307
|
+
/** Secondary brand color (hex) */
|
|
308
|
+
secondaryColor: string | null;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Signed URL response for media assets
|
|
313
|
+
*/
|
|
314
|
+
interface SignedMediaUrl {
|
|
315
|
+
/** Signed S3 URL (expires in 1 hour) */
|
|
316
|
+
url: string;
|
|
317
|
+
/** Seconds until URL expires */
|
|
318
|
+
expiresIn: number;
|
|
319
|
+
/** S3 bucket name */
|
|
320
|
+
bucket: string;
|
|
321
|
+
/** S3 object key */
|
|
322
|
+
key: string;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Media list item
|
|
326
|
+
*/
|
|
327
|
+
interface MediaItem {
|
|
328
|
+
/** File key (filename) */
|
|
329
|
+
key: string;
|
|
330
|
+
/** File size in bytes */
|
|
331
|
+
size: number;
|
|
332
|
+
/** Last modified timestamp */
|
|
333
|
+
lastModified: string;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Media list response
|
|
337
|
+
*/
|
|
338
|
+
interface MediaListResponse {
|
|
339
|
+
items: MediaItem[];
|
|
340
|
+
count: number;
|
|
341
|
+
bucket: string;
|
|
342
|
+
prefix: string;
|
|
343
|
+
}
|
|
344
|
+
type DocumentStatus = 'draft' | 'published' | 'archived';
|
|
345
|
+
type DocumentAudience = 'public' | 'members' | 'section' | 'internal';
|
|
346
|
+
type DocumentSourceProvider = 'upload' | 'sharepoint';
|
|
347
|
+
/**
|
|
348
|
+
* Public document metadata exposed through the AxCloud SDK.
|
|
349
|
+
*/
|
|
350
|
+
interface DocumentItem {
|
|
351
|
+
document_id: string;
|
|
352
|
+
org_id: string;
|
|
353
|
+
title: string;
|
|
354
|
+
description?: string;
|
|
355
|
+
filename: string;
|
|
356
|
+
mime_type: string;
|
|
357
|
+
size: number;
|
|
358
|
+
status: DocumentStatus;
|
|
359
|
+
audience: DocumentAudience;
|
|
360
|
+
tags: string[];
|
|
361
|
+
source_provider: DocumentSourceProvider;
|
|
362
|
+
created_at: string;
|
|
363
|
+
updated_at: string;
|
|
364
|
+
published_at?: string;
|
|
365
|
+
/** Section IDs this document is scoped to (member endpoint only). */
|
|
366
|
+
section_ids?: string[];
|
|
367
|
+
/** Display name of the member who uploaded the document (member endpoint only). */
|
|
368
|
+
uploaded_by_name?: string;
|
|
369
|
+
/** Folder IDs this document belongs to (member endpoint only). */
|
|
370
|
+
folder_ids?: string[];
|
|
371
|
+
}
|
|
372
|
+
interface DocumentListResponse {
|
|
373
|
+
items: DocumentItem[];
|
|
374
|
+
count: number;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* A document folder the current member is allowed to see.
|
|
378
|
+
*
|
|
379
|
+
* Members receive folders for their own sections plus org-level folders
|
|
380
|
+
* (`section_id === null`). Returned by the member document-folders endpoint.
|
|
381
|
+
*/
|
|
382
|
+
interface DocumentFolder {
|
|
383
|
+
id: string;
|
|
384
|
+
/** Section this folder belongs to, or `null` for org-level folders. */
|
|
385
|
+
section_id: string | null;
|
|
386
|
+
/** Parent folder for nesting, or `null` for a top-level folder. */
|
|
387
|
+
parent_folder_id: string | null;
|
|
388
|
+
name: string;
|
|
389
|
+
sort_order: number;
|
|
390
|
+
}
|
|
391
|
+
interface DocumentFolderListResponse {
|
|
392
|
+
folders: DocumentFolder[];
|
|
393
|
+
}
|
|
394
|
+
interface SignedDocumentUrl {
|
|
395
|
+
documentId: string;
|
|
396
|
+
url: string;
|
|
397
|
+
expiresIn: number;
|
|
398
|
+
filename: string;
|
|
399
|
+
mimeType: string;
|
|
400
|
+
}
|
|
401
|
+
interface DocumentQueryOptions {
|
|
402
|
+
search?: string;
|
|
403
|
+
tags?: string[];
|
|
404
|
+
limit?: number;
|
|
405
|
+
/** Restrict results to documents belonging to this folder (member endpoint only). */
|
|
406
|
+
folderId?: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
type ContentSlotValue = string | number | boolean | null | undefined | string[] | Record<string, unknown> | unknown[];
|
|
410
|
+
type ContentSlotMap = Record<string, ContentSlotValue>;
|
|
411
|
+
interface ContentSlotImage {
|
|
412
|
+
url: string;
|
|
413
|
+
alt?: string;
|
|
414
|
+
caption?: string;
|
|
415
|
+
}
|
|
416
|
+
interface ContentSlotReader {
|
|
417
|
+
fields: ContentSlotMap;
|
|
418
|
+
value<T = ContentSlotValue>(key: string, fallback?: T): ContentSlotValue | T;
|
|
419
|
+
text(key: string, fallback?: string): string;
|
|
420
|
+
/** @deprecated HTML is untrusted. Prefer text(), or unsafeHtml() with sanitization. */
|
|
421
|
+
html(key: string, fallback?: string): string;
|
|
422
|
+
/** Returns untrusted CMS HTML. Sanitize it before inserting it into the DOM. */
|
|
423
|
+
unsafeHtml(key: string, fallback?: string): string;
|
|
424
|
+
list(key: string, fallback?: string[]): string[];
|
|
425
|
+
image(key: string, fallback?: ContentSlotImage): ContentSlotImage | undefined;
|
|
426
|
+
}
|
|
427
|
+
declare function getContentSlotMap(content?: Pick<ContentItem, 'fields' | 'blocks'> | null): ContentSlotMap;
|
|
428
|
+
declare function createContentSlotReader(content?: Pick<ContentItem, 'fields' | 'blocks'> | null): ContentSlotReader;
|
|
429
|
+
|
|
430
|
+
interface AxCloudContextValue {
|
|
431
|
+
config: AxCloudConfig;
|
|
432
|
+
client: AxCloudClient;
|
|
433
|
+
orgId: string;
|
|
434
|
+
/** API stage (e.g., 'dev', 'prod') */
|
|
435
|
+
stage: string;
|
|
436
|
+
/** Whether using public API mode (API key, no auth) */
|
|
437
|
+
isPublicMode: boolean;
|
|
438
|
+
/** Auth0 has completed its initial session check. */
|
|
439
|
+
isAuthLoading?: boolean;
|
|
440
|
+
/** Whether the current browser session is authenticated. */
|
|
441
|
+
isAuthenticated?: boolean;
|
|
442
|
+
/** Auth0 subject used to isolate member-only query caches. */
|
|
443
|
+
authSubject?: string;
|
|
444
|
+
/** Remove identity-bound AxCloud query data before logout or account changes. */
|
|
445
|
+
clearContentCache?: () => void;
|
|
446
|
+
analytics: AnalyticsRuntime;
|
|
447
|
+
}
|
|
448
|
+
declare function useAxCloudContext(): AxCloudContextValue;
|
|
449
|
+
|
|
450
|
+
type AnalyticsRuntimeConfig = Pick<AxCloudConfig, 'analytics' | 'apiUrl' | 'orgId' | 'stage'>;
|
|
451
|
+
declare function useAnalyticsRuntime(config: AnalyticsRuntimeConfig): AnalyticsRuntime;
|
|
452
|
+
declare function useAnalytics(): AnalyticsRuntime;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Fetch a published content collection.
|
|
456
|
+
*
|
|
457
|
+
* AxCloud owns editorial data and publication. The consuming application owns
|
|
458
|
+
* layout and rendering. Drafts are intentionally never selectable through
|
|
459
|
+
* this delivery hook.
|
|
460
|
+
*/
|
|
461
|
+
declare function useContent<T extends ContentItem = ContentItem>(contentType: string, options?: ContentQueryOptions): {
|
|
462
|
+
data: T[];
|
|
463
|
+
count: number;
|
|
464
|
+
total: number;
|
|
465
|
+
page: number;
|
|
466
|
+
pageSize: number;
|
|
467
|
+
hasMore: boolean;
|
|
468
|
+
nextCursor: string | undefined;
|
|
469
|
+
isLoading: boolean;
|
|
470
|
+
isFetching: boolean;
|
|
471
|
+
isError: boolean;
|
|
472
|
+
error: Error | null;
|
|
473
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<ContentListResponse<T>, Error>>;
|
|
474
|
+
};
|
|
475
|
+
interface ContentItemOptions {
|
|
476
|
+
/** Force public delivery even when the visitor is authenticated. */
|
|
477
|
+
publicOnly?: boolean;
|
|
478
|
+
/** Return the requested translation when content has language variants. */
|
|
479
|
+
lang?: string;
|
|
480
|
+
}
|
|
481
|
+
/** Fetch one published content item by ID or slug. */
|
|
482
|
+
declare function useContentItem<T extends ContentItem = ContentItem>(contentType: string, idOrSlug: string, options?: ContentItemOptions): {
|
|
483
|
+
data: _tanstack_react_query.NoInfer<T> | null;
|
|
484
|
+
isLoading: boolean;
|
|
485
|
+
isFetching: boolean;
|
|
486
|
+
isError: boolean;
|
|
487
|
+
error: Error | null;
|
|
488
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<_tanstack_react_query.NoInfer<T>, Error>>;
|
|
489
|
+
};
|
|
490
|
+
interface PageContentState<T extends ContentItem = ContentItem> extends ContentSlotReader {
|
|
491
|
+
page: T | null;
|
|
492
|
+
data: T | null;
|
|
493
|
+
isLoading: boolean;
|
|
494
|
+
isFetching: boolean;
|
|
495
|
+
isError: boolean;
|
|
496
|
+
error: Error | null;
|
|
497
|
+
refetch: () => unknown;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Fetch a website page and expose structured template fields.
|
|
501
|
+
*
|
|
502
|
+
* Use `page.content`/`page.blocks` for article-like rich text pages. Use
|
|
503
|
+
* `text('hero.title')`, `list('benefits.items')`, etc. for designed website
|
|
504
|
+
* templates where the frontend owns layout and AxCloud owns content.
|
|
505
|
+
*/
|
|
506
|
+
declare function usePageContent<T extends ContentItem = ContentItem>(slug: string, options?: ContentItemOptions): PageContentState<T>;
|
|
507
|
+
|
|
508
|
+
export { useAxCloudContext as $, type AxCloudAnalyticsOptions as A, type BaseRole as B, type ContentQueryOptions as C, type DocumentQueryOptions as D, type DocumentSourceProvider as E, type DocumentStatus as F, type Membership as G, type OrganizationSettings as H, type PageContentState as I, type PaginatedResponse as J, type SectionPermissions as K, type SystemRole as L, type MediaItem as M, type NewsItem as N, type Organization as O, type Page as P, createContentSlotReader as Q, fetchAnalyticsPublicConfig as R, type Section as S, getContentSlotMap as T, type User as U, isAllowedAnalyticsEvent as V, isLocalAnalyticsHostname as W, sanitizeAnalyticsEventData as X, sanitizeAnalyticsPath as Y, useAnalytics as Z, useAnalyticsRuntime as _, type UserRole as a, useContent as a0, useContentItem as a1, usePageContent as a2, userHasAllPermissions as a3, userHasAnyPermission as a4, userHasPermission as a5, type ContentBlock as a6, type ContentItemOptions as a7, type AxCloudModule as b, type ContentListResponse as c, type SignedMediaUrl as d, type OrganizationBranding as e, type MediaListResponse as f, type SignedDocumentUrl as g, type DocumentItem as h, type DocumentListResponse as i, type DocumentFolder as j, type DocumentFolderListResponse as k, type AnalyticsEventData as l, type AnalyticsEventValue as m, type AnalyticsPublicConfig as n, type AnalyticsRuntime as o, type AnalyticsRuntimeConfig as p, type AxCloudConfig as q, type ContentCollectionType as r, type ContentDetailType as s, type ContentItem as t, type ContentSlotImage as u, type ContentSlotMap as v, type ContentSlotReader as w, type ContentSlotValue as x, type CustomRole as y, type DocumentAudience as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axcode/axcloud-sdk",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.5dc7e06",
|
|
4
4
|
"description": "SDK for building websites with AxCloud CMS and member management",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./public": {
|
|
15
|
+
"types": "./dist/public.d.ts",
|
|
16
|
+
"import": "./dist/public.mjs",
|
|
17
|
+
"require": "./dist/public.js"
|
|
18
|
+
},
|
|
19
|
+
"./barnsport": {
|
|
20
|
+
"types": "./dist/barnsport.d.ts",
|
|
21
|
+
"import": "./dist/barnsport.mjs",
|
|
22
|
+
"require": "./dist/barnsport.js"
|
|
23
|
+
},
|
|
14
24
|
"./styles/linked-accounts.css": "./dist/styles/linked-accounts.css"
|
|
15
25
|
},
|
|
16
26
|
"files": [
|
|
@@ -40,16 +50,16 @@
|
|
|
40
50
|
"@types/node": "^20.0.0",
|
|
41
51
|
"@types/react": "^19.0.2",
|
|
42
52
|
"@types/react-dom": "^19.0.2",
|
|
43
|
-
"@vitest/coverage-v8": "4.
|
|
53
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
44
54
|
"eslint": "^9.17.0",
|
|
45
55
|
"eslint-plugin-react": "^7.37.4",
|
|
46
56
|
"globals": "^16.5.0",
|
|
47
|
-
"react": "^19.
|
|
48
|
-
"react-dom": "^19.
|
|
57
|
+
"react": "^19.2.8",
|
|
58
|
+
"react-dom": "^19.2.8",
|
|
49
59
|
"tsup": "^8.3.5",
|
|
50
60
|
"typescript": "^5.7.2",
|
|
51
61
|
"typescript-eslint": "^8.31.1",
|
|
52
|
-
"vitest": "4.
|
|
62
|
+
"vitest": "4.1.10"
|
|
53
63
|
},
|
|
54
64
|
"repository": {
|
|
55
65
|
"type": "git",
|