@rudderstack/analytics-js 3.0.0-beta.2 → 3.0.0-beta.20

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,32 +1,41 @@
1
1
  {
2
2
  "name": "@rudderstack/analytics-js",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.20",
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"
22
+ },
23
+ "./content-script": {
24
+ "types": "./dist/npm/index.d.ts",
25
+ "require": "./dist/npm/modern/content-script/cjs/index.js",
26
+ "import": "./dist/npm/modern/content-script/esm/index.js"
24
27
  }
25
28
  },
29
+ "types": "./dist/npm/index.d.ts",
26
30
  "publishConfig": {
27
- "directory": "dist/npm",
28
31
  "access": "public"
29
32
  },
33
+ "files": [
34
+ "dist/npm",
35
+ "LICENSE",
36
+ "README.md",
37
+ "CHANGELOG.md"
38
+ ],
30
39
  "keywords": [
31
40
  "analytics",
32
41
  "rudder"
@@ -43,20 +52,23 @@
43
52
  },
44
53
  "homepage": "https://github.com/rudderlabs/rudder-sdk-js/blob/main/packages/analytics-js/README.md",
45
54
  "scripts": {
46
- "clean": "rimraf -rf ./dist && rimraf -rf ./node_modules/.cache && rimraf tsconfig.tsbuildinfo && rimraf -rf ./reports",
55
+ "clean": "rimraf -rf ./dist && rimraf -rf ./node_modules/.cache && rimraf -rf ./reports",
47
56
  "start": "rollup -c --watch --environment DEV_SERVER,PROD_DEBUG",
57
+ "start:modern": "BROWSERSLIST_ENV=modern npm run start",
48
58
  "build": "npm run build:browser && npm run build:package",
49
59
  "build:browser:modern": "BROWSERSLIST_ENV=modern npm run build:browser",
50
60
  "build:browser": "rollup -c --environment VERSION:$npm_package_version,UGLIFY,PROD_DEBUG,ENV:prod",
51
61
  "build:npm": "rollup -c --environment VERSION:$npm_package_version,ENV:prod,MODULE_TYPE:npm",
62
+ "build:npm:bundled": "BUNDLED_PLUGINS=all npm run build:npm:modern",
63
+ "build:npm:content-script": "BUNDLED_PLUGINS=all NO_EXTERNAL_HOST=true npm run build:npm:modern",
52
64
  "build:npm:modern": "BROWSERSLIST_ENV=modern npm run build:npm",
53
- "build:package": "npm run build:npm:modern && npm run build:npm",
65
+ "build:package": "npm run build:npm:modern && npm run build:npm && npm run build:npm:bundled && npm run build:npm:content-script",
54
66
  "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",
67
+ "test": "npm run build:browser:test && nx test --maxWorkers=50%",
68
+ "test:ci": "npm run build:browser:test && nx test --parallel=false --configuration=ci --runInBand --maxWorkers=1 --forceExit",
69
+ "check:lint": "nx lint",
70
+ "check:lint:ci": "nx lint --configuration=ci",
71
+ "check:size:build": "npm run build:browser && npm run build:browser:modern && npm run build:package",
60
72
  "check:size": "npm run check:size:build && size-limit",
61
73
  "check:size:json": "size-limit --json",
62
74
  "check:circular": "madge --circular --extensions js,ts src || exit 0",
@@ -64,103 +76,19 @@
64
76
  "check:support:modern": "NODE_ENV=modern npx browserslist --mobile-to-desktop",
65
77
  "check:duplicates": "jscpd src",
66
78
  "check:security": "npm audit --recursive --audit-level=high",
67
- "start:modern": "BROWSERSLIST_ENV=modern npm run start",
68
79
  "build:modern": "npm run build:browser:modern && npm run build:npm:modern",
69
- "prepare": "npm run build:package",
70
- "package": "cd dist/npm && npm pack --pack-destination ../../",
71
- "release": "npm publish"
72
- },
73
- "engines": {
74
- "node": ">=v16"
75
- },
76
- "dependencies": {
77
- "@lukeed/uuid": "2.0.1",
78
- "@preact/signals-core": "1.3.1",
79
- "@rudderstack/analytics-js-common": "3.0.0-beta.2",
80
- "@rudderstack/analytics-js-plugins": "3.0.0-beta.2",
81
- "ramda": "0.29.0",
82
- "storejs": "2.0.5"
80
+ "package": "npm pack",
81
+ "release": "npm publish",
82
+ "build:browser:LH": "nx run @rudderstack/analytics-js:build-browser && nx run @rudderstack/analytics-js:build-browser-modern"
83
83
  },
