@rudderstack/analytics-js 3.20.1 → 3.21.0-beta.pr.2309.bb541e7
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 +12 -0
- package/dist/npm/index.d.cts +161 -2
- package/dist/npm/index.d.mts +161 -2
- package/dist/npm/legacy/bundled/cjs/index.cjs +133 -205
- package/dist/npm/legacy/bundled/esm/index.mjs +133 -205
- package/dist/npm/legacy/bundled/umd/index.js +133 -205
- package/dist/npm/legacy/cjs/index.cjs +133 -205
- package/dist/npm/legacy/content-script/cjs/index.cjs +133 -205
- package/dist/npm/legacy/content-script/esm/index.mjs +133 -205
- package/dist/npm/legacy/content-script/umd/index.js +133 -205
- package/dist/npm/legacy/esm/index.mjs +133 -205
- package/dist/npm/legacy/umd/index.js +133 -205
- package/dist/npm/modern/bundled/cjs/index.cjs +125 -61
- package/dist/npm/modern/bundled/esm/index.mjs +125 -61
- package/dist/npm/modern/bundled/umd/index.js +125 -61
- package/dist/npm/modern/cjs/index.cjs +84 -45
- package/dist/npm/modern/content-script/cjs/index.cjs +125 -61
- package/dist/npm/modern/content-script/esm/index.mjs +125 -61
- package/dist/npm/modern/content-script/umd/index.js +125 -61
- package/dist/npm/modern/esm/index.mjs +84 -45
- package/dist/npm/modern/umd/index.js +84 -45
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [3.21.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.20.1...@rudderstack/analytics-js@3.21.0) (2025-06-20)
|
6
|
+
|
7
|
+
### Dependency Updates
|
8
|
+
|
9
|
+
* `@rudderstack/analytics-js-cookies` updated to version `0.4.27`
|
10
|
+
* `@rudderstack/analytics-js-common` updated to version `3.21.0`
|
11
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.10.2`
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* **analytics-js:** reduce error noise from CSP/adblocker ([#2296](https://github.com/rudderlabs/rudder-sdk-js/issues/2296)) ([c187816](https://github.com/rudderlabs/rudder-sdk-js/commit/c187816b2cfafb706670824001140e464e3d90d8))
|
16
|
+
|
5
17
|
## [3.20.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.20.0...@rudderstack/analytics-js@3.20.1) (2025-06-12)
|
6
18
|
|
7
19
|
### Dependency Updates
|
package/dist/npm/index.d.cts
CHANGED
@@ -14,6 +14,7 @@ interface ILogger {
|
|
14
14
|
setMinLogLevel(logLevel: LogLevel): void;
|
15
15
|
}
|
16
16
|
type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
|
17
|
+
type RSALogger = Pick<ILogger, 'log' | 'info' | 'debug' | 'warn' | 'error' | 'setMinLogLevel'>;
|
17
18
|
|
18
19
|
type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
|
19
20
|
|
@@ -62,6 +63,7 @@ type IntegrationOpts = {
|
|
62
63
|
[index: string]: DestinationIntgConfig;
|
63
64
|
};
|
64
65
|
|
66
|
+
type Traits = Nullable<ApiObject>;
|
65
67
|
type ApiCallback = (data?: any) => void;
|
66
68
|
/**
|
67
69
|
* Represents the options parameter in the APIs
|
@@ -161,6 +163,11 @@ type CookieSameSite = 'Strict' | 'Lax' | 'None';
|
|
161
163
|
type OneTrustCookieCategory = {
|
162
164
|
oneTrustCookieCategory: string;
|
163
165
|
};
|
166
|
+
type ConsentManagement = {
|
167
|
+
deniedConsentIds: Consents;
|
168
|
+
allowedConsentIds: Consents;
|
169
|
+
provider: ConsentManagementProvider;
|
170
|
+
};
|
164
171
|
type ConsentManagementMetadata = {
|
165
172
|
providers: ConsentManagementProviderMetadata[];
|
166
173
|
};
|
@@ -421,6 +428,76 @@ type IdentifyTraits = {
|
|
421
428
|
[index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
|
422
429
|
};
|
423
430
|
|
431
|
+
type AppInfo = {
|
432
|
+
readonly name: string;
|
433
|
+
readonly version: string;
|
434
|
+
readonly namespace: string;
|
435
|
+
readonly installType: string;
|
436
|
+
};
|
437
|
+
type LibraryInfo = {
|
438
|
+
readonly name: string;
|
439
|
+
readonly version: string;
|
440
|
+
readonly snippetVersion?: string;
|
441
|
+
};
|
442
|
+
type OSInfo = {
|
443
|
+
readonly name: string;
|
444
|
+
readonly version: string;
|
445
|
+
};
|
446
|
+
type ScreenInfo = {
|
447
|
+
readonly density: number;
|
448
|
+
readonly width: number;
|
449
|
+
readonly height: number;
|
450
|
+
readonly innerWidth: number;
|
451
|
+
readonly innerHeight: number;
|
452
|
+
};
|
453
|
+
type UTMParameters = Record<string, string>;
|
454
|
+
|
455
|
+
type PageLifecycle = {
|
456
|
+
pageViewId: string;
|
457
|
+
};
|
458
|
+
type AutoTrack = {
|
459
|
+
page: PageLifecycle;
|
460
|
+
};
|
461
|
+
type RudderContext = {
|
462
|
+
[index: string]: string | number | boolean | ApiObject | UADataValues | Nullable<string> | (string | number | boolean | ApiObject)[] | undefined;
|
463
|
+
traits?: Nullable<ApiObject>;
|
464
|
+
sessionId?: number;
|
465
|
+
sessionStart?: boolean;
|
466
|
+
consentManagement?: ConsentManagement;
|
467
|
+
'ua-ch'?: UADataValues;
|
468
|
+
app: AppInfo;
|
469
|
+
library: LibraryInfo;
|
470
|
+
userAgent: Nullable<string>;
|
471
|
+
os: OSInfo;
|
472
|
+
locale: Nullable<string>;
|
473
|
+
screen: ScreenInfo;
|
474
|
+
campaign?: UTMParameters;
|
475
|
+
trulyAnonymousTracking?: boolean;
|
476
|
+
timezone: string;
|
477
|
+
autoTrack?: AutoTrack;
|
478
|
+
};
|
479
|
+
type RudderEvent = {
|
480
|
+
type: RudderEventType;
|
481
|
+
channel: string;
|
482
|
+
anonymousId: string;
|
483
|
+
context: RudderContext;
|
484
|
+
originalTimestamp: string;
|
485
|
+
integrations: IntegrationOpts;
|
486
|
+
messageId: string;
|
487
|
+
event: Nullable<string>;
|
488
|
+
previousId?: string;
|
489
|
+
userId?: Nullable<string>;
|
490
|
+
sentAt?: string;
|
491
|
+
properties?: Nullable<ApiObject>;
|
492
|
+
name?: Nullable<string>;
|
493
|
+
category?: Nullable<string>;
|
494
|
+
traits?: Traits;
|
495
|
+
groupId?: Nullable<string>;
|
496
|
+
};
|
497
|
+
type RSAEvent = {
|
498
|
+
message: RudderEvent;
|
499
|
+
};
|
500
|
+
|
424
501
|
type AnalyticsIdentifyMethod = {
|
425
502
|
(userId: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
426
503
|
(userId: string, traits?: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
|
@@ -558,7 +635,75 @@ interface IRudderAnalytics<T = any> {
|
|
558
635
|
* @param options Consent API options
|
559
636
|
*/
|
560
637
|
consent(options?: ConsentOptions): void;
|
638
|
+
/**
|
639
|
+
* To add a custom integration
|
640
|
+
* @param name The name of the custom integration
|
641
|
+
* @param integration The custom integration object
|
642
|
+
*/
|
643
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration): void;
|
561
644
|
}
|
645
|
+
type RSAnalytics = Pick<IRudderAnalytics, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'getAnonymousId' | 'getUserId' | 'getUserTraits' | 'getGroupId' | 'getGroupTraits' | 'getSessionId'>;
|
646
|
+
/**
|
647
|
+
* Type for the custom integration to be used in addCustomIntegration API
|
648
|
+
* Defines the contract that all custom integrations must implement
|
649
|
+
*/
|
650
|
+
type RSACustomIntegration = {
|
651
|
+
/**
|
652
|
+
* Initialize the integration
|
653
|
+
* @param analytics - The RudderStack analytics instance
|
654
|
+
* @param logger - The logger instance for this integration
|
655
|
+
* @optional
|
656
|
+
*/
|
657
|
+
init?: (analytics: RSAnalytics, logger: RSALogger) => void;
|
658
|
+
/**
|
659
|
+
* Check if the integration is ready to process events
|
660
|
+
* @param analytics - The RudderStack analytics instance
|
661
|
+
* @param logger - The logger instance for this integration
|
662
|
+
* @returns boolean indicating whether the integration is ready
|
663
|
+
* @required
|
664
|
+
*/
|
665
|
+
isReady: (analytics: RSAnalytics, logger: RSALogger) => boolean;
|
666
|
+
/**
|
667
|
+
* Process track events
|
668
|
+
* @param analytics - The RudderStack analytics instance
|
669
|
+
* @param logger - The logger instance for this integration
|
670
|
+
* @param event - The track event payload to process
|
671
|
+
* @optional
|
672
|
+
*/
|
673
|
+
track?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
674
|
+
/**
|
675
|
+
* Process page events
|
676
|
+
* @param analytics - The RudderStack analytics instance
|
677
|
+
* @param logger - The logger instance for this integration
|
678
|
+
* @param event - The page event payload to process
|
679
|
+
* @optional
|
680
|
+
*/
|
681
|
+
page?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
682
|
+
/**
|
683
|
+
* Process identify events
|
684
|
+
* @param analytics - The RudderStack analytics instance
|
685
|
+
* @param logger - The logger instance for this integration
|
686
|
+
* @param event - The identify event payload to process
|
687
|
+
* @optional
|
688
|
+
*/
|
689
|
+
identify?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
690
|
+
/**
|
691
|
+
* Process group events
|
692
|
+
* @param analytics - The RudderStack analytics instance
|
693
|
+
* @param logger - The logger instance for this integration
|
694
|
+
* @param event - The group event payload to process
|
695
|
+
* @optional
|
696
|
+
*/
|
697
|
+
group?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
698
|
+
/**
|
699
|
+
* Process alias events
|
700
|
+
* @param analytics - The RudderStack analytics instance
|
701
|
+
* @param logger - The logger instance for this integration
|
702
|
+
* @param event - The alias event payload to process
|
703
|
+
* @optional
|
704
|
+
*/
|
705
|
+
alias?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
706
|
+
};
|
562
707
|
|
563
708
|
type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
|
564
709
|
type ErrorInfo = {
|
@@ -572,7 +717,7 @@ interface IErrorHandler {
|
|
572
717
|
httpClient: IHttpClient;
|
573
718
|
logger: ILogger;
|
574
719
|
init(): void;
|
575
|
-
onError(errorInfo: ErrorInfo): void
|
720
|
+
onError(errorInfo: ErrorInfo): Promise<void>;
|
576
721
|
leaveBreadcrumb(breadcrumb: string): void;
|
577
722
|
}
|
578
723
|
declare enum ErrorType {
|
@@ -1133,6 +1278,13 @@ interface IAnalytics {
|
|
1133
1278
|
* To set auth token
|
1134
1279
|
*/
|
1135
1280
|
setAuthToken(token: string): void;
|
1281
|
+
/**
|
1282
|
+
* Add a custom integration to the SDK
|
1283
|
+
* @param name - Unique name for the custom integration
|
1284
|
+
* @param integration - The custom integration instance implementing RSACustomIntegration
|
1285
|
+
* @param isBufferedInvocation - Internal flag to indicate if this is a buffered call
|
1286
|
+
*/
|
1287
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration, isBufferedInvocation?: boolean): void;
|
1136
1288
|
}
|
1137
1289
|
|
1138
1290
|
declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
@@ -1141,6 +1293,12 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1141
1293
|
defaultAnalyticsKey: string;
|
1142
1294
|
logger: Logger;
|
1143
1295
|
constructor();
|
1296
|
+
/**
|
1297
|
+
* Create an instance of the current instance that can be used
|
1298
|
+
* to call a subset of methods of the current instance.
|
1299
|
+
* It is typically used to expose the analytics instance to the integrations (standard and custom)
|
1300
|
+
*/
|
1301
|
+
createSafeAnalyticsInstance(): void;
|
1144
1302
|
static initializeGlobalResources(): void;
|
1145
1303
|
/**
|
1146
1304
|
* Set instance to use if no specific writeKey is provided in methods
|
@@ -1235,6 +1393,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1235
1393
|
getSessionId(): Nullable<number> | undefined;
|
1236
1394
|
setAuthToken(token: string): void;
|
1237
1395
|
consent(options?: ConsentOptions): void;
|
1396
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration): void;
|
1238
1397
|
}
|
1239
1398
|
//# sourceMappingURL=RudderAnalytics.d.ts.map
|
1240
1399
|
|
@@ -1246,4 +1405,4 @@ declare global {
|
|
1246
1405
|
//# sourceMappingURL=index.d.ts.map
|
1247
1406
|
|
1248
1407
|
export { RudderAnalytics };
|
1249
|
-
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|
1408
|
+
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|
package/dist/npm/index.d.mts
CHANGED
@@ -14,6 +14,7 @@ interface ILogger {
|
|
14
14
|
setMinLogLevel(logLevel: LogLevel): void;
|
15
15
|
}
|
16
16
|
type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
|
17
|
+
type RSALogger = Pick<ILogger, 'log' | 'info' | 'debug' | 'warn' | 'error' | 'setMinLogLevel'>;
|
17
18
|
|
18
19
|
type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
|
19
20
|
|
@@ -62,6 +63,7 @@ type IntegrationOpts = {
|
|
62
63
|
[index: string]: DestinationIntgConfig;
|
63
64
|
};
|
64
65
|
|
66
|
+
type Traits = Nullable<ApiObject>;
|
65
67
|
type ApiCallback = (data?: any) => void;
|
66
68
|
/**
|
67
69
|
* Represents the options parameter in the APIs
|
@@ -161,6 +163,11 @@ type CookieSameSite = 'Strict' | 'Lax' | 'None';
|
|
161
163
|
type OneTrustCookieCategory = {
|
162
164
|
oneTrustCookieCategory: string;
|
163
165
|
};
|
166
|
+
type ConsentManagement = {
|
167
|
+
deniedConsentIds: Consents;
|
168
|
+
allowedConsentIds: Consents;
|
169
|
+
provider: ConsentManagementProvider;
|
170
|
+
};
|
164
171
|
type ConsentManagementMetadata = {
|
165
172
|
providers: ConsentManagementProviderMetadata[];
|
166
173
|
};
|
@@ -421,6 +428,76 @@ type IdentifyTraits = {
|
|
421
428
|
[index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
|
422
429
|
};
|
423
430
|
|
431
|
+
type AppInfo = {
|
432
|
+
readonly name: string;
|
433
|
+
readonly version: string;
|
434
|
+
readonly namespace: string;
|
435
|
+
readonly installType: string;
|
436
|
+
};
|
437
|
+
type LibraryInfo = {
|
438
|
+
readonly name: string;
|
439
|
+
readonly version: string;
|
440
|
+
readonly snippetVersion?: string;
|
441
|
+
};
|
442
|
+
type OSInfo = {
|
443
|
+
readonly name: string;
|
444
|
+
readonly version: string;
|
445
|
+
};
|
446
|
+
type ScreenInfo = {
|
447
|
+
readonly density: number;
|
448
|
+
readonly width: number;
|
449
|
+
readonly height: number;
|
450
|
+
readonly innerWidth: number;
|
451
|
+
readonly innerHeight: number;
|
452
|
+
};
|
453
|
+
type UTMParameters = Record<string, string>;
|
454
|
+
|
455
|
+
type PageLifecycle = {
|
456
|
+
pageViewId: string;
|
457
|
+
};
|
458
|
+
type AutoTrack = {
|
459
|
+
page: PageLifecycle;
|
460
|
+
};
|
461
|
+
type RudderContext = {
|
462
|
+
[index: string]: string | number | boolean | ApiObject | UADataValues | Nullable<string> | (string | number | boolean | ApiObject)[] | undefined;
|
463
|
+
traits?: Nullable<ApiObject>;
|
464
|
+
sessionId?: number;
|
465
|
+
sessionStart?: boolean;
|
466
|
+
consentManagement?: ConsentManagement;
|
467
|
+
'ua-ch'?: UADataValues;
|
468
|
+
app: AppInfo;
|
469
|
+
library: LibraryInfo;
|
470
|
+
userAgent: Nullable<string>;
|
471
|
+
os: OSInfo;
|
472
|
+
locale: Nullable<string>;
|
473
|
+
screen: ScreenInfo;
|
474
|
+
campaign?: UTMParameters;
|
475
|
+
trulyAnonymousTracking?: boolean;
|
476
|
+
timezone: string;
|
477
|
+
autoTrack?: AutoTrack;
|
478
|
+
};
|
479
|
+
type RudderEvent = {
|
480
|
+
type: RudderEventType;
|
481
|
+
channel: string;
|
482
|
+
anonymousId: string;
|
483
|
+
context: RudderContext;
|
484
|
+
originalTimestamp: string;
|
485
|
+
integrations: IntegrationOpts;
|
486
|
+
messageId: string;
|
487
|
+
event: Nullable<string>;
|
488
|
+
previousId?: string;
|
489
|
+
userId?: Nullable<string>;
|
490
|
+
sentAt?: string;
|
491
|
+
properties?: Nullable<ApiObject>;
|
492
|
+
name?: Nullable<string>;
|
493
|
+
category?: Nullable<string>;
|
494
|
+
traits?: Traits;
|
495
|
+
groupId?: Nullable<string>;
|
496
|
+
};
|
497
|
+
type RSAEvent = {
|
498
|
+
message: RudderEvent;
|
499
|
+
};
|
500
|
+
|
424
501
|
type AnalyticsIdentifyMethod = {
|
425
502
|
(userId: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
426
503
|
(userId: string, traits?: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
|
@@ -558,7 +635,75 @@ interface IRudderAnalytics<T = any> {
|
|
558
635
|
* @param options Consent API options
|
559
636
|
*/
|
560
637
|
consent(options?: ConsentOptions): void;
|
638
|
+
/**
|
639
|
+
* To add a custom integration
|
640
|
+
* @param name The name of the custom integration
|
641
|
+
* @param integration The custom integration object
|
642
|
+
*/
|
643
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration): void;
|
561
644
|
}
|
645
|
+
type RSAnalytics = Pick<IRudderAnalytics, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'getAnonymousId' | 'getUserId' | 'getUserTraits' | 'getGroupId' | 'getGroupTraits' | 'getSessionId'>;
|
646
|
+
/**
|
647
|
+
* Type for the custom integration to be used in addCustomIntegration API
|
648
|
+
* Defines the contract that all custom integrations must implement
|
649
|
+
*/
|
650
|
+
type RSACustomIntegration = {
|
651
|
+
/**
|
652
|
+
* Initialize the integration
|
653
|
+
* @param analytics - The RudderStack analytics instance
|
654
|
+
* @param logger - The logger instance for this integration
|
655
|
+
* @optional
|
656
|
+
*/
|
657
|
+
init?: (analytics: RSAnalytics, logger: RSALogger) => void;
|
658
|
+
/**
|
659
|
+
* Check if the integration is ready to process events
|
660
|
+
* @param analytics - The RudderStack analytics instance
|
661
|
+
* @param logger - The logger instance for this integration
|
662
|
+
* @returns boolean indicating whether the integration is ready
|
663
|
+
* @required
|
664
|
+
*/
|
665
|
+
isReady: (analytics: RSAnalytics, logger: RSALogger) => boolean;
|
666
|
+
/**
|
667
|
+
* Process track events
|
668
|
+
* @param analytics - The RudderStack analytics instance
|
669
|
+
* @param logger - The logger instance for this integration
|
670
|
+
* @param event - The track event payload to process
|
671
|
+
* @optional
|
672
|
+
*/
|
673
|
+
track?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
674
|
+
/**
|
675
|
+
* Process page events
|
676
|
+
* @param analytics - The RudderStack analytics instance
|
677
|
+
* @param logger - The logger instance for this integration
|
678
|
+
* @param event - The page event payload to process
|
679
|
+
* @optional
|
680
|
+
*/
|
681
|
+
page?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
682
|
+
/**
|
683
|
+
* Process identify events
|
684
|
+
* @param analytics - The RudderStack analytics instance
|
685
|
+
* @param logger - The logger instance for this integration
|
686
|
+
* @param event - The identify event payload to process
|
687
|
+
* @optional
|
688
|
+
*/
|
689
|
+
identify?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
690
|
+
/**
|
691
|
+
* Process group events
|
692
|
+
* @param analytics - The RudderStack analytics instance
|
693
|
+
* @param logger - The logger instance for this integration
|
694
|
+
* @param event - The group event payload to process
|
695
|
+
* @optional
|
696
|
+
*/
|
697
|
+
group?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
698
|
+
/**
|
699
|
+
* Process alias events
|
700
|
+
* @param analytics - The RudderStack analytics instance
|
701
|
+
* @param logger - The logger instance for this integration
|
702
|
+
* @param event - The alias event payload to process
|
703
|
+
* @optional
|
704
|
+
*/
|
705
|
+
alias?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
706
|
+
};
|
562
707
|
|
563
708
|
type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
|
564
709
|
type ErrorInfo = {
|
@@ -572,7 +717,7 @@ interface IErrorHandler {
|
|
572
717
|
httpClient: IHttpClient;
|
573
718
|
logger: ILogger;
|
574
719
|
init(): void;
|
575
|
-
onError(errorInfo: ErrorInfo): void
|
720
|
+
onError(errorInfo: ErrorInfo): Promise<void>;
|
576
721
|
leaveBreadcrumb(breadcrumb: string): void;
|
577
722
|
}
|
578
723
|
declare enum ErrorType {
|
@@ -1133,6 +1278,13 @@ interface IAnalytics {
|
|
1133
1278
|
* To set auth token
|
1134
1279
|
*/
|
1135
1280
|
setAuthToken(token: string): void;
|
1281
|
+
/**
|
1282
|
+
* Add a custom integration to the SDK
|
1283
|
+
* @param name - Unique name for the custom integration
|
1284
|
+
* @param integration - The custom integration instance implementing RSACustomIntegration
|
1285
|
+
* @param isBufferedInvocation - Internal flag to indicate if this is a buffered call
|
1286
|
+
*/
|
1287
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration, isBufferedInvocation?: boolean): void;
|
1136
1288
|
}
|
1137
1289
|
|
1138
1290
|
declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
@@ -1141,6 +1293,12 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1141
1293
|
defaultAnalyticsKey: string;
|
1142
1294
|
logger: Logger;
|
1143
1295
|
constructor();
|
1296
|
+
/**
|
1297
|
+
* Create an instance of the current instance that can be used
|
1298
|
+
* to call a subset of methods of the current instance.
|
1299
|
+
* It is typically used to expose the analytics instance to the integrations (standard and custom)
|
1300
|
+
*/
|
1301
|
+
createSafeAnalyticsInstance(): void;
|
1144
1302
|
static initializeGlobalResources(): void;
|
1145
1303
|
/**
|
1146
1304
|
* Set instance to use if no specific writeKey is provided in methods
|
@@ -1235,6 +1393,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1235
1393
|
getSessionId(): Nullable<number> | undefined;
|
1236
1394
|
setAuthToken(token: string): void;
|
1237
1395
|
consent(options?: ConsentOptions): void;
|
1396
|
+
addCustomIntegration(name: string, integration: RSACustomIntegration): void;
|
1238
1397
|
}
|
1239
1398
|
//# sourceMappingURL=RudderAnalytics.d.ts.map
|
1240
1399
|
|
@@ -1246,4 +1405,4 @@ declare global {
|
|
1246
1405
|
//# sourceMappingURL=index.d.ts.map
|
1247
1406
|
|
1248
1407
|
export { RudderAnalytics };
|
1249
|
-
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|
1408
|
+
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|