@base44-preview/sdk 0.8.18-pr.78.04eb7f2 → 0.8.18-pr.79.302a71f
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/client.types.d.ts +18 -21
- package/dist/modules/analytics.types.d.ts +90 -3
- package/package.json +1 -1
package/dist/client.types.d.ts
CHANGED
|
@@ -74,23 +74,20 @@ export interface CreateClientConfig {
|
|
|
74
74
|
* Provides access to all SDK modules for interacting with the app.
|
|
75
75
|
*/
|
|
76
76
|
export interface Base44Client {
|
|
77
|
-
/** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
|
|
78
|
-
entities: EntitiesModule;
|
|
79
|
-
/** {@link IntegrationsModule | Integrations module} for calling pre-built integration endpoints. */
|
|
80
|
-
integrations: IntegrationsModule;
|
|
81
|
-
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
82
|
-
auth: AuthModule;
|
|
83
|
-
/** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
|
|
84
|
-
functions: FunctionsModule;
|
|
85
77
|
/** {@link AgentsModule | Agents module} for managing AI agent conversations. */
|
|
86
78
|
agents: AgentsModule;
|
|
79
|
+
/** {@link AnalyticsModule | Analytics module} for tracking custom events in your app. */
|
|
80
|
+
analytics: AnalyticsModule;
|
|
87
81
|
/** {@link AppLogsModule | App logs module} for tracking app usage. */
|
|
88
82
|
appLogs: AppLogsModule;
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
84
|
+
auth: AuthModule;
|
|
85
|
+
/** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
|
|
86
|
+
entities: EntitiesModule;
|
|
87
|
+
/** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
|
|
88
|
+
functions: FunctionsModule;
|
|
89
|
+
/** {@link IntegrationsModule | Integrations module} for calling pre-built integration endpoints. */
|
|
90
|
+
integrations: IntegrationsModule;
|
|
94
91
|
/** Cleanup function to disconnect WebSocket connections. Call when you're done with the client. */
|
|
95
92
|
cleanup: () => void;
|
|
96
93
|
/**
|
|
@@ -118,22 +115,22 @@ export interface Base44Client {
|
|
|
118
115
|
* @throws {Error} When accessed without providing a serviceToken during client creation
|
|
119
116
|
*/
|
|
120
117
|
readonly asServiceRole: {
|
|
118
|
+
/** {@link AgentsModule | Agents module} with elevated permissions. */
|
|
119
|
+
agents: AgentsModule;
|
|
120
|
+
/** {@link AppLogsModule | App logs module} with elevated permissions. */
|
|
121
|
+
appLogs: AppLogsModule;
|
|
122
|
+
/** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
|
|
123
|
+
connectors: ConnectorsModule;
|
|
121
124
|
/** {@link EntitiesModule | Entities module} with elevated permissions. */
|
|
122
125
|
entities: EntitiesModule;
|
|
126
|
+
/** {@link FunctionsModule | Functions module} with elevated permissions. */
|
|
127
|
+
functions: FunctionsModule;
|
|
123
128
|
/** {@link IntegrationsModule | Integrations module} with elevated permissions. */
|
|
124
129
|
integrations: IntegrationsModule;
|
|
125
130
|
/** {@link SsoModule | SSO module} for generating SSO tokens.
|
|
126
131
|
* @internal
|
|
127
132
|
*/
|
|
128
133
|
sso: SsoModule;
|
|
129
|
-
/** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
|
|
130
|
-
connectors: ConnectorsModule;
|
|
131
|
-
/** {@link FunctionsModule | Functions module} with elevated permissions. */
|
|
132
|
-
functions: FunctionsModule;
|
|
133
|
-
/** {@link AgentsModule | Agents module} with elevated permissions. */
|
|
134
|
-
agents: AgentsModule;
|
|
135
|
-
/** {@link AppLogsModule | App logs module} with elevated permissions. */
|
|
136
|
-
appLogs: AppLogsModule;
|
|
137
134
|
/** Cleanup function to disconnect WebSocket connections. */
|
|
138
135
|
cleanup: () => void;
|
|
139
136
|
};
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties for analytics events.
|
|
3
|
+
*
|
|
4
|
+
* Key-value pairs with additional event data. Values can be strings, numbers, booleans, or null.
|
|
5
|
+
*/
|
|
1
6
|
export type TrackEventProperties = {
|
|
2
7
|
[key: string]: string | number | boolean | null | undefined;
|
|
3
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for tracking an analytics event.
|
|
11
|
+
*/
|
|
4
12
|
export type TrackEventParams = {
|
|
13
|
+
/**
|
|
14
|
+
* Name of the event to track.
|
|
15
|
+
*
|
|
16
|
+
* Use descriptive names like `button_click`, `form_submit`, or `purchase_completed`.
|
|
17
|
+
*/
|
|
5
18
|
eventName: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional key-value pairs with additional event data.
|
|
21
|
+
*
|
|
22
|
+
* Values can be strings, numbers, booleans, or null.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* base44.analytics.track({
|
|
27
|
+
* eventName: 'add_to_cart',
|
|
28
|
+
* properties: {
|
|
29
|
+
* product_id: 'prod_123',
|
|
30
|
+
* price: 29.99,
|
|
31
|
+
* quantity: 2
|
|
32
|
+
* }
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
6
36
|
properties?: TrackEventProperties;
|
|
7
37
|
};
|
|
8
38
|
export type TrackEventIntrinsicData = {
|
|
@@ -37,6 +67,63 @@ export type AnalyticsModuleOptions = {
|
|
|
37
67
|
batchSize?: number;
|
|
38
68
|
heartBeatInterval?: number;
|
|
39
69
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Analytics module for tracking custom events in your app.
|
|
72
|
+
*
|
|
73
|
+
* Use this module to track specific user actions that appear as custom event cards in your [Analytics dashboard](/documentation/performance-and-seo/app-analytics). Track things like button clicks, form submissions, purchases, and feature usage.
|
|
74
|
+
*
|
|
75
|
+
* Choose clear, descriptive event names in snake_case like `signup_button_click` or `purchase_completed` rather than generic names like `click`. Include relevant context in your properties such as identifiers like `product_id`, measurements like `price`, and flags like `is_first_purchase`.
|
|
76
|
+
*
|
|
77
|
+
* This module is only available in user authentication mode (`base44.analytics`).
|
|
78
|
+
*
|
|
79
|
+
* ## Built-in vs Custom Analytics
|
|
80
|
+
*
|
|
81
|
+
* Your Analytics dashboard shows two types of data:
|
|
82
|
+
*
|
|
83
|
+
* **Built-in metrics:**
|
|
84
|
+
* - Total visits, unique visitors, visit duration, and live visitors.
|
|
85
|
+
* - Breakdown cards for country, device, operating system, and referrer.
|
|
86
|
+
*
|
|
87
|
+
* These begin tracking automatically when {@linkcode createClient | createClient()} is called and continue tracking until the client is cleaned up.
|
|
88
|
+
*
|
|
89
|
+
* **Custom events:**
|
|
90
|
+
* - Each event you track with `track()` appears as its own card in the dashboard.
|
|
91
|
+
* - Use these to measure specific actions that matter to your app.
|
|
92
|
+
*
|
|
93
|
+
* These are tracked when you call the `track()` method.
|
|
94
|
+
*/
|
|
95
|
+
export interface AnalyticsModule {
|
|
96
|
+
/**
|
|
97
|
+
* Tracks a custom event that appears as a card in your Analytics dashboard.
|
|
98
|
+
*
|
|
99
|
+
* Each unique event name becomes its own card showing total count and trends over time. This method returns immediately and events are sent in batches in the background.
|
|
100
|
+
*
|
|
101
|
+
* @param params - Event parameters.
|
|
102
|
+
* @param params.eventName - Name of the event. This becomes the card title in your dashboard. Use descriptive names like `'signup_button_click'` or `'purchase_completed'`.
|
|
103
|
+
* @param params.properties - Optional data to attach to the event. You can filter and analyze events by these properties in the dashboard.
|
|
104
|
+
*
|
|
105
|
+
* @example Track a button click
|
|
106
|
+
* ```typescript
|
|
107
|
+
* // Track a button click
|
|
108
|
+
* base44.analytics.track({
|
|
109
|
+
* eventName: 'signup_button_click'
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example Track with properties
|
|
114
|
+
* ```typescript
|
|
115
|
+
* // Track with properties
|
|
116
|
+
* base44.analytics.track({
|
|
117
|
+
* eventName: 'add_to_cart',
|
|
118
|
+
* properties: {
|
|
119
|
+
* product_id: 'prod_123',
|
|
120
|
+
* product_name: 'Premium Widget',
|
|
121
|
+
* price: 29.99,
|
|
122
|
+
* quantity: 2,
|
|
123
|
+
* is_first_purchase: true
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
track(params: TrackEventParams): void;
|
|
129
|
+
}
|