@rudderstack/analytics-js 3.0.0-beta.6 → 3.0.0-beta.8

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