@base44-preview/sdk 0.8.49-pr.280.04af9f9 → 0.8.49-pr.289.78ea614

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/actor.d.ts CHANGED
@@ -25,8 +25,8 @@ export interface Storage {
25
25
  get<T>(key: string): Promise<T | undefined>;
26
26
  put(key: string, value: unknown): Promise<void>;
27
27
  delete(key: string): Promise<boolean>;
28
- /** Wipe the room's entire persisted storage (match-end cleanup). Safe: a
29
- * later rejoin re-bootstraps exactly like a brand-new room. */
28
+ /** Wipe the session's entire persisted storage. A later connection starts
29
+ * with the same empty storage as a new session. */
30
30
  deleteAll(): Promise<void>;
31
31
  }
32
32
  /**
package/dist/client.js CHANGED
@@ -14,9 +14,6 @@ import { createAppModule } from "./modules/app.js";
14
14
  import { createUsersModule } from "./modules/users.js";
15
15
  import { RoomsSocket } from "./utils/socket-utils.js";
16
16
  import { createAnalyticsModule } from "./modules/analytics.js";
17
- import { createExperimentsModule } from "./modules/experiments.js";
18
- import { createExposureTracker } from "./modules/experiment-exposures.js";
19
- import { EXPERIMENTS_CONTEXT_HEADER, getBrowserExperimentsContext, readExperimentsContext } from "./modules/experiments-context.js";
20
17
  import { createActorsModule, resolveActorsHost, } from "./modules/actors.js";
21
18
  /**
22
19
  * Creates a Base44 client.
@@ -56,11 +53,10 @@ import { createActorsModule, resolveActorsHost, } from "./modules/actors.js";
56
53
  * ```
57
54
  */
58
55
  export function createClient(config) {
59
- var _a, _b, _c, _d, _e, _f, _g;
56
+ var _a, _b, _c, _d;
60
57
  const { serverUrl = "https://base44.app", appId, analytics, token, serviceToken, requiresAuth = false, appBaseUrl, options, functionsVersion, headers: optionalHeaders, } = config;
61
58
  // Normalize appBaseUrl to always be a string (empty if not provided or invalid)
62
59
  const normalizedAppBaseUrl = typeof appBaseUrl === "string" ? appBaseUrl : "";
63
- const experimentsContext = (_a = config.experiments) !== null && _a !== void 0 ? _a : getBrowserExperimentsContext(appId);
64
60
  const socketConfig = {
65
61
  serverUrl,
66
62
  mountPath: "/ws-user-apps/socket.io/",
@@ -77,14 +73,9 @@ export function createClient(config) {
77
73
  }
78
74
  return socket;
79
75
  };
80
- const { [EXPERIMENTS_CONTEXT_HEADER]: inheritedExperimentsContext, ...requestHeaders } = optionalHeaders !== null && optionalHeaders !== void 0 ? optionalHeaders : {};
81
76
  const headers = {
82
- ...requestHeaders,
77
+ ...optionalHeaders,
83
78
  "X-App-Id": String(appId),
84
- ...(experimentsContext ? {
85
- "Base44-Visitor-Id": experimentsContext.identity.visitorId,
86
- "Base44-Experiment-Preview": JSON.stringify((_b = experimentsContext.preview) !== null && _b !== void 0 ? _b : {}),
87
- } : {}),
88
79
  };
89
80
  const functionHeaders = functionsVersion
90
81
  ? {
@@ -130,25 +121,10 @@ export function createClient(config) {
130
121
  baseURL: `${serverUrl}/api`,
131
122
  headers,
132
123
  });
133
- const exposureTracker = createExposureTracker({
134
- axiosClient,
135
- appId,
136
- enabled: (_c = analytics === null || analytics === void 0 ? void 0 : analytics.enabled) !== null && _c !== void 0 ? _c : true,
137
- source: typeof window === "undefined" ? "backend" : "browser",
138
- pageUrl: experimentsContext === null || experimentsContext === void 0 ? void 0 : experimentsContext.pageUrl,
139
- });
140
- const experiments = createExperimentsModule({
141
- appId,
142
- getAuth: () => userAuthModule,
143
- trackExposure: exposureTracker.track,
144
- flushExposures: exposureTracker.flush,
145
- context: experimentsContext,
146
- });
147
124
  const userAuthModule = createAuthModule(axiosClient, functionsAxiosClient, appId, {
148
125
  appBaseUrl: normalizedAppBaseUrl,
149
126
  serverUrl,
150
127
  token,
151
- onAuthStateChange: experiments.onAuthStateChange,
152
128
  });
153
129
  // Apply the access token before any module that may issue authenticated
154
130
  // requests during construction (notably analytics, which fires an init
@@ -160,19 +136,11 @@ export function createClient(config) {
160
136
  userAuthModule.setToken(accessToken);
161
137
  }
162
138
  }
