'; if ( null !== $stats && $stats['store_blocked'] ) { self::blocked_notice(); } if ( null !== $stats && $stats['awaiting_review'] > 0 ) { self::review_banner( $stats['awaiting_review'] ); } echo '
'; self::tile( __( 'Products synced', 'cortexcommerce' ), 'products-synced', $count( 'products_synced' ) ); self::tile( __( 'Enriched', 'cortexcommerce' ), 'products-enriched', $count( 'products_enriched' ), EnrichedPage::url() ); self::tile( __( 'Live on your site', 'cortexcommerce' ), 'products-live', $count( 'products_live' ) ); self::tile( __( 'Waiting for your review', 'cortexcommerce' ), 'awaiting-review', $count( 'awaiting_review' ) ); echo '
'; } private static function review_banner( int $waiting ): void { printf( '
%1$s', esc_html( sprintf( /* translators: %s: number of products. */ _n( '%s product is ready for your review', '%s products are ready for your review', $waiting, 'cortexcommerce' ), number_format_i18n( $waiting ) ) ) ); ConnectPage::external_button( self::store_url( Config::review_url() ), __( 'Review now', 'cortexcommerce' ), 'button-secondary' ); echo '
'; } private static function blocked_notice(): void { printf( '

%1$s %3$s

', esc_html( Messages::for_reason( 'sync_host_blocked' ) ), esc_url( Config::hosting_help_url() ), esc_html__( 'How to fix this', 'cortexcommerce' ) ); } /** The portal opens on this store when it is one of several. */ public static function store_url( string $url ): string { $tenant = Options::tenant_id(); return '' === $tenant ? $url : $url . '?store=' . rawurlencode( $tenant ); } /** * @param string $url Where the whole tile leads, or '' for a plain tile. */ private static function tile( string $label, string $key, string $value, string $url = '' ): void { printf( '<%1$s class="card cortexcommerce-sync__tile"%2$s>%3$s%5$s', '' === $url ? 'div' : 'a', '' === $url ? '' : ' href="' . esc_url( $url ) . '"', esc_html( $label ), esc_attr( $key ), esc_html( $value ) ); } }