mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-05 07:09:02 +02:00
Merge pull request #23177 from overleaf/rh-pause-tracking
Add tracking for subscription-pause-scheduled event GitOrigin-RevId: 802899e53d22f2be49f2d20adb45a4a47d0f6beb
This commit is contained in:
@@ -198,6 +198,20 @@ async function pauseSubscription(req, res, next) {
|
||||
)
|
||||
try {
|
||||
await SubscriptionHandler.promises.pauseSubscription(user, pauseCycles)
|
||||
|
||||
const { subscription } =
|
||||
await LimitationsManager.promises.userHasSubscription(user)
|
||||
|
||||
AnalyticsManager.recordEventForUserInBackground(
|
||||
user._id,
|
||||
'subscription-pause-scheduled',
|
||||
{
|
||||
pause_length: pauseCycles,
|
||||
plan_code: subscription?.planCode,
|
||||
subscriptionId: subscription?.id,
|
||||
}
|
||||
)
|
||||
|
||||
return res.sendStatus(200)
|
||||
} catch (err) {
|
||||
if (err instanceof Error) {
|
||||
|
||||
@@ -66,6 +66,7 @@ export default function PauseSubscriptionModal() {
|
||||
const newUrl = new URL(location.toString())
|
||||
newUrl.searchParams.set('flash', 'paused')
|
||||
window.history.replaceState(null, '', newUrl)
|
||||
|
||||
location.reload()
|
||||
} catch (err) {
|
||||
debugConsole.error('error pausing subscription', err)
|
||||
|
||||
@@ -172,6 +172,7 @@ describe('SubscriptionController', function () {
|
||||
'./Errors': SubscriptionErrors,
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
recordEventForUser: sinon.stub(),
|
||||
recordEventForUserInBackground: sinon.stub(),
|
||||
recordEventForSession: sinon.stub(),
|
||||
setUserPropertyForUser: sinon.stub(),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user