@10x-media/analytics 0.1.0-beta.4 → 1.0.0-beta.10
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/CHANGELOG.md +280 -0
- package/LICENSE +21 -21
- package/README.md +15 -4
- package/dist/adapters/ga4/disableKey.d.ts +9 -0
- package/dist/adapters/ga4/disableKey.js +21 -0
- package/dist/adapters/ga4/disableKey.js.map +1 -0
- package/dist/adapters/ga4/eventName.d.ts +15 -0
- package/dist/adapters/ga4/eventName.js +19 -0
- package/dist/adapters/ga4/eventName.js.map +1 -0
- package/dist/adapters/ga4/ga4.d.ts +5 -0
- package/dist/adapters/ga4/ga4.js +186 -58
- package/dist/adapters/ga4/ga4.js.map +1 -1
- package/dist/adapters/ga4/measurementId.js +15 -0
- package/dist/adapters/ga4/measurementId.js.map +1 -0
- package/dist/adapters/goalRead.js +126 -0
- package/dist/adapters/goalRead.js.map +1 -0
- package/dist/adapters/http/fetchJson.js +1 -1
- package/dist/adapters/plausible/plausible.d.ts +25 -0
- package/dist/adapters/plausible/plausible.js +159 -38
- package/dist/adapters/plausible/plausible.js.map +1 -1
- package/dist/adapters/posthog/posthog.d.ts +10 -1
- package/dist/adapters/posthog/posthog.js +130 -21
- package/dist/adapters/posthog/posthog.js.map +1 -1
- package/dist/adapters/series.js +11 -1
- package/dist/adapters/series.js.map +1 -1
- package/dist/adapters/umami/umami.d.ts +13 -1
- package/dist/adapters/umami/umami.js +278 -26
- package/dist/adapters/umami/umami.js.map +1 -1
- package/dist/binding/resolvePath.js +18 -2
- package/dist/binding/resolvePath.js.map +1 -1
- package/dist/capture/getTrackerConfig.d.ts +20 -0
- package/dist/capture/getTrackerConfig.js +31 -0
- package/dist/capture/getTrackerConfig.js.map +1 -0
- package/dist/capture/mountPath.js +14 -0
- package/dist/capture/mountPath.js.map +1 -0
- package/dist/capture/proxyEndpoint.js +127 -0
- package/dist/capture/proxyEndpoint.js.map +1 -0
- package/dist/capture/proxyRoutes.js +108 -0
- package/dist/capture/proxyRoutes.js.map +1 -0
- package/dist/capture/requestBody.js +68 -0
- package/dist/capture/requestBody.js.map +1 -0
- package/dist/capture/slots.d.ts +8 -0
- package/dist/capture/slots.js +54 -0
- package/dist/capture/slots.js.map +1 -0
- package/dist/capture/trackerConfig.d.ts +33 -0
- package/dist/capture/trackerConfig.js +95 -0
- package/dist/capture/trackerConfig.js.map +1 -0
- package/dist/capture/trackerEndpoint.js +35 -0
- package/dist/capture/trackerEndpoint.js.map +1 -0
- package/dist/charts/BarList.d.ts +16 -1
- package/dist/charts/BarList.js +41 -19
- package/dist/charts/BarList.js.map +1 -1
- package/dist/charts/TrendChart.d.ts +16 -3
- package/dist/charts/TrendChart.js +172 -106
- package/dist/charts/TrendChart.js.map +1 -1
- package/dist/charts/bars.d.ts +4 -0
- package/dist/charts/bars.js +3 -1
- package/dist/charts/bars.js.map +1 -1
- package/dist/charts/bucket.js +10 -1
- package/dist/charts/bucket.js.map +1 -1
- package/dist/charts/spline.js +2 -2
- package/dist/charts/spline.js.map +1 -1
- package/dist/charts/styles.js +18 -1
- package/dist/charts/styles.js.map +1 -1
- package/dist/core/cacheKey.js +26 -3
- package/dist/core/cacheKey.js.map +1 -1
- package/dist/core/capabilities.d.ts +17 -2
- package/dist/core/capabilities.js +20 -1
- package/dist/core/capabilities.js.map +1 -1
- package/dist/core/capture.d.ts +49 -0
- package/dist/core/contract.d.ts +74 -5
- package/dist/core/contract.js +30 -1
- package/dist/core/contract.js.map +1 -1
- package/dist/core/granularity.js +1 -1
- package/dist/core/options.d.ts +168 -8
- package/dist/core/options.js +132 -4
- package/dist/core/options.js.map +1 -1
- package/dist/core/registry.d.ts +1 -0
- package/dist/core/scopeList.js +32 -0
- package/dist/core/scopeList.js.map +1 -0
- package/dist/core/scopedRead.js +101 -29
- package/dist/core/scopedRead.js.map +1 -1
- package/dist/core/serverEvent.d.ts +60 -0
- package/dist/core/serverEvent.js +12 -0
- package/dist/core/serverEvent.js.map +1 -0
- package/dist/exports/adapters/ga4.d.ts +2 -1
- package/dist/exports/adapters/ga4.js +2 -1
- package/dist/exports/adapters/native.d.ts +3 -1
- package/dist/exports/adapters/native.js +2 -1
- package/dist/exports/client.d.ts +16 -2
- package/dist/exports/client.js +13 -1
- package/dist/exports/geo.d.ts +2 -2
- package/dist/exports/next.d.ts +2 -1
- package/dist/exports/next.js +2 -1
- package/dist/exports/react.d.ts +4 -0
- package/dist/exports/react.js +5 -0
- package/dist/exports/rsc.d.ts +12 -4
- package/dist/exports/rsc.js +7 -2
- package/dist/exports/tracker.d.ts +21 -0
- package/dist/exports/tracker.js +15 -0
- package/dist/exports/types.d.ts +17 -3
- package/dist/exports/types.js +4 -2
- package/dist/fields/AnalyticsPanelClient.js +2 -2
- package/dist/fields/AnalyticsPanelField.js +1 -1
- package/dist/fields/AnalyticsStatField.js +2 -2
- package/dist/fields/config/FilterDimensionSelectField.d.ts +14 -0
- package/dist/fields/config/FilterDimensionSelectField.js +77 -0
- package/dist/fields/config/FilterDimensionSelectField.js.map +1 -0
- package/dist/fields/config/FilterOperatorSelectField.d.ts +14 -0
- package/dist/fields/config/FilterOperatorSelectField.js +75 -0
- package/dist/fields/config/FilterOperatorSelectField.js.map +1 -0
- package/dist/fields/config/MetricSelectField.d.ts +23 -0
- package/dist/fields/config/MetricSelectField.js +51 -0
- package/dist/fields/config/MetricSelectField.js.map +1 -0
- package/dist/fields/config/SourceSelectField.d.ts +14 -0
- package/dist/fields/config/SourceSelectField.js +46 -0
- package/dist/fields/config/SourceSelectField.js.map +1 -0
- package/dist/fields/config/fetchSources.d.ts +16 -0
- package/dist/fields/config/fetchSources.js +33 -0
- package/dist/fields/config/fetchSources.js.map +1 -0
- package/dist/fields/config/narrow.js +32 -0
- package/dist/fields/config/narrow.js.map +1 -0
- package/dist/fields/config/sourcesState.js +27 -0
- package/dist/fields/config/sourcesState.js.map +1 -0
- package/dist/fields/config/toSelectOption.js +27 -0
- package/dist/fields/config/toSelectOption.js.map +1 -0
- package/dist/fields/config/useAnalyticsSources.d.ts +24 -0
- package/dist/fields/config/useAnalyticsSources.js +62 -0
- package/dist/fields/config/useAnalyticsSources.js.map +1 -0
- package/dist/fields/config/useFilterCapabilities.d.ts +28 -0
- package/dist/fields/config/useFilterCapabilities.js +52 -0
- package/dist/fields/config/useFilterCapabilities.js.map +1 -0
- package/dist/fields/readForDocument.d.ts +5 -0
- package/dist/fields/readForDocument.js +22 -10
- package/dist/fields/readForDocument.js.map +1 -1
- package/dist/goals/GoalSelectField.d.ts +7 -0
- package/dist/goals/GoalSelectField.js +77 -0
- package/dist/goals/GoalSelectField.js.map +1 -0
- package/dist/goals/collection.js +254 -0
- package/dist/goals/collection.js.map +1 -0
- package/dist/goals/currency.js +14 -0
- package/dist/goals/currency.js.map +1 -0
- package/dist/goals/fetchGoals.d.ts +18 -0
- package/dist/goals/fetchGoals.js +33 -0
- package/dist/goals/fetchGoals.js.map +1 -0
- package/dist/goals/goalField.d.ts +31 -0
- package/dist/goals/goalField.js +56 -0
- package/dist/goals/goalField.js.map +1 -0
- package/dist/goals/goalsEndpoint.d.ts +1 -0
- package/dist/goals/goalsEndpoint.js +58 -0
- package/dist/goals/goalsEndpoint.js.map +1 -0
- package/dist/goals/match.js +64 -0
- package/dist/goals/match.js.map +1 -0
- package/dist/goals/resolver.d.ts +8 -0
- package/dist/goals/resolver.js +147 -0
- package/dist/goals/resolver.js.map +1 -0
- package/dist/goals/trackGoalAction.d.ts +76 -0
- package/dist/goals/trackGoalAction.js +158 -0
- package/dist/goals/trackGoalAction.js.map +1 -0
- package/dist/goals/types.d.ts +33 -0
- package/dist/goals/types.js +7 -0
- package/dist/goals/types.js.map +1 -0
- package/dist/goals/useAnalyticsGoals.d.ts +20 -0
- package/dist/goals/useAnalyticsGoals.js +67 -0
- package/dist/goals/useAnalyticsGoals.js.map +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.js +185 -19
- package/dist/index.js.map +1 -1
- package/dist/native/collections/events.js +65 -1
- package/dist/native/collections/events.js.map +1 -1
- package/dist/native/collections/rollups.js +39 -3
- package/dist/native/collections/rollups.js.map +1 -1
- package/dist/native/eventScan.js +25 -0
- package/dist/native/eventScan.js.map +1 -0
- package/dist/native/geo/composeGeoResolvers.js +2 -2
- package/dist/native/geo/composeGeoResolvers.js.map +1 -1
- package/dist/native/geo/geoResolver.d.ts +9 -2
- package/dist/native/geo/geoResolver.js.map +1 -1
- package/dist/native/geo/maxmindResolver.js +3 -5
- package/dist/native/geo/maxmindResolver.js.map +1 -1
- package/dist/native/ingest/bots.d.ts +11 -0
- package/dist/native/ingest/bots.js +71 -0
- package/dist/native/ingest/bots.js.map +1 -0
- package/dist/native/ingest/browser.js +47 -0
- package/dist/native/ingest/browser.js.map +1 -0
- package/dist/native/ingest/clientIp.js +20 -0
- package/dist/native/ingest/clientIp.js.map +1 -0
- package/dist/native/ingest/device.js +11 -3
- package/dist/native/ingest/device.js.map +1 -1
- package/dist/native/ingest/endpoint.d.ts +1 -0
- package/dist/native/ingest/endpoint.js +107 -21
- package/dist/native/ingest/endpoint.js.map +1 -1
- package/dist/native/ingest/flushBatch.js +29 -38
- package/dist/native/ingest/flushBatch.js.map +1 -1
- package/dist/native/ingest/language.js +14 -0
- package/dist/native/ingest/language.js.map +1 -0
- package/dist/native/ingest/normalizeEvent.d.ts +30 -0
- package/dist/native/ingest/normalizeEvent.js +115 -16
- package/dist/native/ingest/normalizeEvent.js.map +1 -1
- package/dist/native/ingest/referrer.js +48 -0
- package/dist/native/ingest/referrer.js.map +1 -0
- package/dist/native/ingest/requestHost.js +57 -0
- package/dist/native/ingest/requestHost.js.map +1 -0
- package/dist/native/ingest/resolveHostname.d.ts +29 -0
- package/dist/native/ingest/resolveHostname.js +52 -0
- package/dist/native/ingest/resolveHostname.js.map +1 -0
- package/dist/native/ingest/salt.js +27 -2
- package/dist/native/ingest/salt.js.map +1 -1
- package/dist/native/ingest/serverTrack.d.ts +20 -0
- package/dist/native/ingest/serverTrack.js +109 -0
- package/dist/native/ingest/serverTrack.js.map +1 -0
- package/dist/native/ingest/source.d.ts +11 -0
- package/dist/native/ingest/source.js +264 -16
- package/dist/native/ingest/source.js.map +1 -1
- package/dist/native/ingest/utm.js +33 -0
- package/dist/native/ingest/utm.js.map +1 -0
- package/dist/native/ingest/validate.js +26 -0
- package/dist/native/ingest/validate.js.map +1 -0
- package/dist/native/nativeAdapter.d.ts +37 -1
- package/dist/native/nativeAdapter.js +175 -22
- package/dist/native/nativeAdapter.js.map +1 -1
- package/dist/native/query/eventAgg.js +175 -0
- package/dist/native/query/eventAgg.js.map +1 -0
- package/dist/native/retention/pruneTask.js +53 -13
- package/dist/native/retention/pruneTask.js.map +1 -1
- package/dist/native/rollupAcc.js +12 -1
- package/dist/native/rollupAcc.js.map +1 -1
- package/dist/native/rollups/bucketKey.js +15 -0
- package/dist/native/rollups/bucketKey.js.map +1 -0
- package/dist/native/rollups/bumpRollups.js +116 -0
- package/dist/native/rollups/bumpRollups.js.map +1 -0
- package/dist/native/rollups/deltas.js +86 -11
- package/dist/native/rollups/deltas.js.map +1 -1
- package/dist/native/rollups/insertManyIfNew.js +93 -0
- package/dist/native/rollups/insertManyIfNew.js.map +1 -0
- package/dist/next/captureRewrites.d.ts +42 -0
- package/dist/next/captureRewrites.js +57 -0
- package/dist/next/captureRewrites.js.map +1 -0
- package/dist/next/posthogProxyRewrites.d.ts +5 -0
- package/dist/next/posthogProxyRewrites.js +16 -21
- package/dist/next/posthogProxyRewrites.js.map +1 -1
- package/dist/plugin/documentEndpoint.js +71 -24
- package/dist/plugin/documentEndpoint.js.map +1 -1
- package/dist/plugin/errors.d.ts +31 -0
- package/dist/plugin/errors.js +79 -0
- package/dist/plugin/errors.js.map +1 -0
- package/dist/plugin/goalHint.d.ts +1 -0
- package/dist/plugin/goalHint.js +24 -0
- package/dist/plugin/goalHint.js.map +1 -0
- package/dist/plugin/paths.js +19 -1
- package/dist/plugin/paths.js.map +1 -1
- package/dist/plugin/queryEndpoint.js +124 -0
- package/dist/plugin/queryEndpoint.js.map +1 -0
- package/dist/plugin/readContextForRequest.js +73 -0
- package/dist/plugin/readContextForRequest.js.map +1 -0
- package/dist/plugin/realtimeEndpoint.js +39 -18
- package/dist/plugin/realtimeEndpoint.js.map +1 -1
- package/dist/plugin/refreshEndpoint.js +113 -0
- package/dist/plugin/refreshEndpoint.js.map +1 -0
- package/dist/plugin/runtime.d.ts +1 -0
- package/dist/plugin/runtime.js +33 -1
- package/dist/plugin/runtime.js.map +1 -1
- package/dist/plugin/scopeChange.js +22 -0
- package/dist/plugin/scopeChange.js.map +1 -0
- package/dist/plugin/scopeFieldBoot.js +22 -0
- package/dist/plugin/scopeFieldBoot.js.map +1 -0
- package/dist/plugin/sourcesEndpoint.js +28 -0
- package/dist/plugin/sourcesEndpoint.js.map +1 -0
- package/dist/plugin/warmTask.js +0 -0
- package/dist/plugin/warmTask.js.map +1 -1
- package/dist/providers/access.js +2 -1
- package/dist/providers/access.js.map +1 -1
- package/dist/providers/collection.js +90 -29
- package/dist/providers/collection.js.map +1 -1
- package/dist/providers/factory.js +11 -3
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/resolver.js.map +1 -1
- package/dist/query/dates.js +64 -0
- package/dist/query/dates.js.map +1 -0
- package/dist/query/errors.d.ts +14 -0
- package/dist/query/fetchQuery.d.ts +79 -0
- package/dist/query/fetchQuery.js +117 -0
- package/dist/query/fetchQuery.js.map +1 -0
- package/dist/query/parse.d.ts +22 -0
- package/dist/query/parse.js +168 -0
- package/dist/query/parse.js.map +1 -0
- package/dist/query/response.d.ts +39 -0
- package/dist/query/response.js +11 -0
- package/dist/query/response.js.map +1 -0
- package/dist/react/AnalyticsProvider.d.ts +50 -0
- package/dist/react/AnalyticsProvider.js +67 -0
- package/dist/react/AnalyticsProvider.js.map +1 -0
- package/dist/react/TrackerBoot.d.ts +22 -0
- package/dist/react/TrackerBoot.js +30 -0
- package/dist/react/TrackerBoot.js.map +1 -0
- package/dist/react/useAnalytics.d.ts +20 -0
- package/dist/react/useAnalytics.js +52 -0
- package/dist/react/useAnalytics.js.map +1 -0
- package/dist/rsc/AnalyticsScripts.d.ts +30 -0
- package/dist/rsc/AnalyticsScripts.js +41 -0
- package/dist/rsc/AnalyticsScripts.js.map +1 -0
- package/dist/surfacing/cacheStore.d.ts +1 -0
- package/dist/surfacing/cacheStore.js +18 -2
- package/dist/surfacing/cacheStore.js.map +1 -1
- package/dist/surfacing/engine.d.ts +1 -0
- package/dist/surfacing/engine.js +47 -6
- package/dist/surfacing/engine.js.map +1 -1
- package/dist/surfacing/epoch.d.ts +1 -0
- package/dist/surfacing/epoch.js +72 -0
- package/dist/surfacing/epoch.js.map +1 -0
- package/dist/surfacing/queue.js +22 -6
- package/dist/surfacing/queue.js.map +1 -1
- package/dist/surfacing/rateLimiter.js +130 -0
- package/dist/surfacing/rateLimiter.js.map +1 -0
- package/dist/surfacing/retryPolicy.js +15 -0
- package/dist/surfacing/retryPolicy.js.map +1 -0
- package/dist/sync/collection.js +23 -7
- package/dist/sync/collection.js.map +1 -1
- package/dist/sync/syncTask.js +68 -33
- package/dist/sync/syncTask.js.map +1 -1
- package/dist/testing/memoryAdapter.d.ts +2 -0
- package/dist/testing/memoryAdapter.js +17 -1
- package/dist/testing/memoryAdapter.js.map +1 -1
- package/dist/timeframe/tz.js +17 -6
- package/dist/timeframe/tz.js.map +1 -1
- package/dist/tracker/autoCapture.d.ts +48 -0
- package/dist/tracker/autoCapture.js +129 -0
- package/dist/tracker/autoCapture.js.map +1 -0
- package/dist/tracker/consent.d.ts +24 -0
- package/dist/tracker/consent.js +48 -0
- package/dist/tracker/consent.js.map +1 -0
- package/dist/tracker/createTracker.d.ts +18 -0
- package/dist/tracker/createTracker.js +215 -0
- package/dist/tracker/createTracker.js.map +1 -0
- package/dist/tracker/exclusion.d.ts +28 -0
- package/dist/tracker/exclusion.js +50 -0
- package/dist/tracker/exclusion.js.map +1 -0
- package/dist/tracker/initTracker.d.ts +22 -0
- package/dist/tracker/initTracker.js +33 -0
- package/dist/tracker/initTracker.js.map +1 -0
- package/dist/tracker/loadScript.d.ts +14 -0
- package/dist/tracker/loadScript.js +41 -0
- package/dist/tracker/loadScript.js.map +1 -0
- package/dist/tracker/pageTracking.d.ts +17 -0
- package/dist/tracker/pageTracking.js +38 -0
- package/dist/tracker/pageTracking.js.map +1 -0
- package/dist/tracker/registry.d.ts +27 -0
- package/dist/tracker/registry.js +73 -0
- package/dist/tracker/registry.js.map +1 -0
- package/dist/tracker/sinks/ga4.d.ts +29 -0
- package/dist/tracker/sinks/ga4.js +30 -0
- package/dist/tracker/sinks/ga4.js.map +1 -0
- package/dist/tracker/sinks/native.d.ts +22 -0
- package/dist/tracker/sinks/native.js +56 -0
- package/dist/tracker/sinks/native.js.map +1 -0
- package/dist/tracker/sinks/plausible.d.ts +20 -0
- package/dist/tracker/sinks/plausible.js +32 -0
- package/dist/tracker/sinks/plausible.js.map +1 -0
- package/dist/tracker/sinks/posthog.d.ts +18 -0
- package/dist/tracker/sinks/posthog.js +30 -0
- package/dist/tracker/sinks/posthog.js.map +1 -0
- package/dist/tracker/sinks/umami.d.ts +18 -0
- package/dist/tracker/sinks/umami.js +23 -0
- package/dist/tracker/sinks/umami.js.map +1 -0
- package/dist/tracker/sinks/vendor.d.ts +14 -0
- package/dist/tracker/sinks/vendor.js +81 -0
- package/dist/tracker/sinks/vendor.js.map +1 -0
- package/dist/tracker/transport.js +28 -0
- package/dist/tracker/transport.js.map +1 -0
- package/dist/tracker/types.d.ts +91 -0
- package/dist/translations/ar.js +221 -0
- package/dist/translations/ar.js.map +1 -0
- package/dist/translations/de.js +145 -1
- package/dist/translations/de.js.map +1 -1
- package/dist/translations/en.js +145 -1
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/es.js +221 -0
- package/dist/translations/es.js.map +1 -0
- package/dist/translations/fr.js +221 -0
- package/dist/translations/fr.js.map +1 -0
- package/dist/translations/id.js +221 -0
- package/dist/translations/id.js.map +1 -0
- package/dist/translations/index.d.ts +10 -1
- package/dist/translations/index.js +19 -1
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/keys.d.ts +144 -0
- package/dist/translations/keys.js +145 -1
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/ko.js +221 -0
- package/dist/translations/ko.js.map +1 -0
- package/dist/translations/metricKeys.js +8 -2
- package/dist/translations/metricKeys.js.map +1 -1
- package/dist/translations/pt.js +221 -0
- package/dist/translations/pt.js.map +1 -0
- package/dist/translations/ru.js +221 -0
- package/dist/translations/ru.js.map +1 -0
- package/dist/translations/server.js.map +1 -1
- package/dist/translations/uk.js +221 -0
- package/dist/translations/uk.js.map +1 -0
- package/dist/translations/zh.js +221 -0
- package/dist/translations/zh.js.map +1 -0
- package/dist/view/AnalyticsNavLink.d.ts +19 -0
- package/dist/view/AnalyticsNavLink.js +40 -0
- package/dist/view/AnalyticsNavLink.js.map +1 -0
- package/dist/view/AnalyticsView.d.ts +23 -0
- package/dist/view/AnalyticsView.js +45 -0
- package/dist/view/AnalyticsView.js.map +1 -0
- package/dist/view/AnalyticsViewClient.d.ts +15 -0
- package/dist/view/AnalyticsViewClient.js +244 -0
- package/dist/view/AnalyticsViewClient.js.map +1 -0
- package/dist/view/authRedirect.js +32 -0
- package/dist/view/authRedirect.js.map +1 -0
- package/dist/view/conversionRate.js +18 -0
- package/dist/view/conversionRate.js.map +1 -0
- package/dist/view/dayRange.js +68 -0
- package/dist/view/dayRange.js.map +1 -0
- package/dist/view/gating.d.ts +1 -0
- package/dist/view/gating.js +142 -0
- package/dist/view/gating.js.map +1 -0
- package/dist/view/labels.js +76 -0
- package/dist/view/labels.js.map +1 -0
- package/dist/view/registerView.js +48 -0
- package/dist/view/registerView.js.map +1 -0
- package/dist/view/sections/Breakdowns.js +198 -0
- package/dist/view/sections/Breakdowns.js.map +1 -0
- package/dist/view/sections/EmptyStates.js +92 -0
- package/dist/view/sections/EmptyStates.js.map +1 -0
- package/dist/view/sections/FilterChips.js +46 -0
- package/dist/view/sections/FilterChips.js.map +1 -0
- package/dist/view/sections/GoalsPanel.js +82 -0
- package/dist/view/sections/GoalsPanel.js.map +1 -0
- package/dist/view/sections/OverviewCards.js +65 -0
- package/dist/view/sections/OverviewCards.js.map +1 -0
- package/dist/view/sections/RealtimeStrip.js +80 -0
- package/dist/view/sections/RealtimeStrip.js.map +1 -0
- package/dist/view/sections/Toolbar.js +207 -0
- package/dist/view/sections/Toolbar.js.map +1 -0
- package/dist/view/sections/Trend.js +125 -0
- package/dist/view/sections/Trend.js.map +1 -0
- package/dist/view/sections/styles.js +76 -0
- package/dist/view/sections/styles.js.map +1 -0
- package/dist/view/state.js +211 -0
- package/dist/view/state.js.map +1 -0
- package/dist/view/useViewQueries.js +153 -0
- package/dist/view/useViewQueries.js.map +1 -0
- package/dist/view/viewProps.d.ts +40 -0
- package/dist/view/viewProps.js +90 -0
- package/dist/view/viewProps.js.map +1 -0
- package/dist/widgets/AnalyticsBreakdownWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsBreakdownWidget.js +78 -11
- package/dist/widgets/AnalyticsBreakdownWidget.js.map +1 -1
- package/dist/widgets/AnalyticsGoalsWidget.d.ts +14 -0
- package/dist/widgets/AnalyticsGoalsWidget.js +196 -0
- package/dist/widgets/AnalyticsGoalsWidget.js.map +1 -0
- package/dist/widgets/AnalyticsMetricWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsMetricWidget.js +63 -13
- package/dist/widgets/AnalyticsMetricWidget.js.map +1 -1
- package/dist/widgets/AnalyticsRealtimeWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsRealtimeWidget.js +45 -23
- package/dist/widgets/AnalyticsRealtimeWidget.js.map +1 -1
- package/dist/widgets/AnalyticsTrendWidget.d.ts +2 -1
- package/dist/widgets/AnalyticsTrendWidget.js +79 -16
- package/dist/widgets/AnalyticsTrendWidget.js.map +1 -1
- package/dist/widgets/RealtimeCounter.d.ts +4 -0
- package/dist/widgets/RealtimeCounter.js +18 -4
- package/dist/widgets/RealtimeCounter.js.map +1 -1
- package/dist/widgets/WidgetViewLink.js +17 -0
- package/dist/widgets/WidgetViewLink.js.map +1 -0
- package/dist/widgets/breakdownTypes.js +38 -0
- package/dist/widgets/breakdownTypes.js.map +1 -1
- package/dist/widgets/cardChrome.js +31 -7
- package/dist/widgets/cardChrome.js.map +1 -1
- package/dist/widgets/comparison.js +15 -1
- package/dist/widgets/comparison.js.map +1 -1
- package/dist/widgets/defaults.d.ts +6 -2
- package/dist/widgets/defaults.js +78 -23
- package/dist/widgets/defaults.js.map +1 -1
- package/dist/widgets/filterCaption.js +27 -0
- package/dist/widgets/filterCaption.js.map +1 -0
- package/dist/widgets/filterField.d.ts +19 -0
- package/dist/widgets/filterField.js +75 -0
- package/dist/widgets/filterField.js.map +1 -0
- package/dist/widgets/prepareWidgetRead.d.ts +7 -0
- package/dist/widgets/prepareWidgetRead.js +74 -0
- package/dist/widgets/prepareWidgetRead.js.map +1 -0
- package/dist/widgets/range.js +43 -12
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/readForWidget.d.ts +26 -3
- package/dist/widgets/readForWidget.js +48 -44
- package/dist/widgets/readForWidget.js.map +1 -1
- package/dist/widgets/readForWidgetBreakdown.d.ts +34 -2
- package/dist/widgets/readForWidgetBreakdown.js +53 -49
- package/dist/widgets/readForWidgetBreakdown.js.map +1 -1
- package/dist/widgets/readForWidgetGoals.d.ts +67 -0
- package/dist/widgets/readForWidgetGoals.js +140 -0
- package/dist/widgets/readForWidgetGoals.js.map +1 -0
- package/dist/widgets/readForWidgetRealtime.d.ts +8 -0
- package/dist/widgets/readForWidgetRealtime.js +23 -21
- package/dist/widgets/readForWidgetRealtime.js.map +1 -1
- package/dist/widgets/readForWidgetSeries.d.ts +26 -2
- package/dist/widgets/readForWidgetSeries.js +78 -53
- package/dist/widgets/readForWidgetSeries.js.map +1 -1
- package/dist/widgets/readMeta.js +18 -0
- package/dist/widgets/readMeta.js.map +1 -0
- package/dist/widgets/realtimePoll.js +16 -1
- package/dist/widgets/realtimePoll.js.map +1 -1
- package/dist/widgets/registerWidgets.js +76 -14
- package/dist/widgets/registerWidgets.js.map +1 -1
- package/dist/widgets/types.d.ts +15 -0
- package/dist/widgets/types.js +16 -2
- package/dist/widgets/types.js.map +1 -1
- package/dist/widgets/viewLink.d.ts +22 -0
- package/dist/widgets/viewLink.js +86 -0
- package/dist/widgets/viewLink.js.map +1 -0
- package/package.json +27 -7
- package/dist/native/rollups/applyDistinctDeltas.js +0 -9
- package/dist/native/rollups/applyDistinctDeltas.js.map +0 -1
- package/dist/native/rollups/bumpRollup.js +0 -68
- package/dist/native/rollups/bumpRollup.js.map +0 -1
- package/dist/native/rollups/insertIfNew.js +0 -19
- package/dist/native/rollups/insertIfNew.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/core/scopeList.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the scopes a cron tier (warm, sync) fans out over: the install-wide
|
|
4
|
+
* null scope first, then each tenant scope from `scopes()`, deduplicated (an
|
|
5
|
+
* empty string folds into null). A throwing or rejecting resolver degrades to
|
|
6
|
+
* the null-only pass so one tenant-enumeration bug does not block the whole run.
|
|
7
|
+
*/
|
|
8
|
+
const resolveScopeList = async (scopes, payload) => {
|
|
9
|
+
if (!scopes) return [null];
|
|
10
|
+
let raw;
|
|
11
|
+
try {
|
|
12
|
+
const result = await scopes({ payload });
|
|
13
|
+
if (!Array.isArray(result)) throw new Error("scopes() must resolve to an array of scope ids");
|
|
14
|
+
raw = result;
|
|
15
|
+
} catch (err) {
|
|
16
|
+
payload.logger.warn(`analytics: scopes() failed, falling back to the install-wide scope: ${String(err)}`);
|
|
17
|
+
return [null];
|
|
18
|
+
}
|
|
19
|
+
const out = [null];
|
|
20
|
+
const seen = new Set([null]);
|
|
21
|
+
for (const value of raw) {
|
|
22
|
+
const scope = value === "" ? null : value;
|
|
23
|
+
if (seen.has(scope)) continue;
|
|
24
|
+
seen.add(scope);
|
|
25
|
+
out.push(scope);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { resolveScopeList };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=scopeList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopeList.js","names":[],"sources":["../../src/core/scopeList.ts"],"sourcesContent":["import type { Payload } from 'payload'\nimport type { ScopesResolver } from './options'\n\n/**\n * Resolves the scopes a cron tier (warm, sync) fans out over: the install-wide\n * null scope first, then each tenant scope from `scopes()`, deduplicated (an\n * empty string folds into null). A throwing or rejecting resolver degrades to\n * the null-only pass so one tenant-enumeration bug does not block the whole run.\n */\nexport const resolveScopeList = async (\n\tscopes: ScopesResolver | undefined,\n\tpayload: Payload\n): Promise<Array<string | null>> => {\n\tif (!scopes) {\n\t\treturn [null]\n\t}\n\tlet raw: string[]\n\ttry {\n\t\tconst result = await scopes({ payload })\n\t\tif (!Array.isArray(result)) {\n\t\t\tthrow new Error('scopes() must resolve to an array of scope ids')\n\t\t}\n\t\traw = result\n\t} catch (err) {\n\t\tpayload.logger.warn(\n\t\t\t`analytics: scopes() failed, falling back to the install-wide scope: ${String(err)}`\n\t\t)\n\t\treturn [null]\n\t}\n\tconst out: Array<string | null> = [null]\n\tconst seen = new Set<string | null>([null])\n\tfor (const value of raw) {\n\t\tconst scope = value === '' ? null : value\n\t\tif (seen.has(scope)) {\n\t\t\tcontinue\n\t\t}\n\t\tseen.add(scope)\n\t\tout.push(scope)\n\t}\n\treturn out\n}\n"],"mappings":";;;;;;;AASA,MAAa,mBAAmB,OAC/B,QACA,YACmC;CACnC,IAAI,CAAC,QACJ,OAAO,CAAC,IAAI;CAEb,IAAI;CACJ,IAAI;EACH,MAAM,SAAS,MAAM,OAAO,EAAE,QAAQ,CAAC;EACvC,IAAI,CAAC,MAAM,QAAQ,MAAM,GACxB,MAAM,IAAI,MAAM,gDAAgD;EAEjE,MAAM;CACP,SAAS,KAAK;EACb,QAAQ,OAAO,KACd,uEAAuE,OAAO,GAAG,GAClF;EACA,OAAO,CAAC,IAAI;CACb;CACA,MAAM,MAA4B,CAAC,IAAI;CACvC,MAAM,OAAO,IAAI,IAAmB,CAAC,IAAI,CAAC;CAC1C,KAAK,MAAM,SAAS,KAAK;EACxB,MAAM,QAAQ,UAAU,KAAK,OAAO;EACpC,IAAI,KAAK,IAAI,KAAK,GACjB;EAED,KAAK,IAAI,KAAK;EACd,IAAI,KAAK,KAAK;CACf;CACA,OAAO;AACR"}
|
package/dist/core/scopedRead.js
CHANGED
|
@@ -1,20 +1,102 @@
|
|
|
1
|
-
import { platformReadFor, resolveRegistryFor, resolveScopeFor } from "../plugin/runtime.js";
|
|
2
1
|
import "./contract.js";
|
|
2
|
+
import { platformReadGate, resolveRegistryFor, resolveScopeFor } from "../plugin/runtime.js";
|
|
3
3
|
//#region src/core/scopedRead.ts
|
|
4
4
|
/**
|
|
5
|
+
* The scope one request may act on, decided in one place for every endpoint that takes a
|
|
6
|
+
* `scope` from a caller, so a read gate and a state-changing gate cannot drift apart.
|
|
7
|
+
*
|
|
8
|
+
* The raw value is trimmed and a blank one counts as absent, exactly as `readParam` reads a
|
|
9
|
+
* query string. Naming a scope, the platform wildcard included, is the cross-scope decision
|
|
10
|
+
* and requires `platformRead`. Absent means the request's own resolved scope, which is
|
|
11
|
+
* itself cross-scope when the resolver answers the wildcard or, on a scoped install, null:
|
|
12
|
+
* null usually means "no tenant selected" rather than "everything", so it fails closed
|
|
13
|
+
* behind the same gate. A resolver that throws answers no scope either, separately, so a
|
|
14
|
+
* caller with a degraded answer to give can tell it from a refusal. Per-adapter narrowing
|
|
15
|
+
* is a later decision, in `resolveQueryScope`.
|
|
16
|
+
*/
|
|
17
|
+
const resolveRequestedScope = async (args) => {
|
|
18
|
+
const { runtime, req } = args;
|
|
19
|
+
const allowed = args.platformRead ?? platformReadGate(runtime, req);
|
|
20
|
+
const named = typeof args.raw === "string" ? args.raw.trim() : "";
|
|
21
|
+
if (named !== "") return await allowed() ? {
|
|
22
|
+
ok: true,
|
|
23
|
+
scope: named
|
|
24
|
+
} : {
|
|
25
|
+
ok: false,
|
|
26
|
+
reason: "named"
|
|
27
|
+
};
|
|
28
|
+
let scope;
|
|
29
|
+
try {
|
|
30
|
+
scope = await resolveScopeFor(runtime, req);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
req.payload.logger?.warn(`analytics: scope resolution failed: ${String(err)}`);
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
reason: "failed"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if ((scope === "*" || runtime.scoped === true && scope === null) && !await allowed()) return {
|
|
39
|
+
ok: false,
|
|
40
|
+
reason: "unresolved"
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
ok: true,
|
|
44
|
+
scope
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The scope to stamp on one adapter query, or a refusal. Cross-scope reads fail closed
|
|
49
|
+
* behind `platformRead`: the `'*'` marker, and any scoped read through a shared config
|
|
50
|
+
* adapter that cannot narrow the query to one scope (whether or not it is the designated
|
|
51
|
+
* platform adapter), which would otherwise answer with every scope's data. A tenant's own
|
|
52
|
+
* runtime adapters are never gated. Every read path decides this here, so the widgets and
|
|
53
|
+
* the query endpoint cannot drift apart on what counts as cross-scope.
|
|
54
|
+
*/
|
|
55
|
+
const resolveQueryScope = async (args) => {
|
|
56
|
+
const { runtime, req, scope, adapter } = args;
|
|
57
|
+
const allowed = args.platformRead ?? platformReadGate(runtime, req);
|
|
58
|
+
if (scope === "*") return await allowed() ? { ok: true } : { ok: false };
|
|
59
|
+
if (scope === null) return { ok: true };
|
|
60
|
+
if (runtime.configAdapterIds.has(adapter.id) && !adapter.capabilities.scopedQueries) return await allowed() ? { ok: true } : { ok: false };
|
|
61
|
+
return {
|
|
62
|
+
ok: true,
|
|
63
|
+
queryScope: scope
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
5
67
|
* Resolve one read's scope and adapter: explicit scope wins over the request's
|
|
6
68
|
* resolved scope, the registry is resolved per scope, then the adapter is picked
|
|
7
|
-
* by id (or the registry default).
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
69
|
+
* by id (or the registry default). A request's own scope goes through
|
|
70
|
+
* `resolveRequestedScope`, the same decision every endpoint that takes a scope
|
|
71
|
+
* reads with, so the widgets cannot drift from them on what a scope may be.
|
|
72
|
+
* Cross-scope reads fail closed behind `platformRead`: an explicit `'*'` scope
|
|
73
|
+
* always, any scoped read through a shared config adapter that cannot narrow the
|
|
74
|
+
* query to one scope (whether or not it is the designated platform adapter), and,
|
|
75
|
+
* on a scoped install, a request that resolves no scope at all. That last case is
|
|
76
|
+
* ambiguous rather than intentionally install-wide (a tenant's scopeResolver
|
|
77
|
+
* returning null usually means "no tenant selected", not "read everything"), so it
|
|
78
|
+
* fails closed the same way. An explicit `scope: null` override bypasses that gate:
|
|
79
|
+
* it is the trusted server-side caller's path (cron passes, tests), never a
|
|
80
|
+
* request's own resolution. A tenant's own runtime adapters are never gated.
|
|
81
|
+
* Any resolution failure (unknown adapter id, a throwing scopeResolver or
|
|
82
|
+
* provider lookup) degrades to `{ ok: false }` so read paths render their
|
|
83
|
+
* unavailable state instead of throwing.
|
|
13
84
|
*/
|
|
14
85
|
const resolveReadContext = async (args) => {
|
|
15
86
|
const { runtime, req, adapterId } = args;
|
|
87
|
+
const allowed = platformReadGate(runtime, req);
|
|
16
88
|
try {
|
|
17
|
-
|
|
89
|
+
let scope;
|
|
90
|
+
if (args.scope !== void 0) scope = args.scope;
|
|
91
|
+
else {
|
|
92
|
+
const requested = await resolveRequestedScope({
|
|
93
|
+
runtime,
|
|
94
|
+
req,
|
|
95
|
+
platformRead: allowed
|
|
96
|
+
});
|
|
97
|
+
if (!requested.ok) return { ok: false };
|
|
98
|
+
scope = requested.scope;
|
|
99
|
+
}
|
|
18
100
|
const registryScope = scope === "*" ? null : scope;
|
|
19
101
|
const registry = await resolveRegistryFor(runtime, {
|
|
20
102
|
payload: req.payload,
|
|
@@ -22,29 +104,19 @@ const resolveReadContext = async (args) => {
|
|
|
22
104
|
scope: registryScope
|
|
23
105
|
});
|
|
24
106
|
const adapter = adapterId ? registry.get(adapterId) : registry.default();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
if (scope !== null && adapter.id === runtime.platformAdapterId && !adapter.capabilities.scopedQueries) {
|
|
35
|
-
if (!await platformReadFor(runtime, req)) return { ok: false };
|
|
36
|
-
return {
|
|
37
|
-
ok: true,
|
|
38
|
-
adapter,
|
|
39
|
-
scope,
|
|
40
|
-
queryScope: void 0
|
|
41
|
-
};
|
|
42
|
-
}
|
|
107
|
+
const decision = await resolveQueryScope({
|
|
108
|
+
runtime,
|
|
109
|
+
req,
|
|
110
|
+
scope,
|
|
111
|
+
adapter,
|
|
112
|
+
platformRead: allowed
|
|
113
|
+
});
|
|
114
|
+
if (!decision.ok) return { ok: false };
|
|
43
115
|
return {
|
|
44
116
|
ok: true,
|
|
45
117
|
adapter,
|
|
46
|
-
scope,
|
|
47
|
-
queryScope:
|
|
118
|
+
scope: registryScope,
|
|
119
|
+
queryScope: decision.queryScope
|
|
48
120
|
};
|
|
49
121
|
} catch (err) {
|
|
50
122
|
req.payload.logger?.warn(`analytics: read context resolution failed: ${String(err)}`);
|
|
@@ -52,6 +124,6 @@ const resolveReadContext = async (args) => {
|
|
|
52
124
|
}
|
|
53
125
|
};
|
|
54
126
|
//#endregion
|
|
55
|
-
export { resolveReadContext };
|
|
127
|
+
export { resolveQueryScope, resolveReadContext, resolveRequestedScope };
|
|
56
128
|
|
|
57
129
|
//# sourceMappingURL=scopedRead.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopedRead.js","names":[],"sources":["../../src/core/scopedRead.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport {\n\ttype AnalyticsRuntime,\n\
|
|
1
|
+
{"version":3,"file":"scopedRead.js","names":[],"sources":["../../src/core/scopedRead.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport {\n\ttype AnalyticsRuntime,\n\ttype PlatformReadGate,\n\tplatformReadGate,\n\tresolveRegistryFor,\n\tresolveScopeFor,\n} from '../plugin/runtime'\nimport { type AnalyticsAdapter, PLATFORM_SCOPE } from './contract'\n\nexport type ReadContext =\n\t| {\n\t\t\tok: true\n\t\t\tadapter: AnalyticsAdapter\n\t\t\tscope: string | null\n\t\t\t/** The scope to stamp on the adapter query; undefined for install-wide reads. */\n\t\t\tqueryScope?: string\n\t }\n\t| { ok: false }\n\nexport interface ResolveReadContextArgs {\n\truntime: AnalyticsRuntime\n\treq: PayloadRequest\n\tadapterId?: string\n\t/** Explicit scope override; undefined resolves via the plugin's scopeResolver. */\n\tscope?: string | null\n}\n\nexport interface QueryScopeArgs {\n\truntime: AnalyticsRuntime\n\treq: PayloadRequest\n\t/** The read's resolved scope; `'*'` is the explicit cross-scope marker. */\n\tscope: string | null\n\tadapter: AnalyticsAdapter\n\t/** Shared `platformRead` decision; one is created per call when omitted. */\n\tplatformRead?: PlatformReadGate\n}\n\n/**\n * A scope a request may act on, or why it may not. `named` is a scope the caller asked for\n * and `platformRead` denies; `unresolved` is a request whose own scope is cross-scope, or\n * ambiguous on a scoped install, behind the same gate; `failed` is a `scopeResolver` that\n * threw, which callers that can serve something degraded tell apart from a refusal.\n */\nexport type RequestedScope =\n\t| { ok: true; scope: string | null }\n\t| { ok: false; reason: 'named' | 'unresolved' | 'failed' }\n\nexport interface RequestedScopeArgs {\n\truntime: AnalyticsRuntime\n\treq: PayloadRequest\n\t/** The `scope` the request carried, untrimmed; null or undefined when it carried none. */\n\traw?: string | null\n\t/** Shared `platformRead` decision; one is created per call when omitted. */\n\tplatformRead?: PlatformReadGate\n}\n\n/**\n * The scope one request may act on, decided in one place for every endpoint that takes a\n * `scope` from a caller, so a read gate and a state-changing gate cannot drift apart.\n *\n * The raw value is trimmed and a blank one counts as absent, exactly as `readParam` reads a\n * query string. Naming a scope, the platform wildcard included, is the cross-scope decision\n * and requires `platformRead`. Absent means the request's own resolved scope, which is\n * itself cross-scope when the resolver answers the wildcard or, on a scoped install, null:\n * null usually means \"no tenant selected\" rather than \"everything\", so it fails closed\n * behind the same gate. A resolver that throws answers no scope either, separately, so a\n * caller with a degraded answer to give can tell it from a refusal. Per-adapter narrowing\n * is a later decision, in `resolveQueryScope`.\n */\nexport const resolveRequestedScope = async (args: RequestedScopeArgs): Promise<RequestedScope> => {\n\tconst { runtime, req } = args\n\tconst allowed = args.platformRead ?? platformReadGate(runtime, req)\n\tconst named = typeof args.raw === 'string' ? args.raw.trim() : ''\n\tif (named !== '') {\n\t\treturn (await allowed()) ? { ok: true, scope: named } : { ok: false, reason: 'named' }\n\t}\n\tlet scope: string | null\n\ttry {\n\t\tscope = await resolveScopeFor(runtime, req)\n\t} catch (err) {\n\t\treq.payload.logger?.warn(`analytics: scope resolution failed: ${String(err)}`)\n\t\treturn { ok: false, reason: 'failed' }\n\t}\n\tconst crossScope = scope === PLATFORM_SCOPE || (runtime.scoped === true && scope === null)\n\tif (crossScope && !(await allowed())) {\n\t\treturn { ok: false, reason: 'unresolved' }\n\t}\n\treturn { ok: true, scope }\n}\n\n/**\n * The scope to stamp on one adapter query, or a refusal. Cross-scope reads fail closed\n * behind `platformRead`: the `'*'` marker, and any scoped read through a shared config\n * adapter that cannot narrow the query to one scope (whether or not it is the designated\n * platform adapter), which would otherwise answer with every scope's data. A tenant's own\n * runtime adapters are never gated. Every read path decides this here, so the widgets and\n * the query endpoint cannot drift apart on what counts as cross-scope.\n */\nexport const resolveQueryScope = async (\n\targs: QueryScopeArgs\n): Promise<{ ok: true; queryScope?: string } | { ok: false }> => {\n\tconst { runtime, req, scope, adapter } = args\n\tconst allowed = args.platformRead ?? platformReadGate(runtime, req)\n\tif (scope === PLATFORM_SCOPE) {\n\t\treturn (await allowed()) ? { ok: true } : { ok: false }\n\t}\n\tif (scope === null) {\n\t\treturn { ok: true }\n\t}\n\tif (runtime.configAdapterIds.has(adapter.id) && !adapter.capabilities.scopedQueries) {\n\t\treturn (await allowed()) ? { ok: true } : { ok: false }\n\t}\n\treturn { ok: true, queryScope: scope }\n}\n\n/**\n * Resolve one read's scope and adapter: explicit scope wins over the request's\n * resolved scope, the registry is resolved per scope, then the adapter is picked\n * by id (or the registry default). A request's own scope goes through\n * `resolveRequestedScope`, the same decision every endpoint that takes a scope\n * reads with, so the widgets cannot drift from them on what a scope may be.\n * Cross-scope reads fail closed behind `platformRead`: an explicit `'*'` scope\n * always, any scoped read through a shared config adapter that cannot narrow the\n * query to one scope (whether or not it is the designated platform adapter), and,\n * on a scoped install, a request that resolves no scope at all. That last case is\n * ambiguous rather than intentionally install-wide (a tenant's scopeResolver\n * returning null usually means \"no tenant selected\", not \"read everything\"), so it\n * fails closed the same way. An explicit `scope: null` override bypasses that gate:\n * it is the trusted server-side caller's path (cron passes, tests), never a\n * request's own resolution. A tenant's own runtime adapters are never gated.\n * Any resolution failure (unknown adapter id, a throwing scopeResolver or\n * provider lookup) degrades to `{ ok: false }` so read paths render their\n * unavailable state instead of throwing.\n */\nexport const resolveReadContext = async (args: ResolveReadContextArgs): Promise<ReadContext> => {\n\tconst { runtime, req, adapterId } = args\n\tconst allowed = platformReadGate(runtime, req)\n\ttry {\n\t\tlet scope: string | null\n\t\tif (args.scope !== undefined) {\n\t\t\tscope = args.scope\n\t\t} else {\n\t\t\tconst requested = await resolveRequestedScope({ runtime, req, platformRead: allowed })\n\t\t\tif (!requested.ok) {\n\t\t\t\treturn { ok: false }\n\t\t\t}\n\t\t\tscope = requested.scope\n\t\t}\n\t\tconst registryScope = scope === PLATFORM_SCOPE ? null : scope\n\t\tconst registry = await resolveRegistryFor(runtime, {\n\t\t\tpayload: req.payload,\n\t\t\treq,\n\t\t\tscope: registryScope,\n\t\t})\n\t\tconst adapter = adapterId ? registry.get(adapterId) : registry.default()\n\t\tconst decision = await resolveQueryScope({\n\t\t\truntime,\n\t\t\treq,\n\t\t\tscope,\n\t\t\tadapter,\n\t\t\tplatformRead: allowed,\n\t\t})\n\t\tif (!decision.ok) {\n\t\t\treturn { ok: false }\n\t\t}\n\t\treturn { ok: true, adapter, scope: registryScope, queryScope: decision.queryScope }\n\t} catch (err) {\n\t\treq.payload.logger?.warn(`analytics: read context resolution failed: ${String(err)}`)\n\t\treturn { ok: false }\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsEA,MAAa,wBAAwB,OAAO,SAAsD;CACjG,MAAM,EAAE,SAAS,QAAQ;CACzB,MAAM,UAAU,KAAK,gBAAgB,iBAAiB,SAAS,GAAG;CAClE,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW,KAAK,IAAI,KAAK,IAAI;CAC/D,IAAI,UAAU,IACb,OAAQ,MAAM,QAAQ,IAAK;EAAE,IAAI;EAAM,OAAO;CAAM,IAAI;EAAE,IAAI;EAAO,QAAQ;CAAQ;CAEtF,IAAI;CACJ,IAAI;EACH,QAAQ,MAAM,gBAAgB,SAAS,GAAG;CAC3C,SAAS,KAAK;EACb,IAAI,QAAQ,QAAQ,KAAK,uCAAuC,OAAO,GAAG,GAAG;EAC7E,OAAO;GAAE,IAAI;GAAO,QAAQ;EAAS;CACtC;CAEA,KADmB,UAAA,OAA6B,QAAQ,WAAW,QAAQ,UAAU,SACnE,CAAE,MAAM,QAAQ,GACjC,OAAO;EAAE,IAAI;EAAO,QAAQ;CAAa;CAE1C,OAAO;EAAE,IAAI;EAAM;CAAM;AAC1B;;;;;;;;;AAUA,MAAa,oBAAoB,OAChC,SACgE;CAChE,MAAM,EAAE,SAAS,KAAK,OAAO,YAAY;CACzC,MAAM,UAAU,KAAK,gBAAgB,iBAAiB,SAAS,GAAG;CAClE,IAAI,UAAA,KACH,OAAQ,MAAM,QAAQ,IAAK,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,MAAM;CAEvD,IAAI,UAAU,MACb,OAAO,EAAE,IAAI,KAAK;CAEnB,IAAI,QAAQ,iBAAiB,IAAI,QAAQ,EAAE,KAAK,CAAC,QAAQ,aAAa,eACrE,OAAQ,MAAM,QAAQ,IAAK,EAAE,IAAI,KAAK,IAAI,EAAE,IAAI,MAAM;CAEvD,OAAO;EAAE,IAAI;EAAM,YAAY;CAAM;AACtC;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,qBAAqB,OAAO,SAAuD;CAC/F,MAAM,EAAE,SAAS,KAAK,cAAc;CACpC,MAAM,UAAU,iBAAiB,SAAS,GAAG;CAC7C,IAAI;EACH,IAAI;EACJ,IAAI,KAAK,UAAU,KAAA,GAClB,QAAQ,KAAK;OACP;GACN,MAAM,YAAY,MAAM,sBAAsB;IAAE;IAAS;IAAK,cAAc;GAAQ,CAAC;GACrF,IAAI,CAAC,UAAU,IACd,OAAO,EAAE,IAAI,MAAM;GAEpB,QAAQ,UAAU;EACnB;EACA,MAAM,gBAAgB,UAAA,MAA2B,OAAO;EACxD,MAAM,WAAW,MAAM,mBAAmB,SAAS;GAClD,SAAS,IAAI;GACb;GACA,OAAO;EACR,CAAC;EACD,MAAM,UAAU,YAAY,SAAS,IAAI,SAAS,IAAI,SAAS,QAAQ;EACvE,MAAM,WAAW,MAAM,kBAAkB;GACxC;GACA;GACA;GACA;GACA,cAAc;EACf,CAAC;EACD,IAAI,CAAC,SAAS,IACb,OAAO,EAAE,IAAI,MAAM;EAEpB,OAAO;GAAE,IAAI;GAAM;GAAS,OAAO;GAAe,YAAY,SAAS;EAAW;CACnF,SAAS,KAAK;EACb,IAAI,QAAQ,QAAQ,KAAK,8CAA8C,OAAO,GAAG,GAAG;EACpF,OAAO,EAAE,IAAI,MAAM;CACpB;AACD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { RawEventInput } from "../native/ingest/normalizeEvent.js";
|
|
2
|
+
import { PayloadRequest } from "payload";
|
|
3
|
+
|
|
4
|
+
//#region src/core/serverEvent.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* One event recorded from server code. The fields a browser event carries mean exactly what
|
|
7
|
+
* they mean on the wire (and go through the same sanitizers); the rest say what the server
|
|
8
|
+
* knows that a browser request would otherwise have said for itself.
|
|
9
|
+
*/
|
|
10
|
+
type ServerEventInput = Pick<RawEventInput, 'type' | 'name' | 'path' | 'referrer' | 'query' | 'props' | 'value' | 'currency'> & {
|
|
11
|
+
/**
|
|
12
|
+
* The site the event belongs to. Required, and stored as given: there is no request behind
|
|
13
|
+
* a server event to attribute it to, so the caller owns the value.
|
|
14
|
+
*/
|
|
15
|
+
hostname: string;
|
|
16
|
+
/**
|
|
17
|
+
* Attribution inputs, overlaid on `opts.req`'s own headers when there is a request.
|
|
18
|
+
* With neither, the event is attributed to the day's synthetic server visitor and
|
|
19
|
+
* reports no device, browser, OS or language: those are read off the request's headers,
|
|
20
|
+
* and inventing them would put a fabricated visitor in every breakdown. No IP is ever
|
|
21
|
+
* fabricated either.
|
|
22
|
+
*/
|
|
23
|
+
ip?: string;
|
|
24
|
+
userAgent?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Analytics boundary to stamp; null is install-wide. Unset resolves from `opts.req`.
|
|
27
|
+
* Ignored on an unscoped install, and never validated against the scopes that exist.
|
|
28
|
+
*/
|
|
29
|
+
scope?: string | null; /** IANA reporting timezone the rollup day bucket is computed in. */
|
|
30
|
+
timezone?: string; /** Event time; defaults to now. */
|
|
31
|
+
now?: Date;
|
|
32
|
+
};
|
|
33
|
+
interface ServerTrackOptions {
|
|
34
|
+
/** The request the event belongs to: attribution, scope and timezone all come from it. */
|
|
35
|
+
req?: PayloadRequest;
|
|
36
|
+
/**
|
|
37
|
+
* Wait for the write to land. On an install with a write buffer the call otherwise
|
|
38
|
+
* resolves as soon as the event is queued, and a failed flush only reaches the logger.
|
|
39
|
+
*/
|
|
40
|
+
flush?: boolean;
|
|
41
|
+
}
|
|
42
|
+
type ServerTrack = (event: ServerEventInput, opts?: ServerTrackOptions) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Applies an adapter's own hostname policy to a request, answering null when it refuses the
|
|
45
|
+
* host. Server code that stands in for a browser event (a form action recording a conversion)
|
|
46
|
+
* attributes through this rather than through a forgeable `Host`, so one policy decides what a
|
|
47
|
+
* hostname may be on every public path.
|
|
48
|
+
*/
|
|
49
|
+
type IngestHostnameResolver = (args: {
|
|
50
|
+
req: PayloadRequest; /** What the caller believes the host is, never trusted on its own. */
|
|
51
|
+
claimed?: string;
|
|
52
|
+
scope?: string | null;
|
|
53
|
+
}) => Promise<string | null>;
|
|
54
|
+
/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */
|
|
55
|
+
declare class AnalyticsTrackError extends Error {
|
|
56
|
+
constructor(message: string);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { AnalyticsTrackError, IngestHostnameResolver, ServerEventInput, ServerTrack, ServerTrackOptions };
|
|
60
|
+
//# sourceMappingURL=serverEvent.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/serverEvent.ts
|
|
2
|
+
/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */
|
|
3
|
+
var AnalyticsTrackError = class extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "AnalyticsTrackError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AnalyticsTrackError };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=serverEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverEvent.js","names":[],"sources":["../../src/core/serverEvent.ts"],"sourcesContent":["import type { PayloadRequest } from 'payload'\nimport type { RawEventInput } from '../native/ingest/normalizeEvent'\n\n/**\n * One event recorded from server code. The fields a browser event carries mean exactly what\n * they mean on the wire (and go through the same sanitizers); the rest say what the server\n * knows that a browser request would otherwise have said for itself.\n */\nexport type ServerEventInput = Pick<\n\tRawEventInput,\n\t'type' | 'name' | 'path' | 'referrer' | 'query' | 'props' | 'value' | 'currency'\n> & {\n\t/**\n\t * The site the event belongs to. Required, and stored as given: there is no request behind\n\t * a server event to attribute it to, so the caller owns the value.\n\t */\n\thostname: string\n\t/**\n\t * Attribution inputs, overlaid on `opts.req`'s own headers when there is a request.\n\t * With neither, the event is attributed to the day's synthetic server visitor and\n\t * reports no device, browser, OS or language: those are read off the request's headers,\n\t * and inventing them would put a fabricated visitor in every breakdown. No IP is ever\n\t * fabricated either.\n\t */\n\tip?: string\n\tuserAgent?: string\n\t/**\n\t * Analytics boundary to stamp; null is install-wide. Unset resolves from `opts.req`.\n\t * Ignored on an unscoped install, and never validated against the scopes that exist.\n\t */\n\tscope?: string | null\n\t/** IANA reporting timezone the rollup day bucket is computed in. */\n\ttimezone?: string\n\t/** Event time; defaults to now. */\n\tnow?: Date\n}\n\nexport interface ServerTrackOptions {\n\t/** The request the event belongs to: attribution, scope and timezone all come from it. */\n\treq?: PayloadRequest\n\t/**\n\t * Wait for the write to land. On an install with a write buffer the call otherwise\n\t * resolves as soon as the event is queued, and a failed flush only reaches the logger.\n\t */\n\tflush?: boolean\n}\n\nexport type ServerTrack = (event: ServerEventInput, opts?: ServerTrackOptions) => Promise<void>\n\n/**\n * Applies an adapter's own hostname policy to a request, answering null when it refuses the\n * host. Server code that stands in for a browser event (a form action recording a conversion)\n * attributes through this rather than through a forgeable `Host`, so one policy decides what a\n * hostname may be on every public path.\n */\nexport type IngestHostnameResolver = (args: {\n\treq: PayloadRequest\n\t/** What the caller believes the host is, never trusted on its own. */\n\tclaimed?: string\n\tscope?: string | null\n}) => Promise<string | null>\n\n/** Thrown instead of dropping the event: a server caller can handle a rejected promise. */\nexport class AnalyticsTrackError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'AnalyticsTrackError'\n\t}\n}\n"],"mappings":";;AA+DA,IAAa,sBAAb,cAAyC,MAAM;CAC9C,YAAY,SAAiB;EAC5B,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD"}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { BotFilter, isBot } from "../../native/ingest/bots.js";
|
|
2
|
+
import { EventHostnameResolver, HostnameOption } from "../../native/ingest/resolveHostname.js";
|
|
1
3
|
import { NativeOptions, native } from "../../native/nativeAdapter.js";
|
|
2
|
-
export { type NativeOptions, native };
|
|
4
|
+
export { type BotFilter, type EventHostnameResolver, type HostnameOption, type NativeOptions, isBot, native };
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { BarList, BarListProps } from "../charts/BarList.js";
|
|
2
|
-
import { TrendChart, TrendChartProps } from "../charts/TrendChart.js";
|
|
2
|
+
import { TrendChart, TrendChartProps, TrendPoint } from "../charts/TrendChart.js";
|
|
3
|
+
import { FilterDimensionSelectField, FilterDimensionSelectFieldProps } from "../fields/config/FilterDimensionSelectField.js";
|
|
4
|
+
import { FilterOperatorSelectField, FilterOperatorSelectFieldProps } from "../fields/config/FilterOperatorSelectField.js";
|
|
5
|
+
import { WireSource } from "../fields/config/fetchSources.js";
|
|
6
|
+
import { MetricSelectField, MetricSelectFieldProps } from "../fields/config/MetricSelectField.js";
|
|
7
|
+
import { SourceSelectField } from "../fields/config/SourceSelectField.js";
|
|
8
|
+
import { AnalyticsSources, useAnalyticsSources } from "../fields/config/useAnalyticsSources.js";
|
|
9
|
+
import { FilterCapabilities, useFilterCapabilities } from "../fields/config/useFilterCapabilities.js";
|
|
3
10
|
import { DateRangeField } from "../fields/dateRange/ui.js";
|
|
11
|
+
import { GoalsResponse, WireGoal } from "../goals/fetchGoals.js";
|
|
12
|
+
import { GoalSelectField } from "../goals/GoalSelectField.js";
|
|
13
|
+
import { useAnalyticsGoals } from "../goals/useAnalyticsGoals.js";
|
|
14
|
+
import { AnalyticsError, AnalyticsErrorCode, readErrorCode, readResponseError } from "../plugin/errors.js";
|
|
15
|
+
import { QueryFetchError, QueryRequest, RefreshRequest, RefreshResponse, buildQueryUrl, fetchQuery, refreshCache } from "../query/fetchQuery.js";
|
|
16
|
+
import { AnalyticsNavLink, AnalyticsNavLinkProps } from "../view/AnalyticsNavLink.js";
|
|
17
|
+
import { AnalyticsViewClient } from "../view/AnalyticsViewClient.js";
|
|
4
18
|
import { RealtimeCounter } from "../widgets/RealtimeCounter.js";
|
|
5
|
-
export { BarList, type BarListProps, DateRangeField, RealtimeCounter, TrendChart, type TrendChartProps };
|
|
19
|
+
export { type AnalyticsError, type AnalyticsErrorCode, AnalyticsNavLink, type AnalyticsNavLinkProps, type AnalyticsSources, AnalyticsViewClient, BarList, type BarListProps, DateRangeField, type FilterCapabilities, FilterDimensionSelectField, type FilterDimensionSelectFieldProps, FilterOperatorSelectField, type FilterOperatorSelectFieldProps, GoalSelectField, type GoalsResponse, MetricSelectField, type MetricSelectFieldProps, QueryFetchError, type QueryRequest, RealtimeCounter, type RefreshRequest, type RefreshResponse, SourceSelectField, TrendChart, type TrendChartProps, type TrendPoint, type WireGoal, type WireSource, buildQueryUrl, fetchQuery, readErrorCode, readResponseError, refreshCache, useAnalyticsGoals, useAnalyticsSources, useFilterCapabilities };
|
package/dist/exports/client.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { readErrorCode, readResponseError } from "../plugin/errors.js";
|
|
2
3
|
import { BarList } from "../charts/BarList.js";
|
|
3
4
|
import { TrendChart } from "../charts/TrendChart.js";
|
|
5
|
+
import { useAnalyticsSources } from "../fields/config/useAnalyticsSources.js";
|
|
6
|
+
import { useFilterCapabilities } from "../fields/config/useFilterCapabilities.js";
|
|
7
|
+
import { FilterDimensionSelectField } from "../fields/config/FilterDimensionSelectField.js";
|
|
8
|
+
import { FilterOperatorSelectField } from "../fields/config/FilterOperatorSelectField.js";
|
|
9
|
+
import { MetricSelectField } from "../fields/config/MetricSelectField.js";
|
|
10
|
+
import { SourceSelectField } from "../fields/config/SourceSelectField.js";
|
|
4
11
|
import { DateRangeField } from "../fields/dateRange/ui.js";
|
|
12
|
+
import { useAnalyticsGoals } from "../goals/useAnalyticsGoals.js";
|
|
13
|
+
import { GoalSelectField } from "../goals/GoalSelectField.js";
|
|
14
|
+
import { QueryFetchError, buildQueryUrl, fetchQuery, refreshCache } from "../query/fetchQuery.js";
|
|
15
|
+
import { AnalyticsNavLink } from "../view/AnalyticsNavLink.js";
|
|
5
16
|
import { RealtimeCounter } from "../widgets/RealtimeCounter.js";
|
|
6
|
-
|
|
17
|
+
import { AnalyticsViewClient } from "../view/AnalyticsViewClient.js";
|
|
18
|
+
export { AnalyticsNavLink, AnalyticsViewClient, BarList, DateRangeField, FilterDimensionSelectField, FilterOperatorSelectField, GoalSelectField, MetricSelectField, QueryFetchError, RealtimeCounter, SourceSelectField, TrendChart, buildQueryUrl, fetchQuery, readErrorCode, readResponseError, refreshCache, useAnalyticsGoals, useAnalyticsSources, useFilterCapabilities };
|
package/dist/exports/geo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Geo, GeoResolver, noopResolver, platformHeaderResolver } from "../native/geo/geoResolver.js";
|
|
1
|
+
import { Geo, GeoResolver, GeoResolverOptions, noopResolver, platformHeaderResolver } from "../native/geo/geoResolver.js";
|
|
2
2
|
import { composeGeoResolvers } from "../native/geo/composeGeoResolvers.js";
|
|
3
3
|
import { MaxmindOptions, maxmindResolver } from "../native/geo/maxmindResolver.js";
|
|
4
|
-
export { type Geo, type GeoResolver, type MaxmindOptions, composeGeoResolvers, maxmindResolver, noopResolver, platformHeaderResolver };
|
|
4
|
+
export { type Geo, type GeoResolver, type GeoResolverOptions, type MaxmindOptions, composeGeoResolvers, maxmindResolver, noopResolver, platformHeaderResolver };
|
package/dist/exports/next.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { CaptureRewrite, CaptureRewriteMount, captureRewrites } from "../next/captureRewrites.js";
|
|
1
2
|
import { PosthogProxyRegion, PosthogProxyRewrite, PosthogProxyRewritesOptions, posthogProxyRewrites } from "../next/posthogProxyRewrites.js";
|
|
2
|
-
export { type PosthogProxyRegion, type PosthogProxyRewrite, type PosthogProxyRewritesOptions, posthogProxyRewrites };
|
|
3
|
+
export { type CaptureRewrite, type CaptureRewriteMount, type PosthogProxyRegion, type PosthogProxyRewrite, type PosthogProxyRewritesOptions, captureRewrites, posthogProxyRewrites };
|
package/dist/exports/next.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AnalyticsApi, AnalyticsCommands, AnalyticsProvider, AnalyticsProviderProps } from "../react/AnalyticsProvider.js";
|
|
2
|
+
import { TrackerBoot, TrackerBootProps } from "../react/TrackerBoot.js";
|
|
3
|
+
import { useAnalytics } from "../react/useAnalytics.js";
|
|
4
|
+
export { type AnalyticsApi, type AnalyticsCommands, AnalyticsProvider, type AnalyticsProviderProps, TrackerBoot, type TrackerBootProps, useAnalytics };
|
package/dist/exports/rsc.d.ts
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { DateRange, DimensionKey, MetricKey } from "../core/contract.js";
|
|
2
|
-
import { ReadForWidgetRealtimeArgs, RealtimePoint, WidgetRealtimeResult, WidgetRealtimeStatus, readForWidgetRealtime } from "../widgets/readForWidgetRealtime.js";
|
|
1
|
+
import { AnalyticsFilter, DateRange, DimensionKey, MetricKey } from "../core/contract.js";
|
|
3
2
|
import { CapabilityRequirement } from "../core/capabilities.js";
|
|
3
|
+
import { AnalyticsViewClientProps, ViewGoal } from "../view/viewProps.js";
|
|
4
|
+
import { ReadForWidgetRealtimeArgs, RealtimePoint, WidgetRealtimeResult, WidgetRealtimeStatus, readForWidgetRealtime } from "../widgets/readForWidgetRealtime.js";
|
|
5
|
+
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
6
|
+
import { getTrackerConfig } from "../capture/getTrackerConfig.js";
|
|
4
7
|
import { AnalyticsStatField } from "../fields/AnalyticsStatField.js";
|
|
5
8
|
import { AnalyticsPanelField } from "../fields/AnalyticsPanelField.js";
|
|
6
9
|
import { formatMetricValue } from "../fields/format.js";
|
|
7
|
-
import {
|
|
10
|
+
import { WidgetReadStatus } from "../widgets/prepareWidgetRead.js";
|
|
8
11
|
import { ReadForWidgetSeriesArgs, SeriesPoint, WidgetSeriesResult, readForWidgetSeries } from "../widgets/readForWidgetSeries.js";
|
|
9
12
|
import { FieldReadResult, FieldReadStatus, ReadForFieldArgs, readForField } from "../fields/readForDocument.js";
|
|
13
|
+
import { AnalyticsScripts, AnalyticsScriptsProps } from "../rsc/AnalyticsScripts.js";
|
|
14
|
+
import { AnalyticsView, AnalyticsViewProps } from "../view/AnalyticsView.js";
|
|
10
15
|
import { AnalyticsBreakdownWidget } from "../widgets/AnalyticsBreakdownWidget.js";
|
|
16
|
+
import { AnalyticsGoalsWidget } from "../widgets/AnalyticsGoalsWidget.js";
|
|
11
17
|
import { AnalyticsMetricWidget } from "../widgets/AnalyticsMetricWidget.js";
|
|
12
18
|
import { AnalyticsRealtimeWidget } from "../widgets/AnalyticsRealtimeWidget.js";
|
|
13
19
|
import { AnalyticsTrendWidget } from "../widgets/AnalyticsTrendWidget.js";
|
|
14
20
|
import { cardStyle, labelStyle } from "../widgets/cardChrome.js";
|
|
21
|
+
import { ReadForWidgetArgs, WidgetReadResult, readForWidget } from "../widgets/readForWidget.js";
|
|
15
22
|
import { BreakdownRow, ReadForWidgetBreakdownArgs, WidgetBreakdownResult, readForWidgetBreakdown } from "../widgets/readForWidgetBreakdown.js";
|
|
16
|
-
|
|
23
|
+
import { GoalRow, ReadForWidgetGoalsArgs, WidgetGoalsResult, readForWidgetGoals } from "../widgets/readForWidgetGoals.js";
|
|
24
|
+
export { AnalyticsBreakdownWidget, type AnalyticsFilter, AnalyticsGoalsWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsScripts, type AnalyticsScriptsProps, AnalyticsStatField, AnalyticsTrendWidget, AnalyticsView, type AnalyticsViewClientProps, type AnalyticsViewProps, type BreakdownRow, type CapabilityRequirement, type DateRange, type DimensionKey, type FieldReadResult, type FieldReadStatus, type GoalRow, type MetricKey, type ReadForFieldArgs, type ReadForWidgetArgs, type ReadForWidgetBreakdownArgs, type ReadForWidgetGoalsArgs, type ReadForWidgetRealtimeArgs, type ReadForWidgetSeriesArgs, type RealtimePoint, type SeriesPoint, type TrackerConfig, type TrackerSlotConfig, type ViewGoal, type WidgetBreakdownResult, type WidgetGoalsResult, type WidgetReadResult, type WidgetReadStatus, type WidgetRealtimeResult, type WidgetRealtimeStatus, type WidgetSeriesResult, formatMetricValue, getTrackerConfig, readForField, readForWidget, readForWidgetBreakdown, readForWidgetGoals, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
package/dist/exports/rsc.js
CHANGED
|
@@ -4,11 +4,16 @@ import { readForWidgetRealtime } from "../widgets/readForWidgetRealtime.js";
|
|
|
4
4
|
import { readForWidget } from "../widgets/readForWidget.js";
|
|
5
5
|
import { readForWidgetBreakdown } from "../widgets/readForWidgetBreakdown.js";
|
|
6
6
|
import { formatMetricValue } from "../fields/format.js";
|
|
7
|
+
import { cardStyle, labelStyle } from "../widgets/cardChrome.js";
|
|
8
|
+
import { getTrackerConfig } from "../capture/getTrackerConfig.js";
|
|
7
9
|
import { AnalyticsStatField } from "../fields/AnalyticsStatField.js";
|
|
8
10
|
import { AnalyticsPanelField } from "../fields/AnalyticsPanelField.js";
|
|
9
|
-
import {
|
|
11
|
+
import { AnalyticsScripts } from "../rsc/AnalyticsScripts.js";
|
|
12
|
+
import { AnalyticsView } from "../view/AnalyticsView.js";
|
|
10
13
|
import AnalyticsBreakdownWidget from "../widgets/AnalyticsBreakdownWidget.js";
|
|
14
|
+
import { readForWidgetGoals } from "../widgets/readForWidgetGoals.js";
|
|
15
|
+
import AnalyticsGoalsWidget from "../widgets/AnalyticsGoalsWidget.js";
|
|
11
16
|
import AnalyticsMetricWidget from "../widgets/AnalyticsMetricWidget.js";
|
|
12
17
|
import AnalyticsRealtimeWidget from "../widgets/AnalyticsRealtimeWidget.js";
|
|
13
18
|
import AnalyticsTrendWidget from "../widgets/AnalyticsTrendWidget.js";
|
|
14
|
-
export { AnalyticsBreakdownWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsStatField, AnalyticsTrendWidget, formatMetricValue, readForField, readForWidget, readForWidgetBreakdown, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
|
19
|
+
export { AnalyticsBreakdownWidget, AnalyticsGoalsWidget, AnalyticsMetricWidget, AnalyticsPanelField, AnalyticsRealtimeWidget, AnalyticsScripts, AnalyticsStatField, AnalyticsTrendWidget, AnalyticsView, formatMetricValue, getTrackerConfig, readForField, readForWidget, readForWidgetBreakdown, readForWidgetGoals, readForWidgetRealtime, readForWidgetSeries, cardStyle as widgetCardStyle, labelStyle as widgetLabelStyle };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TrackerGoal } from "../goals/types.js";
|
|
2
|
+
import { CaptureSnippet, SnippetScript } from "../core/capture.js";
|
|
3
|
+
import { ResolvedAutoCapture } from "../core/options.js";
|
|
4
|
+
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
5
|
+
import { ConsentState, LoadScript, Sink, Tracker, TrackerEvent, TrackerOptions, TrackerWindow } from "../tracker/types.js";
|
|
6
|
+
import { AutoCapture, AutoCaptureHandlers, DOWNLOAD_EVENT, GOAL_ATTRIBUTE, OUTBOUND_EVENT, SCROLL_EVENT, createAutoCapture } from "../tracker/autoCapture.js";
|
|
7
|
+
import { CONSENT_QUEUE_LIMIT, CONSENT_STORAGE_KEY, createConsentQueue, readConsent, writeConsent } from "../tracker/consent.js";
|
|
8
|
+
import { createNoopTracker, createTracker } from "../tracker/createTracker.js";
|
|
9
|
+
import { DEFAULT_EXCLUSION_PARAM, EXCLUSION_STORAGE_KEY, readExclusion, readExclusionParam, subscribeExclusion, writeExclusion } from "../tracker/exclusion.js";
|
|
10
|
+
import { DEFAULT_TRACKER_ENDPOINT, InitTrackerArgs, initTracker } from "../tracker/initTracker.js";
|
|
11
|
+
import { createScriptLoader } from "../tracker/loadScript.js";
|
|
12
|
+
import { PageTracking, createPageTracking } from "../tracker/pageTracking.js";
|
|
13
|
+
import { TrackerLease, acquireTracker } from "../tracker/registry.js";
|
|
14
|
+
import { VendorSinkArgs } from "../tracker/sinks/vendor.js";
|
|
15
|
+
import { GA4_DISABLE_PREFIX } from "../adapters/ga4/disableKey.js";
|
|
16
|
+
import { Ga4SinkArgs, createGa4Sink } from "../tracker/sinks/ga4.js";
|
|
17
|
+
import { PAGEVIEW_BUFFER_MS, createNativeSink } from "../tracker/sinks/native.js";
|
|
18
|
+
import { PLAUSIBLE_IGNORE_KEY, createPlausibleSink } from "../tracker/sinks/plausible.js";
|
|
19
|
+
import { createPosthogSink } from "../tracker/sinks/posthog.js";
|
|
20
|
+
import { UMAMI_DISABLED_KEY, createUmamiSink } from "../tracker/sinks/umami.js";
|
|
21
|
+
export { type AutoCapture, type AutoCaptureHandlers, CONSENT_QUEUE_LIMIT, CONSENT_STORAGE_KEY, type CaptureSnippet, type ConsentState, DEFAULT_EXCLUSION_PARAM, DEFAULT_TRACKER_ENDPOINT, DOWNLOAD_EVENT, EXCLUSION_STORAGE_KEY, GA4_DISABLE_PREFIX, GOAL_ATTRIBUTE, type Ga4SinkArgs, type InitTrackerArgs, type LoadScript, OUTBOUND_EVENT, PAGEVIEW_BUFFER_MS, PLAUSIBLE_IGNORE_KEY, type PageTracking, type ResolvedAutoCapture, SCROLL_EVENT, type Sink, type SnippetScript, type Tracker, type TrackerConfig, type TrackerEvent, type TrackerGoal, type TrackerLease, type TrackerOptions, type TrackerSlotConfig, type TrackerWindow, UMAMI_DISABLED_KEY, type VendorSinkArgs, acquireTracker, createAutoCapture, createConsentQueue, createGa4Sink, createNativeSink, createNoopTracker, createPageTracking, createPlausibleSink, createPosthogSink, createScriptLoader, createTracker, createUmamiSink, initTracker, readConsent, readExclusion, readExclusionParam, subscribeExclusion, writeConsent, writeExclusion };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DEFAULT_EXCLUSION_PARAM, EXCLUSION_STORAGE_KEY, readExclusion, readExclusionParam, subscribeExclusion, writeExclusion } from "../tracker/exclusion.js";
|
|
2
|
+
import { GA4_DISABLE_PREFIX } from "../adapters/ga4/disableKey.js";
|
|
3
|
+
import { DOWNLOAD_EVENT, GOAL_ATTRIBUTE, OUTBOUND_EVENT, SCROLL_EVENT, createAutoCapture } from "../tracker/autoCapture.js";
|
|
4
|
+
import { CONSENT_QUEUE_LIMIT, CONSENT_STORAGE_KEY, createConsentQueue, readConsent, writeConsent } from "../tracker/consent.js";
|
|
5
|
+
import { createScriptLoader } from "../tracker/loadScript.js";
|
|
6
|
+
import { createPageTracking } from "../tracker/pageTracking.js";
|
|
7
|
+
import { createGa4Sink } from "../tracker/sinks/ga4.js";
|
|
8
|
+
import { PAGEVIEW_BUFFER_MS, createNativeSink } from "../tracker/sinks/native.js";
|
|
9
|
+
import { PLAUSIBLE_IGNORE_KEY, createPlausibleSink } from "../tracker/sinks/plausible.js";
|
|
10
|
+
import { createPosthogSink } from "../tracker/sinks/posthog.js";
|
|
11
|
+
import { UMAMI_DISABLED_KEY, createUmamiSink } from "../tracker/sinks/umami.js";
|
|
12
|
+
import { createNoopTracker, createTracker } from "../tracker/createTracker.js";
|
|
13
|
+
import { acquireTracker } from "../tracker/registry.js";
|
|
14
|
+
import { DEFAULT_TRACKER_ENDPOINT, initTracker } from "../tracker/initTracker.js";
|
|
15
|
+
export { CONSENT_QUEUE_LIMIT, CONSENT_STORAGE_KEY, DEFAULT_EXCLUSION_PARAM, DEFAULT_TRACKER_ENDPOINT, DOWNLOAD_EVENT, EXCLUSION_STORAGE_KEY, GA4_DISABLE_PREFIX, GOAL_ATTRIBUTE, OUTBOUND_EVENT, PAGEVIEW_BUFFER_MS, PLAUSIBLE_IGNORE_KEY, SCROLL_EVENT, UMAMI_DISABLED_KEY, acquireTracker, createAutoCapture, createConsentQueue, createGa4Sink, createNativeSink, createNoopTracker, createPageTracking, createPlausibleSink, createPosthogSink, createScriptLoader, createTracker, createUmamiSink, initTracker, readConsent, readExclusion, readExclusionParam, subscribeExclusion, writeConsent, writeExclusion };
|
package/dist/exports/types.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Goal, GoalMatch, TrackerGoal } from "../goals/types.js";
|
|
2
|
+
import { CaptureClientKind, CaptureSnippet, CaptureSupport, ProxyDescriptor, ProxyRoute, SnippetScript } from "../core/capture.js";
|
|
3
|
+
import { ServerEventInput, ServerTrack, ServerTrackOptions } from "../core/serverEvent.js";
|
|
4
|
+
import { AdapterContext, AdapterRegisterContext, AnalyticsAdapter, AnalyticsAdapterFactory, AnalyticsCapabilities, AnalyticsFilter, AnalyticsQuery, AnalyticsResult, AnalyticsRow, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, Granularity, MetricKey, PLATFORM_SCOPE, RateLimitDescriptor } from "../core/contract.js";
|
|
5
|
+
import { SerializedCapabilities } from "../core/capabilities.js";
|
|
6
|
+
import { ANALYTICS_ERROR_CODES, AnalyticsError, AnalyticsErrorCode, readErrorCode } from "../plugin/errors.js";
|
|
7
|
+
import { QueryError, QueryErrorCode } from "../query/errors.js";
|
|
8
|
+
import { QueryErrorResponse, QueryResponse, QuerySourceRef, SerializedAnalyticsQuery } from "../query/response.js";
|
|
9
|
+
import { QueryRequest, RefreshRequest, RefreshResponse } from "../query/fetchQuery.js";
|
|
2
10
|
import { AnalyticsBinding, BindingContext, HostnameResolver, PathResolver } from "../binding/types.js";
|
|
3
11
|
import { TimeframePreset } from "../timeframe/presets.js";
|
|
12
|
+
import { AnalyticsPluginOptions, AnalyticsViewAccess, AnalyticsViewOptions, ResolvedAutoCapture } from "../core/options.js";
|
|
13
|
+
import { AnalyticsViewClientProps, ViewGoal } from "../view/viewProps.js";
|
|
14
|
+
import { TrackerConfig, TrackerSlotConfig } from "../capture/trackerConfig.js";
|
|
4
15
|
import { AnalyticsFieldsOptions, AnalyticsMetricLabel, AnalyticsMetricLabels, AnalyticsStatOptions, AnalyticsStatRowOptions, AnalyticsTabOptions } from "../fields/factories.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
16
|
+
import { GoalFieldOptions } from "../goals/goalField.js";
|
|
17
|
+
import { GoalActionDefinition, GoalActionRunArgs, TrackGoalActionOptions } from "../goals/trackGoalAction.js";
|
|
18
|
+
import { TRAFFIC_CHANNELS, TrafficChannel } from "../native/ingest/source.js";
|
|
19
|
+
import { ParseResult, ParsedQuery } from "../query/parse.js";
|
|
20
|
+
export { ANALYTICS_ERROR_CODES, AdapterContext, AdapterRegisterContext, AnalyticsAdapter, AnalyticsAdapterFactory, type AnalyticsBinding, AnalyticsCapabilities, type AnalyticsError, type AnalyticsErrorCode, type AnalyticsFieldsOptions, AnalyticsFilter, type AnalyticsMetricLabel, type AnalyticsMetricLabels, type AnalyticsPluginOptions, AnalyticsQuery, AnalyticsResult, AnalyticsRow, type AnalyticsStatOptions, type AnalyticsStatRowOptions, type AnalyticsTabOptions, type AnalyticsViewAccess, type AnalyticsViewClientProps, type AnalyticsViewOptions, type BindingContext, CaptureClientKind, CaptureSnippet, CaptureSupport, DIMENSION_KEYS, DateRange, DimensionKey, FILTER_OPERATORS, FilterOperator, type Goal, type GoalActionDefinition, type GoalActionRunArgs, type GoalFieldOptions, type GoalMatch, Granularity, type HostnameResolver, MetricKey, PLATFORM_SCOPE, type ParseResult, type ParsedQuery, type PathResolver, ProxyDescriptor, ProxyRoute, type QueryError, type QueryErrorCode, type QueryErrorResponse, type QueryRequest, type QueryResponse, type QuerySourceRef, RateLimitDescriptor, type RefreshRequest, type RefreshResponse, type ResolvedAutoCapture, type SerializedAnalyticsQuery, type SerializedCapabilities, type ServerEventInput, type ServerTrack, type ServerTrackOptions, SnippetScript, TRAFFIC_CHANNELS, type TimeframePreset, type TrackGoalActionOptions, type TrackerConfig, type TrackerGoal, type TrackerSlotConfig, type TrafficChannel, type ViewGoal, readErrorCode };
|
package/dist/exports/types.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import { PLATFORM_SCOPE } from "../core/contract.js";
|
|
2
|
-
|
|
1
|
+
import { DIMENSION_KEYS, FILTER_OPERATORS, PLATFORM_SCOPE } from "../core/contract.js";
|
|
2
|
+
import { ANALYTICS_ERROR_CODES, readErrorCode } from "../plugin/errors.js";
|
|
3
|
+
import { TRAFFIC_CHANNELS } from "../native/ingest/source.js";
|
|
4
|
+
export { ANALYTICS_ERROR_CODES, DIMENSION_KEYS, FILTER_OPERATORS, PLATFORM_SCOPE, TRAFFIC_CHANNELS, readErrorCode };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { DOCUMENT_PATH } from "../plugin/paths.js";
|
|
2
3
|
import { keys } from "../translations/keys.js";
|
|
3
4
|
import { TIMEFRAME_PRESETS } from "../timeframe/presets.js";
|
|
4
5
|
import { METRIC_KEYS, TIMEFRAME_KEYS } from "../translations/metricKeys.js";
|
|
5
|
-
import { DOCUMENT_PATH } from "../plugin/paths.js";
|
|
6
6
|
import { TrendChart } from "../charts/TrendChart.js";
|
|
7
7
|
import { useTranslation as useTranslation$1 } from "../translations/useTranslation.js";
|
|
8
|
-
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
9
8
|
import { formatMetricValue } from "./format.js";
|
|
9
|
+
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
10
10
|
import { ComparisonDelta } from "../widgets/ComparisonDelta.js";
|
|
11
11
|
import { bucketSeries } from "../charts/bucket.js";
|
|
12
12
|
import { useCallback, useState } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asTranslate } from "../translations/server.js";
|
|
2
|
-
import { readForField } from "./readForDocument.js";
|
|
3
2
|
import { METRIC_KEYS } from "../translations/metricKeys.js";
|
|
3
|
+
import { readForField } from "./readForDocument.js";
|
|
4
4
|
import { resolveMetricLabel } from "./AnalyticsStatField.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/fields/AnalyticsPanelField.tsx
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { keys } from "../translations/keys.js";
|
|
2
2
|
import { asTranslate } from "../translations/server.js";
|
|
3
|
-
import { readForField } from "./readForDocument.js";
|
|
4
3
|
import { METRIC_KEYS, TIMEFRAME_KEYS } from "../translations/metricKeys.js";
|
|
5
|
-
import {
|
|
4
|
+
import { readForField } from "./readForDocument.js";
|
|
6
5
|
import { formatMetricValue } from "./format.js";
|
|
6
|
+
import { AnalyticsEmptyState, isNewDocumentAnalytics } from "./emptyState.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/fields/AnalyticsStatField.tsx
|
|
9
9
|
const resolveMetricLabel = (override, i18n, fallback) => {
|