@rudderstack/analytics-js 3.11.8 → 3.11.10
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/npm/legacy/bundled/cjs/index.cjs +23 -23
- package/dist/npm/legacy/bundled/esm/index.mjs +23 -23
- package/dist/npm/legacy/bundled/umd/index.js +23 -23
- package/dist/npm/legacy/cjs/index.cjs +23 -23
- package/dist/npm/legacy/content-script/cjs/index.cjs +23 -23
- package/dist/npm/legacy/content-script/esm/index.mjs +23 -23
- package/dist/npm/legacy/content-script/umd/index.js +23 -23
- package/dist/npm/legacy/esm/index.mjs +23 -23
- package/dist/npm/legacy/umd/index.js +23 -23
- package/dist/npm/modern/bundled/cjs/index.cjs +23 -23
- package/dist/npm/modern/bundled/esm/index.mjs +23 -23
- package/dist/npm/modern/bundled/umd/index.js +23 -23
- package/dist/npm/modern/cjs/index.cjs +1 -1
- package/dist/npm/modern/content-script/cjs/index.cjs +23 -23
- package/dist/npm/modern/content-script/esm/index.mjs +23 -23
- package/dist/npm/modern/content-script/umd/index.js +23 -23
- package/dist/npm/modern/esm/index.mjs +1 -1
- package/dist/npm/modern/umd/index.js +1 -1
- package/package.json +1 -1
@@ -463,7 +463,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
463
463
|
* @returns Instance of Error with message prepended with issue
|
464
464
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
465
465
|
|
466
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
466
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.10';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
467
467
|
|
468
468
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
469
469
|
|
@@ -758,6 +758,12 @@ const EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING=(context,payloadSize,sizeLimit)=>`${
|
|
758
758
|
*/const getFinalEventForDeliveryMutator=(event,currentTime)=>{const finalEvent=clone(event);// Update sentAt timestamp to the latest timestamp
|
759
759
|
finalEvent.sentAt=currentTime;return finalEvent;};
|
760
760
|
|
761
|
+
const METRICS_PAYLOAD_VERSION='1';
|
762
|
+
|
763
|
+
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
764
|
+
|
765
|
+
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
766
|
+
|
761
767
|
const BEACON_PLUGIN_EVENTS_QUEUE_DEBUG=context=>`${context}${LOG_CONTEXT_SEPARATOR}Sending events to data plane.`;const BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to string.`;const BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to Blob.`;const BEACON_QUEUE_SEND_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to send events batch data to the browser's beacon queue. The events will be dropped.`;const BEACON_QUEUE_DELIVERY_ERROR=url=>`Failed to send events batch data to the browser's beacon queue for URL ${url}.`;
|
762
768
|
|
763
769
|
const DEFAULT_BEACON_QUEUE_MAX_SIZE=10;const DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS=10*60*1000;// 10 minutes
|
@@ -772,8 +778,6 @@ const DEFAULT_BEACON_QUEUE_OPTIONS={maxItems:DEFAULT_BEACON_QUEUE_MAX_SIZE,flush
|
|
772
778
|
* @returns stringified events payload as Blob, undefined if error occurs.
|
773
779
|
*/const getBatchDeliveryPayload$1=(events,currentTime,logger)=>{const data={batch:events,sentAt:currentTime};try{const blobPayload=stringifyWithoutCircular(data,true);const blobOptions={type:'text/plain'};if(blobPayload){return new Blob([blobPayload],blobOptions);}logger?.error(BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN));}catch(err){logger?.error(BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN),err);}return undefined;};const getNormalizedBeaconQueueOptions=queueOpts=>mergeDeepRight(DEFAULT_BEACON_QUEUE_OPTIONS,queueOpts);const getDeliveryUrl$1=(dataplaneUrl,writeKey)=>{const dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/','beacon','/',DATA_PLANE_API_VERSION$1,'/',`batch?writeKey=${writeKey}`].join('')),dpUrl).href;};
|
774
780
|
|
775
|
-
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
776
|
-
|
777
781
|
let ScheduleModes=/*#__PURE__*/function(ScheduleModes){ScheduleModes[ScheduleModes["ASAP"]=1]="ASAP";ScheduleModes[ScheduleModes["RESCHEDULE"]=2]="RESCHEDULE";ScheduleModes[ScheduleModes["ABANDON"]=3]="ABANDON";return ScheduleModes;}({});const DEFAULT_CLOCK_LATE_FACTOR=2;const DEFAULT_CLOCK={setTimeout(fn,ms){return globalThis.setTimeout(fn,ms);},clearTimeout(id){return globalThis.clearTimeout(id);},Date:globalThis.Date,clockLateFactor:DEFAULT_CLOCK_LATE_FACTOR};class Schedule{constructor(){this.tasks={};this.nextId=1;this.clock=DEFAULT_CLOCK;}now(){return +new this.clock.Date();}run(task,timeout,mode){const id=(this.nextId+1).toString();this.tasks[id]=this.clock.setTimeout(this.handle(id,task,timeout,mode||ScheduleModes.ASAP),timeout);return id;}handle(id,callback,timeout,mode){const start=this.now();return ()=>{delete this.tasks[id];const elapsedTimeoutTime=start+timeout*(this.clock.clockLateFactor||DEFAULT_CLOCK_LATE_FACTOR);const currentTime=this.now();const notCompletedOrTimedOut=mode>=ScheduleModes.RESCHEDULE&&elapsedTimeoutTime<currentTime;if(notCompletedOrTimedOut){if(mode===ScheduleModes.RESCHEDULE){this.run(callback,timeout,mode);}return undefined;}return callback();};}cancel(id){if(this.tasks[id]){this.clock.clearTimeout(this.tasks[id]);delete this.tasks[id];}}cancelAll(){Object.values(this.tasks).forEach(this.clock.clearTimeout);this.tasks={};}}
|
778
782
|
|
779
783
|
const RETRY_QUEUE_PROCESS_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Process function threw an error.`;const RETRY_QUEUE_ENTRY_REMOVE_ERROR=(context,entry,attempt)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to remove local storage entry "${entry}" (attempt: ${attempt}.`;
|
@@ -922,6 +926,20 @@ if(!cmpConfig?.consents){return true;}const configuredConsents=cmpConfig.consent
|
|
922
926
|
// the configured resolution strategy
|
923
927
|
const matchPredicate=consent=>allowedConsentIds.includes(consent);switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler?.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$3);return true;}}}});
|
924
928
|
|
929
|
+
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
930
|
+
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
931
|
+
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
932
|
+
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
933
|
+
|
934
|
+
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
935
|
+
|
936
|
+
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
937
|
+
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
938
|
+
* @param intgOpts Integration options object
|
939
|
+
* @param destinations Destinations array
|
940
|
+
* @returns Destinations array filtered based on the integration options
|
941
|
+
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
942
|
+
|
925
943
|
const DIR_NAME$1g='AdobeAnalytics';const DISPLAY_NAME$1g='Adobe Analytics';
|
926
944
|
|
927
945
|
const DIR_NAME$1f='Amplitude';const DISPLAY_NAME$1f='Amplitude';
|
@@ -1087,20 +1105,6 @@ const DIR_NAME='XPixel';const DISPLAY_NAME='XPixel';
|
|
1087
1105
|
// map of the destination display names to the destination directory names
|
1088
1106
|
const destDisplayNamesToFileNamesMap={[DISPLAY_NAME$W]:DIR_NAME$W,[DISPLAY_NAME$12]:DIR_NAME$12,[DISPLAY_NAME$X]:DIR_NAME$X,[DISPLAY_NAME$$]:DIR_NAME$$,[DISPLAY_NAME$z]:DIR_NAME$z,[DISPLAY_NAME$Z]:DIR_NAME$Z,[DISPLAY_NAME$1c]:DIR_NAME$1c,[DISPLAY_NAME$V]:DIR_NAME$V,[DISPLAY_NAME$U]:DIR_NAME$U,[DISPLAY_NAME$T]:DIR_NAME$T,[DISPLAY_NAME$16]:DIR_NAME$16,[DISPLAY_NAME$1a]:DIR_NAME$1a,[DISPLAY_NAME$18]:DIR_NAME$18,[DISPLAY_NAME$14]:DIR_NAME$14,[DISPLAY_NAME$P]:DIR_NAME$P,[DISPLAY_NAME$L]:DIR_NAME$L,[DISPLAY_NAME$1b]:DIR_NAME$1b,[DISPLAY_NAME$13]:DIR_NAME$13,[DISPLAY_NAME$A]:DIR_NAME$A,[DISPLAY_NAME$11]:DIR_NAME$11,[DISPLAY_NAME$10]:DIR_NAME$10,[DISPLAY_NAME$M]:DIR_NAME$M,[DISPLAY_NAME$1f]:DIR_NAME$1f,[DISPLAY_NAME$K]:DIR_NAME$K,[DISPLAY_NAME$O]:DIR_NAME$O,[DISPLAY_NAME$1e]:DIR_NAME$1e,[DISPLAY_NAME$H]:DIR_NAME$H,[DISPLAY_NAME$S]:DIR_NAME$S,[DISPLAY_NAME$19]:DIR_NAME$19,[DISPLAY_NAME$1d]:DIR_NAME$1d,[DISPLAY_NAME$J]:DIR_NAME$J,[DISPLAY_NAME$1g]:DIR_NAME$1g,[DISPLAY_NAME$Q]:DIR_NAME$Q,[DISPLAY_NAME$D]:DIR_NAME$D,[DISPLAY_NAME$15]:DIR_NAME$15,[DISPLAY_NAME$Y]:DIR_NAME$Y,[DISPLAY_NAME$17]:DIR_NAME$17,[DISPLAY_NAME$N]:DIR_NAME$N,[DISPLAY_NAME$F]:DIR_NAME$F,[DISPLAY_NAME$G]:DIR_NAME$G,[DISPLAY_NAME$C]:DIR_NAME$C,[DISPLAY_NAME$E]:DIR_NAME$E,[DISPLAY_NAME$B]:DIR_NAME$B,[DISPLAY_NAME$I]:DIR_NAME$I,[DISPLAY_NAME$_]:DIR_NAME$_,[DISPLAY_NAME$R]:DIR_NAME$R,[DISPLAY_NAME$y]:DIR_NAME$y,[DISPLAY_NAME$x]:DIR_NAME$x,[DISPLAY_NAME$w]:DIR_NAME$w,[DISPLAY_NAME$v]:DIR_NAME$v,[DISPLAY_NAME$u]:DIR_NAME$u,[DISPLAY_NAME$t]:DIR_NAME$t,[DISPLAY_NAME$s]:DIR_NAME$s,[DISPLAY_NAME$r]:DIR_NAME$r,[DISPLAY_NAME$q]:DIR_NAME$q,[DISPLAY_NAME$p]:DIR_NAME$p,[DISPLAY_NAME$o]:DIR_NAME$o,[DISPLAY_NAME$n]:DIR_NAME$n,[DISPLAY_NAME$m]:DIR_NAME$m,[DISPLAY_NAME$l]:DIR_NAME$l,[DISPLAY_NAME$k]:DIR_NAME$k,[DISPLAY_NAME$j]:DIR_NAME$j,[DISPLAY_NAME$i]:DIR_NAME$i,[DISPLAY_NAME$h]:DIR_NAME$h,[DISPLAY_NAME$g]:DIR_NAME$g,[DISPLAY_NAME$f]:DIR_NAME$f,[DISPLAY_NAME$e]:DIR_NAME$e,[DISPLAY_NAME$d]:DIR_NAME$d,[DISPLAY_NAME$c]:DIR_NAME$c,[DISPLAY_NAME$b]:DIR_NAME$b,[DISPLAY_NAME$a]:DIR_NAME$a,[DISPLAY_NAME$9]:DIR_NAME$9,[DISPLAY_NAME$8]:DIR_NAME$8,[DISPLAY_NAME$7]:DIR_NAME$7,[DISPLAY_NAME$6]:DIR_NAME$6,[DISPLAY_NAME$5]:DIR_NAME$5,[DISPLAY_NAME$4]:DIR_NAME$4,[DISPLAY_NAME$3]:DIR_NAME$3,[DISPLAY_NAME$2]:DIR_NAME$2,[DISPLAY_NAME$1]:DIR_NAME$1,[DISPLAY_NAME]:DIR_NAME};
|
1089
1107
|
|
1090
|
-
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
1091
|
-
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
1092
|
-
* @param intgOpts Integration options object
|
1093
|
-
* @param destinations Destinations array
|
1094
|
-
* @returns Destinations array filtered based on the integration options
|
1095
|
-
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1096
|
-
|
1097
|
-
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
1098
|
-
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
1099
|
-
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
1100
|
-
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
1101
|
-
|
1102
|
-
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
1103
|
-
|
1104
1108
|
/**
|
1105
1109
|
* Determines if the destination SDK code is evaluated
|
1106
1110
|
* @param destSDKIdentifier The name of the global globalThis object that contains the destination SDK
|
@@ -1114,7 +1118,7 @@ const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUse
|
|
1114
1118
|
* @param curDestIntgConfig Current destinations integration config
|
1115
1119
|
* @param logger Logger object
|
1116
1120
|
* @returns Combined destinations integrations config
|
1117
|
-
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,dest.instance?.getDataForIntegrationsObject());}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1121
|
+
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,getSanitizedValue(dest.instance?.getDataForIntegrationsObject()));}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1118
1122
|
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[...state.nativeDestinations.initializedDestinations.value,initializedDestination];}).catch(err=>{state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];// The error message is already formatted in the isDestinationReady function
|
1119
1123
|
logger?.error(err);});}catch(err){state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INIT_ERROR(dest.userFriendlyId));}};
|
1120
1124
|
|
@@ -1140,10 +1144,6 @@ const pluginName$b='DeviceModeTransformation';const DeviceModeTransformation=()=
|
|
1140
1144
|
`${QUEUE_NAME$2}_${writeKey}`,DEFAULT_TRANSFORMATION_QUEUE_OPTIONS,(item,done,attemptNumber,maxRetryAttempts)=>{const payload=createPayload(item.event,item.destinationIds,item.token);httpClient.getAsyncData({url:`${state.lifecycle.activeDataplaneUrl.value}/transform`,options:{method:'POST',data:getDMTDeliveryPayload(payload),sendRawData:true},isRawResponse:true,timeout:REQUEST_TIMEOUT_MS$2,callback:(result,details)=>{// null means item will not be requeued
|
1141
1145
|
const queueErrResp=isErrRetryable(details)?details:null;if(!queueErrResp||attemptNumber===maxRetryAttempts){sendTransformedEventToDestinations(state,pluginsManager,item.destinationIds,result,details?.xhr?.status,item.event,errorHandler,logger);}done(queueErrResp,result);}});},storeManager,MEMORY_STORAGE);return eventsQueue;},enqueue(state,eventsQueue,event,destinations){const destinationIds=destinations.map(d=>d.id);eventsQueue.addItem({event,destinationIds,token:state.session.authToken.value});}}});
|
1142
1146
|
|
1143
|
-
const METRICS_PAYLOAD_VERSION='1';
|
1144
|
-
|
1145
|
-
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
1146
|
-
|
1147
1147
|
// Errors from the below scripts are NOT allowed to reach Bugsnag
|
1148
1148
|
const SDK_FILE_NAME_PREFIXES=()=>['rsa'// Prefix for all the SDK scripts including plugins and module federated chunks
|
1149
1149
|
];const DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
|
@@ -1348,7 +1348,7 @@ globalThis.getIubendaUserConsentedPurposes=()=>state.consents.data.value.allowed
|
|
1348
1348
|
// This will be helpful for debugging
|
1349
1349
|
globalThis.getIubendaUserDeniedPurposes=()=>state.consents.data.value.deniedConsentIds?.slice();// updateIubendaConsent callback function to update current consent purpose state
|
1350
1350
|
globalThis.updateIubendaConsent=iubendaConsentData=>{updateConsentStateFromData$1(state,iubendaConsentData);};},updateConsentsInfo(state,storeManager,logger){// retrieve consent data and update the state
|
1351
|
-
let iubendaConsentData;// From window
|
1351
|
+
let iubendaConsentData;// From window
|
1352
1352
|
if(!isUndefined(globalThis._iub.cs.consent.purposes)){iubendaConsentData=globalThis._iub.cs.consent.purposes;// From cookie
|
1353
1353
|
}else {iubendaConsentData=getIubendaConsentData(storeManager,logger);}updateConsentStateFromData$1(state,iubendaConsentData);},isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}const allowedConsentIds=state.consents.data.value.allowedConsentIds;const matchPredicate=consent=>allowedConsentIds.includes(consent);try{const{consentManagement}=destConfig;// If the destination does not have consent management config, events should be sent.
|
1354
1354
|
if(consentManagement){// Get the corresponding consents for the destination
|
@@ -459,7 +459,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
459
459
|
* @returns Instance of Error with message prepended with issue
|
460
460
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
461
461
|
|
462
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
462
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.10';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
463
463
|
|
464
464
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
465
465
|
|
@@ -754,6 +754,12 @@ const EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING=(context,payloadSize,sizeLimit)=>`${
|
|
754
754
|
*/const getFinalEventForDeliveryMutator=(event,currentTime)=>{const finalEvent=clone(event);// Update sentAt timestamp to the latest timestamp
|
755
755
|
finalEvent.sentAt=currentTime;return finalEvent;};
|
756
756
|
|
757
|
+
const METRICS_PAYLOAD_VERSION='1';
|
758
|
+
|
759
|
+
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
760
|
+
|
761
|
+
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
762
|
+
|
757
763
|
const BEACON_PLUGIN_EVENTS_QUEUE_DEBUG=context=>`${context}${LOG_CONTEXT_SEPARATOR}Sending events to data plane.`;const BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to string.`;const BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to Blob.`;const BEACON_QUEUE_SEND_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to send events batch data to the browser's beacon queue. The events will be dropped.`;const BEACON_QUEUE_DELIVERY_ERROR=url=>`Failed to send events batch data to the browser's beacon queue for URL ${url}.`;
|
758
764
|
|
759
765
|
const DEFAULT_BEACON_QUEUE_MAX_SIZE=10;const DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS=10*60*1000;// 10 minutes
|
@@ -768,8 +774,6 @@ const DEFAULT_BEACON_QUEUE_OPTIONS={maxItems:DEFAULT_BEACON_QUEUE_MAX_SIZE,flush
|
|
768
774
|
* @returns stringified events payload as Blob, undefined if error occurs.
|
769
775
|
*/const getBatchDeliveryPayload$1=(events,currentTime,logger)=>{const data={batch:events,sentAt:currentTime};try{const blobPayload=stringifyWithoutCircular(data,true);const blobOptions={type:'text/plain'};if(blobPayload){return new Blob([blobPayload],blobOptions);}logger?.error(BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN));}catch(err){logger?.error(BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN),err);}return undefined;};const getNormalizedBeaconQueueOptions=queueOpts=>mergeDeepRight(DEFAULT_BEACON_QUEUE_OPTIONS,queueOpts);const getDeliveryUrl$1=(dataplaneUrl,writeKey)=>{const dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/','beacon','/',DATA_PLANE_API_VERSION$1,'/',`batch?writeKey=${writeKey}`].join('')),dpUrl).href;};
|
770
776
|
|
771
|
-
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
772
|
-
|
773
777
|
let ScheduleModes=/*#__PURE__*/function(ScheduleModes){ScheduleModes[ScheduleModes["ASAP"]=1]="ASAP";ScheduleModes[ScheduleModes["RESCHEDULE"]=2]="RESCHEDULE";ScheduleModes[ScheduleModes["ABANDON"]=3]="ABANDON";return ScheduleModes;}({});const DEFAULT_CLOCK_LATE_FACTOR=2;const DEFAULT_CLOCK={setTimeout(fn,ms){return globalThis.setTimeout(fn,ms);},clearTimeout(id){return globalThis.clearTimeout(id);},Date:globalThis.Date,clockLateFactor:DEFAULT_CLOCK_LATE_FACTOR};class Schedule{constructor(){this.tasks={};this.nextId=1;this.clock=DEFAULT_CLOCK;}now(){return +new this.clock.Date();}run(task,timeout,mode){const id=(this.nextId+1).toString();this.tasks[id]=this.clock.setTimeout(this.handle(id,task,timeout,mode||ScheduleModes.ASAP),timeout);return id;}handle(id,callback,timeout,mode){const start=this.now();return ()=>{delete this.tasks[id];const elapsedTimeoutTime=start+timeout*(this.clock.clockLateFactor||DEFAULT_CLOCK_LATE_FACTOR);const currentTime=this.now();const notCompletedOrTimedOut=mode>=ScheduleModes.RESCHEDULE&&elapsedTimeoutTime<currentTime;if(notCompletedOrTimedOut){if(mode===ScheduleModes.RESCHEDULE){this.run(callback,timeout,mode);}return undefined;}return callback();};}cancel(id){if(this.tasks[id]){this.clock.clearTimeout(this.tasks[id]);delete this.tasks[id];}}cancelAll(){Object.values(this.tasks).forEach(this.clock.clearTimeout);this.tasks={};}}
|
774
778
|
|
775
779
|
const RETRY_QUEUE_PROCESS_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Process function threw an error.`;const RETRY_QUEUE_ENTRY_REMOVE_ERROR=(context,entry,attempt)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to remove local storage entry "${entry}" (attempt: ${attempt}.`;
|
@@ -918,6 +922,20 @@ if(!cmpConfig?.consents){return true;}const configuredConsents=cmpConfig.consent
|
|
918
922
|
// the configured resolution strategy
|
919
923
|
const matchPredicate=consent=>allowedConsentIds.includes(consent);switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler?.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$3);return true;}}}});
|
920
924
|
|
925
|
+
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
926
|
+
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
927
|
+
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
928
|
+
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
929
|
+
|
930
|
+
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
931
|
+
|
932
|
+
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
933
|
+
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
934
|
+
* @param intgOpts Integration options object
|
935
|
+
* @param destinations Destinations array
|
936
|
+
* @returns Destinations array filtered based on the integration options
|
937
|
+
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
938
|
+
|
921
939
|
const DIR_NAME$1g='AdobeAnalytics';const DISPLAY_NAME$1g='Adobe Analytics';
|
922
940
|
|
923
941
|
const DIR_NAME$1f='Amplitude';const DISPLAY_NAME$1f='Amplitude';
|
@@ -1083,20 +1101,6 @@ const DIR_NAME='XPixel';const DISPLAY_NAME='XPixel';
|
|
1083
1101
|
// map of the destination display names to the destination directory names
|
1084
1102
|
const destDisplayNamesToFileNamesMap={[DISPLAY_NAME$W]:DIR_NAME$W,[DISPLAY_NAME$12]:DIR_NAME$12,[DISPLAY_NAME$X]:DIR_NAME$X,[DISPLAY_NAME$$]:DIR_NAME$$,[DISPLAY_NAME$z]:DIR_NAME$z,[DISPLAY_NAME$Z]:DIR_NAME$Z,[DISPLAY_NAME$1c]:DIR_NAME$1c,[DISPLAY_NAME$V]:DIR_NAME$V,[DISPLAY_NAME$U]:DIR_NAME$U,[DISPLAY_NAME$T]:DIR_NAME$T,[DISPLAY_NAME$16]:DIR_NAME$16,[DISPLAY_NAME$1a]:DIR_NAME$1a,[DISPLAY_NAME$18]:DIR_NAME$18,[DISPLAY_NAME$14]:DIR_NAME$14,[DISPLAY_NAME$P]:DIR_NAME$P,[DISPLAY_NAME$L]:DIR_NAME$L,[DISPLAY_NAME$1b]:DIR_NAME$1b,[DISPLAY_NAME$13]:DIR_NAME$13,[DISPLAY_NAME$A]:DIR_NAME$A,[DISPLAY_NAME$11]:DIR_NAME$11,[DISPLAY_NAME$10]:DIR_NAME$10,[DISPLAY_NAME$M]:DIR_NAME$M,[DISPLAY_NAME$1f]:DIR_NAME$1f,[DISPLAY_NAME$K]:DIR_NAME$K,[DISPLAY_NAME$O]:DIR_NAME$O,[DISPLAY_NAME$1e]:DIR_NAME$1e,[DISPLAY_NAME$H]:DIR_NAME$H,[DISPLAY_NAME$S]:DIR_NAME$S,[DISPLAY_NAME$19]:DIR_NAME$19,[DISPLAY_NAME$1d]:DIR_NAME$1d,[DISPLAY_NAME$J]:DIR_NAME$J,[DISPLAY_NAME$1g]:DIR_NAME$1g,[DISPLAY_NAME$Q]:DIR_NAME$Q,[DISPLAY_NAME$D]:DIR_NAME$D,[DISPLAY_NAME$15]:DIR_NAME$15,[DISPLAY_NAME$Y]:DIR_NAME$Y,[DISPLAY_NAME$17]:DIR_NAME$17,[DISPLAY_NAME$N]:DIR_NAME$N,[DISPLAY_NAME$F]:DIR_NAME$F,[DISPLAY_NAME$G]:DIR_NAME$G,[DISPLAY_NAME$C]:DIR_NAME$C,[DISPLAY_NAME$E]:DIR_NAME$E,[DISPLAY_NAME$B]:DIR_NAME$B,[DISPLAY_NAME$I]:DIR_NAME$I,[DISPLAY_NAME$_]:DIR_NAME$_,[DISPLAY_NAME$R]:DIR_NAME$R,[DISPLAY_NAME$y]:DIR_NAME$y,[DISPLAY_NAME$x]:DIR_NAME$x,[DISPLAY_NAME$w]:DIR_NAME$w,[DISPLAY_NAME$v]:DIR_NAME$v,[DISPLAY_NAME$u]:DIR_NAME$u,[DISPLAY_NAME$t]:DIR_NAME$t,[DISPLAY_NAME$s]:DIR_NAME$s,[DISPLAY_NAME$r]:DIR_NAME$r,[DISPLAY_NAME$q]:DIR_NAME$q,[DISPLAY_NAME$p]:DIR_NAME$p,[DISPLAY_NAME$o]:DIR_NAME$o,[DISPLAY_NAME$n]:DIR_NAME$n,[DISPLAY_NAME$m]:DIR_NAME$m,[DISPLAY_NAME$l]:DIR_NAME$l,[DISPLAY_NAME$k]:DIR_NAME$k,[DISPLAY_NAME$j]:DIR_NAME$j,[DISPLAY_NAME$i]:DIR_NAME$i,[DISPLAY_NAME$h]:DIR_NAME$h,[DISPLAY_NAME$g]:DIR_NAME$g,[DISPLAY_NAME$f]:DIR_NAME$f,[DISPLAY_NAME$e]:DIR_NAME$e,[DISPLAY_NAME$d]:DIR_NAME$d,[DISPLAY_NAME$c]:DIR_NAME$c,[DISPLAY_NAME$b]:DIR_NAME$b,[DISPLAY_NAME$a]:DIR_NAME$a,[DISPLAY_NAME$9]:DIR_NAME$9,[DISPLAY_NAME$8]:DIR_NAME$8,[DISPLAY_NAME$7]:DIR_NAME$7,[DISPLAY_NAME$6]:DIR_NAME$6,[DISPLAY_NAME$5]:DIR_NAME$5,[DISPLAY_NAME$4]:DIR_NAME$4,[DISPLAY_NAME$3]:DIR_NAME$3,[DISPLAY_NAME$2]:DIR_NAME$2,[DISPLAY_NAME$1]:DIR_NAME$1,[DISPLAY_NAME]:DIR_NAME};
|
1085
1103
|
|
1086
|
-
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
1087
|
-
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
1088
|
-
* @param intgOpts Integration options object
|
1089
|
-
* @param destinations Destinations array
|
1090
|
-
* @returns Destinations array filtered based on the integration options
|
1091
|
-
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1092
|
-
|
1093
|
-
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
1094
|
-
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
1095
|
-
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
1096
|
-
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
1097
|
-
|
1098
|
-
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
1099
|
-
|
1100
1104
|
/**
|
1101
1105
|
* Determines if the destination SDK code is evaluated
|
1102
1106
|
* @param destSDKIdentifier The name of the global globalThis object that contains the destination SDK
|
@@ -1110,7 +1114,7 @@ const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUse
|
|
1110
1114
|
* @param curDestIntgConfig Current destinations integration config
|
1111
1115
|
* @param logger Logger object
|
1112
1116
|
* @returns Combined destinations integrations config
|
1113
|
-
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,dest.instance?.getDataForIntegrationsObject());}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1117
|
+
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,getSanitizedValue(dest.instance?.getDataForIntegrationsObject()));}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1114
1118
|
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[...state.nativeDestinations.initializedDestinations.value,initializedDestination];}).catch(err=>{state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];// The error message is already formatted in the isDestinationReady function
|
1115
1119
|
logger?.error(err);});}catch(err){state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INIT_ERROR(dest.userFriendlyId));}};
|
1116
1120
|
|
@@ -1136,10 +1140,6 @@ const pluginName$b='DeviceModeTransformation';const DeviceModeTransformation=()=
|
|
1136
1140
|
`${QUEUE_NAME$2}_${writeKey}`,DEFAULT_TRANSFORMATION_QUEUE_OPTIONS,(item,done,attemptNumber,maxRetryAttempts)=>{const payload=createPayload(item.event,item.destinationIds,item.token);httpClient.getAsyncData({url:`${state.lifecycle.activeDataplaneUrl.value}/transform`,options:{method:'POST',data:getDMTDeliveryPayload(payload),sendRawData:true},isRawResponse:true,timeout:REQUEST_TIMEOUT_MS$2,callback:(result,details)=>{// null means item will not be requeued
|
1137
1141
|
const queueErrResp=isErrRetryable(details)?details:null;if(!queueErrResp||attemptNumber===maxRetryAttempts){sendTransformedEventToDestinations(state,pluginsManager,item.destinationIds,result,details?.xhr?.status,item.event,errorHandler,logger);}done(queueErrResp,result);}});},storeManager,MEMORY_STORAGE);return eventsQueue;},enqueue(state,eventsQueue,event,destinations){const destinationIds=destinations.map(d=>d.id);eventsQueue.addItem({event,destinationIds,token:state.session.authToken.value});}}});
|
1138
1142
|
|
1139
|
-
const METRICS_PAYLOAD_VERSION='1';
|
1140
|
-
|
1141
|
-
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
1142
|
-
|
1143
1143
|
// Errors from the below scripts are NOT allowed to reach Bugsnag
|
1144
1144
|
const SDK_FILE_NAME_PREFIXES=()=>['rsa'// Prefix for all the SDK scripts including plugins and module federated chunks
|
1145
1145
|
];const DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
|
@@ -1344,7 +1344,7 @@ globalThis.getIubendaUserConsentedPurposes=()=>state.consents.data.value.allowed
|
|
1344
1344
|
// This will be helpful for debugging
|
1345
1345
|
globalThis.getIubendaUserDeniedPurposes=()=>state.consents.data.value.deniedConsentIds?.slice();// updateIubendaConsent callback function to update current consent purpose state
|
1346
1346
|
globalThis.updateIubendaConsent=iubendaConsentData=>{updateConsentStateFromData$1(state,iubendaConsentData);};},updateConsentsInfo(state,storeManager,logger){// retrieve consent data and update the state
|
1347
|
-
let iubendaConsentData;// From window
|
1347
|
+
let iubendaConsentData;// From window
|
1348
1348
|
if(!isUndefined(globalThis._iub.cs.consent.purposes)){iubendaConsentData=globalThis._iub.cs.consent.purposes;// From cookie
|
1349
1349
|
}else {iubendaConsentData=getIubendaConsentData(storeManager,logger);}updateConsentStateFromData$1(state,iubendaConsentData);},isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}const allowedConsentIds=state.consents.data.value.allowedConsentIds;const matchPredicate=consent=>allowedConsentIds.includes(consent);try{const{consentManagement}=destConfig;// If the destination does not have consent management config, events should be sent.
|
1350
1350
|
if(consentManagement){// Get the corresponding consents for the destination
|
@@ -465,7 +465,7 @@
|
|
465
465
|
* @returns Instance of Error with message prepended with issue
|
466
466
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
467
467
|
|
468
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
468
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.10';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
469
469
|
|
470
470
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
471
471
|
|
@@ -760,6 +760,12 @@
|
|
760
760
|
*/const getFinalEventForDeliveryMutator=(event,currentTime)=>{const finalEvent=clone(event);// Update sentAt timestamp to the latest timestamp
|
761
761
|
finalEvent.sentAt=currentTime;return finalEvent;};
|
762
762
|
|
763
|
+
const METRICS_PAYLOAD_VERSION='1';
|
764
|
+
|
765
|
+
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
766
|
+
|
767
|
+
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
768
|
+
|
763
769
|
const BEACON_PLUGIN_EVENTS_QUEUE_DEBUG=context=>`${context}${LOG_CONTEXT_SEPARATOR}Sending events to data plane.`;const BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to string.`;const BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to convert events batch object to Blob.`;const BEACON_QUEUE_SEND_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to send events batch data to the browser's beacon queue. The events will be dropped.`;const BEACON_QUEUE_DELIVERY_ERROR=url=>`Failed to send events batch data to the browser's beacon queue for URL ${url}.`;
|
764
770
|
|
765
771
|
const DEFAULT_BEACON_QUEUE_MAX_SIZE=10;const DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS=10*60*1000;// 10 minutes
|
@@ -774,8 +780,6 @@
|
|
774
780
|
* @returns stringified events payload as Blob, undefined if error occurs.
|
775
781
|
*/const getBatchDeliveryPayload$1=(events,currentTime,logger)=>{const data={batch:events,sentAt:currentTime};try{const blobPayload=stringifyWithoutCircular(data,true);const blobOptions={type:'text/plain'};if(blobPayload){return new Blob([blobPayload],blobOptions);}logger?.error(BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN));}catch(err){logger?.error(BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN),err);}return undefined;};const getNormalizedBeaconQueueOptions=queueOpts=>mergeDeepRight(DEFAULT_BEACON_QUEUE_OPTIONS,queueOpts);const getDeliveryUrl$1=(dataplaneUrl,writeKey)=>{const dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/','beacon','/',DATA_PLANE_API_VERSION$1,'/',`batch?writeKey=${writeKey}`].join('')),dpUrl).href;};
|
776
782
|
|
777
|
-
const QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
778
|
-
|
779
783
|
let ScheduleModes=/*#__PURE__*/function(ScheduleModes){ScheduleModes[ScheduleModes["ASAP"]=1]="ASAP";ScheduleModes[ScheduleModes["RESCHEDULE"]=2]="RESCHEDULE";ScheduleModes[ScheduleModes["ABANDON"]=3]="ABANDON";return ScheduleModes;}({});const DEFAULT_CLOCK_LATE_FACTOR=2;const DEFAULT_CLOCK={setTimeout(fn,ms){return globalThis.setTimeout(fn,ms);},clearTimeout(id){return globalThis.clearTimeout(id);},Date:globalThis.Date,clockLateFactor:DEFAULT_CLOCK_LATE_FACTOR};class Schedule{constructor(){this.tasks={};this.nextId=1;this.clock=DEFAULT_CLOCK;}now(){return +new this.clock.Date();}run(task,timeout,mode){const id=(this.nextId+1).toString();this.tasks[id]=this.clock.setTimeout(this.handle(id,task,timeout,mode||ScheduleModes.ASAP),timeout);return id;}handle(id,callback,timeout,mode){const start=this.now();return ()=>{delete this.tasks[id];const elapsedTimeoutTime=start+timeout*(this.clock.clockLateFactor||DEFAULT_CLOCK_LATE_FACTOR);const currentTime=this.now();const notCompletedOrTimedOut=mode>=ScheduleModes.RESCHEDULE&&elapsedTimeoutTime<currentTime;if(notCompletedOrTimedOut){if(mode===ScheduleModes.RESCHEDULE){this.run(callback,timeout,mode);}return undefined;}return callback();};}cancel(id){if(this.tasks[id]){this.clock.clearTimeout(this.tasks[id]);delete this.tasks[id];}}cancelAll(){Object.values(this.tasks).forEach(this.clock.clearTimeout);this.tasks={};}}
|
780
784
|
|
781
785
|
const RETRY_QUEUE_PROCESS_ERROR=context=>`${context}${LOG_CONTEXT_SEPARATOR}Process function threw an error.`;const RETRY_QUEUE_ENTRY_REMOVE_ERROR=(context,entry,attempt)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to remove local storage entry "${entry}" (attempt: ${attempt}.`;
|
@@ -924,6 +928,20 @@
|
|
924
928
|
// the configured resolution strategy
|
925
929
|
const matchPredicate=consent=>allowedConsentIds.includes(consent);switch(resolutionStrategy){case'or':return configuredConsents.some(matchPredicate)||configuredConsents.length===0;case'and':default:return configuredConsents.every(matchPredicate);}}catch(err){errorHandler?.onError(err,CUSTOM_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR$3);return true;}}}});
|
926
930
|
|
931
|
+
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
932
|
+
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
933
|
+
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
934
|
+
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
935
|
+
|
936
|
+
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
937
|
+
|
938
|
+
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
939
|
+
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
940
|
+
* @param intgOpts Integration options object
|
941
|
+
* @param destinations Destinations array
|
942
|
+
* @returns Destinations array filtered based on the integration options
|
943
|
+
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
944
|
+
|
927
945
|
const DIR_NAME$1g='AdobeAnalytics';const DISPLAY_NAME$1g='Adobe Analytics';
|
928
946
|
|
929
947
|
const DIR_NAME$1f='Amplitude';const DISPLAY_NAME$1f='Amplitude';
|
@@ -1089,20 +1107,6 @@
|
|
1089
1107
|
// map of the destination display names to the destination directory names
|
1090
1108
|
const destDisplayNamesToFileNamesMap={[DISPLAY_NAME$W]:DIR_NAME$W,[DISPLAY_NAME$12]:DIR_NAME$12,[DISPLAY_NAME$X]:DIR_NAME$X,[DISPLAY_NAME$$]:DIR_NAME$$,[DISPLAY_NAME$z]:DIR_NAME$z,[DISPLAY_NAME$Z]:DIR_NAME$Z,[DISPLAY_NAME$1c]:DIR_NAME$1c,[DISPLAY_NAME$V]:DIR_NAME$V,[DISPLAY_NAME$U]:DIR_NAME$U,[DISPLAY_NAME$T]:DIR_NAME$T,[DISPLAY_NAME$16]:DIR_NAME$16,[DISPLAY_NAME$1a]:DIR_NAME$1a,[DISPLAY_NAME$18]:DIR_NAME$18,[DISPLAY_NAME$14]:DIR_NAME$14,[DISPLAY_NAME$P]:DIR_NAME$P,[DISPLAY_NAME$L]:DIR_NAME$L,[DISPLAY_NAME$1b]:DIR_NAME$1b,[DISPLAY_NAME$13]:DIR_NAME$13,[DISPLAY_NAME$A]:DIR_NAME$A,[DISPLAY_NAME$11]:DIR_NAME$11,[DISPLAY_NAME$10]:DIR_NAME$10,[DISPLAY_NAME$M]:DIR_NAME$M,[DISPLAY_NAME$1f]:DIR_NAME$1f,[DISPLAY_NAME$K]:DIR_NAME$K,[DISPLAY_NAME$O]:DIR_NAME$O,[DISPLAY_NAME$1e]:DIR_NAME$1e,[DISPLAY_NAME$H]:DIR_NAME$H,[DISPLAY_NAME$S]:DIR_NAME$S,[DISPLAY_NAME$19]:DIR_NAME$19,[DISPLAY_NAME$1d]:DIR_NAME$1d,[DISPLAY_NAME$J]:DIR_NAME$J,[DISPLAY_NAME$1g]:DIR_NAME$1g,[DISPLAY_NAME$Q]:DIR_NAME$Q,[DISPLAY_NAME$D]:DIR_NAME$D,[DISPLAY_NAME$15]:DIR_NAME$15,[DISPLAY_NAME$Y]:DIR_NAME$Y,[DISPLAY_NAME$17]:DIR_NAME$17,[DISPLAY_NAME$N]:DIR_NAME$N,[DISPLAY_NAME$F]:DIR_NAME$F,[DISPLAY_NAME$G]:DIR_NAME$G,[DISPLAY_NAME$C]:DIR_NAME$C,[DISPLAY_NAME$E]:DIR_NAME$E,[DISPLAY_NAME$B]:DIR_NAME$B,[DISPLAY_NAME$I]:DIR_NAME$I,[DISPLAY_NAME$_]:DIR_NAME$_,[DISPLAY_NAME$R]:DIR_NAME$R,[DISPLAY_NAME$y]:DIR_NAME$y,[DISPLAY_NAME$x]:DIR_NAME$x,[DISPLAY_NAME$w]:DIR_NAME$w,[DISPLAY_NAME$v]:DIR_NAME$v,[DISPLAY_NAME$u]:DIR_NAME$u,[DISPLAY_NAME$t]:DIR_NAME$t,[DISPLAY_NAME$s]:DIR_NAME$s,[DISPLAY_NAME$r]:DIR_NAME$r,[DISPLAY_NAME$q]:DIR_NAME$q,[DISPLAY_NAME$p]:DIR_NAME$p,[DISPLAY_NAME$o]:DIR_NAME$o,[DISPLAY_NAME$n]:DIR_NAME$n,[DISPLAY_NAME$m]:DIR_NAME$m,[DISPLAY_NAME$l]:DIR_NAME$l,[DISPLAY_NAME$k]:DIR_NAME$k,[DISPLAY_NAME$j]:DIR_NAME$j,[DISPLAY_NAME$i]:DIR_NAME$i,[DISPLAY_NAME$h]:DIR_NAME$h,[DISPLAY_NAME$g]:DIR_NAME$g,[DISPLAY_NAME$f]:DIR_NAME$f,[DISPLAY_NAME$e]:DIR_NAME$e,[DISPLAY_NAME$d]:DIR_NAME$d,[DISPLAY_NAME$c]:DIR_NAME$c,[DISPLAY_NAME$b]:DIR_NAME$b,[DISPLAY_NAME$a]:DIR_NAME$a,[DISPLAY_NAME$9]:DIR_NAME$9,[DISPLAY_NAME$8]:DIR_NAME$8,[DISPLAY_NAME$7]:DIR_NAME$7,[DISPLAY_NAME$6]:DIR_NAME$6,[DISPLAY_NAME$5]:DIR_NAME$5,[DISPLAY_NAME$4]:DIR_NAME$4,[DISPLAY_NAME$3]:DIR_NAME$3,[DISPLAY_NAME$2]:DIR_NAME$2,[DISPLAY_NAME$1]:DIR_NAME$1,[DISPLAY_NAME]:DIR_NAME};
|
1091
1109
|
|
1092
|
-
const isDestIntgConfigTruthy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;const isDestIntgConfigFalsy=destIntgConfig=>!isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;/**
|
1093
|
-
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
1094
|
-
* @param intgOpts Integration options object
|
1095
|
-
* @param destinations Destinations array
|
1096
|
-
* @returns Destinations array filtered based on the integration options
|
1097
|
-
*/const filterDestinations=(intgOpts,destinations)=>{const allOptVal=intgOpts.All??true;return destinations.filter(dest=>{const destDisplayName=dest.displayName;let isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1098
|
-
|
1099
|
-
const READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
1100
|
-
const SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
1101
|
-
const READY_CHECK_INTERVAL_MS=100;// 100 milliseconds
|
1102
|
-
const DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
1103
|
-
|
1104
|
-
const DESTINATION_NOT_SUPPORTED_ERROR=destUserFriendlyId=>`Destination ${destUserFriendlyId} is not supported.`;const DESTINATION_SDK_LOAD_ERROR=(context,destUserFriendlyId)=>`${context}${LOG_CONTEXT_SEPARATOR}Failed to load script for destination ${destUserFriendlyId}.`;const DESTINATION_INIT_ERROR=destUserFriendlyId=>`Failed to initialize destination ${destUserFriendlyId}.`;const DESTINATION_INTEGRATIONS_DATA_ERROR=destUserFriendlyId=>`Failed to get integrations data for destination ${destUserFriendlyId}.`;const DESTINATION_READY_TIMEOUT_ERROR=(timeout,destUserFriendlyId)=>`A timeout of ${timeout} ms occurred while trying to check the ready status for "${destUserFriendlyId}" destination.`;
|
1105
|
-
|
1106
1110
|
/**
|
1107
1111
|
* Determines if the destination SDK code is evaluated
|
1108
1112
|
* @param destSDKIdentifier The name of the global globalThis object that contains the destination SDK
|
@@ -1116,7 +1120,7 @@
|
|
1116
1120
|
* @param curDestIntgConfig Current destinations integration config
|
1117
1121
|
* @param logger Logger object
|
1118
1122
|
* @returns Combined destinations integrations config
|
1119
|
-
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,dest.instance?.getDataForIntegrationsObject());}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1123
|
+
*/const getCumulativeIntegrationsConfig=(dest,curDestIntgConfig,errorHandler)=>{let integrationsConfig=curDestIntgConfig;if(isFunction(dest.instance?.getDataForIntegrationsObject)){try{integrationsConfig=mergeDeepRight(curDestIntgConfig,getSanitizedValue(dest.instance?.getDataForIntegrationsObject()));}catch(err){errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};const initializeDestination=(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger)=>{try{const initializedDestination=clone(dest);const destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(()=>{// Collect the integrations data for the hybrid mode destinations
|
1120
1124
|
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[...state.nativeDestinations.initializedDestinations.value,initializedDestination];}).catch(err=>{state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];// The error message is already formatted in the isDestinationReady function
|
1121
1125
|
logger?.error(err);});}catch(err){state.nativeDestinations.failedDestinations.value=[...state.nativeDestinations.failedDestinations.value,dest];errorHandler?.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INIT_ERROR(dest.userFriendlyId));}};
|
1122
1126
|
|
@@ -1142,10 +1146,6 @@
|
|
1142
1146
|
`${QUEUE_NAME$2}_${writeKey}` ,DEFAULT_TRANSFORMATION_QUEUE_OPTIONS,(item,done,attemptNumber,maxRetryAttempts)=>{const payload=createPayload(item.event,item.destinationIds,item.token);httpClient.getAsyncData({url:`${state.lifecycle.activeDataplaneUrl.value}/transform`,options:{method:'POST',data:getDMTDeliveryPayload(payload),sendRawData:true},isRawResponse:true,timeout:REQUEST_TIMEOUT_MS$2,callback:(result,details)=>{// null means item will not be requeued
|
1143
1147
|
const queueErrResp=isErrRetryable(details)?details:null;if(!queueErrResp||attemptNumber===maxRetryAttempts){sendTransformedEventToDestinations(state,pluginsManager,item.destinationIds,result,details?.xhr?.status,item.event,errorHandler,logger);}done(queueErrResp,result);}});},storeManager,MEMORY_STORAGE);return eventsQueue;},enqueue(state,eventsQueue,event,destinations){const destinationIds=destinations.map(d=>d.id);eventsQueue.addItem({event,destinationIds,token:state.session.authToken.value});}}});
|
1144
1148
|
|
1145
|
-
const METRICS_PAYLOAD_VERSION='1';
|
1146
|
-
|
1147
|
-
const FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';const ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
1148
|
-
|
1149
1149
|
// Errors from the below scripts are NOT allowed to reach Bugsnag
|
1150
1150
|
const SDK_FILE_NAME_PREFIXES=()=>['rsa'// Prefix for all the SDK scripts including plugins and module federated chunks
|
1151
1151
|
];const DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
|
@@ -1350,7 +1350,7 @@
|
|
1350
1350
|
// This will be helpful for debugging
|
1351
1351
|
globalThis.getIubendaUserDeniedPurposes=()=>state.consents.data.value.deniedConsentIds?.slice();// updateIubendaConsent callback function to update current consent purpose state
|
1352
1352
|
globalThis.updateIubendaConsent=iubendaConsentData=>{updateConsentStateFromData$1(state,iubendaConsentData);};},updateConsentsInfo(state,storeManager,logger){// retrieve consent data and update the state
|
1353
|
-
let iubendaConsentData;// From window
|
1353
|
+
let iubendaConsentData;// From window
|
1354
1354
|
if(!isUndefined(globalThis._iub.cs.consent.purposes)){iubendaConsentData=globalThis._iub.cs.consent.purposes;// From cookie
|
1355
1355
|
}else {iubendaConsentData=getIubendaConsentData(storeManager,logger);}updateConsentStateFromData$1(state,iubendaConsentData);},isDestinationConsented(state,destConfig,errorHandler,logger){if(!state.consents.initialized.value){return true;}const allowedConsentIds=state.consents.data.value.allowedConsentIds;const matchPredicate=consent=>allowedConsentIds.includes(consent);try{const{consentManagement}=destConfig;// If the destination does not have consent management config, events should be sent.
|
1356
1356
|
if(consentManagement){// Get the corresponding consents for the destination
|
@@ -450,7 +450,7 @@ const MANUAL_ERROR_IDENTIFIER='[MANUAL ERROR]';/**
|
|
450
450
|
* @returns Instance of Error with message prepended with issue
|
451
451
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
452
452
|
|
453
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
453
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.10';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
454
454
|
|
455
455
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
456
456
|
|
@@ -456,7 +456,7 @@
|
|
456
456
|
* @returns Instance of Error with message prepended with issue
|
457
457
|
*/const getMutatedError=(err,issue)=>{let finalError=err;if(!isTypeOfError(err)){finalError=new Error(`${issue}: ${stringifyWithoutCircular(err)}`);}else {finalError.message=`${issue}: ${err.message}`;}return finalError;};const dispatchErrorEvent=error=>{if(isTypeOfError(error)){error.stack=`${error.stack??''}\n${MANUAL_ERROR_IDENTIFIER}`;}globalThis.dispatchEvent(new ErrorEvent('error',{error}));};
|
458
458
|
|
459
|
-
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.
|
459
|
+
const APP_NAME='RudderLabs JavaScript SDK';const APP_VERSION='3.11.10';const APP_NAMESPACE='com.rudderlabs.javascript';const MODULE_TYPE='npm';const ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';const ADBLOCK_PAGE_NAME='ad-block page request';const ADBLOCK_PAGE_PATH='/ad-blocked';const GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';const CONSENT_TRACK_EVENT_NAME='Consent Management Interaction';
|
460
460
|
|
461
461
|
const QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';const QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';const QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';const QUERY_PARAM_USER_ID_KEY='ajs_uid';const QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
462
462
|
|