@rudderstack/analytics-js 3.0.0-beta.1 → 3.0.0-beta.10

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/package.json CHANGED
@@ -1,32 +1,36 @@
1
1
  {
2
2
  "name": "@rudderstack/analytics-js",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "RudderStack Javascript SDK",
5
- "main": "modern/cjs/index.js",
6
- "module": "modern/esm/index.js",
5
+ "main": "dist/npm/modern/cjs/index.js",
6
+ "module": "dist/npm/modern/esm/index.js",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./index.d.ts",
10
- "require": "./modern/cjs/index.js",
11
- "import": "./modern/esm/index.js"
9
+ "types": "./dist/npm/index.d.ts",
10
+ "require": "./dist/npm/modern/cjs/index.js",
11
+ "import": "./dist/npm/modern/esm/index.js"
12
12
  },
13
13
  "./legacy": {
14
- "types": "./index.d.ts",
15
- "require": "./legacy/cjs/index.js",
16
- "import": "./legacy/esm/index.js"
17
- }
18
- },
19
- "typesVersions": {
20
- "*": {
21
- ".": [
22
- "index.d.ts"
23
- ]
14
+ "types": "./dist/npm/index.d.ts",
15
+ "require": "./dist/npm/legacy/cjs/index.js",
16
+ "import": "./dist/npm/legacy/esm/index.js"
17
+ },
18
+ "./bundled": {
19
+ "types": "./dist/npm/index.d.ts",
20
+ "require": "./dist/npm/modern/bundled/cjs/index.js",
21
+ "import": "./dist/npm/modern/bundled/esm/index.js"
24
22
  }
25
23
  },
24
+ "types": "./dist/npm/index.d.ts",
26
25
  "publishConfig": {
27
- "directory": "dist/npm",
28
26
  "access": "public"
29
27
  },
