@rudderstack/analytics-js 3.0.0-beta.12 → 3.0.0-beta.14
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/CHANGELOG.md +36 -0
- package/README.md +57 -10
- package/dist/npm/index.d.ts +224 -90
- package/dist/npm/legacy/cjs/index.js +217 -147
- package/dist/npm/legacy/esm/index.js +217 -147
- package/dist/npm/legacy/umd/index.js +217 -147
- package/dist/npm/modern/bundled/cjs/index.js +207 -137
- package/dist/npm/modern/bundled/esm/index.js +207 -137
- package/dist/npm/modern/bundled/umd/index.js +207 -137
- package/dist/npm/modern/cjs/index.js +144 -98
- package/dist/npm/modern/esm/index.js +144 -98
- package/dist/npm/modern/umd/index.js +144 -98
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,42 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [3.0.0-beta.14](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.13...@rudderstack/analytics-js@3.0.0-beta.14) (2023-10-27)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* alter life cycle for pre consent ([#1411](https://github.com/rudderlabs/rudder-sdk-js/issues/1411)) ([60ec092](https://github.com/rudderlabs/rudder-sdk-js/commit/60ec0924a1229678fb16d76a34a494c40a622a11))
|
11
|
+
* auto capture timezone as a part of context ([#1464](https://github.com/rudderlabs/rudder-sdk-js/issues/1464)) ([8e66069](https://github.com/rudderlabs/rudder-sdk-js/commit/8e660693d75727d2131a57ca57859e6d0b920e84))
|
12
|
+
* configure cookie to be fetched from exact domain ([#1468](https://github.com/rudderlabs/rudder-sdk-js/issues/1468)) ([4db1b10](https://github.com/rudderlabs/rudder-sdk-js/commit/4db1b10b45b4ffcd652aec6bd684943ca35c6c08))
|
13
|
+
* consent api ([#1458](https://github.com/rudderlabs/rudder-sdk-js/issues/1458)) ([216b405](https://github.com/rudderlabs/rudder-sdk-js/commit/216b405f7c319d5ff2d799d2e3a5efe2ee4a03af))
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* **analytics-js:** correct declared global extended type ([#1460](https://github.com/rudderlabs/rudder-sdk-js/issues/1460)) ([3f15290](https://github.com/rudderlabs/rudder-sdk-js/commit/3f1529037ba0541391b5f8033e37f867fdd7931c))
|
19
|
+
* **analytics-js:** fix remote import error when npm package is bundled with webpack ([#1466](https://github.com/rudderlabs/rudder-sdk-js/issues/1466)) ([3a818ac](https://github.com/rudderlabs/rudder-sdk-js/commit/3a818accd24e6b3667c75a6b60fb12aba36bdf7e))
|
20
|
+
* **monorepo:** update vulnerable dependencies ([#1457](https://github.com/rudderlabs/rudder-sdk-js/issues/1457)) ([7a4bc4c](https://github.com/rudderlabs/rudder-sdk-js/commit/7a4bc4cc641e4fff2a8f561ce6fd67d16c0cd5a0))
|
21
|
+
* upgrade vulnerable cryptoJS dependency, rolup to v4 & NX to v17 ([#1471](https://github.com/rudderlabs/rudder-sdk-js/issues/1471)) ([b2bb21c](https://github.com/rudderlabs/rudder-sdk-js/commit/b2bb21cb3f618f6c86f593d1706abe9e6349066d))
|
22
|
+
|
23
|
+
## [3.0.0-beta.13](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.12...@rudderstack/analytics-js@3.0.0-beta.13) (2023-10-16)
|
24
|
+
|
25
|
+
|
26
|
+
### Features
|
27
|
+
|
28
|
+
* add support for session storage ([#1440](https://github.com/rudderlabs/rudder-sdk-js/issues/1440)) ([7e3106b](https://github.com/rudderlabs/rudder-sdk-js/commit/7e3106b5317af05ad28a9c0c22a50638dbaebdc2))
|
29
|
+
* **analytics-js-service-worker:** deprecate service worker export of rudder-sdk-js package in favor of the new standalone package([#1437](https://github.com/rudderlabs/rudder-sdk-js/issues/1437)) ([1797d3e](https://github.com/rudderlabs/rudder-sdk-js/commit/1797d3ef356e947a528c2de9abcfde245cc28178))
|
30
|
+
* dmt plugin for v3 ([#1412](https://github.com/rudderlabs/rudder-sdk-js/issues/1412)) ([97ee68a](https://github.com/rudderlabs/rudder-sdk-js/commit/97ee68a27daa5ce8c3a098cdc84c4ee7981f1149))
|
31
|
+
|
32
|
+
|
33
|
+
### Bug Fixes
|
34
|
+
|
35
|
+
* **analytics-js-loading-scripts:** add globalThis polyfill for safari ([#1446](https://github.com/rudderlabs/rudder-sdk-js/issues/1446)) ([bf111f8](https://github.com/rudderlabs/rudder-sdk-js/commit/bf111f8fc24fe75d183ea4924423e3c560ce457d))
|
36
|
+
* **analytics-js:** add global definitions extended window type ([#1445](https://github.com/rudderlabs/rudder-sdk-js/issues/1445)) ([b995635](https://github.com/rudderlabs/rudder-sdk-js/commit/b995635a7a3979173d35b34fa32b41b4429b166f))
|
37
|
+
* empty anonymous id after reset call ([#1433](https://github.com/rudderlabs/rudder-sdk-js/issues/1433)) ([b078347](https://github.com/rudderlabs/rudder-sdk-js/commit/b0783478917a75833f6e7133f10ad5f8999866de))
|
38
|
+
* identify traits type ([#1427](https://github.com/rudderlabs/rudder-sdk-js/issues/1427)) ([a58c919](https://github.com/rudderlabs/rudder-sdk-js/commit/a58c919ca36fc4e14d134455a08fe0e35f3e66ce))
|
39
|
+
* pass anonymous id load option to getanonymousid method ([#1443](https://github.com/rudderlabs/rudder-sdk-js/issues/1443)) ([e234a8f](https://github.com/rudderlabs/rudder-sdk-js/commit/e234a8fa7538ac84fbf451aa4b104c1b26b5a04e))
|
40
|
+
|
5
41
|
## [3.0.0-beta.12](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.11...@rudderstack/analytics-js@3.0.0-beta.12) (2023-10-02)
|
6
42
|
|
7
43
|
|
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<p align="center">
|
4
4
|
<a href="https://rudderstack.com/">
|
5
|
-
<img src="https://
|
5
|
+
<img alt="RudderStack" width="512" src="https://raw.githubusercontent.com/rudderlabs/rudder-sdk-js/develop/assets/rs-logo-full-light.jpg">
|
6
6
|
</a>
|
7
7
|
<br />
|
8
8
|
<caption>The Customer Data Platform for Developers</caption>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
---
|
21
21
|
|
22
|
-
#
|
22
|
+
# @rudderstack/analytics-js
|
23
23
|
|
24
24
|
RudderStack Javascript SDK for browsers.
|
25
25
|
|
@@ -27,9 +27,12 @@ RudderStack Javascript SDK for browsers.
|
|
27
27
|
|
28
28
|
## Table of Contents
|
29
29
|
|
30
|
-
- [**Installing the package**](
|
30
|
+
- [**Installing the package**](#installing-the-package)
|
31
|
+
- [**How to build the SDK**](#How-to-build-the-SDK)
|
32
|
+
- [**Usage in Chrome Extensions**](#usage-in-chrome-extensions)
|
33
|
+
- [**Usage in Serverless Runtimes**](#usage-in-serverless-runtimes)
|
31
34
|
|
32
|
-
##
|
35
|
+
## Installing the package
|
33
36
|
|
34
37
|
To install the package via npm, run the following command:
|
35
38
|
|
@@ -39,15 +42,59 @@ npm install @rudderstack/analytics-js --save
|
|
39
42
|
|
40
43
|
**Note that this NPM module is only meant to be used for a browser installation**. If you want to integrate RudderStack with your Node.js application, refer to the [**RudderStack Node.js repository**](https://github.com/rudderlabs/rudder-sdk-node).
|
41
44
|
|
45
|
+
### Available exports
|
46
|
+
|
47
|
+
Default export will fetch the plugins during runtime as federated modules in separate requests.
|
48
|
+
|
49
|
+
```javascript
|
50
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js';
|
51
|
+
|
52
|
+
const analytics = new RudderAnalytics();
|
53
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
54
|
+
window.rudderanalytics = analytics;
|
55
|
+
```
|
56
|
+
|
57
|
+
Bundled export will contain the plugins code as part of the bundle in build time.
|
58
|
+
|
59
|
+
```javascript
|
60
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js/bundled';
|
61
|
+
|
62
|
+
const analytics = new RudderAnalytics();
|
63
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
64
|
+
window.rudderanalytics = analytics;
|
65
|
+
```
|
66
|
+
|
67
|
+
Legacy export will contain the plugins code as part of the bundle in build time and support legacy browsers like IE11.
|
68
|
+
|
69
|
+
```javascript
|
70
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js/legacy';
|
71
|
+
|
72
|
+
const analytics = new RudderAnalytics();
|
73
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
74
|
+
window.rudderanalytics = analytics;
|
75
|
+
```
|
76
|
+
|
77
|
+
## How to build the SDK
|
78
|
+
|
79
|
+
Look for run scripts in the `package.json` file for getting the browser minified and non-minified builds. The builds are
|
80
|
+
updated in the `dist` folder of the directory. Among the others, some of the important ones are:
|
81
|
+
|
82
|
+
- `npm run build:browser:modern`: This outputs **dist/cdn/modern** folder that contains the cdn package contents.
|
83
|
+
- `npm run build:npm`: This outputs **dist/npm** folder that contains the npm package contents.
|
84
|
+
|
42
85
|
## Usage in Chrome Extensions
|
43
86
|
|
44
|
-
RudderStack JS SDK can be used
|
87
|
+
RudderStack JS SDK can be used in Chrome Extensions with manifest v3, both as a content script (via the JavaScript SDK package)
|
88
|
+
or as a background script service worker (via the [service worker package](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker)).
|
89
|
+
|
90
|
+
For examples and specific details look into [Chrome Extensions Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/chrome-extension/USAGE.md)
|
45
91
|
|
46
|
-
|
92
|
+
## Usage in Serverless Runtimes
|
47
93
|
|
48
|
-
|
94
|
+
RudderStack JS SDK [service worker](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker) can be used
|
95
|
+
in serverless runtimes like Cloudflare Workers or Vercel Edge functions.
|
49
96
|
|
50
|
-
|
97
|
+
For examples and specific details look into:
|
51
98
|
|
52
|
-
|
53
|
-
|
99
|
+
- [Vercel Edge Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|
100
|
+
- [Cloudflare Worker Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|
package/dist/npm/index.d.ts
CHANGED
@@ -16,58 +16,31 @@ interface ILogger {
|
|
16
16
|
}
|
17
17
|
type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
|
18
18
|
|
19
|
-
type
|
20
|
-
url: string;
|
21
|
-
default: boolean;
|
22
|
-
};
|
23
|
-
/**
|
24
|
-
* Represents residency server input the options
|
25
|
-
*/
|
26
|
-
type ResidencyServerRegion = 'US' | 'EU';
|
27
|
-
|
28
|
-
type Nullable<T> = T | null;
|
19
|
+
type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
|
29
20
|
|
30
|
-
interface ExtensionPoint {
|
31
|
-
[lifeCycleName: string]: (...args: any[]) => unknown;
|
32
|
-
}
|
33
21
|
/**
|
34
|
-
*
|
35
|
-
* When index signature is provided, every key have to match the type, the types
|
36
|
-
* for 'name', 'deps', and 'initialize' is added as index signature.
|
22
|
+
* Service to log messages/data to output provider, default is console
|
37
23
|
*/
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
invoke: <T = any>(extPoint?: string, allowMultiple?: boolean, ...args: any[]) => Nullable<T>[];
|
57
|
-
invokeSingle: <T = any>(extPoint?: string, ...args: any[]) => Nullable<T>;
|
58
|
-
invokeMultiple: <T = any>(extPoint?: string, ...args: any[]) => Nullable<T>[];
|
59
|
-
}
|
24
|
+
declare class Logger implements ILogger {
|
25
|
+
minLogLevel: number;
|
26
|
+
scope?: string;
|
27
|
+
logProvider: LoggerProvider;
|
28
|
+
constructor(minLogLevel?: LogLevel, scope?: string, logProvider?: Console);
|
29
|
+
log(...data: any[]): void;
|
30
|
+
info(...data: any[]): void;
|
31
|
+
debug(...data: any[]): void;
|
32
|
+
warn(...data: any[]): void;
|
33
|
+
error(...data: any[]): void;
|
34
|
+
outputLog(logMethod: LogLevel, data: any[]): void;
|
35
|
+
setScope(scopeVal: string): void;
|
36
|
+
setMinLogLevel(logLevel: LogLevel): void;
|
37
|
+
/**
|
38
|
+
* Formats the console message using `scope` and styles
|
39
|
+
*/
|
40
|
+
formatLogData(data: any[]): any[];
|
41
|
+
}//# sourceMappingURL=Logger.d.ts.map
|
60
42
|
|
61
|
-
|
62
|
-
engine: IPluginEngine;
|
63
|
-
init(): void;
|
64
|
-
attachEffects(): void;
|
65
|
-
setActivePlugins(): void;
|
66
|
-
invokeMultiple<T = any>(extPoint?: string, ...args: any[]): Nullable<T>[];
|
67
|
-
invokeSingle<T = any>(extPoint?: string, ...args: any[]): Nullable<T>;
|
68
|
-
register(plugins: ExtensionPlugin[]): void;
|
69
|
-
}
|
70
|
-
type PluginName = 'BeaconQueue' | 'Bugsnag' | 'DeviceModeDestinations' | 'DeviceModeTransformation' | 'ErrorReporting' | 'ExternalAnonymousId' | 'GoogleLinker' | 'KetchConsentManager' | 'NativeDestinationQueue' | 'OneTrustConsentManager' | 'StorageEncryption' | 'StorageEncryptionLegacy' | 'StorageMigrator' | 'XhrQueue';
|
43
|
+
type Nullable<T> = T | null;
|
71
44
|
|
72
45
|
/**
|
73
46
|
* Represents a generic object in the APIs
|
@@ -117,24 +90,77 @@ type APIEvent = {
|
|
117
90
|
type RudderEventType = 'page' | 'track' | 'identify' | 'alias' | 'group';
|
118
91
|
type ReadyCallback = () => void;
|
119
92
|
|
93
|
+
type RegionDetails = {
|
94
|
+
url: string;
|
95
|
+
default: boolean;
|
96
|
+
};
|
97
|
+
/**
|
98
|
+
* Represents residency server input the options
|
99
|
+
*/
|
100
|
+
type ResidencyServerRegion = 'US' | 'EU';
|
101
|
+
|
102
|
+
interface ExtensionPoint {
|
103
|
+
[lifeCycleName: string]: (...args: any[]) => unknown;
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* ExtensionPoint can be nested, e.g. 'sdk.initialize.phase1'
|
107
|
+
* When index signature is provided, every key have to match the type, the types
|
108
|
+
* for 'name', 'deps', and 'initialize' is added as index signature.
|
109
|
+
*/
|
110
|
+
interface ExtensionPlugin {
|
111
|
+
name: string;
|
112
|
+
initialize?: (state?: any) => void;
|
113
|
+
deps?: string[];
|
114
|
+
[key: string]: string | (() => void) | ExtensionPoint | ((...args: any[]) => unknown | void) | string[] | undefined;
|
115
|
+
}
|
116
|
+
type PluginEngineConfig = {
|
117
|
+
throws?: boolean | RegExp;
|
118
|
+
};
|
119
|
+
interface IPluginEngine {
|
120
|
+
plugins: ExtensionPlugin[];
|
121
|
+
byName: Record<string, ExtensionPlugin>;
|
122
|
+
cache: Record<string, ExtensionPlugin[]>;
|
123
|
+
config: PluginEngineConfig;
|
124
|
+
register: (plugin: ExtensionPlugin, state?: Record<string, any>) => void;
|
125
|
+
unregister: (name: string) => void;
|
126
|
+
getPlugin: (name: string) => ExtensionPlugin | undefined;
|
127
|
+
getPlugins: (extPoint?: string) => ExtensionPlugin[];
|
128
|
+
invoke: <T = any>(extPoint?: string, allowMultiple?: boolean, ...args: any[]) => Nullable<T>[];
|
129
|
+
invokeSingle: <T = any>(extPoint?: string, ...args: any[]) => Nullable<T>;
|
130
|
+
invokeMultiple: <T = any>(extPoint?: string, ...args: any[]) => Nullable<T>[];
|
131
|
+
}
|
132
|
+
|
133
|
+
interface IPluginsManager {
|
134
|
+
engine: IPluginEngine;
|
135
|
+
init(): void;
|
136
|
+
attachEffects(): void;
|
137
|
+
setActivePlugins(): void;
|
138
|
+
invokeMultiple<T = any>(extPoint?: string, ...args: any[]): Nullable<T>[];
|
139
|
+
invokeSingle<T = any>(extPoint?: string, ...args: any[]): Nullable<T>;
|
140
|
+
register(plugins: ExtensionPlugin[]): void;
|
141
|
+
}
|
142
|
+
type PluginName = 'BeaconQueue' | 'Bugsnag' | 'CustomConsentManager' | 'DeviceModeDestinations' | 'DeviceModeTransformation' | 'ErrorReporting' | 'ExternalAnonymousId' | 'GoogleLinker' | 'KetchConsentManager' | 'NativeDestinationQueue' | 'OneTrustConsentManager' | 'StorageEncryption' | 'StorageEncryptionLegacy' | 'StorageMigrator' | 'XhrQueue';
|
143
|
+
|
120
144
|
type OneTrustCookieCategory = {
|
121
145
|
oneTrustCookieCategory: string;
|
122
146
|
};
|
123
|
-
type
|
124
|
-
|
125
|
-
|
126
|
-
|
147
|
+
type ConsentProvider = 'oneTrust' | 'ketch' | 'custom';
|
148
|
+
type Consents = Record<string, string> | string[];
|
149
|
+
type ConsentManagementOptions = {
|
150
|
+
enabled: boolean;
|
151
|
+
provider: ConsentProvider;
|
152
|
+
allowedConsentIds?: Consents;
|
153
|
+
deniedConsentIds?: Consents;
|
127
154
|
};
|
128
|
-
type
|
129
|
-
|
130
|
-
|
131
|
-
deniedConsentIds?: string[];
|
155
|
+
type ConsentsInfo = {
|
156
|
+
allowedConsentIds?: Consents;
|
157
|
+
deniedConsentIds?: Consents;
|
132
158
|
};
|
133
159
|
type KetchConsentPurpose = {
|
134
160
|
purpose: string;
|
135
161
|
};
|
136
162
|
|
137
|
-
type UserSessionKeys = 'userId' | 'userTraits' | 'anonymousId' | 'groupId' | 'groupTraits' | 'initialReferrer' | 'initialReferringDomain' | 'sessionInfo';
|
163
|
+
type UserSessionKeys = 'userId' | 'userTraits' | 'anonymousId' | 'groupId' | 'groupTraits' | 'initialReferrer' | 'initialReferringDomain' | 'sessionInfo' | 'authToken';
|
138
164
|
|
139
165
|
type StorageEncryptionVersion = 'legacy' | 'v3';
|
140
166
|
type StorageType = 'cookieStorage' | 'localStorage' | 'memoryStorage' | 'sessionStorage' | 'none';
|
@@ -231,7 +257,6 @@ type PreConsentOptions = {
|
|
231
257
|
enabled: boolean;
|
232
258
|
storage?: PreConsentStorageOptions;
|
233
259
|
events?: PreConsentEventsOptions;
|
234
|
-
trackConsent?: boolean;
|
235
260
|
};
|
236
261
|
/**
|
237
262
|
* Represents the options parameter in the load API
|
@@ -249,7 +274,6 @@ type LoadOptions = {
|
|
249
274
|
useBeacon?: boolean;
|
250
275
|
beaconQueueOptions?: BeaconQueueOpts;
|
251
276
|
destinationsQueueOptions?: DestinationsQueueOpts;
|
252
|
-
cookieConsentManager?: CookieConsentOptions;
|
253
277
|
anonymousIdOptions?: AnonymousIdOptions;
|
254
278
|
setCookieDomain?: string;
|
255
279
|
sameSiteCookie: CookieSameSite;
|
@@ -269,38 +293,105 @@ type LoadOptions = {
|
|
269
293
|
storage?: StorageOpts;
|
270
294
|
preConsent?: PreConsentOptions;
|
271
295
|
transportMode?: EventsTransportMode;
|
296
|
+
consentManagement?: ConsentManagementOptions;
|
297
|
+
sameDomainCookiesOnly?: boolean;
|
298
|
+
};
|
299
|
+
type ConsentOptions = {
|
300
|
+
storage?: StorageOpts;
|
301
|
+
consentManagement?: ConsentManagementOptions;
|
302
|
+
integrations?: IntegrationOpts;
|
303
|
+
discardPreConsentEvents?: boolean;
|
304
|
+
sendPageEvent?: boolean;
|
305
|
+
trackConsent?: boolean;
|
272
306
|
};
|
273
307
|
|
274
|
-
type
|
275
|
-
|
308
|
+
type Address = {
|
309
|
+
city?: string;
|
310
|
+
City?: string;
|
311
|
+
country?: string;
|
312
|
+
Country?: string;
|
313
|
+
postalCode?: string;
|
314
|
+
state?: string;
|
315
|
+
State?: string;
|
316
|
+
street?: string;
|
317
|
+
};
|
318
|
+
type Company = {
|
319
|
+
name?: string;
|
320
|
+
id?: string;
|
321
|
+
industry?: string;
|
322
|
+
employee_count?: string;
|
323
|
+
plan?: string;
|
324
|
+
};
|
276
325
|
/**
|
277
|
-
*
|
326
|
+
* Represents a traits object in the Identify API
|
278
327
|
*/
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
328
|
+
type IdentifyTraits = {
|
329
|
+
id?: string;
|
330
|
+
userId?: string;
|
331
|
+
firstName?: string;
|
332
|
+
firstname?: string;
|
333
|
+
first_name?: string;
|
334
|
+
lastName?: string;
|
335
|
+
lastname?: string;
|
336
|
+
last_name?: string;
|
337
|
+
name?: string;
|
338
|
+
Name?: string;
|
339
|
+
age?: number;
|
340
|
+
email?: string;
|
341
|
+
Email?: string;
|
342
|
+
'E-mail'?: string;
|
343
|
+
phone?: string;
|
344
|
+
address?: string | Address;
|
345
|
+
birthday?: string;
|
346
|
+
company?: Company;
|
347
|
+
createdAt?: string;
|
348
|
+
description?: string;
|
349
|
+
gender?: string;
|
350
|
+
title?: string;
|
351
|
+
username?: string;
|
352
|
+
website?: string;
|
353
|
+
avatar?: string;
|
354
|
+
zip?: string | number;
|
355
|
+
state?: string;
|
356
|
+
State?: string;
|
357
|
+
dob?: string;
|
358
|
+
employed?: string | boolean;
|
359
|
+
education?: string;
|
360
|
+
married?: string | boolean;
|
361
|
+
customerType?: string | number;
|
362
|
+
euConsent?: string;
|
363
|
+
euConsentMessage?: string;
|
364
|
+
newEmail?: string;
|
365
|
+
tags?: string | string[];
|
366
|
+
removeTags?: string | string[];
|
367
|
+
prospect?: string | boolean;
|
368
|
+
doubleOptin?: string | boolean;
|
369
|
+
event_id?: string;
|
370
|
+
constructor?: Record<string, string>;
|
371
|
+
organization?: string;
|
372
|
+
region?: string;
|
373
|
+
anonymous?: string | boolean;
|
374
|
+
country?: string;
|
375
|
+
custom?: string;
|
376
|
+
ip?: string;
|
377
|
+
privateAttributeNames?: any;
|
378
|
+
secondary?: any;
|
379
|
+
customPageId?: string;
|
380
|
+
isRudderEvents?: boolean;
|
381
|
+
optOutType?: boolean | string | number;
|
382
|
+
groupType?: string | number;
|
383
|
+
anonymousId?: string | number;
|
384
|
+
ip_address?: string;
|
385
|
+
number?: string | number;
|
386
|
+
[index: string]: string | number | boolean | ApiObject | null | (string | number | boolean | null | ApiObject)[] | undefined;
|
387
|
+
};
|
297
388
|
|
298
389
|
type AnalyticsIdentifyMethod = {
|
299
|
-
(userId?: string, traits?: Nullable<
|
300
|
-
(userId: string, traits: Nullable<
|
390
|
+
(userId?: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
391
|
+
(userId: string, traits: Nullable<IdentifyTraits>, callback: ApiCallback): void;
|
301
392
|
(userId: string, callback: ApiCallback): void;
|
302
|
-
(traits: Nullable<
|
303
|
-
(traits: Nullable<
|
393
|
+
(traits: Nullable<IdentifyTraits>, options: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
394
|
+
(traits: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
|
304
395
|
};
|
305
396
|
type AnalyticsPageMethod = {
|
306
397
|
(category?: string, name?: string, properties?: Nullable<ApiObject>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
@@ -419,10 +510,20 @@ interface IRudderAnalytics<T = any> {
|
|
419
510
|
* To manually end user session in the SDK
|
420
511
|
*/
|
421
512
|
endSession(): void;
|
513
|
+
/**
|
514
|
+
* To set authorization token
|
515
|
+
* @param token token value
|
516
|
+
*/
|
517
|
+
setAuthToken(token: string): void;
|
422
518
|
/**
|
423
519
|
* To fetch the current sessionId
|
424
520
|
*/
|
425
521
|
getSessionId(): Nullable<number>;
|
522
|
+
/**
|
523
|
+
* To provide consent
|
524
|
+
* @param options Consent API options
|
525
|
+
*/
|
526
|
+
consent(options?: ConsentOptions): void;
|
426
527
|
}
|
427
528
|
|
428
529
|
interface IExternalSourceLoadConfig {
|
@@ -510,7 +611,7 @@ interface IStoreManager {
|
|
510
611
|
errorHandler?: IErrorHandler;
|
511
612
|
logger?: ILogger;
|
512
613
|
init(): void;
|
513
|
-
|
614
|
+
initClientDataStores(): void;
|
514
615
|
setStore(storeConfig: IStoreConfig): IStore;
|
515
616
|
getStore(id: StoreId): IStore | undefined;
|
516
617
|
}
|
@@ -547,6 +648,7 @@ interface ICookieStorageOptions extends CookieOptions {
|
|
547
648
|
domain?: string;
|
548
649
|
secure?: boolean;
|
549
650
|
enabled?: boolean;
|
651
|
+
sameDomainCookiesOnly?: boolean;
|
550
652
|
}
|
551
653
|
interface ILocalStorageOptions {
|
552
654
|
enabled?: boolean;
|
@@ -570,7 +672,7 @@ type TrackCallOptions = {
|
|
570
672
|
};
|
571
673
|
type IdentifyCallOptions = {
|
572
674
|
userId?: string | null;
|
573
|
-
traits?: Nullable<
|
675
|
+
traits?: Nullable<IdentifyTraits>;
|
574
676
|
options?: Nullable<ApiOptions>;
|
575
677
|
callback?: ApiCallback;
|
576
678
|
};
|
@@ -665,6 +767,8 @@ interface IUserSessionManager {
|
|
665
767
|
reset(resetAnonymousId?: boolean, noNewSessionStart?: boolean): void;
|
666
768
|
start(sessionId?: number): void;
|
667
769
|
end(): void;
|
770
|
+
syncStorageDataToState(): void;
|
771
|
+
setAuthToken(token: string): void;
|
668
772
|
}
|
669
773
|
|
670
774
|
type DestinationConnectionMode = 'hybrid' | 'cloud' | 'device';
|
@@ -761,6 +865,7 @@ interface IConfigManager {
|
|
761
865
|
interface IEventManager {
|
762
866
|
init(): void;
|
763
867
|
addEvent(event: APIEvent): void;
|
868
|
+
resume(): void;
|
764
869
|
}
|
765
870
|
|
766
871
|
interface ICapabilitiesManager {
|
@@ -775,6 +880,9 @@ interface ICapabilitiesManager {
|
|
775
880
|
}
|
776
881
|
|
777
882
|
type PreloadedEventCall = Array<string | any>;
|
883
|
+
type RudderAnalyticsPreloader = {
|
884
|
+
[index: string]: (...args: number[]) => any;
|
885
|
+
};
|
778
886
|
|
779
887
|
/**
|
780
888
|
* A buffer queue to serve as a store for any type of data
|
@@ -925,6 +1033,15 @@ interface IAnalytics {
|
|
925
1033
|
* To fetch the current sessionId
|
926
1034
|
*/
|
927
1035
|
getSessionId(): Nullable<number>;
|
1036
|
+
/**
|
1037
|
+
* To record consent
|
1038
|
+
* @param options Consent API options
|
1039
|
+
*/
|
1040
|
+
consent(options?: ConsentOptions): void;
|
1041
|
+
/**
|
1042
|
+
* To set auth token
|
1043
|
+
*/
|
1044
|
+
setAuthToken(token: string): void;
|
928
1045
|
}
|
929
1046
|
|
930
1047
|
declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
@@ -970,7 +1087,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
970
1087
|
/**
|
971
1088
|
* Process identify arguments and forward to page call
|
972
1089
|
*/
|
973
|
-
identify(userId?: string | number | Nullable<
|
1090
|
+
identify(userId?: string | number | Nullable<IdentifyTraits>, traits?: Nullable<IdentifyTraits> | Nullable<ApiOptions> | ApiCallback, options?: Nullable<ApiOptions> | ApiCallback, callback?: ApiCallback): void;
|
974
1091
|
/**
|
975
1092
|
* Process alias arguments and forward to page call
|
976
1093
|
*/
|
@@ -989,6 +1106,8 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
989
1106
|
startSession(sessionId?: number): void;
|
990
1107
|
endSession(): void;
|
991
1108
|
getSessionId(): Nullable<number>;
|
1109
|
+
setAuthToken(token: string): void;
|
1110
|
+
consent(options?: ConsentOptions): void;
|
992
1111
|
}
|
993
1112
|
//# sourceMappingURL=RudderAnalytics.d.ts.map
|
994
1113
|
|
@@ -1039,9 +1158,12 @@ type CapabilitiesState = {
|
|
1039
1158
|
isAdBlocked: Signal<boolean>;
|
1040
1159
|
};
|
1041
1160
|
type ConsentsState = {
|
1042
|
-
|
1161
|
+
enabled: Signal<boolean>;
|
1162
|
+
data: Signal<ConsentsInfo>;
|
1163
|
+
initialized: Signal<boolean>;
|
1043
1164
|
activeConsentManagerPluginName: Signal<PluginName | undefined>;
|
1044
|
-
|
1165
|
+
preConsent: Signal<PreConsentOptions>;
|
1166
|
+
postConsent: Signal<ConsentOptions>;
|
1045
1167
|
};
|
1046
1168
|
type ContextState = {
|
1047
1169
|
app: Signal<AppInfo>;
|
@@ -1054,6 +1176,7 @@ type ContextState = {
|
|
1054
1176
|
locale: Signal<Nullable<string>>;
|
1055
1177
|
screen: Signal<ScreenInfo>;
|
1056
1178
|
'ua-ch': Signal<UADataValues | undefined>;
|
1179
|
+
timezone: Signal<string | undefined>;
|
1057
1180
|
};
|
1058
1181
|
type EventBufferState = {
|
1059
1182
|
toBeProcessedArray: Signal<BufferedEvent[]>;
|
@@ -1112,6 +1235,7 @@ type SessionState = {
|
|
1112
1235
|
readonly initialReferrer: Signal<string | undefined>;
|
1113
1236
|
readonly initialReferringDomain: Signal<string | undefined>;
|
1114
1237
|
readonly sessionInfo: Signal<SessionInfo>;
|
1238
|
+
readonly authToken: Signal<Nullable<string>>;
|
1115
1239
|
};
|
1116
1240
|
type SourceConfigState = Signal<Source | undefined>;
|
1117
1241
|
type StorageEntry = {
|
@@ -1163,4 +1287,14 @@ interface IRudderStackGlobals {
|
|
1163
1287
|
[key: string]: ExposedGlobals;
|
1164
1288
|
}
|
1165
1289
|
|
1166
|
-
|
1290
|
+
declare global {
|
1291
|
+
interface Window {
|
1292
|
+
rudderanalytics: RudderAnalytics | PreloadedEventCall[] | RudderAnalyticsPreloader;
|
1293
|
+
RudderStackGlobals: IRudderStackGlobals;
|
1294
|
+
rudderAnalyticsMount: () => void;
|
1295
|
+
rudderAnalyticsBuildType: 'legacy' | 'modern';
|
1296
|
+
}
|
1297
|
+
}
|
1298
|
+
//# sourceMappingURL=index.d.ts.map
|
1299
|
+
|
1300
|
+
export { type AnonymousIdOptions, type ApiCallback, type ApiObject, type ApiOptions, type BeaconQueueOpts, type ConsentOptions, type CookieSameSite, type DestinationsQueueOpts, type IRudderStackGlobals, type IdentifyTraits, type IntegrationOpts, type LoadOptions, type LogLevel, type PluginName, type PreloadedEventCall, type QueueOpts, type ResidencyServerRegion, RudderAnalytics, type RudderAnalyticsPreloader, type SessionOpts, type UaChTrackLevel };
|