fulldev-ui 0.14.0 → 0.14.2
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 +12 -0
- package/README.md +1 -1
- package/package.json +7 -13
- package/public/r/layout.json +1 -1
- package/public/r/navigation-menu.json +2 -2
- package/src/components/ui/layout/layout-head.astro +12 -3
- package/src/components/ui/navigation-menu/navigation-menu-trigger-style.ts +1 -1
- package/src/components/ui/navigation-menu/navigation-menu-trigger.astro +1 -1
- package/src/lib/analytics-interactions.js +72 -0
- package/src/lib/analytics-privacy.js +46 -0
- package/src/lib/analytics.ts +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Fulldev UI
|
|
2
2
|
|
|
3
|
+
## 0.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#213](https://github.com/fulldotdev/ui/pull/213) [`1304c8b`](https://github.com/fulldotdev/ui/commit/1304c8b49e14a6f4cf3576433014ecf396019913) Thanks [@silveltman](https://github.com/silveltman)! - Improve the `LayoutHead` social tags: add `twitter:card` (`summary_large_image` with an image, `summary` without), emit `og:image:type` for optimized images, skip `og:image` when the image source is empty, and follow `trailingSlash: "never"` in the canonical and `og:url`.
|
|
8
|
+
|
|
9
|
+
## 0.14.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#202](https://github.com/fulldotdev/ui/pull/202) [`30b1949`](https://github.com/fulldotdev/ui/commit/30b19499edf55ba3ae15490562334f50476f21c0) Thanks [@silveltman](https://github.com/silveltman)! - Match Navigation Menu trigger styling and chevron rotation to Data Slot's data-state attribute, while retaining compatibility with data-open and data-popup-open.
|
|
14
|
+
|
|
3
15
|
## 0.14.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fulldev-ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.2",
|
|
5
5
|
"description": "Open-source Astro UI components and blocks",
|
|
6
6
|
"homepage": "https://ui.full.dev",
|
|
7
7
|
"bugs": "https://github.com/fulldotdev/ui/issues",
|
|
@@ -83,23 +83,22 @@
|
|
|
83
83
|
"astro-robots-txt": "^1.0.0",
|
|
84
84
|
"class-variance-authority": "^0.7.1",
|
|
85
85
|
"clsx": "^2.1.1",
|
|
86
|
+
"embla-carousel": "8.6.0",
|
|
86
87
|
"lucide-static": "^1.22.0",
|
|
88
|
+
"posthog-js": "1.434.15",
|
|
87
89
|
"shadcn": "^4.12.0",
|
|
88
90
|
"simple-icons": "^16.24.1",
|
|
89
91
|
"simple-icons-astro": "^16.1.0",
|
|
90
92
|
"tailwind-merge": "^3.6.0",
|
|
91
93
|
"tailwindcss": "^4.3.2",
|
|
92
94
|
"tw-animate-css": "^1.4.0",
|
|
93
|
-
"typescript": "^6.0.3"
|
|
94
|
-
"embla-carousel": "8.6.0"
|
|
95
|
+
"typescript": "^6.0.3"
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
97
|
-
"@argos-ci/playwright": "^7.6.0",
|
|
98
98
|
"@astrojs/check": "^0.9.9",
|
|
99
99
|
"@changesets/changelog-github": "^0.7.0",
|
|
100
100
|
"@changesets/cli": "^2.31.0",
|
|
101
101
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
102
|
-
"@playwright/test": "^1.63.0",
|
|
103
102
|
"prettier": "3.9.3",
|
|
104
103
|
"prettier-plugin-astro": "0.14.1",
|
|
105
104
|
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
@@ -108,23 +107,18 @@
|
|
|
108
107
|
"scripts": {
|
|
109
108
|
"astro": "astro",
|
|
110
109
|
"dev": "pnpm stop && astro dev --host 127.0.0.1 --port 4321",
|
|
111
|
-
"start": "pnpm dev",
|
|
112
110
|
"stop": "lsof -tiTCP:4321 -sTCP:LISTEN | xargs kill 2>/dev/null || true",
|
|
113
111
|
"preview": "pnpm stop && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
114
112
|
"typecheck": "astro check",
|
|
115
|
-
"
|
|
116
|
-
"check": "pnpm format:check && pnpm typecheck",
|
|
113
|
+
"check": "pnpm format:check && pnpm typecheck && pnpm registry:check",
|
|
117
114
|
"build": "astro build",
|
|
118
|
-
"build:prod": "pnpm check && pnpm registry:build && pnpm build",
|
|
119
|
-
"build:preview": "pnpm registry:build && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
120
|
-
"build:test": "pnpm check && pnpm registry:build && pnpm build && astro preview --host 127.0.0.1 --port 4321",
|
|
121
115
|
"registry:build": "pnpm registry:meta && shadcn build && pnpm format:write --log-level warn",
|
|
122
116
|
"registry:check": "pnpm registry:build && git diff --exit-code -- registry.json public/r",
|
|
123
117
|
"format:write": "prettier --write .",
|
|
124
118
|
"format:check": "prettier --check .",
|
|
125
119
|
"release": "changeset version && pnpm install --lockfile-only",
|
|
126
|
-
"release:publish": "pnpm registry:check &&
|
|
120
|
+
"release:publish": "pnpm registry:check && changeset publish",
|
|
127
121
|
"registry:meta": "node scripts/registry-meta.mjs",
|
|
128
|
-
"
|
|
122
|
+
"format": "prettier --write ."
|
|
129
123
|
}
|
|
130
124
|
}
|
package/public/r/layout.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "src/components/ui/layout/layout-head.astro",
|
|
17
|
-
"content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Font, getImage } from \"astro:assets\"\nimport { AstroSeo } from \"@lexingtonthemes/seo\"\n\ntype Props = {\n name?: string\n title?: string\n description?: string\n image?: {\n src?: ImageMetadata | string\n alt?: string\n }\n noindex?: boolean\n nofollow?: boolean\n canonical?: string\n}\n\nconst baseUrl = Astro.site?.origin || Astro.url.origin\nconst
|
|
17
|
+
"content": "---\nimport type { ImageMetadata } from \"astro\"\nimport { Font, getImage } from \"astro:assets\"\nimport { trailingSlash } from \"astro:config/server\"\nimport { AstroSeo } from \"@lexingtonthemes/seo\"\n\ntype Props = {\n name?: string\n title?: string\n description?: string\n image?: {\n src?: ImageMetadata | string\n alt?: string\n }\n noindex?: boolean\n nofollow?: boolean\n canonical?: string\n}\n\nconst baseUrl = Astro.site?.origin || Astro.url.origin\nconst pathnameWithSlash = Astro.url.pathname.endsWith(\"/\")\n ? Astro.url.pathname\n : `${Astro.url.pathname}/`\nconst pagePathname =\n trailingSlash === \"never\" && pathnameWithSlash !== \"/\"\n ? pathnameWithSlash.slice(0, -1)\n : pathnameWithSlash\n\nconst {\n name,\n title,\n description,\n image,\n noindex,\n nofollow,\n canonical,\n ...props\n} = Astro.props\n\nconst resolvedCanonical = new URL(canonical || pagePathname, baseUrl).toString()\n\nconst toImageMimeType = (format?: string) => {\n if (!format) return undefined\n if (format.includes(\"/\")) return format\n if (format === \"jpg\") return \"image/jpeg\"\n if (format === \"svg\") return \"image/svg+xml\"\n return `image/${format}`\n}\n\nconst transformedImage =\n image?.src && typeof image.src !== \"string\"\n ? await getImage({\n src: image.src,\n format: \"png\",\n width: 1200,\n height: 630,\n quality: \"medium\",\n })\n : undefined\n\nconst openGraphImage =\n image?.src && typeof image.src === \"string\"\n ? {\n url: new URL(image.src, baseUrl).toString(),\n alt: image.alt,\n }\n : transformedImage\n ? {\n url: new URL(transformedImage.src, baseUrl).toString(),\n alt: image?.alt,\n width: transformedImage.attributes.width,\n height: transformedImage.attributes.height,\n type: toImageMimeType(transformedImage.options.format),\n }\n : undefined\n---\n\n<head data-slot=\"layout-head\" {...props}>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta name=\"generator\" content={Astro.generator} />\n <meta charset=\"utf-8\" />\n <Font cssVariable=\"--font-sans\" />\n <Font cssVariable=\"--font-mono\" />\n <AstroSeo\n title={title}\n description={description}\n canonical={resolvedCanonical}\n noindex={noindex}\n nofollow={nofollow}\n openGraph={{\n url: resolvedCanonical,\n type: \"website\",\n ...(name && { site_name: name }),\n ...(openGraphImage && {\n images: [\n {\n ...openGraphImage,\n ...(openGraphImage.url.startsWith(\"https://\") && {\n secureUrl: openGraphImage.url,\n }),\n },\n ],\n }),\n }}\n twitter={{\n cardType: openGraphImage ? \"summary_large_image\" : \"summary\",\n }}\n />\n <slot />\n</head>\n",
|
|
18
18
|
"type": "registry:ui"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"path": "src/components/ui/navigation-menu/navigation-menu-trigger.astro",
|
|
43
|
-
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronDownIcon from \"@lucide/astro/icons/chevron-down\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport navigationMenuTriggerStyle from \"./navigation-menu-trigger-style\"\n\ntype Props = HTMLAttributes<\"button\">\n\nconst { class: className, type = \"button\", ...props } = Astro.props\n---\n\n<button\n data-slot=\"navigation-menu-trigger\"\n type={type}\n class={cn(navigationMenuTriggerStyle(), \"group\", className)}\n {...props}\n>\n <slot />\n {\" \"}\n <ChevronDownIcon\n class=\"relative top-px ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180\"\n aria-hidden=\"true\"\n />\n</button>\n",
|
|
43
|
+
"content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport ChevronDownIcon from \"@lucide/astro/icons/chevron-down\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport navigationMenuTriggerStyle from \"./navigation-menu-trigger-style\"\n\ntype Props = HTMLAttributes<\"button\">\n\nconst { class: className, type = \"button\", ...props } = Astro.props\n---\n\n<button\n data-slot=\"navigation-menu-trigger\"\n type={type}\n class={cn(navigationMenuTriggerStyle(), \"group\", className)}\n {...props}\n>\n <slot />\n {\" \"}\n <ChevronDownIcon\n class=\"relative top-px ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-[state=open]/navigation-menu-trigger:rotate-180\"\n aria-hidden=\"true\"\n />\n</button>\n",
|
|
44
44
|
"type": "registry:ui"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"path": "src/components/ui/navigation-menu/navigation-menu-trigger-style.ts",
|
|
48
|
-
"content": "import { cva } from \"class-variance-authority\"\n\nconst navigationMenuTriggerStyle = cva(\n \"group/navigation-menu-trigger hover:bg-muted focus:bg-muted focus-visible:ring-ring/50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-all outline-none focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50\"\n)\n\nexport default navigationMenuTriggerStyle\n",
|
|
48
|
+
"content": "import { cva } from \"class-variance-authority\"\n\nconst navigationMenuTriggerStyle = cva(\n \"group/navigation-menu-trigger hover:bg-muted focus:bg-muted focus-visible:ring-ring/50 data-[state=open]:bg-muted/50 data-[state=open]:hover:bg-muted data-[state=open]:focus:bg-muted data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-all outline-none focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50\"\n)\n\nexport default navigationMenuTriggerStyle\n",
|
|
49
49
|
"type": "registry:ui"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { ImageMetadata } from "astro"
|
|
3
3
|
import { Font, getImage } from "astro:assets"
|
|
4
|
+
import { trailingSlash } from "astro:config/server"
|
|
4
5
|
import { AstroSeo } from "@lexingtonthemes/seo"
|
|
5
6
|
|
|
6
7
|
type Props = {
|
|
@@ -17,9 +18,13 @@ type Props = {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const baseUrl = Astro.site?.origin || Astro.url.origin
|
|
20
|
-
const
|
|
21
|
+
const pathnameWithSlash = Astro.url.pathname.endsWith("/")
|
|
21
22
|
? Astro.url.pathname
|
|
22
23
|
: `${Astro.url.pathname}/`
|
|
24
|
+
const pagePathname =
|
|
25
|
+
trailingSlash === "never" && pathnameWithSlash !== "/"
|
|
26
|
+
? pathnameWithSlash.slice(0, -1)
|
|
27
|
+
: pathnameWithSlash
|
|
23
28
|
|
|
24
29
|
const {
|
|
25
30
|
name,
|
|
@@ -38,6 +43,7 @@ const toImageMimeType = (format?: string) => {
|
|
|
38
43
|
if (!format) return undefined
|
|
39
44
|
if (format.includes("/")) return format
|
|
40
45
|
if (format === "jpg") return "image/jpeg"
|
|
46
|
+
if (format === "svg") return "image/svg+xml"
|
|
41
47
|
return `image/${format}`
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -53,7 +59,7 @@ const transformedImage =
|
|
|
53
59
|
: undefined
|
|
54
60
|
|
|
55
61
|
const openGraphImage =
|
|
56
|
-
typeof image
|
|
62
|
+
image?.src && typeof image.src === "string"
|
|
57
63
|
? {
|
|
58
64
|
url: new URL(image.src, baseUrl).toString(),
|
|
59
65
|
alt: image.alt,
|
|
@@ -64,7 +70,7 @@ const openGraphImage =
|
|
|
64
70
|
alt: image?.alt,
|
|
65
71
|
width: transformedImage.attributes.width,
|
|
66
72
|
height: transformedImage.attributes.height,
|
|
67
|
-
type: toImageMimeType(transformedImage.
|
|
73
|
+
type: toImageMimeType(transformedImage.options.format),
|
|
68
74
|
}
|
|
69
75
|
: undefined
|
|
70
76
|
---
|
|
@@ -96,6 +102,9 @@ const openGraphImage =
|
|
|
96
102
|
],
|
|
97
103
|
}),
|
|
98
104
|
}}
|
|
105
|
+
twitter={{
|
|
106
|
+
cardType: openGraphImage ? "summary_large_image" : "summary",
|
|
107
|
+
}}
|
|
99
108
|
/>
|
|
100
109
|
<slot />
|
|
101
110
|
</head>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority"
|
|
2
2
|
|
|
3
3
|
const navigationMenuTriggerStyle = cva(
|
|
4
|
-
"group/navigation-menu-trigger hover:bg-muted focus:bg-muted focus-visible:ring-ring/50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-all outline-none focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50"
|
|
4
|
+
"group/navigation-menu-trigger hover:bg-muted focus:bg-muted focus-visible:ring-ring/50 data-[state=open]:bg-muted/50 data-[state=open]:hover:bg-muted data-[state=open]:focus:bg-muted data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted inline-flex h-9 w-max items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-all outline-none focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50"
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
export default navigationMenuTriggerStyle
|
|
@@ -20,7 +20,7 @@ const { class: className, type = "button", ...props } = Astro.props
|
|
|
20
20
|
<slot />
|
|
21
21
|
{" "}
|
|
22
22
|
<ChevronDownIcon
|
|
23
|
-
class="relative top-px ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180"
|
|
23
|
+
class="relative top-px ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-[state=open]/navigation-menu-trigger:rotate-180"
|
|
24
24
|
aria-hidden="true"
|
|
25
25
|
/>
|
|
26
26
|
</button>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
let started = false
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Record intent only, never form values, link text or contact details.
|
|
5
|
+
* @param {{ capture: (name: string, properties: Record<string, string>) => unknown }} posthog
|
|
6
|
+
*/
|
|
7
|
+
export function trackInteractions(posthog) {
|
|
8
|
+
if (started) return
|
|
9
|
+
started = true
|
|
10
|
+
const ignored =
|
|
11
|
+
".ph-no-capture, .ph-no-autocapture, [data-ph-no-capture], [data-ph-no-autocapture]"
|
|
12
|
+
const capture = (/** @type {string} */ type) => {
|
|
13
|
+
posthog.capture("website_interaction", { interaction_type: type })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
document.addEventListener(
|
|
17
|
+
"submit",
|
|
18
|
+
(event) => {
|
|
19
|
+
if (
|
|
20
|
+
event.target instanceof HTMLFormElement &&
|
|
21
|
+
!event.target.closest(ignored)
|
|
22
|
+
) {
|
|
23
|
+
capture("form_submit_attempt")
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
true
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
document.addEventListener(
|
|
30
|
+
"click",
|
|
31
|
+
(event) => {
|
|
32
|
+
if (!(event.target instanceof Element) || event.target.closest(ignored))
|
|
33
|
+
return
|
|
34
|
+
const link = event.target.closest("a[href]")
|
|
35
|
+
if (!(link instanceof HTMLAnchorElement)) return
|
|
36
|
+
let url
|
|
37
|
+
try {
|
|
38
|
+
url = new URL(link.href)
|
|
39
|
+
} catch {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
if (url.protocol === "tel:") capture("phone_click")
|
|
43
|
+
else if (url.protocol === "mailto:") capture("email_click")
|
|
44
|
+
else if (url.protocol === "whatsapp:") capture("whatsapp_click")
|
|
45
|
+
else if (
|
|
46
|
+
link.hasAttribute("download") &&
|
|
47
|
+
(url.protocol === "blob:" || url.protocol === "data:")
|
|
48
|
+
) {
|
|
49
|
+
capture("download_click")
|
|
50
|
+
} else if (url.protocol === "https:" || url.protocol === "http:") {
|
|
51
|
+
if (
|
|
52
|
+
["wa.me", "api.whatsapp.com", "web.whatsapp.com"].includes(
|
|
53
|
+
url.hostname
|
|
54
|
+
)
|
|
55
|
+
) {
|
|
56
|
+
capture("whatsapp_click")
|
|
57
|
+
} else if (
|
|
58
|
+
link.hasAttribute("download") ||
|
|
59
|
+
/\.(pdf|docx?|xlsx?|pptx?|csv|zip)$/i.test(url.pathname)
|
|
60
|
+
) {
|
|
61
|
+
capture("download_click")
|
|
62
|
+
} else if (
|
|
63
|
+
url.hostname.replace(/^www\./, "") !==
|
|
64
|
+
window.location.hostname.replace(/^www\./, "")
|
|
65
|
+
) {
|
|
66
|
+
capture("outbound_click")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ capture: true, passive: true }
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Remove URL details from exceptions; redact ambiguous text as a whole. */
|
|
2
|
+
export function sanitizeExceptionUrls(event) {
|
|
3
|
+
if (event?.event !== "$exception") return event
|
|
4
|
+
const seen = new WeakSet()
|
|
5
|
+
const clean = (value) => {
|
|
6
|
+
if (typeof value === "string") {
|
|
7
|
+
if (!/[?#@]/.test(value)) return value
|
|
8
|
+
const normalized = value.replace(/\\/g, "/")
|
|
9
|
+
// Only preserve an unambiguous standalone URL or relative filename.
|
|
10
|
+
if (
|
|
11
|
+
/\s|["'<>]/.test(normalized) ||
|
|
12
|
+
!/^(?:https?:|\/|\.\.?\/|[\w.-]+[?#])/i.test(normalized)
|
|
13
|
+
) {
|
|
14
|
+
return "[redacted-url-details]"
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const absolute = /^https?:/i.test(normalized)
|
|
18
|
+
const parsed = new URL(
|
|
19
|
+
normalized,
|
|
20
|
+
absolute ? undefined : "https://redacted.invalid"
|
|
21
|
+
)
|
|
22
|
+
if (/https?:|\/\/|@/i.test(parsed.pathname))
|
|
23
|
+
return "[redacted-url-details]"
|
|
24
|
+
const prefix = absolute
|
|
25
|
+
? parsed.protocol + "//" + parsed.host
|
|
26
|
+
: normalized.startsWith("//")
|
|
27
|
+
? "//" + parsed.host
|
|
28
|
+
: ""
|
|
29
|
+
const pathname =
|
|
30
|
+
!absolute && !normalized.startsWith("/")
|
|
31
|
+
? parsed.pathname.slice(1)
|
|
32
|
+
: parsed.pathname
|
|
33
|
+
return prefix + pathname
|
|
34
|
+
} catch {
|
|
35
|
+
return "[redacted-url-details]"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (value && typeof value === "object" && !seen.has(value)) {
|
|
39
|
+
seen.add(value)
|
|
40
|
+
for (const key of Object.keys(value)) value[key] = clean(value[key])
|
|
41
|
+
}
|
|
42
|
+
return value
|
|
43
|
+
}
|
|
44
|
+
clean(event.properties)
|
|
45
|
+
return event
|
|
46
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "posthog-js/dist/web-vitals"
|
|
2
|
+
|
|
3
|
+
import { sanitizeExceptionUrls } from "./analytics-privacy.js"
|
|
4
|
+
|
|
5
|
+
import "posthog-js/dist/exception-autocapture"
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
AnalyticsExtensions,
|
|
9
|
+
ErrorTrackingExtensions,
|
|
10
|
+
} from "posthog-js/dist/extension-bundles"
|
|
11
|
+
import posthog from "posthog-js/dist/module.slim.no-external"
|
|
12
|
+
|
|
13
|
+
import { trackInteractions } from "./analytics-interactions.js"
|
|
14
|
+
|
|
15
|
+
export function startAnalytics() {
|
|
16
|
+
posthog.init("phc_mVacbe8Xydu0UZlh4bNw5EGisvzyRcpqXEEuEEp5lOY", {
|
|
17
|
+
api_host: "https://eu.i.posthog.com",
|
|
18
|
+
defaults: "2025-11-30",
|
|
19
|
+
cookieless_mode: "always",
|
|
20
|
+
person_profiles: "never",
|
|
21
|
+
autocapture: false,
|
|
22
|
+
__extensionClasses: {
|
|
23
|
+
...ErrorTrackingExtensions,
|
|
24
|
+
webVitalsAutocapture: AnalyticsExtensions.webVitalsAutocapture,
|
|
25
|
+
},
|
|
26
|
+
capture_exceptions: {
|
|
27
|
+
capture_unhandled_errors: true,
|
|
28
|
+
capture_unhandled_rejections: true,
|
|
29
|
+
capture_console_errors: true,
|
|
30
|
+
},
|
|
31
|
+
capture_performance: { web_vitals: true, web_vitals_attribution: false },
|
|
32
|
+
mask_personal_data_properties: true,
|
|
33
|
+
custom_personal_data_properties: [
|
|
34
|
+
"email",
|
|
35
|
+
"phone",
|
|
36
|
+
"name",
|
|
37
|
+
"password",
|
|
38
|
+
"token",
|
|
39
|
+
"access_token",
|
|
40
|
+
"refresh_token",
|
|
41
|
+
"code",
|
|
42
|
+
],
|
|
43
|
+
disable_capture_url_hashes: true,
|
|
44
|
+
property_denylist: [
|
|
45
|
+
"$referrer",
|
|
46
|
+
"$initial_referrer",
|
|
47
|
+
"$session_entry_referrer",
|
|
48
|
+
],
|
|
49
|
+
loaded: trackInteractions,
|
|
50
|
+
before_send: sanitizeExceptionUrls,
|
|
51
|
+
capture_pageview: true,
|
|
52
|
+
capture_pageleave: true,
|
|
53
|
+
disable_session_recording: true,
|
|
54
|
+
disable_surveys: true,
|
|
55
|
+
advanced_disable_flags: true,
|
|
56
|
+
disable_external_dependency_loading: true,
|
|
57
|
+
})
|
|
58
|
+
}
|