28
+ "files": [
29
+ "dist/npm",
30
+ "LICENSE",
31
+ "README.md",
32
+ "CHANGELOG.md"
33
+ ],
30
34
  "keywords": [
31
35
  "analytics",
32
36
  "rudder"
@@ -41,22 +45,24 @@
41
45
  "bugs": {
42
46
  "url": "https://github.com/rudderlabs/rudder-sdk-js/issues"
43
47
  },
44
- "homepage": "https://github.com/rudderlabs/rudder-sdk-js/blob/master/README.md",
48
+ "homepage": "https://github.com/rudderlabs/rudder-sdk-js/blob/main/packages/analytics-js/README.md",
45
49
  "scripts": {
46
- "clean": "rimraf -rf ./dist && rimraf -rf ./node_modules/.cache && rimraf tsconfig.tsbuildinfo && rimraf -rf ./reports",
50
+ "clean": "rimraf -rf ./dist && rimraf -rf ./node_modules/.cache && rimraf -rf ./reports",
47
51
  "start": "rollup -c --watch --environment DEV_SERVER,PROD_DEBUG",
52
+ "start:modern": "BROWSERSLIST_ENV=modern npm run start",
48
53
  "build": "npm run build:browser && npm run build:package",
49
54
  "build:browser:modern": "BROWSERSLIST_ENV=modern npm run build:browser",
50
55
  "build:browser": "rollup -c --environment VERSION:$npm_package_version,UGLIFY,PROD_DEBUG,ENV:prod",
51
56
  "build:npm": "rollup -c --environment VERSION:$npm_package_version,ENV:prod,MODULE_TYPE:npm",
57
+ "build:npm:bundled": "BUNDLED_PLUGINS=all npm run build:npm:modern",
52
58
  "build:npm:modern": "BROWSERSLIST_ENV=modern npm run build:npm",
53
- "build:package": "npm run build:npm:modern && npm run build:npm",
59
+ "build:package": "npm run build:npm:modern && npm run build:npm && npm run build:npm:bundled",
54
60
  "build:browser:test": "ONLY_IIFE=true npm run build:browser && sed 's/var rudderanalytics/rudderanalytics/g' dist/cdn/legacy/iife/rsa.min.js > __mocks__/cdnSDKv3.js",
55
- "test": "npm run build:browser:test && jest --watchAll=false --detectOpenHandles --forceExit --maxWorkers=50% --coverage",
56
- "test:ci": "npm run build:browser:test && jest --watchAll=false --detectOpenHandles --forceExit --maxWorkers=2 --coverage",
57
- "check:lint:dev": "eslint --ext .js,.ts src",
58
- "check:lint": "eslint --ext .js,.ts src -f json -o reports/eslint.json || exit 0",
59
- "check:size:build": "npm run clean && npm run build:browser && npm run build:browser:modern && npm run build:package",
61
+ "test": "npm run build:browser:test && nx test --maxWorkers=50%",
62
+ "test:ci": "npm run build:browser:test && nx test --parallel=false --configuration=ci --runInBand --maxWorkers=1 --forceExit",
63
+ "check:lint": "nx lint",
64
+ "check:lint:ci": "nx lint --configuration=ci",
65
+ "check:size:build": "npm run build:browser && npm run build:browser:modern && npm run build:package",
60
66
  "check:size": "npm run check:size:build && size-limit",
61
67
  "check:size:json": "size-limit --json",
62
68
  "check:circular": "madge --circular --extensions js,ts src || exit 0",
@@ -64,102 +70,18 @@
64
70
  "check:support:modern": "NODE_ENV=modern npx browserslist --mobile-to-desktop",
65
71
  "check:duplicates": "jscpd src",
66
72
  "check:security": "npm audit --recursive --audit-level=high",
67
- "start:modern": "BROWSERSLIST_ENV=modern npm run start",
68
73
  "build:modern": "npm run build:browser:modern && npm run build:npm:modern",
69
- "package": "cd dist/npm && npm pack --pack-destination ../../",
74
+ "package": "npm pack",
70
75
  "release": "npm publish"
71
76
  },
72
- "engines": {
73
- "node": ">=v16"
74
- },
75
- "dependencies": {
77
+ "devDependencies": {
76
78
  "@lukeed/uuid": "2.0.1",
77
- "@preact/signals-core": "1.3.1",
78
- "@rudderstack/analytics-js-common": "^3.0.0-beta.1",
79
- "@rudderstack/analytics-js-plugins": "^3.0.0-beta.1",
79
+ "@preact/signals-core": "1.5.0",
80
+ "@rudderstack/analytics-js-common": "*",
81
+ "@rudderstack/analytics-js-plugins": "*",
80
82
  "ramda": "0.29.0",
81
- "storejs": "2.0.5"
83
+ "storejs": "2.0.6"
82
84
  },
83
- "devDependencies": {
84
- "@babel/core": "7.22.9",
85
- "@babel/eslint-parser": "7.22.9",
86
- "@babel/plugin-proposal-class-properties": "7.18.6",
87
- "@babel/plugin-transform-arrow-functions": "7.22.5",
88
- "@babel/plugin-transform-object-assign": "7.22.5",
89
- "@babel/plugin-transform-runtime": "7.22.9",
90
- "@babel/preset-env": "7.22.9",
91
- "@babel/preset-typescript": "7.22.5",
92
- "@commitlint/config-conventional": "17.6.7",
93
- "@commitlint/config-lerna-scopes": "17.6.6",
94
- "@digitalroute/cz-conventional-changelog-for-jira": "8.0.1",
95
- "@originjs/vite-plugin-federation": "1.2.2",
96
- "@rollup/plugin-alias": "5.0.0",
97
- "@rollup/plugin-babel": "6.0.3",
98
- "@rollup/plugin-commonjs": "25.0.3",
99
- "@rollup/plugin-json": "6.0.0",
100
- "@rollup/plugin-node-resolve": "15.1.0",
101
- "@rollup/plugin-replace": "5.0.2",
102
- "@rollup/plugin-terser": "0.4.3",
103
- "@size-limit/file": "8.2.6",
104
- "@size-limit/webpack": "8.2.6",
105
- "@types/jest": "29.5.3",
106
- "@types/ramda": "0.29.3",
107
- "@typescript-eslint/eslint-plugin": "5.59.11",
108
- "@typescript-eslint/parser": "5.59.11",
109
- "assert": "2.0.0",
110
- "babel-eslint": "10.1.0",
111
- "babel-plugin-transform-object-hasown": "1.1.0",
112
- "commitizen": "4.3.0",
113
- "commitlint": "17.6.7",
114
- "conventional-changelog-cli": "2.2.2",
115
- "conventional-github-releaser": "3.1.5",
116
- "dotenv": "16.3.1",
117
- "eslint": "8.45.0",
118
- "eslint-config-airbnb": "19.0.4",
119
- "eslint-config-airbnb-base": "15.0.0",
120
- "eslint-config-airbnb-typescript": "17.1.0",
121
- "eslint-config-prettier": "8.8.0",
122
- "eslint-import-resolver-typescript": "3.5.5",
123
- "eslint-plugin-compat": "4.1.4",
124
- "eslint-plugin-import": "2.27.5",
125
- "eslint-plugin-sonarjs": "0.19.0",
126
- "eslint-plugin-unicorn": "48.0.0",
127
- "esm": "3.2.25",
128
- "http-server": "14.1.1",
129
- "husky": "8.0.3",
130
- "isomorphic-fetch": "3.0.0",
131
- "jest": "29.6.1",
132
- "jest-date-mock": "1.0.8",
133
- "jest-environment-jsdom": "29.6.1",
134
- "jest-junit": "16.0.0",
135
- "jest-sonar": "0.2.16",
136
- "jest-watch-typeahead": "2.2.2",
137
- "jscpd": "3.5.9",
138
- "lint-staged": "13.2.3",
139
- "madge": "6.1.0",
140
- "msw": "1.2.2",
141
- "patch-package": "7.0.2",
142
- "prettier": "2.8.8",
143
- "rollup": "3.20.2",
144
- "rollup-plugin-copy": "3.4.0",
145
- "rollup-plugin-delete": "2.0.0",
146
- "rollup-plugin-dts": "5.3.0",
147
- "rollup-plugin-exclude-dependencies-from-bundle": "1.1.23",
148
- "rollup-plugin-external-globals": "0.8.0",
149
- "rollup-plugin-filesize": "10.0.0",
150
- "rollup-plugin-generate-html-template": "1.7.0",
151
- "rollup-plugin-livereload": "2.0.5",
152
- "rollup-plugin-polyfill-node": "0.12.0",
153
- "rollup-plugin-serve": "2.0.2",
154
- "rollup-plugin-typescript2": "0.35.0",
155
- "rollup-plugin-visualizer": "5.9.2",
156
- "size-limit": "8.2.6",
157
- "standard-version": "9.5.0",
158
- "ts-jest": "29.1.1",
159
- "tslib": "2.6.0",
160
- "typescript": "4.9.5"
161
- },
162
- "overrides": {},
163
85
  "browserslist": {
164
86
  "production": [
165
87
  "defaults",
@@ -179,5 +101,6 @@
179
101
  "last 1 edge version",
180
102
  "last 1 safari version"
181
103
  ]
182
- }
104
+ },
105
+ "dependencies": {}
183
106
  }
