mirror of
https://github.com/tutao/tutanota.git
synced 2025-10-19 07:53:47 +00:00
parent
9100edc7b8
commit
c33c24053e
1 changed files with 22 additions and 7 deletions
|
@ -9,10 +9,16 @@ import { GENERATED_MAX_ID } from "../api/common/utils/EntityUtils.js"
|
||||||
import { AvailablePlanType, Const, NewBusinessPlans, NewPaidPlans, NewPersonalPlans, PlanType } from "../api/common/TutanotaConstants.js"
|
import { AvailablePlanType, Const, NewBusinessPlans, NewPaidPlans, NewPersonalPlans, PlanType } from "../api/common/TutanotaConstants.js"
|
||||||
import { ProgrammingError } from "../api/common/error/ProgrammingError.js"
|
import { ProgrammingError } from "../api/common/error/ProgrammingError.js"
|
||||||
|
|
||||||
|
let upgradeDialogShowing = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialog which states that the function is not available in the Free subscription and provides an option to upgrade.
|
* Opens a dialog which states that the function is not available in the Free subscription and provides an option to upgrade.
|
||||||
*/
|
*/
|
||||||
export async function showNotAvailableForFreeDialog(acceptedPlans: readonly AvailablePlanType[] = NewPaidPlans) {
|
export async function showNotAvailableForFreeDialog(acceptedPlans: readonly AvailablePlanType[] = NewPaidPlans) {
|
||||||
|
// upgradeDialogShowing prevents the dialog from being opened multiple times, as could happen when waiting for the wizard to import
|
||||||
|
if (!upgradeDialogShowing) {
|
||||||
|
upgradeDialogShowing = true
|
||||||
|
try {
|
||||||
const wizard = await import("../subscription/UpgradeSubscriptionWizard")
|
const wizard = await import("../subscription/UpgradeSubscriptionWizard")
|
||||||
const customerInfo = await locator.logins.getUserController().loadCustomerInfo()
|
const customerInfo = await locator.logins.getUserController().loadCustomerInfo()
|
||||||
|
|
||||||
|
@ -21,7 +27,16 @@ export async function showNotAvailableForFreeDialog(acceptedPlans: readonly Avai
|
||||||
NewPersonalPlans.includes(downcast(customerInfo.plan))
|
NewPersonalPlans.includes(downcast(customerInfo.plan))
|
||||||
const msg = lang.getTranslation(businessPlanRequired ? "pricing.notSupportedByPersonalPlan_msg" : "newPaidPlanRequired_msg")
|
const msg = lang.getTranslation(businessPlanRequired ? "pricing.notSupportedByPersonalPlan_msg" : "newPaidPlanRequired_msg")
|
||||||
|
|
||||||
await wizard.showUpgradeWizard({ logins: locator.logins, isCalledBySatisfactionDialog: false, acceptedPlans, msg })
|
await wizard.showUpgradeWizard({
|
||||||
|
logins: locator.logins,
|
||||||
|
isCalledBySatisfactionDialog: false,
|
||||||
|
acceptedPlans,
|
||||||
|
msg,
|
||||||
|
})
|
||||||
|
} finally {
|
||||||
|
upgradeDialogShowing = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createNotAvailableForFreeClickHandler(
|
export function createNotAvailableForFreeClickHandler(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue