diff --git a/.size-limit.js b/.size-limit.js index 104764b57..a95e1f0dc 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -7,7 +7,7 @@ module.exports = [ name: 'Core - CDN', path: 'dist/legacy/rudder-analytics.min.js', gzip: true, - limit: '37.2 kB', + limit: '37.5 kB', }, { name: 'All Integrations - CDN', @@ -19,7 +19,7 @@ module.exports = [ name: 'Core - NPM', path: 'dist/npm-lib/index.js', gzip: true, - limit: '37.1 kB', + limit: '37.5 kB', }, { name: 'Service Worker - NPM', diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ebcbebd8..2985a1986 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.39.0](https://github.com/rudderlabs/rudder-sdk-js/compare/v2.38.1...v2.39.0) (2023-08-01) + + +### Features + +* enhancement of device mode transformation ([#1169](https://github.com/rudderlabs/rudder-sdk-js/issues/1169)) ([7b5aea1](https://github.com/rudderlabs/rudder-sdk-js/commit/7b5aea1eea91511e4b68ad6fe895b638f4c4413a)) + + +### Bug Fixes + +* resolve issue with error reporting global key in IE11 for npm package ([#1241](https://github.com/rudderlabs/rudder-sdk-js/issues/1241)) ([1c45585](https://github.com/rudderlabs/rudder-sdk-js/commit/1c4558596c6fabaf7aa41e2824b4405a4dfd170c)) + ### [2.38.1](https://github.com/rudderlabs/rudder-sdk-js/compare/v2.38.0...v2.38.1) (2023-07-25) diff --git a/__tests__/transformationHandler.test.js b/__tests__/transformationHandler.test.js index f37b12cd7..ed60c8387 100644 --- a/__tests__/transformationHandler.test.js +++ b/__tests__/transformationHandler.test.js @@ -14,7 +14,6 @@ import { } from '../__mocks__/fixtures'; describe('Test suite for device mode transformation feature', () => { - beforeAll(() => { server.listen(); }); @@ -24,9 +23,9 @@ describe('Test suite for device mode transformation feature', () => { }); let payload; - + const destinationIds = ['id1', 'id2', 'id3']; beforeEach(() => { - payload = createPayload(samplePageEvent, 'sample-auth-token'); + payload = createPayload(samplePageEvent, destinationIds, 'sample-auth-token'); }); it('Validate payload format', () => { @@ -37,6 +36,7 @@ describe('Test suite for device mode transformation feature', () => { batch: [ { orderNo: expect.any(Number), + destinationIds, event: samplePageEvent.message, }, ], @@ -48,7 +48,6 @@ describe('Test suite for device mode transformation feature', () => { await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { - expect(response.transformationServerAccess).toEqual(true); expect(Array.isArray(response.transformedPayload)).toEqual(true); const destObj = response.transformedPayload[0]; @@ -63,33 +62,12 @@ describe('Test suite for device mode transformation feature', () => { }); }); - it('Transformation server response is in wrong format in case of successful transformation', async () => { - DeviceModeTransformations.init(dummyWriteKey, `${dummyDataplaneHost}/invalidResponse`); - - await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) - .then((response) => { - console.log(response); - expect('to').toBe('fail'); - }) - .catch((e) => { - expect(typeof e).toBe('string'); - }); - }); - it('Validate whether the SDK is sending the orginal event in case server returns 404', async () => { DeviceModeTransformations.init(dummyWriteKey, `${dummyDataplaneHost}/accessDenied`); await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { - expect(response.transformationServerAccess).toEqual(false); - expect(response.transformedPayload).toEqual(payload.batch); - - const destObj = response.transformedPayload[0]; - - expect(Object.prototype.hasOwnProperty.call(destObj, 'event')).toBe(true); - expect(Object.prototype.hasOwnProperty.call(destObj, 'orderNo')).toBe(true); - expect(Object.prototype.hasOwnProperty.call(destObj, 'id')).toBe(false); - expect(Object.prototype.hasOwnProperty.call(destObj, 'payload')).toEqual(false); + expect(response.status).toEqual(404); }) .catch((e) => { console.log(e); @@ -101,10 +79,8 @@ describe('Test suite for device mode transformation feature', () => { let counter = 0; server.use( rest.post(`${dummyDataplaneHost}/serverDown/transform`, (req, res, ctx) => { - counter +=1; - return res( - ctx.status(500) - ) + counter += 1; + return res(ctx.status(500)); }), ); @@ -113,7 +89,9 @@ describe('Test suite for device mode transformation feature', () => { await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { console.log(response); - expect('to').toBe('fail'); + expect(counter).toEqual(retryCount + 1); // retryCount+ first attempt + expect(response.errorMessage).toBe('Retries exhausted'); + expect(response.status).toBe(500); }) .catch((e) => { expect(typeof e).toBe('string'); @@ -121,22 +99,20 @@ describe('Test suite for device mode transformation feature', () => { }); }); - it('Transformation server returning response for partial success,SDK silently drops the unsuccessful events and procced', async () => { + it('Should not filter transformed events that are not 200', async () => { DeviceModeTransformations.init(dummyWriteKey, `${dummyDataplaneHost}/partialSuccess`); await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { let totalTransformedEvents = 0; - let successfulTransformedEvents = 0; + let totalTransformedEventsInResponse = 0; samplePayloadPartialSuccess.transformedBatch.forEach((dest) => { totalTransformedEvents += dest.payload.length; }); response.transformedPayload.forEach((dest) => { - dest.payload.forEach((tEvent) => { - if (tEvent.status === '200') successfulTransformedEvents++; - }); + totalTransformedEventsInResponse += dest.payload.length; }); - expect(successfulTransformedEvents).toBeLessThan(totalTransformedEvents); + expect(totalTransformedEventsInResponse).toEqual(totalTransformedEvents); }) .catch((e) => { console.log(e); @@ -150,7 +126,8 @@ describe('Test suite for device mode transformation feature', () => { await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { console.log(response); - expect('to').toBe('fail'); + expect(typeof response.errorMessage).toBe('string'); + expect(response.status).toBe(400); }) .catch((e) => { expect(typeof e).toBe('string'); @@ -159,17 +136,14 @@ describe('Test suite for device mode transformation feature', () => { }); it('Transformation server returns success after intermediate retry', async () => { - let counter = 0; server.use( rest.post(`${dummyDataplaneHost}/success/transform`, (req, res, ctx) => { - if(counter === 0){ - counter +=1; - return res( - ctx.status(500) - ) + if (counter === 0) { + counter += 1; + return res(ctx.status(500)); } - counter +=1; + counter += 1; return res(ctx.status(200), ctx.json(samplePayloadSuccess)); }), ); @@ -179,7 +153,6 @@ describe('Test suite for device mode transformation feature', () => { await DeviceModeTransformations.sendEventForTransformation(payload, retryCount) .then((response) => { expect(counter).toBeGreaterThan(1); - expect(response.transformationServerAccess).toEqual(true); expect(Array.isArray(response.transformedPayload)).toEqual(true); const destObj = response.transformedPayload[0]; diff --git a/package.json b/package.json index 3db7b6299..287064037 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-analytics", - "version": "2.38.1", + "version": "2.39.0", "description": "", "main": "./dist/browser.min.js", "scripts": { diff --git a/packages/npm/package.json b/packages/npm/package.json index 31b4ef49f..5634a97a8 100644 --- a/packages/npm/package.json +++ b/packages/npm/package.json @@ -1,6 +1,6 @@ { "name": "rudder-sdk-js", - "version": "2.38.1", + "version": "2.39.0", "description": "RudderStack Javascript SDK", "main": "index.js", "module": "index.es.js", diff --git a/sanity-suite/src/testBook/ResultAssertions.js b/sanity-suite/src/testBook/ResultAssertions.js index 5c08ce561..bd7e08533 100644 --- a/sanity-suite/src/testBook/ResultAssertions.js +++ b/sanity-suite/src/testBook/ResultAssertions.js @@ -10,18 +10,20 @@ class ResultsAssertions { const resultData = JSON.parse(result); const expectedResultData = JSON.parse(expectedResult); - ignoredProperties.forEach((property) => { - if ( - typeof objectPath.get(resultData, property.key) === property.type || - property.optional === true - ) { - objectPath.set( - resultData, - property.key, - objectPath.get(expectedResultData, property.key), - ); - } - }); + if (resultData.message) { + ignoredProperties.forEach((property) => { + if ( + typeof objectPath.get(resultData, property.key) === property.type || + property.optional === true + ) { + objectPath.set( + resultData, + property.key, + objectPath.get(expectedResultData, property.key), + ); + } + }); + } return JSON.stringify(resultData, undefined, 2); } catch (e) { diff --git a/sonar-project.properties b/sonar-project.properties index c30e52c25..e08636f69 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,7 +6,7 @@ sonar.qualitygate.wait=false sonar.projectKey=rudderlabs_rudder-sdk-js sonar.organization=rudderlabs sonar.projectName=rudder-sdk-js -sonar.projectVersion=2.38.1 +sonar.projectVersion=2.39.0 # Meta-data for the project sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js diff --git a/src/core/analytics.js b/src/core/analytics.js index 1d792c568..e91037b48 100644 --- a/src/core/analytics.js +++ b/src/core/analytics.js @@ -63,6 +63,7 @@ import { getIntegrationsCDNPath } from '../utils/cdnPaths'; import { ErrorReportingService } from '../features/core/metrics/errorReporting/ErrorReportingService'; import { getUserAgentClientHint } from '../utils/clientHint'; import { DeviceModeTransformations } from '../features/core/deviceModeTransformation/transformationHandler'; +import { isNonEmptyObject } from '../utils/ObjectUtils'; /** * class responsible for handling core @@ -256,7 +257,10 @@ class Analytics { name: destination.destinationDefinition.name, config: destination.config, destinationInfo: { - areTransformationsConnected: destination.areTransformationsConnected || false, + shouldApplyDeviceModeTransformation: + destination.shouldApplyDeviceModeTransformation || false, + propagateEventsUntransformedOnError: + destination.propagateEventsUntransformedOnError || false, destinationId: destination.id, }, }); @@ -396,57 +400,100 @@ class Analytics { } } + /** + * A function that gets the transformed event and + * depending on the response either send the transformed/untransformed event to destination or just log error. + * @param {Array} destWithTransformation List of device mode destination that has transformation connected + * @param {Object} rudderElement Rudder event + * @param {string} methodName Type of event page/track/identify etc. + */ sendTransformedDataToDestination(destWithTransformation, rudderElement, methodName) { try { // convert integrations object to server identified names, kind of hack now! transformToServerNames(rudderElement.message.integrations); - + const destinationIds = destWithTransformation.map((e) => e.destinationId); // Process Transformation this.transformationHandler.enqueue( rudderElement, - ({ transformedPayload, transformationServerAccess }) => { - if (transformedPayload) { - destWithTransformation.forEach((intg) => { - try { - let transformedEvents = []; - if (transformationServerAccess) { - // filter the transformed event for that destination + destinationIds, + ({ status, transformedPayload, errorMessage }) => { + destWithTransformation.forEach((intg) => { + try { + switch (status) { + // The transformation request is successful + case 200: { + // filter destination specific transformed payload const destTransformedResult = transformedPayload.find( (e) => e.id === intg.destinationId, ); - if (!destTransformedResult) { - logger.error( - `[DMT]::Transformed data for destination "${intg.name}" was not sent from the server`, - ); - return; - } - + const eventsToSend = []; destTransformedResult?.payload.forEach((tEvent) => { + // Transformation successful + // event level status is 200 if (tEvent.status === '200') { - transformedEvents.push(tEvent); + // push transformed event to the queue + eventsToSend.push(tEvent); } else { - logger.error( - `[DMT]::Event transformation unsuccessful for destination "${intg.name}". Dropping the event. Status: "${tEvent.status}". Error Message: "${tEvent.error}"`, - ); + const msgPrefix = `[DMT]:: Event transformation unsuccessful for destination "${intg.name}". Reason: `; + + let reason = 'Unknown'; + if (tEvent.status === '410') { + reason = 'Transformation is not available'; + } + + let action = 'Dropping the event'; + let logMethod = logger.error; + if (intg.propagateEventsUntransformedOnError === true) { + action = 'Sending untransformed event to the destination'; + logMethod = logger.warn; + eventsToSend.push({ event: rudderElement.message }); + } + + const logMsg = `${msgPrefix} ${reason}. ${action}.`; + logMethod(logMsg); + } + }); + // send events to destination + eventsToSend?.forEach((tEvent) => { + // send only if the event is not null/undefined/empty object + if (isNonEmptyObject(tEvent.event)) { + this.sendDataToDestination(intg, { message: tEvent.event }, methodName); } }); - } else { - transformedEvents = transformedPayload; + break; } - // send transformed event to destination - transformedEvents?.forEach((tEvent) => { - if (tEvent.event) { - this.sendDataToDestination(intg, { message: tEvent.event }, methodName); + // Transformation server access denied + case 404: { + logger.warn( + `[DMT]:: Transformation server access is denied. The configuration data seems to be out of sync. Sending untransformed event to the destination.`, + ); + // send untransformed event to destination + this.sendDataToDestination(intg, rudderElement, methodName); + break; + } + // For any other cases + default: { + if (intg.propagateEventsUntransformedOnError === true) { + logger.warn( + `[DMT]::[Destination: ${intg.name}] :: Transformation request failed with status: ${status} ${errorMessage}. Sending untransformed event.`, + ); + // send untransformed event to destination + this.sendDataToDestination(intg, rudderElement, methodName); + } else { + logger.error( + `[DMT]::[Destination: ${intg.name}] :: Transformation request failed with status: ${status} ${errorMessage}. Dropping the event.`, + ); } - }); - } catch (e) { - if (e instanceof Error) { - e.message = `[DMT]::[Destination:${intg.name}]:: ${e.message}`; + break; } - handleError(e); } - }); - } + } catch (e) { + if (e instanceof Error) { + e.message = `[DMT]::[Destination:${intg.name}]:: ${e.message}`; + } + handleError(e); + } + }); }, ); } catch (e) { @@ -474,7 +521,7 @@ class Analytics { // Block the event if it is blacklisted for the device-mode destination if (sendEvent) { - if (intg.areTransformationsConnected) { + if (intg.shouldApplyDeviceModeTransformation) { destWithTransformation.push(intg); } else { destWithoutTransformation.push(intg); diff --git a/src/features/core/deviceModeTransformation/transformationHandler.js b/src/features/core/deviceModeTransformation/transformationHandler.js index db65564e5..afc88af99 100644 --- a/src/features/core/deviceModeTransformation/transformationHandler.js +++ b/src/features/core/deviceModeTransformation/transformationHandler.js @@ -29,9 +29,10 @@ class TransformationsHandler { } // Enqueue the events and callbacks - enqueue(event, cb) { + enqueue(event, destinationIds, cb) { this.queue.push({ event, + destinationIds, cb, }); } @@ -61,67 +62,67 @@ class TransformationsHandler { const { status } = xhr; let { response } = xhr; - if (status === 200) { - if (response && typeof response === 'string') { + switch (status) { + case 200: { response = JSON.parse(response); - } else { - reject(`[Transformation]:: Transformation failed. Invalid response from server.`); + /** + * Sample Response format: + * { + "transformedBatch" :[ + { + "id": "destination-id", + "payload": [ + { + "orderNo":1, + "status": "200", + "event": { + "message": { ...} + }] + }] + } + */ + resolve({ + status, + transformedPayload: response.transformedBatch, + }); return; } - /** - * Sample Response format: - * { - "transformedBatch" :[ - { - "id": "destination-id", - "payload": [ - { - "orderNo":1, - "status": "200", - "event": { - "message": { ...} - }] - }] - } - */ - resolve({ - transformedPayload: response.transformedBatch, - transformationServerAccess: true, - }); - return; - } - if (status === 400) { - const errorMessage = response - ? `[Transformation]:: ${response}` - : `[Transformation]:: Invalid request payload`; - reject(errorMessage); - return; - } - if (status === 404) { - resolve({ - transformedPayload: payload.batch, - transformationServerAccess: false, - }); - return; - } - - // If the request is not successful - // one or more transformation is unsuccessfull - // retry till the retryAttempt is exhausted - if (retryAttempt > 0) { - const newRetryAttempt = retryAttempt - 1; - setTimeout( - () => - this.sendEventForTransformation(payload, newRetryAttempt) - .then(resolve) - .catch(reject), - RETRY_INTERVAL * backoffFactor ** (this.retryAttempt - newRetryAttempt), - ); - } else { - // Even after all the retries event transformation - // is not successful, ignore the event - reject(`[Transformation]:: Transformation failed with status ${status}`); - return; + case 400: { + const errorMessage = response ? `${response}` : `Invalid request payload`; + resolve({ + status, + errorMessage, + }); + return; + } + case 404: { + resolve({ + status, + }); + return; + } + default: { + // If the request is not successful + // retry till the retryAttempt is exhausted + if (retryAttempt > 0) { + const newRetryAttempt = retryAttempt - 1; + setTimeout( + () => + this.sendEventForTransformation(payload, newRetryAttempt) + .then(resolve) + .catch(reject), + RETRY_INTERVAL * backoffFactor ** (this.retryAttempt - newRetryAttempt), + ); + } else { + // Even after all the retries event transformation + // is not successful, return the response with a flag retryExhausted + resolve({ + status, + errorMessage: 'Retries exhausted', + }); + return; + } + } } } catch (err) { reject(err); @@ -149,7 +150,7 @@ class TransformationsHandler { process() { this.isTransformationProcessing = true; const firstElement = this.queue.shift(); - const payload = createPayload(firstElement.event, this.authToken); + const payload = createPayload(firstElement.event, firstElement.destinationIds, this.authToken); // Send event for transformation with payload, writekey and retryAttempt this.sendEventForTransformation(payload, this.retryAttempt) @@ -165,8 +166,8 @@ class TransformationsHandler { handleError(err.message); } this.isTransformationProcessing = false; - // send null as response in case of error or retry fail - firstElement.cb({ transformedPayload: null }); + // send only status as response in case of unhandled error occurs + firstElement.cb({ status: 0 }); this.checkQueueLengthAndProcess(); }); } diff --git a/src/features/core/deviceModeTransformation/util.js b/src/features/core/deviceModeTransformation/util.js index 3176a6588..21ef52f7e 100644 --- a/src/features/core/deviceModeTransformation/util.js +++ b/src/features/core/deviceModeTransformation/util.js @@ -3,15 +3,16 @@ * a batch payload that will be sent to transformation server * */ -const createPayload = (event, token) => { +const createPayload = (event, destinationIds, token) => { const orderNo = Date.now(); const payload = { metadata: { - "Custom-Authorization": token + 'Custom-Authorization': token, }, batch: [ { orderNo, + destinationIds, event: event.message, }, ], diff --git a/src/integrations/AdobeAnalytics/browser.js b/src/integrations/AdobeAnalytics/browser.js index efd6909a2..9fafe5265 100644 --- a/src/integrations/AdobeAnalytics/browser.js +++ b/src/integrations/AdobeAnalytics/browser.js @@ -31,9 +31,11 @@ class AdobeAnalytics { this.proxyHeartbeatUrl = config.proxyHeartbeatUrl; this.pageName = ''; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); utils.setConfig(config); } diff --git a/src/integrations/Adroll/browser.js b/src/integrations/Adroll/browser.js index 64e4edfaa..2e1ab4ef2 100644 --- a/src/integrations/Adroll/browser.js +++ b/src/integrations/Adroll/browser.js @@ -21,9 +21,11 @@ class Adroll { window.adroll_adv_id = this.advId; window.adroll_pix_id = this.pixId; this.eventsMap = config.eventsMap || []; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Amplitude/browser.js b/src/integrations/Amplitude/browser.js index 6757f39f7..95fdec96d 100644 --- a/src/integrations/Amplitude/browser.js +++ b/src/integrations/Amplitude/browser.js @@ -30,12 +30,11 @@ class Amplitude { this.traitsToIncrement = []; this.trackProductsOnce = config.trackProductsOnce || false; this.versionName = config.versionName; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); if (config.traitsToSetOnce && config.traitsToSetOnce.length > 0) { config.traitsToSetOnce.forEach((element) => { diff --git a/src/integrations/Appcues/browser.js b/src/integrations/Appcues/browser.js index 70b57d122..bd6f20b30 100644 --- a/src/integrations/Appcues/browser.js +++ b/src/integrations/Appcues/browser.js @@ -12,9 +12,11 @@ class Appcues { this.accountId = config.accountId; this.apiKey = config.apiKey; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); // this.sendToAllDestinations = config.sendToAll; } diff --git a/src/integrations/Axeptio/browser.js b/src/integrations/Axeptio/browser.js index 183fbcc0e..7f1482a63 100644 --- a/src/integrations/Axeptio/browser.js +++ b/src/integrations/Axeptio/browser.js @@ -16,9 +16,11 @@ class Axeptio { this.name = NAME; this.clientId = config.clientId; this.toggleToActivateCallback = config.toggleToActivateCallback; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/BingAds/browser.js b/src/integrations/BingAds/browser.js index 3c1d0a6a6..284db5f2c 100644 --- a/src/integrations/BingAds/browser.js +++ b/src/integrations/BingAds/browser.js @@ -13,8 +13,11 @@ class BingAds { this.analytics = analytics; this.tagID = config.tagID; this.name = NAME; - this.areTransformationsConnected = destinationInfo?.areTransformationsConnected; - this.destinationId = destinationInfo?.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); this.uniqueId = `bing${this.tagID}`; } diff --git a/src/integrations/Braze/browser.js b/src/integrations/Braze/browser.js index 9cefa63a9..23ad00469 100644 --- a/src/integrations/Braze/browser.js +++ b/src/integrations/Braze/browser.js @@ -38,7 +38,8 @@ class Braze { this.name = NAME; this.supportDedup = config.supportDedup || false; ({ - areTransformationsConnected: this.areTransformationsConnected, + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, destinationId: this.destinationId, } = destinationInfo ?? {}); diff --git a/src/integrations/Bugsnag/browser.js b/src/integrations/Bugsnag/browser.js index 3b3ba4b07..6e4d85b63 100644 --- a/src/integrations/Bugsnag/browser.js +++ b/src/integrations/Bugsnag/browser.js @@ -13,9 +13,11 @@ class Bugsnag { this.apiKey = config.apiKey; this.name = NAME; this.setIntervalHandler = undefined; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Chartbeat/browser.js b/src/integrations/Chartbeat/browser.js index e3d3c70a3..73103c494 100644 --- a/src/integrations/Chartbeat/browser.js +++ b/src/integrations/Chartbeat/browser.js @@ -25,9 +25,11 @@ class Chartbeat { this.failed = false; this.isFirstPageCallMade = false; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Clevertap/browser.js b/src/integrations/Clevertap/browser.js index a2a860909..31b9e7b2a 100644 --- a/src/integrations/Clevertap/browser.js +++ b/src/integrations/Clevertap/browser.js @@ -41,9 +41,11 @@ class Clevertap { 'married', 'customerType', ]; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Comscore/browser.js b/src/integrations/Comscore/browser.js index f30d2311e..f9daf4221 100644 --- a/src/integrations/Comscore/browser.js +++ b/src/integrations/Comscore/browser.js @@ -20,9 +20,11 @@ class Comscore { this.comScoreParams = {}; this.replayEvents = []; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/ConvertFlow/browser.js b/src/integrations/ConvertFlow/browser.js index bc506eb48..c84e78c98 100644 --- a/src/integrations/ConvertFlow/browser.js +++ b/src/integrations/ConvertFlow/browser.js @@ -16,9 +16,11 @@ class ConvertFlow { this.eventsList = config.eventsList; this.eventsMappping = config.eventsMappping; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Criteo/browser.js b/src/integrations/Criteo/browser.js index 5ff85208c..6629db525 100644 --- a/src/integrations/Criteo/browser.js +++ b/src/integrations/Criteo/browser.js @@ -31,9 +31,11 @@ class Criteo { this.fieldMapping = config.fieldMapping; this.eventsToStandard = config.eventsToStandard; this.OPERATOR_LIST = ['eq', 'gt', 'lt', 'ge', 'le', 'in']; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/CustomerIO/browser.js b/src/integrations/CustomerIO/browser.js index fc7f9181b..0e3d3841f 100644 --- a/src/integrations/CustomerIO/browser.js +++ b/src/integrations/CustomerIO/browser.js @@ -12,9 +12,11 @@ class CustomerIO { this.siteID = config.siteID; this.apiKey = config.apiKey; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/DCMFloodlight/browser.js b/src/integrations/DCMFloodlight/browser.js index f0dcb99f4..7e91cffcb 100644 --- a/src/integrations/DCMFloodlight/browser.js +++ b/src/integrations/DCMFloodlight/browser.js @@ -29,9 +29,11 @@ class DCMFloodlight { this.googleNetworkId = config.googleNetworkId; this.tagFormat = config.tagFormat || GTAG; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } /** diff --git a/src/integrations/Drip/browser.js b/src/integrations/Drip/browser.js index 97908ef4e..7af9b98e8 100644 --- a/src/integrations/Drip/browser.js +++ b/src/integrations/Drip/browser.js @@ -31,9 +31,11 @@ class Drip { 'eu_consent_message', 'euConsentMessage', ]; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Engage/browser.js b/src/integrations/Engage/browser.js index f410e3e89..4d11c5246 100644 --- a/src/integrations/Engage/browser.js +++ b/src/integrations/Engage/browser.js @@ -16,9 +16,11 @@ class Engage { this.api_secret = config.privateKey; this.name = NAME; this.listsIds = config.listsIds; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/FacebookPixel/browser.js b/src/integrations/FacebookPixel/browser.js index 8c8a5e66c..6307fd54a 100644 --- a/src/integrations/FacebookPixel/browser.js +++ b/src/integrations/FacebookPixel/browser.js @@ -31,9 +31,11 @@ class FacebookPixel { this.useUpdatedMapping = config.useUpdatedMapping; this.name = NAME; this.analytics = analytics; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } // START-NO-SONAR-SCAN diff --git a/src/integrations/Fullstory/browser.js b/src/integrations/Fullstory/browser.js index 2808af323..a555cc94b 100644 --- a/src/integrations/Fullstory/browser.js +++ b/src/integrations/Fullstory/browser.js @@ -15,9 +15,11 @@ class Fullstory { this.fs_host = config.fs_host || 'fullstory.com'; this.name = NAME; this.analytics = analytics; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } static getFSProperties(properties) { diff --git a/src/integrations/GA/browser.js b/src/integrations/GA/browser.js index d299afa69..e9c1e2a24 100644 --- a/src/integrations/GA/browser.js +++ b/src/integrations/GA/browser.js @@ -44,8 +44,11 @@ export default class GA { 'product viewed', 'product removed', ]; - this.areTransformationsConnected = destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } initializeGlobalObject() { diff --git a/src/integrations/GA/index.test.js b/src/integrations/GA/index.test.js index 25d5cc522..5d3070e04 100644 --- a/src/integrations/GA/index.test.js +++ b/src/integrations/GA/index.test.js @@ -7,14 +7,22 @@ afterAll(() => { jest.restoreAllMocks(); }); -const destinationInfo = { areTransformationsConnected: false, destinationId: 'sample-destination-id' }; +const destinationInfo = { + shouldApplyDeviceModeTransformation: false, + propagateEventsUntransformedOnError: false, + destinationId: 'sample-destination-id', +}; GA.prototype.loadScript = jest.fn(); describe('GA init tests', () => { let googleAnalytics; beforeEach(() => { - googleAnalytics = new GA({ trackingID: 'UA-143161493-8' }, { loadIntegration: true }, destinationInfo); + googleAnalytics = new GA( + { trackingID: 'UA-143161493-8' }, + { loadIntegration: true }, + destinationInfo, + ); googleAnalytics.init(); }); @@ -63,7 +71,7 @@ describe('GA init tests', () => { ], }, { loadIntegration: true }, - destinationInfo + destinationInfo, ); googleAnalytics.init(); window.ga = jest.fn(); @@ -113,7 +121,7 @@ describe('GA init tests', () => { contentGroupings: [], }, { loadIntegration: true }, - destinationInfo + destinationInfo, ); googleAnalytics.init(); window.ga = jest.fn(); diff --git a/src/integrations/GA360/browser.js b/src/integrations/GA360/browser.js index c6a65c484..06151c0ac 100644 --- a/src/integrations/GA360/browser.js +++ b/src/integrations/GA360/browser.js @@ -18,9 +18,11 @@ class GA360 extends GA { super(config, analytics, destinationInfo); this.analytics = analytics; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/GA4/browser.js b/src/integrations/GA4/browser.js index b43ec4bf8..290600a0b 100644 --- a/src/integrations/GA4/browser.js +++ b/src/integrations/GA4/browser.js @@ -31,10 +31,12 @@ export default class GA4 { this.capturePageView = config.capturePageView || 'rs'; this.isHybridModeEnabled = config.connectionMode === 'hybrid'; this.extendPageViewParams = config.extendPageViewParams || false; - this.destinationId = destinationInfo && destinationInfo.destinationId; this.overrideClientAndSessionId = config.overrideClientAndSessionId || false; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript(measurementId) { diff --git a/src/integrations/GoogleAds/browser.js b/src/integrations/GoogleAds/browser.js index 934e52783..0a69bca54 100644 --- a/src/integrations/GoogleAds/browser.js +++ b/src/integrations/GoogleAds/browser.js @@ -39,9 +39,11 @@ class GoogleAds { this.dynamicRemarketing = config.dynamicRemarketing; this.allowEnhancedConversions = config.allowEnhancedConversions || false; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/GoogleOptimize/browser.js b/src/integrations/GoogleOptimize/browser.js index 3f95a81f3..44ad640f5 100644 --- a/src/integrations/GoogleOptimize/browser.js +++ b/src/integrations/GoogleOptimize/browser.js @@ -16,9 +16,11 @@ class GoogleOptimize { this.containerId = config.containerId; this.async = config.async; this.aflicker = config.aflicker; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/GoogleTagManager/browser.js b/src/integrations/GoogleTagManager/browser.js index dadfcc92e..2308ac610 100644 --- a/src/integrations/GoogleTagManager/browser.js +++ b/src/integrations/GoogleTagManager/browser.js @@ -12,9 +12,11 @@ class GoogleTagManager { this.containerID = config.containerID; this.name = NAME; this.serverUrl = config.serverUrl; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Heap/browser.js b/src/integrations/Heap/browser.js index c58aaaeaa..7f60edb66 100644 --- a/src/integrations/Heap/browser.js +++ b/src/integrations/Heap/browser.js @@ -13,9 +13,11 @@ class Heap { this.analytics = analytics; this.appId = config.appId; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } /** diff --git a/src/integrations/Hotjar/browser.js b/src/integrations/Hotjar/browser.js index 44ccc7b64..7964b2ab5 100644 --- a/src/integrations/Hotjar/browser.js +++ b/src/integrations/Hotjar/browser.js @@ -13,9 +13,11 @@ class Hotjar { this.siteId = config.siteID; this.name = NAME; this._ready = false; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/HubSpot/browser.js b/src/integrations/HubSpot/browser.js index e2f9b41ee..26d2b8b4e 100644 --- a/src/integrations/HubSpot/browser.js +++ b/src/integrations/HubSpot/browser.js @@ -11,9 +11,11 @@ class HubSpot { this.analytics = analytics; this.hubId = config.hubID; // 6405167 this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/INTERCOM/browser.js b/src/integrations/INTERCOM/browser.js index 1f33ab858..84d583449 100644 --- a/src/integrations/INTERCOM/browser.js +++ b/src/integrations/INTERCOM/browser.js @@ -15,9 +15,11 @@ class INTERCOM { this.API_KEY = config.apiKey; this.APP_ID = config.appId; this.MOBILE_APP_ID = config.mobileAppId; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Iterable/browser.js b/src/integrations/Iterable/browser.js index 5d3e482bc..9da92e41f 100644 --- a/src/integrations/Iterable/browser.js +++ b/src/integrations/Iterable/browser.js @@ -46,9 +46,11 @@ class Iterable { this.isRequiredToDismissMessage = config.isRequiredToDismissMessage; this.closeButtonPosition = config.closeButtonPosition; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/June/browser.js b/src/integrations/June/browser.js index 807087714..6b34db957 100644 --- a/src/integrations/June/browser.js +++ b/src/integrations/June/browser.js @@ -14,9 +14,11 @@ class June { this.analytics = analytics; this.name = NAME; this.apiKey = config.apiKey; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Keen/browser.js b/src/integrations/Keen/browser.js index db8afe675..44df7aa39 100644 --- a/src/integrations/Keen/browser.js +++ b/src/integrations/Keen/browser.js @@ -16,9 +16,11 @@ class Keen { this.referrerAddon = config.referrerAddon; this.client = null; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Kissmetrics/browser.js b/src/integrations/Kissmetrics/browser.js index 1a782199c..85fea1ec9 100644 --- a/src/integrations/Kissmetrics/browser.js +++ b/src/integrations/Kissmetrics/browser.js @@ -15,9 +15,11 @@ class Kissmetrics { this.apiKey = config.apiKey; this.prefixProperties = config.prefixProperties; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Klaviyo/browser.js b/src/integrations/Klaviyo/browser.js index 2662df37c..6e49efd64 100644 --- a/src/integrations/Klaviyo/browser.js +++ b/src/integrations/Klaviyo/browser.js @@ -73,9 +73,11 @@ class Klaviyo { 'product added': 'Added to Cart', 'checkout started': 'Started Checkout', }; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/LaunchDarkly/browser.js b/src/integrations/LaunchDarkly/browser.js index 962bcb9b4..2fa8eae52 100644 --- a/src/integrations/LaunchDarkly/browser.js +++ b/src/integrations/LaunchDarkly/browser.js @@ -14,9 +14,11 @@ class LaunchDarkly { this.name = NAME; this.clientSideId = config.clientSideId; this.anonymousUsersSharedKey = config.anonymousUsersSharedKey; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Lemnisk/browser.js b/src/integrations/Lemnisk/browser.js index a8a2a7cf5..931f09ada 100644 --- a/src/integrations/Lemnisk/browser.js +++ b/src/integrations/Lemnisk/browser.js @@ -16,9 +16,11 @@ class Lemnisk { this.accountId = config.accountId; this.sdkWriteKey = config.sdkWriteKey; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/LinkedInInsightTag/browser.js b/src/integrations/LinkedInInsightTag/browser.js index 8e16e9b5c..4e1e16415 100644 --- a/src/integrations/LinkedInInsightTag/browser.js +++ b/src/integrations/LinkedInInsightTag/browser.js @@ -13,9 +13,11 @@ class LinkedInInsightTag { this.name = NAME; this.partnerId = config.partnerId; this.eventToConversionIdMap = config.eventToConversionIdMap; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/LiveChat/browser.js b/src/integrations/LiveChat/browser.js index 4338acb5b..4d7570e2e 100644 --- a/src/integrations/LiveChat/browser.js +++ b/src/integrations/LiveChat/browser.js @@ -20,9 +20,11 @@ class LiveChat { this.eventsToStandard = config.eventsToStandard; this.updateEventNames = config.updateEventNames; this.eventsList = config.eventsList; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Lotame/browser.js b/src/integrations/Lotame/browser.js index bf4aa86c4..014d9285c 100644 --- a/src/integrations/Lotame/browser.js +++ b/src/integrations/Lotame/browser.js @@ -21,8 +21,11 @@ class Lotame { const { value } = mapping; this.mappings[key] = value; }); - this.areTransformationsConnected = destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Lytics/browser.js b/src/integrations/Lytics/browser.js index aa7c2cb12..d7c41cb61 100644 --- a/src/integrations/Lytics/browser.js +++ b/src/integrations/Lytics/browser.js @@ -34,8 +34,11 @@ class Lytics { this.name = NAME; this.forFirstName = ['firstname', 'firstName']; this.forLastName = ['lastname', 'lastName']; - this.areTransformationsConnected = destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadLyticsScript() { diff --git a/src/integrations/Matomo/browser.js b/src/integrations/Matomo/browser.js index a73d0b8bf..03d133b2d 100644 --- a/src/integrations/Matomo/browser.js +++ b/src/integrations/Matomo/browser.js @@ -48,9 +48,11 @@ class Matomo { CLEAR_ECOMMERCE_CART: 'CLEAR_ECOMMERCE_CART', TRACK_ECOMMERCE_CART_UPDATE: 'TRACK_ECOMMERCE_CART_UPDATE', }; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/MicrosoftClarity/browser.js b/src/integrations/MicrosoftClarity/browser.js index a25172614..0843720db 100644 --- a/src/integrations/MicrosoftClarity/browser.js +++ b/src/integrations/MicrosoftClarity/browser.js @@ -13,9 +13,11 @@ class MicrosoftClarity { this.name = NAME; this.projectId = config.projectId; this.cookieConsent = config.cookieConsent; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Mixpanel/browser.js b/src/integrations/Mixpanel/browser.js index 025787be9..8f1a484d8 100644 --- a/src/integrations/Mixpanel/browser.js +++ b/src/integrations/Mixpanel/browser.js @@ -76,9 +76,11 @@ class Mixpanel { username: '$username', phone: '$phone', }; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/MoEngage/browser.js b/src/integrations/MoEngage/browser.js index 7e72df158..f798e3d04 100644 --- a/src/integrations/MoEngage/browser.js +++ b/src/integrations/MoEngage/browser.js @@ -28,9 +28,11 @@ class MoEngage { this.debug = config.debug; this.region = config.region; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Mouseflow/browser.js b/src/integrations/Mouseflow/browser.js index 6843767f2..712f7983e 100644 --- a/src/integrations/Mouseflow/browser.js +++ b/src/integrations/Mouseflow/browser.js @@ -13,9 +13,11 @@ class Mouseflow { this.analytics = analytics; this.websiteId = config.websiteId; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Olark/browser.js b/src/integrations/Olark/browser.js index 206f4dbb5..e53adfca6 100644 --- a/src/integrations/Olark/browser.js +++ b/src/integrations/Olark/browser.js @@ -20,9 +20,11 @@ class Olark { this.standardToEvent = config.standardToEvent; this.updateEventNames = config.updateEventNames; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Optimizely/browser.js b/src/integrations/Optimizely/browser.js index 59a4d422e..cabf977cf 100644 --- a/src/integrations/Optimizely/browser.js +++ b/src/integrations/Optimizely/browser.js @@ -22,8 +22,11 @@ class Optimizely { ? config.customExperimentProperties : []; this.name = NAME; - this.areTransformationsConnected = destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Pendo/browser.js b/src/integrations/Pendo/browser.js index c8ac937f2..953b906cd 100644 --- a/src/integrations/Pendo/browser.js +++ b/src/integrations/Pendo/browser.js @@ -12,9 +12,11 @@ class Pendo { this.analytics = analytics; this.apiKey = !config.apiKey ? '' : config.apiKey; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); logger.debug('Config ', config); } diff --git a/src/integrations/PinterestTag/browser.js b/src/integrations/PinterestTag/browser.js index feb1b5098..0952e7e6b 100644 --- a/src/integrations/PinterestTag/browser.js +++ b/src/integrations/PinterestTag/browser.js @@ -30,9 +30,11 @@ export default class PinterestTag { this.userDefinedEventsMapping = config.eventsMapping || []; this.name = NAME; this.deduplicationKey = config.deduplicationKey; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); this.sendAsCustomEvent = config.sendAsCustomEvent || false; } diff --git a/src/integrations/Podsights/browser.js b/src/integrations/Podsights/browser.js index 867e987c8..ed3cd8f8b 100644 --- a/src/integrations/Podsights/browser.js +++ b/src/integrations/Podsights/browser.js @@ -30,9 +30,11 @@ class Podsights { this.eventsToPodsightsEvents = config.eventsToPodsightsEvents; this.enableAliasCall = config.enableAliasCall; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/PostAffiliatePro/browser.js b/src/integrations/PostAffiliatePro/browser.js index c39fb9491..e8c4c3176 100644 --- a/src/integrations/PostAffiliatePro/browser.js +++ b/src/integrations/PostAffiliatePro/browser.js @@ -27,9 +27,11 @@ class PostAffiliatePro { this.disableTrackingMethod = config.disableTrackingMethod; this.paramNameUserId = config.paramNameUserId; this.clickEvents = config.clickEvents; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Posthog/browser.js b/src/integrations/Posthog/browser.js index fcfabcc51..5d6b481c9 100644 --- a/src/integrations/Posthog/browser.js +++ b/src/integrations/Posthog/browser.js @@ -22,8 +22,11 @@ class Posthog { this.propertyBlackList = []; this.xhrHeaders = {}; this.enableLocalStoragePersistence = config.enableLocalStoragePersistence; - this.areTransformationsConnected = destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); if (config.xhrHeaders && config.xhrHeaders.length > 0) { config.xhrHeaders.forEach((header) => { diff --git a/src/integrations/ProfitWell/browser.js b/src/integrations/ProfitWell/browser.js index a22dec19a..1ded64388 100644 --- a/src/integrations/ProfitWell/browser.js +++ b/src/integrations/ProfitWell/browser.js @@ -13,9 +13,11 @@ class ProfitWell { this.publicApiKey = config.publicApiKey; this.siteType = config.siteType; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Qualaroo/browser.js b/src/integrations/Qualaroo/browser.js index ae1001f2a..1cf757bc6 100644 --- a/src/integrations/Qualaroo/browser.js +++ b/src/integrations/Qualaroo/browser.js @@ -19,9 +19,11 @@ class Qualaroo { this.eventsToStandard = config.eventsToStandard; this.updateEventNames = config.updateEventNames; this.eventsList = config.eventsList; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Qualtrics/browser.js b/src/integrations/Qualtrics/browser.js index 8ba6252b4..d0017e4d1 100644 --- a/src/integrations/Qualtrics/browser.js +++ b/src/integrations/Qualtrics/browser.js @@ -23,9 +23,11 @@ class Qualtrics { this.projectId = config.projectId; this.brandId = config.brandId; this.enableGenericPageTitle = config.enableGenericPageTitle; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/QuantumMetric/browser.js b/src/integrations/QuantumMetric/browser.js index d6059bafd..3eae64b8e 100644 --- a/src/integrations/QuantumMetric/browser.js +++ b/src/integrations/QuantumMetric/browser.js @@ -13,9 +13,11 @@ class QuantumMetric { this.siteId = config.siteID; // 1549611 this.name = NAME; this._ready = false; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/QuoraPixel/browser.js b/src/integrations/QuoraPixel/browser.js index f49db38af..88494193c 100644 --- a/src/integrations/QuoraPixel/browser.js +++ b/src/integrations/QuoraPixel/browser.js @@ -13,9 +13,11 @@ class QuoraPixel { this.name = NAME; this.pixelId = config.pixelId; this.eventsToQPEvents = config.eventsToQPEvents; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/RedditPixel/browser.js b/src/integrations/RedditPixel/browser.js index 62cf7f8db..f18ccf8ce 100644 --- a/src/integrations/RedditPixel/browser.js +++ b/src/integrations/RedditPixel/browser.js @@ -21,9 +21,11 @@ class RedditPixel { this.advertiserId = config.advertiserId; this.name = NAME; this.eventMappingFromConfig = config.eventMappingFromConfig; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Refiner/browser.js b/src/integrations/Refiner/browser.js index b5fc85c3b..6a6a6caea 100644 --- a/src/integrations/Refiner/browser.js +++ b/src/integrations/Refiner/browser.js @@ -14,9 +14,11 @@ class Refiner { this.apiKey = config.webClientApiKey; this.userAttributesMapping = config.userAttributesMapping; this.accountAttributesMapping = config.accountAttributesMapping; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Rockerbox/browser.js b/src/integrations/Rockerbox/browser.js index 26d8bc310..d331af14e 100644 --- a/src/integrations/Rockerbox/browser.js +++ b/src/integrations/Rockerbox/browser.js @@ -15,10 +15,12 @@ class Rockerbox { this.customDomain = config.customDomain; this.enableCookieSync = config.enableCookieSync; this.eventsMap = config.eventsMap || []; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; this.connectionMode = config.connectionMode; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/RollBar/browser.js b/src/integrations/RollBar/browser.js index a33253a76..fffe11854 100644 --- a/src/integrations/RollBar/browser.js +++ b/src/integrations/RollBar/browser.js @@ -20,9 +20,11 @@ class RollBar { this.ignoredMessages = config.ignoredMessages; this.environment = config.environment; this.sourceMapEnabled = config.sourceMapEnabled; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Satismeter/browser.js b/src/integrations/Satismeter/browser.js index 6821ef732..d1a9a4769 100644 --- a/src/integrations/Satismeter/browser.js +++ b/src/integrations/Satismeter/browser.js @@ -20,9 +20,11 @@ class Satismeter { this.eventsToStandard = config.eventsToStandard; this.updateEventNames = config.updateEventNames; this.eventsList = config.eventsList; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Sendinblue/browser.js b/src/integrations/Sendinblue/browser.js index b24b2f5bc..6462cf568 100644 --- a/src/integrations/Sendinblue/browser.js +++ b/src/integrations/Sendinblue/browser.js @@ -18,9 +18,11 @@ class Sendinblue { this.clientKey = config.clientKey; this.contactAttributeMapping = config.contactAttributeMapping; this.sendTraitsInTrack = config.sendTraitsInTrack; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/Sentry/browser.js b/src/integrations/Sentry/browser.js index 6eedfd52f..97918b4ab 100644 --- a/src/integrations/Sentry/browser.js +++ b/src/integrations/Sentry/browser.js @@ -28,9 +28,11 @@ class Sentry { this.release = config.release; this.customVersionProperty = config.customVersionProperty; this.serverName = config.serverName; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Shynet/browser.js b/src/integrations/Shynet/browser.js index e26e95bb9..aa9a29b32 100644 --- a/src/integrations/Shynet/browser.js +++ b/src/integrations/Shynet/browser.js @@ -12,9 +12,11 @@ class Shynet { const { shynetServiceUrl } = config; this.scriptCheck = false; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); this.shynetScript = { idempotency: null, diff --git a/src/integrations/SnapEngage/browser.js b/src/integrations/SnapEngage/browser.js index f3868e7fb..1019dae2e 100644 --- a/src/integrations/SnapEngage/browser.js +++ b/src/integrations/SnapEngage/browser.js @@ -20,9 +20,11 @@ class SnapEngage { this.eventsToStandard = config.eventsToStandard; this.updateEventNames = config.updateEventNames; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/integrations/SnapPixel/browser.js b/src/integrations/SnapPixel/browser.js index 7bbdea048..2385bbd33 100644 --- a/src/integrations/SnapPixel/browser.js +++ b/src/integrations/SnapPixel/browser.js @@ -60,9 +60,11 @@ class SnapPixel { 'custom_event_4', 'custom_event_5', ]; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/TVSquared/browser.js b/src/integrations/TVSquared/browser.js index fb42f817f..71cf76302 100644 --- a/src/integrations/TVSquared/browser.js +++ b/src/integrations/TVSquared/browser.js @@ -15,9 +15,11 @@ class TVSquared { this.eventWhiteList = config.eventWhiteList || []; this.customMetrics = config.customMetrics || []; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/TiktokAds/browser.js b/src/integrations/TiktokAds/browser.js index f8e8a4df7..b76b8d24f 100644 --- a/src/integrations/TiktokAds/browser.js +++ b/src/integrations/TiktokAds/browser.js @@ -22,9 +22,11 @@ class TiktokAds { this.analytics = analytics; this.eventsToStandard = config.eventsToStandard; this.pixelCode = config.pixelCode; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/VWO/browser.js b/src/integrations/VWO/browser.js index 5461674ad..90e23c79d 100644 --- a/src/integrations/VWO/browser.js +++ b/src/integrations/VWO/browser.js @@ -20,9 +20,11 @@ class VWO { this.sendExperimentTrack = config.sendExperimentTrack; this.sendExperimentIdentify = config.sendExperimentIdentify; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); logger.debug('Config ', config); } diff --git a/src/integrations/Vero/browser.js b/src/integrations/Vero/browser.js index 902de090b..0a9f07056 100644 --- a/src/integrations/Vero/browser.js +++ b/src/integrations/Vero/browser.js @@ -13,9 +13,11 @@ class Vero { this.analytics = analytics; this.apiKey = config.apiKey; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/Woopra/browser.js b/src/integrations/Woopra/browser.js index fbc6667c3..127029618 100644 --- a/src/integrations/Woopra/browser.js +++ b/src/integrations/Woopra/browser.js @@ -24,9 +24,11 @@ class Woopra { this.ignoreQueryUrl = config.ignoreQueryUrl; this.outgoingIgnoreSubdomain = config.outgoingIgnoreSubdomain; this.outgoingTracking = config.outgoingTracking; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } init() { diff --git a/src/integrations/YandexMetrica/browser.js b/src/integrations/YandexMetrica/browser.js index aee2939d2..44b203c09 100644 --- a/src/integrations/YandexMetrica/browser.js +++ b/src/integrations/YandexMetrica/browser.js @@ -24,9 +24,11 @@ class YandexMetrica { this.goalId = config.goalId; this.eventNameToYandexEvent = config.eventNameToYandexEvent; this.name = NAME; - this.areTransformationsConnected = - destinationInfo && destinationInfo.areTransformationsConnected; - this.destinationId = destinationInfo && destinationInfo.destinationId; + ({ + shouldApplyDeviceModeTransformation: this.shouldApplyDeviceModeTransformation, + propagateEventsUntransformedOnError: this.propagateEventsUntransformedOnError, + destinationId: this.destinationId, + } = destinationInfo ?? {}); } loadScript() { diff --git a/src/utils/ObjectUtils.js b/src/utils/ObjectUtils.js index 228ce0434..44549a1b8 100644 --- a/src/utils/ObjectUtils.js +++ b/src/utils/ObjectUtils.js @@ -54,6 +54,9 @@ const stringifyWithoutCircular = (obj, excludeNull) => const isInstanceOfEvent = (value) => typeof value === 'object' && value !== null && 'target' in value; +const isNonEmptyObject = (value) => + isObjectLiteralAndNotNull(value) && Object.keys(value).length > 0; + export { mergeDeepRightObjectArrays, mergeDeepRight, @@ -61,4 +64,5 @@ export { stringifyWithoutCircular, isInstanceOfEvent, isObjectLiteralAndNotNull, + isNonEmptyObject, };