package/index.d.ts DELETED
@@ -1,358 +0,0 @@
1
- import { AnonymousIdOptions, LoadOptions } from '@rudderstack/analytics-js-common/types/LoadOptions';
2
- export { AnonymousIdOptions, BeaconQueueOpts, CookieSameSite, DestinationsQueueOpts, LoadOptions, QueueOpts, SessionOpts, UaChTrackLevel } from '@rudderstack/analytics-js-common/types/LoadOptions';
3
- import { APIEvent, ApiCallback, ApiOptions } from '@rudderstack/analytics-js-common/types/EventApi';
4
- export { ApiCallback, ApiOptions } from '@rudderstack/analytics-js-common/types/EventApi';
5
- import { ApiObject } from '@rudderstack/analytics-js-common/types/ApiObject';
6
- export { ApiObject } from '@rudderstack/analytics-js-common/types/ApiObject';
7
- export { IntegrationOpts } from '@rudderstack/analytics-js-common/types/Integration';
8
- export { ResidencyServerRegion } from '@rudderstack/analytics-js-common/types/DataResidency';
9
- import { ILogger } from '@rudderstack/analytics-js-common/types/Logger';
10
- export { LogLevel } from '@rudderstack/analytics-js-common/types/Logger';
11
- import { IPluginsManager } from '@rudderstack/analytics-js-common/types/PluginsManager';
12
- export { PluginName } from '@rudderstack/analytics-js-common/types/PluginsManager';
13
- import { IRudderAnalytics } from '@rudderstack/analytics-js-common/types/IRudderAnalytics';
14
- import { Nullable } from '@rudderstack/analytics-js-common/types/Nullable';
15
- import { IHttpClient } from '@rudderstack/analytics-js-common/types/HttpClient';
16
- import { IErrorHandler } from '@rudderstack/analytics-js-common/types/ErrorHandler';
17
- import { IExternalSrcLoader } from '@rudderstack/analytics-js-common/services/ExternalSrcLoader/types';
18
- import { IStore, IStorage, IStoreConfig, IStoreManager } from '@rudderstack/analytics-js-common/types/Store';
19
- import { LifecycleStatus } from '@rudderstack/analytics-js-common/types/ApplicationLifecycle';
20
- import { PageCallOptions, TrackCallOptions, IdentifyCallOptions, AliasCallOptions, GroupCallOptions } from '@rudderstack/analytics-js-common/utilities/eventMethodOverloads';
21
- import { ApplicationState } from '@rudderstack/analytics-js-common/types/ApplicationState';
22
-
23
- interface ICapabilitiesManager {
24
- logger?: ILogger;
25
- errorHandler?: IErrorHandler;
26
- externalSrcLoader?: IExternalSrcLoader;
27
- init(): void;
28
- detectBrowserCapabilities(): void;
29
- prepareBrowserCapabilities(): void;
30
- attachWindowListeners(): void;
31
- onReady(): void;
32
- }
33
-
34
- interface IEventManager {
35
- init(): void;
36
- addEvent(event: APIEvent): void;
37
- }
38
-
39
- /**
40
- * Store Implementation with dedicated storage
41
- */
42
- declare class Store implements IStore {
43
- id: string;
44
- name: string;
45
- isEncrypted: boolean;
46
- validKeys: Record<string, string>;
47
- engine: IStorage;
48
- originalEngine: IStorage;
49
- noKeyValidation?: boolean;
50
- noCompoundKey?: boolean;
51
- errorHandler?: IErrorHandler;
52
- hasErrorHandler: boolean;
53
- logger?: ILogger;
54
- pluginsManager?: IPluginsManager;
55
- constructor(config: IStoreConfig, engine?: IStorage, pluginsManager?: IPluginsManager);
56
- /**
57
- * Ensure the key is valid and with correct format
58
- */
59
- createValidKey(key: string): string | undefined;
60
- /**
61
- * Switch to inMemoryEngine, bringing any existing data with.
62
- */
63
- swapQueueStoreToInMemoryEngine(): void;
64
- /**
65
- * Set value by key.
66
- */
67
- set(key: string, value: any): void;
68
- /**
69
- * Get by Key.
70
- */
71
- get<T = any>(key: string): Nullable<T>;
72
- /**
73
- * Remove by Key.
74
- */
75
- remove(key: string): void;
76
- /**
77
- * Get original engine
78
- */
79
- getOriginalEngine(): IStorage;
80
- /**
81
- * Decrypt values
82
- */
83
- decrypt(value?: Nullable<string>): Nullable<string>;
84
- /**
85
- * Encrypt value
86
- */
87
- encrypt(value: Nullable<any>): string;
88
- /**
89
- * Extension point to use with encryption plugins
90
- */
91
- crypto(value: Nullable<any>, mode: 'encrypt' | 'decrypt'): string;
92
- /**
93
- * Handle errors
94
- */
95
- onError(error: unknown): void;
96
- }
97
- //# sourceMappingURL=Store.d.ts.map
98
-
99
- interface IUserSessionManager {
100
- store?: IStore;
101
- init(storage: IStore): void;
102
- setAnonymousId(anonymousId?: string, rudderAmpLinkerParam?: string): void;
103
- getAnonymousId(options?: AnonymousIdOptions): string;
104
- refreshSession(): void;
105
- getGroupId(): Nullable<string>;
106
- getUserId(): Nullable<string>;
107
- setUserId(userId?: null | string): void;
108
- setUserTraits(traits?: Nullable<ApiObject>): void;
109
- getUserTraits(): Nullable<ApiObject>;
110
- getGroupTraits(): Nullable<ApiObject>;
111
- setGroupId(groupId?: Nullable<string>): void;
112
- setGroupTraits(traits?: Nullable<ApiObject>): void;
113
- reset(resetAnonymousId?: boolean, noNewSessionStart?: boolean): void;
114
- start(sessionId?: number): void;
115
- end(): void;
116
- clearUserSessionStorage(resetAnonymousId?: boolean): void;
117
- }
118
-
119
- interface IConfigManager {
120
- httpClient: IHttpClient;
121
- errorHandler?: IErrorHandler;
122
- logger?: ILogger;
123
- init: () => void;
124
- getConfig: () => void;
125
- processConfig: () => void;
126
- }
127
-
128
- /**
129
- * A buffer queue to serve as a store for any type of data
130
- */
131
- declare class BufferQueue<T = any> {
132
- items: T[];
133
- constructor();
134
- enqueue(item: T): void;
135
- dequeue(): Nullable<T> | undefined;
136
- isEmpty(): boolean;
137
- size(): number;
138
- clear(): void;
139
- }
140
- //# sourceMappingURL=BufferQueue.d.ts.map
141
-
142
- type PreloadedEventCall = Array<string | any>;
143
-
144
- interface IAnalytics {
145
- preloadBuffer: BufferQueue<PreloadedEventCall>;
146
- initialized: boolean;
147
- status?: LifecycleStatus;
148
- httpClient: IHttpClient;
149
- logger: ILogger;
150
- errorHandler: IErrorHandler;
151
- externalSrcLoader: IExternalSrcLoader;
152
- capabilitiesManager: ICapabilitiesManager;
153
- storeManager?: IStoreManager;
154
- configManager?: IConfigManager;
155
- eventManager?: IEventManager;
156
- userSessionManager?: IUserSessionManager;
157
- pluginsManager?: IPluginsManager;
158
- clientDataStore?: Store;
159
- /**
160
- * Start application lifecycle if not already started
161
- */
162
- load(writeKey: string, dataPlaneUrl?: string | Partial<LoadOptions>, loadOptions?: Partial<LoadOptions>): void;
163
- /**
164
- * Orchestrate the lifecycle of the application phases/status
165
- */
166
- startLifecycle(): void;
167
- /**
168
- * Load browser polyfill if required
169
- */
170
- prepareBrowserCapabilities(): void;
171
- /**
172
- * Enqueue in buffer the events that were triggered pre SDK initialization
173
- */
174
- enqueuePreloadBufferEvents(bufferedEvents: PreloadedEventCall[]): void;
175
- /**
176
- * Start the process of consuming the buffered events that were triggered pre SDK initialization
177
- */
178
- processDataInPreloadBuffer(): void;
179
- /**
180
- * Assign instances for the internal services
181
- */
182
- prepareInternalServices(): void;
183
- /**
184
- * Load configuration
185
- */
186
- loadConfig(): void;
187
- /**
188
- * Initialize the storage and event queue
189
- */
190
- init(): void;
191
- /**
192
- * Load plugins
193
- */
194
- loadPlugins(): void;
195
- /**
196
- * Trigger onLoaded callback if any is provided in config
197
- */
198
- onLoaded(): void;
199
- /**
200
- * Consume preloaded events buffer
201
- */
202
- processBufferedEvents(): void;
203
- /**
204
- * Load device mode integrations
205
- */
206
- loadIntegrations(): void;
207
- /**
208
- * Invoke the ready callbacks if any exist
209
- */
210
- onReady(): void;
211
- /**
212
- * To register a callback for SDK ready state
213
- */
214
- ready(callback: ApiCallback): void;
215
- /**
216
- * To record a page view event
217
- */
218
- page(pageOptions: PageCallOptions): void;
219
- /**
220
- * To record a user track event
221
- */
222
- track(trackCallOptions: TrackCallOptions): void;
223
- /**
224
- * To record a user identification event
225
- */
226
- identify(identifyCallOptions: IdentifyCallOptions): void;
227
- /**
228
- * To record a user alias event
229
- */
230
- alias(aliasCallOptions: AliasCallOptions): void;
231
- /**
232
- * To record a user group event
233
- */
234
- group(groupCallOptions: GroupCallOptions): void;
235
- /**
236
- * To get anonymousId set in the SDK
237
- */
238
- getAnonymousId(options?: AnonymousIdOptions): string | undefined;
239
- /**
240
- * To set anonymousId
241
- */
242
- setAnonymousId(anonymousId?: string, rudderAmpLinkerParam?: string): void;
243
- /**
244
- * Clear user information, optionally anonymousId as well
245
- */
246
- reset(resetAnonymousId?: boolean): void;
247
- /**
248
- * To get userId set in the SDK
249
- */
250
- getUserId(): Nullable<string> | undefined;
251
- /**
252
- * To get user traits set in the SDK
253
- */
254
- getUserTraits(): Nullable<ApiObject> | undefined;
255
- /**
256
- * To get groupId set in the SDK
257
- */
258
- getGroupId(): Nullable<string> | undefined;
259
- /**
260
- * To get group traits set in the SDK
261
- */
262
- getGroupTraits(): Nullable<ApiObject> | undefined;
263
- /**
264
- * To manually start user session in the SDK
265
- */
266
- startSession(sessionId?: number): void;
267
- /**
268
- * To manually end user session in the SDK
269
- */
270
- endSession(): void;
271
- /**
272
- * To fetch the current sessionId
273
- */
274
- getSessionId(): Nullable<number>;
275
- }
276
-
277
- declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
278
- static globalSingleton: Nullable<RudderAnalytics>;
279
- analyticsInstances: Record<string, IAnalytics>;
280
- defaultAnalyticsKey: string;
281
- constructor();
282
- /**
283
- * Set instance to use if no specific writeKey is provided in methods
284
- * automatically for the first created instance
285
- * TODO: to support multiple analytics instances in the near future
286
- */
287
- setDefaultInstanceKey(writeKey: string): void;
288
- /**
289
- * Retrieve an existing analytics instance
290
- */
291
- getAnalyticsInstance(writeKey?: string): IAnalytics;
292
- /**
293
- * Create new analytics instance and trigger application lifecycle start
294
- */
295
- load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial<LoadOptions>): void;
296
- /**
297
- * Get preloaded events in buffer queue if exists
298
- */
299
- getPreloadBuffer(): void;
300
- /**
301
- * Trigger load event in buffer queue if exists
302
- */
303
- triggerBufferedLoadEvent(): void;
304
- /**
305
- * Get ready callback arguments and forward to ready call
306
- */
307
- ready(callback: ApiCallback): void;
308
- /**
309
- * Process page arguments and forward to page call
310
- */
311
- page(category?: string | Nullable<ApiObject> | ApiCallback, name?: string | Nullable<ApiOptions> | Nullable<ApiObject> | ApiCallback, properties?: Nullable<ApiOptions> | Nullable<ApiObject> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
312
- /**
313
- * Process track arguments and forward to page call
314
- */
315
- track(event: string, properties?: Nullable<ApiObject> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
316
- /**
317
- * Process identify arguments and forward to page call
318
- */
319
- identify(userId?: string | number | Nullable<ApiObject>, traits?: Nullable<ApiObject> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
320
- /**
321
- * Process alias arguments and forward to page call
322
- */
323
- alias(to?: Nullable<string> | ApiCallback, from?: string | Nullable<ApiOptions> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
324
- /**
325
- * Process group arguments and forward to page call
326
- */
327
- group(groupId: string | number | Nullable<ApiObject> | ApiCallback, traits?: Nullable<ApiOptions> | Nullable<ApiObject> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
328
- reset(resetAnonymousId?: boolean): void;
329
- getAnonymousId(options?: AnonymousIdOptions): string | undefined;
330
- setAnonymousId(anonymousId?: string, rudderAmpLinkerParam?: string): void;
331
- getUserId(): Nullable<string> | undefined;
332
- getUserTraits(): Nullable<ApiObject> | undefined;
333
- getGroupId(): Nullable<string> | undefined;
334
- getGroupTraits(): Nullable<ApiObject> | undefined;
335
- startSession(sessionId?: number): void;
336
- endSession(): void;
337
- getSessionId(): Nullable<number>;
338
- }
339
- //# sourceMappingURL=RudderAnalytics.d.ts.map
340
-
341
- /**
342
- * Exposed values that can be accessed as global objects per analytics instance
343
- * // TODO: find all values that need to be exposed in globals if anything else
344
- */
345
- type ExposedGlobals = {
346
- state?: ApplicationState;
347
- preloadedEventsBuffer?: PreloadedEventCall[];
348
- pluginsCDNPath?: string;
349
- };
350
- /**
351
- * Exposing all globally accessible values for all analytics instances
352
- * As key, we use the value of writeKey assigned to analytics instance that the values belong to
353
- */
354
- interface IRudderStackGlobals {
355
- [key: string]: ExposedGlobals;
356
- }
357
-
358
- export { IRudderStackGlobals, RudderAnalytics };