feat: track Memind product analytics
This commit is contained in:
+14
-1
@@ -13,7 +13,12 @@ import { createWikiAuth } from './wiki-auth.mjs';
|
||||
import { isLocalDevHostname } from './scripts/local-test-config.mjs';
|
||||
import { PUBLISH_ROOT_DIR } from './user-publish.mjs';
|
||||
import { startWorkspaceThumbnailWatcher } from './mindspace-workspace-thumbnails.mjs';
|
||||
import { resolveMindSpaceAnalyticsConfig, sendMindSpaceAnalyticsEvent } from './mindspace-analytics.mjs';
|
||||
import {
|
||||
buildProductAnalyticsContext,
|
||||
resolveMindSpaceAnalyticsConfig,
|
||||
resolveProductAnalyticsConfig,
|
||||
sendMindSpaceAnalyticsEvent,
|
||||
} from './mindspace-analytics.mjs';
|
||||
import { resolveMindSpaceRybbitConfig } from './mindspace-rybbit.mjs';
|
||||
import { startWorkspaceAssetSyncWatcher } from './mindspace-workspace-sync.mjs';
|
||||
import { attachRequestId, sendData, sendError } from './api-response.mjs';
|
||||
@@ -689,6 +694,8 @@ api.use(createPortalApiAuthMiddleware({
|
||||
getLegacySessionToken: legacySessionToken,
|
||||
isPageDataPublicPath,
|
||||
isLegacyPageDataApiPath,
|
||||
isProductAnalyticsPublicPath: (requestPath, method) =>
|
||||
method === 'GET' && requestPath === '/analytics/context',
|
||||
accessPolicyMode: portalAccessPolicyMode,
|
||||
accessEnforcementConfig: portalAccessEnforcementConfig,
|
||||
accessShadowReporter: portalAccessShadowReporter,
|
||||
@@ -699,6 +706,12 @@ attachPortalImageMakeRuntimeConfigRoute(api, {
|
||||
getImageMakeAdminConfigService: () => imageMakeAdminConfigService,
|
||||
});
|
||||
|
||||
api.get('/analytics/context', (req, res) => {
|
||||
const config = resolveProductAnalyticsConfig(process.env, mindSpaceAnalyticsConfig);
|
||||
res.set('Cache-Control', 'private, no-store');
|
||||
res.json(buildProductAnalyticsContext({ config, user: req.currentUser ?? null }));
|
||||
});
|
||||
|
||||
attachAsrRoutes(api, { sendError, sendData });
|
||||
attachMindSpaceImageGenerationRoutes(api, {
|
||||
getService: () => mindSpaceImageGeneration,
|
||||
|
||||
Reference in New Issue
Block a user