@refraction-ui/astro 0.7.0 → 0.8.1
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/dist/analytics-sink-app-insights/app-insights-sink.ts +344 -0
- package/dist/analytics-sink-app-insights/index.ts +14 -0
- package/dist/analytics-sink-app-insights/mapping.ts +171 -0
- package/dist/analytics-sink-ga4/client-sdk-sink.ts +191 -0
- package/dist/analytics-sink-ga4/ga4-sink.ts +27 -0
- package/dist/analytics-sink-ga4/http-sink.ts +141 -0
- package/dist/analytics-sink-ga4/index.ts +20 -0
- package/dist/analytics-sink-ga4/mapping.ts +172 -0
- package/dist/analytics-sink-ga4/types.ts +94 -0
- package/dist/analytics-sink-posthog/client-sdk-sink.ts +160 -0
- package/dist/analytics-sink-posthog/http-sink.ts +214 -0
- package/dist/analytics-sink-posthog/index.ts +26 -0
- package/dist/analytics-sink-posthog/mapping.ts +155 -0
- package/dist/analytics-sink-posthog/replay.ts +152 -0
- package/dist/analytics-sink-posthog/sink.ts +37 -0
- package/dist/astro-analytics/index.ts +45 -0
- package/dist/shared/library-origin-error.ts +1 -2
- package/dist/shared/types.ts +1 -1
- package/dist/theme/theme-script.ts +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AnalyticsSink } from '../analytics/index.ts'
|
|
2
|
+
import {
|
|
3
|
+
createPostHogHttpSink,
|
|
4
|
+
type PostHogHttpSinkOptions,
|
|
5
|
+
} from './http-sink.js'
|
|
6
|
+
import {
|
|
7
|
+
createPostHogClientSdkSink,
|
|
8
|
+
type PostHogClientSdkSinkOptions,
|
|
9
|
+
} from './client-sdk-sink.js'
|
|
10
|
+
|
|
11
|
+
/** PostHog fan-out mode. `http` is the default (no browser library). */
|
|
12
|
+
export type PostHogSinkMode = 'http' | 'client-sdk'
|
|
13
|
+
|
|
14
|
+
export type PostHogSinkOptions =
|
|
15
|
+
| ({ mode?: 'http' } & PostHogHttpSinkOptions)
|
|
16
|
+
| ({ mode: 'client-sdk' } & PostHogClientSdkSinkOptions)
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a PostHog `AnalyticsSink`.
|
|
20
|
+
*
|
|
21
|
+
* - `mode: 'http'` (DEFAULT) — pure protocol adapter against PostHog's
|
|
22
|
+
* `/capture` + `/batch` API. No `posthog-js`. Server-relay friendly.
|
|
23
|
+
* - `mode: 'client-sdk'` — OPTIONAL. Lazily dynamic-imports `posthog-js`
|
|
24
|
+
* for client-exclusive features. Only loaded if this mode is selected.
|
|
25
|
+
*
|
|
26
|
+
* Session replay is NOT configurable here — import the separate
|
|
27
|
+
* `@refraction-ui/analytics-sink-posthog/replay` module to opt in. It is
|
|
28
|
+
* never on the event path and tree-shakes away when unused.
|
|
29
|
+
*/
|
|
30
|
+
export function createPostHogSink(
|
|
31
|
+
options: PostHogSinkOptions,
|
|
32
|
+
): AnalyticsSink {
|
|
33
|
+
if (options.mode === 'client-sdk') {
|
|
34
|
+
return createPostHogClientSdkSink(options)
|
|
35
|
+
}
|
|
36
|
+
return createPostHogHttpSink(options)
|
|
37
|
+
}
|
|
@@ -47,3 +47,48 @@ export {
|
|
|
47
47
|
type CreateMockSinkOptions,
|
|
48
48
|
type Redactor,
|
|
49
49
|
} from '../analytics/index.ts'
|
|
50
|
+
|
|
51
|
+
// Re-export vendor sink factories so consumers of the public meta can fan
|
|
52
|
+
// out to GA4 / Azure App Insights / PostHog. The sink packages stay private;
|
|
53
|
+
// they reach consumers only through this adapter (and the meta's `export *`).
|
|
54
|
+
// Named re-exports only — `export *` would collide on shared mapping helpers
|
|
55
|
+
// (each sink re-exports its own `mapEvent`). Mapping helpers are intentionally
|
|
56
|
+
// not surfaced here; only the sink factories + their option/type contracts.
|
|
57
|
+
export {
|
|
58
|
+
createGA4Sink,
|
|
59
|
+
createGA4HttpSink,
|
|
60
|
+
createGA4ClientSdkSink,
|
|
61
|
+
type GA4SinkOptions,
|
|
62
|
+
type GA4HttpOptions,
|
|
63
|
+
type GA4ClientSdkOptions,
|
|
64
|
+
type GA4ConsentBridge,
|
|
65
|
+
type ConsentState,
|
|
66
|
+
type GtagFn,
|
|
67
|
+
} from '../analytics-sink-ga4/index.ts'
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
createAppInsightsSink,
|
|
71
|
+
type AppInsightsSinkOptions,
|
|
72
|
+
type AppInsightsSinkMode,
|
|
73
|
+
type ClientSdkOptions,
|
|
74
|
+
type HttpOptions,
|
|
75
|
+
type AppInsightsLike,
|
|
76
|
+
} from '../analytics-sink-app-insights/index.ts'
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
createPostHogSink,
|
|
80
|
+
createPostHogHttpSink,
|
|
81
|
+
createPostHogClientSdkSink,
|
|
82
|
+
type PostHogSinkMode,
|
|
83
|
+
type PostHogSinkOptions,
|
|
84
|
+
type PostHogHttpSinkOptions,
|
|
85
|
+
type PostHogClientSdkSinkOptions,
|
|
86
|
+
} from '../analytics-sink-posthog/index.ts'
|
|
87
|
+
|
|
88
|
+
// Optional, lazy PostHog session replay (separate `./replay` entry point of
|
|
89
|
+
// the sink package — never on the event path, tree-shaken when unused).
|
|
90
|
+
export {
|
|
91
|
+
startSessionReplay,
|
|
92
|
+
type SessionReplayOptions,
|
|
93
|
+
type SessionReplayHandle,
|
|
94
|
+
} from '../analytics-sink-posthog/replay.ts'
|
|
@@ -22,7 +22,6 @@ const REFRACTION_FRAME = /@refraction-ui\//
|
|
|
22
22
|
/** Frameworks a refraction-ui adapter can run under. */
|
|
23
23
|
export type LibraryFramework =
|
|
24
24
|
| 'react'
|
|
25
|
-
| 'angular'
|
|
26
25
|
| 'astro'
|
|
27
26
|
| 'vue'
|
|
28
27
|
| 'svelte'
|
|
@@ -203,7 +202,7 @@ export type LibraryOriginIdentity = Pick<
|
|
|
203
202
|
|
|
204
203
|
/**
|
|
205
204
|
* The single capture primitive shared by every per-framework seam (React error
|
|
206
|
-
* boundary,
|
|
205
|
+
* boundary, Astro middleware). It performs the entire
|
|
207
206
|
* guarded flow in one place so the seams stay thin and identical in behavior:
|
|
208
207
|
*
|
|
209
208
|
* 1. **Library-origin filter** — if the error's stack has no
|
package/dist/shared/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Framework-agnostic base prop types for all refraction-ui components.
|
|
3
|
-
* These are headless core types — no React
|
|
3
|
+
* These are headless core types — no React or Astro imports.
|
|
4
4
|
* Framework wrappers extend these with framework-specific types.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inline script for preventing theme flash on page load.
|
|
3
3
|
* Inject this as a <script> tag in the <head> before any CSS.
|
|
4
|
-
* Works with any framework (React,
|
|
4
|
+
* Works with any framework (React, Astro, plain HTML).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export function getThemeScript(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refraction-ui/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "All Refraction UI Astro components in one package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "node build.mjs"
|
|
13
|
+
"build": "node build.mjs",
|
|
14
|
+
"test": "vitest run --passWithNoTests",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"test:coverage": "vitest run --coverage --passWithNoTests"
|
|
14
17
|
},
|
|
18
|
+
"dependencies": {},
|
|
15
19
|
"peerDependencies": {
|
|
16
20
|
"astro": ">=4.0.0"
|
|
17
21
|
},
|