84
84
  "devDependencies": {
85
- "@babel/core": "7.22.9",
86
- "@babel/eslint-parser": "7.22.9",
87
- "@babel/plugin-proposal-class-properties": "7.18.6",
88
- "@babel/plugin-transform-arrow-functions": "7.22.5",
89
- "@babel/plugin-transform-object-assign": "7.22.5",
90
- "@babel/plugin-transform-runtime": "7.22.9",
91
- "@babel/preset-env": "7.22.9",
92
- "@babel/preset-typescript": "7.22.5",
93
- "@commitlint/config-conventional": "17.6.7",
94
- "@commitlint/config-lerna-scopes": "17.6.6",
95
- "@digitalroute/cz-conventional-changelog-for-jira": "8.0.1",
96
- "@originjs/vite-plugin-federation": "1.2.2",
97
- "@rollup/plugin-alias": "5.0.0",
98
- "@rollup/plugin-babel": "6.0.3",
99
- "@rollup/plugin-commonjs": "25.0.3",
100
- "@rollup/plugin-json": "6.0.0",
101
- "@rollup/plugin-node-resolve": "15.1.0",
102
- "@rollup/plugin-replace": "5.0.2",
103
- "@rollup/plugin-terser": "0.4.3",
104
- "@size-limit/file": "8.2.6",
105
- "@size-limit/webpack": "8.2.6",
106
- "@types/jest": "29.5.3",
107
- "@types/ramda": "0.29.3",
108
- "@typescript-eslint/eslint-plugin": "5.59.11",
109
- "@typescript-eslint/parser": "5.59.11",
110
- "assert": "2.0.0",
111
- "babel-eslint": "10.1.0",
112
- "babel-plugin-transform-object-hasown": "1.1.0",
113
- "commitizen": "4.3.0",
114
- "commitlint": "17.6.7",
115
- "conventional-changelog-cli": "2.2.2",
116
- "conventional-github-releaser": "3.1.5",
117
- "dotenv": "16.3.1",
118
- "eslint": "8.45.0",
119
- "eslint-config-airbnb": "19.0.4",
120
- "eslint-config-airbnb-base": "15.0.0",
121
- "eslint-config-airbnb-typescript": "17.1.0",
122
- "eslint-config-prettier": "8.8.0",
123
- "eslint-import-resolver-typescript": "3.5.5",
124
- "eslint-plugin-compat": "4.1.4",
125
- "eslint-plugin-import": "2.27.5",
126
- "eslint-plugin-sonarjs": "0.19.0",
127
- "eslint-plugin-unicorn": "48.0.0",
128
- "esm": "3.2.25",
129
- "http-server": "14.1.1",
130
- "husky": "8.0.3",
131
- "isomorphic-fetch": "3.0.0",
132
- "jest": "29.6.1",
133
- "jest-date-mock": "1.0.8",
134
- "jest-environment-jsdom": "29.6.1",
135
- "jest-junit": "16.0.0",
136
- "jest-sonar": "0.2.16",
137
- "jest-watch-typeahead": "2.2.2",
138
- "jscpd": "3.5.9",
139
- "lint-staged": "13.2.3",
140
- "madge": "6.1.0",
141
- "msw": "1.2.2",
142
- "patch-package": "7.0.2",
143
- "prettier": "2.8.8",
144
- "rollup": "3.20.2",
145
- "rollup-plugin-copy": "3.4.0",
146
- "rollup-plugin-delete": "2.0.0",
147
- "rollup-plugin-dts": "5.3.0",
148
- "rollup-plugin-exclude-dependencies-from-bundle": "1.1.23",
149
- "rollup-plugin-external-globals": "0.8.0",
150
- "rollup-plugin-filesize": "10.0.0",
151
- "rollup-plugin-generate-html-template": "1.7.0",
152
- "rollup-plugin-livereload": "2.0.5",
153
- "rollup-plugin-polyfill-node": "0.12.0",
154
- "rollup-plugin-serve": "2.0.2",
155
- "rollup-plugin-typescript2": "0.35.0",
156
- "rollup-plugin-visualizer": "5.9.2",
157
- "size-limit": "8.2.6",
158
- "standard-version": "9.5.0",
159
- "ts-jest": "29.1.1",
160
- "tslib": "2.6.0",
161
- "typescript": "4.9.5"
85
+ "@lukeed/uuid": "2.0.1",
86
+ "@preact/signals-core": "1.5.1",
87
+ "@rudderstack/analytics-js-common": "*",
88
+ "@rudderstack/analytics-js-plugins": "*",
89
+ "ramda": "0.29.1",
90
+ "storejs": "2.0.7"
162
91
  },
163
- "overrides": {},
164
92
  "browserslist": {
165
93
  "production": [
166
94
  "defaults",
@@ -181,5 +109,5 @@
181
109
  "last 1 safari version"
182
110
  ]
183
111
  },
184
- "gitHead": "0b6f1a302a3d3818796db0a7a716113678ab025c"
112
+ "dependencies": {}
185
113
  }
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 };