@axcode/axcloud-sdk 0.2.0-dev.85285e0 → 0.2.0-dev.d9fb4fe
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 +23 -0
- package/dist/barnsport.d.mts +12 -3
- package/dist/barnsport.d.ts +12 -3
- package/dist/barnsport.js +21 -17
- package/dist/barnsport.mjs +2 -2
- package/dist/{chunk-DI4M6A7K.js → chunk-2IVJTMRB.js} +264 -219
- package/dist/chunk-2IVJTMRB.js.map +1 -0
- package/dist/{chunk-HRNRGCCT.mjs → chunk-7IPCZJ5Q.mjs} +16 -5
- 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-F3JPEND3.mjs → chunk-CACQMQCJ.mjs} +259 -214
- 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-EX66R5IA.js → chunk-ZOQAXLCZ.js} +29 -17
- package/dist/chunk-ZOQAXLCZ.js.map +1 -0
- package/dist/index.d.mts +4 -79
- package/dist/index.d.ts +4 -79
- package/dist/index.js +81 -320
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -260
- package/dist/index.mjs.map +1 -1
- package/dist/public.d.mts +2 -2
- package/dist/public.d.ts +2 -2
- package/dist/public.js +29 -9
- package/dist/public.mjs +4 -4
- package/dist/{useBarnsport-1DObGZDl.d.mts → useBarnsport-Cn9flax0.d.mts} +54 -6
- package/dist/{useBarnsport-1DObGZDl.d.ts → useBarnsport-Cn9flax0.d.ts} +54 -6
- package/dist/{analytics-LYZxP7PC.d.mts → useContent-1WbKvPY4.d.mts} +77 -1
- package/dist/{analytics-BOxmSWNt.d.ts → useContent-Cl7dvERE.d.ts} +77 -1
- package/package.json +1 -1
- package/dist/chunk-2A5NJAFA.mjs +0 -15
- package/dist/chunk-2A5NJAFA.mjs.map +0 -1
- package/dist/chunk-DI4M6A7K.js.map +0 -1
- package/dist/chunk-DSWRJZWR.js +0 -18
- package/dist/chunk-DSWRJZWR.js.map +0 -1
- package/dist/chunk-EX66R5IA.js.map +0 -1
- package/dist/chunk-F3JPEND3.mjs.map +0 -1
- package/dist/chunk-HRNRGCCT.mjs.map +0 -1
package/dist/public.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { A as AxCloudAnalyticsOptions } from './
|
|
4
|
-
export {
|
|
3
|
+
import { A as AxCloudAnalyticsOptions } from './useContent-1WbKvPY4.mjs';
|
|
4
|
+
export { l as AnalyticsEventData, m as AnalyticsEventValue, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, a6 as ContentBlock, t as ContentItem, a7 as ContentItemOptions, c as ContentListResponse, C as ContentQueryOptions, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, P as Page, I as PageContentState, Q as createContentSlotReader, T as getContentSlotMap, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent } from './useContent-1WbKvPY4.mjs';
|
|
5
5
|
import './client-FOpKwe3e.mjs';
|
|
6
6
|
|
|
7
7
|
interface AxCloudPublicProviderProps {
|
package/dist/public.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { A as AxCloudAnalyticsOptions } from './
|
|
4
|
-
export {
|
|
3
|
+
import { A as AxCloudAnalyticsOptions } from './useContent-Cl7dvERE.js';
|
|
4
|
+
export { l as AnalyticsEventData, m as AnalyticsEventValue, o as AnalyticsRuntime, p as AnalyticsRuntimeConfig, a6 as ContentBlock, t as ContentItem, a7 as ContentItemOptions, c as ContentListResponse, C as ContentQueryOptions, u as ContentSlotImage, v as ContentSlotMap, w as ContentSlotReader, x as ContentSlotValue, P as Page, I as PageContentState, Q as createContentSlotReader, T as getContentSlotMap, Z as useAnalytics, _ as useAnalyticsRuntime, $ as useAxCloudContext, a0 as useContent, a1 as useContentItem, a2 as usePageContent } from './useContent-Cl7dvERE.js';
|
|
5
5
|
import './client-FOpKwe3e.js';
|
|
6
6
|
|
|
7
7
|
interface AxCloudPublicProviderProps {
|
package/dist/public.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk2IVJTMRB_js = require('./chunk-2IVJTMRB.js');
|
|
4
|
+
var chunk7K5N3DQ4_js = require('./chunk-7K5N3DQ4.js');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -13,7 +13,7 @@ function createDefaultQueryClient() {
|
|
|
13
13
|
staleTime: 1e3 * 60,
|
|
14
14
|
gcTime: 1e3 * 60 * 30,
|
|
15
15
|
retry: (failureCount, error) => {
|
|
16
|
-
if (
|
|
16
|
+
if (chunk7K5N3DQ4_js.isAxCloudError(error) && error.status >= 400 && error.status < 500) {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
19
|
return failureCount < 2;
|
|
@@ -67,14 +67,14 @@ function AxCloudPublicProvider({
|
|
|
67
67
|
setActivatedOwner(ownerSignature);
|
|
68
68
|
}, [clearContentCache, ownerNeedsActivation, ownerSignature, queryClient]);
|
|
69
69
|
const client = react.useMemo(
|
|
70
|
-
() => new
|
|
70
|
+
() => new chunk7K5N3DQ4_js.AxCloudClient({
|
|
71
71
|
baseUrl: apiUrl,
|
|
72
72
|
apiKey,
|
|
73
73
|
timeout
|
|
74
74
|
}),
|
|
75
75
|
[apiUrl, apiKey, timeout]
|
|
76
76
|
);
|
|
77
|
-
const analytics =
|
|
77
|
+
const analytics = chunk2IVJTMRB_js.useAnalyticsRuntime(config);
|
|
78
78
|
const contextValue = react.useMemo(
|
|
79
79
|
() => ({
|
|
80
80
|
config,
|
|
@@ -91,20 +91,40 @@ function AxCloudPublicProvider({
|
|
|
91
91
|
[config, client, orgId, stage, clearContentCache, analytics]
|
|
92
92
|
);
|
|
93
93
|
const identityReady = !ownerNeedsActivation && (activatedOwner === ownerSignature || publicQueryClientOwners.get(queryClient) === ownerSignature);
|
|
94
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(chunk7K5N3DQ4_js.AxCloudContext.Provider, { value: contextValue, children: identityReady ? children : null }) });
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
Object.defineProperty(exports, "createContentSlotReader", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () { return chunk2IVJTMRB_js.createContentSlotReader; }
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(exports, "getContentSlotMap", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: function () { return chunk2IVJTMRB_js.getContentSlotMap; }
|
|
104
|
+
});
|
|
97
105
|
Object.defineProperty(exports, "useAnalytics", {
|
|
98
106
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunk2IVJTMRB_js.useAnalytics; }
|
|
100
108
|
});
|
|
101
109
|
Object.defineProperty(exports, "useAnalyticsRuntime", {
|
|
102
110
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunk2IVJTMRB_js.useAnalyticsRuntime; }
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "useContent", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: function () { return chunk2IVJTMRB_js.useContent; }
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, "useContentItem", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function () { return chunk2IVJTMRB_js.useContentItem; }
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "usePageContent", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () { return chunk2IVJTMRB_js.usePageContent; }
|
|
104
124
|
});
|
|
105
125
|
Object.defineProperty(exports, "useAxCloudContext", {
|
|
106
126
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunk7K5N3DQ4_js.useAxCloudContext; }
|
|
108
128
|
});
|
|
109
129
|
exports.AxCloudPublicProvider = AxCloudPublicProvider;
|
|
110
130
|
//# sourceMappingURL=public.js.map
|
package/dist/public.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { useAnalytics, useAnalyticsRuntime } from './chunk-
|
|
3
|
-
import { AxCloudContext } from './chunk-
|
|
4
|
-
export { useAxCloudContext } from './chunk-
|
|
1
|
+
import { useAnalyticsRuntime } from './chunk-CACQMQCJ.mjs';
|
|
2
|
+
export { createContentSlotReader, getContentSlotMap, useAnalytics, useAnalyticsRuntime, useContent, useContentItem, usePageContent } from './chunk-CACQMQCJ.mjs';
|
|
3
|
+
import { AxCloudClient, AxCloudContext, isAxCloudError } from './chunk-PMMCOWL3.mjs';
|
|
4
|
+
export { useAxCloudContext } from './chunk-PMMCOWL3.mjs';
|
|
5
5
|
import { useState, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
6
6
|
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -151,13 +151,13 @@ interface BarnsportSitemapResponse {
|
|
|
151
151
|
updatedAt: string;
|
|
152
152
|
urls: BarnsportSitemapUrl[];
|
|
153
153
|
}
|
|
154
|
-
interface
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
interface BarnsportInquirySubmissionBase {
|
|
155
|
+
activityOfferSlug?: string;
|
|
156
|
+
sportSlug?: string;
|
|
157
|
+
municipalitySlug?: string;
|
|
157
158
|
guardianEmail: string;
|
|
158
159
|
guardianPhone?: string;
|
|
159
160
|
childName?: string;
|
|
160
|
-
childBirthYear?: number;
|
|
161
161
|
message?: string;
|
|
162
162
|
consent: {
|
|
163
163
|
contact: boolean;
|
|
@@ -170,12 +170,60 @@ interface BarnsportInterestSubmissionRequest {
|
|
|
170
170
|
utm?: Record<string, string>;
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
type BarnsportInquiryTarget = {
|
|
174
|
+
activitySlug: string;
|
|
175
|
+
providerSlug?: string;
|
|
176
|
+
} | {
|
|
177
|
+
activitySlug?: string;
|
|
178
|
+
providerSlug: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* A normal interest inquiry requires guardian details and the child's birth
|
|
182
|
+
* year. Contact-help is intentionally lighter, but both variants must identify
|
|
183
|
+
* either an activity or a provider.
|
|
184
|
+
*/
|
|
185
|
+
type BarnsportInterestSubmissionRequest = BarnsportInquiryTarget & BarnsportInquirySubmissionBase & ({
|
|
186
|
+
requestKind?: 'interest';
|
|
187
|
+
guardianName: string;
|
|
188
|
+
childBirthYear: number;
|
|
189
|
+
} | {
|
|
190
|
+
requestKind: 'contact_help';
|
|
191
|
+
guardianName?: string;
|
|
192
|
+
childBirthYear?: number;
|
|
193
|
+
});
|
|
194
|
+
interface BarnsportInterestSubmissionResponse extends BarnsportInquiryResponse {
|
|
174
195
|
success: boolean;
|
|
175
196
|
submissionId?: string;
|
|
176
197
|
duplicate?: boolean;
|
|
177
198
|
message: string;
|
|
178
199
|
}
|
|
200
|
+
interface BarnsportProviderUpdateRequest {
|
|
201
|
+
requesterName: string;
|
|
202
|
+
requesterEmail: string;
|
|
203
|
+
requesterRole?: string;
|
|
204
|
+
proposedChanges: {
|
|
205
|
+
website_url?: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
street_address?: string;
|
|
208
|
+
postal_code?: string;
|
|
209
|
+
locality?: string;
|
|
210
|
+
};
|
|
211
|
+
message?: string;
|
|
212
|
+
honeypot?: string;
|
|
213
|
+
source?: {
|
|
214
|
+
site?: string;
|
|
215
|
+
pageUrl?: string;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
interface BarnsportProviderUpdateResponse {
|
|
219
|
+
accepted?: boolean;
|
|
220
|
+
success?: boolean;
|
|
221
|
+
message?: string;
|
|
222
|
+
request?: {
|
|
223
|
+
id?: string;
|
|
224
|
+
status?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
179
227
|
interface BarnsportClubRemovalRequest {
|
|
180
228
|
requesterName: string;
|
|
181
229
|
requesterEmail: string;
|
|
@@ -523,4 +571,4 @@ declare function useSubmitBarnsportFeedback(): _tanstack_react_query.UseMutation
|
|
|
523
571
|
declare function useSubmitBarnsportReview(): _tanstack_react_query.UseMutationResult<BarnsportReviewSubmissionResponse, Error, BarnsportReviewSubmissionRequest, unknown>;
|
|
524
572
|
declare function useTrackBarnsportEvent(): _tanstack_react_query.UseMutationResult<BarnsportEventResponse, Error, BarnsportEventRequest, unknown>;
|
|
525
573
|
|
|
526
|
-
export {
|
|
574
|
+
export { useBarnsportActivityOffers as $, type BarnsportActivityOffer as A, type BarnsportActivitiesFilter as B, type BarnsportFeedbackRequest as C, type BarnsportFeedbackResponse as D, type BarnsportReviewSubmissionRequest as E, type BarnsportReviewSubmissionResponse as F, type BarnsportEventRequest as G, type BarnsportEventResponse as H, type BarnsportClubRemovalRequest as I, type BarnsportClubRemovalResponse as J, type BarnsportProviderUpdateRequest as K, type BarnsportProviderUpdateResponse as L, type BarnsportActivityEnvironment as M, type BarnsportCourseCandidate as N, type BarnsportEventType as O, type BarnsportInquiryDelivery as P, type BarnsportInquiryResponse as Q, type BarnsportMunicipalitySummary as R, type BarnsportProviderSummary as S, type BarnsportReview as T, type BarnsportReviewsSummary as U, type BarnsportSourceConfidence as V, type BarnsportSportArticle as W, type BarnsportSportSummary as X, type BarnsportStats as Y, type BarnsportVerificationStatus as Z, type BarnsportYouthStatus as _, type BarnsportActivity as a, useBarnsportProvider as a0, useBarnsportProviderSearch as a1, useSubmitBarnsportFeedback as a2, useSubmitBarnsportReview as a3, useTrackBarnsportEvent as a4, type BarnsportActivityListItem as b, type BarnsportActivityLocation as c, type BarnsportActivityResponse as d, type BarnsportActivitySchedule as e, type BarnsportInterestSubmissionRequest as f, type BarnsportInterestSubmissionResponse as g, type BarnsportListResponse as h, type BarnsportMunicipality as i, type BarnsportRegistrationMethod as j, type BarnsportSitemapResponse as k, type BarnsportSitemapUrl as l, type BarnsportSport as m, useBarnsportActivity as n, useBarnsportMunicipalities as o, useBarnsportSitemap as p, useBarnsportSport as q, useBarnsportSports as r, useSubmitBarnsportInterest as s, type BarnsportProvidersFilter as t, useBarnsportActivities as u, type BarnsportCollectionResponse as v, type BarnsportProvider as w, type BarnsportItemResponse as x, type BarnsportProviderProfile as y, type BarnsportActivityOffersFilter as z };
|
|
@@ -151,13 +151,13 @@ interface BarnsportSitemapResponse {
|
|
|
151
151
|
updatedAt: string;
|
|
152
152
|
urls: BarnsportSitemapUrl[];
|
|
153
153
|
}
|
|
154
|
-
interface
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
interface BarnsportInquirySubmissionBase {
|
|
155
|
+
activityOfferSlug?: string;
|
|
156
|
+
sportSlug?: string;
|
|
157
|
+
municipalitySlug?: string;
|
|
157
158
|
guardianEmail: string;
|
|
158
159
|
guardianPhone?: string;
|
|
159
160
|
childName?: string;
|
|
160
|
-
childBirthYear?: number;
|
|
161
161
|
message?: string;
|
|
162
162
|
consent: {
|
|
163
163
|
contact: boolean;
|
|
@@ -170,12 +170,60 @@ interface BarnsportInterestSubmissionRequest {
|
|
|
170
170
|
utm?: Record<string, string>;
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
type BarnsportInquiryTarget = {
|
|
174
|
+
activitySlug: string;
|
|
175
|
+
providerSlug?: string;
|
|
176
|
+
} | {
|
|
177
|
+
activitySlug?: string;
|
|
178
|
+
providerSlug: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* A normal interest inquiry requires guardian details and the child's birth
|
|
182
|
+
* year. Contact-help is intentionally lighter, but both variants must identify
|
|
183
|
+
* either an activity or a provider.
|
|
184
|
+
*/
|
|
185
|
+
type BarnsportInterestSubmissionRequest = BarnsportInquiryTarget & BarnsportInquirySubmissionBase & ({
|
|
186
|
+
requestKind?: 'interest';
|
|
187
|
+
guardianName: string;
|
|
188
|
+
childBirthYear: number;
|
|
189
|
+
} | {
|
|
190
|
+
requestKind: 'contact_help';
|
|
191
|
+
guardianName?: string;
|
|
192
|
+
childBirthYear?: number;
|
|
193
|
+
});
|
|
194
|
+
interface BarnsportInterestSubmissionResponse extends BarnsportInquiryResponse {
|
|
174
195
|
success: boolean;
|
|
175
196
|
submissionId?: string;
|
|
176
197
|
duplicate?: boolean;
|
|
177
198
|
message: string;
|
|
178
199
|
}
|
|
200
|
+
interface BarnsportProviderUpdateRequest {
|
|
201
|
+
requesterName: string;
|
|
202
|
+
requesterEmail: string;
|
|
203
|
+
requesterRole?: string;
|
|
204
|
+
proposedChanges: {
|
|
205
|
+
website_url?: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
street_address?: string;
|
|
208
|
+
postal_code?: string;
|
|
209
|
+
locality?: string;
|
|
210
|
+
};
|
|
211
|
+
message?: string;
|
|
212
|
+
honeypot?: string;
|
|
213
|
+
source?: {
|
|
214
|
+
site?: string;
|
|
215
|
+
pageUrl?: string;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
interface BarnsportProviderUpdateResponse {
|
|
219
|
+
accepted?: boolean;
|
|
220
|
+
success?: boolean;
|
|
221
|
+
message?: string;
|
|
222
|
+
request?: {
|
|
223
|
+
id?: string;
|
|
224
|
+
status?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
179
227
|
interface BarnsportClubRemovalRequest {
|
|
180
228
|
requesterName: string;
|
|
181
229
|
requesterEmail: string;
|
|
@@ -523,4 +571,4 @@ declare function useSubmitBarnsportFeedback(): _tanstack_react_query.UseMutation
|
|
|
523
571
|
declare function useSubmitBarnsportReview(): _tanstack_react_query.UseMutationResult<BarnsportReviewSubmissionResponse, Error, BarnsportReviewSubmissionRequest, unknown>;
|
|
524
572
|
declare function useTrackBarnsportEvent(): _tanstack_react_query.UseMutationResult<BarnsportEventResponse, Error, BarnsportEventRequest, unknown>;
|
|
525
573
|
|
|
526
|
-
export {
|
|
574
|
+
export { useBarnsportActivityOffers as $, type BarnsportActivityOffer as A, type BarnsportActivitiesFilter as B, type BarnsportFeedbackRequest as C, type BarnsportFeedbackResponse as D, type BarnsportReviewSubmissionRequest as E, type BarnsportReviewSubmissionResponse as F, type BarnsportEventRequest as G, type BarnsportEventResponse as H, type BarnsportClubRemovalRequest as I, type BarnsportClubRemovalResponse as J, type BarnsportProviderUpdateRequest as K, type BarnsportProviderUpdateResponse as L, type BarnsportActivityEnvironment as M, type BarnsportCourseCandidate as N, type BarnsportEventType as O, type BarnsportInquiryDelivery as P, type BarnsportInquiryResponse as Q, type BarnsportMunicipalitySummary as R, type BarnsportProviderSummary as S, type BarnsportReview as T, type BarnsportReviewsSummary as U, type BarnsportSourceConfidence as V, type BarnsportSportArticle as W, type BarnsportSportSummary as X, type BarnsportStats as Y, type BarnsportVerificationStatus as Z, type BarnsportYouthStatus as _, type BarnsportActivity as a, useBarnsportProvider as a0, useBarnsportProviderSearch as a1, useSubmitBarnsportFeedback as a2, useSubmitBarnsportReview as a3, useTrackBarnsportEvent as a4, type BarnsportActivityListItem as b, type BarnsportActivityLocation as c, type BarnsportActivityResponse as d, type BarnsportActivitySchedule as e, type BarnsportInterestSubmissionRequest as f, type BarnsportInterestSubmissionResponse as g, type BarnsportListResponse as h, type BarnsportMunicipality as i, type BarnsportRegistrationMethod as j, type BarnsportSitemapResponse as k, type BarnsportSitemapUrl as l, type BarnsportSport as m, useBarnsportActivity as n, useBarnsportMunicipalities as o, useBarnsportSitemap as p, useBarnsportSport as q, useBarnsportSports as r, useSubmitBarnsportInterest as s, type BarnsportProvidersFilter as t, useBarnsportActivities as u, type BarnsportCollectionResponse as v, type BarnsportProvider as w, type BarnsportItemResponse as x, type BarnsportProviderProfile as y, type BarnsportActivityOffersFilter as z };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { A as AxCloudClient } from './client-FOpKwe3e.mjs';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
3
|
|
|
3
4
|
type AnalyticsEventValue = string | number | boolean;
|
|
4
5
|
type AnalyticsEventData = Record<string, AnalyticsEventValue>;
|
|
@@ -405,6 +406,27 @@ interface DocumentQueryOptions {
|
|
|
405
406
|
folderId?: string;
|
|
406
407
|
}
|
|
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
|
+
|
|
408
430
|
interface AxCloudContextValue {
|
|
409
431
|
config: AxCloudConfig;
|
|
410
432
|
client: AxCloudClient;
|
|
@@ -429,4 +451,58 @@ type AnalyticsRuntimeConfig = Pick<AxCloudConfig, 'analytics' | 'apiUrl' | 'orgI
|
|
|
429
451
|
declare function useAnalyticsRuntime(config: AnalyticsRuntimeConfig): AnalyticsRuntime;
|
|
430
452
|
declare function useAnalytics(): AnalyticsRuntime;
|
|
431
453
|
|
|
432
|
-
|
|
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 };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { A as AxCloudClient } from './client-FOpKwe3e.js';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
3
|
|
|
3
4
|
type AnalyticsEventValue = string | number | boolean;
|
|
4
5
|
type AnalyticsEventData = Record<string, AnalyticsEventValue>;
|
|
@@ -405,6 +406,27 @@ interface DocumentQueryOptions {
|
|
|
405
406
|
folderId?: string;
|
|
406
407
|
}
|
|
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
|
+
|
|
408
430
|
interface AxCloudContextValue {
|
|
409
431
|
config: AxCloudConfig;
|
|
410
432
|
client: AxCloudClient;
|
|
@@ -429,4 +451,58 @@ type AnalyticsRuntimeConfig = Pick<AxCloudConfig, 'analytics' | 'apiUrl' | 'orgI
|
|
|
429
451
|
declare function useAnalyticsRuntime(config: AnalyticsRuntimeConfig): AnalyticsRuntime;
|
|
430
452
|
declare function useAnalytics(): AnalyticsRuntime;
|
|
431
453
|
|
|
432
|
-
|
|
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
package/dist/chunk-2A5NJAFA.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
// src/react/context.tsx
|
|
4
|
-
var AxCloudContext = createContext(null);
|
|
5
|
-
function useAxCloudContext() {
|
|
6
|
-
const context = useContext(AxCloudContext);
|
|
7
|
-
if (!context) {
|
|
8
|
-
throw new Error("useAxCloudContext must be used within a AxCloudProvider");
|
|
9
|
-
}
|
|
10
|
-
return context;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { AxCloudContext, useAxCloudContext };
|
|
14
|
-
//# sourceMappingURL=chunk-2A5NJAFA.mjs.map
|
|
15
|
-
//# sourceMappingURL=chunk-2A5NJAFA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/context.tsx"],"names":[],"mappings":";;;AAwBO,IAAM,cAAA,GAAiB,cAA0C,IAAI;AAErE,SAAS,iBAAA,GAAyC;AACvD,EAAA,MAAM,OAAA,GAAU,WAAW,cAAc,CAAA;AACzC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,yDAAyD,CAAA;AAAA,EAC3E;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-2A5NJAFA.mjs","sourcesContent":["import { createContext, useContext } from 'react';\nimport type { AxCloudClient } from '../core/client';\nimport type { AxCloudConfig } from '../core/types';\nimport type { AnalyticsRuntime } from '../core/analytics';\n\nexport interface AxCloudContextValue {\n config: AxCloudConfig;\n client: AxCloudClient;\n orgId: string;\n /** API stage (e.g., 'dev', 'prod') */\n stage: string;\n /** Whether using public API mode (API key, no auth) */\n isPublicMode: boolean;\n /** Auth0 has completed its initial session check. */\n isAuthLoading?: boolean;\n /** Whether the current browser session is authenticated. */\n isAuthenticated?: boolean;\n /** Auth0 subject used to isolate member-only query caches. */\n authSubject?: string;\n /** Remove identity-bound AxCloud query data before logout or account changes. */\n clearContentCache?: () => void;\n analytics: AnalyticsRuntime;\n}\n\nexport const AxCloudContext = createContext<AxCloudContextValue | null>(null);\n\nexport function useAxCloudContext(): AxCloudContextValue {\n const context = useContext(AxCloudContext);\n if (!context) {\n throw new Error('useAxCloudContext must be used within a AxCloudProvider');\n }\n return context;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/errors.ts","../src/core/client.ts","../src/core/analytics.ts","../src/react/analytics.ts"],"names":["useState","useRef","useCallback","useEffect","useMemo","useAxCloudContext"],"mappings":";;;;;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EAKtC,WAAA,CACE,OAAA,EACA,IAAA,EACA,MAAA,EACA,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAA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ACD,OAAO,SAAA,EAAW,OAAA;AAAA,IAClB,OAAO,SAAA,EAAW,OAAA;AAAA,IAClB,OAAO,SAAA,EAAW,cAAA;AAAA,IAClB,OAAO,SAAA,EAAW,aAAA;AAAA,IAClB,MAAA,CAAO,MAAA;AAAA,IACP,MAAA,CAAO,KAAA;AAAA,IACP,MAAA,CAAO;AAAA,GACR,CAAA;AAED,EAAA,OAAOC,aAAA;AAAA,IACL,OAAO,EAAE,OAAA,EAAS,KAAA,EAAO,OAAO,aAAA,EAAc,CAAA;AAAA,IAC9C,CAAC,OAAA,EAAS,KAAA,EAAO,KAAA,EAAO,aAAa;AAAA,GACvC;AACF;AAEO,SAAS,YAAA,GAAiC;AAC/C,EAAA,OAAOC,oCAAkB,CAAE,SAAA;AAC7B","file":"chunk-DI4M6A7K.js","sourcesContent":["/**\n * AxCloud SDK Error Types\n */\n\nexport type AxCloudErrorCode =\n | 'UNAUTHORIZED'\n | 'FORBIDDEN'\n | 'NOT_FOUND'\n | 'VALIDATION_ERROR'\n | 'NETWORK_ERROR'\n | 'TIMEOUT_ERROR'\n | 'SERVER_ERROR'\n | 'UNKNOWN_ERROR';\n\nexport class AxCloudError extends Error {\n readonly code: AxCloudErrorCode;\n readonly status: number;\n readonly details?: Record<string, unknown>;\n\n constructor(\n message: string,\n code: AxCloudErrorCode,\n status: number,\n details?: Record<string, unknown>\n ) {\n super(message);\n this.name = 'AxCloudError';\n this.code = code;\n this.status = status;\n this.details = details;\n\n // Maintains proper stack trace for where error was thrown (V8 only)\n const ErrorWithCapture = Error as typeof Error & {\n captureStackTrace?: (target: object, constructor?: typeof AxCloudError) => void;\n };\n if (ErrorWithCapture.captureStackTrace) {\n ErrorWithCapture.captureStackTrace(this, AxCloudError);\n }\n }\n\n static fromResponse(status: number, body?: unknown): AxCloudError {\n const details = typeof body === 'object' ? (body as Record<string, unknown>) : undefined;\n const message =\n (typeof details?.message === 'string' ? details.message : undefined) ||\n (typeof details?.error === 'string' ? details.error : undefined);\n\n switch (status) {\n case 401:\n return new AxCloudError(\n message || 'Authentication required',\n 'UNAUTHORIZED',\n status,\n details\n );\n case 403:\n return new AxCloudError(message || 'Access denied', 'FORBIDDEN', status, details);\n case 404:\n return new AxCloudError(message || 'Resource not found', 'NOT_FOUND', status, details);\n case 422:\n return new AxCloudError(\n message || 'Validation failed',\n 'VALIDATION_ERROR',\n status,\n details\n );\n default:\n if (status >= 500) {\n return new AxCloudError(message || 'Server error', 'SERVER_ERROR', status, details);\n }\n return new AxCloudError(message || 'An error occurred', 'UNKNOWN_ERROR', status, details);\n }\n }\n\n static networkError(originalError?: Error): AxCloudError {\n // Don't include original error details in production to avoid leaking sensitive info\n // Use typeof check to avoid issues in environments where process is not defined\n const isDev = typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';\n const message =\n isDev && originalError?.message ? originalError.message : 'Network request failed';\n\n return new AxCloudError(\n message,\n 'NETWORK_ERROR',\n 0,\n isDev ? { originalError: originalError?.message } : undefined\n );\n }\n\n static timeoutError(timeoutMs: number): AxCloudError {\n return new AxCloudError(`Request timed out after ${timeoutMs}ms`, 'TIMEOUT_ERROR', 0, {\n timeout: timeoutMs,\n });\n }\n}\n\nexport function isAxCloudError(error: unknown): error is AxCloudError {\n return error instanceof AxCloudError;\n}\n","/**\n * AxCloud API Client\n *\n * Fetch wrapper with authentication header injection and error handling.\n */\n\nimport { AxCloudError } from './errors'\n\nexport interface ClientConfig {\n baseUrl: string\n getAccessToken?: () => Promise<string | undefined>\n /** API key for public content endpoints */\n apiKey?: string\n /** Default request timeout in milliseconds (default: 30000) */\n timeout?: number\n}\n\nexport interface RequestOptions extends Omit<RequestInit, 'body'> {\n body?: unknown\n params?: Record<string, string | number | boolean | undefined>\n /** Request timeout in milliseconds (overrides client default) */\n timeout?: number\n}\n\nexport class AxCloudClient {\n private baseUrl: string\n private getAccessToken?: () => Promise<string | undefined>\n private apiKey?: string\n private defaultTimeout: number\n\n constructor(config: ClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/$/, '')\n this.getAccessToken = config.getAccessToken\n this.apiKey = config.apiKey\n this.defaultTimeout = config.timeout ?? 30000\n }\n\n /**\n * Update the access token getter (used when auth state changes)\n */\n setAccessTokenGetter(getter: () => Promise<string | undefined>) {\n this.getAccessToken = getter\n }\n\n /**\n * Build URL with query parameters\n */\n private buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {\n const url = new URL(`${this.baseUrl}${path}`)\n\n if (params) {\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined) {\n url.searchParams.append(key, String(value))\n }\n })\n }\n\n return url.toString()\n }\n\n /**\n * API key should only be sent to public endpoints.\n * This avoids leaking public keys to authenticated/internal routes.\n */\n private shouldAttachApiKey(path: string): boolean {\n const normalized = path.startsWith('/') ? path : `/${path}`\n return (\n normalized.startsWith('/public/') ||\n normalized.startsWith('/api/public/') ||\n normalized.startsWith('/content/public/') ||\n normalized.startsWith('/media/public/') ||\n normalized.startsWith('/documents/public/') ||\n normalized.startsWith('/barnsport/public/') ||\n normalized.startsWith('/api/barnsport/public/')\n )\n }\n\n /**\n * Make an authenticated request\n */\n async request<T>(path: string, options: RequestOptions = {}): Promise<T> {\n const { body, params, headers: customHeaders, timeout, ...restOptions } = options\n\n // Initialize headers as Record<string, string> to avoid type casting\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n }\n\n // Merge custom headers\n if (customHeaders) {\n const customHeadersRecord = customHeaders as Record<string, string>\n Object.assign(headers, customHeadersRecord)\n }\n\n // Add API key header only for public endpoints\n if (this.apiKey && this.shouldAttachApiKey(path)) {\n headers['x-api-key'] = this.apiKey\n }\n\n // Add auth header if we have a token getter\n if (this.getAccessToken) {\n try {\n const token = await this.getAccessToken()\n if (token) {\n headers['Authorization'] = `Bearer ${token}`\n }\n } catch (error) {\n // Log in development to help with debugging auth issues\n // Use typeof check to avoid issues in environments where process is not defined\n if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development') {\n console.warn(\n '[AxCloud SDK] Failed to fetch access token:',\n error instanceof Error ? error.message : error\n )\n }\n // Don't throw - allow request to continue (backend will return 401 if needed)\n }\n }\n\n const url = this.buildUrl(path, params)\n\n // Setup AbortController for timeout\n const controller = new AbortController()\n const requestTimeout = timeout ?? this.defaultTimeout\n const timeoutId = setTimeout(() => controller.abort(), requestTimeout)\n\n try {\n const response = await fetch(url, {\n ...restOptions,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n })\n\n // Handle non-JSON responses\n const contentType = response.headers.get('content-type')\n const isJson = contentType?.includes('application/json')\n\n if (!response.ok) {\n const errorBody = isJson ? await response.json().catch(() => null) : null\n throw AxCloudError.fromResponse(response.status, errorBody)\n }\n\n // Return empty object for 204 No Content\n if (response.status === 204) {\n return {} as T\n }\n\n return isJson ? await response.json() : ({} as T)\n } catch (error) {\n if (error instanceof AxCloudError) {\n throw error\n }\n // Handle abort/timeout errors\n if (error instanceof Error && error.name === 'AbortError') {\n throw AxCloudError.timeoutError(requestTimeout)\n }\n throw AxCloudError.networkError(error instanceof Error ? error : undefined)\n } finally {\n clearTimeout(timeoutId)\n }\n }\n\n /**\n * GET request\n */\n get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T> {\n return this.request<T>(path, { method: 'GET', params })\n }\n\n /**\n * POST request\n */\n post<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: 'POST', body })\n }\n\n /**\n * PUT request\n */\n put<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: 'PUT', body })\n }\n\n /**\n * PATCH request\n */\n patch<T>(path: string, body?: unknown): Promise<T> {\n return this.request<T>(path, { method: 'PATCH', body })\n }\n\n /**\n * DELETE request\n */\n delete<T>(path: string): Promise<T> {\n return this.request<T>(path, { method: 'DELETE' })\n }\n}\n\n// Client instance registry - allows multiple providers without SSR issues\n// Uses WeakMap to prevent memory leaks when providers unmount\nconst clientRegistry = new WeakMap<object, AxCloudClient>()\n\n/**\n * Create a client instance associated with a key (typically the provider instance)\n * This allows multiple AxCloudProviders to coexist without conflicts\n */\nexport function createClient(config: ClientConfig, key?: object): AxCloudClient {\n const client = new AxCloudClient(config)\n if (key) {\n clientRegistry.set(key, client)\n }\n return client\n}\n\n/**\n * Get a client instance by key\n * @deprecated Use the client from useAxCloudContext() instead\n */\nexport function getClient(key?: object): AxCloudClient {\n if (key) {\n const client = clientRegistry.get(key)\n if (client) {\n return client\n }\n }\n throw new Error('AxCloud client not found. Make sure AxCloudProvider is mounted and use useAxCloudContext() to get the client.')\n}\n","export type AnalyticsEventValue = string | number | boolean;\nexport type AnalyticsEventData = Record<string, AnalyticsEventValue>;\n\nexport interface AxCloudAnalyticsOptions {\n /** Site key configured in AxCloud, for example \"public-web\". */\n siteKey: string;\n /** Analytics is opt-in and disabled unless this is true. */\n enabled?: boolean;\n /** Allow local collection for explicit development tests. */\n trackLocalhost?: boolean;\n /** Override path normalization. Return null to skip a pageview. */\n normalizePath?: (pathname: string) => string | null;\n}\n\nexport interface AnalyticsPublicConfig {\n enabled: boolean;\n provider?: 'umami';\n websiteId?: string;\n scriptUrl?: string;\n hostUrl?: string;\n domains?: string[];\n autoTrack?: boolean;\n respectDoNotTrack?: boolean;\n excludeSearch?: boolean;\n excludeHash?: boolean;\n allowedEvents?: string[];\n}\n\nexport interface AnalyticsRuntime {\n enabled: boolean;\n ready: boolean;\n track: (eventName: string, data?: AnalyticsEventData) => boolean;\n trackPageView: (pathname?: string) => boolean;\n}\n\ninterface UmamiWindow extends Window {\n umami?: {\n track: (\n event?: string | { url?: string; title?: string },\n data?: AnalyticsEventData\n ) => unknown;\n };\n}\n\nconst EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]{1,63}$/;\nconst PROPERTY_KEY_PATTERN = /^[a-z][a-z0-9_]{0,47}$/;\nconst SENSITIVE_PROPERTY_PATTERN =\n /(^|_)(auth0|email|name|password|query|search|secret|token|trace|user|userid)($|_)/;\nconst EMAIL_VALUE_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst OPAQUE_SEGMENT_PATTERNS = [\n /^[0-9a-f]{8}-[0-9a-f-]{27,}$/i,\n /^(org|user|section|document|content|poll|invitation|invite|trace|chan)[_-][a-z0-9_-]+$/i,\n /^[a-f0-9]{20,}$/i,\n /^[a-z0-9_-]{32,}$/i,\n];\n\nconst scriptLoads = new Map<string, Promise<void>>();\n\nexport function isLocalAnalyticsHostname(hostname: string): boolean {\n return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';\n}\n\nexport function sanitizeAnalyticsPath(\n pathname: string,\n customNormalizer?: (pathname: string) => string | null\n): string | null {\n const rawPath = pathname.split(/[?#]/, 1)[0] || '/';\n const normalizedInput = rawPath.startsWith('/') ? rawPath : `/${rawPath}`;\n const custom = customNormalizer?.(normalizedInput);\n if (custom === null) return null;\n const path = custom ?? normalizedInput;\n const cleanPath = path.split(/[?#]/, 1)[0] || '/';\n\n const segments = cleanPath.split('/').map((segment) => {\n if (!segment) return segment;\n let decoded = segment;\n try {\n decoded = decodeURIComponent(segment);\n } catch {\n // Keep malformed path segments encoded and classify them below.\n }\n return OPAQUE_SEGMENT_PATTERNS.some((pattern) => pattern.test(decoded)) ? ':id' : segment;\n });\n\n return segments.join('/') || '/';\n}\n\nexport function sanitizeAnalyticsEventData(\n data: AnalyticsEventData | undefined\n): AnalyticsEventData | undefined {\n if (!data) return undefined;\n const sanitized: AnalyticsEventData = {};\n\n for (const [rawKey, rawValue] of Object.entries(data).slice(0, 20)) {\n const key = rawKey.trim().toLowerCase();\n if (!PROPERTY_KEY_PATTERN.test(key) || SENSITIVE_PROPERTY_PATTERN.test(key)) continue;\n\n if (typeof rawValue === 'string') {\n const value = rawValue.trim();\n if (!value || value.length > 100 || EMAIL_VALUE_PATTERN.test(value)) continue;\n sanitized[key] = value;\n continue;\n }\n if (typeof rawValue === 'number' && Number.isFinite(rawValue)) {\n sanitized[key] = rawValue;\n continue;\n }\n if (typeof rawValue === 'boolean') sanitized[key] = rawValue;\n }\n\n return Object.keys(sanitized).length > 0 ? sanitized : undefined;\n}\n\nexport function isAllowedAnalyticsEvent(\n eventName: string,\n allowedEvents: string[] | undefined\n): boolean {\n return EVENT_NAME_PATTERN.test(eventName) && Boolean(allowedEvents?.includes(eventName));\n}\n\nexport async function fetchAnalyticsPublicConfig(input: {\n apiUrl: string;\n orgId: string;\n siteKey: string;\n stage: string;\n hostname: string;\n signal?: AbortSignal;\n}): Promise<AnalyticsPublicConfig> {\n const baseUrl = input.apiUrl.replace(/\\/$/, '');\n const url = new URL(`${baseUrl}/analytics/public/config`);\n url.searchParams.set('orgId', input.orgId);\n url.searchParams.set('siteKey', input.siteKey);\n url.searchParams.set('stage', input.stage);\n url.searchParams.set('hostname', input.hostname);\n\n const response = await fetch(url, {\n method: 'GET',\n headers: { Accept: 'application/json' },\n signal: input.signal,\n });\n if (!response.ok) throw new Error(`Analytics configuration returned ${response.status}`);\n return response.json() as Promise<AnalyticsPublicConfig>;\n}\n\nexport function loadAnalyticsScript(\n config: AnalyticsPublicConfig,\n doc: Document = document\n): Promise<void> {\n if (!config.enabled || !config.websiteId || !config.scriptUrl) {\n return Promise.reject(new Error('Analytics tracker configuration is incomplete'));\n }\n\n const key = `${config.scriptUrl}|${config.websiteId}`;\n const existingPromise = scriptLoads.get(key);\n if (existingPromise) return existingPromise;\n\n const existing = doc.querySelector<HTMLScriptElement>(\n `script[data-axcloud-analytics-site=\"${config.websiteId}\"]`\n );\n if (existing && (doc.defaultView as UmamiWindow | null)?.umami) {\n return Promise.resolve();\n }\n\n const promise = new Promise<void>((resolve, reject) => {\n const script = existing || doc.createElement('script');\n const onLoad = () => resolve();\n const onError = () => reject(new Error('Analytics tracker failed to load'));\n script.addEventListener('load', onLoad, { once: true });\n script.addEventListener('error', onError, { once: true });\n\n if (!existing) {\n script.src = config.scriptUrl as string;\n script.defer = true;\n script.dataset.websiteId = config.websiteId as string;\n script.dataset.axcloudAnalyticsSite = config.websiteId as string;\n script.dataset.autoTrack = String(config.autoTrack === true);\n if (config.hostUrl) script.dataset.hostUrl = config.hostUrl;\n if (config.domains?.length) script.dataset.domains = config.domains.join(',');\n if (config.respectDoNotTrack !== false) script.dataset.doNotTrack = 'true';\n if (config.excludeSearch !== false) script.dataset.excludeSearch = 'true';\n if (config.excludeHash !== false) script.dataset.excludeHash = 'true';\n doc.head.appendChild(script);\n }\n }).catch((error) => {\n scriptLoads.delete(key);\n throw error;\n });\n\n scriptLoads.set(key, promise);\n return promise;\n}\n\nexport function sendAnalyticsPageView(\n pathname: string,\n options: AxCloudAnalyticsOptions,\n targetWindow: Window = window\n): boolean {\n const path = sanitizeAnalyticsPath(pathname, options.normalizePath);\n const umami = (targetWindow as UmamiWindow).umami;\n if (!path || !umami) return false;\n umami.track({ url: path, title: targetWindow.document.title });\n return true;\n}\n\nexport function sendAnalyticsEvent(\n eventName: string,\n data: AnalyticsEventData | undefined,\n allowedEvents: string[] | undefined,\n targetWindow: Window = window\n): boolean {\n const umami = (targetWindow as UmamiWindow).umami;\n if (!umami || !isAllowedAnalyticsEvent(eventName, allowedEvents)) return false;\n umami.track(eventName, sanitizeAnalyticsEventData(data));\n return true;\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { AxCloudConfig } from '../core/types';\nimport { useAxCloudContext } from './context';\nimport {\n fetchAnalyticsPublicConfig,\n isLocalAnalyticsHostname,\n loadAnalyticsScript,\n sendAnalyticsEvent,\n sendAnalyticsPageView,\n type AnalyticsEventData,\n type AnalyticsPublicConfig,\n type AnalyticsRuntime,\n} from '../core/analytics';\n\nconst NAVIGATION_EVENT = 'axcloud-sdk:navigation';\nlet historySubscriberCount = 0;\nlet originalPushState: History['pushState'] | null = null;\nlet originalReplaceState: History['replaceState'] | null = null;\n\nexport type AnalyticsRuntimeConfig = Pick<\n AxCloudConfig,\n 'analytics' | 'apiUrl' | 'orgId' | 'stage'\n>;\n\nfunction subscribeToNavigation(callback: () => void): () => void {\n if (typeof window === 'undefined') return () => undefined;\n\n if (historySubscriberCount === 0) {\n originalPushState = window.history.pushState.bind(window.history);\n originalReplaceState = window.history.replaceState.bind(window.history);\n window.history.pushState = ((...args: Parameters<History['pushState']>) => {\n originalPushState?.(...args);\n window.dispatchEvent(new Event(NAVIGATION_EVENT));\n }) as History['pushState'];\n window.history.replaceState = ((...args: Parameters<History['replaceState']>) => {\n originalReplaceState?.(...args);\n window.dispatchEvent(new Event(NAVIGATION_EVENT));\n }) as History['replaceState'];\n }\n historySubscriberCount += 1;\n window.addEventListener('popstate', callback);\n window.addEventListener(NAVIGATION_EVENT, callback);\n\n return () => {\n window.removeEventListener('popstate', callback);\n window.removeEventListener(NAVIGATION_EVENT, callback);\n historySubscriberCount = Math.max(0, historySubscriberCount - 1);\n if (historySubscriberCount === 0) {\n if (originalPushState) window.history.pushState = originalPushState;\n if (originalReplaceState) window.history.replaceState = originalReplaceState;\n originalPushState = null;\n originalReplaceState = null;\n }\n };\n}\n\nfunction doNotTrackEnabled(config: AnalyticsPublicConfig): boolean {\n if (config.respectDoNotTrack === false || typeof navigator === 'undefined') return false;\n return navigator.doNotTrack === '1';\n}\n\nexport function useAnalyticsRuntime(config: AnalyticsRuntimeConfig): AnalyticsRuntime {\n const [enabled, setEnabled] = useState(false);\n const [ready, setReady] = useState(false);\n const publicConfigRef = useRef<AnalyticsPublicConfig | null>(null);\n const optionsRef = useRef(config.analytics);\n optionsRef.current = config.analytics;\n\n const trackPageView = useCallback(\n (pathname?: string) => {\n if (!ready || !optionsRef.current || typeof window === 'undefined') return false;\n return sendAnalyticsPageView(pathname || window.location.pathname, optionsRef.current);\n },\n [ready]\n );\n\n const track = useCallback(\n (eventName: string, data?: AnalyticsEventData) => {\n if (!ready || typeof window === 'undefined') return false;\n return sendAnalyticsEvent(eventName, data, publicConfigRef.current?.allowedEvents);\n },\n [ready]\n );\n\n useEffect(() => {\n const options = config.analytics;\n setEnabled(false);\n setReady(false);\n publicConfigRef.current = null;\n\n if (!options?.enabled || !options.siteKey || typeof window === 'undefined') return undefined;\n if (isLocalAnalyticsHostname(window.location.hostname) && !options.trackLocalhost)\n return undefined;\n\n const controller = new AbortController();\n let cancelled = false;\n let unsubscribe: () => void = () => undefined;\n\n const initialize = async () => {\n try {\n const publicConfig = await fetchAnalyticsPublicConfig({\n apiUrl: config.apiUrl,\n orgId: config.orgId,\n siteKey: options.siteKey,\n stage: config.stage,\n hostname: window.location.hostname,\n signal: controller.signal,\n });\n if (cancelled || !publicConfig.enabled || doNotTrackEnabled(publicConfig)) return;\n\n publicConfigRef.current = publicConfig;\n setEnabled(true);\n await loadAnalyticsScript(publicConfig);\n if (cancelled) return;\n setReady(true);\n\n if (!publicConfig.autoTrack) {\n const trackCurrentPage = () => {\n sendAnalyticsPageView(window.location.pathname, options);\n };\n trackCurrentPage();\n unsubscribe = subscribeToNavigation(trackCurrentPage);\n }\n } catch (error) {\n if (!cancelled && !(error instanceof Error && error.name === 'AbortError')) {\n setEnabled(false);\n setReady(false);\n }\n }\n };\n\n void initialize();\n return () => {\n cancelled = true;\n controller.abort();\n unsubscribe();\n };\n }, [\n config.analytics?.enabled,\n config.analytics?.siteKey,\n config.analytics?.trackLocalhost,\n config.analytics?.normalizePath,\n config.apiUrl,\n config.orgId,\n config.stage,\n ]);\n\n return useMemo(\n () => ({ enabled, ready, track, trackPageView }),\n [enabled, ready, track, trackPageView]\n );\n}\n\nexport function useAnalytics(): AnalyticsRuntime {\n return useAxCloudContext().analytics;\n}\n"]}
|