@base44-preview/sdk 0.8.32-pr.196.8c75df2 → 0.8.32-pr.198.5f32a84

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.
@@ -1,6 +1,7 @@
1
1
  import axios from "axios";
2
2
  import { isInIFrame } from "./common.js";
3
3
  import { v4 as uuidv4 } from "uuid";
4
+ import { getAnalyticsSessionId } from "../modules/analytics.js";
4
5
  /**
5
6
  * Custom error class for Base44 SDK errors.
6
7
  *
@@ -131,6 +132,16 @@ export function createAxiosClient({ baseURL, headers = {}, token, interceptRespo
131
132
  client.interceptors.request.use((config) => {
132
133
  if (typeof window !== "undefined") {
133
134
  config.headers.set("X-Origin-URL", window.location.href);
135
+ // On unauthenticated clients, attach a stable anonymous visitor id so the
136
+ // backend can support anonymous agent access (conversation grouping +
137
+ // ownership). Authenticated clients are identified by their token instead.
138
+ // Reuses the persisted analytics session id so an anonymous agent
139
+ // conversation and that visitor's analytics events share one identity.
140
+ // (Hardening this id to crypto-strength + decoupling from analytics is a
141
+ // tracked follow-up.)
142
+ if (!token) {
143
+ config.headers.set("X-Base44-Anonymous-Id", getAnalyticsSessionId());
144
+ }
134
145
  }
135
146
  const requestId = uuidv4();
136
147
  config.requestId = requestId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.32-pr.196.8c75df2",
3
+ "version": "0.8.32-pr.198.5f32a84",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",