esc_url_raw( rest_url( RestController::NAMESPACE_V1 . '/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'configured' => $configured, 'configError' => $configured ? null : Settings::configError(), 'environment' => Settings::environment(), 'enableLogging' => (bool) $settings['enable_logging'], 'logoUrl' => SABLEPAY_PLUGIN_URL . 'assets/images/sablepay-logo.png', 'version' => \SablePay\SdkVersion::NAME, ); /** * Filter the public browser config (window.SablePayWP). Never add secrets. * * @param array $config Config. */ return apply_filters( 'sablepay_client_config', $config ); } /** * Enqueue the browser SDK. Safe to call from shortcodes / templates. */ public static function enqueue() { if ( ! did_action( 'wp_enqueue_scripts' ) && ! did_action( 'admin_enqueue_scripts' ) && ! doing_action( 'wp_enqueue_scripts' ) ) { // Too early: enqueue once scripts are being registered. add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue' ), 20 ); return; } self::registerScripts(); wp_enqueue_script( 'sablepay' ); } }