| @@ -342,15 +342,23 @@ | ||
| 342 | 342 | Vite::enqueueStyle('fluentcart-customer-css', |
| 343 | 343 | 'public/customer-profile/style/customer-profile.scss' |
| 344 | 344 | ); |
| 345 | 345 | |
| 346 | + // wp-i18n: this bundle pulls in the admin translator transitively | |
| 347 | + // (Start.js -> @/Bits/common.js -> @/utils/translator/Translator.js), | |
| 348 | + // which resolves strings through window.wp.i18n. | |
| 346 | 349 | Vite::enqueueScript( |
| 347 | 350 | 'fluentcart-customer-js', |
| 348 | 351 | 'public/customer-profile/Start.js', |
| 349 | - [] | |
| 352 | + ['wp-i18n'] | |
| 350 | 353 | )->with(CustomerProfileHandler::getLocalizationData()); |
| 351 | 354 | |
| 352 | - //will add script here/ skipping for now | |
| 355 | + /** | |
| 356 | + * Enqueue additional customer-dashboard assets — the hook an add-on | |
| 357 | + * uses to ship the JS backing a portal section it registers through | |
| 358 | + * `fluent_cart/customer_portal/profile_sections`. | |
| 359 | + */ | |
| 360 | + do_action('fluent_cart/customer_dashboard/enqueue_assets'); | |
| 353 | 361 | } |
| 354 | 362 | |
| 355 | 363 | public static function loadCartAssets() |
| 356 | 364 | { |
| @@ -413,11 +421,13 @@ | ||
| 413 | 421 | 'has_active_cart' => !!$cart, |
| 414 | 422 | 'is_drawer_hidden' => CartLoader::shouldHideCartDrawer(), |
| 415 | 423 | 'is_admin_bar_showing' => is_admin_bar_showing(), |
| 416 | 424 | 'cart_item_count' => $isInstantCheckout ? 0 : ($cart ? count($cart->cart_data ?? []) : 0), |
| 425 | + 'cart_total_quantity' => $isInstantCheckout ? 0 : ($cart ? array_sum(array_map(function ($item) { return (int) ($item['quantity'] ?? 1); }, $cart->cart_data ?? [])) : 0), | |
| 417 | 426 | ], |
| 418 | 427 | 'fluentcart_utm_vars' => [ |
| 419 | - 'allowed_keys' => UtmHelper::allowedUtmParameterKey() | |
| 428 | + 'allowed_keys' => UtmHelper::allowedUtmParameterKey(), | |
| 429 | + 'internal_domains' => UtmHelper::getInternalDomains() | |
| 420 | 430 | ] |
| 421 | 431 | ]); |
| 422 | 432 | |
| 423 | 433 | Vite::enqueueStyle( |
| @@ -512,8 +522,16 @@ | ||
| 512 | 522 | if ($hasInstantCheckout || $hasModalCheckout) { |
| 513 | 523 | $isInstantCheckout = 'yes'; |
| 514 | 524 | } |
| 515 | 525 | |
| 526 | + $checkoutErrorNotices = Arr::get($cart->checkout_data, '__checkout_error_notices', []); | |
| 527 | + if ($checkoutErrorNotices) { | |
| 528 | + $checkoutData = is_array($cart->checkout_data) ? $cart->checkout_data : []; | |
| 529 | + unset($checkoutData['__checkout_error_notices']); | |
| 530 | + $cart->checkout_data = $checkoutData; | |
| 531 | + $cart->save(); | |
| 532 | + } | |
| 533 | + | |
| 516 | 534 | $data = [ |
| 517 | 535 | 'fluentcart_checkout_vars' => [ |
| 518 | 536 | 'rest' => Helper::getRestInfo(), |
| 519 | 537 | 'ajaxurl' => admin_url('admin-ajax.php'), |
| @@ -519,8 +537,9 @@ | ||
| 519 | 537 | 'ajaxurl' => admin_url('admin-ajax.php'), |
| 520 | 538 | 'is_all_digital' => !$cart->requireShipping(), |
| 521 | 539 | 'is_cart_locked' => $cart->checkout_data['is_locked'] ?? 'no', |
| 522 | 540 | 'disable_coupons' => $cart->checkout_data['disable_coupons'] ?? 'no', |
| 541 | + 'notices' => array_values($checkoutErrorNotices), | |
| 523 | 542 | 'payment_methods_with_custom_checkout_buttons' => apply_filters('fluent_cart/payment_methods_with_custom_checkout_buttons', []), |
| 524 | 543 | 'tax_settings' => (new TaxModule())->getSettings(), |
| 525 | 544 | 'submit_button' => [ |
| 526 | 545 | 'text' => __('Place Order', 'fluent-cart'), |