| @@ -9,8 +9,9 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | namespace WCPOS\WooCommercePOS\Admin; |
| 12 | 12 | |
| 13 | +use WCPOS\WooCommercePOS\Logger; | |
| 13 | 14 | use WCPOS\WooCommercePOS\Services\Analytics; |
| 14 | 15 | use WCPOS\WooCommercePOS\Services\Analytics_Profile; |
| 15 | 16 | use WCPOS\WooCommercePOS\Services\Landing_Profile; |
| 16 | 17 | use WCPOS\WooCommercePOS\Services\Lifecycle_Events; |
| @@ -466,9 +467,10 @@ | ||
| 466 | 467 | $json_flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT; |
| 467 | 468 | $profile = new Landing_Profile(); |
| 468 | 469 | $data = $profile->get_functional_data(); |
| 469 | 470 | |
| 470 | - $consent = Settings::instance()->tracking_consent(); | |
| 471 | + // Send gate: the persisted answer, not the filtered read view. | |
| 472 | + $consent = Settings::instance()->raw_tracking_consent(); | |
| 471 | 473 | if ( 'allowed' === $consent ) { |
| 472 | 474 | $data = array_merge( $data, $profile->get_consented_data() ); |
| 473 | 475 | } |
| 474 | 476 | |
| @@ -474,10 +476,9 @@ | ||
| 474 | 476 | |
| 475 | 477 | $encoded = wp_json_encode( $data, $json_flags ); |
| 476 | 478 | |
| 477 | 479 | if ( false === $encoded ) { |
| 478 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 479 | - error_log( 'WCPOS landing data JSON encoding failed: ' . json_last_error_msg() ); | |
| 480 | + Logger::error( 'Landing data JSON encoding failed: ' . json_last_error_msg() ); | |
| 480 | 481 | $encoded = '{}'; |
| 481 | 482 | } |
| 482 | 483 | |
| 483 | 484 | return \sprintf( |
| @@ -569,9 +570,9 @@ | ||
| 569 | 570 | |
| 570 | 571 | wp_enqueue_script( |
| 571 | 572 | 'wcpos-template-gallery', |
| 572 | 573 | PLUGIN_URL . $dir . '/js/template-gallery.js', |
| 573 | - array( 'react', 'react-dom', 'wp-api-fetch', 'wp-url' ), | |
| 574 | + array( 'react', 'react-dom', 'wp-api-fetch', \WCPOS\WooCommercePOS\Admin::API_FETCH_METHOD_PARAM_HANDLE, 'wp-url' ), | |
| 574 | 575 | PLUGIN_VERSION, |
| 575 | 576 | true |
| 576 | 577 | ); |
| 577 | 578 | |
| @@ -585,9 +586,9 @@ | ||
| 585 | 586 | $json_encode_flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT; |
| 586 | 587 | |
| 587 | 588 | return \sprintf( |
| 588 | 589 | 'var wcpos = wcpos || {}; wcpos.templateGallery = { isProActive: %s, adminUrl: %s, hasPosOrders: %s, previewBaseUrl: %s }; wcpos.translationVersion = %s;', |
| 589 | - wp_json_encode( class_exists( '\WCPOS\WooCommercePOSPro\WooCommercePOSPro' ), $json_encode_flags ), | |
| 590 | + wp_json_encode( wcpos_is_pro_active(), $json_encode_flags ), | |
| 590 | 591 | wp_json_encode( untrailingslashit( admin_url() ), $json_encode_flags ), |
| 591 | 592 | wp_json_encode( |
| 592 | 593 | (bool) wc_get_orders( |
| 593 | 594 | array( |