163
- if (experimentsContext) {
164
- const { userId, status } = experimentsContext.identity;
165
- // The document's cookie identity may differ from this client's localStorage token.
166
- const needsClientIdentity = typeof window !== "undefined" && userAuthModule.hasToken() &&
167
- experimentsContext.config.experiments.some((experiment) => experiment.assign_by === "user");
168
- experiments.onAuthStateChange(status === "pending" || needsClientIdentity ? { status: "pending" } :
169
- userId ? { status: "authenticated", userId } : { status: "anonymous" });
170
- }
171
139
  const actorsModule = createActorsModule({
172
140
  appId,
173
141
  // serverUrl is often relative/empty (same-origin app); the proxy-fallback
174
142
  // URL needs an absolute host, so fall back to the page origin.
175
- host: resolveActorsHost(serverUrl, typeof window !== "undefined" ? (_d = window.location) === null || _d === void 0 ? void 0 : _d.origin : undefined),
143
+ host: resolveActorsHost(serverUrl, typeof window !== "undefined" ? (_a = window.location) === null || _a === void 0 ? void 0 : _a.origin : undefined),
176
144
  functionsVersion,
177
145
  getAuthToken: () => token || getAccessToken(),
178
146
  mintConnectionToken: async (actorName, room, connectionId) => {
@@ -200,7 +168,6 @@ export function createClient(config) {
200
168
  integrations: createIntegrationsModule(axiosClient, appId),
201
169
  connectors: createUserConnectorsModule(axiosClient, appId),
202
170
  auth: userAuthModule,
203
- experiments: experiments.module,
204
171
  functions: createFunctionsModule(functionsAxiosClient, appId, {
205
172
  getAuthHeaders: () => {
206
173
  const headers = {};
@@ -211,7 +178,7 @@ export function createClient(config) {
211
178
  }
212
179
  return headers;
213
180
  },
214
- baseURL: (_e = functionsAxiosClient.defaults) === null || _e === void 0 ? void 0 : _e.baseURL,
181
+ baseURL: (_b = functionsAxiosClient.defaults) === null || _b === void 0 ? void 0 : _b.baseURL,
215
182
  }),
216
183
  agents: createAgentsModule({
217
184
  axios: axiosClient,
@@ -229,14 +196,11 @@ export function createClient(config) {
229
196
  serverUrl,
230
197
  appId,
231
198
  userAuthModule,
232
- enabled: (_f = analytics === null || analytics === void 0 ? void 0 : analytics.enabled) !== null && _f !== void 0 ? _f : true,
233
- getVisitorId: experiments.visitorId,
234
- experimentsContext,
199
+ enabled: (_c = analytics === null || analytics === void 0 ? void 0 : analytics.enabled) !== null && _c !== void 0 ? _c : true,
235
200
  }),
236
201
  actors: actorsModule.module,
237
202
  cleanup: () => {
238
203
  userModules.analytics.cleanup();
239
- experiments.cleanup();
240
204
  actorsModule.closeAll();
241
205
  if (socket) {
242
206
  socket.disconnect();
@@ -261,7 +225,7 @@ export function createClient(config) {
261
225
  }
262
226
  return headers;
263
227
  },
264
- baseURL: (_g = serviceRoleFunctionsAxiosClient.defaults) === null || _g === void 0 ? void 0 : _g.baseURL,
228
+ baseURL: (_d = serviceRoleFunctionsAxiosClient.defaults) === null || _d === void 0 ? void 0 : _d.baseURL,
265
229
  }),
266
230
  agents: createAgentsModule({
267
231
  axios: serviceRoleAxiosClient,
@@ -304,10 +268,7 @@ export function createClient(config) {
304
268
  appId: String(appId),
305
269
  serverUrl,
306
270
  functionsVersion,
307
- platformHeaders: {
308
- ...headers,
309
- ...(inheritedExperimentsContext ? { [EXPERIMENTS_CONTEXT_HEADER]: inheritedExperimentsContext } : {}),
310
- },
271
+ platformHeaders: optionalHeaders,
311
272
  }),
312
273
  /**
313
274
  * Sets a new authentication token for all subsequent requests.
@@ -459,10 +420,6 @@ export function createClientFromRequest(request) {
459
420
  }
460
421
  // Prepare additional headers to propagate
461
422
  const additionalHeaders = {};
462
- const encodedExperiments = request.headers.get(EXPERIMENTS_CONTEXT_HEADER);
463
- const experimentsContext = readExperimentsContext(encodedExperiments, appId);
464
- if (experimentsContext && encodedExperiments)
465
- additionalHeaders[EXPERIMENTS_CONTEXT_HEADER] = encodedExperiments;
466
423
  if (stateHeader) {
467
424
  additionalHeaders["Base44-State"] = stateHeader;
468
425
  }
@@ -483,6 +440,5 @@ export function createClientFromRequest(request) {
483
440
  serviceToken: serviceRoleToken,
484
441
  functionsVersion: functionsVersion !== null && functionsVersion !== void 0 ? functionsVersion : undefined,
485
442
  headers: additionalHeaders,
486
- experiments: experimentsContext ? { ...experimentsContext, pageUrl: request.url ? new URL(request.url).pathname : "/" } : undefined,
487
443
  });
488
444
  }
@@ -9,8 +9,6 @@ import type { AiGatewayModule } from "./modules/ai-gateway.types.js";
9
9
  import type { AppLogsModule } from "./modules/app-logs.types.js";
10
10
  import type { AppModule } from "./modules/app.types.js";
11
11
  import type { AnalyticsModule } from "./modules/analytics.types.js";
12
- import type { ExperimentsModule } from "./modules/experiments.types.js";
13
- import type { ExperimentsContext } from "./modules/experiments-config.types.js";
14
12
  import type { ActorsModule } from "./modules/actors.types.js";
15
13
  import type { FetchWithAuthInit } from "./utils/fetch-with-auth.js";
16
14
  /**
@@ -41,9 +39,9 @@ export interface CreateClientAnalyticsConfig {
41
39
  /**
42
40
  * Whether app analytics is enabled for this client.
43
41
  *
44
- * When disabled, automatic analytics, experiment exposures and calls to
45
- * `analytics.track()` are no-ops. The SDK does not create an analytics session
46
- * identifier, start heartbeat timers, or send analytics requests.
42
+ * When disabled, automatic analytics and calls to `analytics.track()` are
43
+ * no-ops. The SDK does not create an analytics session identifier, start
44
+ * heartbeat timers, or send analytics requests.
47
45
  *
48
46
  * @defaultValue `true`
49
47
  */
@@ -81,12 +79,6 @@ export interface CreateClientConfig {
81
79
  * Omit this option to preserve the default analytics behavior.
82
80
  */
83
81
  analytics?: CreateClientAnalyticsConfig;
84
- /**
85
- * Platform-validated context for local flag evaluation. Request-scoped on servers.
86
- * Automatically read from the platform bootstrap in browsers and trusted headers
87
- * by createClientFromRequest(). Not an authorization credential.
88
- */
89
- experiments?: ExperimentsContext;
90
82
  /**
91
83
  * User authentication token. Used to authenticate as a specific user.
92
84
  *
@@ -142,8 +134,6 @@ export interface Base44Client {
142
134
  connectors: UserConnectorsModule;
143
135
  /** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
144
136
  entities: EntitiesModule;
145
- /** {@link ExperimentsModule | Experiments module} for local feature flags and exposures. */
146
- experiments: ExperimentsModule;
147
137
  /** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
148
138
  functions: FunctionsModule;
149
139
  /** {@link IntegrationsModule | Integrations module} for calling pre-built integration endpoints. */
package/dist/index.d.ts CHANGED
@@ -4,9 +4,6 @@ import { getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl } from
4
4
  export { createClient, createClientFromRequest, Base44Error, getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, };
5
5
  export type { Base44Client, CreateClientAnalyticsConfig, CreateClientConfig, CreateClientOptions, Base44ErrorJSON, };
6
6
  export * from "./types.js";
7
- export { evaluateExperiments } from "./modules/experiments-evaluator.js";
8
- export type { ExperimentsConfig, ExperimentsContext, ExperimentsIdentity } from "./modules/experiments-config.types.js";
9
- export type { ExperimentsModule, ExperimentsSnapshot, } from "./modules/experiments.types.js";
10
7
  export type { DeleteManyResult, DeleteResult, EntitiesModule, EntityAggregateResult, EntityAggregateSpec, EntityDateBucketUnit, EntityDistinctOptions, EntityFilterOperators, EntityFilterQuery, EntityFilterValue, EntityHandler, EntityListOptions, EntityPage, EntityRecord, EntityTypeRegistry, EntityUpsertOptions, EntityUpsertResult, ImportResult, RealtimeEventType, RealtimeEvent, RealtimeCallback, SortField, UpdateManyResult, } from "./modules/entities.types.js";
11
8
  export type { AuthModule, LoginResponse, RegisterParams, VerifyOtpParams, ChangePasswordParams, ResetPasswordParams, User, } from "./modules/auth.types.js";
12
9
  export type { IntegrationsModule, IntegrationEndpointFunction, CoreIntegrations, InvokeLLMParams, GenerateImageParams, GenerateImageResult, UploadFileParams, UploadFileResult, SendEmailParams, SendEmailResult, ExtractDataFromUploadedFileParams, ExtractDataFromUploadedFileResult, UploadPrivateFileParams, UploadPrivateFileResult, CreateFileSignedUrlParams, CreateFileSignedUrlResult, } from "./modules/integrations.types.js";
package/dist/index.js CHANGED
@@ -3,5 +3,4 @@ import { Base44Error } from "./utils/axios-client.js";
3
3
  import { getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, } from "./utils/auth-utils.js";
4
4
  export { createClient, createClientFromRequest, Base44Error, getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, };
5
5
  export * from "./types.js";
6
- export { evaluateExperiments } from "./modules/experiments-evaluator.js";
7
6
  export { Actor } from "./actor.js";
@@ -1,9 +1,15 @@
1
1
  /**
2
- * Extend this interface to add typed `subscribe` callbacks and `send` payloads
3
- * for your deployed Actors.
2
+ * Maps actor names to their incoming and outgoing message types.
4
3
  *
5
- * This is separate from {@link ActorNameRegistry} (which is auto-generated
6
- * by `base44 types generate`), so there are no conflicts.
4
+ * Extend this interface through module augmentation when you want typed actor
5
+ * messages without generating types with the CLI. For each actor, `toServer`
6
+ * defines incoming messages that a client sends to the actor. `toClient` defines
7
+ * outgoing messages that the actor sends to connected clients.
8
+ *
9
+ * To generate types from deployed actors instead, use the
10
+ * [`types generate`](/developers/references/cli/commands/types-generate) CLI command.
11
+ * See [Typing messages in the client](/developers/backend/resources/actors/overview#typing-messages-in-the-client)
12
+ * for how to define your message types.
7
13
  *
8
14
  * @example
9
15
  * ```typescript
@@ -20,8 +26,11 @@
20
26
  export interface ActorRegistry {
21
27
  }
22
28
  /**
23
- * Auto-populated by `base44 types generate` with the names of your deployed actors.
24
- * Do not edit this interface manually — use {@link ActorRegistry} for message types.
29
+ * Lists actor names when your project includes types generated by the CLI
30
+ * with [`types generate`](/developers/references/cli/commands/types-generate).
31
+ *
32
+ * The generated names provide autocomplete for deployed actors. To define
33
+ * incoming and outgoing message types manually, augment {@link ActorRegistry}.
25
34
  */
26
35
  export interface ActorNameRegistry {
27
36
  }
@@ -32,71 +41,140 @@ type ToClientFor<N extends string> = N extends keyof ActorRegistry ? ActorRegist
32
41
  type ToServerFor<N extends string> = N extends keyof ActorRegistry ? ActorRegistry[N] extends {
33
42
  toServer: infer O;
34
43
  } ? O : unknown : unknown;
35
- /** Options for {@link ActorRef.connect}. */
44
+ /**
45
+ * Options for {@link ActorRef.connect}.
46
+ */
36
47
  export interface ActorConnectOptions {
37
48
  /**
38
- * The connection id — becomes the actor's `conn.id`. Supply a stable value
39
- * (e.g. persisted per tab) so a reconnect reuses the same server-side
40
- * identity; omit for an auto-generated per-connection id.
49
+ * Connection ID that the actor receives as `conn.id`.
50
+ *
51
+ * Use a stable value, such as one stored per browser tab, so the actor
52
+ * can recognize the same client if it reconnects. If omitted, the SDK generates one.
53
+ *
54
+ * See [Connection ID](/developers/backend/resources/actors/overview#connection-id)
55
+ * for more details.
41
56
  */
42
57
  id?: string;
43
58
  }
44
- /** Handle for one listener registered via {@link Connection.subscribe}. */
59
+ /**
60
+ * Represents an outgoing-message listener registered with
61
+ * {@link Connection.subscribe}.
62
+ */
45
63
  export interface ActorSubscription {
46
- /** Remove this listener; other listeners and the socket stay live. */
64
+ /**
65
+ * Removes this listener. Other listeners and the socket stay open.
66
+ */
47
67
  unsubscribe(): void;
48
68
  }
49
69
  /**
50
- * A live connection to an actor instance, returned by {@link ActorRef.connect}.
51
- * `subscribe`/`send` are always valid — you only get a `Connection` once the
52
- * socket has been opened, so there's no pre-connect state to guard against.
70
+ * Represents a client's WebSocket connection to an actor session.
71
+ *
72
+ * {@link ActorRef.connect} returns this object while the socket connects.
73
+ * The socket buffers messages sent during connection setup until it opens.
53
74
  */
54
75
  export interface Connection<N extends string = string> {
55
- /** The connection id (the value the actor sees as `conn.id`). */
76
+ /** Connection ID that the actor receives as `conn.id`. */
56
77
  readonly id: string;
57
- /** Register a message listener. Multiple are allowed; returns a per-listener unsubscribe. */
78
+ /**
79
+ * Registers a listener for outgoing messages from the actor.
80
+ *
81
+ * You can register multiple listeners on the same connection.
82
+ *
83
+ * @param callback - Called with each outgoing message sent to this connection.
84
+ * @returns A handle you can use to remove this listener without closing the socket.
85
+ */
58
86
  subscribe(callback: (data: ToClientFor<N>) => void): ActorSubscription;
59
- /** Send a message. Buffered by the socket until it's open; dropped after
60
- * {@link close}. */
87
+ /**
88
+ * Sends an incoming message to the actor.
89
+ *
90
+ * The socket buffers messages until it opens. After {@link close}, the socket
91
+ * drops further sends.
92
+ *
93
+ * @param data - Incoming message to send. Typed through {@link ActorRegistry} when configured.
94
+ */
61
95
  send(data: ToServerFor<N>): void;
62
96
  /**
63
- * Tear down the socket, heartbeat, and all listeners. Safe to call more
64
- * than once. A connection also closes itself when it fails permanently —
65
- * see {@link ActorRef.connect}.
97
+ * Closes the connection and removes all listeners.
98
+ *
99
+ * Safe to call more than once. A connection also closes itself when it fails
100
+ * permanently. See {@link ActorRef.connect} for how to open a fresh connection.
66
101
  */
67
102
  close(): void;
68
103
  }
69
104
  /**
70
- * A handle to one actor instance — `base44.actors.MyActor(id)`. Call
71
- * {@link connect} to open the socket and get a {@link Connection}.
105
+ * Represents an actor session selected by actor name and session ID.
106
+ *
107
+ * Call {@link connect} to open the WebSocket and get a {@link Connection}.
72
108
  */
73
109
  export interface ActorRef<N extends string = string> {
74
110
  /**
75
- * Open the WebSocket and return the {@link Connection}. Idempotent while the
76
- * connection is open.
111
+ * Creates or returns the {@link Connection} for this session.
112
+ *
113
+ * Repeated calls return the same connection until it closes. After a permanent
114
+ * failure, such as a missing actor or denied connection, fix the cause and call
115
+ * `connect()` again. Add subscriptions to the new connection.
77
116
  *
78
- * A connection that fails permanently (for example, the actor doesn't exist
79
- * or the caller isn't allowed to connect) closes itself and reports the
80
- * error to the client's `onError` handler. Call `connect()` again after
81
- * fixing the cause to get a fresh {@link Connection}, and re-subscribe.
117
+ * See [Connect a client to a session](/developers/backend/resources/actors/samples#connect-a-client-to-a-session)
118
+ * for a sample flow.
119
+ *
120
+ * @param options - Optional connection settings, such as a stable connection ID.
121
+ * @returns The {@link Connection} for this actor session.
82
122
  */
83
123
  connect(options?: ActorConnectOptions): Connection<N>;
84
124
  }
85
125
  /**
86
- * Client for a single named Actor — call it with an instance id to get an
87
- * {@link ActorRef}. Typed automatically when the actor is registered in
88
- * {@link ActorRegistry}.
126
+ * Selects a session for a named actor.
127
+ *
128
+ * Typed automatically when the actor is registered in {@link ActorRegistry} or
129
+ * {@link ActorNameRegistry}.
89
130
  */
90
131
  export interface ActorClient<N extends string = string> {
132
+ /**
133
+ * Gets a reference to an actor session.
134
+ *
135
+ * Clients that specify the same actor name and session ID join the same session.
136
+ *
137
+ * @param instanceId - Session ID that identifies which session to connect to.
138
+ * @returns A reference to the actor session.
139
+ */
91
140
  (instanceId: string): ActorRef<N>;
92
141
  }
93
142
  /**
94
- * The actors module provides access to Cloudflare Durable Object-backed
95
- * Actors deployed by the Base44 platform.
143
+ * Provides access to actors and their shared, live sessions.
96
144
  *
145
+ * Select an actor by name and session ID, then connect a client to the
146
+ * session. Clients in the same session can exchange realtime messages through the
147
+ * actor. The client works in the browser and in Node.
148
+ *
149
+ * ## Connection flow
150
+ *
151
+ * - Connect to a session with `base44.actors.<ActorName>(sessionId).connect()`.
152
+ * - Subscribe to outgoing messages with {@link Connection.subscribe}.
153
+ * - Send incoming messages with {@link Connection.send}.
154
+ * - Close the connection with {@link Connection.close}.
155
+ *
156
+ * See [Actors Overview](/developers/backend/resources/actors/overview)
157
+ * for actor concepts and terminology, [Actor Class Reference](/developers/backend/resources/actors/reference)
158
+ * for the backend class API, and [Sample Flows](/developers/backend/resources/actors/samples)
159
+ * for common patterns.
160
+ *
161
+ * ## See also
162
+ *
163
+ * - [Actors Overview](/developers/backend/resources/actors/overview) — Actor concepts, sessions, message types, storage, and timers
164
+ * - [Actor Class Reference](/developers/backend/resources/actors/reference) — Backend class API
165
+ * - [Sample Flows](/developers/backend/resources/actors/samples) — Connect a client, run ticks, schedule wakes, and persist data
166
+ * - [`types generate`](/developers/references/cli/commands/types-generate) — Generate TypeScript types from deployed actors
167
+ *
168
+ * ## Authentication modes
169
+ *
170
+ * This module is available in anonymous or user authentication mode
171
+ * (`base44.actors`). It isn't available with service role authentication. Apps that
172
+ * require login can reject anonymous connections in the actor's `handleConnect()` method.
173
+ *
174
+ * @example
97
175
  * ```typescript
98
- * const conn = base44.actors.MyActor("room-1").connect();
99
- * const sub = conn.subscribe((msg) => console.log(msg)); // typed via ActorRegistry
176
+ * const conn = base44.actors.Chat("session-1").connect({ id: "tab-1" });
177
+ * const sub = conn.subscribe((msg) => console.log(msg));
100
178
  * conn.send({ type: "message", text: "hi" });
101
179
  * sub.unsubscribe();
102
180
  * conn.close();
@@ -1,44 +1,19 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { TrackEventParams, AnalyticsModuleOptions, SessionContext } from "./analytics.types";
2
+ import { TrackEventParams, AnalyticsModuleOptions } from "./analytics.types";
3
3
  import type { InternalAuthModule } from "./auth.types";
4
- import type { ExperimentsContext } from "./experiments-config.types.js";
5
4
  export declare const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
6
5
  export declare const ANALYTICS_INITIALIZATION_EVENT_NAME = "__initialization_event__";
7
6
  export declare const ANALYTICS_SESSION_DURATION_EVENT_NAME = "__session_duration_event__";
8
7
  export declare const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
9
8
  export declare const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
10
- declare function createAnalyticsState(): {
11
- isHeartBeatProcessing: boolean;
12
- wasInitializationTracked: boolean;
13
- sessionContext: SessionContext | null;
14
- sessionContextPromise: Promise<SessionContext> | null;
15
- sessionStartTime: string | null;
16
- fallbackSessionId: string | null;
17
- config: Required<AnalyticsModuleOptions>;
18
- };
19
- type AnalyticsState = ReturnType<typeof createAnalyticsState>;
20
- /** @internal */
21
- export declare function getAnalyticsState(axiosClient: AxiosInstance): AnalyticsState;
22
9
  export interface AnalyticsModuleArgs {
23
10
  axiosClient: AxiosInstance;
24
11
  serverUrl: string;
25
12
  appId: string;
26
13
  userAuthModule: InternalAuthModule;
27
14
  enabled: boolean;
28
- getVisitorId?: () => string | undefined;
29
- experimentsContext?: ExperimentsContext;
30
15
  }
31
- /** @internal */
32
- export declare function isAnalyticsEnabled(enabled: boolean, state?: {
33
- isHeartBeatProcessing: boolean;
34
- wasInitializationTracked: boolean;
35
- sessionContext: SessionContext | null;
36
- sessionContextPromise: Promise<SessionContext> | null;
37
- sessionStartTime: string | null;
38
- fallbackSessionId: string | null;
39
- config: Required<AnalyticsModuleOptions>;
40
- }): boolean;
41
- export declare const createAnalyticsModule: ({ axiosClient, appId, userAuthModule, enabled, getVisitorId, experimentsContext, }: AnalyticsModuleArgs) => {
16
+ export declare const createAnalyticsModule: ({ axiosClient, serverUrl, appId, userAuthModule, enabled, }: AnalyticsModuleArgs) => {
42
17
  track: (params: TrackEventParams) => void;
43
18
  cleanup: () => void;
44
19
  };
@@ -52,15 +27,6 @@ export declare const createAnalyticsModule: ({ axiosClient, appId, userAuthModul
52
27
  *
53
28
  * @internal
54
29
  */
55
- export declare function resetAnalyticsSessionContext(axiosClient?: AxiosInstance): void;
30
+ export declare function resetAnalyticsSessionContext(): void;
56
31
  export declare function getAnalyticsConfigFromUrlParams(): AnalyticsModuleOptions | undefined;
57
- export declare function getAnalyticsSessionId(state?: {
58
- isHeartBeatProcessing: boolean;
59
- wasInitializationTracked: boolean;
60
- sessionContext: SessionContext | null;
61
- sessionContextPromise: Promise<SessionContext> | null;
62
- sessionStartTime: string | null;
63
- fallbackSessionId: string | null;
64
- config: Required<AnalyticsModuleOptions>;
65
- }): string;
66
- export {};
32
+ export declare function getAnalyticsSessionId(): string;