path . 'build/index.asset.php'; if ( ! is_readable( $asset_file ) ) { return; } $asset = require $asset_file; $deps = is_array( $asset['dependencies'] ?? null ) ? $asset['dependencies'] : array(); wp_enqueue_script( self::HANDLE, $this->url . 'build/index.js', array_merge( $deps, array( AdminPage::SCRIPT_HANDLE ) ), (string) ( $asset['version'] ?? ADAFWC_VERSION ), true ); if ( is_readable( $this->path . 'build/style-index.css' ) ) { wp_enqueue_style( self::HANDLE, $this->url . 'build/style-index.css', array(), (string) ( $asset['version'] ?? ADAFWC_VERSION ) ); // The build writes style-index-rtl.css beside it. wp_style_add_data( self::HANDLE, 'rtl', 'replace' ); } wp_add_inline_script( self::HANDLE, 'window.adafwcAdmin = ' . wp_json_encode( self::config() ) . ';', 'before' ); wp_set_script_translations( self::HANDLE, 'agentic-daisy-ai-agent-firewall-for-woocommerce', $this->path . 'languages' ); } /** * What the screens need to show money, and what this user may do. * * @return array */ private static function config(): array { $currency = new StoreCurrency(); return array( 'currency' => $currency->base(), 'decimals' => $currency->decimals(), 'locale' => str_replace( '_', '-', get_user_locale() ), 'canManage' => current_user_can( 'manage_woocommerce' ), ); } }