fix(modal): align rollout schema contract
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
113a6bcab0
commit
1f004aea46
10 files changed
+40
-39
No files matched your search
@@ -26,14 +26,14 @@ export const toolsSection = {
|
|||||||
section: 'backup',
|
section: 'backup',
|
||||||
}),
|
}),
|
||||||
schemaPage({
|
schemaPage({
|
||||||
key: 'tools-modal-rollout',
|
key: 'tools-frontend-modal-rollout',
|
||||||
name: 'ToolsModalRollout',
|
name: 'ToolsFrontendModalRollout',
|
||||||
label: '前台弹窗灰度',
|
label: '前台弹窗灰度',
|
||||||
route: '/tools/modal-rollout',
|
route: '/tools/frontend-modal-rollout',
|
||||||
title: '前台弹窗灰度',
|
title: '前台弹窗灰度',
|
||||||
desc: '按领域控制前台弹窗新流程的分阶段发布。',
|
desc: '按领域控制前台弹窗新流程的分阶段发布。',
|
||||||
canonicalDomain: 'tools',
|
canonicalDomain: 'tools',
|
||||||
section: 'modal-rollout',
|
section: 'frontend-modal-rollout',
|
||||||
}),
|
}),
|
||||||
customPage({
|
customPage({
|
||||||
key: 'tools-health',
|
key: 'tools-health',
|
||||||
|
|||||||
+7
-7
@@ -1,17 +1,17 @@
|
|||||||
export const modalRolloutSchema = {
|
export const frontendModalRolloutSchema = {
|
||||||
key: 'tools.modal-rollout',
|
key: 'tools.frontend-modal-rollout',
|
||||||
title: '前台弹窗灰度',
|
title: '前台弹窗灰度',
|
||||||
icon: 'fas fa-bolt',
|
icon: 'fas fa-bolt',
|
||||||
description: '按领域控制前台弹窗新流程的分阶段发布。',
|
description: '按领域控制前台弹窗新流程的分阶段发布。',
|
||||||
defaults: {
|
defaults: {
|
||||||
frontend_modal_rollout_identity: false,
|
frontend_modal_rollout_identity: false,
|
||||||
frontend_modal_rollout_badges: false,
|
frontend_modal_rollout_badge: false,
|
||||||
frontend_modal_rollout_orders: false,
|
frontend_modal_rollout_order: false,
|
||||||
frontend_modal_rollout_vip: false,
|
frontend_modal_rollout_vip: false,
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
key: 'modal-rollout',
|
key: 'rollout',
|
||||||
title: '弹窗新流程开关',
|
title: '弹窗新流程开关',
|
||||||
icon: 'fas fa-toggle-on',
|
icon: 'fas fa-toggle-on',
|
||||||
fields: [
|
fields: [
|
||||||
@@ -22,13 +22,13 @@ export const modalRolloutSchema = {
|
|||||||
help: '启用统一弹窗运行时与认证快照流程。',
|
help: '启用统一弹窗运行时与认证快照流程。',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'frontend_modal_rollout_badges',
|
key: 'frontend_modal_rollout_badge',
|
||||||
label: '徽章新流程',
|
label: '徽章新流程',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
help: '启用统一 JSON 徽章流程和短缓存。',
|
help: '启用统一 JSON 徽章流程和短缓存。',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'frontend_modal_rollout_orders',
|
key: 'frontend_modal_rollout_order',
|
||||||
label: '订单新流程',
|
label: '订单新流程',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
help: '启用订单详情快速开壳与状态同步流程。',
|
help: '启用订单详情快速开壳与状态同步流程。',
|
||||||
@@ -7,12 +7,12 @@ import { importExportSchema } from './import-export.js'
|
|||||||
import { healthSchema } from './health.js'
|
import { healthSchema } from './health.js'
|
||||||
import { emailRollbackSchema } from './email-rollback.js'
|
import { emailRollbackSchema } from './email-rollback.js'
|
||||||
import { backupSchema } from './backup.js'
|
import { backupSchema } from './backup.js'
|
||||||
import { modalRolloutSchema } from './modal-rollout.js'
|
import { frontendModalRolloutSchema } from './frontend-modal-rollout.js'
|
||||||
|
|
||||||
export const toolsSchemas = {
|
export const toolsSchemas = {
|
||||||
'import-export': importExportSchema,
|
'import-export': importExportSchema,
|
||||||
health: healthSchema,
|
health: healthSchema,
|
||||||
'email-rollback': emailRollbackSchema,
|
'email-rollback': emailRollbackSchema,
|
||||||
backup: backupSchema,
|
backup: backupSchema,
|
||||||
'modal-rollout': modalRolloutSchema,
|
'frontend-modal-rollout': frontendModalRolloutSchema,
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ class SchemaTools {
|
|||||||
'health' => SchemaToolsHealth::build(),
|
'health' => SchemaToolsHealth::build(),
|
||||||
'backup' => SchemaToolsBackup::build(),
|
'backup' => SchemaToolsBackup::build(),
|
||||||
'email-rollback' => SchemaToolsEmailRollback::build(),
|
'email-rollback' => SchemaToolsEmailRollback::build(),
|
||||||
'modal-rollout' => SchemaToolsModalRollout::build(),
|
'frontend-modal-rollout' => SchemaToolsFrontendModalRollout::build(),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -7,17 +7,17 @@ namespace AKSRT\Admin\Schema;
|
|||||||
|
|
||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
class SchemaToolsModalRollout {
|
class SchemaToolsFrontendModalRollout {
|
||||||
|
|
||||||
public static function build(): array {
|
public static function build(): array {
|
||||||
return [
|
return [
|
||||||
'key' => 'modal-rollout',
|
'key' => 'frontend-modal-rollout',
|
||||||
'title' => '前台弹窗灰度',
|
'title' => '前台弹窗灰度',
|
||||||
'version' => '1.0.0',
|
'version' => '1.0.0',
|
||||||
'option_key' => 'aksrt_settings',
|
'option_key' => 'aksrt_settings',
|
||||||
'groups' => [
|
'groups' => [
|
||||||
[
|
[
|
||||||
'key' => 'modal-rollout',
|
'key' => 'rollout',
|
||||||
'title' => '弹窗新流程开关',
|
'title' => '弹窗新流程开关',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
[
|
[
|
||||||
@@ -28,14 +28,14 @@ class SchemaToolsModalRollout {
|
|||||||
'help' => '启用统一弹窗运行时与认证快照流程。',
|
'help' => '启用统一弹窗运行时与认证快照流程。',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'key' => 'frontend_modal_rollout_badges',
|
'key' => 'frontend_modal_rollout_badge',
|
||||||
'label' => '徽章新流程',
|
'label' => '徽章新流程',
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'help' => '启用统一 JSON 徽章流程和短缓存。',
|
'help' => '启用统一 JSON 徽章流程和短缓存。',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'key' => 'frontend_modal_rollout_orders',
|
'key' => 'frontend_modal_rollout_order',
|
||||||
'label' => '订单新流程',
|
'label' => '订单新流程',
|
||||||
'type' => 'switch',
|
'type' => 'switch',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
@@ -17,8 +17,6 @@ class ToolsController extends ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function register_routes(): void {
|
public function register_routes(): void {
|
||||||
$this->register_section_routes('tools', 'tools');
|
|
||||||
|
|
||||||
// Health: email verification status
|
// Health: email verification status
|
||||||
register_rest_route(self::API_NAMESPACE, '/health/email-verification', [
|
register_rest_route(self::API_NAMESPACE, '/health/email-verification', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
|
|||||||
@@ -561,11 +561,11 @@ trait ScriptsPart1c {
|
|||||||
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
|
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
|
||||||
// Alias used by modal-auth / follow / report (same value as restUrl).
|
// Alias used by modal-auth / follow / report (same value as restUrl).
|
||||||
'apiUrl' => esc_url_raw(rest_url('aksrt/v1')),
|
'apiUrl' => esc_url_raw(rest_url('aksrt/v1')),
|
||||||
'modalRollout' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_frontend_modal_rollout_settings() : [
|
'frontendModalRollout' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_frontend_modal_rollout() : [
|
||||||
'identity' => false,
|
|
||||||
'badges' => false,
|
|
||||||
'orders' => false,
|
|
||||||
'vip' => false,
|
'vip' => false,
|
||||||
|
'order' => false,
|
||||||
|
'identity' => false,
|
||||||
|
'badge' => false,
|
||||||
],
|
],
|
||||||
'stickyEnabled' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_enabled'] : true,
|
'stickyEnabled' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_enabled'] : true,
|
||||||
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_pages'] : ['home', 'cat'],
|
'stickyPages' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['sticky_pages'] : ['home', 'cat'],
|
||||||
|
|||||||
@@ -179,12 +179,4 @@ trait DomainGroups {
|
|||||||
return Capabilities::get_system_tools_settings();
|
return Capabilities::get_system_tools_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取前台弹窗按领域灰度开关。
|
|
||||||
*
|
|
||||||
* @return array{identity:bool,badges:bool,orders:bool,vip:bool}
|
|
||||||
*/
|
|
||||||
public static function get_frontend_modal_rollout_settings(): array {
|
|
||||||
return ModalRuntime::get_frontend_modal_rollout_settings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -9,21 +9,21 @@ namespace AKSRT\Settings;
|
|||||||
|
|
||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
class ModalRuntime {
|
class FrontendModalRuntime {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the per-domain frontend modal rollout switches.
|
* Read the per-domain frontend modal rollout switches.
|
||||||
*
|
*
|
||||||
* @return array{identity:bool,badges:bool,orders:bool,vip:bool}
|
* @return array{vip:bool,order:bool,identity:bool,badge:bool}
|
||||||
*/
|
*/
|
||||||
public static function get_frontend_modal_rollout_settings(): array {
|
public static function get_frontend_modal_rollout(): array {
|
||||||
$settings = Settings::get_all();
|
$settings = Settings::get_all();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'identity' => !empty($settings['frontend_modal_rollout_identity']),
|
|
||||||
'badges' => !empty($settings['frontend_modal_rollout_badges']),
|
|
||||||
'orders' => !empty($settings['frontend_modal_rollout_orders']),
|
|
||||||
'vip' => !empty($settings['frontend_modal_rollout_vip']),
|
'vip' => !empty($settings['frontend_modal_rollout_vip']),
|
||||||
|
'order' => !empty($settings['frontend_modal_rollout_order']),
|
||||||
|
'identity' => !empty($settings['frontend_modal_rollout_identity']),
|
||||||
|
'badge' => !empty($settings['frontend_modal_rollout_badge']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,6 +526,17 @@ class Settings {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取前台弹窗按领域灰度开关。
|
||||||
|
*
|
||||||
|
* @return array{vip:bool,order:bool,identity:bool,badge:bool}
|
||||||
|
*/
|
||||||
|
public static function get_frontend_modal_rollout(): array {
|
||||||
|
return FrontendModalRuntime::get_frontend_modal_rollout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取侧边栏配置
|
* 获取侧边栏配置
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user