@axcode/axcloud-sdk 0.3.2 → 0.4.0-dev.35742cb
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 +32 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -9
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.mts +2 -2
- package/dist/public.d.ts +2 -2
- package/dist/{useContent-Cl7dvERE.d.ts → useContent-CGI1l3Gs.d.ts} +25 -1
- package/dist/{useContent-1WbKvPY4.d.mts → useContent-DLoyqAWH.d.mts} +25 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -137,6 +137,37 @@ function App() {
|
|
|
137
137
|
`auth0.organization` is the Auth0 Organization ID used during login, for example `org_o960yILn77d4vY6u`.
|
|
138
138
|
Set `auth0.organization` for invite-only customer member sites so Universal Login is scoped to that customer organization.
|
|
139
139
|
|
|
140
|
+
### Customer-owned identity providers
|
|
141
|
+
|
|
142
|
+
An organization may authenticate through its own Auth0 tenant while AxCloud
|
|
143
|
+
continues to provide content, membership and authorization APIs. Configure the
|
|
144
|
+
complete, reviewed provider tuple statically in the first-party site:
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
<AxCloudProvider
|
|
148
|
+
orgId="org_customer"
|
|
149
|
+
apiUrl="https://dev-api.axcloud.app"
|
|
150
|
+
stage="dev"
|
|
151
|
+
auth0={{
|
|
152
|
+
identityProviderId: 'idp_customer_dev',
|
|
153
|
+
domain: 'dev-auth.customer.example',
|
|
154
|
+
clientId: 'customer-member-spa-client-id',
|
|
155
|
+
audience: 'https://api.axcloud.app',
|
|
156
|
+
organization: 'org_customer_auth0',
|
|
157
|
+
redirectUri: window.location.origin,
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<App />
|
|
161
|
+
</AxCloudProvider>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`identityProviderId` is a public AxCloud identifier, not a credential. It is
|
|
165
|
+
included in the SDK cache-owner signature so a provider switch or rotation
|
|
166
|
+
cannot reuse identity-bound query data. The SDK does not discover providers or
|
|
167
|
+
hold Auth0 Management API credentials. Keep domain, client ID, audience,
|
|
168
|
+
organization ID, AxCloud stage and API URL together as one environment-specific
|
|
169
|
+
configuration; never mix a customer DEV tenant with AxCloud PROD APIs.
|
|
170
|
+
|
|
140
171
|
### 2. Fetch content
|
|
141
172
|
|
|
142
173
|
```tsx
|
|
@@ -586,7 +617,7 @@ The SDK uses two types of credentials:
|
|
|
586
617
|
| Public content | API key (x-api-key header) | `/content/public/{orgId}/news` |
|
|
587
618
|
| Member content | JWT Bearer token | `/content/members/{orgId}/news` |
|
|
588
619
|
| User data | JWT Bearer token | `/api/users/me` |
|
|
589
|
-
| Admin | JWT Bearer token + role | `/
|
|
620
|
+
| Admin | JWT Bearer token + role | `/forms/admin/submissions` |
|
|
590
621
|
|
|
591
622
|
## Error Handling
|
|
592
623
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as AxCloudClient, c as createClient, g as getClient } from './client-FOpKwe3e.mjs';
|
|
2
|
-
import { A as AxCloudAnalyticsOptions, U as User$1, a as UserRole, O as Organization, b as AxCloudModule, C as ContentQueryOptions, N as NewsItem, c as ContentListResponse, S as Section, d as SignedMediaUrl, e as OrganizationBranding, M as MediaItem, f as MediaListResponse, g as SignedDocumentUrl, D as DocumentQueryOptions, h as DocumentItem, i as DocumentListResponse, j as DocumentFolder, k as DocumentFolderListResponse } from './useContent-
|
|
3
|
-
export { l as AnalyticsEventData, m as AnalyticsEventValue, n as AnalyticsPublicConfig, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, q as AxCloudConfig, B as BaseRole, r as ContentCollectionType, s as ContentDetailType, t as ContentItem, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, y as CustomRole, z as DocumentAudience, E as DocumentSourceProvider, F as DocumentStatus, G as Membership, H as OrganizationSettings, P as Page, I as PageContentState, J as PaginatedResponse, K as SectionPermissions, L as SystemRole, Q as createContentSlotReader, R as fetchAnalyticsPublicConfig, T as getContentSlotMap, V as isAllowedAnalyticsEvent, W as isLocalAnalyticsHostname, X as sanitizeAnalyticsEventData, Y as sanitizeAnalyticsPath, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent, a3 as userHasAllPermissions, a4 as userHasAnyPermission, a5 as userHasPermission } from './useContent-
|
|
2
|
+
import { A as AxCloudAnalyticsOptions, U as User$1, a as UserRole, O as Organization, b as AxCloudModule, C as ContentQueryOptions, N as NewsItem, c as ContentListResponse, S as Section, d as SignedMediaUrl, e as OrganizationBranding, M as MediaItem, f as MediaListResponse, g as SignedDocumentUrl, D as DocumentQueryOptions, h as DocumentItem, i as DocumentListResponse, j as DocumentFolder, k as DocumentFolderListResponse } from './useContent-DLoyqAWH.mjs';
|
|
3
|
+
export { l as AnalyticsEventData, m as AnalyticsEventValue, n as AnalyticsPublicConfig, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, q as AxCloudConfig, B as BaseRole, r as ContentCollectionType, s as ContentDetailType, t as ContentItem, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, y as CustomRole, z as DocumentAudience, E as DocumentSourceProvider, F as DocumentStatus, G as Membership, H as OrganizationSettings, P as Page, I as PageContentState, J as PaginatedResponse, K as SectionPermissions, L as SystemRole, Q as createContentSlotReader, R as fetchAnalyticsPublicConfig, T as getContentSlotMap, V as isAllowedAnalyticsEvent, W as isLocalAnalyticsHostname, X as sanitizeAnalyticsEventData, Y as sanitizeAnalyticsPath, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent, a3 as userHasAllPermissions, a4 as userHasAnyPermission, a5 as userHasPermission } from './useContent-DLoyqAWH.mjs';
|
|
4
4
|
export { B as BarnsportActivitiesFilter, a as BarnsportActivity, b as BarnsportActivityListItem, c as BarnsportActivityLocation, d as BarnsportActivityResponse, e as BarnsportActivitySchedule, f as BarnsportInquirySubmissionRequest, g as BarnsportInterestSubmissionRequest, h as BarnsportInterestSubmissionResponse, i as BarnsportListResponse, j as BarnsportMunicipality, k as BarnsportRegistrationMethod, l as BarnsportSitemapResponse, m as BarnsportSitemapUrl, n as BarnsportSport, u as useBarnsportActivities, o as useBarnsportActivity, p as useBarnsportMunicipalities, q as useBarnsportSitemap, r as useBarnsportSport, s as useBarnsportSports, t as useSubmitBarnsportInterest } from './useBarnsport-DHyNF9GM.mjs';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -323,6 +323,11 @@ interface AxCloudProviderProps {
|
|
|
323
323
|
/** Optional privacy-safe analytics collection through AxCloud. */
|
|
324
324
|
analytics?: AxCloudAnalyticsOptions;
|
|
325
325
|
auth0: {
|
|
326
|
+
/**
|
|
327
|
+
* Stable public AxCloud identity-provider identifier.
|
|
328
|
+
* Used only to isolate SDK-owned state across provider changes.
|
|
329
|
+
*/
|
|
330
|
+
identityProviderId?: string;
|
|
326
331
|
domain: string;
|
|
327
332
|
clientId: string;
|
|
328
333
|
redirectUri: string;
|
|
@@ -348,6 +353,7 @@ interface AxCloudProviderProps {
|
|
|
348
353
|
* apiUrl="https://api.axcloud.app"
|
|
349
354
|
* apiKey="your-api-key" // Required for public content access
|
|
350
355
|
* auth0={{
|
|
356
|
+
* identityProviderId: "idp_customer_abc123",
|
|
351
357
|
* domain: "auth.axcloud.app",
|
|
352
358
|
* clientId: "xxx",
|
|
353
359
|
* redirectUri: window.location.origin,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as AxCloudClient, c as createClient, g as getClient } from './client-FOpKwe3e.js';
|
|
2
|
-
import { A as AxCloudAnalyticsOptions, U as User$1, a as UserRole, O as Organization, b as AxCloudModule, C as ContentQueryOptions, N as NewsItem, c as ContentListResponse, S as Section, d as SignedMediaUrl, e as OrganizationBranding, M as MediaItem, f as MediaListResponse, g as SignedDocumentUrl, D as DocumentQueryOptions, h as DocumentItem, i as DocumentListResponse, j as DocumentFolder, k as DocumentFolderListResponse } from './useContent-
|
|
3
|
-
export { l as AnalyticsEventData, m as AnalyticsEventValue, n as AnalyticsPublicConfig, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, q as AxCloudConfig, B as BaseRole, r as ContentCollectionType, s as ContentDetailType, t as ContentItem, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, y as CustomRole, z as DocumentAudience, E as DocumentSourceProvider, F as DocumentStatus, G as Membership, H as OrganizationSettings, P as Page, I as PageContentState, J as PaginatedResponse, K as SectionPermissions, L as SystemRole, Q as createContentSlotReader, R as fetchAnalyticsPublicConfig, T as getContentSlotMap, V as isAllowedAnalyticsEvent, W as isLocalAnalyticsHostname, X as sanitizeAnalyticsEventData, Y as sanitizeAnalyticsPath, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent, a3 as userHasAllPermissions, a4 as userHasAnyPermission, a5 as userHasPermission } from './useContent-
|
|
2
|
+
import { A as AxCloudAnalyticsOptions, U as User$1, a as UserRole, O as Organization, b as AxCloudModule, C as ContentQueryOptions, N as NewsItem, c as ContentListResponse, S as Section, d as SignedMediaUrl, e as OrganizationBranding, M as MediaItem, f as MediaListResponse, g as SignedDocumentUrl, D as DocumentQueryOptions, h as DocumentItem, i as DocumentListResponse, j as DocumentFolder, k as DocumentFolderListResponse } from './useContent-CGI1l3Gs.js';
|
|
3
|
+
export { l as AnalyticsEventData, m as AnalyticsEventValue, n as AnalyticsPublicConfig, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, q as AxCloudConfig, B as BaseRole, r as ContentCollectionType, s as ContentDetailType, t as ContentItem, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, y as CustomRole, z as DocumentAudience, E as DocumentSourceProvider, F as DocumentStatus, G as Membership, H as OrganizationSettings, P as Page, I as PageContentState, J as PaginatedResponse, K as SectionPermissions, L as SystemRole, Q as createContentSlotReader, R as fetchAnalyticsPublicConfig, T as getContentSlotMap, V as isAllowedAnalyticsEvent, W as isLocalAnalyticsHostname, X as sanitizeAnalyticsEventData, Y as sanitizeAnalyticsPath, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent, a3 as userHasAllPermissions, a4 as userHasAnyPermission, a5 as userHasPermission } from './useContent-CGI1l3Gs.js';
|
|
4
4
|
export { B as BarnsportActivitiesFilter, a as BarnsportActivity, b as BarnsportActivityListItem, c as BarnsportActivityLocation, d as BarnsportActivityResponse, e as BarnsportActivitySchedule, f as BarnsportInquirySubmissionRequest, g as BarnsportInterestSubmissionRequest, h as BarnsportInterestSubmissionResponse, i as BarnsportListResponse, j as BarnsportMunicipality, k as BarnsportRegistrationMethod, l as BarnsportSitemapResponse, m as BarnsportSitemapUrl, n as BarnsportSport, u as useBarnsportActivities, o as useBarnsportActivity, p as useBarnsportMunicipalities, q as useBarnsportSitemap, r as useBarnsportSport, s as useBarnsportSports, t as useSubmitBarnsportInterest } from './useBarnsport-DHyNF9GM.js';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
@@ -323,6 +323,11 @@ interface AxCloudProviderProps {
|
|
|
323
323
|
/** Optional privacy-safe analytics collection through AxCloud. */
|
|
324
324
|
analytics?: AxCloudAnalyticsOptions;
|
|
325
325
|
auth0: {
|
|
326
|
+
/**
|
|
327
|
+
* Stable public AxCloud identity-provider identifier.
|
|
328
|
+
* Used only to isolate SDK-owned state across provider changes.
|
|
329
|
+
*/
|
|
330
|
+
identityProviderId?: string;
|
|
326
331
|
domain: string;
|
|
327
332
|
clientId: string;
|
|
328
333
|
redirectUri: string;
|
|
@@ -348,6 +353,7 @@ interface AxCloudProviderProps {
|
|
|
348
353
|
* apiUrl="https://api.axcloud.app"
|
|
349
354
|
* apiKey="your-api-key" // Required for public content access
|
|
350
355
|
* auth0={{
|
|
356
|
+
* identityProviderId: "idp_customer_abc123",
|
|
351
357
|
* domain: "auth.axcloud.app",
|
|
352
358
|
* clientId: "xxx",
|
|
353
359
|
* redirectUri: window.location.origin,
|
package/dist/index.js
CHANGED
|
@@ -252,6 +252,7 @@ function createQueryClientOwnerSignature(config, subject) {
|
|
|
252
252
|
config.stage,
|
|
253
253
|
config.apiUrl,
|
|
254
254
|
config.apiKey ?? null,
|
|
255
|
+
config.auth0.identityProviderId ?? null,
|
|
255
256
|
config.auth0.domain,
|
|
256
257
|
config.auth0.clientId,
|
|
257
258
|
config.auth0.audience ?? null,
|
|
@@ -858,17 +859,18 @@ function useSections() {
|
|
|
858
859
|
refetch: query.refetch
|
|
859
860
|
};
|
|
860
861
|
}
|
|
862
|
+
var FORMS_ADMIN_PATH = "/forms/admin";
|
|
861
863
|
function useForms(options = {}) {
|
|
862
|
-
const { client,
|
|
864
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
863
865
|
const { formType, status, limit = 50, cursor } = options;
|
|
864
866
|
const query = reactQuery.useQuery({
|
|
865
|
-
queryKey: ["axcloud", "forms", "submissions",
|
|
867
|
+
queryKey: ["axcloud", "forms", "submissions", orgId, formType, status, limit, cursor],
|
|
866
868
|
queryFn: async () => {
|
|
867
|
-
const params = { limit };
|
|
869
|
+
const params = { org_id: orgId, limit };
|
|
868
870
|
if (formType) params.form_type = formType;
|
|
869
871
|
if (status) params.status = status;
|
|
870
872
|
if (cursor) params.cursor = cursor;
|
|
871
|
-
return client.get(
|
|
873
|
+
return client.get(`${FORMS_ADMIN_PATH}/submissions`, params);
|
|
872
874
|
},
|
|
873
875
|
staleTime: 1e3 * 30
|
|
874
876
|
// 30 seconds
|
|
@@ -885,12 +887,12 @@ function useForms(options = {}) {
|
|
|
885
887
|
};
|
|
886
888
|
}
|
|
887
889
|
function useFormStats(options = {}) {
|
|
888
|
-
const { client,
|
|
890
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
889
891
|
const { days = 30 } = options;
|
|
890
892
|
const query = reactQuery.useQuery({
|
|
891
|
-
queryKey: ["axcloud", "forms", "stats",
|
|
893
|
+
queryKey: ["axcloud", "forms", "stats", orgId, days],
|
|
892
894
|
queryFn: async () => {
|
|
893
|
-
return client.get(
|
|
895
|
+
return client.get(`${FORMS_ADMIN_PATH}/stats`, { org_id: orgId, days });
|
|
894
896
|
},
|
|
895
897
|
staleTime: 1e3 * 60 * 5
|
|
896
898
|
// 5 minutes
|
|
@@ -906,7 +908,7 @@ function useFormStats(options = {}) {
|
|
|
906
908
|
};
|
|
907
909
|
}
|
|
908
910
|
function useUpdateFormSubmission() {
|
|
909
|
-
const { client,
|
|
911
|
+
const { client, orgId } = chunk7K5N3DQ4_js.useAxCloudContext();
|
|
910
912
|
const queryClient = reactQuery.useQueryClient();
|
|
911
913
|
return reactQuery.useMutation({
|
|
912
914
|
mutationFn: async ({
|
|
@@ -914,7 +916,10 @@ function useUpdateFormSubmission() {
|
|
|
914
916
|
status,
|
|
915
917
|
notes
|
|
916
918
|
}) => {
|
|
917
|
-
return client.patch(
|
|
919
|
+
return client.patch(
|
|
920
|
+
`${FORMS_ADMIN_PATH}/submissions/${encodeURIComponent(submissionId)}?org_id=${encodeURIComponent(orgId)}`,
|
|
921
|
+
{ status, notes }
|
|
922
|
+
);
|
|
918
923
|
},
|
|
919
924
|
onSuccess: () => {
|
|
920
925
|
queryClient.invalidateQueries({ queryKey: ["axcloud", "forms"] });
|