mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Merge pull request #4639 from overleaf/ab-web-mono-analytics-id
Analytics ID support GitOrigin-RevId: 820a6c0f4d19f046f6c791ce4dc64dbc80748924
This commit is contained in:
committed by
Copybot
parent
3af8fc63de
commit
44a8883b6d
@@ -40,7 +40,7 @@ describe('FeaturesUpdater', function () {
|
||||
'../Institutions/InstitutionsFeatures': (this.InstitutionsFeatures = {}),
|
||||
'../User/UserGetter': (this.UserGetter = {}),
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
setUserProperty: sinon.stub(),
|
||||
setUserPropertyForUser: sinon.stub(),
|
||||
}),
|
||||
'../../infrastructure/Modules': (this.Modules = {
|
||||
hooks: { fire: sinon.stub() },
|
||||
@@ -182,7 +182,7 @@ describe('FeaturesUpdater', function () {
|
||||
)
|
||||
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.user_id,
|
||||
'feature-set',
|
||||
'personal'
|
||||
@@ -201,7 +201,7 @@ describe('FeaturesUpdater', function () {
|
||||
)
|
||||
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.user_id,
|
||||
'feature-set',
|
||||
'mixed'
|
||||
|
||||
@@ -27,8 +27,8 @@ describe('RecurlyEventHandler', function () {
|
||||
this.RecurlyEventHandler = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
recordEvent: sinon.stub(),
|
||||
setUserProperty: sinon.stub(),
|
||||
recordEventForUser: sinon.stub(),
|
||||
setUserPropertyForUser: sinon.stub(),
|
||||
}),
|
||||
},
|
||||
})
|
||||
@@ -40,7 +40,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-started',
|
||||
{
|
||||
@@ -50,19 +50,19 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-plan-code',
|
||||
this.planCode
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-state',
|
||||
'active'
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-is-trial',
|
||||
true
|
||||
@@ -83,7 +83,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-started',
|
||||
{
|
||||
@@ -93,13 +93,13 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-state',
|
||||
'active'
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-is-trial',
|
||||
false
|
||||
@@ -114,7 +114,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-updated',
|
||||
{
|
||||
@@ -123,19 +123,19 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-plan-code',
|
||||
this.planCode
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-state',
|
||||
'active'
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-is-trial',
|
||||
true
|
||||
@@ -149,7 +149,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-cancelled',
|
||||
{
|
||||
@@ -159,13 +159,13 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-state',
|
||||
'cancelled'
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-is-trial',
|
||||
true
|
||||
@@ -179,7 +179,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-expired',
|
||||
{
|
||||
@@ -189,19 +189,19 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-plan-code',
|
||||
this.planCode
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-state',
|
||||
'expired'
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.userId,
|
||||
'subscription-is-trial',
|
||||
true
|
||||
@@ -214,7 +214,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-renewed',
|
||||
{
|
||||
@@ -231,7 +231,7 @@ describe('RecurlyEventHandler', function () {
|
||||
this.eventData
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-reactivated',
|
||||
{
|
||||
@@ -255,7 +255,7 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-invoice-collected'
|
||||
)
|
||||
@@ -274,7 +274,7 @@ describe('RecurlyEventHandler', function () {
|
||||
},
|
||||
}
|
||||
)
|
||||
sinon.assert.notCalled(this.AnalyticsManager.recordEvent)
|
||||
sinon.assert.notCalled(this.AnalyticsManager.recordEventForUser)
|
||||
})
|
||||
|
||||
it('with closed_invoice_notification', function () {
|
||||
@@ -291,7 +291,7 @@ describe('RecurlyEventHandler', function () {
|
||||
}
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.recordEvent,
|
||||
this.AnalyticsManager.recordEventForUser,
|
||||
this.userId,
|
||||
'subscription-invoice-collected'
|
||||
)
|
||||
@@ -310,6 +310,6 @@ describe('RecurlyEventHandler', function () {
|
||||
},
|
||||
}
|
||||
)
|
||||
sinon.assert.notCalled(this.AnalyticsManager.recordEvent)
|
||||
sinon.assert.notCalled(this.AnalyticsManager.recordEventForUser)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -141,8 +141,9 @@ describe('SubscriptionController', function () {
|
||||
}),
|
||||
'./Errors': SubscriptionErrors,
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
recordEvent: sinon.stub(),
|
||||
setUserProperty: sinon.stub(),
|
||||
recordEventForUser: sinon.stub(),
|
||||
recordEventForSession: sinon.stub(),
|
||||
setUserPropertyForUser: sinon.stub(),
|
||||
}),
|
||||
'../SplitTests/SplitTestHandler': (this.SplitTestHandler = {
|
||||
getTestSegmentation: () => {},
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('SubscriptionHandler', function () {
|
||||
|
||||
this.EmailHandler = { sendEmail: sinon.stub() }
|
||||
|
||||
this.AnalyticsManager = { recordEvent: sinon.stub() }
|
||||
this.AnalyticsManager = { recordEventForUser: sinon.stub() }
|
||||
|
||||
this.PlansLocator = {
|
||||
findLocalPlanInSettings: sinon.stub().returns({ planCode: 'plan' }),
|
||||
|
||||
@@ -105,7 +105,7 @@ describe('SubscriptionUpdater', function () {
|
||||
findOneAndUpdate: sinon.stub().yields(),
|
||||
}
|
||||
this.AnalyticsManager = {
|
||||
setUserProperty: sinon.stub(),
|
||||
setUserPropertyForUser: sinon.stub(),
|
||||
}
|
||||
this.SubscriptionUpdater = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
@@ -527,7 +527,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.otherUserId,
|
||||
() => {
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
'group_subscription'
|
||||
@@ -547,7 +547,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.otherUserId
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
'group_subscription'
|
||||
@@ -564,7 +564,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.otherUserId
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
'better_group_subscription'
|
||||
@@ -581,7 +581,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.otherUserId
|
||||
)
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
'better_group_subscription'
|
||||
@@ -622,7 +622,7 @@ describe('SubscriptionUpdater', function () {
|
||||
this.otherUserId,
|
||||
() => {
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
null
|
||||
@@ -635,7 +635,7 @@ describe('SubscriptionUpdater', function () {
|
||||
it('should set the group plan code user property when removing user from all groups', function (done) {
|
||||
this.SubscriptionUpdater.removeUserFromAllGroups(this.otherUserId, () => {
|
||||
sinon.assert.calledWith(
|
||||
this.AnalyticsManager.setUserProperty,
|
||||
this.AnalyticsManager.setUserPropertyForUser,
|
||||
this.otherUserId,
|
||||
'group-subscription-plan-code',
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user