@djangocfg/api 2.1.470 → 2.1.471

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/dist/auth.cjs CHANGED
@@ -54,6 +54,7 @@ __export(auth_exports, {
54
54
  peekSavedRedirect: () => peekSavedRedirect,
55
55
  resolveGuardIsAuthenticated: () => resolveGuardIsAuthenticated,
56
56
  resolveGuardIsLoading: () => resolveGuardIsLoading,
57
+ setAnalyticsSink: () => setAnalyticsSink,
57
58
  setCachedProfile: () => setCachedProfile,
58
59
  shouldRedirectToAuth: () => shouldRedirectToAuth,
59
60
  useAccountsContext: () => useAccountsContext,
@@ -2457,21 +2458,30 @@ var AnalyticsCategory = /* @__PURE__ */ ((AnalyticsCategory2) => {
2457
2458
  AnalyticsCategory2["AUTH"] = "auth";
2458
2459
  return AnalyticsCategory2;
2459
2460
  })(AnalyticsCategory || {});
2461
+ var sink = null;
2462
+ function setAnalyticsSink(next) {
2463
+ sink = next;
2464
+ }
2465
+ __name(setAnalyticsSink, "setAnalyticsSink");
2460
2466
  var Analytics = {
2461
- /**
2462
- * Track an analytics event
2463
- */
2467
+ /** Track an auth event. Delivered to the installed sink, if any. */
2464
2468
  event(eventName, params) {
2469
+ if (sink) {
2470
+ sink.event(eventName, params);
2471
+ return;
2472
+ }
2465
2473
  if (isDev) {
2466
- console.log("[Analytics]", eventName, params);
2474
+ console.log("[Analytics:no-sink]", eventName, params);
2467
2475
  }
2468
2476
  },
2469
- /**
2470
- * Set user ID for tracking
2471
- */
2477
+ /** Attach the signed-in user. Pass null on logout. */
2472
2478
  setUser(userId) {
2479
+ if (sink) {
2480
+ sink.setUser(userId);
2481
+ return;
2482
+ }
2473
2483
  if (isDev) {
2474
- console.log("[Analytics] Set user:", userId);
2484
+ console.log("[Analytics:no-sink] Set user:", userId);
2475
2485
  }
2476
2486
  }
2477
2487
  };