Revert "Send subscription -> salesforce/v1 links to analytics"

This reverts commit 52c02138f9ef8141850e2f8ce16f2bab1e7463b0.

GitOrigin-RevId: 022e828a8e41cc73c4087b94d51fa75dbe6cfdb5
This commit is contained in:
Andrew Rumble
2024-10-23 08:06:11 +00:00
committed by Copybot
parent 6f3c371435
commit e75e9c4818
5 changed files with 0 additions and 360 deletions
@@ -1,48 +0,0 @@
export function extractAccountMappingsFromSubscription(
subscription,
updatedSubscription
) {
const accountMappings = []
if (
updatedSubscription.salesforce_id ||
updatedSubscription.salesforce_id === ''
) {
if (subscription.salesforce_id !== updatedSubscription.salesforce_id) {
accountMappings.push(
generateSubscriptionToSalesforceMapping(
subscription.id,
updatedSubscription.salesforce_id
)
)
}
}
if (updatedSubscription.v1_id || updatedSubscription.v1_id === '') {
if (subscription.v1_id !== updatedSubscription.v1_id) {
accountMappings.push(
generateSubscriptionToV1Mapping(
subscription.id,
updatedSubscription.v1_id
)
)
}
}
return accountMappings
}
}
function generateSubscriptionToSalesforceMapping(subscriptionId, salesforceId) {
return {
source: 'salesforce',
sourceEntity: 'account',
sourceEntityId: salesforceId,
target: 'v2',
targetEntity: 'subscription',
targetEntityId: subscriptionId,
createdAt: new Date().toISOString(),
}
}
export default {
extractAccountMappingsFromSubscription,
}
@@ -15,9 +15,6 @@ const analyticsEditingSessionsQueue = Queues.getQueue(
const analyticsUserPropertiesQueue = Queues.getQueue(
'analytics-user-properties'
)
const analyticsAccountMappingQueue = Queues.getQueue(
'analytics-account-mapping'
)
const ONE_MINUTE_MS = 60 * 1000
@@ -146,55 +143,6 @@ function setUserPropertyForSessionInBackground(session, property, value) {
})
}
/**
* Register mapping between two accounts.
*
* @param {object} payload - The event payload to send to Analytics
* @param {string} payload.source - The type of account linked from
* @param {string} payload.sourceId - The ID of the account linked from
* @param {string} payload.target - The type of account linked to
* @param {string} payload.targetId - The ID of the account linked to
* @param {Date} payload.createdAt - The date the mapping was created
* @property
*/
function registerAccountMapping({
source,
sourceEntity,
sourceEntityId,
target,
targetEntity,
targetEntityId,
createdAt,
}) {
Metrics.analyticsQueue.inc({
status: 'adding',
event_type: 'account-mapping',
})
analyticsAccountMappingQueue
.add('account-mapping', {
source,
sourceEntity,
sourceEntityId,
target,
targetEntity,
targetEntityId,
createdAt: createdAt ?? new Date(),
})
.then(() => {
Metrics.analyticsQueue.inc({
status: 'added',
event_type: 'account-mapping',
})
})
.catch(() => {
Metrics.analyticsQueue.inc({
status: 'error',
event_type: 'account-mapping',
})
})
}
function updateEditingSession(userId, projectId, countryCode, segmentation) {
if (!userId) {
return
@@ -401,6 +349,5 @@ module.exports = {
setUserPropertyForAnalyticsId,
updateEditingSession,
getIdsFromSession,
registerAccountMapping,
analyticsIdMiddleware: expressify(analyticsIdMiddleware),
}
@@ -17,9 +17,6 @@ const QUEUES_JOB_OPTIONS = {
'analytics-editing-sessions': {
removeOnFail: MAX_FAILED_JOBS_RETAINED_ANALYTICS,
},
'analytics-account-mapping': {
removeOnFail: MAX_FAILED_JOBS_RETAINED_ANALYTICS,
},
'analytics-user-properties': {
removeOnFail: MAX_FAILED_JOBS_RETAINED_ANALYTICS,
},
@@ -41,7 +38,6 @@ const QUEUES_JOB_OPTIONS = {
removeOnFail: MAX_FAILED_JOBS_RETAINED,
attempts: 3,
},
'group-sso-reminder': {
removeOnFail: MAX_FAILED_JOBS_RETAINED,
attempts: 3,
@@ -58,7 +54,6 @@ const QUEUE_OPTIONS = {
}
const ANALYTICS_QUEUES = [
'analytics-account-mapping',
'analytics-events',
'analytics-editing-sessions',
'analytics-user-properties',