| @@ -10,9 +10,8 @@ | ||
| 10 | 10 | |
| 11 | 11 | namespace SureDonation\Inc\Shortcodes; |
| 12 | 12 | |
| 13 | 13 | use SureDonation\Inc\Fields\Form_Renderer; |
| 14 | -use SureDonation\Inc\Fields\Form_Styling; | |
| 15 | 14 | use SureDonation\Inc\Helper; |
| 16 | 15 | use SureDonation\Inc\Post_Types\Donation_Form as Donation_Form_CPT; |
| 17 | 16 | use SureDonation\Inc\Traits\Get_Instance; |
| 18 | 17 | |
| @@ -106,16 +105,10 @@ | ||
| 106 | 105 | * @return void |
| 107 | 106 | * @since 0.0.1 |
| 108 | 107 | */ |
| 109 | 108 | private function enqueue_assets( $form_id, $form ) { |
| 110 | - // Enqueue the shared compiled frontend stylesheet (same handle the block | |
| 111 | - // uses). Skipped when the form has default styling disabled — the site's | |
| 112 | - // own CSS then controls the appearance. Scripts are always loaded so | |
| 113 | - // payment and validation keep working. The enqueue is additive across | |
| 114 | - // forms on a page, so a styled form still loads the stylesheet. | |
| 115 | - if ( ! Form_Styling::is_default_styling_disabled( $form_id ) ) { | |
| 116 | - wp_enqueue_style( 'suredonation-donation-form' ); | |
| 117 | - } | |
| 109 | + // Enqueue the shared compiled frontend stylesheet (same handle the block uses). | |
| 110 | + wp_enqueue_style( 'suredonation-donation-form' ); | |
| 118 | 111 | |
| 119 | 112 | // Enqueue frontend script (registered globally in Assets\Register). |
| 120 | 113 | wp_enqueue_script( 'suredonation-form-frontend' ); |
| 121 | 114 | |
| @@ -136,10 +129,9 @@ | ||
| 136 | 129 | |
| 137 | 130 | // Enqueue Stripe.js if Stripe is configured. |
| 138 | 131 | $this->maybe_enqueue_stripe(); |
| 139 | 132 | |
| 140 | - // Allow payment gateway extensions to enqueue their scripts and localize | |
| 141 | - // their frontend configuration (see the action's docblock in block.php). | |
| 133 | + // Allow payment gateway extensions to enqueue their scripts (e.g., PayPal SDK). | |
| 142 | 134 | do_action( 'suredonation_enqueue_form_frontend_scripts', $form_id, $form->post_content ); |
| 143 | 135 | } |
| 144 | 136 | |
| 145 | 137 | /** |
| @@ -152,11 +144,11 @@ | ||
| 152 | 144 | if ( ! class_exists( 'SureDonation\Inc\Payments\Stripe\Stripe_Helper' ) ) { |
| 153 | 145 | return; |
| 154 | 146 | } |
| 155 | 147 | |
| 156 | - // Load Stripe.js when any connected account exists; the per-form | |
| 157 | - // publishable key is passed to the frontend via the payment block markup. | |
| 158 | - if ( \SureDonation\Inc\Payments\Stripe\Stripe_Helper::is_stripe_connected() ) { | |
| 148 | + $publishable_key = \SureDonation\Inc\Payments\Stripe\Stripe_Helper::get_stripe_publishable_key(); | |
| 149 | + | |
| 150 | + if ( ! empty( $publishable_key ) ) { | |
| 159 | 151 | wp_enqueue_script( |
| 160 | 152 | 'stripe-js', |
| 161 | 153 | 'https://js.stripe.com/v3/', |
| 162 | 154 | [], |