[web] Remove some unused code related to AI assist (#35533)

* Remove unused `ol-addonPrices`

* Remove unused `showAiAssistAnnualDiscount`

* Remove unused `buyAddOnUrl` and related code

GitOrigin-RevId: d4f47d8c6cd8e2b304ad5c0a2c78cbef28a6cb97
This commit is contained in:
Antoine Clausse
2026-09-17 11:29:35 +00:00
committed by Copybot
parent 04c9e583a3
commit 82f92933a2
4 changed files with 0 additions and 61 deletions
@@ -914,10 +914,6 @@ const _ProjectController = {
showAiFeaturesDisabled = false
}
// only add-on is ai based, so we only need its pricing info if ai features are usable
const addonPrices =
showAiFeatures && (await ProjectController._getAddonPrices(req, res))
let standardPlanPricing
let recommendedCurrency
if (Features.hasFeature('saas')) {
@@ -1049,7 +1045,6 @@ const _ProjectController = {
isSaas: Features.hasFeature('saas'),
shouldLoadHotjar,
customerIoEnabled: true,
addonPrices,
compileSettings: {
compileTimeout: ownerFeatures?.compileTimeout,
},
@@ -1092,37 +1087,6 @@ const _ProjectController = {
}
},
// todo: quota clean-up: these can be removed potentially?
async _getAddonPrices(req, res, addonPlans = ['assistant']) {
const plansData = {}
const locale = req.i18n.language
const { currency } = await SubscriptionController.getRecommendedCurrency(
req,
res
)
addonPlans.forEach(plan => {
const annualPrice = Settings.localizedAddOnsPricing[currency][plan].annual
const monthlyPrice =
Settings.localizedAddOnsPricing[currency][plan].monthly
const annualDividedByTwelve =
Settings.localizedAddOnsPricing[currency][plan].annualDividedByTwelve
plansData[plan] = {
annual: formatCurrency(annualPrice, currency, locale, true),
annualDividedByTwelve: formatCurrency(
annualDividedByTwelve,
currency,
locale,
true
),
monthly: formatCurrency(monthlyPrice, currency, locale, true),
}
})
return plansData
},
async _refreshFeatures(req, user) {
// If the feature refresh has failed in this session, don't retry
// it - require the user to log in again.
@@ -1490,7 +1454,6 @@ const ProjectController = {
_isInPercentageRollout: _ProjectController._isInPercentageRollout,
_refreshFeatures: _ProjectController._refreshFeatures,
_getPlanPricing: _ProjectController._getPlanPricing,
_getAddonPrices: _ProjectController._getAddonPrices,
_setWritefullTrialState: _ProjectController._setWritefullTrialState,
}
@@ -19,28 +19,9 @@ export function isStandaloneAiAddOnPlanCode(planCode) {
)
}
/**
* Returns whether subscription change will have have the ai bundle once the change is processed
*
* @param {Record<string, any>} subscriptionChange The subscription change object coming from payment provider
* type should be PaymentProviderSubscriptionChange but if imported here, it creates a circular dependency
* TODO: fix this when moved to es modules
*
* @return {boolean}
*/
export function subscriptionChangeIsAiAssistUpgrade(subscriptionChange) {
return Boolean(
isStandaloneAiAddOnPlanCode(subscriptionChange.nextPlanCode) ||
subscriptionChange.nextAddOns?.some(
/** @param {any} addOn */ addOn => addOn.code === AI_ADD_ON_CODE
)
)
}
export default {
AI_ADD_ON_CODE,
AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE,
AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE,
isStandaloneAiAddOnPlanCode,
subscriptionChangeIsAiAssistUpgrade,
}
@@ -45,7 +45,6 @@ meta(name="ol-isSaas" data-type="boolean" content=isSaas)
meta(name="ol-shouldLoadHotjar" data-type="boolean" content=shouldLoadHotjar)
meta(name='ol-customerIoEnabled' data-type="boolean" content=customerIoEnabled)
meta(name='ol-compileSettings' data-type="json" content=compileSettings)
meta(name="ol-addonPrices" data-type="json" content=addonPrices)
if (standardPlanPricing)
meta(
name='ol-recommendedCurrency'
-4
View File
@@ -73,10 +73,6 @@ import { FullHistoryFailure } from '@ol-types/history/projectHistory'
export interface Meta {
'ol-ExposedSettings': ExposedSettings
'ol-addonPrices': Record<
string,
{ annual: string; monthly: string; annualDividedByTwelve: string }
>
'ol-adminCapabilities': AdminCapability[]
'ol-adminSubscription': AdminSubscription
'ol-adminUserExists': boolean