@rudderstack/analytics-js 3.21.0 → 3.22.1-beta.pr.2309.e8431bc
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 +25 -0
- package/dist/npm/index.d.cts +229 -58
- package/dist/npm/index.d.mts +229 -58
- package/dist/npm/legacy/bundled/cjs/index.cjs +199 -286
- package/dist/npm/legacy/bundled/esm/index.mjs +199 -286
- package/dist/npm/legacy/bundled/umd/index.js +199 -286
- package/dist/npm/legacy/cjs/index.cjs +199 -286
- package/dist/npm/legacy/content-script/cjs/index.cjs +198 -285
- package/dist/npm/legacy/content-script/esm/index.mjs +198 -285
- package/dist/npm/legacy/content-script/umd/index.js +198 -285
- package/dist/npm/legacy/esm/index.mjs +199 -286
- package/dist/npm/legacy/umd/index.js +199 -286
- package/dist/npm/modern/bundled/cjs/index.cjs +189 -139
- package/dist/npm/modern/bundled/esm/index.mjs +189 -139
- package/dist/npm/modern/bundled/umd/index.js +189 -139
- package/dist/npm/modern/cjs/index.cjs +58 -40
- package/dist/npm/modern/content-script/cjs/index.cjs +188 -138
- package/dist/npm/modern/content-script/esm/index.mjs +188 -138
- package/dist/npm/modern/content-script/umd/index.js +188 -138
- package/dist/npm/modern/esm/index.mjs +58 -40
- package/dist/npm/modern/umd/index.js +58 -40
- package/package.json +1 -1
package/dist/npm/index.d.mts
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
import { Event } from '@bugsnag/js';
|
2
|
-
|
3
1
|
type LoggerProvider$1 = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
|
4
2
|
interface ILogger {
|
5
3
|
minLogLevel: number;
|
@@ -14,6 +12,7 @@ interface ILogger {
|
|
14
12
|
setMinLogLevel(logLevel: LogLevel): void;
|
15
13
|
}
|
16
14
|
type LogLevel = 'LOG' | 'INFO' | 'DEBUG' | 'WARN' | 'ERROR' | 'NONE';
|
15
|
+
type RSALogger = Pick<ILogger, 'log' | 'info' | 'debug' | 'warn' | 'error' | 'setMinLogLevel'>;
|
17
16
|
|
18
17
|
type LoggerProvider = Record<Exclude<Lowercase<LogLevel>, Lowercase<'NONE'>>, (...data: any[]) => void>;
|
19
18
|
|
@@ -62,6 +61,7 @@ type IntegrationOpts = {
|
|
62
61
|
[index: string]: DestinationIntgConfig;
|
63
62
|
};
|
64
63
|
|
64
|
+
type Traits = Nullable<ApiObject>;
|
65
65
|
type ApiCallback = (data?: any) => void;
|
66
66
|
/**
|
67
67
|
* Represents the options parameter in the APIs
|
@@ -161,6 +161,11 @@ type CookieSameSite = 'Strict' | 'Lax' | 'None';
|
|
161
161
|
type OneTrustCookieCategory = {
|
162
162
|
oneTrustCookieCategory: string;
|
163
163
|
};
|
164
|
+
type ConsentManagement = {
|
165
|
+
deniedConsentIds: Consents;
|
166
|
+
allowedConsentIds: Consents;
|
167
|
+
provider: ConsentManagementProvider;
|
168
|
+
};
|
164
169
|
type ConsentManagementMetadata = {
|
165
170
|
providers: ConsentManagementProviderMetadata[];
|
166
171
|
};
|
@@ -421,6 +426,137 @@ type IdentifyTraits = {
|
|
421
426
|
[index: string]: string | number | boolean | ApiObject | null | Date | (string | number | boolean | null | Date | ApiObject)[] | undefined;
|
422
427
|
};
|
423
428
|
|
429
|
+
type AppInfo = {
|
430
|
+
readonly name: string;
|
431
|
+
readonly version: string;
|
432
|
+
readonly namespace: string;
|
433
|
+
readonly installType: string;
|
434
|
+
};
|
435
|
+
type LibraryInfo = {
|
436
|
+
readonly name: string;
|
437
|
+
readonly version: string;
|
438
|
+
readonly snippetVersion?: string;
|
439
|
+
};
|
440
|
+
type OSInfo = {
|
441
|
+
readonly name: string;
|
442
|
+
readonly version: string;
|
443
|
+
};
|
444
|
+
type ScreenInfo = {
|
445
|
+
readonly density: number;
|
446
|
+
readonly width: number;
|
447
|
+
readonly height: number;
|
448
|
+
readonly innerWidth: number;
|
449
|
+
readonly innerHeight: number;
|
450
|
+
};
|
451
|
+
type UTMParameters = Record<string, string>;
|
452
|
+
|
453
|
+
type PageLifecycle = {
|
454
|
+
pageViewId: string;
|
455
|
+
};
|
456
|
+
type AutoTrack = {
|
457
|
+
page: PageLifecycle;
|
458
|
+
};
|
459
|
+
type RudderContext = {
|
460
|
+
[index: string]: string | number | boolean | ApiObject | UADataValues | Nullable<string> | (string | number | boolean | ApiObject)[] | undefined;
|
461
|
+
traits?: Nullable<ApiObject>;
|
462
|
+
sessionId?: number;
|
463
|
+
sessionStart?: boolean;
|
464
|
+
consentManagement?: ConsentManagement;
|
465
|
+
'ua-ch'?: UADataValues;
|
466
|
+
app: AppInfo;
|
467
|
+
library: LibraryInfo;
|
468
|
+
userAgent: Nullable<string>;
|
469
|
+
os: OSInfo;
|
470
|
+
locale: Nullable<string>;
|
471
|
+
screen: ScreenInfo;
|
472
|
+
campaign?: UTMParameters;
|
473
|
+
trulyAnonymousTracking?: boolean;
|
474
|
+
timezone: string;
|
475
|
+
autoTrack?: AutoTrack;
|
476
|
+
};
|
477
|
+
type RudderEvent = {
|
478
|
+
type: RudderEventType;
|
479
|
+
channel: string;
|
480
|
+
anonymousId: string;
|
481
|
+
context: RudderContext;
|
482
|
+
originalTimestamp: string;
|
483
|
+
integrations: IntegrationOpts;
|
484
|
+
messageId: string;
|
485
|
+
event: Nullable<string>;
|
486
|
+
previousId?: string;
|
487
|
+
userId?: Nullable<string>;
|
488
|
+
sentAt?: string;
|
489
|
+
properties?: Nullable<ApiObject>;
|
490
|
+
name?: Nullable<string>;
|
491
|
+
category?: Nullable<string>;
|
492
|
+
traits?: Traits;
|
493
|
+
groupId?: Nullable<string>;
|
494
|
+
};
|
495
|
+
type RSAEvent = {
|
496
|
+
message: RudderEvent;
|
497
|
+
};
|
498
|
+
|
499
|
+
type DestinationConnectionMode = 'hybrid' | 'cloud' | 'device';
|
500
|
+
type DestinationEvent = {
|
501
|
+
eventName: string;
|
502
|
+
};
|
503
|
+
type ConsentsConfig = {
|
504
|
+
consent: string;
|
505
|
+
};
|
506
|
+
type ConsentManagementProviderConfig = {
|
507
|
+
provider: ConsentManagementProvider;
|
508
|
+
consents: ConsentsConfig[];
|
509
|
+
resolutionStrategy: string | undefined;
|
510
|
+
};
|
511
|
+
/**
|
512
|
+
* The common configuration properties for all device
|
513
|
+
* and hybrid mode supported destinations.
|
514
|
+
*/
|
515
|
+
type BaseDestinationConfig = {
|
516
|
+
blacklistedEvents: DestinationEvent[];
|
517
|
+
whitelistedEvents: DestinationEvent[];
|
518
|
+
eventFilteringOption: EventFilteringOption;
|
519
|
+
consentManagement: ConsentManagementProviderConfig[];
|
520
|
+
connectionMode: DestinationConnectionMode;
|
521
|
+
};
|
522
|
+
type DestinationConfig = BaseDestinationConfig & {
|
523
|
+
iubendaConsentPurposes?: IubendaConsentPurpose[];
|
524
|
+
oneTrustCookieCategories?: OneTrustCookieCategory[];
|
525
|
+
ketchConsentPurposes?: KetchConsentPurpose[];
|
526
|
+
clickEventConversions?: Conversion[];
|
527
|
+
pageLoadConversions?: Conversion[];
|
528
|
+
conversionID?: string;
|
529
|
+
conversionLinker?: boolean;
|
530
|
+
disableAdPersonalization?: boolean;
|
531
|
+
dynamicRemarketing?: boolean;
|
532
|
+
sendPageView?: boolean;
|
533
|
+
defaultPageConversion?: string;
|
534
|
+
enableConversionEventsFiltering?: boolean;
|
535
|
+
trackConversions?: boolean;
|
536
|
+
trackDynamicRemarketing?: boolean;
|
537
|
+
tagID?: string;
|
538
|
+
advertiserId?: string;
|
539
|
+
partnerId?: string;
|
540
|
+
measurementId?: string;
|
541
|
+
capturePageView?: string;
|
542
|
+
useNativeSDKToSend?: boolean;
|
543
|
+
extendPageViewParams?: boolean;
|
544
|
+
eventMappingFromConfig?: EventMapping[];
|
545
|
+
appKey?: string;
|
546
|
+
dataCenter?: string;
|
547
|
+
enableBrazeLogging?: boolean;
|
548
|
+
enableNestedArrayOperations?: boolean;
|
549
|
+
enableSubscriptionGroupInGroupCall?: boolean;
|
550
|
+
supportDedup?: boolean;
|
551
|
+
trackAnonymousUser?: boolean;
|
552
|
+
serverUrl?: string;
|
553
|
+
containerID?: string;
|
554
|
+
fs_debug_mode?: boolean;
|
555
|
+
fs_org?: boolean;
|
556
|
+
siteID?: string;
|
557
|
+
[key: string]: any;
|
558
|
+
};
|
559
|
+
|
424
560
|
type AnalyticsIdentifyMethod = {
|
425
561
|
(userId: string, traits?: Nullable<IdentifyTraits>, options?: Nullable<ApiOptions>, callback?: ApiCallback): void;
|
426
562
|
(userId: string, traits?: Nullable<IdentifyTraits>, callback?: ApiCallback): void;
|
@@ -558,7 +694,82 @@ interface IRudderAnalytics<T = any> {
|
|
558
694
|
* @param options Consent API options
|
559
695
|
*/
|
560
696
|
consent(options?: ConsentOptions): void;
|
697
|
+
/**
|
698
|
+
* To add a custom integration for a custom destination
|
699
|
+
* @param destinationId The ID of the custom destination from the RudderStack dashboard
|
700
|
+
* @param integration The custom integration object
|
701
|
+
*/
|
702
|
+
addCustomIntegration(destinationId: string, integration: RSACustomIntegration): void;
|
561
703
|
}
|
704
|
+
type RSAnalytics = Pick<IRudderAnalytics, 'track' | 'page' | 'identify' | 'group' | 'alias' | 'getAnonymousId' | 'getUserId' | 'getUserTraits' | 'getGroupId' | 'getGroupTraits' | 'getSessionId'>;
|
705
|
+
/**
|
706
|
+
* Type for the custom destination configuration object
|
707
|
+
* For now, it is the same as the base destination config
|
708
|
+
* but in the future, it can be extended to include more properties
|
709
|
+
*/
|
710
|
+
type CustomDestinationConfig = BaseDestinationConfig;
|
711
|
+
/**
|
712
|
+
* Type for the custom integration to be used in addCustomIntegration API
|
713
|
+
* Defines the contract that all custom integrations must implement
|
714
|
+
*/
|
715
|
+
type RSACustomIntegration = {
|
716
|
+
/**
|
717
|
+
* Initialize the integration
|
718
|
+
* @param destinationConfig - The custom destination configuration object
|
719
|
+
* @param analytics - The RudderStack analytics instance
|
720
|
+
* @param logger - The logger instance for this integration
|
721
|
+
* @optional
|
722
|
+
*/
|
723
|
+
init?: (destinationConfig: CustomDestinationConfig, analytics: RSAnalytics, logger: RSALogger) => void;
|
724
|
+
/**
|
725
|
+
* Check if the integration is ready to process events
|
726
|
+
* @param analytics - The RudderStack analytics instance
|
727
|
+
* @param logger - The logger instance for this integration
|
728
|
+
* @returns boolean indicating whether the integration is ready
|
729
|
+
* @required
|
730
|
+
*/
|
731
|
+
isReady: (analytics: RSAnalytics, logger: RSALogger) => boolean;
|
732
|
+
/**
|
733
|
+
* Process track events
|
734
|
+
* @param analytics - The RudderStack analytics instance
|
735
|
+
* @param logger - The logger instance for this integration
|
736
|
+
* @param event - The track event payload to process
|
737
|
+
* @optional
|
738
|
+
*/
|
739
|
+
track?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
740
|
+
/**
|
741
|
+
* Process page events
|
742
|
+
* @param analytics - The RudderStack analytics instance
|
743
|
+
* @param logger - The logger instance for this integration
|
744
|
+
* @param event - The page event payload to process
|
745
|
+
* @optional
|
746
|
+
*/
|
747
|
+
page?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
748
|
+
/**
|
749
|
+
* Process identify events
|
750
|
+
* @param analytics - The RudderStack analytics instance
|
751
|
+
* @param logger - The logger instance for this integration
|
752
|
+
* @param event - The identify event payload to process
|
753
|
+
* @optional
|
754
|
+
*/
|
755
|
+
identify?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
756
|
+
/**
|
757
|
+
* Process group events
|
758
|
+
* @param analytics - The RudderStack analytics instance
|
759
|
+
* @param logger - The logger instance for this integration
|
760
|
+
* @param event - The group event payload to process
|
761
|
+
* @optional
|
762
|
+
*/
|
763
|
+
group?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
764
|
+
/**
|
765
|
+
* Process alias events
|
766
|
+
* @param analytics - The RudderStack analytics instance
|
767
|
+
* @param logger - The logger instance for this integration
|
768
|
+
* @param event - The alias event payload to process
|
769
|
+
* @optional
|
770
|
+
*/
|
771
|
+
alias?: (analytics: RSAnalytics, logger: RSALogger, event: RSAEvent) => void;
|
772
|
+
};
|
562
773
|
|
563
774
|
type SDKError = unknown | Error | ErrorEvent | Event | PromiseRejectionEvent;
|
564
775
|
type ErrorInfo = {
|
@@ -567,6 +778,7 @@ type ErrorInfo = {
|
|
567
778
|
customMessage?: string;
|
568
779
|
errorType?: ErrorType;
|
569
780
|
groupingHash?: string | SDKError;
|
781
|
+
category?: 'sdk' | 'integrations';
|
570
782
|
};
|
571
783
|
interface IErrorHandler {
|
572
784
|
httpClient: IHttpClient;
|
@@ -826,61 +1038,6 @@ interface IUserSessionManager {
|
|
826
1038
|
setAuthToken(token: Nullable<string>): void;
|
827
1039
|
}
|
828
1040
|
|
829
|
-
type DestinationConnectionMode = 'hybrid' | 'cloud' | 'device';
|
830
|
-
type DestinationEvent = {
|
831
|
-
eventName: string;
|
832
|
-
};
|
833
|
-
type ConsentsConfig = {
|
834
|
-
consent: string;
|
835
|
-
};
|
836
|
-
type ConsentManagementProviderConfig = {
|
837
|
-
provider: ConsentManagementProvider;
|
838
|
-
consents: ConsentsConfig[];
|
839
|
-
resolutionStrategy: string | undefined;
|
840
|
-
};
|
841
|
-
type DestinationConfig = {
|
842
|
-
blacklistedEvents: DestinationEvent[];
|
843
|
-
whitelistedEvents: DestinationEvent[];
|
844
|
-
iubendaConsentPurposes?: IubendaConsentPurpose[];
|
845
|
-
oneTrustCookieCategories?: OneTrustCookieCategory[];
|
846
|
-
ketchConsentPurposes?: KetchConsentPurpose[];
|
847
|
-
consentManagement?: ConsentManagementProviderConfig[];
|
848
|
-
eventFilteringOption: EventFilteringOption;
|
849
|
-
clickEventConversions?: Conversion[];
|
850
|
-
pageLoadConversions?: Conversion[];
|
851
|
-
conversionID?: string;
|
852
|
-
conversionLinker?: boolean;
|
853
|
-
disableAdPersonalization?: boolean;
|
854
|
-
dynamicRemarketing?: boolean;
|
855
|
-
sendPageView?: boolean;
|
856
|
-
defaultPageConversion?: string;
|
857
|
-
enableConversionEventsFiltering?: boolean;
|
858
|
-
trackConversions?: boolean;
|
859
|
-
trackDynamicRemarketing?: boolean;
|
860
|
-
tagID?: string;
|
861
|
-
advertiserId?: string;
|
862
|
-
partnerId?: string;
|
863
|
-
measurementId?: string;
|
864
|
-
capturePageView?: string;
|
865
|
-
useNativeSDKToSend?: boolean;
|
866
|
-
connectionMode?: DestinationConnectionMode;
|
867
|
-
extendPageViewParams?: boolean;
|
868
|
-
eventMappingFromConfig?: EventMapping[];
|
869
|
-
appKey?: string;
|
870
|
-
dataCenter?: string;
|
871
|
-
enableBrazeLogging?: boolean;
|
872
|
-
enableNestedArrayOperations?: boolean;
|
873
|
-
enableSubscriptionGroupInGroupCall?: boolean;
|
874
|
-
supportDedup?: boolean;
|
875
|
-
trackAnonymousUser?: boolean;
|
876
|
-
serverUrl?: string;
|
877
|
-
containerID?: string;
|
878
|
-
fs_debug_mode?: boolean;
|
879
|
-
fs_org?: boolean;
|
880
|
-
siteID?: string;
|
881
|
-
[key: string]: any;
|
882
|
-
};
|
883
|
-
|
884
1041
|
type StatsCollection = {
|
885
1042
|
errors: {
|
886
1043
|
enabled: boolean;
|
@@ -1133,6 +1290,13 @@ interface IAnalytics {
|
|
1133
1290
|
* To set auth token
|
1134
1291
|
*/
|
1135
1292
|
setAuthToken(token: string): void;
|
1293
|
+
/**
|
1294
|
+
* Add a custom integration for a custom destination
|
1295
|
+
* @param destinationId - Unique ID for the custom destination from the RudderStack dashboard
|
1296
|
+
* @param integration - The custom integration instance implementing RSACustomIntegration
|
1297
|
+
* @param isBufferedInvocation - Internal flag to indicate if this is a buffered call
|
1298
|
+
*/
|
1299
|
+
addCustomIntegration(destinationId: string, integration: RSACustomIntegration, isBufferedInvocation?: boolean): void;
|
1136
1300
|
}
|
1137
1301
|
|
1138
1302
|
declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
@@ -1141,6 +1305,12 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1141
1305
|
defaultAnalyticsKey: string;
|
1142
1306
|
logger: Logger;
|
1143
1307
|
constructor();
|
1308
|
+
/**
|
1309
|
+
* Create an instance of the current instance that can be used
|
1310
|
+
* to call a subset of methods of the current instance.
|
1311
|
+
* It is typically used to expose the analytics instance to the integrations (standard and custom)
|
1312
|
+
*/
|
1313
|
+
createSafeAnalyticsInstance(): void;
|
1144
1314
|
static initializeGlobalResources(): void;
|
1145
1315
|
/**
|
1146
1316
|
* Set instance to use if no specific writeKey is provided in methods
|
@@ -1235,6 +1405,7 @@ declare class RudderAnalytics implements IRudderAnalytics<IAnalytics> {
|
|
1235
1405
|
getSessionId(): Nullable<number> | undefined;
|
1236
1406
|
setAuthToken(token: string): void;
|
1237
1407
|
consent(options?: ConsentOptions): void;
|
1408
|
+
addCustomIntegration(destinationId: string, integration: RSACustomIntegration): void;
|
1238
1409
|
}
|
1239
1410
|
//# sourceMappingURL=RudderAnalytics.d.ts.map
|
1240
1411
|
|
@@ -1246,4 +1417,4 @@ declare global {
|
|
1246
1417
|
//# sourceMappingURL=index.d.ts.map
|
1247
1418
|
|
1248
1419
|
export { RudderAnalytics };
|
1249
|
-
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|
1420
|
+
export type { AnonymousIdOptions, ApiCallback, ApiObject, ApiOptions, BeaconQueueOpts, ConsentOptions, CookieSameSite, DestinationsQueueOpts, IdentifyTraits, IntegrationOpts, LoadOptions, LogLevel, PluginName, PreloadedEventCall, QueueOpts, RSACustomIntegration, RSAEvent, RSALogger, RSAnalytics, RudderAnalyticsPreloader, SessionOpts, UaChTrackLevel };
|