Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
340e3e5
fix: render the AI builder preview in the sandboxed frame
vytisbulkevicius Nov 27, 2026
d034a1a
test: let the sandbox check chart finish its drawing
vytisbulkevicius Nov 27, 2026
a941148
fix: give the AI builder its own renderer address and drop stale code…
vytisbulkevicius Nov 28, 2026
e0f20ae
Merge remote-tracking branch 'origin/development' into bugfix/pro/658
vytisbulkevicius Dec 1, 2026
9a155cd
fix: give the block editor builder its renderer address and drop supe…
vytisbulkevicius Dec 1, 2026
e0abf6d
fix: drop data checks of replaced chart code and version the frame sc…
vytisbulkevicius Dec 1, 2026
b933958
fix: show the data of a generated chart at once and check pending dat…
vytisbulkevicius Dec 1, 2026
1cf27b8
fix: show data that arrived during a repair in the preview with the r…
vytisbulkevicius Dec 1, 2026
068cfa1
test: cover a repair whose code fails with data that arrived during it
vytisbulkevicius Dec 1, 2026
046272b
fix: keep data that the preview does not show yet for the next chart …
vytisbulkevicius Dec 1, 2026
0c27706
test: fix the order of the failed-check repair case and cover data th…
vytisbulkevicius Dec 2, 2026
91884d5
test: hold the repair job before the repair can start
vytisbulkevicius Dec 2, 2026
cd1c360
fix: read the current code and the newest data in work that outlives …
vytisbulkevicius Dec 2, 2026
4564e37
fix: replace the chart code after the data of the generation is read
vytisbulkevicius Dec 2, 2026
d52b6c9
Merge remote-tracking branch 'origin/development' into bugfix/pro/658
vytisbulkevicius Dec 2, 2026
ca37631
Merge remote-tracking branch 'origin/development' into bugfix/pro/658
vytisbulkevicius Dec 2, 2026
1462120
fix: lock the AI builder while the chart loads and while it is published
vytisbulkevicius Dec 2, 2026
49dbe50
fix: upload the first data edit after the AI builder unlocks
vytisbulkevicius Dec 2, 2026
4da8b32
fix: take the upload skip of loaded data while the AI builder is locked
vytisbulkevicius Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion classes/Visualizer/ChartBuilder/src/AIBuilder/DataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ export default function DataSource( { chartId, uploadNonce, onDataReady, dataLoa

// Manual CSV: debounce 700 ms — uploads whenever the full CSV text changes.
useEffect( () => {
if ( disabled ) return;
if ( ( source !== 'manual' && source !== 'sheet' ) || ! csvText.trim() || ! chartId || ! uploadNonce ) return;
// The skip belongs to the CSV that arrives now, also while the builder is locked. Kept, it drops the next edit.
if ( skipUploadRef.current ) { skipUploadRef.current = false; return; }
if ( disabled ) return;
const trimmed = csvText.trim();
if ( lastCsvRef.current === trimmed ) return;
const parsed = parseCsv( trimmed );
Expand Down
287 changes: 208 additions & 79 deletions classes/Visualizer/ChartBuilder/src/AIBuilder/index.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion classes/Visualizer/D3Renderer/src/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*
* Sends postMessage replies to the parent:
* { type: 'iframe-ready' }
* { type: 'render-result', error } error is null, or the message of the error the code threw
* { type: 'export-image-result', dataUrl }
*/
import * as d3 from 'd3';
Expand Down Expand Up @@ -65,13 +66,16 @@ window.addEventListener( 'message', function ( event ) {
if ( ! code || ! container ) return;

const values = toD3Values( series, data );
let error = null;
try {
// eslint-disable-next-line no-new-func
new Function( 'd3', 'topojson', 'container', 'data', code )( d3, topojson, container, values );
} catch ( err ) {
error = String( err && err.message ? err.message : err );
container.innerHTML =
'<p style="color:#c00;padding:12px">Chart render error: ' + err.message + '</p>';
'<p style="color:#c00;padding:12px">Chart render error: ' + error + '</p>';
}
event.source.postMessage( { type: 'render-result', error }, '*' );
}

if ( msg.type === 'export-image' ) {
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Elementor/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function () {
'visualizer-d3-renderer',
'vizD3Renderer',
array(
'iframeJsUrl' => VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js',
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion classes/Visualizer/Gutenberg/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function enqueue_gutenberg_scripts() {
'visualizer-d3-renderer',
'vizD3Renderer',
array(
'iframeJsUrl' => VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js',
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
}
Expand Down Expand Up @@ -188,6 +188,7 @@ public function enqueue_gutenberg_scripts() {
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'visualizer-ai-builder' ),
'isPro' => Visualizer_Module::is_pro(),
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
// Inject the mount point the ChartBuilder React app needs.
Expand Down
11 changes: 11 additions & 0 deletions classes/Visualizer/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,17 @@ public static function can_edit_chart( $chart_id ) {
);
}

/**
* Address of the script of the sandboxed D3 frame.
*
* It carries the plugin version, so a browser does not keep the script of an older version.
*
* @return string
*/
public static function d3_iframe_js_url() {
return add_query_arg( 'ver', Visualizer_Plugin::VERSION, VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js' );
}

/**
* Checks if the PRO version is active.
*
Expand Down
5 changes: 3 additions & 2 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public function enqueueMediaScripts() {
'visualizer-d3-renderer',
'vizD3Renderer',
array(
'iframeJsUrl' => VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js',
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
}
Expand Down Expand Up @@ -745,7 +745,7 @@ public function enqueueLibraryScripts( $suffix ) {
'visualizer-d3-renderer',
'vizD3Renderer',
array(
'iframeJsUrl' => VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js',
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
}
Expand Down Expand Up @@ -813,6 +813,7 @@ public function enqueueLibraryScripts( $suffix ) {
'nonce' => wp_create_nonce( 'visualizer-ai-builder' ),
'isPro' => Visualizer_Module::is_pro(),
'upgradeUrl' => tsdk_utmify( Visualizer_Plugin::PRO_TEASER_URL, 'aiBuilderUpgrade', 'dataSource' ),
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Visualizer/Module/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public function renderChart( $atts ) {
'visualizer-d3-renderer',
'vizD3Renderer',
array(
'iframeJsUrl' => VISUALIZER_ABSURL . 'classes/Visualizer/D3Renderer/build/iframe.js',
'iframeJsUrl' => Visualizer_Module::d3_iframe_js_url(),
)
);
$d3_localized = true;
Expand Down
Loading
Loading