webspresso 0.0.53 → 0.0.54
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
CHANGED
|
@@ -62,17 +62,20 @@ function siteAnalyticsPlugin(options = {}) {
|
|
|
62
62
|
|
|
63
63
|
ctx.app.use(trackingMiddleware);
|
|
64
64
|
|
|
65
|
-
// Client error tracking: public POST endpoint + inject script
|
|
66
65
|
if (trackClientErrors) {
|
|
67
|
-
const errorHandler = createErrorReportHandler({ knex, tableName: errorsTableName });
|
|
68
|
-
ctx.addRoute('post', '/_analytics/report-error', errorHandler);
|
|
69
|
-
|
|
70
66
|
const script = generateErrorTrackerScript({ endpoint: '/_analytics/report-error' });
|
|
71
67
|
ctx.injectBody(`<script>${script}</script>`, { id: 'site-analytics-error-tracker', priority: 5 });
|
|
72
68
|
}
|
|
73
69
|
},
|
|
74
70
|
|
|
75
71
|
onRoutesReady(ctx) {
|
|
72
|
+
// Client error report endpoint (must be in onRoutesReady - addRoute only mounts there)
|
|
73
|
+
if (trackClientErrors) {
|
|
74
|
+
const knex = db.knex || db;
|
|
75
|
+
const errorHandler = createErrorReportHandler({ knex, tableName: errorsTableName });
|
|
76
|
+
ctx.addRoute('post', '/_analytics/report-error', errorHandler);
|
|
77
|
+
}
|
|
78
|
+
|
|
76
79
|
const adminApi = ctx.usePlugin('admin-panel');
|
|
77
80
|
if (!adminApi) {
|
|
78
81
|
console.warn('[site-analytics] admin-panel plugin not found, skipping admin page registration');
|