diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index e7ef36e5f..c8e028c33 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -1409,7 +1409,7 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) { $is_black_friday = apply_filters( 'themeisle_sdk_is_black_friday_sale', false ); // knowledge base link $plugin_meta[] = sprintf( - '%s', + '%s', esc_html__( 'Docs', 'visualizer' ) ); if ( ! $is_black_friday ) { diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index dedce5036..18e0aeb80 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -95,7 +95,7 @@ public static function _renderDbQuery( $args ) { echo sprintf( // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. __( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ), - '', + '', '' ); ?> @@ -208,7 +208,7 @@ public static function _renderJsonScreen( $args ) { echo sprintf( // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. __( 'If you want to add authentication or headers to the endpoint or change the request in any way, please refer to our document %1$shere%2$s.', 'visualizer' ), - '', + '', '' ); ?> @@ -621,7 +621,7 @@ private static function _renderPermissions( $args ) { array( 'visualizer-permission', 'visualizer-permission-specific', 'visualizer-permission-edit-specific' ) ); Visualizer_Render_Sidebar::_renderSectionEnd(); - echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions', 'https://docs.themeisle.com/article/1280-how-to-customize-permissions' ); + echo apply_filters( 'visualizer_pro_upsell', '', 'chart-permissions', tsdk_utmify( 'https://docs.themeisle.com/visualizer-charts-and-graphs/how-to-customize-permissions', 'chart-permissions', 'chart-editor' ) ); echo ''; Visualizer_Render_Sidebar::_renderGroupEnd(); } @@ -689,15 +689,15 @@ public static function _renderTabHelp( $args ) { Visualizer_Render_Sidebar::_renderGroupStart( esc_html__( 'Documentation', 'visualizer' ), '', 'open' ); Visualizer_Render_Sidebar::_renderSectionStart( esc_html__( 'General', 'visualizer' ), true ); ?> -

-

+

+

 " target="_blank">

-

+

', + '', '' ); ?> @@ -917,7 +917,16 @@ public static function _renderTabBasic( $args ) {
-

this tutorial', 'visualizer' ); ?>

+

+ ', + '' + ); + ?> +

- + @@ -1248,7 +1257,7 @@ class="dashicons dashicons-lock">

- + diff --git a/classes/Visualizer/Render/Sidebar.php b/classes/Visualizer/Render/Sidebar.php index 91e28a38e..61cfd2985 100644 --- a/classes/Visualizer/Render/Sidebar.php +++ b/classes/Visualizer/Render/Sidebar.php @@ -144,7 +144,7 @@ protected function _renderManualConfigDescription() { // translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag. __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to %3$sCommon Snippets%4$s for examples.', 'visualizer' ), '', '', - '', + '', '' ) . '' ); diff --git a/classes/Visualizer/Render/Sidebar/ChartJS.php b/classes/Visualizer/Render/Sidebar/ChartJS.php index 7d4a433a1..a7021f718 100644 --- a/classes/Visualizer/Render/Sidebar/ChartJS.php +++ b/classes/Visualizer/Render/Sidebar/ChartJS.php @@ -393,7 +393,7 @@ protected function _renderManualConfigDescription() { __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to %3$sCommon Snippets%4$s for examples.', 'visualizer' ), '', '', - '', + '', '' ) . '' ); diff --git a/classes/Visualizer/Render/Sidebar/Google.php b/classes/Visualizer/Render/Sidebar/Google.php index 2684e297c..04a7d3329 100644 --- a/classes/Visualizer/Render/Sidebar/Google.php +++ b/classes/Visualizer/Render/Sidebar/Google.php @@ -155,7 +155,7 @@ protected function _renderRoleField( $index ) { esc_html__( 'Determines whether the series has to be used for a special role as mentioned in %1$shere%2$s. You can view a few examples %3$shere%4$s.', 'visualizer' ), '', '', - '', + '', '' ) ); diff --git a/index.php b/index.php index b5f211080..7cd0c6401 100644 --- a/index.php +++ b/index.php @@ -94,11 +94,11 @@ function visualizer_launch() { define( 'VISUALIZER_ENABLE_BETA_FEATURES', '' ); // the link to pre-build queries. - define( 'VISUALIZER_DB_QUERY_DOC_URL', 'https://docs.themeisle.com/article/970-visualizer-sample-queries-to-generate-charts' ); - define( 'VISUALIZER_MAIN_DOC', 'https://docs.themeisle.com/category/657-visualizer' ); + define( 'VISUALIZER_DB_QUERY_DOC_URL', 'https://docs.themeisle.com/visualizer-charts-and-graphs/visualizer-sample-queries-to-generate-charts' ); + define( 'VISUALIZER_MAIN_DOC', 'https://docs.themeisle.com/visualizer-charts-and-graphs/' ); define( 'VISUALIZER_DOC_COLLECTION', 'https://docs.themeisle.com/visualizer-charts-and-graphs/?query=#' ); define( 'VISUALIZER_DEMO_URL', 'https://demo.themeisle.com/visualizer/#' ); - define( 'VISUALIZER_CODE_SNIPPETS_URL', 'https://docs.themeisle.com/category/726-visualizer' ); + define( 'VISUALIZER_CODE_SNIPPETS_URL', 'https://docs.themeisle.com/visualizer-charts-and-graphs/' ); define( 'VISUALIZER_SUBSCRIBE_API', 'https://api.themeisle.com/tracking/subscribe' ); define( 'VISUALIZER_AGENTS_URL', 'https://ai.themeisle.com' ); diff --git a/js/frame.js b/js/frame.js index 6fd62e269..9984a0b63 100644 --- a/js/frame.js +++ b/js/frame.js @@ -67,9 +67,11 @@ break; } - if($('span.viz-gvlink').length > 0) { - $('span.viz-gvlink').html($('span.viz-gvlink').html().replace('?', chart_type_in_api_link)); - } + // Only the Google API link has the "gallery/?" placeholder. Other links in the + // description (e.g. Common Snippets) carry UTM query strings and must stay as they are. + $('span.viz-gvlink a[href*="/chart/interactive/docs/gallery/?"]').attr('href', function (i, href) { + return href.replace('gallery/?', 'gallery/' + chart_type_in_api_link); + }); $('.type-radio').change(function () { $('.type-label-selected').removeClass('type-label-selected'); diff --git a/templates/docs.php b/templates/docs.php index a094e05b4..619addeab 100644 --- a/templates/docs.php +++ b/templates/docs.php @@ -44,10 +44,10 @@

Documentation

-

To get started with Visualizer, we recommend you first bookmark our main documentation page here.

+

To get started with Visualizer, we recommend you first bookmark our main documentation page here.

- Notably, you could take a look at this first introductory tutorial: How to create my first chart. + Notably, you could take a look at this first introductory tutorial: How to create my first chart.

If you prefer learning through video, this could prove useful. It is a little dated however.

diff --git a/tests/e2e/specs/admin.spec.js b/tests/e2e/specs/admin.spec.js index 3534105ac..3a6b9488a 100644 --- a/tests/e2e/specs/admin.spec.js +++ b/tests/e2e/specs/admin.spec.js @@ -211,6 +211,41 @@ test.describe( 'Chart Library', () => { await expect( page.getByText(backendName) ).toBeVisible(); await expect( page.locator('g').filter({ hasText: 'Test Chart Name' }).locator('rect') ).toBeVisible(); } ); + + // frame.js rewrites the Google API link for the chart type. It must leave the + // "Common Snippets" docs link and its UTMs alone, on both libraries. + for ( const library of [ 'GoogleCharts', 'ChartJS' ] ) { + test( `manual configuration links (${ library })`, async ( { admin, page } ) => { + await admin.visitAdminPage( 'admin.php?page=visualizer&vaction=addnew' ); + await page.waitForURL( '**/admin.php?page=visualizer&vaction=addnew' ); + await expect( page.getByRole('button', { name: 'Classic Builder Step-by-step' }) ).toBeVisible({ timeout: 5000 }); + await page.getByRole('button', { name: 'Classic Builder Step-by-step' }).click(); + await page.waitForSelector('h1:text("Visualizer")'); + + const frame = page.frameLocator('iframe'); + await frame.getByRole('combobox').selectOption({ value: library }); + await selectChartAdmin( frame, CHART_JS_LABELS.pie ); + await expect( frame.getByRole('button', { name: 'Create Chart' }) ).toBeVisible({ timeout: 5000 }); + + const snippets = frame.locator('span.viz-gvlink a').filter({ hasText: 'Common Snippets' }); + await expect( snippets ).toHaveAttribute( + 'href', + 'https://docs.themeisle.com/visualizer-charts-and-graphs/manual-configuration?utm_source=wpadmin&utm_medium=chart-editor&utm_campaign=manual-configuration&utm_content=docsvisualizer-charts-and-graphsmanual-configuration' + ); + + if ( library === 'GoogleCharts' ) { + await expect( frame.locator('span.viz-gvlink a').filter({ hasText: 'Google Visualization API' }) ).toHaveAttribute( + 'href', + 'https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options' + ); + // The data filter box keeps its own text and link. + await expect( frame.locator('span.viz-gvlink a').filter({ hasText: 'Chart Controls API' }) ).toHaveAttribute( + 'href', + 'https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery' + ); + } + } ); + } } ); test.describe( 'Support', () => { diff --git a/tests/php/static-analysis-stubs/symbols.php b/tests/php/static-analysis-stubs/symbols.php index 0e17329a9..9df272ecc 100644 --- a/tests/php/static-analysis-stubs/symbols.php +++ b/tests/php/static-analysis-stubs/symbols.php @@ -31,11 +31,11 @@ define( 'VISUALIZER_ENABLE_BETA_FEATURES', '' ); // the link to pre-build queries. -define( 'VISUALIZER_DB_QUERY_DOC_URL', 'https://docs.themeisle.com/article/970-visualizer-sample-queries-to-generate-charts' ); -define( 'VISUALIZER_MAIN_DOC', 'https://docs.themeisle.com/category/657-visualizer' ); +define( 'VISUALIZER_DB_QUERY_DOC_URL', 'https://docs.themeisle.com/visualizer-charts-and-graphs/visualizer-sample-queries-to-generate-charts' ); +define( 'VISUALIZER_MAIN_DOC', 'https://docs.themeisle.com/visualizer-charts-and-graphs/' ); define( 'VISUALIZER_DOC_COLLECTION', 'https://docs.themeisle.com/search?collectionId=561ec249c69791452ed4bceb&query=#+visualizer' ); define( 'VISUALIZER_DEMO_URL', 'https://demo.themeisle.com/visualizer/#' ); -define( 'VISUALIZER_CODE_SNIPPETS_URL', 'https://docs.themeisle.com/category/726-visualizer' ); +define( 'VISUALIZER_CODE_SNIPPETS_URL', 'https://docs.themeisle.com/visualizer-charts-and-graphs/' ); define( 'VISUALIZER_SUBSCRIBE_API', 'https://api.themeisle.com/tracking/subscribe' ); // to redirect all themeisle_log_event to error log.