@philcrp/analytics 1.6.3 → 1.6.5

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.
@@ -0,0 +1,729 @@
1
+ // src/manager.ts
2
+ var AnalyticsManager = class {
3
+ constructor(business, debug = false) {
4
+ this.providers = /* @__PURE__ */ new Map();
5
+ this.globalContext = {};
6
+ this.initialized = false;
7
+ this.business = business;
8
+ this.debug = debug;
9
+ }
10
+ /**
11
+ * 注册分析工具提供商
12
+ */
13
+ registerProvider(name, provider) {
14
+ this.providers.set(name, provider);
15
+ this.log(`Registered provider: ${name}`);
16
+ return this;
17
+ }
18
+ /**
19
+ * 移除分析工具提供商
20
+ */
21
+ unregisterProvider(name) {
22
+ this.providers.delete(name);
23
+ this.log(`Unregistered provider: ${name}`);
24
+ return this;
25
+ }
26
+ getProvider(name) {
27
+ return this.providers.get(name);
28
+ }
29
+ /**
30
+ * 获取所有提供商
31
+ */
32
+ getAllProviders() {
33
+ return Array.from(this.providers.values());
34
+ }
35
+ /**
36
+ * 初始化所有提供商
37
+ */
38
+ async initialize() {
39
+ if (this.initialized) {
40
+ this.log("Already initialized");
41
+ return;
42
+ }
43
+ const results = await this.executeOnAllProviders("initialize");
44
+ this.initialized = true;
45
+ this.log(`Initialized ${results.success.length}/${this.providers.size} providers`);
46
+ if (results.errors.length > 0) {
47
+ console.warn(`[AnalyticsManager] ${results.errors.length} providers failed to initialize`);
48
+ }
49
+ }
50
+ /**
51
+ * 追踪事件到所有提供商
52
+ */
53
+ async track(event) {
54
+ if (!this.ensureInitialized()) return;
55
+ const enrichedEvent = this.enrichEvent(event);
56
+ await this.executeOnAllProviders("track", enrichedEvent);
57
+ }
58
+ /**
59
+ * 类型安全的事件追踪
60
+ */
61
+ async trackEvent(eventName, properties) {
62
+ await this.track({
63
+ name: eventName,
64
+ properties
65
+ });
66
+ }
67
+ /**
68
+ * 识别用户
69
+ */
70
+ async identify(userId, properties) {
71
+ if (!this.ensureInitialized()) return;
72
+ const mergedProperties = { ...this.globalContext, ...properties };
73
+ await this.executeOnAllProviders("identify", userId, mergedProperties);
74
+ }
75
+ /**
76
+ * 追踪页面浏览
77
+ */
78
+ async trackPageView(page, properties) {
79
+ if (!this.ensureInitialized()) return;
80
+ const mergedProperties = { ...this.globalContext, ...properties };
81
+ await this.executeOnAllProviders("trackPageView", page, mergedProperties);
82
+ }
83
+ /**
84
+ * 重置用户身份
85
+ */
86
+ async reset() {
87
+ if (!this.ensureInitialized()) return;
88
+ await this.executeOnAllProviders("reset");
89
+ }
90
+ /**
91
+ * 设置全局上下文
92
+ */
93
+ setGlobalContext(context) {
94
+ this.globalContext = { ...this.globalContext, ...context };
95
+ this.log("Updated global context", this.globalContext);
96
+ return this;
97
+ }
98
+ /**
99
+ * 获取全局上下文
100
+ */
101
+ getGlobalContext() {
102
+ return { ...this.globalContext };
103
+ }
104
+ /**
105
+ * 获取管理器状态
106
+ */
107
+ getStatus() {
108
+ return {
109
+ initialized: this.initialized,
110
+ providersCount: this.providers.size
111
+ };
112
+ }
113
+ /**
114
+ * 检查是否已初始化
115
+ */
116
+ ensureInitialized() {
117
+ if (!this.initialized) {
118
+ console.warn("[AnalyticsManager] Not initialized. Call initialize() first.");
119
+ return false;
120
+ }
121
+ return true;
122
+ }
123
+ /**
124
+ * 在所有提供商上执行操作
125
+ */
126
+ async executeOnAllProviders(method, ...args) {
127
+ const results = {
128
+ errors: [],
129
+ success: []
130
+ };
131
+ const promises = Array.from(this.providers.entries()).map(async ([name, provider]) => {
132
+ try {
133
+ await provider[method](...args);
134
+ results.success.push(name);
135
+ } catch (error) {
136
+ results.errors.push({ error, provider: name });
137
+ console.error(
138
+ `[AnalyticsManager] ${method} failed for ${provider.getProviderName()}:`,
139
+ error
140
+ );
141
+ }
142
+ });
143
+ await Promise.allSettled(promises);
144
+ return results;
145
+ }
146
+ /**
147
+ * 丰富事件数据
148
+ */
149
+ enrichEvent(event) {
150
+ return {
151
+ ...event,
152
+ properties: {
153
+ ...this.globalContext,
154
+ ...event.properties
155
+ },
156
+ timestamp: event.timestamp || /* @__PURE__ */ new Date()
157
+ };
158
+ }
159
+ /**
160
+ * 记录日志
161
+ */
162
+ log(message, data) {
163
+ if (this.debug) {
164
+ console.log(`[AnalyticsManager] ${message}`, data || "");
165
+ }
166
+ }
167
+ };
168
+
169
+ // src/providers/posthog.ts
170
+ import { posthog } from "posthog-js";
171
+
172
+ // src/base.ts
173
+ var BaseAnalytics = class {
174
+ constructor(config) {
175
+ var _a, _b;
176
+ this.debug = (_a = config.debug) != null ? _a : false;
177
+ this.enabled = (_b = config.enabled) != null ? _b : true;
178
+ this.business = config.business;
179
+ }
180
+ /**
181
+ * Check if provider is enabled
182
+ */
183
+ isEnabled() {
184
+ if (!this.enabled) {
185
+ this.log("Provider is disabled");
186
+ return false;
187
+ }
188
+ return true;
189
+ }
190
+ /**
191
+ * Validate event data
192
+ */
193
+ validateEvent(event) {
194
+ if (!event.name) {
195
+ this.logError("Event name is required");
196
+ return false;
197
+ }
198
+ return true;
199
+ }
200
+ /**
201
+ * Log debug message
202
+ */
203
+ log(message, data) {
204
+ if (this.debug) {
205
+ console.log(`[${this.getProviderName()}] ${message}`, data || "");
206
+ }
207
+ }
208
+ /**
209
+ * Log error message
210
+ */
211
+ logError(message, error) {
212
+ console.error(`[${this.getProviderName()}] ${message}`, error || "");
213
+ }
214
+ /**
215
+ * 丰富属性数据,自动处理 spm 前缀
216
+ * 确保无论通过哪种方式调用都会添加 business 前缀
217
+ */
218
+ enrichProperties(properties) {
219
+ const enriched = { ...properties };
220
+ enriched.business = this.business;
221
+ if (enriched.spm && typeof enriched.spm === "string" && enriched.spm.trim()) {
222
+ if (enriched.spm !== this.business && !enriched.spm.startsWith(`${this.business}.`)) {
223
+ enriched.spm = `${this.business}.${enriched.spm}`;
224
+ }
225
+ } else {
226
+ enriched.spm = this.business;
227
+ }
228
+ return enriched;
229
+ }
230
+ };
231
+
232
+ // src/providers/posthog.ts
233
+ var PostHogAnalyticsProvider = class extends BaseAnalytics {
234
+ constructor(config, business) {
235
+ super({ business, debug: config.debug, enabled: config.enabled });
236
+ this.initialized = false;
237
+ this.config = config;
238
+ }
239
+ getProviderName() {
240
+ return "PostHog";
241
+ }
242
+ async initialize() {
243
+ if (!this.isEnabled() || this.initialized) {
244
+ return;
245
+ }
246
+ try {
247
+ const { key, host, ...posthogConfig } = this.config;
248
+ const initConfig = {
249
+ ...posthogConfig,
250
+ // User's posthog-js config options
251
+ api_host: host || posthogConfig.api_host || "https://app.posthog.com",
252
+ // Use before_send to dynamically add business context to all events
253
+ before_send: this.createBeforeSendHandler(posthogConfig.before_send),
254
+ debug: this.debug,
255
+ loaded: () => this.log("PostHog loaded and ready")
256
+ };
257
+ posthog.init(key, initConfig);
258
+ this.initialized = true;
259
+ this.log("PostHog initialized successfully");
260
+ this.log(`Using before_send to add business context: ${this.business}`);
261
+ } catch (error) {
262
+ this.logError("Failed to initialize PostHog", error);
263
+ throw error;
264
+ }
265
+ }
266
+ async track(event) {
267
+ if (!this.isEnabled() || !this.initialized || !this.validateEvent(event)) {
268
+ return;
269
+ }
270
+ try {
271
+ const enrichedProperties = this.enrichProperties(event.properties);
272
+ posthog.capture(event.name, {
273
+ ...enrichedProperties,
274
+ ...event.userId && { distinct_id: event.userId }
275
+ });
276
+ this.log(`Tracked event: ${event.name}`, { ...event, properties: enrichedProperties });
277
+ } catch (error) {
278
+ this.logError(`Failed to track event: ${event.name}`, error);
279
+ }
280
+ }
281
+ async identify(userId, properties) {
282
+ if (!this.isEnabled() || !this.initialized) {
283
+ return;
284
+ }
285
+ try {
286
+ const enrichedProperties = this.enrichProperties(properties);
287
+ posthog.identify(userId, enrichedProperties);
288
+ this.log(`Identified user: ${userId}`, enrichedProperties);
289
+ } catch (error) {
290
+ this.logError(`Failed to identify user: ${userId}`, error);
291
+ }
292
+ }
293
+ async trackPageView(page, properties) {
294
+ if (!this.isEnabled() || !this.initialized) {
295
+ return;
296
+ }
297
+ try {
298
+ const enrichedProperties = this.enrichProperties(properties);
299
+ await this.track({
300
+ name: "$pageview",
301
+ properties: { page, ...enrichedProperties }
302
+ });
303
+ this.log(`Tracked page view: ${page}`, enrichedProperties);
304
+ } catch (error) {
305
+ this.logError(`Failed to track page view: ${page}`, error);
306
+ }
307
+ }
308
+ async reset() {
309
+ if (!this.isEnabled() || !this.initialized) {
310
+ return;
311
+ }
312
+ try {
313
+ posthog.reset();
314
+ this.log("Reset user identity");
315
+ } catch (error) {
316
+ this.logError("Failed to reset user identity", error);
317
+ }
318
+ }
319
+ /**
320
+ * Check if feature flag is enabled
321
+ */
322
+ isFeatureEnabled(flag) {
323
+ if (!this.initialized) {
324
+ return false;
325
+ }
326
+ try {
327
+ return Boolean(posthog.isFeatureEnabled(flag));
328
+ } catch (error) {
329
+ this.logError(`Failed to check feature flag: ${flag}`, error);
330
+ return false;
331
+ }
332
+ }
333
+ /**
334
+ * Get the native PostHog instance for direct access to PostHog APIs
335
+ *
336
+ * Note: When using the native instance directly, events will still include
337
+ * the business spm prefix because it's registered as a global property.
338
+ *
339
+ * @returns PostHog native instance or null if not initialized
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * const analytics = createAnalytics({ business: 'myapp', ... });
344
+ * const posthogProvider = analytics.getProvider('posthog');
345
+ * const posthog = posthogProvider.getNativeInstance();
346
+ *
347
+ * // These calls will automatically include spm: 'myapp'
348
+ * posthog?.capture('custom_event', { custom: 'data' });
349
+ * posthog?.isFeatureEnabled('new_feature');
350
+ * posthog?.group('company', 'company_123');
351
+ * ```
352
+ */
353
+ getNativeInstance() {
354
+ if (!this.isEnabled() || !this.initialized) {
355
+ this.log("Cannot get native instance: provider not enabled or not initialized");
356
+ return null;
357
+ }
358
+ return posthog;
359
+ }
360
+ /**
361
+ * Create a before_send handler that adds business context to all events
362
+ * This ensures both wrapper calls and direct PostHog calls include business information
363
+ */
364
+ createBeforeSendHandler(userBeforeSend) {
365
+ return (event) => {
366
+ var _a;
367
+ if (!event) {
368
+ return null;
369
+ }
370
+ const originallyHadSpm = ((_a = event.properties) == null ? void 0 : _a.spm) !== void 0;
371
+ let processedEvent = event;
372
+ if (userBeforeSend) {
373
+ if (Array.isArray(userBeforeSend)) {
374
+ for (const fn of userBeforeSend) {
375
+ processedEvent = fn(processedEvent);
376
+ if (!processedEvent) {
377
+ return null;
378
+ }
379
+ }
380
+ } else if (typeof userBeforeSend === "function") {
381
+ processedEvent = userBeforeSend(processedEvent);
382
+ if (!processedEvent) {
383
+ return null;
384
+ }
385
+ }
386
+ }
387
+ if (!processedEvent.properties) {
388
+ processedEvent.properties = {};
389
+ }
390
+ processedEvent.properties.business = this.business;
391
+ const currentSpm = processedEvent.properties.spm;
392
+ const shouldSetDefaultSpm = !originallyHadSpm && (!currentSpm || typeof currentSpm === "string" && !currentSpm.trim());
393
+ if (shouldSetDefaultSpm) {
394
+ processedEvent.properties.spm = this.business;
395
+ }
396
+ return processedEvent;
397
+ };
398
+ }
399
+ /**
400
+ * Update the business context dynamically
401
+ * This will affect all future events
402
+ */
403
+ updateBusiness(newBusiness) {
404
+ if (!this.isEnabled() || !this.initialized) {
405
+ this.log("Cannot update business: provider not enabled or not initialized");
406
+ return;
407
+ }
408
+ this.log(`Business update requested: ${newBusiness} (current: ${this.business})`);
409
+ this.log("Note: Dynamic business updates require storing business in a mutable field");
410
+ }
411
+ /**
412
+ * Get current business context
413
+ */
414
+ getCurrentBusiness() {
415
+ return this.business;
416
+ }
417
+ };
418
+
419
+ // src/providers/posthog-node.ts
420
+ import { PostHog } from "posthog-node";
421
+ var PostHogNodeAnalyticsProvider = class extends BaseAnalytics {
422
+ constructor(config, business) {
423
+ super({ business, debug: config.debug, enabled: config.enabled });
424
+ this.client = null;
425
+ this.initialized = false;
426
+ this.config = config;
427
+ }
428
+ getProviderName() {
429
+ return "PostHogNode";
430
+ }
431
+ async initialize() {
432
+ if (!this.isEnabled() || this.initialized) {
433
+ return;
434
+ }
435
+ try {
436
+ const { key, debug, enabled, ...posthogNodeConfig } = this.config;
437
+ void debug;
438
+ void enabled;
439
+ this.client = new PostHog(key, {
440
+ flushAt: 20,
441
+ flushInterval: 1e4,
442
+ host: "https://app.posthog.com",
443
+ ...posthogNodeConfig
444
+ // Apply user's posthog-node config options
445
+ });
446
+ this.initialized = true;
447
+ this.log("PostHog Node.js initialized successfully");
448
+ this.log(`Using business context: ${this.business}`);
449
+ } catch (error) {
450
+ this.logError("Failed to initialize PostHog Node.js", error);
451
+ throw error;
452
+ }
453
+ }
454
+ async track(event) {
455
+ if (!this.isEnabled() || !this.initialized || !this.client || !this.validateEvent(event)) {
456
+ return;
457
+ }
458
+ try {
459
+ const enrichedProperties = this.enrichProperties(event.properties);
460
+ this.client.capture({
461
+ distinctId: event.userId || event.anonymousId || "anonymous",
462
+ event: event.name,
463
+ properties: enrichedProperties,
464
+ timestamp: event.timestamp
465
+ });
466
+ this.log(`Tracked event: ${event.name}`, { ...event, properties: enrichedProperties });
467
+ } catch (error) {
468
+ this.logError(`Failed to track event: ${event.name}`, error);
469
+ }
470
+ }
471
+ async identify(userId, properties) {
472
+ if (!this.isEnabled() || !this.initialized || !this.client) {
473
+ return;
474
+ }
475
+ try {
476
+ const enrichedProperties = this.enrichProperties(properties);
477
+ this.client.identify({
478
+ distinctId: userId,
479
+ properties: enrichedProperties
480
+ });
481
+ this.log(`Identified user: ${userId}`, enrichedProperties);
482
+ } catch (error) {
483
+ this.logError(`Failed to identify user: ${userId}`, error);
484
+ }
485
+ }
486
+ async trackPageView(page, properties) {
487
+ if (!this.isEnabled() || !this.initialized || !this.client) {
488
+ return;
489
+ }
490
+ try {
491
+ const enrichedProperties = this.enrichProperties({ page, ...properties });
492
+ await this.track({
493
+ name: "$pageview",
494
+ properties: enrichedProperties
495
+ });
496
+ this.log(`Tracked page view: ${page}`, enrichedProperties);
497
+ } catch (error) {
498
+ this.logError(`Failed to track page view: ${page}`, error);
499
+ }
500
+ }
501
+ async reset() {
502
+ if (!this.isEnabled() || !this.initialized) {
503
+ return;
504
+ }
505
+ try {
506
+ await this.flush();
507
+ this.log("Reset user identity (flushed pending events)");
508
+ } catch (error) {
509
+ this.logError("Failed to reset user identity", error);
510
+ }
511
+ }
512
+ /**
513
+ * Check if feature flag is enabled for a user
514
+ */
515
+ async isFeatureEnabled(flag, distinctId, groups) {
516
+ if (!this.initialized || !this.client) {
517
+ return false;
518
+ }
519
+ try {
520
+ const result = await this.client.isFeatureEnabled(flag, distinctId, groups);
521
+ return Boolean(result);
522
+ } catch (error) {
523
+ this.logError(`Failed to check feature flag: ${flag}`, error);
524
+ return false;
525
+ }
526
+ }
527
+ /**
528
+ * Get feature flag payload for a user
529
+ */
530
+ async getFeatureFlag(flag, distinctId, groups) {
531
+ if (!this.initialized || !this.client) {
532
+ return void 0;
533
+ }
534
+ try {
535
+ return await this.client.getFeatureFlag(flag, distinctId, groups);
536
+ } catch (error) {
537
+ this.logError(`Failed to get feature flag: ${flag}`, error);
538
+ return void 0;
539
+ }
540
+ }
541
+ /**
542
+ * Get all feature flags for a user
543
+ */
544
+ async getAllFlags(distinctId, groups) {
545
+ if (!this.initialized || !this.client) {
546
+ return {};
547
+ }
548
+ try {
549
+ const flags = await this.client.getAllFlags(distinctId, groups);
550
+ return flags || {};
551
+ } catch (error) {
552
+ this.logError("Failed to get all feature flags", error);
553
+ return {};
554
+ }
555
+ }
556
+ /**
557
+ * Flush pending events
558
+ */
559
+ async flush() {
560
+ if (!this.initialized || !this.client) {
561
+ return;
562
+ }
563
+ try {
564
+ await this.client.flush();
565
+ this.log("Flushed pending events");
566
+ } catch (error) {
567
+ this.logError("Failed to flush events", error);
568
+ }
569
+ }
570
+ /**
571
+ * Shutdown the client and flush remaining events
572
+ */
573
+ async shutdown() {
574
+ if (!this.initialized || !this.client) {
575
+ return;
576
+ }
577
+ try {
578
+ await this.client.shutdown();
579
+ this.initialized = false;
580
+ this.log("PostHog Node.js client shut down");
581
+ } catch (error) {
582
+ this.logError("Failed to shutdown PostHog Node.js client", error);
583
+ }
584
+ }
585
+ /**
586
+ * Get the native PostHog Node instance for direct access to PostHog APIs
587
+ */
588
+ getNativeInstance() {
589
+ if (!this.isEnabled() || !this.initialized) {
590
+ this.log("Cannot get native instance: provider not enabled or not initialized");
591
+ return null;
592
+ }
593
+ return this.client;
594
+ }
595
+ /**
596
+ * Group identify - associate user with a group
597
+ */
598
+ async groupIdentify(groupType, groupKey, properties) {
599
+ if (!this.isEnabled() || !this.initialized || !this.client) {
600
+ return;
601
+ }
602
+ try {
603
+ const enrichedProperties = this.enrichProperties(properties);
604
+ this.client.groupIdentify({
605
+ groupKey,
606
+ groupType,
607
+ properties: enrichedProperties
608
+ });
609
+ this.log(`Group identified: ${groupType}:${groupKey}`, enrichedProperties);
610
+ } catch (error) {
611
+ this.logError(`Failed to identify group: ${groupType}:${groupKey}`, error);
612
+ }
613
+ }
614
+ /**
615
+ * Create alias between user IDs
616
+ */
617
+ async alias(distinctId, alias) {
618
+ if (!this.isEnabled() || !this.initialized || !this.client) {
619
+ return;
620
+ }
621
+ try {
622
+ this.client.alias({
623
+ alias,
624
+ distinctId
625
+ });
626
+ this.log(`Created alias: ${distinctId} -> ${alias}`);
627
+ } catch (error) {
628
+ this.logError(`Failed to create alias: ${distinctId} -> ${alias}`, error);
629
+ }
630
+ }
631
+ /**
632
+ * Update the business context dynamically
633
+ * This will affect all future events
634
+ */
635
+ updateBusiness(newBusiness) {
636
+ if (!this.isEnabled() || !this.initialized) {
637
+ this.log("Cannot update business: provider not enabled or not initialized");
638
+ return;
639
+ }
640
+ this.log(`Business update requested: ${newBusiness} (current: ${this.business})`);
641
+ this.log("Note: Dynamic business updates require storing business in a mutable field");
642
+ }
643
+ /**
644
+ * Get current business context
645
+ */
646
+ getCurrentBusiness() {
647
+ return this.business;
648
+ }
649
+ };
650
+
651
+ // src/global.ts
652
+ var GLOBAL_STATE_KEY = "__LOBE_ANALYTICS_GLOBAL_STATE__";
653
+ function getGlobalState() {
654
+ if (!globalThis[GLOBAL_STATE_KEY]) {
655
+ globalThis[GLOBAL_STATE_KEY] = {
656
+ instances: /* @__PURE__ */ new Map(),
657
+ singletonConfig: null,
658
+ singletonInstance: null
659
+ };
660
+ }
661
+ return globalThis[GLOBAL_STATE_KEY];
662
+ }
663
+ var DEFAULT_INSTANCE_NAME = "__default__";
664
+ function setGlobalAnalytics(instance, name = DEFAULT_INSTANCE_NAME) {
665
+ const state = getGlobalState();
666
+ state.instances.set(name, instance);
667
+ }
668
+ function getGlobalAnalytics(name = DEFAULT_INSTANCE_NAME) {
669
+ const state = getGlobalState();
670
+ const instance = state.instances.get(name);
671
+ if (!instance) {
672
+ throw new Error(
673
+ `Global analytics instance "${name}" not found. Make sure to register it first using setGlobalAnalytics() or use AnalyticsProvider.`
674
+ );
675
+ }
676
+ return instance;
677
+ }
678
+ function getGlobalAnalyticsOptional(name = DEFAULT_INSTANCE_NAME) {
679
+ const state = getGlobalState();
680
+ return state.instances.get(name) || null;
681
+ }
682
+ function hasGlobalAnalytics(name = DEFAULT_INSTANCE_NAME) {
683
+ const state = getGlobalState();
684
+ return state.instances.has(name);
685
+ }
686
+ function removeGlobalAnalytics(name = DEFAULT_INSTANCE_NAME) {
687
+ const state = getGlobalState();
688
+ return state.instances.delete(name);
689
+ }
690
+ function clearGlobalAnalytics() {
691
+ const state = getGlobalState();
692
+ state.instances.clear();
693
+ }
694
+ function getGlobalAnalyticsNames() {
695
+ const state = getGlobalState();
696
+ return Array.from(state.instances.keys());
697
+ }
698
+
699
+ // src/server.ts
700
+ function createServerAnalytics(config) {
701
+ var _a, _b;
702
+ const manager = new AnalyticsManager(config.business, config.debug);
703
+ if ((_a = config.providers.posthog) == null ? void 0 : _a.enabled) {
704
+ const provider = new PostHogAnalyticsProvider(config.providers.posthog, config.business);
705
+ manager.registerProvider("posthog", provider);
706
+ }
707
+ if ((_b = config.providers.posthogNode) == null ? void 0 : _b.enabled) {
708
+ const provider = new PostHogNodeAnalyticsProvider(
709
+ config.providers.posthogNode,
710
+ config.business
711
+ );
712
+ manager.registerProvider("posthogNode", provider);
713
+ }
714
+ return manager;
715
+ }
716
+ export {
717
+ AnalyticsManager,
718
+ PostHogAnalyticsProvider,
719
+ PostHogNodeAnalyticsProvider,
720
+ clearGlobalAnalytics,
721
+ createServerAnalytics,
722
+ getGlobalAnalytics,
723
+ getGlobalAnalyticsNames,
724
+ getGlobalAnalyticsOptional,
725
+ hasGlobalAnalytics,
726
+ removeGlobalAnalytics,
727
+ setGlobalAnalytics
728
+ };
729
+ //# sourceMappingURL=server.mjs.map