| @@ -205,8 +205,14 @@ | ||
| 205 | 205 | |
| 206 | 206 | // Collect data based on current step |
| 207 | 207 | switch(this.currentStep) { |
| 208 | 208 | |
| 209 | + case 2: // Connection and analytics consent | |
| 210 | + stepData.analytics = { | |
| 211 | + enabled: $('#wizard-analytics-consent').is(':checked') | |
| 212 | + }; | |
| 213 | + break; | |
| 214 | + | |
| 209 | 215 | case 4: // SEO Settings |
| 210 | 216 | stepData.seo_settings = { |
| 211 | 217 | date_archives: $('input[name="seo_date_archives"]').is(':checked'), |
| 212 | 218 | author_archives: $('input[name="seo_author_archives"]').is(':checked'), |
| @@ -361,9 +367,8 @@ | ||
| 361 | 367 | } |
| 362 | 368 | }).fail(function () { |
| 363 | 369 | // Continue polling even if individual request fails |
| 364 | 370 | // Don't show error for temporary network issues |
| 365 | - console.log('SSO polling request failed, continuing...'); | |
| 366 | 371 | }); |
| 367 | 372 | |
| 368 | 373 | // Stop polling after max attempts (timeout) |
| 369 | 374 | if (attempts >= maxAttempts) { |
| @@ -449,25 +454,42 @@ | ||
| 449 | 454 | } |
| 450 | 455 | |
| 451 | 456 | var type = selectedTypes[index]; |
| 452 | 457 | |
| 453 | - $.post(ajaxurl, { | |
| 454 | - action: 'metasync_import_external_data', | |
| 455 | - nonce: metasyncWizardData.importNonce, | |
| 456 | - type: type, | |
| 457 | - plugin: plugin | |
| 458 | - }, function (response) { | |
| 459 | - completedImports++; | |
| 460 | - var progress = (completedImports / totalImports) * 100; | |
| 461 | - $progressBar.css('width', progress + '%'); | |
| 458 | + // Indexation imports are batched server-side; loop until complete | |
| 459 | + var offset = 0; | |
| 462 | 460 | |
| 463 | - // Import next type | |
| 464 | - importNext(index + 1); | |
| 465 | - }).fail(function () { | |
| 466 | - $button.prop('disabled', false).text('Import Failed'); | |
| 467 | - $progress.hide(); | |
| 468 | - alert('Import failed for ' + type + '. Please try again.'); | |
| 469 | - }); | |
| 461 | + function postImport() { | |
| 462 | + $.post(ajaxurl, { | |
| 463 | + action: 'metasync_import_external_data', | |
| 464 | + nonce: metasyncWizardData.importNonce, | |
| 465 | + type: type, | |
| 466 | + plugin: plugin, | |
| 467 | + offset: offset | |
| 468 | + }, function (response) { | |
| 469 | + var data = response && response.data ? response.data : {}; | |
| 470 | + | |
| 471 | + // Continue batching until the server reports completion | |
| 472 | + if (type === 'indexation' && response.success && data.is_complete === false) { | |
| 473 | + offset = data.processed || (offset + 1); | |
| 474 | + postImport(); | |
| 475 | + return; | |
| 476 | + } | |
| 477 | + | |
| 478 | + completedImports++; | |
| 479 | + var progress = (completedImports / totalImports) * 100; | |
| 480 | + $progressBar.css('width', progress + '%'); | |
| 481 | + | |
| 482 | + // Import next type | |
| 483 | + importNext(index + 1); | |
| 484 | + }).fail(function () { | |
| 485 | + $button.prop('disabled', false).text('Import Failed'); | |
| 486 | + $progress.hide(); | |
| 487 | + alert('Import failed for ' + type + '. Please try again.'); | |
| 488 | + }); | |
| 489 | + } | |
| 490 | + | |
| 491 | + postImport(); | |
| 470 | 492 | } |
| 471 | 493 | |
| 472 | 494 | importNext(0); |
| 473 | 495 | }, |