feat(modal): add rollout telemetry foundation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-08-04 21:23:04 +08:00
1 parent 8b728295a9
commit 113a6bcab0
14 files changed
+320 -1

No files matched your search

+1
View File
@@ -18,6 +18,7 @@ class SchemaTools {
'health' => SchemaToolsHealth::build(),
'backup' => SchemaToolsBackup::build(),
'email-rollback' => SchemaToolsEmailRollback::build(),
'modal-rollout' => SchemaToolsModalRollout::build(),
],
];
}
@@ -0,0 +1,56 @@
<?php
/**
* @package AKSRT
*/
namespace AKSRT\Admin\Schema;
defined('ABSPATH') || exit;
class SchemaToolsModalRollout {
public static function build(): array {
return [
'key' => 'modal-rollout',
'title' => '前台弹窗灰度',
'version' => '1.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
[
'key' => 'modal-rollout',
'title' => '弹窗新流程开关',
'fields' => [
[
'key' => 'frontend_modal_rollout_identity',
'label' => '官方认证新流程',
'type' => 'switch',
'default' => false,
'help' => '启用统一弹窗运行时与认证快照流程。',
],
[
'key' => 'frontend_modal_rollout_badges',
'label' => '徽章新流程',
'type' => 'switch',
'default' => false,
'help' => '启用统一 JSON 徽章流程和短缓存。',
],
[
'key' => 'frontend_modal_rollout_orders',
'label' => '订单新流程',
'type' => 'switch',
'default' => false,
'help' => '启用订单详情快速开壳与状态同步流程。',
],
[
'key' => 'frontend_modal_rollout_vip',
'label' => '会员支付新流程',
'type' => 'switch',
'default' => false,
'help' => '启用统一会员购买、支付和结果同步流程。',
],
],
],
],
];
}
}
+2
View File
@@ -17,6 +17,8 @@ class ToolsController extends ControllerBase {
}
public function register_routes(): void {
$this->register_section_routes('tools', 'tools');
// Health: email verification status
register_rest_route(self::API_NAMESPACE, '/health/email-verification', [
'methods' => 'GET',
+7
View File
@@ -127,6 +127,7 @@ trait ScriptsPart1c {
'aksrt-core-comment-move' => 'comment-move-form.js',
// Shared zibll-parity list/modal engines (before pagination consumers).
'aksrt-core-ajax-list' => 'ajax-list.js',
'aksrt-core-modal-telemetry' => 'modal-telemetry.js',
'aksrt-core-remote-modal' => 'remote-modal.js',
'aksrt-core-pagination' => 'pagination.js',
'aksrt-core-archive' => 'archive.js',
@@ -560,6 +561,12 @@ trait ScriptsPart1c {
'restUrl' => esc_url_raw(rest_url('aksrt/v1')),
// Alias used by modal-auth / follow / report (same value as restUrl).
'apiUrl' => esc_url_raw(rest_url('aksrt/v1')),
'modalRollout' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_frontend_modal_rollout_settings() : [
'identity' => false,
'badges' => false,
'orders' => false,
'vip' => false,
],
'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'],
'badgeShow' => class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_post_list_style_settings()['badge_show'] : true,
+9
View File
@@ -178,4 +178,13 @@ trait DomainGroups {
public static function get_system_tools_settings(): array {
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();
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* Frontend modal runtime settings.
*
* @package AKSRT
*/
namespace AKSRT\Settings;
defined('ABSPATH') || exit;
class ModalRuntime {
/**
* Read the per-domain frontend modal rollout switches.
*
* @return array{identity:bool,badges:bool,orders:bool,vip:bool}
*/
public static function get_frontend_modal_rollout_settings(): array {
$settings = Settings::get_all();
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']),
];
}
}