@a2f0/skyline 0.2.61 → 0.2.62
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/package.json +5 -5
- package/site/vendor/ct-client.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2f0/skyline",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62",
|
|
4
4
|
"description": "Interactive Chicago skyline viewer and reusable Three.js building models",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
|
-
"packageManager": "bun@1.4.
|
|
14
|
+
"packageManager": "bun@1.4.4",
|
|
15
15
|
"sideEffects": [
|
|
16
16
|
"./site/**/*.js"
|
|
17
17
|
],
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@a2f0/ct-client": "0.1.
|
|
63
|
+
"@a2f0/ct-client": "0.1.7",
|
|
64
64
|
"@types/three": "0.186.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@a2f0/agent-tool": "0.1.
|
|
97
|
+
"@a2f0/agent-tool": "0.1.40",
|
|
98
98
|
"@tsconfig/strictest": "^2.0.8",
|
|
99
|
-
"@types/bun": "^1.4.
|
|
99
|
+
"@types/bun": "^1.4.4",
|
|
100
100
|
"esbuild": "0.28.2",
|
|
101
101
|
"playwright": "1.64.1",
|
|
102
102
|
"three": "0.186.1",
|
package/site/vendor/ct-client.js
CHANGED
|
@@ -13,7 +13,7 @@ function safePage(value) {
|
|
|
13
13
|
const path = value.split(/[?#]/, 1)[0] ?? "/";
|
|
14
14
|
return /^\/[a-zA-Z0-9/:_.-]{0,199}$/.test(path) ? path : "/";
|
|
15
15
|
}
|
|
16
|
-
function clickTarget(event, capture) {
|
|
16
|
+
function clickTarget(event, capture, defaultApp = null) {
|
|
17
17
|
const path = event.composedPath();
|
|
18
18
|
const elements = path.filter((item) => item instanceof Element);
|
|
19
19
|
if (elements.some((element) => element.matches("[data-ct-ignore], input, textarea, select, [contenteditable]:not([contenteditable='false'])")))
|
|
@@ -23,8 +23,10 @@ function clickTarget(event, capture) {
|
|
|
23
23
|
if (!target)
|
|
24
24
|
return null;
|
|
25
25
|
const label = target.getAttribute("data-ct");
|
|
26
|
+
const app = elements.find((element) => element.hasAttribute("data-ct-app"))?.getAttribute("data-ct-app");
|
|
26
27
|
const tag = target.tagName.toLowerCase();
|
|
27
28
|
return {
|
|
29
|
+
app: app === undefined ? defaultApp : app && /^[a-z0-9][a-z0-9-]{0,63}$/.test(app) ? app : null,
|
|
28
30
|
target: /^[a-z][a-z0-9-]{0,31}$/.test(tag) ? tag : "unknown",
|
|
29
31
|
label: label && /^[a-zA-Z0-9_.:-]{1,80}$/.test(label) ? label : null
|
|
30
32
|
};
|
|
@@ -80,7 +82,11 @@ function createTracker(options) {
|
|
|
80
82
|
const response = await fetch(endpoint, {
|
|
81
83
|
method: "POST",
|
|
82
84
|
headers: { "Content-Type": "text/plain;charset=UTF-8" },
|
|
83
|
-
body: JSON.stringify({
|
|
85
|
+
body: JSON.stringify({
|
|
86
|
+
site: options.site,
|
|
87
|
+
environment: options.environment,
|
|
88
|
+
events: batch
|
|
89
|
+
}),
|
|
84
90
|
credentials: "omit",
|
|
85
91
|
referrerPolicy: "no-referrer",
|
|
86
92
|
keepalive: true,
|
|
@@ -122,7 +128,7 @@ function createTracker(options) {
|
|
|
122
128
|
function click(event) {
|
|
123
129
|
if (!event.isTrusted || blocked())
|
|
124
130
|
return;
|
|
125
|
-
const target = clickTarget(event, options.capture ?? "interactive");
|
|
131
|
+
const target = clickTarget(event, options.capture ?? "interactive", options.app ?? null);
|
|
126
132
|
if (!target || queue.length >= capacity)
|
|
127
133
|
return;
|
|
128
134
|
try {
|
|
@@ -162,6 +168,10 @@ function createTracker(options) {
|
|
|
162
168
|
return false;
|
|
163
169
|
if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(options.site))
|
|
164
170
|
throw new Error("Invalid ct site identifier");
|
|
171
|
+
if (options.app !== undefined && !/^[a-z0-9][a-z0-9-]{0,63}$/.test(options.app))
|
|
172
|
+
throw new Error("Invalid ct app identifier");
|
|
173
|
+
if (options.environment !== undefined && !["production", "staging"].includes(options.environment))
|
|
174
|
+
throw new Error("Invalid ct environment");
|
|
165
175
|
const url = new URL(endpoint);
|
|
166
176
|
if (url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1"].includes(url.hostname)))
|
|
167
177
|
throw new Error("ct requires an HTTPS endpoint");
|