Files
overleaf-cep/services/web/app/views/subscriptions/dashboard-react.pug
Antoine Clausse dd44f4e2e8 [web] Remove stale "You already have a subscription" notification (#33187)
* Remove stale "You already have a subscription" notification after cancel/plan change

The notification was derived from a server-rendered meta tag set at page load,
so it persisted through cancel and plan-change flows. Now derived directly from
the URL param on the client; the param is stripped on cancel button click
(replaceState) and before plan-change reloads (location.replace via
reloadWithoutHasSubscription helper).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix format

* Update services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix change-plan tests after location.reload → location.replace migration

reloadWithoutHasSubscription calls location.replace() not location.reload(),
so update assertions accordingly. Also stub toString() to return the jsdom
origin so FlashMessage's replaceState call doesn't throw a SecurityError.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Guard reloadWithoutHasSubscription against empty URL

When called after component unmount, useLocation's toString() returns '',
causing new URL('') to throw. No-op early to avoid the exception.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Guard against empty URL in history state replacement for subscription cancellation

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GitOrigin-RevId: 8408ee971adf038e2d819eae5df060ace62a7e14
2026-05-01 08:06:41 +00:00

103 lines
2.3 KiB
Plaintext

extends ../layout-react
block vars
- isWebsiteRedesign = true
block entrypointVar
- entrypoint = 'pages/user/subscription/dashboard'
block head-scripts
script(
type='text/javascript'
nonce=scriptNonce
src='https://js.recurly.com/v4/recurly.js'
)
block append meta
meta(name='ol-subscription' data-type='json' content=personalSubscription)
meta(
name='ol-userCanExtendTrial'
data-type='boolean'
content=userCanExtendTrial
)
meta(
name='ol-managedGroupSubscriptions'
data-type='json'
content=managedGroupSubscriptions
)
meta(
name='ol-memberGroupSubscriptions'
data-type='json'
content=memberGroupSubscriptions
)
meta(
name='ol-managedInstitutions'
data-type='json'
content=managedInstitutions
)
meta(name='ol-managedPublishers' data-type='json' content=managedPublishers)
meta(
name='ol-planCodesChangingAtTermEnd'
data-type='json'
content=planCodesChangingAtTermEnd
)
meta(
name='ol-currentInstitutionsWithLicence'
data-type='json'
content=currentInstitutionsWithLicence
)
meta(name='ol-hasSubscription' data-type='boolean' content=hasSubscription)
meta(
name='ol-subscriptionPaymentErrorCode'
data-type='string'
content=redirectedPaymentErrorCode
)
meta(name='ol-plans' data-type='json' content=plans)
meta(
name='ol-groupSettingsAdvertisedFor'
data-type='json'
content=groupSettingsAdvertisedFor
)
meta(
name='ol-canUseFlexibleLicensing'
data-type='boolean'
content=canUseFlexibleLicensing
)
meta(
name='ol-showGroupDiscount'
data-type='boolean'
content=showGroupDiscount
)
meta(
name='ol-groupSettingsEnabledFor'
data-type='json'
content=groupSettingsEnabledFor
)
meta(
name='ol-hasAiAssistViaWritefull'
data-type='boolean'
content=hasAiAssistViaWritefull
)
meta(
name='ol-aiAssistViaWritefullSource'
data-type='string'
content=aiAssistViaWritefullSource
)
meta(
name='ol-isManagedGroupAdmin'
data-type='boolean'
content=isManagedGroupAdmin
)
meta(name='ol-user' data-type='json' content=user)
if personalSubscription && personalSubscription.payment
meta(name='ol-recurlyApiKey' content=settings.apis.recurly.publicKey)
meta(
name='ol-recommendedCurrency'
content=personalSubscription.payment.currency
)
meta(name='ol-groupPlans' data-type='json' content=groupPlans)
block content
main#main-content.content
#subscription-dashboard-root