array( 'label' => __('Pricing batch (REST)', 'ai-eshop-optimizer'), 'desc' => __('Batch effective-price lookup via /aieo/v1/pricing/batch. Read-only; safe to leave on.', 'ai-eshop-optimizer'), ), 'wishlist' => array( 'label' => __('Wishlist heart', 'ai-eshop-optimizer'), 'desc' => __('Heart toggle, optimistic paint with rollback, cookie sync, multi-heart sync, "See your favourites" label.', 'ai-eshop-optimizer'), ), 'waitlist' => array( 'label' => __('Waitlist', 'ai-eshop-optimizer'), 'desc' => __('"Notify me when back in stock" form: email validation, loading overlay, WC variation integration.', 'ai-eshop-optimizer'), ), 'complementary' => array( 'label' => __('Complementary products', 'ai-eshop-optimizer'), 'desc' => __('Multi-checkbox batch add-to-cart. Routes fragments through the IAPI cart store.', 'ai-eshop-optimizer'), ), 'reco' => array( 'label' => __('Recommendations (events only)', 'ai-eshop-optimizer'), 'desc' => __('No standalone shim — emits aieo:reco:rendered after each section mounts. Per-card UI lives in the wishlist/swatches modules.', 'ai-eshop-optimizer'), ), 'ratings' => array( 'label' => __('Star ratings', 'ai-eshop-optimizer'), 'desc' => __('5-star product rating widget with per-product aggregate. Optimistic paint + rollback, batch REST hydration on archives, anonymous-cookie scoping.', 'ai-eshop-optimizer'), ), 'swatches' => array( 'label' => __('Swatches', 'ai-eshop-optimizer'), 'desc' => __('Single-select hydration only. Multi-select / quick-view modal / cart-sync markers NOT IMPLEMENTED — see ROADMAP.md, Phase C-θ.', 'ai-eshop-optimizer'), ), 'sticky_atc' => array( 'label' => __('Sticky add-to-cart', 'ai-eshop-optimizer'), 'desc' => __('IO-based visibility + cart-store add. Multi-select sticky / persistent sticky / smart auto-pick NOT IMPLEMENTED — Phase C-ι.', 'ai-eshop-optimizer'), ), 'side_cart' => array( 'label' => __('Side cart', 'ai-eshop-optimizer'), 'desc' => __('The whole drawer: the cart, the recommendation rails, recently viewed, favourites, quick view with variation dropdowns, the free-gift pickers and the product form\'s AJAX add. The default on block themes.', 'ai-eshop-optimizer'), ), ); } private function module_statuses() { if (method_exists('AIEO_DMM', 'get_iapi_module_statuses')) { return AIEO_DMM::get_iapi_module_statuses(); } return array(); } public function render_page() { if (!current_user_can(self::CAPABILITY)) { wp_die(esc_html__('You do not have permission to access this page.', 'ai-eshop-optimizer')); } if (class_exists('AIEO_Chrome') && AIEO_Chrome::on() && method_exists('\Rooster\Admin\Board', 'page')) { \Rooster\Admin\Board::page(array($this, 'render_body')); return; } $this->render_body(); } public function render_body() { $master_on = (bool) get_option('rooster_iapi_enabled', get_option('roosterx_iapi_enabled', false)); $modules = $this->modules(); $statuses = $this->module_statuses(); $saved = isset($_GET['aieo_iapi_saved']) && $_GET['aieo_iapi_saved'] === '1'; $tones = array('production' => 'success', 'scaffold' => 'warning'); echo '
' . esc_html__('DevTools console one-liners:', 'ai-eshop-optimizer') . '
'; echo '' . esc_html("// after adding to cart on the frontend:\naieo.iapi.stores.cart.state.fragments\n\n// pricing batch round-trip:\naieo.iapi.stores.pricing.actions.prefetch([487390])\n .then(() => aieo.iapi.stores.pricing.state.effectivePrice)\n\n// wishlist state:\naieo.iapi.stores.wishlist.state.productIds") . '';
echo $close;
$runtime_dir = defined('AIEO_RUNTIME_DIR') ? AIEO_RUNTIME_DIR : '';
if ($runtime_dir) {
list($open, $close) = AIEO_DMM_UI::card(array(
'anchor' => 'iapi-docs',
'icon' => 'book-open',
'title' => __('Docs', 'ai-eshop-optimizer'),
));
echo $open;
echo '' . wp_kses_post(sprintf(
__('Companion docs live in the runtime plugin: %s', 'ai-eshop-optimizer'),
'' . esc_html($runtime_dir) . ''
)) . '