@rudderstack/analytics-js 3.34.3 → 3.35.0
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 +28 -0
- package/dist/npm/index.d.cts +3 -0
- package/dist/npm/index.d.mts +3 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +66 -30
- package/dist/npm/legacy/bundled/esm/index.mjs +66 -30
- package/dist/npm/legacy/bundled/umd/index.js +66 -30
- package/dist/npm/legacy/cjs/index.cjs +66 -30
- package/dist/npm/legacy/content-script/cjs/index.cjs +64 -29
- package/dist/npm/legacy/content-script/esm/index.mjs +64 -29
- package/dist/npm/legacy/content-script/umd/index.js +64 -29
- package/dist/npm/legacy/esm/index.mjs +66 -30
- package/dist/npm/legacy/lite/cjs/index.cjs +66 -30
- package/dist/npm/legacy/lite/esm/index.mjs +66 -30
- package/dist/npm/legacy/lite/umd/index.js +66 -30
- package/dist/npm/legacy/umd/index.js +66 -30
- package/dist/npm/modern/bundled/cjs/index.cjs +379 -301
- package/dist/npm/modern/bundled/esm/index.mjs +379 -301
- package/dist/npm/modern/bundled/umd/index.js +379 -301
- package/dist/npm/modern/cjs/index.cjs +277 -204
- package/dist/npm/modern/content-script/cjs/index.cjs +379 -301
- package/dist/npm/modern/content-script/esm/index.mjs +379 -301
- package/dist/npm/modern/content-script/umd/index.js +379 -301
- package/dist/npm/modern/esm/index.mjs +277 -204
- package/dist/npm/modern/lite/cjs/index.cjs +350 -272
- package/dist/npm/modern/lite/esm/index.mjs +350 -272
- package/dist/npm/modern/lite/umd/index.js +350 -272
- package/dist/npm/modern/umd/index.js +277 -204
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [3.35.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.34.3...@rudderstack/analytics-js@3.35.0) (2026-10-12)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@rudderstack/analytics-js-cookies` updated to version `0.5.17`
|
|
10
|
+
* `@rudderstack/analytics-js-common` updated to version `3.30.2`
|
|
11
|
+
* `@rudderstack/analytics-js-plugins` updated to version `3.18.4`
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add device-mode e2e harness skill ([#3218](https://github.com/rudderlabs/rudder-sdk-js/issues/3218)) ([8b8757a](https://github.com/rudderlabs/rudder-sdk-js/commit/8b8757ae433f6fb15263dcb0b59962925c214a20))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **analytics-js:** drop corrupt store entries on parse failure ([#3236](https://github.com/rudderlabs/rudder-sdk-js/issues/3236)) ([bacb581](https://github.com/rudderlabs/rudder-sdk-js/commit/bacb58169b8ef8393c2e8ebbdcdda28332408f71))
|
|
21
|
+
* **analytics-js:** group remote plugin failures ([#3232](https://github.com/rudderlabs/rudder-sdk-js/issues/3232)) ([0d6a81e](https://github.com/rudderlabs/rudder-sdk-js/commit/0d6a81e78e6ef938af5ec049ed70b2c766b6dc59))
|
|
22
|
+
* **analytics-js:** skip polyfill detection and loading in the modern build ([#3265](https://github.com/rudderlabs/rudder-sdk-js/issues/3265)) ([1ccc2c5](https://github.com/rudderlabs/rudder-sdk-js/commit/1ccc2c58701c44e5b25042267bc855326977cfde))
|
|
23
|
+
* **analytics-js:** stop using Array.prototype.at in the error handler ([#3263](https://github.com/rudderlabs/rudder-sdk-js/issues/3263)) ([1f6a0f7](https://github.com/rudderlabs/rudder-sdk-js/commit/1f6a0f7a02be4e7deb3267ad9d8a62b2aaa162f7))
|
|
24
|
+
* **monorepo:** avoid String.prototype.replaceAll ([#3228](https://github.com/rudderlabs/rudder-sdk-js/issues/3228)) ([e985e82](https://github.com/rudderlabs/rudder-sdk-js/commit/e985e8276c240aab370d9863be661a49da749262))
|
|
25
|
+
* **monorepo:** deliver polyfills to every user agent ([#3229](https://github.com/rudderlabs/rudder-sdk-js/issues/3229)) ([711036d](https://github.com/rudderlabs/rudder-sdk-js/commit/711036df308503243d80ec5264c7034423bbbc41))
|
|
26
|
+
* **monorepo:** lower the modern browserslist floor ([#3231](https://github.com/rudderlabs/rudder-sdk-js/issues/3231)) ([3555bb5](https://github.com/rudderlabs/rudder-sdk-js/commit/3555bb55b3a2bed4e8157399e21aa24ec64a7552))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Performance Improvements
|
|
30
|
+
|
|
31
|
+
* **analytics-js:** compile the CDN modern core for the snippet's floor ([#3264](https://github.com/rudderlabs/rudder-sdk-js/issues/3264)) ([ce0b4ac](https://github.com/rudderlabs/rudder-sdk-js/commit/ce0b4acce5bcfdc67f829965e42821d8566b40e1))
|
|
32
|
+
|
|
5
33
|
## [3.34.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.34.2...@rudderstack/analytics-js@3.34.3) (2026-09-28)
|
|
6
34
|
|
|
7
35
|
### Dependency Updates
|
package/dist/npm/index.d.cts
CHANGED
|
@@ -351,6 +351,9 @@ type LoadOptions = {
|
|
|
351
351
|
lockIntegrationsVersion?: boolean;
|
|
352
352
|
/**
|
|
353
353
|
* @deprecated Plugins version are locked by default. We do not recommend using this option.
|
|
354
|
+
*
|
|
355
|
+
* On a `v3` CDN install, false resolves plugins from a directory that is not refreshed every
|
|
356
|
+
* release, so the chunks can be far older than the core SDK loading them.
|
|
354
357
|
*/
|
|
355
358
|
lockPluginsVersion?: boolean;
|
|
356
359
|
polyfillIfRequired?: boolean;
|
package/dist/npm/index.d.mts
CHANGED
|
@@ -351,6 +351,9 @@ type LoadOptions = {
|
|
|
351
351
|
lockIntegrationsVersion?: boolean;
|
|
352
352
|
/**
|
|
353
353
|
* @deprecated Plugins version are locked by default. We do not recommend using this option.
|
|
354
|
+
*
|
|
355
|
+
* On a `v3` CDN install, false resolves plugins from a directory that is not refreshed every
|
|
356
|
+
* release, so the chunks can be far older than the core SDK loading them.
|
|
354
357
|
*/
|
|
355
358
|
lockPluginsVersion?: boolean;
|
|
356
359
|
polyfillIfRequired?: boolean;
|
|
@@ -913,7 +913,7 @@ Object.getOwnPropertyNames(err).forEach(function(key){if(key!=='message'&&key!==
|
|
|
913
913
|
}}});return newError;}catch(_unused2){return new Error("".concat(issue,": ").concat(stringifyWithoutCircular(err)));}};var dispatchErrorEvent=function dispatchErrorEvent(error){if(isTypeOfError(error)){var errStack=getStacktrace(error);if(errStack){// eslint-disable-next-line no-param-reassign
|
|
914
914
|
error.stack="".concat(errStack,"\n").concat(MANUAL_ERROR_IDENTIFIER);}}globalThis.dispatchEvent(new ErrorEvent('error',{error:error,bubbles:true,cancelable:true,composed:true}));};
|
|
915
915
|
|
|
916
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.
|
|
916
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.35.0';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var BUILD_VARIANT='legacy-bundled';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';var CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
|
917
917
|
|
|
918
918
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
|
919
919
|
|
|
@@ -1033,7 +1033,7 @@ var SUPPORTED_STORAGE_TYPES=['localStorage','memoryStorage','cookieStorage','ses
|
|
|
1033
1033
|
|
|
1034
1034
|
var SOURCE_CONFIG_RESOLUTION_ERROR="Unable to process/parse source configuration response";var SOURCE_DISABLED_ERROR="The source is disabled. Please enable the source in the dashboard to send events.";var XHR_PAYLOAD_PREP_ERROR="Failed to prepare data for the request.";var PLUGIN_EXT_POINT_MISSING_ERROR="Failed to invoke plugin because the extension point name is missing.";var PLUGIN_EXT_POINT_INVALID_ERROR="Failed to invoke plugin because the extension point name is invalid.";var SOURCE_CONFIG_OPTION_ERROR=function SOURCE_CONFIG_OPTION_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"getSourceConfig\" load API option must be a function that returns valid source configuration data.");};var COMPONENT_BASE_URL_ERROR=function COMPONENT_BASE_URL_ERROR(context,component,url){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The base URL \"").concat(url,"\" for ").concat(component," is not valid.");};// ERROR
|
|
1035
1035
|
var UNSUPPORTED_CONSENT_MANAGER_ERROR=function UNSUPPORTED_CONSENT_MANAGER_ERROR(context,selectedConsentManager,consentManagersToPluginNameMap){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The consent manager \"").concat(selectedConsentManager,"\" is not supported. Please choose one of the following supported consent managers: \"").concat(Object.keys(consentManagersToPluginNameMap),"\".");};var NON_ERROR_WARNING=function NON_ERROR_WARNING(context,errStr){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Ignoring a non-error: ").concat(errStr,".");};var BREADCRUMB_ERROR="Failed to log breadcrumb";var HANDLE_ERROR_FAILURE=function HANDLE_ERROR_FAILURE(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to handle the error.");};var PLUGIN_NAME_MISSING_ERROR=function PLUGIN_NAME_MISSING_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin name is missing.");};var PLUGIN_ALREADY_EXISTS_ERROR=function PLUGIN_ALREADY_EXISTS_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" already exists.");};var PLUGIN_NOT_FOUND_ERROR=function PLUGIN_NOT_FOUND_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found.");};var PLUGIN_ENGINE_BUG_ERROR=function PLUGIN_ENGINE_BUG_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.");};var PLUGIN_DEPS_ERROR=function PLUGIN_DEPS_ERROR(context,pluginName,notExistDeps){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" could not be loaded because some of its dependencies \"").concat(notExistDeps,"\" do not exist.");};var PLUGIN_INVOCATION_ERROR=function PLUGIN_INVOCATION_ERROR(context,extPoint,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to invoke the \"").concat(extPoint,"\" extension point of plugin \"").concat(pluginName,"\".");};var SOURCE_CONFIG_FETCH_ERROR='Failed to fetch the source config';var WRITE_KEY_VALIDATION_ERROR=function WRITE_KEY_VALIDATION_ERROR(context,writeKey){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The write key \"").concat(writeKey,"\" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.");};var DATA_PLANE_URL_VALIDATION_ERROR=function DATA_PLANE_URL_VALIDATION_ERROR(context,dataPlaneUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The data plane URL \"").concat(dataPlaneUrl,"\" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.");};var INVALID_CALLBACK_FN_ERROR=function INVALID_CALLBACK_FN_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided callback parameter is not a function.");};var XHR_DELIVERY_ERROR=function XHR_DELIVERY_ERROR(prefix,status,statusText,url,response){return "".concat(prefix," with status ").concat(status," (").concat(statusText,") for URL: ").concat(url,". Response: ").concat(response.trim());};var XHR_REQUEST_ERROR=function XHR_REQUEST_ERROR(prefix,e,url){return "".concat(prefix," due to timeout or no connection (").concat(e?e.type:'',") at the client side for URL: ").concat(url);};var XHR_SEND_ERROR=function XHR_SEND_ERROR(prefix,url){return "".concat(prefix," for URL: ").concat(url);};var STORE_DATA_SAVE_ERROR=function STORE_DATA_SAVE_ERROR(key){return "Failed to save the value for \"".concat(key,"\" to storage");};var STORE_DATA_FETCH_ERROR=function STORE_DATA_FETCH_ERROR(key){return "Failed to retrieve or parse data for \"".concat(key,"\" from storage");};var DATA_SERVER_URL_INVALID_ERROR=function DATA_SERVER_URL_INVALID_ERROR(context,url){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The server side cookies functionality is disabled as the provided data server URL, \"").concat(url,"\" is invalid.");};var DATA_SERVER_REQUEST_FAIL_ERROR=function DATA_SERVER_REQUEST_FAIL_ERROR(status){return "The server responded with status ".concat(status," while setting the cookies. As a fallback, the cookies will be set client side.");};var FAILED_SETTING_COOKIE_FROM_SERVER_ERROR=function FAILED_SETTING_COOKIE_FROM_SERVER_ERROR(key){return "The server failed to set the ".concat(key," cookie. As a fallback, the cookies will be set client side.");};var FAILED_SETTING_COOKIE_FROM_SERVER_GLOBAL_ERROR="Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side.";var COLLAPSED_COOKIE_BATCH_ERROR=function COLLAPSED_COOKIE_BATCH_ERROR(missingCookies,batchSize){return "The server did not set ".concat(missingCookies.length," of the ").concat(batchSize," cookies sent in one request: ").concat(missingCookies.join(', '),". A fallback to set them client side was attempted. Check that the data service and any proxy preserve every \"Set-Cookie\" header, and that the cookie domain and SameSite/Secure attributes are valid.");};// WARNING
|
|
1036
|
-
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default storage type will be used instead.");};var UNSUPPORTED_STORAGE_ENTRY_TYPE_WARNING=function UNSUPPORTED_STORAGE_ENTRY_TYPE_WARNING(context,entry,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" configured for the entry \"").concat(entry,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default storage type will be used instead.");};var UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=function UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage encryption version \"").concat(selectedStorageEncryptionVersion,"\" is not supported. Please choose one of the following supported versions: \"").concat(Object.keys(storageEncryptionVersionsToPluginNameMap),"\". The default version \"").concat(defaultVersion,"\" will be used instead.");};var STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=function STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(context,storageEncryptionVersion,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage data migration has been disabled because the configured storage encryption version (").concat(storageEncryptionVersion,") is not the latest (").concat(defaultVersion,"). To enable storage data migration, please update the storage encryption version to the latest version.");};var SERVER_SIDE_COOKIE_FEATURE_OVERRIDE_ERROR=function SERVER_SIDE_COOKIE_FEATURE_OVERRIDE_ERROR(context,providedCookieDomain,currentCookieDomain){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided cookie domain (").concat(providedCookieDomain,") does not match the current webpage's domain (").concat(currentCookieDomain,"). Hence, the cookies will be set client-side.");};var SERVER_SIDE_COOKIE_DATA_SERVICE_HOST_ERROR=function SERVER_SIDE_COOKIE_DATA_SERVICE_HOST_ERROR(context,dataServiceHost,webpageHost){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The data service host (").concat(dataServiceHost,") cannot set cookies for the current webpage (").concat(webpageHost,"). Hence, the cookies will be set client-side instead of server-side.");};var RESERVED_KEYWORD_WARNING=function RESERVED_KEYWORD_WARNING(context,property,parentKeyPath,reservedElements){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(property,"\" property defined under \"").concat(parentKeyPath,"\" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (").concat(reservedElements,").");};var RESERVED_CUSTOM_CONTEXT_KEY_WARNING=function RESERVED_CUSTOM_CONTEXT_KEY_WARNING(logContext,property){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"The top-level custom context property \"").concat(property,"\" is reserved and was ignored.");};var INVALID_CONTEXT_OBJECT_WARNING=function INVALID_CONTEXT_OBJECT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Please make sure that the \"context\" property in the event API's \"options\" argument is a valid object literal with key-value pairs.");};var INVALID_CUSTOM_CONTEXT_WARNING=function INVALID_CUSTOM_CONTEXT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Invalid custom context. Use a plain object without prototype pollution keys.");};var UNSUPPORTED_BEACON_API_WARNING=function UNSUPPORTED_BEACON_API_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The Beacon API is not supported by your browser. The events will be sent using XHR instead.");};var TIMEOUT_NOT_NUMBER_WARNING=function TIMEOUT_NOT_NUMBER_WARNING(context,timeout,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value \"").concat(timeout,"\" is not a number. The default timeout of ").concat(defaultValue," ms will be used instead.");};var CUT_OFF_DURATION_NOT_NUMBER_WARNING=function CUT_OFF_DURATION_NOT_NUMBER_WARNING(context,cutOffDuration,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session cut off duration value \"").concat(cutOffDuration,"\" is not a number. The default cut off duration of ").concat(defaultValue," ms will be used instead.");};var CUT_OFF_DURATION_LESS_THAN_TIMEOUT_WARNING=function CUT_OFF_DURATION_LESS_THAN_TIMEOUT_WARNING(context,cutOffDuration,timeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session cut off duration value \"").concat(cutOffDuration,"\" ms is less than the session timeout value \"").concat(timeout,"\" ms. The cut off functionality will be disabled.");};var TIMEOUT_ZERO_WARNING=function TIMEOUT_ZERO_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.");};var TIMEOUT_NOT_RECOMMENDED_WARNING=function TIMEOUT_NOT_RECOMMENDED_WARNING(context,timeout,minTimeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value ").concat(timeout," ms is less than the recommended minimum of ").concat(minTimeout," ms. Please consider increasing the timeout value to ensure optimal performance and reliability.");};var INVALID_SESSION_ID_WARNING=function INVALID_SESSION_ID_WARNING(context,sessionId,minSessionIdLength){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided session ID (").concat(sessionId,") is either invalid, not a positive integer, or not at least \"").concat(minSessionIdLength,"\" digits long. A new session ID will be auto-generated instead.");};var STORAGE_QUOTA_EXCEEDED_WARNING=function STORAGE_QUOTA_EXCEEDED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.");};var STORAGE_UNAVAILABLE_WARNING=function STORAGE_UNAVAILABLE_WARNING(context,entry,selectedStorageType,finalStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(selectedStorageType,"\" is not available for entry \"").concat(entry,"\". The SDK will initialize the entry with \"").concat(finalStorageType,"\" storage type instead.");};var CALLBACK_INVOKE_ERROR=function CALLBACK_INVOKE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The callback threw an exception");};var INVALID_CONFIG_URL_WARNING=function INVALID_CONFIG_URL_WARNING(context,configUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided source config URL \"").concat(configUrl,"\" is invalid. Using the default source config URL instead.");};var POLYFILL_SCRIPT_LOAD_ERROR=function POLYFILL_SCRIPT_LOAD_ERROR(scriptId,url){return "Failed to load the polyfill script with ID \"".concat(scriptId,"\" from URL ").concat(url,".");};var UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY=function UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(context,selectedStrategy,defaultStrategy){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy \"").concat(selectedStrategy,"\" is not supported. Please choose one of the following supported strategies: \"none, session, anonymousId\". The default strategy \"").concat(defaultStrategy,"\" will be used instead.");};var DEPRECATED_PRE_CONSENT_STORAGE_STRATEGY=function DEPRECATED_PRE_CONSENT_STORAGE_STRATEGY(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy option is deprecated. Please enable \"storage\" in the pre-consent options and use the \"storage\" load API option instead.");};var UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE=function UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(context,selectedDeliveryType,defaultDeliveryType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent events delivery type \"").concat(selectedDeliveryType,"\" is not supported. Please choose one of the following supported types: \"immediate, buffer\". The default type \"").concat(defaultDeliveryType,"\" will be used instead.");};var DEPRECATED_PLUGIN_WARNING=function DEPRECATED_PLUGIN_WARNING(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR).concat(pluginName," plugin is deprecated. Please exclude it from the load API options.");};var generateMisconfiguredPluginsWarning=function generateMisconfiguredPluginsWarning(context,configurationStatus,missingPlugins,shouldAddMissingPlugins){var isSinglePlugin=missingPlugins.length===1;var pluginsString=isSinglePlugin?" '".concat(missingPlugins[0],"' plugin was"):" ['".concat(missingPlugins.join("', '"),"'] plugins were");var baseWarning="".concat(context).concat(LOG_CONTEXT_SEPARATOR).concat(configurationStatus,", but").concat(pluginsString," not configured to load.");if(shouldAddMissingPlugins){return "".concat(baseWarning," So, ").concat(isSinglePlugin?'the plugin':'those plugins'," will be loaded automatically.");}return "".concat(baseWarning," Ignore if this was intentional. Otherwise, consider adding ").concat(isSinglePlugin?'it':'them'," to the 'plugins' load API option.");};var INVALID_POLYFILL_URL_WARNING=function INVALID_POLYFILL_URL_WARNING(context,customPolyfillUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided polyfill URL \"").concat(customPolyfillUrl,"\" is invalid. The default polyfill URL will be used instead.");};var PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING=function PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Page Unloaded event can only be tracked when the Beacon transport is active. Please enable \"useBeacon\" load API option.");};var UNKNOWN_PLUGINS_WARNING=function UNKNOWN_PLUGINS_WARNING(context,unknownPlugins){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Ignoring unknown plugins: ").concat(unknownPlugins.join(', '),".");};var REMOTE_PLUGIN_LOAD_ERROR=function REMOTE_PLUGIN_LOAD_ERROR(context,pluginName,reason){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load plugin \"").concat(pluginName,"\" - ").concat(reason);};var UNAVAILABLE_PLUGINS_ERROR=function UNAVAILABLE_PLUGINS_ERROR(context,unavailablePlugins){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load the following unavailable local plugins: ").concat(unavailablePlugins.join(', '),". Some features of the SDK may not work as expected. Make sure you are using the correct SDK bundle variant.");};var CUSTOM_INTEGRATION_CANNOT_BE_ADDED_ERROR=function CUSTOM_INTEGRATION_CANNOT_BE_ADDED_ERROR(context,destinationId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Cannot add custom integration for destination ID \"").concat(destinationId,"\" after the SDK is loaded.");};
|
|
1036
|
+
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default storage type will be used instead.");};var UNSUPPORTED_STORAGE_ENTRY_TYPE_WARNING=function UNSUPPORTED_STORAGE_ENTRY_TYPE_WARNING(context,entry,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" configured for the entry \"").concat(entry,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default storage type will be used instead.");};var UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=function UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage encryption version \"").concat(selectedStorageEncryptionVersion,"\" is not supported. Please choose one of the following supported versions: \"").concat(Object.keys(storageEncryptionVersionsToPluginNameMap),"\". The default version \"").concat(defaultVersion,"\" will be used instead.");};var STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=function STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(context,storageEncryptionVersion,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage data migration has been disabled because the configured storage encryption version (").concat(storageEncryptionVersion,") is not the latest (").concat(defaultVersion,"). To enable storage data migration, please update the storage encryption version to the latest version.");};var SERVER_SIDE_COOKIE_FEATURE_OVERRIDE_ERROR=function SERVER_SIDE_COOKIE_FEATURE_OVERRIDE_ERROR(context,providedCookieDomain,currentCookieDomain){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided cookie domain (").concat(providedCookieDomain,") does not match the current webpage's domain (").concat(currentCookieDomain,"). Hence, the cookies will be set client-side.");};var SERVER_SIDE_COOKIE_DATA_SERVICE_HOST_ERROR=function SERVER_SIDE_COOKIE_DATA_SERVICE_HOST_ERROR(context,dataServiceHost,webpageHost){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The data service host (").concat(dataServiceHost,") cannot set cookies for the current webpage (").concat(webpageHost,"). Hence, the cookies will be set client-side instead of server-side.");};var RESERVED_KEYWORD_WARNING=function RESERVED_KEYWORD_WARNING(context,property,parentKeyPath,reservedElements){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(property,"\" property defined under \"").concat(parentKeyPath,"\" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (").concat(reservedElements,").");};var RESERVED_CUSTOM_CONTEXT_KEY_WARNING=function RESERVED_CUSTOM_CONTEXT_KEY_WARNING(logContext,property){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"The top-level custom context property \"").concat(property,"\" is reserved and was ignored.");};var INVALID_CONTEXT_OBJECT_WARNING=function INVALID_CONTEXT_OBJECT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Please make sure that the \"context\" property in the event API's \"options\" argument is a valid object literal with key-value pairs.");};var INVALID_CUSTOM_CONTEXT_WARNING=function INVALID_CUSTOM_CONTEXT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Invalid custom context. Use a plain object without prototype pollution keys.");};var UNSUPPORTED_BEACON_API_WARNING=function UNSUPPORTED_BEACON_API_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The Beacon API is not supported by your browser. The events will be sent using XHR instead.");};var TIMEOUT_NOT_NUMBER_WARNING=function TIMEOUT_NOT_NUMBER_WARNING(context,timeout,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value \"").concat(timeout,"\" is not a number. The default timeout of ").concat(defaultValue," ms will be used instead.");};var CUT_OFF_DURATION_NOT_NUMBER_WARNING=function CUT_OFF_DURATION_NOT_NUMBER_WARNING(context,cutOffDuration,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session cut off duration value \"").concat(cutOffDuration,"\" is not a number. The default cut off duration of ").concat(defaultValue," ms will be used instead.");};var CUT_OFF_DURATION_LESS_THAN_TIMEOUT_WARNING=function CUT_OFF_DURATION_LESS_THAN_TIMEOUT_WARNING(context,cutOffDuration,timeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session cut off duration value \"").concat(cutOffDuration,"\" ms is less than the session timeout value \"").concat(timeout,"\" ms. The cut off functionality will be disabled.");};var TIMEOUT_ZERO_WARNING=function TIMEOUT_ZERO_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.");};var TIMEOUT_NOT_RECOMMENDED_WARNING=function TIMEOUT_NOT_RECOMMENDED_WARNING(context,timeout,minTimeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value ").concat(timeout," ms is less than the recommended minimum of ").concat(minTimeout," ms. Please consider increasing the timeout value to ensure optimal performance and reliability.");};var INVALID_SESSION_ID_WARNING=function INVALID_SESSION_ID_WARNING(context,sessionId,minSessionIdLength){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided session ID (").concat(sessionId,") is either invalid, not a positive integer, or not at least \"").concat(minSessionIdLength,"\" digits long. A new session ID will be auto-generated instead.");};var STORAGE_QUOTA_EXCEEDED_WARNING=function STORAGE_QUOTA_EXCEEDED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.");};var STORAGE_UNAVAILABLE_WARNING=function STORAGE_UNAVAILABLE_WARNING(context,entry,selectedStorageType,finalStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(selectedStorageType,"\" is not available for entry \"").concat(entry,"\". The SDK will initialize the entry with \"").concat(finalStorageType,"\" storage type instead.");};var CALLBACK_INVOKE_ERROR=function CALLBACK_INVOKE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The callback threw an exception");};var INVALID_CONFIG_URL_WARNING=function INVALID_CONFIG_URL_WARNING(context,configUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided source config URL \"").concat(configUrl,"\" is invalid. Using the default source config URL instead.");};var POLYFILL_SCRIPT_LOAD_ERROR=function POLYFILL_SCRIPT_LOAD_ERROR(scriptId,url){return "Failed to load the polyfill script with ID \"".concat(scriptId,"\" from URL ").concat(url,".");};var POLYFILL_VERIFICATION_ERROR=function POLYFILL_VERIFICATION_ERROR(missingFeatures){return "Failed to apply the polyfills for the following features: ".concat(missingFeatures.join(', '),".");};var UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY=function UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(context,selectedStrategy,defaultStrategy){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy \"").concat(selectedStrategy,"\" is not supported. Please choose one of the following supported strategies: \"none, session, anonymousId\". The default strategy \"").concat(defaultStrategy,"\" will be used instead.");};var DEPRECATED_PRE_CONSENT_STORAGE_STRATEGY=function DEPRECATED_PRE_CONSENT_STORAGE_STRATEGY(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy option is deprecated. Please enable \"storage\" in the pre-consent options and use the \"storage\" load API option instead.");};var UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE=function UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(context,selectedDeliveryType,defaultDeliveryType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent events delivery type \"").concat(selectedDeliveryType,"\" is not supported. Please choose one of the following supported types: \"immediate, buffer\". The default type \"").concat(defaultDeliveryType,"\" will be used instead.");};var DEPRECATED_PLUGIN_WARNING=function DEPRECATED_PLUGIN_WARNING(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR).concat(pluginName," plugin is deprecated. Please exclude it from the load API options.");};var generateMisconfiguredPluginsWarning=function generateMisconfiguredPluginsWarning(context,configurationStatus,missingPlugins,shouldAddMissingPlugins){var isSinglePlugin=missingPlugins.length===1;var pluginsString=isSinglePlugin?" '".concat(missingPlugins[0],"' plugin was"):" ['".concat(missingPlugins.join("', '"),"'] plugins were");var baseWarning="".concat(context).concat(LOG_CONTEXT_SEPARATOR).concat(configurationStatus,", but").concat(pluginsString," not configured to load.");if(shouldAddMissingPlugins){return "".concat(baseWarning," So, ").concat(isSinglePlugin?'the plugin':'those plugins'," will be loaded automatically.");}return "".concat(baseWarning," Ignore if this was intentional. Otherwise, consider adding ").concat(isSinglePlugin?'it':'them'," to the 'plugins' load API option.");};var INVALID_POLYFILL_URL_WARNING=function INVALID_POLYFILL_URL_WARNING(context,customPolyfillUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided polyfill URL \"").concat(customPolyfillUrl,"\" is invalid. The default polyfill URL will be used instead.");};var PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING=function PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Page Unloaded event can only be tracked when the Beacon transport is active. Please enable \"useBeacon\" load API option.");};var UNKNOWN_PLUGINS_WARNING=function UNKNOWN_PLUGINS_WARNING(context,unknownPlugins){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Ignoring unknown plugins: ").concat(unknownPlugins.join(', '),".");};var REMOTE_PLUGIN_LOAD_ERROR=function REMOTE_PLUGIN_LOAD_ERROR(context,pluginName,reason){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load plugin \"").concat(pluginName,"\" - ").concat(reason);};var NO_PLUGIN_FACTORY_EXPORTED_REASON='the module exported no plugin factory';var UNAVAILABLE_PLUGINS_ERROR=function UNAVAILABLE_PLUGINS_ERROR(context,unavailablePlugins){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load the following unavailable local plugins: ").concat(unavailablePlugins.join(', '),". Some features of the SDK may not work as expected. Make sure you are using the correct SDK bundle variant.");};var CUSTOM_INTEGRATION_CANNOT_BE_ADDED_ERROR=function CUSTOM_INTEGRATION_CANNOT_BE_ADDED_ERROR(context,destinationId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Cannot add custom integration for destination ID \"").concat(destinationId,"\" after the SDK is loaded.");};
|
|
1037
1037
|
|
|
1038
1038
|
var DEFAULT_INTEGRATIONS_CONFIG={All:true};
|
|
1039
1039
|
|
|
@@ -1048,7 +1048,9 @@ var CDN_INT_DIR='js-integrations';var CDN_PLUGINS_DIR='plugins';var URL_PATTERN=
|
|
|
1048
1048
|
'(\\#[-a-zA-Z\\d_]*)?$')// fragment locator
|
|
1049
1049
|
;
|
|
1050
1050
|
|
|
1051
|
-
var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CDN_ARCH_VERSION_DIR='v3';var DEFAULT_INTEGRATION_SDKS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_INT_DIR);var DEFAULT_PLUGINS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_PLUGINS_DIR);var DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com'
|
|
1051
|
+
var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CDN_ARCH_VERSION_DIR='v3';var DEFAULT_INTEGRATION_SDKS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_INT_DIR);var DEFAULT_PLUGINS_URL="".concat(SDK_CDN_BASE_URL,"/").concat(CDN_ARCH_VERSION_DIR,"/").concat(BUILD_TYPE,"/").concat(CDN_PLUGINS_DIR);var DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com';// Mirrors remotePluginsExportsFilename in rollup.config.mjs, which builds the URL
|
|
1052
|
+
// the generated federation code requests at runtime.
|
|
1053
|
+
var REMOTE_PLUGINS_ENTRY_FILE='rsa-plugins.js';
|
|
1052
1054
|
|
|
1053
1055
|
var DEFAULT_STORAGE_ENCRYPTION_VERSION='v3';var DEFAULT_DATA_PLANE_EVENTS_TRANSPORT='xhr';var ConsentManagersToPluginNameMap={iubenda:'IubendaConsentManager',oneTrust:'OneTrustConsentManager',ketch:'KetchConsentManager',custom:'CustomConsentManager'};var StorageEncryptionVersionsToPluginNameMap=_defineProperty(_defineProperty({},DEFAULT_STORAGE_ENCRYPTION_VERSION,'StorageEncryption'),"legacy",'StorageEncryptionLegacy');var DataPlaneEventsTransportToPluginNameMap=_defineProperty(_defineProperty({},DEFAULT_DATA_PLANE_EVENTS_TRANSPORT,'XhrQueue'),"beacon",'BeaconQueue');var DEFAULT_DATA_SERVICE_ENDPOINT='rsaRequest';var METRICS_SERVICE_ENDPOINT='rsaMetrics';var CUSTOM_DEVICE_MODE_DESTINATION_DISPLAY_NAME='Custom Device Mode';
|
|
1054
1056
|
|
|
@@ -1093,7 +1095,9 @@ var autoTrackState={enabled:y(false),pageLifecycle:{enabled:y(false),pageViewId:
|
|
|
1093
1095
|
|
|
1094
1096
|
var defaultStateValues={capabilities:capabilitiesState,consents:consentsState,context:contextState,customContext:customContextState,eventBuffer:eventBufferState,lifecycle:lifecycleState,loadOptions:loadOptionsState,metrics:metricsState,nativeDestinations:nativeDestinationsState,plugins:pluginsState,reporting:reportingState,session:sessionState,source:sourceConfigState,storage:storageState,serverCookies:serverSideCookiesState,dataPlaneEvents:dataPlaneEventsState,autoTrack:autoTrackState};var state=_objectSpread2({},clone(defaultStateValues));
|
|
1095
1097
|
|
|
1096
|
-
var CHROME_STACK_LINE_RE=/^\s*at /;var SAFARI_NATIVE_RE=/^(eval@)?(\[native code])?$/;var
|
|
1098
|
+
var CHROME_STACK_LINE_RE=/^\s*at /;var SAFARI_NATIVE_RE=/^(eval@)?(\[native code])?$/;var DIGITS_RE=/^\d+$/;function extractLocation(urlLike){if(!(urlLike!==null&&urlLike!==void 0&&urlLike.includes(':'))){return [urlLike||undefined,undefined,undefined];}var normalizedUrlLike=urlLike.startsWith('(')&&urlLike.endsWith(')')?urlLike.slice(1,-1):urlLike;// Take up to two trailing all-digit segments as line and column; whatever is left,
|
|
1099
|
+
// colons included, is the file. A url keeps its scheme because "//host" is not digits.
|
|
1100
|
+
var segments=normalizedUrlLike.split(':');var location=[];while(segments.length>1&&location.length<2&&DIGITS_RE.test(segments[segments.length-1])){location.unshift(Number(segments.pop()));}return [segments.join(':')||undefined,location[0],location[1]];}function parseV8Line(line){if(!CHROME_STACK_LINE_RE.test(line)){return null;}if(line.includes('(eval ')){line=line.replace(/eval code/g,'eval').replace(/\(eval at [^()]*/g,'').replace(/,.*/,'');}var sanitized=line.replace(/^\s+/,'').replace(/\(eval code/g,'(').replace(/^.*?\s+/,'');var parenLoc=/ (\(.+\)$)/.exec(sanitized);var withoutLoc=parenLoc?sanitized.replace(parenLoc[0],''):sanitized;var _extractLocation=extractLocation(parenLoc?parenLoc[1]:sanitized),_extractLocation2=_slicedToArray(_extractLocation,3),rawFile=_extractLocation2[0],lineNumber=_extractLocation2[1],columnNumber=_extractLocation2[2];var functionName=parenLoc&&withoutLoc||undefined;var fileName=rawFile==='eval'||rawFile==='<anonymous>'?undefined:rawFile;return {functionName:functionName,fileName:fileName,lineNumber:lineNumber,columnNumber:columnNumber};}function parseFFSafariLine(line){if(SAFARI_NATIVE_RE.test(line)){return null;}if(line.includes(' > eval')){line=line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,':$1');}if(!line.includes('@')&&!line.includes(':')){return {functionName:line,fileName:undefined,lineNumber:undefined,columnNumber:undefined};}var atIndex=line.lastIndexOf('@');var functionName=atIndex>0?line.slice(0,atIndex):undefined;var _extractLocation3=extractLocation(line.slice(atIndex+1)),_extractLocation4=_slicedToArray(_extractLocation3,3),fileName=_extractLocation4[0],lineNumber=_extractLocation4[1],columnNumber=_extractLocation4[2];return {functionName:functionName,fileName:fileName,lineNumber:lineNumber,columnNumber:columnNumber};}/**
|
|
1097
1101
|
* Parses an Error object's stack trace into structured frames.
|
|
1098
1102
|
* Supports V8/Chromium (Chrome, Edge, Node) and SpiderMonkey/WebKit (Firefox, Safari) formats.
|
|
1099
1103
|
* Throws if the error has no stack property.
|
|
@@ -1217,7 +1221,9 @@ resolve(true);}}else {resolve(!ERROR_MESSAGES_TO_BE_FILTERED.some(function(e){re
|
|
|
1217
1221
|
* A function to get the directory name from a file path.
|
|
1218
1222
|
* @param {string} filePath The file path
|
|
1219
1223
|
* @returns The directory name or undefined if the file path is invalid
|
|
1220
|
-
*/var getDirectoryName=function getDirectoryName(filePath){if(!filePath){return undefined;}var paths=filePath.split('/')
|
|
1224
|
+
*/var getDirectoryName=function getDirectoryName(filePath){if(!filePath){return undefined;}var paths=filePath.split('/');// Not `.at(-2)`: Array.prototype.at is neither transpiled nor polyfilled
|
|
1225
|
+
return paths[paths.length-2];// NOSONAR
|
|
1226
|
+
};/**
|
|
1221
1227
|
* A function to get the top stack path from the exception.
|
|
1222
1228
|
* @param {Exception} exception The exception object
|
|
1223
1229
|
* @returns The top stack path or undefined if the exception is invalid
|
|
@@ -1307,7 +1313,8 @@ destination.config.useNativeSDK===true);};var isHybridModeDestination=function i
|
|
|
1307
1313
|
* @param id The id of the destination
|
|
1308
1314
|
*
|
|
1309
1315
|
* @returns the user friendly id
|
|
1310
|
-
*/var getDestinationUserFriendlyId=function getDestinationUserFriendlyId(displayName,id){return
|
|
1316
|
+
*/var getDestinationUserFriendlyId=function getDestinationUserFriendlyId(displayName,id){return(// displayName comes from the source config response, so it is not guaranteed to be a string
|
|
1317
|
+
"".concat(String(displayName!==null&&displayName!==void 0?displayName:'').replace(/ /g,'-'),"___").concat(id));};
|
|
1311
1318
|
|
|
1312
1319
|
/**
|
|
1313
1320
|
* List of plugin names that are loaded as dynamic imports in modern builds
|
|
@@ -1426,7 +1433,9 @@ var runningQueueIdsByName=new Map();var RetryQueue=/*#__PURE__*/function(){/**
|
|
|
1426
1433
|
* @param {StorageType} [storageType] The storage type to use. Defaults to LOCAL_STORAGE
|
|
1427
1434
|
* @param {ILogger} [logger] The logger to use
|
|
1428
1435
|
* @param {QueueBatchItemsSizeCalculatorCallback} [queueBatchItemsSizeCalculatorCb] The callback to use to calculate the size of items in the batch queue
|
|
1429
|
-
*/function RetryQueue(name,options,queueProcessCb,storeManager){var _options$timerScaleFa;var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:LOCAL_STORAGE;var logger=arguments.length>5?arguments[5]:undefined;var queueBatchItemsSizeCalculatorCb=arguments.length>6?arguments[6]:undefined;_classCallCheck(this,RetryQueue);this.storeManager=storeManager;this.logger=logger;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.batchSizeCalcCb=queueBatchItemsSizeCalculatorCb;this.maxItems=options.maxItems||DEFAULT_MAX_ITEMS;this.maxAttempts=options.maxAttempts
|
|
1436
|
+
*/function RetryQueue(name,options,queueProcessCb,storeManager){var _options$maxAttempts,_options$backoffJitte,_options$timerScaleFa;var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:LOCAL_STORAGE;var logger=arguments.length>5?arguments[5]:undefined;var queueBatchItemsSizeCalculatorCb=arguments.length>6?arguments[6]:undefined;_classCallCheck(this,RetryQueue);this.storeManager=storeManager;this.logger=logger;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.batchSizeCalcCb=queueBatchItemsSizeCalculatorCb;this.maxItems=options.maxItems||DEFAULT_MAX_ITEMS;this.maxAttempts=(_options$maxAttempts=options.maxAttempts)!==null&&_options$maxAttempts!==void 0?_options$maxAttempts:DEFAULT_MAX_RETRY_ATTEMPTS;this.batch={enabled:false};this.configureBatchMode(options);// `??` keeps an explicit 0 but also keeps NaN, which would make every delay NaN
|
|
1437
|
+
var jitter=(_options$backoffJitte=options.backoffJitter)!==null&&_options$backoffJitte!==void 0?_options$backoffJitte:DEFAULT_BACKOFF_JITTER;this.backoff={minRetryDelay:options.minRetryDelay||DEFAULT_MIN_RETRY_DELAY_MS,maxRetryDelay:options.maxRetryDelay||DEFAULT_MAX_RETRY_DELAY_MS,factor:options.backoffFactor||DEFAULT_BACKOFF_FACTOR,// Clamp so delays stay positive and within maxRetryDelay
|
|
1438
|
+
jitter:Number.isNaN(jitter)?DEFAULT_BACKOFF_JITTER:Math.min(Math.max(jitter,0),1)};// Limit the timer scale factor to the minimum value
|
|
1430
1439
|
var timerScaleFactor=Math.max((_options$timerScaleFa=options.timerScaleFactor)!==null&&_options$timerScaleFa!==void 0?_options$timerScaleFa:MIN_TIMER_SCALE_FACTOR,MIN_TIMER_SCALE_FACTOR);// Limit the timer scale factor to the maximum value
|
|
1431
1440
|
timerScaleFactor=Math.min(timerScaleFactor,MAX_TIMER_SCALE_FACTOR);// painstakingly tuned. that's why they're not "easily" configurable
|
|
1432
1441
|
this.timeouts={ackTimer:Math.round(timerScaleFactor*DEFAULT_ACK_TIMER_MS),reclaimTimer:Math.round(timerScaleFactor*DEFAULT_RECLAIM_TIMER_MS),reclaimTimeout:Math.round(timerScaleFactor*DEFAULT_RECLAIM_TIMEOUT_MS),reclaimWait:Math.round(timerScaleFactor*DEFAULT_RECLAIM_WAIT_MS)};this.schedule=new Schedule();this.processId='0';// Set up our empty queues
|
|
@@ -1454,7 +1463,9 @@ this.scheduleFlushBatch();}}/**
|
|
|
1454
1463
|
*
|
|
1455
1464
|
* @param {Number} attemptNumber The attemptNumber (1 for first retry)
|
|
1456
1465
|
* @return {Number} The delay in milliseconds to wait before attempting a retry
|
|
1457
|
-
*/},{key:"getDelay",value:function getDelay(attemptNumber){
|
|
1466
|
+
*/},{key:"getDelay",value:function getDelay(attemptNumber){// Cap leaves headroom for +jitter so the jittered delay never exceeds maxRetryDelay
|
|
1467
|
+
var cap=Math.floor(this.backoff.maxRetryDelay/(1+this.backoff.jitter));var ms=Math.min(// First retry waits the base delay
|
|
1468
|
+
Number((this.backoff.minRetryDelay*Math.pow(this.backoff.factor,attemptNumber-1)).toPrecision(1)),cap);if(this.backoff.jitter){var rand=Math.random();var deviation=Math.floor(rand*this.backoff.jitter*ms);if(Math.floor(rand*10)<5){ms-=deviation;}else {ms+=deviation;}}return Math.min(ms,this.backoff.maxRetryDelay);}},{key:"enqueue",value:function enqueue(entry){var curEntry;if(this.batch.enabled&&entry.type===SINGLE_QUEUE_ITEM_TYPE){curEntry=this.handleNewItemForBatch(entry);}else {curEntry=entry;}// when batching is enabled, `curEntry` could be `undefined` if the batch criteria is not met
|
|
1458
1469
|
if(curEntry){this.pushToMainQueue(curEntry);}}/**
|
|
1459
1470
|
* Handles a new item added to the retry queue when batching is enabled
|
|
1460
1471
|
* @param entry New item added to the retry queue
|
|
@@ -1537,8 +1548,8 @@ done(null);}else {// Note: We're not removing the item from the queue as we want
|
|
|
1537
1548
|
logger===null||logger===void 0||logger.warn("".concat(BEACON_QUEUE_SEND_ERROR(BEACON_QUEUE_PLUGIN,url)," The event(s) will be retried as the current page is being unloaded."));}}else {// Remove the item from queue as the request was successful
|
|
1538
1549
|
done(null);}}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError({error:err,context:BEACON_QUEUE_PLUGIN,customMessage:BEACON_QUEUE_DELIVERY_ERROR(url)});// Remove the item from queue
|
|
1539
1550
|
done(null);}};var eventsQueue=new RetryQueue("".concat(QUEUE_NAME$3,"_").concat(writeKey),{batch:{enabled:true,flushInterval:finalQOpts.flushQueueInterval,maxSize:MAX_BATCH_PAYLOAD_SIZE_BYTES,// set the hard limit
|
|
1540
|
-
maxItems:finalQOpts.maxItems}},queueProcessCallback,storeManager,getStorageTypeForEventsPersistence(logger),logger,function(itemData){var currentTime=getCurrentTimeFormatted();var events=itemData.map(function(queueItemData){return queueItemData.event;});// type casting to Blob as we know that the event has already been validated prior to enqueue
|
|
1541
|
-
return getBatchDeliveryPayload$1(events,currentTime,logger).size;});return eventsQueue;},/**
|
|
1551
|
+
maxItems:finalQOpts.maxItems}},queueProcessCallback,storeManager,getStorageTypeForEventsPersistence(logger),logger,function(itemData){var _getBatchDeliveryPayl;var currentTime=getCurrentTimeFormatted();var events=itemData.map(function(queueItemData){return queueItemData.event;});// type casting to Blob as we know that the event has already been validated prior to enqueue
|
|
1552
|
+
return (_getBatchDeliveryPayl=getBatchDeliveryPayload$1(events,currentTime,logger))===null||_getBatchDeliveryPayl===void 0?void 0:_getBatchDeliveryPayl.size;});return eventsQueue;},/**
|
|
1542
1553
|
* Add event to the queue for delivery
|
|
1543
1554
|
* @param state Application state
|
|
1544
1555
|
* @param eventsQueue IQueue instance
|
|
@@ -3147,7 +3158,8 @@ decryptedVal=decryptBrowser(decryptedVal);// If the decrypted value is the same
|
|
|
3147
3158
|
if(decryptedVal===currentVal){break;}// storejs that is used in localstorage engine already deserializes json strings but swallows errors
|
|
3148
3159
|
currentVal=JSON.parse(decryptedVal);}return currentVal;}catch(err){var customMessage=STORAGE_MIGRATION_ERROR(key);errorHandler===null||errorHandler===void 0||errorHandler.onError({error:err,context:STORAGE_MIGRATOR_PLUGIN,customMessage:customMessage,groupingHash:customMessage});return null;}}}};};
|
|
3149
3160
|
|
|
3150
|
-
var DEFAULT_RETRY_QUEUE_OPTIONS={maxRetryDelay:
|
|
3161
|
+
var DEFAULT_RETRY_QUEUE_OPTIONS={maxRetryDelay:540000,minRetryDelay:1000,backoffFactor:2,backoffJitter:0.2,maxAttempts:30,// ~3h of retries at these delays
|
|
3162
|
+
maxItems:100};var REQUEST_TIMEOUT_MS=30*1000;// 30 seconds
|
|
3151
3163
|
var DATA_PLANE_API_VERSION='v1';var QUEUE_NAME='rudder';var XHR_QUEUE_PLUGIN='XhrQueuePlugin';
|
|
3152
3164
|
|
|
3153
3165
|
var EVENT_DELIVERY_FAILURE_ERROR_PREFIX=function EVENT_DELIVERY_FAILURE_ERROR_PREFIX(context,originalErrorMsg){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to deliver event(s). Cause: ").concat(originalErrorMsg,".");};
|
|
@@ -3229,15 +3241,16 @@ var availablePlugins=[].concat(_toConsumableArray(Object.keys(pluginsInventory))
|
|
|
3229
3241
|
* Register plugins that are direct imports to PluginEngine
|
|
3230
3242
|
*/},{key:"registerLocalPlugins",value:function registerLocalPlugins(){var _this2=this;var unavailablePlugins=[];Object.entries(pluginsInventory).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),pluginName=_ref2[0],localPlugin=_ref2[1];if(state.plugins.activePlugins.value.includes(pluginName)){if(isFunction(localPlugin)){_this2.register([localPlugin()]);}else {unavailablePlugins.push(pluginName);}}});if(unavailablePlugins.length>0){state.plugins.failedPlugins.value=[].concat(_toConsumableArray(state.plugins.failedPlugins.value),unavailablePlugins);this.logger.error(UNAVAILABLE_PLUGINS_ERROR(PLUGINS_MANAGER,unavailablePlugins));}}/**
|
|
3231
3243
|
* Register plugins that are dynamic imports to PluginEngine
|
|
3232
|
-
*/},{key:"registerRemotePlugins",value:function registerRemotePlugins(){var _this3=this;var remotePluginsList=remotePluginsInventory(state.plugins.activePlugins.value);var loadFailures=[];// Kept separate from state.plugins.failedPlugins, which also collects
|
|
3244
|
+
*/},{key:"registerRemotePlugins",value:function registerRemotePlugins(){var _this3=this;var remotePluginsList=remotePluginsInventory(state.plugins.activePlugins.value);var pluginsCDNPath=state.lifecycle.pluginsCDNPath.value;var remoteEntryUrl="".concat(pluginsCDNPath,"/").concat(REMOTE_PLUGINS_ENTRY_FILE);var loadFailures=[];// Kept separate from state.plugins.failedPlugins, which also collects
|
|
3233
3245
|
// unknown plugins from setActivePlugins, unavailable local plugins from
|
|
3234
3246
|
// registerLocalPlugins and registration failures from register(). Reporting
|
|
3235
3247
|
// the global list would attribute those to this remote load incident.
|
|
3236
|
-
var failedRemotePlugins=[];return Promise.all(Object.keys(remotePluginsList).map(/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(remotePluginKey){return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:_context.n=1;return remotePluginsList[remotePluginKey]().then(function(remotePluginModule){
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3248
|
+
var failedRemotePlugins=[];return Promise.all(Object.keys(remotePluginsList).map(/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(remotePluginKey){return _regenerator().w(function(_context){while(1)switch(_context.n){case 0:_context.n=1;return remotePluginsList[remotePluginKey]().then(function(remotePluginModule){// An intercepted chunk can parse yet export nothing; calling the
|
|
3249
|
+
// undefined factory blind reports a per-build minified name.
|
|
3250
|
+
var pluginFactory=remotePluginModule===null||remotePluginModule===void 0?void 0:remotePluginModule.default;if(!isFunction(pluginFactory)){throw new Error(NO_PLUGIN_FACTORY_EXPORTED_REASON);}_this3.register([pluginFactory()]);}).catch(function(err){var _message;// TODO: add retry here if dynamic import fails
|
|
3251
|
+
failedRemotePlugins.push(remotePluginKey);state.plugins.failedPlugins.value=[].concat(_toConsumableArray(state.plugins.failedPlugins.value),[remotePluginKey]);// A rejection is not guaranteed to be an Error, so without the
|
|
3252
|
+
// fallback the log reads "- undefined".
|
|
3253
|
+
var reason=(_message=err===null||err===void 0?void 0:err.message)!==null&&_message!==void 0?_message:String(err);_this3.logger.error(REMOTE_PLUGIN_LOAD_ERROR(PLUGINS_MANAGER,remotePluginKey,reason));loadFailures.push(err);});case 1:return _context.a(2);}},_callee);}));return function(_x){return _ref3.apply(this,arguments);};}())).then(function(){// A failed remote entry rejects every plugin import at once, so the
|
|
3241
3254
|
// fan-out is one incident and gets one report, raised only after every
|
|
3242
3255
|
// import has settled so it names all of them.
|
|
3243
3256
|
//
|
|
@@ -3245,7 +3258,9 @@ failedRemotePlugins.push(remotePluginKey);state.plugins.failedPlugins.value=[].c
|
|
|
3245
3258
|
// deliberate: a dynamic import has no timeout of its own, and holding a
|
|
3246
3259
|
// timer open to salvage a partial report would spend page resources on
|
|
3247
3260
|
// error reporting, which is the lowest priority thing the SDK does.
|
|
3248
|
-
if(failedRemotePlugins.length===0){return;}
|
|
3261
|
+
if(failedRemotePlugins.length===0){return;}_this3.onError(loadFailures[0],"Failed to load plugins: ".concat(failedRemotePlugins.join(', ')),// Grouping on the message split one bug across two dozen groups: the
|
|
3262
|
+
// federation runtime names its own local, renamed by the host bundler per build.
|
|
3263
|
+
remoteEntryUrl);}).catch(function(err){_this3.onError(err);});}/**
|
|
3249
3264
|
* Extension point invoke that allows multiple plugins to be registered to it with error handling
|
|
3250
3265
|
*/},{key:"invokeMultiple",value:function invokeMultiple(extPoint){try{var _this$engine;for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}return (_this$engine=this.engine).invokeMultiple.apply(_this$engine,[extPoint].concat(args));}catch(e){this.onError(e,extPoint);return [];}}/**
|
|
3251
3266
|
* Extension point invoke that allows a single plugin to be registered to it with error handling
|
|
@@ -3355,7 +3370,7 @@ state.storage.cookie.value={maxage:cookieStorageOptions.maxage,path:cookieStorag
|
|
|
3355
3370
|
*/return _createClass(Store,[{key:"createValidKey",value:function createValidKey(key){var name=this.name,id=this.id,validKeys=this.validKeys,noKeyValidation=this.noKeyValidation,noCompoundKey=this.noCompoundKey;if(noKeyValidation){return noCompoundKey?key:[name,id,key].join('.');}// validate and return undefined if invalid key
|
|
3356
3371
|
var compoundKey;Object.values(validKeys).forEach(function(validKeyName){if(validKeyName===key){compoundKey=noCompoundKey?key:[name,id,key].join('.');}});return compoundKey;}/**
|
|
3357
3372
|
* Switch to inMemoryEngine, bringing any existing data with.
|
|
3358
|
-
*/},{key:"swapQueueStoreToInMemoryEngine",value:function swapQueueStoreToInMemoryEngine(){var _this=this;var validKeys=this.validKeys,noCompoundKey=this.noCompoundKey;var inMemoryStorage=getStorageEngine(MEMORY_STORAGE)
|
|
3373
|
+
*/},{key:"swapQueueStoreToInMemoryEngine",value:function swapQueueStoreToInMemoryEngine(){var _this=this;var validKeys=this.validKeys,noCompoundKey=this.noCompoundKey,durableEngine=this.engine;var inMemoryStorage=getStorageEngine(MEMORY_STORAGE);// grab existing data, but only for this page's queue instance, not all
|
|
3359
3374
|
// better to keep other queues in localstorage to be flushed later
|
|
3360
3375
|
// than to pull them into memory and remove them from durable storage
|
|
3361
3376
|
var existingEntries=Object.values(validKeys).map(function(storeKey){return [storeKey,_this.get(storeKey)];});// Client data stores keep their durable copy. Dropping rl_user_id and the
|
|
@@ -3376,8 +3391,18 @@ this.engine.setItem(validKey,this.encrypt(stringifyWithoutCircular(value,false,[
|
|
|
3376
3391
|
this.swapQueueStoreToInMemoryEngine();// and save it there
|
|
3377
3392
|
this.set(key,value);}else {var customMessage=STORE_DATA_SAVE_ERROR(key);this.onError(err,customMessage,customMessage);}}}/**
|
|
3378
3393
|
* Get by Key.
|
|
3379
|
-
*/},{key:"get",value:function get(key){var validKey=this.createValidKey(key);var decryptedValue;try{if(!validKey){return null;}
|
|
3380
|
-
return JSON.parse(decryptedValue);}catch(err){
|
|
3394
|
+
*/},{key:"get",value:function get(key){var validKey=this.createValidKey(key);var storedValue;var decryptedValue;var isRetrieved=false;try{if(!validKey){return null;}storedValue=this.engine.getItem(validKey);decryptedValue=this.decrypt(storedValue);if(isNullOrUndefined(decryptedValue)||decryptedValue===''){return null;}isRetrieved=true;// storejs that is used in localstorage engine already deserializes json strings but swallows errors
|
|
3395
|
+
return JSON.parse(decryptedValue);}catch(err){// Both encryption plugins, and `crypto` with no decrypt extension point registered, return
|
|
3396
|
+
// an unrecognised format untouched, so an unchanged value may still be readable; keep it.
|
|
3397
|
+
var isDecrypted=!this.isEncrypted||decryptedValue!==storedValue;// Drop a parse failure so a later read is a clean miss instead of the same error on every
|
|
3398
|
+
// poll, and only while the entry still holds what was read. Web Storage has no conditional
|
|
3399
|
+
// delete, so that narrows rather than closes the window in which another tab's write is
|
|
3400
|
+
// dropped; the cost there is a restarted reclaim handshake, since queued events are written
|
|
3401
|
+
// only by the context that owns the store. The compare is serialized because storejs
|
|
3402
|
+
// deserializes on every read, and uses `JSON.stringify` because `stringifyWithoutCircular`
|
|
3403
|
+
// returns null on failure, which would make two unserializable values compare equal.
|
|
3404
|
+
try{if(isRetrieved&&isDecrypted&&JSON.stringify(this.engine.getItem(validKey))===JSON.stringify(storedValue)){this.remove(key);}}catch(_unused2){// The engine can refuse the re-read or the removal; a later read retries.
|
|
3405
|
+
}var encryptionPluginName=state.storage.encryptionPluginName.value;// Skip error reporting only when the encryption plugin is configured but failed to load
|
|
3381
3406
|
var shouldReportError=!encryptionPluginName||!state.plugins.failedPlugins.value.includes(encryptionPluginName);if(shouldReportError){var customMessage=STORE_DATA_FETCH_ERROR(key);this.onError(err,customMessage,customMessage);}return null;}}/**
|
|
3382
3407
|
* Remove by Key.
|
|
3383
3408
|
*/},{key:"remove",value:function remove(key){var validKey=this.createValidKey(key);if(validKey){this.engine.removeItem(validKey);}}/**
|
|
@@ -3388,7 +3413,7 @@ var shouldReportError=!encryptionPluginName||!state.plugins.failedPlugins.value.
|
|
|
3388
3413
|
* Encrypt value
|
|
3389
3414
|
*/},{key:"encrypt",value:function encrypt(value){return this.crypto(value,'encrypt');}/**
|
|
3390
3415
|
* Extension point to use with encryption plugins
|
|
3391
|
-
*/},{key:"crypto",value:function crypto(value,mode){var noEncryption=!this.isEncrypted||!value||typeof value!=='string'||trim(value)==='';if(noEncryption){return value;}var extensionPointName="storage.".concat(mode);var formattedValue=this.pluginsManager?this.pluginsManager.invokeSingle(extensionPointName,value):value;return
|
|
3416
|
+
*/},{key:"crypto",value:function crypto(value,mode){var noEncryption=!this.isEncrypted||!value||typeof value!=='string'||trim(value)==='';if(noEncryption){return value;}var extensionPointName="storage.".concat(mode);var formattedValue=this.pluginsManager?this.pluginsManager.invokeSingle(extensionPointName,value):value;return formattedValue===undefined?value:formattedValue!==null&&formattedValue!==void 0?formattedValue:'';}/**
|
|
3392
3417
|
* Handle errors
|
|
3393
3418
|
*/},{key:"onError",value:function onError(error,customMessage,groupingHash){this.errorHandler.onError({error:error,context:"Store ".concat(this.id),customMessage:customMessage,groupingHash:groupingHash});}}]);}();
|
|
3394
3419
|
|
|
@@ -3648,12 +3673,14 @@ var getUserAgentClientHint=function getUserAgentClientHint(callback){var level=a
|
|
|
3648
3673
|
|
|
3649
3674
|
var isDatasetAvailable=function isDatasetAvailable(){var testElement=globalThis.document.createElement('div');testElement.setAttribute('data-a-b','c');return testElement.dataset?testElement.dataset.aB==='c':false;};var legacyJSEngineRequiredPolyfills={// Ideally, we should separate the checks for URL and URLSearchParams but
|
|
3650
3675
|
// the polyfill service serves them under the same feature name, "URL".
|
|
3651
|
-
URL:function URL(){return !isFunction(globalThis.URL)||!isFunction(globalThis.URLSearchParams);},Promise:function Promise(){return !isFunction(globalThis.Promise);},'Number.isNaN':function NumberIsNaN(){return !isFunction(globalThis.Number.isNaN);},'Number.isInteger':function NumberIsInteger(){return !isFunction(globalThis.Number.isInteger);},'Array.from':function ArrayFrom(){return !isFunction(globalThis.Array.from);},'Array.prototype.find':function ArrayPrototypeFind(){return !isFunction(globalThis.Array.prototype.find);},'Array.prototype.includes':function ArrayPrototypeIncludes(){return !isFunction(globalThis.Array.prototype.includes);},'String.prototype.endsWith':function StringPrototypeEndsWith(){return !isFunction(globalThis.String.prototype.endsWith);},'String.prototype.startsWith':function StringPrototypeStartsWith(){return !isFunction(globalThis.String.prototype.startsWith);},'String.prototype.includes':function StringPrototypeIncludes(){return !isFunction(globalThis.String.prototype.includes);},'String.prototype.replaceAll':function StringPrototypeReplaceAll(){return !isFunction(globalThis.String.prototype.replaceAll);},'String.fromCodePoint':function StringFromCodePoint(){return !isFunction(globalThis.String.fromCodePoint);},'Object.entries':function ObjectEntries(){return !isFunction(globalThis.Object.entries);},'Object.values':function ObjectValues(){return !isFunction(globalThis.Object.values);}
|
|
3676
|
+
URL:function URL(){return !isFunction(globalThis.URL)||!isFunction(globalThis.URLSearchParams);},Promise:function Promise(){return !isFunction(globalThis.Promise);},'Number.isNaN':function NumberIsNaN(){return !isFunction(globalThis.Number.isNaN);},'Number.isInteger':function NumberIsInteger(){return !isFunction(globalThis.Number.isInteger);},'Array.from':function ArrayFrom(){return !isFunction(globalThis.Array.from);},'Array.prototype.find':function ArrayPrototypeFind(){return !isFunction(globalThis.Array.prototype.find);},'Array.prototype.includes':function ArrayPrototypeIncludes(){return !isFunction(globalThis.Array.prototype.includes);},'String.prototype.endsWith':function StringPrototypeEndsWith(){return !isFunction(globalThis.String.prototype.endsWith);},'String.prototype.startsWith':function StringPrototypeStartsWith(){return !isFunction(globalThis.String.prototype.startsWith);},'String.prototype.includes':function StringPrototypeIncludes(){return !isFunction(globalThis.String.prototype.includes);},'String.prototype.replaceAll':function StringPrototypeReplaceAll(){return !isFunction(globalThis.String.prototype.replaceAll);},'String.fromCodePoint':function StringFromCodePoint(){return !isFunction(globalThis.String.fromCodePoint);},'Object.entries':function ObjectEntries(){return !isFunction(globalThis.Object.entries);},'Object.values':function ObjectValues(){return !isFunction(globalThis.Object.values);},// Not used in this package, but the device mode integrations need them
|
|
3677
|
+
'Object.assign':function ObjectAssign(){return !isFunction(globalThis.Object.assign);},'Object.fromEntries':function ObjectFromEntries(){return !isFunction(globalThis.Object.fromEntries);},'Element.prototype.dataset':function ElementPrototypeDataset(){return !isDatasetAvailable();},// Ideally, we should separate the checks for TextEncoder and TextDecoder but
|
|
3652
3678
|
// the polyfill service serves them under the same feature name, "TextEncoder".
|
|
3653
|
-
TextEncoder:function TextEncoder(){return !isFunction(globalThis.TextEncoder)||!isFunction(globalThis.TextDecoder);},
|
|
3654
|
-
ArrayBuffer:function ArrayBuffer(){return !isFunction(globalThis.Uint8Array);},Set:function Set(){return !isFunction(globalThis.Set);},atob:function atob(){return !isFunction(globalThis.atob);}};var isLegacyJSEngine=function isLegacyJSEngine(){var requiredCapabilitiesList=Object.keys(legacyJSEngineRequiredPolyfills);var needsPolyfill=false;/* eslint-disable-next-line unicorn/no-for-loop */for(var i=0;i<requiredCapabilitiesList.length;i++){var isCapabilityMissing=legacyJSEngineRequiredPolyfills[requiredCapabilitiesList[i]];if(isFunction(isCapabilityMissing)&&isCapabilityMissing()){needsPolyfill=true;break;}}return needsPolyfill;};
|
|
3679
|
+
TextEncoder:function TextEncoder(){return !isFunction(globalThis.TextEncoder)||!isFunction(globalThis.TextDecoder);},CustomEvent:function CustomEvent(){return !isFunction(globalThis.CustomEvent);},// Note, the polyfill service serves both ArrayBuffer and Uint8Array under the same feature name, "ArrayBuffer".
|
|
3680
|
+
ArrayBuffer:function ArrayBuffer(){return !isFunction(globalThis.Uint8Array);},Set:function Set(){return !isFunction(globalThis.Set);},Map:function Map(){return !isFunction(globalThis.Map);},atob:function atob(){return !isFunction(globalThis.atob);}};var isLegacyJSEngine=function isLegacyJSEngine(){var requiredCapabilitiesList=Object.keys(legacyJSEngineRequiredPolyfills);var needsPolyfill=false;/* eslint-disable-next-line unicorn/no-for-loop */for(var i=0;i<requiredCapabilitiesList.length;i++){var isCapabilityMissing=legacyJSEngineRequiredPolyfills[requiredCapabilitiesList[i]];if(isFunction(isCapabilityMissing)&&isCapabilityMissing()){needsPolyfill=true;break;}}return needsPolyfill;};
|
|
3655
3681
|
|
|
3656
|
-
var polyfillIoSdkUrl='https://polyfill-fastly.io/v3/polyfill.min.js';var POLYFILL_URL
|
|
3682
|
+
var polyfillIoSdkUrl='https://polyfill-fastly.io/v3/polyfill.min.js';var POLYFILL_URL=// Pure so the modern build, which never reads it, drops it and the detection list
|
|
3683
|
+
"".concat(polyfillIoSdkUrl,"?version=3.111.0&flags=always%2Cgated&features=").concat(/* @__PURE__ */Object.keys(legacyJSEngineRequiredPolyfills).join('%2C'));var POLYFILL_LOAD_TIMEOUT=10*1000;// 10 seconds
|
|
3657
3684
|
var POLYFILL_SCRIPT_ID='rudderstackPolyfill';
|
|
3658
3685
|
|
|
3659
3686
|
var detectAdBlockers=function detectAdBlockers(httpClient){state.capabilities.isAdBlockerDetectionInProgress.value=true;try{// Apparently, '?view=ad' is a query param that is blocked by majority of adblockers
|
|
@@ -3682,10 +3709,19 @@ state.capabilities.isBeaconAvailable.value=hasBeacon();state.capabilities.isUaCH
|
|
|
3682
3709
|
state.context.userAgent.value=getUserAgent();state.context.locale.value=getLanguage();state.context.screen.value=getScreenDetails();state.context.timezone.value=getTimezone();if(hasUAClientHints()){getUserAgentClientHint(function(uach){state.context['ua-ch'].value=uach;},state.loadOptions.value.uaChTrackLevel);}});// Ad blocker detection
|
|
3683
3710
|
j(function(){if(state.loadOptions.value.sendAdblockPage===true&&state.lifecycle.sourceConfigUrl.value!==undefined){detectAdBlockers(_this.httpClient);}});}/**
|
|
3684
3711
|
* Detect if polyfills are required and then load script from polyfill URL
|
|
3685
|
-
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _this2=this
|
|
3712
|
+
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _this2=this;// The snippet only hands the modern build to engines that ship every polyfill-list API the
|
|
3713
|
+
state.capabilities.isLegacyDOM.value=isLegacyJSEngine();var customPolyfillUrl=state.loadOptions.value.polyfillURL;var polyfillUrl=POLYFILL_URL;if(isDefinedAndNotNull(customPolyfillUrl)){if(isValidURL(customPolyfillUrl)){polyfillUrl=customPolyfillUrl;}else {this.logger.warn(INVALID_POLYFILL_URL_WARNING(CAPABILITIES_MANAGER,customPolyfillUrl));}}var shouldLoadPolyfill=state.loadOptions.value.polyfillIfRequired&&state.capabilities.isLegacyDOM.value&&isValidURL(polyfillUrl);if(shouldLoadPolyfill){var isDefaultPolyfillService=polyfillUrl!==state.loadOptions.value.polyfillURL;// write key specific callback
|
|
3686
3714
|
// NOTE: we're not putting this into RudderStackGlobals as providing the property path to the callback function in the polyfill URL is not possible
|
|
3687
|
-
var polyfillCallbackName="RS_polyfillCallback_".concat(state.lifecycle.writeKey.value)
|
|
3688
|
-
|
|
3715
|
+
var polyfillCallbackName="RS_polyfillCallback_".concat(state.lifecycle.writeKey.value);// A timed out script stays in the DOM, so a late response can still fire the
|
|
3716
|
+
// callback. Settle once, and drop the handler on failure as well as success.
|
|
3717
|
+
var isPolyfillLoadSettled=false;var installedPolyfillCallback;var settlePolyfillLoad=function settlePolyfillLoad(onSettled){// Only remove our own handler: the name is keyed by write key alone, so the
|
|
3718
|
+
// global may belong to the page or to another in-flight load.
|
|
3719
|
+
if(installedPolyfillCallback&&globalThis[polyfillCallbackName]===installedPolyfillCallback){delete globalThis[polyfillCallbackName];}if(isPolyfillLoadSettled){return;}isPolyfillLoadSettled=true;onSettled();};if(isDefaultPolyfillService){installedPolyfillCallback=function installedPolyfillCallback(){settlePolyfillLoad(function(){return _this2.onPolyfillLoaded();});};globalThis[polyfillCallbackName]=installedPolyfillCallback;polyfillUrl="".concat(polyfillUrl,"&callback=").concat(polyfillCallbackName);}this.externalSrcLoader.loadJSFile({url:polyfillUrl,id:POLYFILL_SCRIPT_ID,async:true,timeout:POLYFILL_LOAD_TIMEOUT,callback:function callback(scriptId,err){if(!scriptId||err){// Report and stop: the SDK misbehaves on an engine still missing these.
|
|
3720
|
+
settlePolyfillLoad(function(){_this2.onError(new Error(POLYFILL_SCRIPT_LOAD_ERROR(POLYFILL_SCRIPT_ID,polyfillUrl)));});}else if(!isDefaultPolyfillService){settlePolyfillLoad(function(){return _this2.onPolyfillLoaded();});}}});}else {this.onReady();}}/**
|
|
3721
|
+
* Report the features that the polyfill script did not apply and then set the
|
|
3722
|
+
* lifecycle status to next phase
|
|
3723
|
+
*/},{key:"onPolyfillLoaded",value:function onPolyfillLoaded(){// Guarded too so the detection list is dropped from the modern bundle
|
|
3724
|
+
if(isLegacyJSEngine()){var missingFeatures=Object.keys(legacyJSEngineRequiredPolyfills).filter(function(feature){var isFeatureMissing=legacyJSEngineRequiredPolyfills[feature];return isFunction(isFeatureMissing)&&isFeatureMissing();});this.onError(new Error(POLYFILL_VERIFICATION_ERROR(missingFeatures)));}this.onReady();}/**
|
|
3689
3725
|
* Attach listeners to window to observe event that update capabilities state values
|
|
3690
3726
|
*/},{key:"attachWindowListeners",value:function attachWindowListeners(){globalThis.addEventListener('offline',function(){state.capabilities.isOnline.value=false;});globalThis.addEventListener('online',function(){state.capabilities.isOnline.value=true;});globalThis.addEventListener('resize',debounce(function(){state.context.screen.value=getScreenDetails();},this));}/**
|
|
3691
3727
|
* Set the lifecycle status to next phase
|
|
@@ -3693,7 +3729,7 @@ delete globalThis[polyfillCallbackName];};globalThis[polyfillCallbackName]=polyf
|
|
|
3693
3729
|
},{key:"onReady",value:function onReady(){this.detectBrowserCapabilities();state.lifecycle.status.value='browserCapabilitiesReady';}/**
|
|
3694
3730
|
* Handles error
|
|
3695
3731
|
* @param error The error object
|
|
3696
|
-
*/},{key:"onError",value:function onError(error,groupingHash){this.errorHandler.onError({error:error,context:CAPABILITIES_MANAGER,groupingHash:groupingHash});}}]);}();
|
|
3732
|
+
*/},{key:"onError",value:function onError(error,groupingHash){void this.errorHandler.onError({error:error,context:CAPABILITIES_MANAGER,groupingHash:groupingHash});}}]);}();
|
|
3697
3733
|
|
|
3698
3734
|
var CHANNEL='web';// These are the top-level elements in the standard RudderStack event spec
|
|
3699
3735
|
var TOP_LEVEL_ELEMENTS=['integrations','anonymousId','originalTimestamp'];// Reserved elements in the context of standard RudderStack event spec
|