feat: add email-only telegram demo states
This commit is contained in:
@@ -9,6 +9,8 @@ const stateMocks = new Set([
|
|||||||
"depleted",
|
"depleted",
|
||||||
"no-subscription",
|
"no-subscription",
|
||||||
"trial",
|
"trial",
|
||||||
|
"trial-telegram",
|
||||||
|
"referral-telegram",
|
||||||
"devices",
|
"devices",
|
||||||
"notifications",
|
"notifications",
|
||||||
"auth",
|
"auth",
|
||||||
|
|||||||
@@ -467,6 +467,8 @@ const docsHref = '/getting-started/demo/';
|
|||||||
<option value="depleted">Трафик закончился</option>
|
<option value="depleted">Трафик закончился</option>
|
||||||
<option value="no-subscription">Нет подписки</option>
|
<option value="no-subscription">Нет подписки</option>
|
||||||
<option value="trial">Доступна пробная подписка</option>
|
<option value="trial">Доступна пробная подписка</option>
|
||||||
|
<option value="trial-telegram">Email-only: Telegram для триала</option>
|
||||||
|
<option value="referral-telegram">Email-only: Telegram для рефбонуса</option>
|
||||||
<option value="devices">Лимит и докупка устройств</option>
|
<option value="devices">Лимит и докупка устройств</option>
|
||||||
<option value="notifications">Telegram-уведомления</option>
|
<option value="notifications">Telegram-уведомления</option>
|
||||||
<option value="auth">Вход и регистрация</option>
|
<option value="auth">Вход и регистрация</option>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
- [Админка: пользователи](/demo/admin/users)
|
- [Админка: пользователи](/demo/admin/users)
|
||||||
- [Админка: бэкапы](/demo/admin/backups)
|
- [Админка: бэкапы](/demo/admin/backups)
|
||||||
- [Пробный период](/demo/home?mock=trial)
|
- [Пробный период](/demo/home?mock=trial)
|
||||||
|
- [Email-only: нужен Telegram для триала](/demo/home?mock=trial-telegram)
|
||||||
|
- [Email-only: нужен Telegram для реферального бонуса](/demo/home?mock=referral-telegram)
|
||||||
- [Докупка устройств](/demo/devices?mock=devices)
|
- [Докупка устройств](/demo/devices?mock=devices)
|
||||||
- [Запуск бота для Telegram-уведомлений](/demo/home?mock=notifications)
|
- [Запуск бота для Telegram-уведомлений](/demo/home?mock=notifications)
|
||||||
- [Вход и регистрация](/demo/login?mock=auth)
|
- [Вход и регистрация](/demo/login?mock=auth)
|
||||||
|
|||||||
@@ -672,6 +672,20 @@ function applyInactiveSubscriptionScenario({ trialAvailable = false } = {}) {
|
|||||||
DEMO_DATASET.tariff_change_options || DEV_MOCK.data.tariff_change_options;
|
DEMO_DATASET.tariff_change_options || DEV_MOCK.data.tariff_change_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyEmailOnlyAccountPatch({
|
||||||
|
email = "preview-user@mailinator.com",
|
||||||
|
referredById = null,
|
||||||
|
} = {}) {
|
||||||
|
DEV_MOCK.data.user = {
|
||||||
|
...(DEV_MOCK.data.user || {}),
|
||||||
|
telegram_id: null,
|
||||||
|
telegram_linked: false,
|
||||||
|
email,
|
||||||
|
email_verified: true,
|
||||||
|
referred_by_id: referredById,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function applyPreviewMock(kind) {
|
export function applyPreviewMock(kind) {
|
||||||
const mode = String(kind || "")
|
const mode = String(kind || "")
|
||||||
.trim()
|
.trim()
|
||||||
@@ -720,11 +734,7 @@ export function applyPreviewMock(kind) {
|
|||||||
|
|
||||||
if (mode === "trial-telegram" || mode === "trial_requires_telegram") {
|
if (mode === "trial-telegram" || mode === "trial_requires_telegram") {
|
||||||
applyInactiveSubscriptionScenario();
|
applyInactiveSubscriptionScenario();
|
||||||
DEV_MOCK.data.user = {
|
applyEmailOnlyAccountPatch({ email: "trial-user@mailinator.com" });
|
||||||
...(DEV_MOCK.data.user || {}),
|
|
||||||
telegram_id: null,
|
|
||||||
telegram_linked: false,
|
|
||||||
};
|
|
||||||
DEV_MOCK.data.settings.trial_enabled = true;
|
DEV_MOCK.data.settings.trial_enabled = true;
|
||||||
DEV_MOCK.data.settings.trial_available = false;
|
DEV_MOCK.data.settings.trial_available = false;
|
||||||
DEV_MOCK.data.settings.trial_requires_telegram = true;
|
DEV_MOCK.data.settings.trial_requires_telegram = true;
|
||||||
@@ -732,6 +742,30 @@ export function applyPreviewMock(kind) {
|
|||||||
DEV_MOCK.data.referral = {
|
DEV_MOCK.data.referral = {
|
||||||
...(DEV_MOCK.data.referral || {}),
|
...(DEV_MOCK.data.referral || {}),
|
||||||
welcome_bonus_days: 3,
|
welcome_bonus_days: 3,
|
||||||
|
welcome_bonus_requires_telegram: false,
|
||||||
|
welcome_bonus_block_reason: "",
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
mode === "referral-telegram" ||
|
||||||
|
mode === "referral_welcome_telegram" ||
|
||||||
|
mode === "referral-welcome-telegram"
|
||||||
|
) {
|
||||||
|
applyInactiveSubscriptionScenario();
|
||||||
|
applyEmailOnlyAccountPatch({
|
||||||
|
email: "referral-user@mailinator.com",
|
||||||
|
referredById: 910001,
|
||||||
|
});
|
||||||
|
DEV_MOCK.data.settings.trial_enabled = true;
|
||||||
|
DEV_MOCK.data.settings.trial_available = false;
|
||||||
|
DEV_MOCK.data.settings.trial_requires_telegram = false;
|
||||||
|
DEV_MOCK.data.settings.trial_block_reason = "";
|
||||||
|
DEV_MOCK.data.referral = {
|
||||||
|
...(DEV_MOCK.data.referral || {}),
|
||||||
|
welcome_bonus_days: 3,
|
||||||
|
welcome_bonus_without_telegram_enabled: false,
|
||||||
welcome_bonus_requires_telegram: true,
|
welcome_bonus_requires_telegram: true,
|
||||||
welcome_bonus_block_reason: "telegram_required",
|
welcome_bonus_block_reason: "telegram_required",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user