fix: refresh trial settings in admin tariffs
This commit is contained in:
@@ -107,40 +107,40 @@
|
|||||||
.join(" · ");
|
.join(" · ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function fieldFor(key) {
|
function fieldFor(key, fieldMap = settingsFieldMap) {
|
||||||
return settingsFieldMap.get(key) || { key, value: "" };
|
return fieldMap.get(key) || { key, value: "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
function valueForKey(key) {
|
function valueForKey(key, dirty = settingsDirty, fieldMap = settingsFieldMap) {
|
||||||
if (settingsDirty[key]?.deleted) return "";
|
if (dirty[key]?.deleted) return "";
|
||||||
if (Object.prototype.hasOwnProperty.call(settingsDirty, key)) {
|
if (Object.prototype.hasOwnProperty.call(dirty, key)) {
|
||||||
return settingsDirty[key].value;
|
return dirty[key].value;
|
||||||
}
|
}
|
||||||
return fieldFor(key).value ?? "";
|
return fieldFor(key, fieldMap).value ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function boolValue(key) {
|
function boolValue(key, dirty = settingsDirty, fieldMap = settingsFieldMap) {
|
||||||
return Boolean(valueForKey(key));
|
return Boolean(valueForKey(key, dirty, fieldMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSetting(key, value) {
|
function setSetting(key, value) {
|
||||||
settingsStore.markDirty(key, value);
|
settingsStore.markDirty(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSettingDirty(key) {
|
function isSettingDirty(key, dirty = settingsDirty) {
|
||||||
return Boolean(settingsDirty[key]);
|
return Boolean(dirty[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dirtyCount(keys) {
|
function dirtyCount(keys, dirty = settingsDirty) {
|
||||||
return (keys || []).filter((key) => isSettingDirty(key)).length;
|
return (keys || []).filter((key) => isSettingDirty(key, dirty)).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetSetting(key) {
|
function resetSetting(key) {
|
||||||
settingsStore.clearDirty(key);
|
settingsStore.clearDirty(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function csvList(key) {
|
function csvList(key, dirty = settingsDirty, fieldMap = settingsFieldMap) {
|
||||||
return String(valueForKey(key) || "")
|
return String(valueForKey(key, dirty, fieldMap) || "")
|
||||||
.split(",")
|
.split(",")
|
||||||
.map((item) => item.trim())
|
.map((item) => item.trim())
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
@@ -230,8 +230,12 @@
|
|||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="admin-editor-section-actions">
|
<div class="admin-editor-section-actions">
|
||||||
<AdminBadge variant={boolValue("TRIAL_ENABLED") ? "success" : "muted"}>
|
<AdminBadge
|
||||||
{boolValue("TRIAL_ENABLED")
|
variant={boolValue("TRIAL_ENABLED", settingsDirty, settingsFieldMap)
|
||||||
|
? "success"
|
||||||
|
: "muted"}
|
||||||
|
>
|
||||||
|
{boolValue("TRIAL_ENABLED", settingsDirty, settingsFieldMap)
|
||||||
? at("enabled", {}, "Enabled")
|
? at("enabled", {}, "Enabled")
|
||||||
: at("disabled", {}, "Disabled")}
|
: at("disabled", {}, "Disabled")}
|
||||||
</AdminBadge>
|
</AdminBadge>
|
||||||
@@ -253,7 +257,10 @@
|
|||||||
</header>
|
</header>
|
||||||
<div class="admin-card-body admin-trial-settings-body">
|
<div class="admin-card-body admin-trial-settings-body">
|
||||||
<div class="admin-settings-field-groups admin-trial-settings-groups">
|
<div class="admin-settings-field-groups admin-trial-settings-groups">
|
||||||
<section class="admin-settings-field-group" class:is-dirty={dirtyCount(TRIAL_SWITCH_KEYS)}>
|
<section
|
||||||
|
class="admin-settings-field-group"
|
||||||
|
class:is-dirty={dirtyCount(TRIAL_SWITCH_KEYS, settingsDirty)}
|
||||||
|
>
|
||||||
<header class="admin-settings-field-group-head">
|
<header class="admin-settings-field-group-head">
|
||||||
<div class="admin-settings-field-group-head-copy">
|
<div class="admin-settings-field-group-head-copy">
|
||||||
<strong>{at("tariffs_trial_group_switch", {}, "Доступ")}</strong>
|
<strong>{at("tariffs_trial_group_switch", {}, "Доступ")}</strong>
|
||||||
@@ -265,12 +272,12 @@
|
|||||||
)}
|
)}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{#if dirtyCount(TRIAL_SWITCH_KEYS)}
|
{#if dirtyCount(TRIAL_SWITCH_KEYS, settingsDirty)}
|
||||||
<AdminBadge variant="warning">
|
<AdminBadge variant="warning">
|
||||||
{at(
|
{at(
|
||||||
"settings_dirty_count",
|
"settings_dirty_count",
|
||||||
{ count: dirtyCount(TRIAL_SWITCH_KEYS) },
|
{ count: dirtyCount(TRIAL_SWITCH_KEYS, settingsDirty) },
|
||||||
`Изменений: ${dirtyCount(TRIAL_SWITCH_KEYS)}`
|
`Изменений: ${dirtyCount(TRIAL_SWITCH_KEYS, settingsDirty)}`
|
||||||
)}
|
)}
|
||||||
</AdminBadge>
|
</AdminBadge>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -278,12 +285,12 @@
|
|||||||
<div class="admin-settings-field-group-body">
|
<div class="admin-settings-field-group-body">
|
||||||
<div
|
<div
|
||||||
class="admin-setting admin-trial-setting-row"
|
class="admin-setting admin-trial-setting-row"
|
||||||
class:is-dirty={isSettingDirty("TRIAL_ENABLED")}
|
class:is-dirty={isSettingDirty("TRIAL_ENABLED", settingsDirty)}
|
||||||
>
|
>
|
||||||
<div class="admin-setting-meta">
|
<div class="admin-setting-meta">
|
||||||
<strong>
|
<strong>
|
||||||
{at("tariffs_trial_enabled", {}, "Триал включён")}
|
{at("tariffs_trial_enabled", {}, "Триал включён")}
|
||||||
{#if isSettingDirty("TRIAL_ENABLED")}
|
{#if isSettingDirty("TRIAL_ENABLED", settingsDirty)}
|
||||||
<AdminBadge variant="warning"
|
<AdminBadge variant="warning"
|
||||||
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
||||||
>
|
>
|
||||||
@@ -294,19 +301,19 @@
|
|||||||
<div class="admin-setting-control">
|
<div class="admin-setting-control">
|
||||||
<div class="admin-setting-switch">
|
<div class="admin-setting-switch">
|
||||||
<Switch.Root
|
<Switch.Root
|
||||||
checked={boolValue("TRIAL_ENABLED")}
|
checked={boolValue("TRIAL_ENABLED", settingsDirty, settingsFieldMap)}
|
||||||
onCheckedChange={(checked) => setSetting("TRIAL_ENABLED", checked)}
|
onCheckedChange={(checked) => setSetting("TRIAL_ENABLED", checked)}
|
||||||
class="admin-switch-root"
|
class="admin-switch-root"
|
||||||
>
|
>
|
||||||
<Switch.Thumb class="admin-switch-thumb" />
|
<Switch.Thumb class="admin-switch-thumb" />
|
||||||
</Switch.Root>
|
</Switch.Root>
|
||||||
<span
|
<span
|
||||||
>{boolValue("TRIAL_ENABLED")
|
>{boolValue("TRIAL_ENABLED", settingsDirty, settingsFieldMap)
|
||||||
? at("enabled", {}, "Включено")
|
? at("enabled", {}, "Включено")
|
||||||
: at("disabled", {}, "Выключено")}</span
|
: at("disabled", {}, "Выключено")}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{#if isSettingDirty("TRIAL_ENABLED")}
|
{#if isSettingDirty("TRIAL_ENABLED", settingsDirty)}
|
||||||
<AdminButton
|
<AdminButton
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -321,7 +328,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="admin-settings-field-group" class:is-dirty={dirtyCount(TRIAL_GENERAL_KEYS)}>
|
<section
|
||||||
|
class="admin-settings-field-group"
|
||||||
|
class:is-dirty={dirtyCount(TRIAL_GENERAL_KEYS, settingsDirty)}
|
||||||
|
>
|
||||||
<header class="admin-settings-field-group-head">
|
<header class="admin-settings-field-group-head">
|
||||||
<div class="admin-settings-field-group-head-copy">
|
<div class="admin-settings-field-group-head-copy">
|
||||||
<strong>{at("tariffs_trial_group_general", {}, "Общие настройки")}</strong>
|
<strong>{at("tariffs_trial_group_general", {}, "Общие настройки")}</strong>
|
||||||
@@ -333,12 +343,12 @@
|
|||||||
)}
|
)}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{#if dirtyCount(TRIAL_GENERAL_KEYS)}
|
{#if dirtyCount(TRIAL_GENERAL_KEYS, settingsDirty)}
|
||||||
<AdminBadge variant="warning">
|
<AdminBadge variant="warning">
|
||||||
{at(
|
{at(
|
||||||
"settings_dirty_count",
|
"settings_dirty_count",
|
||||||
{ count: dirtyCount(TRIAL_GENERAL_KEYS) },
|
{ count: dirtyCount(TRIAL_GENERAL_KEYS, settingsDirty) },
|
||||||
`Изменений: ${dirtyCount(TRIAL_GENERAL_KEYS)}`
|
`Изменений: ${dirtyCount(TRIAL_GENERAL_KEYS, settingsDirty)}`
|
||||||
)}
|
)}
|
||||||
</AdminBadge>
|
</AdminBadge>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -346,12 +356,12 @@
|
|||||||
<div class="admin-settings-field-group-body">
|
<div class="admin-settings-field-group-body">
|
||||||
<div
|
<div
|
||||||
class="admin-setting admin-trial-setting-row"
|
class="admin-setting admin-trial-setting-row"
|
||||||
class:is-dirty={isSettingDirty("TRIAL_DURATION_DAYS")}
|
class:is-dirty={isSettingDirty("TRIAL_DURATION_DAYS", settingsDirty)}
|
||||||
>
|
>
|
||||||
<div class="admin-setting-meta">
|
<div class="admin-setting-meta">
|
||||||
<strong>
|
<strong>
|
||||||
{at("tariffs_trial_days", {}, "Длительность, дней")}
|
{at("tariffs_trial_days", {}, "Длительность, дней")}
|
||||||
{#if isSettingDirty("TRIAL_DURATION_DAYS")}
|
{#if isSettingDirty("TRIAL_DURATION_DAYS", settingsDirty)}
|
||||||
<AdminBadge variant="warning"
|
<AdminBadge variant="warning"
|
||||||
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
||||||
>
|
>
|
||||||
@@ -365,10 +375,10 @@
|
|||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
step="1"
|
step="1"
|
||||||
value={valueForKey("TRIAL_DURATION_DAYS")}
|
value={valueForKey("TRIAL_DURATION_DAYS", settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting("TRIAL_DURATION_DAYS", event.currentTarget.value)}
|
oninput={(event) => setSetting("TRIAL_DURATION_DAYS", event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
{#if isSettingDirty("TRIAL_DURATION_DAYS")}
|
{#if isSettingDirty("TRIAL_DURATION_DAYS", settingsDirty)}
|
||||||
<AdminButton
|
<AdminButton
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -382,12 +392,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="admin-setting admin-trial-setting-row"
|
class="admin-setting admin-trial-setting-row"
|
||||||
class:is-dirty={isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB")}
|
class:is-dirty={isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB", settingsDirty)}
|
||||||
>
|
>
|
||||||
<div class="admin-setting-meta">
|
<div class="admin-setting-meta">
|
||||||
<strong>
|
<strong>
|
||||||
{at("tariffs_trial_traffic", {}, "Лимит трафика, GB")}
|
{at("tariffs_trial_traffic", {}, "Лимит трафика, GB")}
|
||||||
{#if isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB")}
|
{#if isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB", settingsDirty)}
|
||||||
<AdminBadge variant="warning"
|
<AdminBadge variant="warning"
|
||||||
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
||||||
>
|
>
|
||||||
@@ -401,11 +411,11 @@
|
|||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
step="0.1"
|
step="0.1"
|
||||||
value={valueForKey("TRIAL_TRAFFIC_LIMIT_GB")}
|
value={valueForKey("TRIAL_TRAFFIC_LIMIT_GB", settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) =>
|
oninput={(event) =>
|
||||||
setSetting("TRIAL_TRAFFIC_LIMIT_GB", event.currentTarget.value)}
|
setSetting("TRIAL_TRAFFIC_LIMIT_GB", event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
{#if isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB")}
|
{#if isSettingDirty("TRIAL_TRAFFIC_LIMIT_GB", settingsDirty)}
|
||||||
<AdminButton
|
<AdminButton
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -420,7 +430,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="admin-settings-field-group" class:is-dirty={dirtyCount(TRIAL_RESET_KEYS)}>
|
<section
|
||||||
|
class="admin-settings-field-group"
|
||||||
|
class:is-dirty={dirtyCount(TRIAL_RESET_KEYS, settingsDirty)}
|
||||||
|
>
|
||||||
<header class="admin-settings-field-group-head">
|
<header class="admin-settings-field-group-head">
|
||||||
<div class="admin-settings-field-group-head-copy">
|
<div class="admin-settings-field-group-head-copy">
|
||||||
<strong>{at("tariffs_trial_group_reset", {}, "Сброс трафика")}</strong>
|
<strong>{at("tariffs_trial_group_reset", {}, "Сброс трафика")}</strong>
|
||||||
@@ -432,12 +445,12 @@
|
|||||||
)}
|
)}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{#if dirtyCount(TRIAL_RESET_KEYS)}
|
{#if dirtyCount(TRIAL_RESET_KEYS, settingsDirty)}
|
||||||
<AdminBadge variant="warning">
|
<AdminBadge variant="warning">
|
||||||
{at(
|
{at(
|
||||||
"settings_dirty_count",
|
"settings_dirty_count",
|
||||||
{ count: dirtyCount(TRIAL_RESET_KEYS) },
|
{ count: dirtyCount(TRIAL_RESET_KEYS, settingsDirty) },
|
||||||
`Изменений: ${dirtyCount(TRIAL_RESET_KEYS)}`
|
`Изменений: ${dirtyCount(TRIAL_RESET_KEYS, settingsDirty)}`
|
||||||
)}
|
)}
|
||||||
</AdminBadge>
|
</AdminBadge>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -445,12 +458,12 @@
|
|||||||
<div class="admin-settings-field-group-body">
|
<div class="admin-settings-field-group-body">
|
||||||
<div
|
<div
|
||||||
class="admin-setting admin-trial-setting-row"
|
class="admin-setting admin-trial-setting-row"
|
||||||
class:is-dirty={isSettingDirty("TRIAL_TRAFFIC_STRATEGY")}
|
class:is-dirty={isSettingDirty("TRIAL_TRAFFIC_STRATEGY", settingsDirty)}
|
||||||
>
|
>
|
||||||
<div class="admin-setting-meta">
|
<div class="admin-setting-meta">
|
||||||
<strong>
|
<strong>
|
||||||
{at("tariffs_trial_strategy", {}, "Стратегия сброса трафика")}
|
{at("tariffs_trial_strategy", {}, "Стратегия сброса трафика")}
|
||||||
{#if isSettingDirty("TRIAL_TRAFFIC_STRATEGY")}
|
{#if isSettingDirty("TRIAL_TRAFFIC_STRATEGY", settingsDirty)}
|
||||||
<AdminBadge variant="warning"
|
<AdminBadge variant="warning"
|
||||||
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
||||||
>
|
>
|
||||||
@@ -461,12 +474,15 @@
|
|||||||
<div class="admin-setting-control">
|
<div class="admin-setting-control">
|
||||||
<AdminSelect
|
<AdminSelect
|
||||||
class="admin-setting-select"
|
class="admin-setting-select"
|
||||||
value={String(valueForKey("TRIAL_TRAFFIC_STRATEGY") || "NO_RESET")}
|
value={String(
|
||||||
|
valueForKey("TRIAL_TRAFFIC_STRATEGY", settingsDirty, settingsFieldMap) ||
|
||||||
|
"NO_RESET"
|
||||||
|
)}
|
||||||
items={TRAFFIC_STRATEGY_OPTIONS}
|
items={TRAFFIC_STRATEGY_OPTIONS}
|
||||||
ariaLabel={at("tariffs_trial_strategy", {}, "Стратегия сброса трафика")}
|
ariaLabel={at("tariffs_trial_strategy", {}, "Стратегия сброса трафика")}
|
||||||
onValueChange={(value) => setSetting("TRIAL_TRAFFIC_STRATEGY", value)}
|
onValueChange={(value) => setSetting("TRIAL_TRAFFIC_STRATEGY", value)}
|
||||||
/>
|
/>
|
||||||
{#if isSettingDirty("TRIAL_TRAFFIC_STRATEGY")}
|
{#if isSettingDirty("TRIAL_TRAFFIC_STRATEGY", settingsDirty)}
|
||||||
<AdminButton
|
<AdminButton
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -481,7 +497,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="admin-settings-field-group" class:is-dirty={dirtyCount(TRIAL_SQUAD_KEYS)}>
|
<section
|
||||||
|
class="admin-settings-field-group"
|
||||||
|
class:is-dirty={dirtyCount(TRIAL_SQUAD_KEYS, settingsDirty)}
|
||||||
|
>
|
||||||
<header class="admin-settings-field-group-head">
|
<header class="admin-settings-field-group-head">
|
||||||
<div class="admin-settings-field-group-head-copy">
|
<div class="admin-settings-field-group-head-copy">
|
||||||
<strong>{at("tariffs_trial_group_squads", {}, "Сквады")}</strong>
|
<strong>{at("tariffs_trial_group_squads", {}, "Сквады")}</strong>
|
||||||
@@ -493,12 +512,12 @@
|
|||||||
)}
|
)}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{#if dirtyCount(TRIAL_SQUAD_KEYS)}
|
{#if dirtyCount(TRIAL_SQUAD_KEYS, settingsDirty)}
|
||||||
<AdminBadge variant="warning">
|
<AdminBadge variant="warning">
|
||||||
{at(
|
{at(
|
||||||
"settings_dirty_count",
|
"settings_dirty_count",
|
||||||
{ count: dirtyCount(TRIAL_SQUAD_KEYS) },
|
{ count: dirtyCount(TRIAL_SQUAD_KEYS, settingsDirty) },
|
||||||
`Изменений: ${dirtyCount(TRIAL_SQUAD_KEYS)}`
|
`Изменений: ${dirtyCount(TRIAL_SQUAD_KEYS, settingsDirty)}`
|
||||||
)}
|
)}
|
||||||
</AdminBadge>
|
</AdminBadge>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -506,12 +525,12 @@
|
|||||||
<div class="admin-settings-field-group-body">
|
<div class="admin-settings-field-group-body">
|
||||||
<div
|
<div
|
||||||
class="admin-setting admin-trial-setting-row"
|
class="admin-setting admin-trial-setting-row"
|
||||||
class:is-dirty={isSettingDirty("TRIAL_SQUAD_UUIDS")}
|
class:is-dirty={isSettingDirty("TRIAL_SQUAD_UUIDS", settingsDirty)}
|
||||||
>
|
>
|
||||||
<div class="admin-setting-meta">
|
<div class="admin-setting-meta">
|
||||||
<strong>
|
<strong>
|
||||||
{at("tariffs_trial_squads", {}, "Internal Squads для триала")}
|
{at("tariffs_trial_squads", {}, "Internal Squads для триала")}
|
||||||
{#if isSettingDirty("TRIAL_SQUAD_UUIDS")}
|
{#if isSettingDirty("TRIAL_SQUAD_UUIDS", settingsDirty)}
|
||||||
<AdminBadge variant="warning"
|
<AdminBadge variant="warning"
|
||||||
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
>{at("settings_badge_dirty", {}, "Изменено")}</AdminBadge
|
||||||
>
|
>
|
||||||
@@ -542,11 +561,12 @@
|
|||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={valueForKey("USER_SQUAD_UUIDS") || "uuid-a,uuid-b"}
|
placeholder={valueForKey("USER_SQUAD_UUIDS", settingsDirty, settingsFieldMap) ||
|
||||||
value={valueForKey("TRIAL_SQUAD_UUIDS")}
|
"uuid-a,uuid-b"}
|
||||||
|
value={valueForKey("TRIAL_SQUAD_UUIDS", settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting("TRIAL_SQUAD_UUIDS", event.currentTarget.value)}
|
oninput={(event) => setSetting("TRIAL_SQUAD_UUIDS", event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
{#if isSettingDirty("TRIAL_SQUAD_UUIDS")}
|
{#if isSettingDirty("TRIAL_SQUAD_UUIDS", settingsDirty)}
|
||||||
<AdminButton
|
<AdminButton
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -557,7 +577,7 @@
|
|||||||
</AdminButton>
|
</AdminButton>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="admin-chip-list">
|
<div class="admin-chip-list">
|
||||||
{#each csvList("TRIAL_SQUAD_UUIDS") as uuid}
|
{#each csvList("TRIAL_SQUAD_UUIDS", settingsDirty, settingsFieldMap) as uuid}
|
||||||
<button type="button" class="admin-chip" onclick={() => removeTrialSquad(uuid)}>
|
<button type="button" class="admin-chip" onclick={() => removeTrialSquad(uuid)}>
|
||||||
{trialSquadLabel(uuid)}
|
{trialSquadLabel(uuid)}
|
||||||
<X size={12} />
|
<X size={12} />
|
||||||
@@ -775,7 +795,7 @@
|
|||||||
<strong>{months} {at("months_short", {}, "mo")}</strong>
|
<strong>{months} {at("months_short", {}, "mo")}</strong>
|
||||||
<div class="admin-setting-switch">
|
<div class="admin-setting-switch">
|
||||||
<Switch.Root
|
<Switch.Root
|
||||||
checked={boolValue(enabledKey)}
|
checked={boolValue(enabledKey, settingsDirty, settingsFieldMap)}
|
||||||
onCheckedChange={(checked) => setSetting(enabledKey, checked)}
|
onCheckedChange={(checked) => setSetting(enabledKey, checked)}
|
||||||
class="admin-switch-root"
|
class="admin-switch-root"
|
||||||
>
|
>
|
||||||
@@ -787,7 +807,7 @@
|
|||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
step="1"
|
step="1"
|
||||||
value={valueForKey(rubKey)}
|
value={valueForKey(rubKey, settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting(rubKey, event.currentTarget.value)}
|
oninput={(event) => setSetting(rubKey, event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
@@ -795,7 +815,7 @@
|
|||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
step="1"
|
step="1"
|
||||||
value={valueForKey(starsKey)}
|
value={valueForKey(starsKey, settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting(starsKey, event.currentTarget.value)}
|
oninput={(event) => setSetting(starsKey, event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -809,7 +829,7 @@
|
|||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={valueForKey("TRAFFIC_PACKAGES")}
|
value={valueForKey("TRAFFIC_PACKAGES", settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting("TRAFFIC_PACKAGES", event.currentTarget.value)}
|
oninput={(event) => setSetting("TRAFFIC_PACKAGES", event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
@@ -821,7 +841,7 @@
|
|||||||
<input
|
<input
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={valueForKey("STARS_TRAFFIC_PACKAGES")}
|
value={valueForKey("STARS_TRAFFIC_PACKAGES", settingsDirty, settingsFieldMap)}
|
||||||
oninput={(event) => setSetting("STARS_TRAFFIC_PACKAGES", event.currentTarget.value)}
|
oninput={(event) => setSetting("STARS_TRAFFIC_PACKAGES", event.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -467,6 +467,21 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
if (Object.prototype.hasOwnProperty.call(updates, "WEBAPP_FAVICON_USE_CUSTOM")) {
|
if (Object.prototype.hasOwnProperty.call(updates, "WEBAPP_FAVICON_USE_CUSTOM")) {
|
||||||
DEV_MOCK.config.faviconUseCustom = Boolean(updates.WEBAPP_FAVICON_USE_CUSTOM);
|
DEV_MOCK.config.faviconUseCustom = Boolean(updates.WEBAPP_FAVICON_USE_CUSTOM);
|
||||||
}
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(updates, "TRIAL_ENABLED")) {
|
||||||
|
DEV_MOCK.config.trialEnabled = Boolean(updates.TRIAL_ENABLED);
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(updates, "TRIAL_DURATION_DAYS")) {
|
||||||
|
DEV_MOCK.config.trialDurationDays = updates.TRIAL_DURATION_DAYS;
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(updates, "TRIAL_TRAFFIC_LIMIT_GB")) {
|
||||||
|
DEV_MOCK.config.trialTrafficLimitGb = updates.TRIAL_TRAFFIC_LIMIT_GB;
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(updates, "TRIAL_TRAFFIC_STRATEGY")) {
|
||||||
|
DEV_MOCK.config.trialTrafficStrategy = updates.TRIAL_TRAFFIC_STRATEGY || "NO_RESET";
|
||||||
|
}
|
||||||
|
if (Object.prototype.hasOwnProperty.call(updates, "TRIAL_SQUAD_UUIDS")) {
|
||||||
|
DEV_MOCK.config.trialSquadUuids = updates.TRIAL_SQUAD_UUIDS || "";
|
||||||
|
}
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
void _e;
|
void _e;
|
||||||
}
|
}
|
||||||
@@ -634,7 +649,7 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
section: "pricing",
|
section: "pricing",
|
||||||
subsection: "trial",
|
subsection: "trial",
|
||||||
label: "Триал включён",
|
label: "Триал включён",
|
||||||
value: true,
|
value: Boolean(DEV_MOCK.config.trialEnabled),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "TRIAL_DURATION_DAYS",
|
key: "TRIAL_DURATION_DAYS",
|
||||||
@@ -642,7 +657,7 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
section: "pricing",
|
section: "pricing",
|
||||||
subsection: "trial",
|
subsection: "trial",
|
||||||
label: "Длительность триала (дней)",
|
label: "Длительность триала (дней)",
|
||||||
value: 3,
|
value: DEV_MOCK.config.trialDurationDays ?? 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "TRIAL_TRAFFIC_LIMIT_GB",
|
key: "TRIAL_TRAFFIC_LIMIT_GB",
|
||||||
@@ -650,7 +665,7 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
section: "pricing",
|
section: "pricing",
|
||||||
subsection: "trial",
|
subsection: "trial",
|
||||||
label: "Лимит трафика триала (ГБ)",
|
label: "Лимит трафика триала (ГБ)",
|
||||||
value: 5,
|
value: DEV_MOCK.config.trialTrafficLimitGb ?? 5,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "TRIAL_TRAFFIC_STRATEGY",
|
key: "TRIAL_TRAFFIC_STRATEGY",
|
||||||
@@ -658,7 +673,7 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
section: "pricing",
|
section: "pricing",
|
||||||
subsection: "trial",
|
subsection: "trial",
|
||||||
label: "Стратегия сброса трафика триала",
|
label: "Стратегия сброса трафика триала",
|
||||||
value: "NO_RESET",
|
value: DEV_MOCK.config.trialTrafficStrategy || "NO_RESET",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "TRIAL_SQUAD_UUIDS",
|
key: "TRIAL_SQUAD_UUIDS",
|
||||||
@@ -666,7 +681,7 @@ export async function mockApi(path, options = {}, context = {}) {
|
|||||||
section: "pricing",
|
section: "pricing",
|
||||||
subsection: "trial",
|
subsection: "trial",
|
||||||
label: "Internal Squads для триала",
|
label: "Internal Squads для триала",
|
||||||
value: "2f2f6e0a-1f2d-4e80-a33b-0ebf3a409012",
|
value: DEV_MOCK.config.trialSquadUuids || "",
|
||||||
},
|
},
|
||||||
...[
|
...[
|
||||||
["MONTH_1_ENABLED", "bool", true],
|
["MONTH_1_ENABLED", "bool", true],
|
||||||
|
|||||||
@@ -208,6 +208,11 @@ export const DEV_MOCK = {
|
|||||||
logoEmojiFont: "system",
|
logoEmojiFont: "system",
|
||||||
faviconUrl: "/webapp-favicon/19b2a242e5b7bc2d/icon-180.png",
|
faviconUrl: "/webapp-favicon/19b2a242e5b7bc2d/icon-180.png",
|
||||||
faviconUseCustom: false,
|
faviconUseCustom: false,
|
||||||
|
trialEnabled: true,
|
||||||
|
trialDurationDays: 3,
|
||||||
|
trialTrafficLimitGb: 5,
|
||||||
|
trialTrafficStrategy: "NO_RESET",
|
||||||
|
trialSquadUuids: "2f2f6e0a-1f2d-4e80-a33b-0ebf3a409012",
|
||||||
apiBase: "/api",
|
apiBase: "/api",
|
||||||
adminJsAsset: "subscription_webapp_admin.js",
|
adminJsAsset: "subscription_webapp_admin.js",
|
||||||
adminCssAsset: "subscription_webapp_admin.css",
|
adminCssAsset: "subscription_webapp_admin.css",
|
||||||
|
|||||||
Reference in New Issue
Block a user