| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | use FluentBooking\App\Services\BookingService; |
| 13 | 13 | use FluentBooking\App\Services\Helper; |
| 14 | 14 | use FluentBooking\Framework\Support\Arr; |
| 15 | 15 | use FluentBooking\Framework\Support\Collection; |
| 16 | +use FluentBooking\App\Vite; | |
| 16 | 17 | |
| 17 | 18 | class LandingPageHandler |
| 18 | 19 | { |
| 19 | 20 | public function boot() |
| @@ -153,9 +154,8 @@ | ||
| 153 | 154 | $activeEvent->locations = $activeEvent->defaultLocationHtml(); |
| 154 | 155 | do_action_ref_array('fluent_booking/landing_page_event', [&$activeEvent]); |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | - $assetUrl = App::getInstance('url.assets'); | |
| 158 | 158 | $data = [ |
| 159 | 159 | 'calendar' => $calendar, |
| 160 | 160 | 'events' => $activeEvents, |
| 161 | 161 | 'author' => $authorProfile, |
| @@ -163,16 +163,16 @@ | ||
| 163 | 163 | 'description' => $metaDescription, |
| 164 | 164 | 'url' => home_url($wp->request), |
| 165 | 165 | 'embedded' => isset($_GET['embedded']) ? true : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 166 | 166 | 'css_files' => [ |
| 167 | - App::getInstance('url.assets') . 'public/saas.css' | |
| 167 | + Vite::styleUrl('saas_css') | |
| 168 | 168 | ], |
| 169 | 169 | 'js_files' => [ |
| 170 | - 'fluent-booking-public-js' => $assetUrl . 'public/js/app.js', | |
| 170 | + 'fluent-booking-public-js' => Vite::scriptUrl('public_app'), | |
| 171 | 171 | ], |
| 172 | 172 | 'js_vars' => $jsVars, |
| 173 | 173 | 'header_js_files' => [ |
| 174 | - 'fluent_booking_team_app-js' => $assetUrl. 'public/js/team_app.js' | |
| 174 | + 'fluent_booking_team_app-js' => Vite::scriptUrl('team_app') | |
| 175 | 175 | ] |
| 176 | 176 | ]; |
| 177 | 177 | |
| 178 | 178 | if ($extraJsFiles) { |
| @@ -228,12 +228,10 @@ | ||
| 228 | 228 | $assetUrl = App::getInstance('url.assets'); |
| 229 | 229 | |
| 230 | 230 | $eventVars = (new FrontEndHandler())->getCalendarEventVars($calendar, $calendarEvent); |
| 231 | 231 | |
| 232 | - $isRtl = Helper::fluentbooking_is_rtl(); | |
| 232 | + $publicCss = 'saas_css'; | |
| 233 | 233 | |
| 234 | - $publicCss = $isRtl ? 'public/saas-rtl.css' : 'public/saas.css'; | |
| 235 | - | |
| 236 | 234 | $title = $calendarEvent->title . ' ' . __('with', 'fluent-booking') . ' ' . $authorProfile['name']; |
| 237 | 235 | |
| 238 | 236 | $title = apply_filters('fluent_booking/booking_confirmation_page_title', $title, $calendarEvent, $authorProfile); |
| 239 | 237 | |
| @@ -245,12 +243,12 @@ | ||
| 245 | 243 | 'description' => substr(strip_shortcodes(wp_strip_all_tags(str_replace(PHP_EOL, ' ', $calendarEvent->description))), 0, 300) . '...', |
| 246 | 244 | 'url' => home_url($wp->request), |
| 247 | 245 | 'embedded' => isset($_GET['embedded']) ? true : false, // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 248 | 246 | 'css_files' => [ |
| 249 | - $assetUrl . $publicCss | |
| 247 | + Vite::styleUrl($publicCss) | |
| 250 | 248 | ], |
| 251 | 249 | 'js_files' => [ |
| 252 | - 'fluent-booking-public-js' => $assetUrl . 'public/js/app.js', | |
| 250 | + 'fluent-booking-public-js' => Vite::scriptUrl('public_app'), | |
| 253 | 251 | ], |
| 254 | 252 | 'js_vars' => [ |
| 255 | 253 | 'fluentCalendarPublicVars' => (new FrontEndHandler())->getGlobalVars(), |
| 256 | 254 | 'fcal_public_vars_' . $calendar->id . '_' . $calendarEvent->id => $eventVars, |
| @@ -314,12 +312,9 @@ | ||
| 314 | 312 | $responseHtml = BookingService::getBookingConfirmationHtml($booking, $actionType); |
| 315 | 313 | |
| 316 | 314 | $authorProfile = $calendarEvent->getAuthorProfile(true); |
| 317 | 315 | |
| 318 | - $publicCss = 'public/saas_public.css'; | |
| 319 | - if (Helper::fluentbooking_is_rtl()) { | |
| 320 | - $publicCss = 'public/saas_public-rtl.css'; | |
| 321 | - } | |
| 316 | + $publicCss = 'saas_public_css'; | |
| 322 | 317 | |
| 323 | 318 | $data = [ |
| 324 | 319 | 'title' => __('Confirmation: ', 'fluent-booking') . $calendarEvent->title . ' ' . __('with', 'fluent-booking') . ' ' . $authorProfile['name'], |
| 325 | 320 | 'body' => $responseHtml, |
| @@ -324,9 +319,9 @@ | ||
| 324 | 319 | 'title' => __('Confirmation: ', 'fluent-booking') . $calendarEvent->title . ' ' . __('with', 'fluent-booking') . ' ' . $authorProfile['name'], |
| 325 | 320 | 'body' => $responseHtml, |
| 326 | 321 | 'description' => substr(strip_shortcodes(wp_strip_all_tags(str_replace(PHP_EOL, ' ', $calendarEvent->description))), 0, 300) . '...', |
| 327 | 322 | 'css_files' => [ |
| 328 | - App::getInstance('url.assets') . $publicCss | |
| 323 | + Vite::styleUrl($publicCss) | |
| 329 | 324 | ], |
| 330 | 325 | 'js_files' => [], |
| 331 | 326 | 'js_vars' => [], |
| 332 | 327 | 'author' => $authorProfile, |
| @@ -342,9 +337,9 @@ | ||
| 342 | 337 | ] |
| 343 | 338 | ]; |
| 344 | 339 | |
| 345 | 340 | if ($actionType == 'cancel') { |
| 346 | - $data['js_files']['fluent-booking-public-manage-meeting-js'] = App::getInstance('url.assets') . 'public/js/public-manage-meeting.js'; | |
| 341 | + $data['js_files']['fluent-booking-public-manage-meeting-js'] = Vite::scriptUrl('manage_meeting'); | |
| 347 | 342 | } |
| 348 | 343 | |
| 349 | 344 | $data = apply_filters('fluent_booking/booking_confirmation_page_vars', $data, $booking, $calendarEvent); |
| 350 | 345 | |
| @@ -463,9 +458,9 @@ | ||
| 463 | 458 | $files = []; |
| 464 | 459 | $assetUrl = App::getInstance('url.assets'); |
| 465 | 460 | |
| 466 | 461 | if (BookingFieldService::hasPhoneNumberField($formFields)) { |
| 467 | - $files['fluent-booking-phone-field-js'] = $assetUrl . 'public/js/phone-field.js'; | |
| 462 | + $files['fluent-booking-phone-field-js'] = Vite::scriptUrl('phone_field'); | |
| 468 | 463 | } |
| 469 | 464 | |
| 470 | 465 | if ($calendarEvent->type == 'paid') { |
| 471 | 466 | $files['fluent-booking-checkout-sdk-stripe-js'] = 'https://js.stripe.com/v3/'; |