Astra Starter Sites - Version 1.3.5

Version Description

Download this release

Release Info

Developer patilvikasj
Plugin Icon Astra Starter Sites
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

Files changed (34) hide show
  1. astra-sites.php +54 -54
  2. inc/assets/css/admin.css +149 -21
  3. inc/assets/images/beaver-builder.png +0 -0
  4. inc/assets/images/brizy.jpg +0 -0
  5. inc/assets/images/elementor.jpg +0 -0
  6. inc/assets/images/gutenberg.jpg +0 -0
  7. inc/assets/js/admin-page.js +181 -143
  8. inc/assets/js/astra-sites-api.js +27 -31
  9. inc/assets/js/astra-sites-notices.js +0 -21
  10. inc/assets/js/fetch.umd.js +531 -0
  11. inc/assets/js/install-theme.js +23 -3
  12. inc/assets/js/render-grid.js +118 -16
  13. inc/classes/class-astra-sites-importer-log.php +1 -190
  14. inc/classes/class-astra-sites-importer.php +25 -28
  15. inc/classes/class-astra-sites-notices.php +0 -214
  16. inc/classes/class-astra-sites-page.php +86 -12
  17. inc/classes/class-astra-sites-white-label.php +1 -1
  18. inc/classes/class-astra-sites.php +40 -25
  19. inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php +3 -3
  20. inc/importers/batch-processing/class-astra-sites-batch-processing-beaver-builder.php +2 -2
  21. inc/importers/batch-processing/class-astra-sites-batch-processing-brizy.php +1 -1
  22. inc/importers/batch-processing/class-astra-sites-batch-processing-elementor.php +0 -2
  23. inc/importers/batch-processing/class-astra-sites-batch-processing-gutenberg.php +2 -2
  24. inc/importers/batch-processing/class-astra-sites-batch-processing-misc.php +2 -2
  25. inc/importers/batch-processing/class-astra-sites-batch-processing-widgets.php +1 -1
  26. inc/importers/batch-processing/class-astra-sites-batch-processing.php +3 -2
  27. inc/importers/batch-processing/helpers/class-astra-sites-image-importer.php +5 -25
  28. inc/importers/batch-processing/helpers/class-wp-background-process-astra.php +5 -1
  29. inc/importers/wxr-importer/class-astra-wxr-importer.php +5 -0
  30. inc/includes/admin-page.php +15 -5
  31. inc/lib/astra-notices/class-astra-notices.php +334 -0
  32. inc/lib/astra-notices/notices.js +94 -0
  33. languages/astra-sites.pot +178 -155
  34. readme.txt +7 -1
astra-sites.php CHANGED
@@ -1,54 +1,54 @@
1
- <?php
2
- /**
3
- * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
- * Plugin URI: http://www.wpastra.com/pro/
5
- * Description: Import free sites build with Astra theme.
6
- * Version: 1.3.4
7
- * Author: Brainstorm Force
8
- * Author URI: http://www.brainstormforce.com
9
- * Text Domain: astra-sites
10
- *
11
- * @package Astra Sites
12
- */
13
-
14
- /**
15
- * Set constants.
16
- */
17
- if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
18
- define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
19
- }
20
-
21
- if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
- define( 'ASTRA_SITES_VER', '1.3.4' );
23
- }
24
-
25
- if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
26
- define( 'ASTRA_SITES_FILE', __FILE__ );
27
- }
28
-
29
- if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
30
- define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
31
- }
32
-
33
- if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
34
- define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
35
- }
36
-
37
- if ( ! defined( 'ASTRA_SITES_URI' ) ) {
38
- define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
39
- }
40
-
41
- if ( ! function_exists( 'astra_sites_setup' ) ) :
42
-
43
- /**
44
- * Astra Sites Setup
45
- *
46
- * @since 1.0.5
47
- */
48
- function astra_sites_setup() {
49
- require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
50
- }
51
-
52
- add_action( 'plugins_loaded', 'astra_sites_setup' );
53
-
54
- endif;
1
+ <?php
2
+ /**
3
+ * Plugin Name: Astra Starter Sites – Elementor, Beaver Builder & Gutenberg Templates
4
+ * Plugin URI: http://www.wpastra.com/pro/
5
+ * Description: Import free sites build with Astra theme.
6
+ * Version: 1.3.5
7
+ * Author: Brainstorm Force
8
+ * Author URI: http://www.brainstormforce.com
9
+ * Text Domain: astra-sites
10
+ *
11
+ * @package Astra Sites
12
+ */
13
+
14
+ /**
15
+ * Set constants.
16
+ */
17
+ if ( ! defined( 'ASTRA_SITES_NAME' ) ) {
18
+ define( 'ASTRA_SITES_NAME', __( 'Astra Sites', 'astra-sites' ) );
19
+ }
20
+
21
+ if ( ! defined( 'ASTRA_SITES_VER' ) ) {
22
+ define( 'ASTRA_SITES_VER', '1.3.5' );
23
+ }
24
+
25
+ if ( ! defined( 'ASTRA_SITES_FILE' ) ) {
26
+ define( 'ASTRA_SITES_FILE', __FILE__ );
27
+ }
28
+
29
+ if ( ! defined( 'ASTRA_SITES_BASE' ) ) {
30
+ define( 'ASTRA_SITES_BASE', plugin_basename( ASTRA_SITES_FILE ) );
31
+ }
32
+
33
+ if ( ! defined( 'ASTRA_SITES_DIR' ) ) {
34
+ define( 'ASTRA_SITES_DIR', plugin_dir_path( ASTRA_SITES_FILE ) );
35
+ }
36
+
37
+ if ( ! defined( 'ASTRA_SITES_URI' ) ) {
38
+ define( 'ASTRA_SITES_URI', plugins_url( '/', ASTRA_SITES_FILE ) );
39
+ }
40
+
41
+ if ( ! function_exists( 'astra_sites_setup' ) ) :
42
+
43
+ /**
44
+ * Astra Sites Setup
45
+ *
46
+ * @since 1.0.5
47
+ */
48
+ function astra_sites_setup() {
49
+ require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites.php';
50
+ }
51
+
52
+ add_action( 'plugins_loaded', 'astra_sites_setup' );
53
+
54
+ endif;
inc/assets/css/admin.css CHANGED
@@ -503,9 +503,8 @@ body.loading-content .select-page-builder {
503
  margin-bottom: 1em;
504
  }
505
 
506
- .astra-sites-welcome p.description {
507
  font-size: 1rem;
508
- margin-bottom: 2em;
509
  }
510
 
511
  .astra-sites-welcome select {
@@ -513,24 +512,15 @@ body.loading-content .select-page-builder {
513
  height: 100%;
514
  }
515
 
516
- .astra-sites-welcome p.submit {
517
  text-align: center;
518
  margin: 0;
519
  padding: 0;
520
  margin-left: .5em;
521
  }
522
 
523
- .astra-sites-welcome .fields {
524
- display: flex;
525
- vertical-align: middle;
526
- align-items: center;
527
- justify-content: center;
528
- }
529
-
530
- .astra-sites-welcome #submit {
531
- line-height: 1;
532
- padding: .5rem 1rem;
533
- height: auto;
534
  }
535
 
536
  .astra-site-page-builder {
@@ -559,7 +549,7 @@ body.loading-content .select-page-builder {
559
  margin: 0;
560
  }
561
 
562
- #astra-site-import-process-wrap {
563
  display: flex;
564
  align-items: center;
565
  margin-top: -2px;
@@ -568,7 +558,16 @@ body.loading-content .select-page-builder {
568
  border-radius: 3px;
569
  overflow: hidden;
570
  }
571
- #astra-site-import-process-wrap progress {
 
 
 
 
 
 
 
 
 
572
  padding: 0px;
573
  border: 0 none;
574
  background: #0085bd;
@@ -577,10 +576,15 @@ body.loading-content .select-page-builder {
577
  flex: 1;
578
  }
579
 
580
- #astra-site-import-process-wrap progress::-webkit-progress-value {
 
 
 
 
581
  background: #00679b;
582
  }
583
- #astra-site-import-process-wrap progress::-webkit-progress-bar {
 
584
  background: transparent;
585
  }
586
 
@@ -603,9 +607,19 @@ body.loading-content .select-page-builder {
603
  pointer-events: none;
604
  }
605
 
 
 
 
 
 
 
 
 
606
  .astra-sites-tooltip-icon .dashicons {
607
- color: #5d5d5d;
608
- font-size: 18px;
 
 
609
  }
610
 
611
  #astra-sites-welcome-form-inline {
@@ -652,4 +666,118 @@ body.loading-content .select-page-builder {
652
  width: 100%;
653
  border: none;
654
  margin: 0;
655
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  margin-bottom: 1em;
504
  }
505
 
506
+ .astra-sites-welcome p {
507
  font-size: 1rem;
 
508
  }
509
 
510
  .astra-sites-welcome select {
512
  height: 100%;
513
  }
514
 
515
+ .astra-sites-welcome .submit {
516
  text-align: center;
517
  margin: 0;
518
  padding: 0;
519
  margin-left: .5em;
520
  }
521
 
522
+ .astra-sites-welcome .disabled {
523
+ pointer-events: none;
 
 
 
 
 
 
 
 
 
524
  }
525
 
526
  .astra-site-page-builder {
549
  margin: 0;
550
  }
551
 
552
+ .astra-site-import-process-wrap {
553
  display: flex;
554
  align-items: center;
555
  margin-top: -2px;
558
  border-radius: 3px;
559
  overflow: hidden;
560
  }
561
+
562
+ .astra-sites-result-preview .astra-site-import-process-wrap progress {
563
+ background: #eeeeee;
564
+ }
565
+
566
+ .astra-sites-result-preview .astra-site-import-process-wrap progress::-webkit-progress-value {
567
+ background: #0185ba;
568
+ }
569
+
570
+ .astra-site-import-process-wrap progress {
571
  padding: 0px;
572
  border: 0 none;
573
  background: #0085bd;
576
  flex: 1;
577
  }
578
 
579
+ .astra-sites-result-preview .dashicons {
580
+ vertical-align: text-bottom;
581
+ }
582
+
583
+ .astra-site-import-process-wrap progress::-webkit-progress-value {
584
  background: #00679b;
585
  }
586
+
587
+ .astra-site-import-process-wrap progress::-webkit-progress-bar {
588
  background: transparent;
589
  }
590
 
607
  pointer-events: none;
608
  }
609
 
610
+ .astra-sites-preview input[type="checkbox"].disabled {
611
+ background: #eeeeee;
612
+ opacity: 1;
613
+ color: #fff;
614
+ box-shadow: none;
615
+ border-color: #b4b9be;
616
+ }
617
+
618
  .astra-sites-tooltip-icon .dashicons {
619
+ color: #757575;
620
+ font-size: 15px;
621
+ vertical-align: middle;
622
+ height: auto;
623
  }
624
 
625
  #astra-sites-welcome-form-inline {
666
  width: 100%;
667
  border: none;
668
  margin: 0;
669
+ }
670
+
671
+ #astra-sites-welcome-form #submit {
672
+ padding: 0em 4rem;
673
+ }
674
+
675
+ .page-builders li {
676
+ cursor: pointer;
677
+ display: inline-block;
678
+ padding: 1em;
679
+ }
680
+
681
+ .page-builders [type=radio] {
682
+ position: absolute;
683
+ opacity: 0;
684
+ width: 0;
685
+ height: 0;
686
+ }
687
+
688
+ .page-builders [type=radio] + img {
689
+ cursor: pointer;
690
+ opacity: .9;
691
+ border: 3px solid transparent;
692
+ border-radius: 10px;
693
+ transition: all linear 0.2s;
694
+ }
695
+
696
+ .page-builders [type=radio]:hover + img,
697
+ .page-builders [type=radio]:checked + img {
698
+ opacity: 1;
699
+ }
700
+
701
+ .astra-sites-page-builder-notice {
702
+ text-align: center;
703
+ margin: 1em 0 2em 0;
704
+ }
705
+
706
+ .current-importing-status-wrap {
707
+ font-size: 1rem;
708
+ }
709
+
710
+ .current-importing-status-wrap hr {
711
+ border-color: #f1f1f1;
712
+ }
713
+
714
+ .astra-sites-result-preview {
715
+ position: absolute;
716
+ left: 0;
717
+ right: 0;
718
+ top: 0;
719
+ bottom: 0;
720
+ background: #fff;
721
+ overflow-y: auto;
722
+ }
723
+
724
+ .astra-sites-result-preview .button {
725
+ margin-top: 1em;
726
+ }
727
+
728
+ .astra-sites-result-preview .inner {
729
+ margin: 0 auto;
730
+ max-width: 700px;
731
+ padding: 5em 0;
732
+ }
733
+
734
+ .astra-sites-result-preview h2 {
735
+ font-size: 2rem;
736
+ }
737
+
738
+ .astra-sites-result-preview p {
739
+ font-size: 1rem;
740
+ }
741
+
742
+ .current-importing-status {
743
+ font-size: 1rem;
744
+ background: #eeeeee;
745
+ padding: 1em 1.5em;
746
+ }
747
+
748
+ .current-importing-status-title {
749
+ margin-bottom: .5em;
750
+ }
751
+
752
+ .appearance_page_astra-sites .rotating {
753
+ height: auto;
754
+ animation: rotation 2s infinite linear;
755
+ width: auto;
756
+ color: #c1c1c1;
757
+ }
758
+
759
+ @-webkit-keyframes rotation {
760
+ from {
761
+ -webkit-transform: rotate(0deg);
762
+ }
763
+ to {
764
+ -webkit-transform: rotate(359deg);
765
+ }
766
+ }
767
+ .import-time {
768
+ display: inline-block;
769
+ background: #0185ba;
770
+ color: #fff;
771
+ padding: 2px 10px;
772
+ border-radius: 3px;
773
+ animation: astra-scale 0.5s alternate infinite ease-in;
774
+ }
775
+
776
+ @keyframes astra-scale {
777
+ 0% {transform: scale(1);}
778
+ 100% {transform: scale(1.03);}
779
+ }
780
+
781
+ .current-importing-status p {
782
+ margin: 0;
783
+ }
inc/assets/images/beaver-builder.png ADDED
Binary file
inc/assets/images/brizy.jpg ADDED
Binary file
inc/assets/images/elementor.jpg ADDED
Binary file
inc/assets/images/gutenberg.jpg ADDED
Binary file
inc/assets/js/admin-page.js CHANGED
@@ -107,8 +107,11 @@ var AstraSitesAjaxQueue = (function() {
107
  var progress_bar = percent * 100;
108
 
109
  if( progress_bar <= 100 ) {
110
- document.getElementById( 'astra-site-import-process' ).value = progress_bar;
111
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML + ' '+progress );
 
 
 
112
  }
113
  }
114
  },
@@ -153,6 +156,8 @@ var AstraSitesAjaxQueue = (function() {
153
  wpforms_url : '',
154
  options_data : '',
155
  widgets_data : '',
 
 
156
 
157
  init: function()
158
  {
@@ -182,6 +187,20 @@ var AstraSitesAjaxQueue = (function() {
182
  }
183
  },
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  /**
186
  * Binds events for the Astra Sites.
187
  *
@@ -192,6 +211,9 @@ var AstraSitesAjaxQueue = (function() {
192
  _bind: function()
193
  {
194
  $( document ).on( 'click' , '.astra-sites-reset-data .checkbox', AstraSitesAdmin._toggle_reset_notice );
 
 
 
195
  $( document ).on('change' , '#astra-sites-welcome-form-inline select', AstraSitesAdmin._change_page_builder);
196
  $( document ).on('click' , '.astra-sites-tooltip-icon', AstraSitesAdmin._toggle_tooltip);
197
  $( document ).on('click' , '.astra-sites-advanced-options-button', AstraSitesAdmin._toggle_advanced_options);
@@ -232,6 +254,19 @@ var AstraSitesAjaxQueue = (function() {
232
 
233
  },
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  _change_page_builder: function() {
236
  $(this).closest('form').submit();
237
  },
@@ -267,15 +302,14 @@ var AstraSitesAjaxQueue = (function() {
267
  action : 'astra-sites-reset-customizer-data'
268
  },
269
  beforeSend: function() {
270
- AstraSitesAdmin._log( 'Reseting Customizer Data' );
271
- $('.button-hero.astra-demo-import').text( 'Reseting Customizer Data' );
272
  },
273
  })
274
  .fail(function( jqXHR ){
275
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
276
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
277
  })
278
  .done(function ( data ) {
 
279
  $(document).trigger( 'astra-sites-reset-customizer-data-done' );
280
  });
281
  },
@@ -289,17 +323,14 @@ var AstraSitesAjaxQueue = (function() {
289
  action : 'astra-sites-reset-site-options'
290
  },
291
  beforeSend: function() {
292
- AstraSitesAdmin._log( 'Reseting Site Options' );
293
- $('.button-hero.astra-demo-import').text( 'Reseting Site Options' );
294
  },
295
  })
296
  .fail(function( jqXHR ){
297
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
298
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
299
  })
300
  .done(function ( data ) {
301
-
302
-
303
  $(document).trigger( 'astra-sites-reset-site-options-done' );
304
  });
305
  },
@@ -313,16 +344,14 @@ var AstraSitesAjaxQueue = (function() {
313
  action : 'astra-sites-reset-widgets-data'
314
  },
315
  beforeSend: function() {
316
- AstraSitesAdmin._log( 'Reseting Widgets' );
317
- $('.button-hero.astra-demo-import').text( 'Reseting Widgets' );
318
  },
319
  })
320
  .fail(function( jqXHR ){
321
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
322
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
323
  })
324
  .done(function ( data ) {
325
- AstraSitesAdmin._log( data );
326
  $(document).trigger( 'astra-sites-reset-widgets-data-done' );
327
  });
328
  },
@@ -332,11 +361,10 @@ var AstraSitesAjaxQueue = (function() {
332
 
333
  AstraSitesAdmin.reset_remaining_posts = AstraSitesAdmin.site_imported_data['reset_posts'].length;
334
 
335
- // Delete all posts.
336
- // AstraSitesAjaxQueue.stop();
337
- // AstraSitesAjaxQueue.run();
338
-
339
  $.each( AstraSitesAdmin.site_imported_data['reset_posts'], function(index, post_id) {
 
 
 
340
  AstraSitesAjaxQueue.add({
341
  url: astraSitesAdmin.ajaxurl,
342
  type: 'POST',
@@ -349,8 +377,9 @@ var AstraSitesAjaxQueue = (function() {
349
  if( AstraSitesAdmin.reset_processed_posts < AstraSitesAdmin.site_imported_data['reset_posts'].length ) {
350
  AstraSitesAdmin.reset_processed_posts+=1;
351
  }
352
-
353
- $('.button-hero.astra-demo-import').text( 'Deleting Item ' + AstraSitesAdmin.reset_processed_posts + ' of ' + AstraSitesAdmin.site_imported_data['reset_posts'].length );
 
354
  AstraSitesAdmin.reset_remaining_posts-=1;
355
  if( 0 == AstraSitesAdmin.reset_remaining_posts ) {
356
  $(document).trigger( 'astra-sites-delete-posts-done' );
@@ -369,14 +398,11 @@ var AstraSitesAjaxQueue = (function() {
369
 
370
  _reset_wp_forms: function() {
371
 
372
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_wp_forms'] );
373
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_wp_forms'].length );
374
-
375
  if( AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
376
  AstraSitesAdmin.reset_remaining_wp_forms = AstraSitesAdmin.site_imported_data['reset_wp_forms'].length;
377
 
378
  $.each( AstraSitesAdmin.site_imported_data['reset_wp_forms'], function(index, post_id) {
379
- AstraSitesAdmin._log( 'WP Form ID: ' + post_id );
380
  AstraSitesAjaxQueue.add({
381
  url: astraSitesAdmin.ajaxurl,
382
  type: 'POST',
@@ -385,13 +411,13 @@ var AstraSitesAjaxQueue = (function() {
385
  post_id : post_id,
386
  },
387
  success: function( result ){
388
- AstraSitesAdmin._log( 'WP Forms Results' );
389
- AstraSitesAdmin._log( result );
390
  if( AstraSitesAdmin.reset_processed_wp_forms < AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
391
  AstraSitesAdmin.reset_processed_wp_forms+=1;
392
  }
393
 
394
- $('.button-hero.astra-demo-import').text( 'Deleting Form ' + AstraSitesAdmin.reset_processed_wp_forms + ' of ' + AstraSitesAdmin.site_imported_data['reset_wp_forms'].length );
 
395
  AstraSitesAdmin.reset_remaining_wp_forms-=1;
396
  if( 0 == AstraSitesAdmin.reset_remaining_wp_forms ) {
397
  $(document).trigger( 'astra-sites-delete-wp-forms-done' );
@@ -409,13 +435,12 @@ var AstraSitesAjaxQueue = (function() {
409
 
410
  _reset_terms: function() {
411
 
412
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_terms'] );
413
- AstraSitesAdmin._log( AstraSitesAdmin.site_imported_data['reset_terms'].length );
414
 
415
  if( AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
416
  AstraSitesAdmin.reset_remaining_terms = AstraSitesAdmin.site_imported_data['reset_terms'].length;
417
 
418
  $.each( AstraSitesAdmin.site_imported_data['reset_terms'], function(index, term_id) {
 
419
  AstraSitesAjaxQueue.add({
420
  url: astraSitesAdmin.ajaxurl,
421
  type: 'POST',
@@ -427,10 +452,10 @@ var AstraSitesAjaxQueue = (function() {
427
  if( AstraSitesAdmin.reset_processed_terms < AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
428
  AstraSitesAdmin.reset_processed_terms+=1;
429
  }
430
- AstraSitesAdmin._log( result );
431
- $('.button-hero.astra-demo-import').text( 'Deleting Term ' + AstraSitesAdmin.reset_processed_terms + ' of ' + AstraSitesAdmin.site_imported_data['reset_terms'].length );
 
432
  AstraSitesAdmin.reset_remaining_terms-=1;
433
- AstraSitesAdmin._log( AstraSitesAdmin.reset_remaining_terms );
434
  if( 0 == AstraSitesAdmin.reset_remaining_terms ) {
435
  $(document).trigger( 'astra-sites-delete-terms-done' );
436
  }
@@ -471,18 +496,16 @@ var AstraSitesAjaxQueue = (function() {
471
  action : 'astra-sites-backup-settings',
472
  },
473
  beforeSend: function() {
474
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPForms );
475
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.backupCustomizer );
476
  },
477
  })
478
  .fail(function( jqXHR ){
479
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
480
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
481
  })
482
  .done(function ( data ) {
483
 
484
  // 1. Pass - Import Customizer Options.
485
- AstraSitesAdmin._log( astraSitesAdmin.log.backupCustomizerSuccess );
486
 
487
  // Custom trigger.
488
  $(document).trigger( trigger_name );
@@ -506,13 +529,11 @@ var AstraSitesAjaxQueue = (function() {
506
  customizer_data : AstraSitesAdmin.current_site['astra-site-customizer-data'],
507
  },
508
  beforeSend: function() {
509
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizer );
510
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingCustomizer );
511
  },
512
  })
513
  .fail(function( jqXHR ){
514
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
515
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
516
  })
517
  .done(function ( customizer_data ) {
518
 
@@ -520,12 +541,11 @@ var AstraSitesAjaxQueue = (function() {
520
 
521
  // 1. Fail - Import Customizer Options.
522
  if( false === customizer_data.success ) {
523
- AstraSitesAdmin._importFailMessage( customizer_data.data );
524
- AstraSitesAdmin._log( customizer_data.data );
525
  } else {
526
 
527
  // 1. Pass - Import Customizer Options.
528
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizerSuccess );
529
 
530
  $(document).trigger( 'astra-sites-import-customizer-settings-done' );
531
  }
@@ -545,27 +565,55 @@ var AstraSitesAjaxQueue = (function() {
545
  action : 'astra-sites-import-end',
546
  },
547
  beforeSend: function() {
548
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importComplete );
549
  }
550
  })
551
  .fail(function( jqXHR ){
552
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
553
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
554
  })
555
  .done(function ( data ) {
556
 
557
  // 5. Fail - Import Complete.
558
  if( false === data.success ) {
559
- AstraSitesAdmin._importFailMessage( data.data );
560
- AstraSitesAdmin._log( data.data );
561
  } else {
562
 
563
  $('body').removeClass('importing-site');
564
  $('.previous-theme, .next-theme').removeClass('disabled');
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  // 5. Pass - Import Complete.
567
- AstraSitesAdmin._importSuccessMessage();
568
- AstraSitesAdmin._log( astraSitesAdmin.log.success + ' ' + astraSitesAdmin.siteURL );
569
  }
570
  });
571
  },
@@ -584,25 +632,22 @@ var AstraSitesAjaxQueue = (function() {
584
  widgets_data : AstraSitesAdmin.widgets_data,
585
  },
586
  beforeSend: function() {
587
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgets );
588
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWidgets );
589
  },
590
  })
591
  .fail(function( jqXHR ){
592
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
593
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
594
  })
595
  .done(function ( widgets_data ) {
596
 
597
  // 4. Fail - Import Widgets.
598
  if( false === widgets_data.success ) {
599
- AstraSitesAdmin._importFailMessage( widgets_data.data );
600
- AstraSitesAdmin._log( widgets_data.data );
601
 
602
  } else {
603
 
604
  // 4. Pass - Import Widgets.
605
- AstraSitesAdmin._log( astraSitesAdmin.log.importWidgetsSuccess );
606
  $(document).trigger( 'astra-sites-import-widgets-done' );
607
  }
608
  });
@@ -626,27 +671,21 @@ var AstraSitesAjaxQueue = (function() {
626
  options_data : AstraSitesAdmin.options_data,
627
  },
628
  beforeSend: function() {
629
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptions );
630
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingOptions );
631
  $('.astra-demo-import .percent').html('');
632
  },
633
  })
634
  .fail(function( jqXHR ){
635
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
636
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
637
  })
638
  .done(function ( options_data ) {
639
 
640
  // 3. Fail - Import Site Options.
641
  if( false === options_data.success ) {
642
- AstraSitesAdmin._log( options_data );
643
- AstraSitesAdmin._importFailMessage( options_data.data );
644
- AstraSitesAdmin._log( options_data.data );
645
-
646
  } else {
647
 
648
  // 3. Pass - Import Site Options.
649
- AstraSitesAdmin._log( astraSitesAdmin.log.importOptionsSuccess );
650
  $(document).trigger( 'astra-sites-import-options-done' );
651
  }
652
  });
@@ -670,58 +709,50 @@ var AstraSitesAjaxQueue = (function() {
670
  wxr_url : AstraSitesAdmin.current_site['astra-site-wxr-path'],
671
  },
672
  beforeSend: function() {
673
- $('#astra-site-import-process-wrap').show();
674
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepare );
675
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importXMLPreparing );
676
  },
677
  })
678
  .fail(function( jqXHR ){
679
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
680
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
681
  })
682
  .done(function ( xml_data ) {
683
 
684
-
685
  // 2. Fail - Prepare XML Data.
686
  if( false === xml_data.success ) {
687
- AstraSitesAdmin._log( xml_data );
688
  var error_msg = xml_data.data.error || xml_data.data;
689
- AstraSitesAdmin._importFailMessage( error_msg );
690
- AstraSitesAdmin._log( error_msg );
691
 
692
  } else {
693
 
694
  // 2. Pass - Prepare XML Data.
695
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLPrepareSuccess );
696
 
697
  // Import XML though Event Source.
698
  AstraSSEImport.data = xml_data.data;
699
  AstraSSEImport.render();
700
 
701
- AstraSitesAdmin._log( astraSitesAdmin.log.importXML );
702
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML );
 
703
 
704
  var evtSource = new EventSource( AstraSSEImport.data.url );
705
  evtSource.onmessage = function ( message ) {
706
  var data = JSON.parse( message.data );
707
  switch ( data.action ) {
708
  case 'updateDelta':
 
709
  AstraSSEImport.updateDelta( data.type, data.delta );
710
  break;
711
 
712
  case 'complete':
713
  evtSource.close();
714
 
715
- // 2. Pass - Import XML though "Source Event".
716
- AstraSitesAdmin._log( astraSitesAdmin.log.importXMLSuccess );
717
- AstraSitesAdmin._log( '----- SSE - XML import Complete -----' );
718
 
719
- document.getElementById( 'astra-site-import-process' ).value = 100;
720
 
721
-
722
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingXML + ' (100%)' );
723
-
724
- $('#astra-site-import-process-wrap').hide();
725
 
726
  $(document).trigger( 'astra-sites-import-xml-done' );
727
 
@@ -730,7 +761,13 @@ var AstraSitesAjaxQueue = (function() {
730
  };
731
  evtSource.addEventListener( 'log', function ( message ) {
732
  var data = JSON.parse( message.data );
733
- AstraSitesAdmin._log( data.level + ' ' + data.message );
 
 
 
 
 
 
734
  });
735
  }
736
  });
@@ -776,25 +813,20 @@ var AstraSitesAjaxQueue = (function() {
776
  wpforms_url : AstraSitesAdmin.wpforms_url,
777
  },
778
  beforeSend: function() {
779
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPForms );
780
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingWPForms );
781
  },
782
  })
783
  .fail(function( jqXHR ){
784
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
785
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
786
  })
787
  .done(function ( forms ) {
788
 
789
  // 1. Fail - Import WPForms Options.
790
  if( false === forms.success ) {
791
- AstraSitesAdmin._importFailMessage( forms.data );
792
- AstraSitesAdmin._log( forms.data );
793
  } else {
794
 
795
  // 1. Pass - Import Customizer Options.
796
- AstraSitesAdmin._log( astraSitesAdmin.log.importWPFormsSuccess );
797
-
798
  $(document).trigger( 'astra-sites-import-wpforms-done' );
799
  }
800
  });
@@ -817,25 +849,19 @@ var AstraSitesAjaxQueue = (function() {
817
  customizer_data : AstraSitesAdmin.customizer_data,
818
  },
819
  beforeSend: function() {
820
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizer );
821
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.importingCustomizer );
822
  },
823
  })
824
  .fail(function( jqXHR ){
825
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText );
826
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
827
  })
828
  .done(function ( customizer_data ) {
829
 
830
  // 1. Fail - Import Customizer Options.
831
  if( false === customizer_data.success ) {
832
- AstraSitesAdmin._importFailMessage( customizer_data.data );
833
- AstraSitesAdmin._log( customizer_data.data );
834
  } else {
835
 
836
  // 1. Pass - Import Customizer Options.
837
- AstraSitesAdmin._log( astraSitesAdmin.log.importCustomizerSuccess );
838
-
839
  $(document).trigger( 'astra-sites-import-customizer-settings-done' );
840
  }
841
  });
@@ -850,7 +876,7 @@ var AstraSitesAjaxQueue = (function() {
850
  *
851
  * @param {string} data Error message.
852
  */
853
- _importSuccessMessage: function() {
854
 
855
  $('.astra-demo-import').removeClass('updating-message installing')
856
  .removeAttr('data-import')
@@ -937,7 +963,6 @@ var AstraSitesAjaxQueue = (function() {
937
  // Fail Notice.
938
  $('.install-theme-info').append( output );
939
 
940
-
941
  // !important to add trigger.
942
  // Which reinitialize the dismiss error message events.
943
  $(document).trigger('wp-updates-notice-added');
@@ -958,6 +983,8 @@ var AstraSitesAjaxQueue = (function() {
958
  return;
959
  }
960
 
 
 
961
  if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
962
  wp.updates.requestFilesystemCredentials( event );
963
 
@@ -972,13 +999,29 @@ var AstraSitesAjaxQueue = (function() {
972
  } );
973
  }
974
 
975
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + $button.data( 'slug' ) );
976
 
977
  wp.updates.installPlugin( {
978
  slug: $button.data( 'slug' )
979
  } );
980
  },
981
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
982
  /**
983
  * Install Success
984
  */
@@ -986,9 +1029,9 @@ var AstraSitesAjaxQueue = (function() {
986
 
987
  event.preventDefault();
988
 
989
- AstraSitesAdmin._log( astraSitesAdmin.log.installed + ' ' + response.slug );
990
 
991
  var $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val();
 
992
  var $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
993
 
994
  // Transform the 'Install' button into an 'Activate' button.
@@ -1001,6 +1044,8 @@ var AstraSitesAjaxQueue = (function() {
1001
  // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
1002
  setTimeout( function() {
1003
 
 
 
1004
  $.ajax({
1005
  url: astraSitesAdmin.ajaxurl,
1006
  type: 'POST',
@@ -1014,6 +1059,7 @@ var AstraSitesAjaxQueue = (function() {
1014
  .done(function (result) {
1015
 
1016
  if( result.success ) {
 
1017
 
1018
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1019
 
@@ -1037,14 +1083,14 @@ var AstraSitesAjaxQueue = (function() {
1037
 
1038
  var $card = $( '.plugin-card-' + response.slug );
1039
 
1040
- AstraSitesAdmin._log( response.errorMessage + ' ' + response.slug );
 
1041
 
1042
  $card
1043
  .removeClass( 'button-primary' )
1044
  .addClass( 'disabled' )
1045
  .html( wp.updates.l10n.installFailedShort );
1046
 
1047
- AstraSitesAdmin._importFailMessage( response.errorMessage );
1048
  },
1049
 
1050
  /**
@@ -1055,7 +1101,7 @@ var AstraSitesAjaxQueue = (function() {
1055
 
1056
  var $card = $( '.plugin-card-' + args.slug );
1057
 
1058
- AstraSitesAdmin._log( astraSitesAdmin.log.installingPlugin + ' ' + args.slug );
1059
 
1060
  $card.addClass('updating-message');
1061
 
@@ -1071,12 +1117,13 @@ var AstraSitesAjaxQueue = (function() {
1071
  var $button = jQuery( event.target ),
1072
  $init = $button.data( 'init' ),
1073
  $slug = $button.data( 'slug' );
 
1074
 
1075
  if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
1076
  return;
1077
  }
1078
 
1079
- AstraSitesAdmin._log( astraSitesAdmin.log.activating + ' ' + $slug );
1080
 
1081
  $button.addClass('updating-message button-primary')
1082
  .html( astraSitesAdmin.strings.btnActivating );
@@ -1098,7 +1145,7 @@ var AstraSitesAjaxQueue = (function() {
1098
 
1099
  if( result.success ) {
1100
 
1101
- AstraSitesAdmin._log( astraSitesAdmin.log.activated + ' ' + $slug );
1102
 
1103
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1104
 
@@ -1174,7 +1221,7 @@ var AstraSitesAjaxQueue = (function() {
1174
  */
1175
  _activateAllPlugins: function( activate_plugins ) {
1176
 
1177
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkActivation );
1178
 
1179
  $.each( activate_plugins, function(index, single_plugin) {
1180
 
@@ -1182,6 +1229,7 @@ var AstraSitesAjaxQueue = (function() {
1182
  $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val(),
1183
  $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
1184
 
 
1185
  AstraSitesAjaxQueue.add({
1186
  url: astraSitesAdmin.ajaxurl,
1187
  type: 'POST',
@@ -1195,8 +1243,6 @@ var AstraSitesAjaxQueue = (function() {
1195
 
1196
  if( result.success ) {
1197
 
1198
- AstraSitesAdmin._log( astraSitesAdmin.log.activate + ' ' + single_plugin.slug );
1199
-
1200
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1201
 
1202
  // Reset not installed plugins list.
@@ -1205,7 +1251,6 @@ var AstraSitesAjaxQueue = (function() {
1205
  // Enable Demo Import Button
1206
  AstraSitesAdmin._enable_demo_import_button();
1207
  } else {
1208
- AstraSitesAdmin._log( astraSitesAdmin.log.activationError + ' - ' + single_plugin.slug );
1209
  }
1210
  }
1211
  });
@@ -1218,10 +1263,12 @@ var AstraSitesAjaxQueue = (function() {
1218
  */
1219
  _installAllPlugins: function( not_installed ) {
1220
 
1221
- AstraSitesAdmin._log( astraSitesAdmin.log.bulkInstall );
1222
 
1223
  $.each( not_installed, function(index, single_plugin) {
1224
 
 
 
1225
  var $card = $( '.plugin-card-' + single_plugin.slug );
1226
 
1227
  // Add each plugin activate request in Ajax queue.
@@ -1248,6 +1295,10 @@ var AstraSitesAjaxQueue = (function() {
1248
  _importDemo: function(event) {
1249
  event.preventDefault();
1250
 
 
 
 
 
1251
  var disabled = $(this).attr('data-import');
1252
 
1253
  if ( typeof disabled !== 'undefined' && disabled === 'disabled' || $this.hasClass('disabled') ) {
@@ -1255,6 +1306,10 @@ var AstraSitesAjaxQueue = (function() {
1255
  $('.astra-demo-import').addClass('updating-message installing')
1256
  .text( wp.updates.l10n.installing );
1257
 
 
 
 
 
1258
  /**
1259
  * Process Bulk Plugin Install & Activate
1260
  */
@@ -1291,10 +1346,7 @@ var AstraSitesAjaxQueue = (function() {
1291
  */
1292
  _importSite: function( apiURL ) {
1293
 
1294
- AstraSitesAdmin._log( astraSitesAdmin.log.api + ' : ' + apiURL );
1295
- AstraSitesAdmin._log( astraSitesAdmin.log.importing );
1296
-
1297
- $('.button-hero.astra-demo-import').text( astraSitesAdmin.log.gettingData );
1298
 
1299
  // 1. Request Site Import
1300
  $.ajax({
@@ -1307,15 +1359,13 @@ var AstraSitesAjaxQueue = (function() {
1307
  },
1308
  })
1309
  .fail(function( jqXHR ){
1310
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
1311
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText );
1312
  })
1313
  .done(function ( demo_data ) {
1314
 
1315
  // 1. Fail - Request Site Import
1316
  if( false === demo_data.success ) {
1317
 
1318
- AstraSitesAdmin._importFailMessage( demo_data.data );
1319
 
1320
  } else {
1321
 
@@ -1325,8 +1375,6 @@ var AstraSitesAjaxQueue = (function() {
1325
  }
1326
 
1327
  // 1. Pass - Request Site Import
1328
- AstraSitesAdmin._log( astraSitesAdmin.log.processingRequest );
1329
-
1330
  AstraSitesAdmin.customizer_data = JSON.stringify( demo_data.data['astra-site-customizer-data'] ) || '';
1331
  AstraSitesAdmin.wxr_url = encodeURI( demo_data.data['astra-site-wxr-path'] ) || '';
1332
  AstraSitesAdmin.wpforms_url = encodeURI( demo_data.data['astra-site-wpforms-path'] ) || '';
@@ -1402,8 +1450,6 @@ var AstraSitesAjaxQueue = (function() {
1402
  if( AstraSitesAPI._stored_data ) {
1403
  var site_data = AstraSitesAdmin._get_site_details( site_id );
1404
 
1405
-
1406
-
1407
  if( site_data ) {
1408
  // Set current site details.
1409
  AstraSitesAdmin.current_site = site_data;
@@ -1516,9 +1562,6 @@ var AstraSitesAjaxQueue = (function() {
1516
  astraSiteOptions = anchor.find('.astra-site-options').val() || '';
1517
  astraEnabledExtensions = anchor.find('.astra-enabled-extensions').val() || '';
1518
 
1519
- AstraSitesAdmin._log( astraSitesAdmin.log.preview + ' "' + demo_name + '" URL : ' + demoURL );
1520
-
1521
-
1522
  var template = wp.template('astra-site-preview');
1523
 
1524
  templateData = [{
@@ -1535,8 +1578,6 @@ var AstraSitesAjaxQueue = (function() {
1535
  astra_enabled_extensions : astraEnabledExtensions,
1536
  }];
1537
 
1538
- // return;
1539
-
1540
  // delete any earlier fullscreen preview before we render new one.
1541
  $('.theme-install-overlay').remove();
1542
 
@@ -1557,7 +1598,6 @@ var AstraSitesAjaxQueue = (function() {
1557
  },
1558
  })
1559
  .done(function ( response ) {
1560
- AstraSitesAdmin._log( response );
1561
  if( response.success ) {
1562
  AstraSitesAdmin.site_imported_data = response.data;
1563
  }
@@ -1619,8 +1659,6 @@ var AstraSitesAjaxQueue = (function() {
1619
  // Remove loader.
1620
  $('.required-plugins').removeClass('loading').html('');
1621
 
1622
- AstraSitesAdmin._importFailMessage( jqXHR.status + ' ' + jqXHR.responseText, 'plugins' );
1623
- AstraSitesAdmin._log( jqXHR.status + ' ' + jqXHR.responseText );
1624
  })
1625
  .done(function ( response ) {
1626
 
@@ -1651,7 +1689,7 @@ var AstraSitesAjaxQueue = (function() {
1651
  remaining_plugins += parseInt( response.data.notinstalled.length );
1652
 
1653
  $( response.data.notinstalled ).each(function( index, plugin ) {
1654
- $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'">'+plugin.name+'</li>');
1655
  });
1656
  }
1657
 
@@ -1666,7 +1704,7 @@ var AstraSitesAjaxQueue = (function() {
1666
  remaining_plugins += parseInt( response.data.inactive.length );
1667
 
1668
  $( response.data.inactive ).each(function( index, plugin ) {
1669
- $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'">'+plugin.name+'</li>');
1670
  });
1671
  }
1672
 
@@ -1678,7 +1716,7 @@ var AstraSitesAjaxQueue = (function() {
1678
  if ( typeof response.data.active !== 'undefined' ) {
1679
 
1680
  $( response.data.active ).each(function( index, plugin ) {
1681
- $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'">'+plugin.name+'</li>');
1682
  });
1683
  }
1684
 
107
  var progress_bar = percent * 100;
108
 
109
  if( progress_bar <= 100 ) {
110
+ var process_bars = document.getElementsByClassName( 'astra-site-import-process' );
111
+ for ( var i = 0; i < process_bars.length; i++ ) {
112
+ process_bars[i].value = progress_bar;
113
+ }
114
+ AstraSitesAdmin._log_title( 'Importing Content.. ' + progress );
115
  }
116
  }
117
  },
156
  wpforms_url : '',
157
  options_data : '',
158
  widgets_data : '',
159
+ import_start_time : '',
160
+ import_end_time : '',
161
 
162
  init: function()
163
  {
187
  }
188
  },
189
 
190
+ _log_title: function( data, append ) {
191
+
192
+ var markup = '<p>' + data + '</p>';
193
+ if (typeof data == 'object' ) {
194
+ var markup = '<p>' + JSON.stringify( data ) + '</p>';
195
+ }
196
+
197
+ if ( append ) {
198
+ $('.current-importing-status-title').append( markup );
199
+ } else {
200
+ $('.current-importing-status-title').html( markup );
201
+ }
202
+ },
203
+
204
  /**
205
  * Binds events for the Astra Sites.
206
  *
211
  _bind: function()
212
  {
213
  $( document ).on( 'click' , '.astra-sites-reset-data .checkbox', AstraSitesAdmin._toggle_reset_notice );
214
+ $( document ).on( 'click' , '.page-builders li', AstraSitesAdmin._toggle_reset_notice );
215
+ $( document ).on('click' , '#astra-sites-welcome-form .submit', AstraSitesAdmin._show_page_builder_notice);
216
+ $( document ).on('click' , '#astra-sites-welcome-form li', AstraSitesAdmin._show_next_button);
217
  $( document ).on('change' , '#astra-sites-welcome-form-inline select', AstraSitesAdmin._change_page_builder);
218
  $( document ).on('click' , '.astra-sites-tooltip-icon', AstraSitesAdmin._toggle_tooltip);
219
  $( document ).on('click' , '.astra-sites-advanced-options-button', AstraSitesAdmin._toggle_advanced_options);
254
 
255
  },
256
 
257
+ _show_next_button: function() {
258
+ $( this ).parents('.page-builders').find('img').removeClass('wp-ui-highlight');
259
+ $( this ).find('img').addClass('wp-ui-highlight');
260
+
261
+ $('#submit').parent().removeClass('submit');
262
+ $('#submit').removeClass('disabled');
263
+ $('.astra-sites-page-builder-notice').hide();
264
+ },
265
+
266
+ _show_page_builder_notice: function() {
267
+ $('.astra-sites-page-builder-notice').show();
268
+ },
269
+
270
  _change_page_builder: function() {
271
  $(this).closest('form').submit();
272
  },
302
  action : 'astra-sites-reset-customizer-data'
303
  },
304
  beforeSend: function() {
305
+ AstraSitesAdmin._log_title( 'Reseting Customizer Data..' );
 
306
  },
307
  })
308
  .fail(function( jqXHR ){
309
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
310
  })
311
  .done(function ( data ) {
312
+ AstraSitesAdmin._log_title( 'Complete Resetting Customizer Data..' );
313
  $(document).trigger( 'astra-sites-reset-customizer-data-done' );
314
  });
315
  },
323
  action : 'astra-sites-reset-site-options'
324
  },
325
  beforeSend: function() {
326
+ AstraSitesAdmin._log_title( 'Reseting Site Options..' );
 
327
  },
328
  })
329
  .fail(function( jqXHR ){
330
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
331
  })
332
  .done(function ( data ) {
333
+ AstraSitesAdmin._log_title( 'Complete Reseting Site Options..' );
 
334
  $(document).trigger( 'astra-sites-reset-site-options-done' );
335
  });
336
  },
344
  action : 'astra-sites-reset-widgets-data'
345
  },
346
  beforeSend: function() {
347
+ AstraSitesAdmin._log_title( 'Reseting Widgets..' );
 
348
  },
349
  })
350
  .fail(function( jqXHR ){
351
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
352
  })
353
  .done(function ( data ) {
354
+ AstraSitesAdmin._log_title( 'Complete Reseting Widgets..' );
355
  $(document).trigger( 'astra-sites-reset-widgets-data-done' );
356
  });
357
  },
361
 
362
  AstraSitesAdmin.reset_remaining_posts = AstraSitesAdmin.site_imported_data['reset_posts'].length;
363
 
 
 
 
 
364
  $.each( AstraSitesAdmin.site_imported_data['reset_posts'], function(index, post_id) {
365
+
366
+ AstraSitesAdmin._log_title( 'Deleting Posts..' );
367
+
368
  AstraSitesAjaxQueue.add({
369
  url: astraSitesAdmin.ajaxurl,
370
  type: 'POST',
377
  if( AstraSitesAdmin.reset_processed_posts < AstraSitesAdmin.site_imported_data['reset_posts'].length ) {
378
  AstraSitesAdmin.reset_processed_posts+=1;
379
  }
380
+
381
+ AstraSitesAdmin._log_title( 'Deleting Post ' + AstraSitesAdmin.reset_processed_posts + ' of ' + AstraSitesAdmin.site_imported_data['reset_posts'].length + '<br/>' + result.data );
382
+
383
  AstraSitesAdmin.reset_remaining_posts-=1;
384
  if( 0 == AstraSitesAdmin.reset_remaining_posts ) {
385
  $(document).trigger( 'astra-sites-delete-posts-done' );
398
 
399
  _reset_wp_forms: function() {
400
 
 
 
 
401
  if( AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
402
  AstraSitesAdmin.reset_remaining_wp_forms = AstraSitesAdmin.site_imported_data['reset_wp_forms'].length;
403
 
404
  $.each( AstraSitesAdmin.site_imported_data['reset_wp_forms'], function(index, post_id) {
405
+ AstraSitesAdmin._log_title( 'Deleting WP Forms..' );
406
  AstraSitesAjaxQueue.add({
407
  url: astraSitesAdmin.ajaxurl,
408
  type: 'POST',
411
  post_id : post_id,
412
  },
413
  success: function( result ){
414
+
 
415
  if( AstraSitesAdmin.reset_processed_wp_forms < AstraSitesAdmin.site_imported_data['reset_wp_forms'].length ) {
416
  AstraSitesAdmin.reset_processed_wp_forms+=1;
417
  }
418
 
419
+ AstraSitesAdmin._log_title( 'Deleting Form ' + AstraSitesAdmin.reset_processed_wp_forms + ' of ' + AstraSitesAdmin.site_imported_data['reset_wp_forms'].length + '<br/>' + result.data );
420
+
421
  AstraSitesAdmin.reset_remaining_wp_forms-=1;
422
  if( 0 == AstraSitesAdmin.reset_remaining_wp_forms ) {
423
  $(document).trigger( 'astra-sites-delete-wp-forms-done' );
435
 
436
  _reset_terms: function() {
437
 
 
 
438
 
439
  if( AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
440
  AstraSitesAdmin.reset_remaining_terms = AstraSitesAdmin.site_imported_data['reset_terms'].length;
441
 
442
  $.each( AstraSitesAdmin.site_imported_data['reset_terms'], function(index, term_id) {
443
+ AstraSitesAdmin._log_title( 'Deleting Terms..' );
444
  AstraSitesAjaxQueue.add({
445
  url: astraSitesAdmin.ajaxurl,
446
  type: 'POST',
452
  if( AstraSitesAdmin.reset_processed_terms < AstraSitesAdmin.site_imported_data['reset_terms'].length ) {
453
  AstraSitesAdmin.reset_processed_terms+=1;
454
  }
455
+
456
+ AstraSitesAdmin._log_title( 'Deleting Term ' + AstraSitesAdmin.reset_processed_terms + ' of ' + AstraSitesAdmin.site_imported_data['reset_terms'].length + '<br/>' + result.data );
457
+
458
  AstraSitesAdmin.reset_remaining_terms-=1;
 
459
  if( 0 == AstraSitesAdmin.reset_remaining_terms ) {
460
  $(document).trigger( 'astra-sites-delete-terms-done' );
461
  }
496
  action : 'astra-sites-backup-settings',
497
  },
498
  beforeSend: function() {
499
+ AstraSitesAdmin._log_title( 'Processing Customizer Settings Backup..' );
 
500
  },
501
  })
502
  .fail(function( jqXHR ){
503
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
504
  })
505
  .done(function ( data ) {
506
 
507
  // 1. Pass - Import Customizer Options.
508
+ AstraSitesAdmin._log_title( 'Customizer Settings Backup Done..' );
509
 
510
  // Custom trigger.
511
  $(document).trigger( trigger_name );
529
  customizer_data : AstraSitesAdmin.current_site['astra-site-customizer-data'],
530
  },
531
  beforeSend: function() {
532
+ AstraSitesAdmin._log_title( 'Importing Customizer Settings..' );
 
533
  },
534
  })
535
  .fail(function( jqXHR ){
536
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
537
  })
538
  .done(function ( customizer_data ) {
539
 
541
 
542
  // 1. Fail - Import Customizer Options.
543
  if( false === customizer_data.success ) {
544
+ AstraSitesAdmin._log_title( customizer_data.data );
 
545
  } else {
546
 
547
  // 1. Pass - Import Customizer Options.
548
+ AstraSitesAdmin._log_title( 'Imported Customizer Settings..' );
549
 
550
  $(document).trigger( 'astra-sites-import-customizer-settings-done' );
551
  }
565
  action : 'astra-sites-import-end',
566
  },
567
  beforeSend: function() {
568
+ AstraSitesAdmin._log_title( 'Import Complete!' );
569
  }
570
  })
571
  .fail(function( jqXHR ){
572
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
573
  })
574
  .done(function ( data ) {
575
 
576
  // 5. Fail - Import Complete.
577
  if( false === data.success ) {
578
+ AstraSitesAdmin._log_title( data.data );
 
579
  } else {
580
 
581
  $('body').removeClass('importing-site');
582
  $('.previous-theme, .next-theme').removeClass('disabled');
583
 
584
+ var date = new Date();
585
+
586
+ AstraSitesAdmin.import_end_time = new Date();
587
+ var diff = ( AstraSitesAdmin.import_end_time.getTime() - AstraSitesAdmin.import_start_time.getTime() );
588
+
589
+ var time = '';
590
+ var seconds = Math.floor( diff / 1000 );
591
+ var minutes = Math.floor( seconds / 60 );
592
+ var hours = Math.floor( minutes / 60 );
593
+
594
+ minutes = minutes - ( hours * 60 );
595
+ seconds = seconds - ( minutes * 60 );
596
+
597
+ if( hours ) {
598
+ time += hours + ' Hours ';
599
+ }
600
+ if( minutes ) {
601
+ time += minutes + ' Minutes ';
602
+ }
603
+ if( seconds ) {
604
+ time += seconds + ' Seconds';
605
+ }
606
+
607
+ var output = '<h2>Done 🎉</h2>';
608
+ output += '<p>Your starter site has been imported successfully in '+time+'! Now go ahead, customize the text, images, and design to make it yours!</p>';
609
+ output += '<p>You can now start making changes according to your requirements.</p>';
610
+ output += '<p><a class="button button-primary button-hero" href="'+astraSitesAdmin.siteURL+'" target="_blank">View Site <i class="dashicons dashicons-external"></i></a></p>';
611
+
612
+ $('.rotating,.current-importing-status-wrap,.notice-warning').remove();
613
+ $('.astra-sites-result-preview .inner').html(output);
614
+
615
  // 5. Pass - Import Complete.
616
+ AstraSitesAdmin._importSuccessButton();
 
617
  }
618
  });
619
  },
632
  widgets_data : AstraSitesAdmin.widgets_data,
633
  },
634
  beforeSend: function() {
635
+ AstraSitesAdmin._log_title( 'Importing Widgets..' );
 
636
  },
637
  })
638
  .fail(function( jqXHR ){
639
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
640
  })
641
  .done(function ( widgets_data ) {
642
 
643
  // 4. Fail - Import Widgets.
644
  if( false === widgets_data.success ) {
645
+ AstraSitesAdmin._log_title( widgets_data.data );
 
646
 
647
  } else {
648
 
649
  // 4. Pass - Import Widgets.
650
+ AstraSitesAdmin._log_title( 'Imported Widgets!' );
651
  $(document).trigger( 'astra-sites-import-widgets-done' );
652
  }
653
  });
671
  options_data : AstraSitesAdmin.options_data,
672
  },
673
  beforeSend: function() {
674
+ AstraSitesAdmin._log_title( 'Importing Options..' );
 
675
  $('.astra-demo-import .percent').html('');
676
  },
677
  })
678
  .fail(function( jqXHR ){
679
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
680
  })
681
  .done(function ( options_data ) {
682
 
683
  // 3. Fail - Import Site Options.
684
  if( false === options_data.success ) {
685
+ AstraSitesAdmin._log_title( options_data );
 
 
 
686
  } else {
687
 
688
  // 3. Pass - Import Site Options.
 
689
  $(document).trigger( 'astra-sites-import-options-done' );
690
  }
691
  });
709
  wxr_url : AstraSitesAdmin.current_site['astra-site-wxr-path'],
710
  },
711
  beforeSend: function() {
712
+ $('.astra-site-import-process-wrap').show();
713
+ AstraSitesAdmin._log_title( 'Importing Content..' );
 
714
  },
715
  })
716
  .fail(function( jqXHR ){
717
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
718
  })
719
  .done(function ( xml_data ) {
720
 
 
721
  // 2. Fail - Prepare XML Data.
722
  if( false === xml_data.success ) {
723
+ AstraSitesAdmin._log_title( xml_data );
724
  var error_msg = xml_data.data.error || xml_data.data;
725
+ AstraSitesAdmin._log_title( error_msg );
 
726
 
727
  } else {
728
 
729
  // 2. Pass - Prepare XML Data.
 
730
 
731
  // Import XML though Event Source.
732
  AstraSSEImport.data = xml_data.data;
733
  AstraSSEImport.render();
734
 
735
+ $('.current-importing-status-description').html('').show();
736
+
737
+ $('.astra-sites-result-preview .inner').append('<div class="astra-site-import-process-wrap"><progress class="astra-site-import-process" max="100" value="0"></progress></div>');
738
 
739
  var evtSource = new EventSource( AstraSSEImport.data.url );
740
  evtSource.onmessage = function ( message ) {
741
  var data = JSON.parse( message.data );
742
  switch ( data.action ) {
743
  case 'updateDelta':
744
+
745
  AstraSSEImport.updateDelta( data.type, data.delta );
746
  break;
747
 
748
  case 'complete':
749
  evtSource.close();
750
 
751
+ $('.current-importing-status-description').hide();
 
 
752
 
753
+ document.getElementsByClassName("astra-site-import-process").value = '100';
754
 
755
+ $('.astra-site-import-process-wrap').hide();
 
 
 
756
 
757
  $(document).trigger( 'astra-sites-import-xml-done' );
758
 
761
  };
762
  evtSource.addEventListener( 'log', function ( message ) {
763
  var data = JSON.parse( message.data );
764
+ var message = data.message || '';
765
+ if( message ) {
766
+ message = message.replace(/"/g, function(letter) {
767
+ return '';
768
+ });
769
+ $('.current-importing-status-description').html( message );
770
+ }
771
  });
772
  }
773
  });
813
  wpforms_url : AstraSitesAdmin.wpforms_url,
814
  },
815
  beforeSend: function() {
816
+ AstraSitesAdmin._log_title( 'Importing WP Forms..' );
 
817
  },
818
  })
819
  .fail(function( jqXHR ){
820
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
821
  })
822
  .done(function ( forms ) {
823
 
824
  // 1. Fail - Import WPForms Options.
825
  if( false === forms.success ) {
826
+ AstraSitesAdmin._log_title( forms.data );
 
827
  } else {
828
 
829
  // 1. Pass - Import Customizer Options.
 
 
830
  $(document).trigger( 'astra-sites-import-wpforms-done' );
831
  }
832
  });
849
  customizer_data : AstraSitesAdmin.customizer_data,
850
  },
851
  beforeSend: function() {
 
 
852
  },
853
  })
854
  .fail(function( jqXHR ){
855
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText, true );
 
856
  })
857
  .done(function ( customizer_data ) {
858
 
859
  // 1. Fail - Import Customizer Options.
860
  if( false === customizer_data.success ) {
861
+ AstraSitesAdmin._log_title( customizer_data.data );
 
862
  } else {
863
 
864
  // 1. Pass - Import Customizer Options.
 
 
865
  $(document).trigger( 'astra-sites-import-customizer-settings-done' );
866
  }
867
  });
876
  *
877
  * @param {string} data Error message.
878
  */
879
+ _importSuccessButton: function() {
880
 
881
  $('.astra-demo-import').removeClass('updating-message installing')
882
  .removeAttr('data-import')
963
  // Fail Notice.
964
  $('.install-theme-info').append( output );
965
 
 
966
  // !important to add trigger.
967
  // Which reinitialize the dismiss error message events.
968
  $(document).trigger('wp-updates-notice-added');
983
  return;
984
  }
985
 
986
+ AstraSitesAdmin._log_title( 'Installing Plugin..' );
987
+
988
  if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) {
989
  wp.updates.requestFilesystemCredentials( event );
990
 
999
  } );
1000
  }
1001
 
1002
+ AstraSitesAdmin._log_title( 'Installing ' + AstraSitesAdmin.ucwords( $button.data( 'name' ) ) );
1003
 
1004
  wp.updates.installPlugin( {
1005
  slug: $button.data( 'slug' )
1006
  } );
1007
  },
1008
 
1009
+ ucwords: function( str ) {
1010
+ if( ! str ) {
1011
+ return '';
1012
+ }
1013
+
1014
+ str = str.toLowerCase().replace(/\b[a-z]/g, function(letter) {
1015
+ return letter.toUpperCase();
1016
+ });
1017
+
1018
+ str = str.replace(/-/g, function(letter) {
1019
+ return ' ';
1020
+ });
1021
+
1022
+ return str;
1023
+ },
1024
+
1025
  /**
1026
  * Install Success
1027
  */
1029
 
1030
  event.preventDefault();
1031
 
 
1032
 
1033
  var $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val();
1034
+
1035
  var $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
1036
 
1037
  // Transform the 'Install' button into an 'Activate' button.
1044
  // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
1045
  setTimeout( function() {
1046
 
1047
+ AstraSitesAdmin._log_title( 'Activating Plugin..' );
1048
+
1049
  $.ajax({
1050
  url: astraSitesAdmin.ajaxurl,
1051
  type: 'POST',
1059
  .done(function (result) {
1060
 
1061
  if( result.success ) {
1062
+ AstraSitesAdmin._log_title( 'Activating Plugin ' + AstraSitesAdmin.ucwords(response.name) );
1063
 
1064
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1065
 
1083
 
1084
  var $card = $( '.plugin-card-' + response.slug );
1085
 
1086
+ AstraSitesAdmin._log_title( response.errorMessage + ' ' + AstraSitesAdmin.ucwords(response.name) );
1087
+
1088
 
1089
  $card
1090
  .removeClass( 'button-primary' )
1091
  .addClass( 'disabled' )
1092
  .html( wp.updates.l10n.installFailedShort );
1093
 
 
1094
  },
1095
 
1096
  /**
1101
 
1102
  var $card = $( '.plugin-card-' + args.slug );
1103
 
1104
+ AstraSitesAdmin._log_title( 'Installing ' + AstraSitesAdmin.ucwords(args.name ));
1105
 
1106
  $card.addClass('updating-message');
1107
 
1117
  var $button = jQuery( event.target ),
1118
  $init = $button.data( 'init' ),
1119
  $slug = $button.data( 'slug' );
1120
+ $name = $button.data( 'name' );
1121
 
1122
  if ( $button.hasClass( 'updating-message' ) || $button.hasClass( 'button-disabled' ) ) {
1123
  return;
1124
  }
1125
 
1126
+ AstraSitesAdmin._log_title( 'Activating plugin ' + AstraSitesAdmin.ucwords( $name ) );
1127
 
1128
  $button.addClass('updating-message button-primary')
1129
  .html( astraSitesAdmin.strings.btnActivating );
1145
 
1146
  if( result.success ) {
1147
 
1148
+ AstraSitesAdmin._log_title( 'Activated ' + AstraSitesAdmin.ucwords($name) );
1149
 
1150
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1151
 
1221
  */
1222
  _activateAllPlugins: function( activate_plugins ) {
1223
 
1224
+ AstraSitesAdmin._log_title( 'Activating Plugins..' );
1225
 
1226
  $.each( activate_plugins, function(index, single_plugin) {
1227
 
1229
  $siteOptions = $( '.wp-full-overlay-header').find('.astra-site-options').val(),
1230
  $enabledExtensions = $( '.wp-full-overlay-header').find('.astra-enabled-extensions').val();
1231
 
1232
+
1233
  AstraSitesAjaxQueue.add({
1234
  url: astraSitesAdmin.ajaxurl,
1235
  type: 'POST',
1243
 
1244
  if( result.success ) {
1245
 
 
 
1246
  var pluginsList = astraSitesAdmin.requiredPlugins.inactive;
1247
 
1248
  // Reset not installed plugins list.
1251
  // Enable Demo Import Button
1252
  AstraSitesAdmin._enable_demo_import_button();
1253
  } else {
 
1254
  }
1255
  }
1256
  });
1263
  */
1264
  _installAllPlugins: function( not_installed ) {
1265
 
1266
+ AstraSitesAdmin._log_title( 'Installing Plugins..' );
1267
 
1268
  $.each( not_installed, function(index, single_plugin) {
1269
 
1270
+ AstraSitesAdmin._log_title( 'Installing ' + AstraSitesAdmin.ucwords( single_plugin.name ));
1271
+
1272
  var $card = $( '.plugin-card-' + single_plugin.slug );
1273
 
1274
  // Add each plugin activate request in Ajax queue.
1295
  _importDemo: function(event) {
1296
  event.preventDefault();
1297
 
1298
+ var date = new Date();
1299
+
1300
+ AstraSitesAdmin.import_start_time = new Date();
1301
+
1302
  var disabled = $(this).attr('data-import');
1303
 
1304
  if ( typeof disabled !== 'undefined' && disabled === 'disabled' || $this.hasClass('disabled') ) {
1306
  $('.astra-demo-import').addClass('updating-message installing')
1307
  .text( wp.updates.l10n.installing );
1308
 
1309
+ $('.astra-sites-result-preview').show();
1310
+ var output = '<div class="current-importing-status-title"></div><div class="current-importing-status-description"></div>';
1311
+ $('.current-importing-status').html( output );
1312
+
1313
  /**
1314
  * Process Bulk Plugin Install & Activate
1315
  */
1346
  */
1347
  _importSite: function( apiURL ) {
1348
 
1349
+ AstraSitesAdmin._log_title( 'Started Importing..' );
 
 
 
1350
 
1351
  // 1. Request Site Import
1352
  $.ajax({
1359
  },
1360
  })
1361
  .fail(function( jqXHR ){
1362
+ AstraSitesAdmin._log_title( jqXHR.status + ' ' + jqXHR.responseText + ' ' + jqXHR.statusText, true );
 
1363
  })
1364
  .done(function ( demo_data ) {
1365
 
1366
  // 1. Fail - Request Site Import
1367
  if( false === demo_data.success ) {
1368
 
 
1369
 
1370
  } else {
1371
 
1375
  }
1376
 
1377
  // 1. Pass - Request Site Import
 
 
1378
  AstraSitesAdmin.customizer_data = JSON.stringify( demo_data.data['astra-site-customizer-data'] ) || '';
1379
  AstraSitesAdmin.wxr_url = encodeURI( demo_data.data['astra-site-wxr-path'] ) || '';
1380
  AstraSitesAdmin.wpforms_url = encodeURI( demo_data.data['astra-site-wpforms-path'] ) || '';
1450
  if( AstraSitesAPI._stored_data ) {
1451
  var site_data = AstraSitesAdmin._get_site_details( site_id );
1452
 
 
 
1453
  if( site_data ) {
1454
  // Set current site details.
1455
  AstraSitesAdmin.current_site = site_data;
1562
  astraSiteOptions = anchor.find('.astra-site-options').val() || '';
1563
  astraEnabledExtensions = anchor.find('.astra-enabled-extensions').val() || '';
1564
 
 
 
 
1565
  var template = wp.template('astra-site-preview');
1566
 
1567
  templateData = [{
1578
  astra_enabled_extensions : astraEnabledExtensions,
1579
  }];
1580
 
 
 
1581
  // delete any earlier fullscreen preview before we render new one.
1582
  $('.theme-install-overlay').remove();
1583
 
1598
  },
1599
  })
1600
  .done(function ( response ) {
 
1601
  if( response.success ) {
1602
  AstraSitesAdmin.site_imported_data = response.data;
1603
  }
1659
  // Remove loader.
1660
  $('.required-plugins').removeClass('loading').html('');
1661
 
 
 
1662
  })
1663
  .done(function ( response ) {
1664
 
1689
  remaining_plugins += parseInt( response.data.notinstalled.length );
1690
 
1691
  $( response.data.notinstalled ).each(function( index, plugin ) {
1692
+ $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'" data-name="'+plugin.name+'">'+plugin.name+'</li>');
1693
  });
1694
  }
1695
 
1704
  remaining_plugins += parseInt( response.data.inactive.length );
1705
 
1706
  $( response.data.inactive ).each(function( index, plugin ) {
1707
+ $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'" data-name="'+plugin.name+'">'+plugin.name+'</li>');
1708
  });
1709
  }
1710
 
1716
  if ( typeof response.data.active !== 'undefined' ) {
1717
 
1718
  $( response.data.active ).each(function( index, plugin ) {
1719
+ $('.required-plugins-list').append('<li class="plugin-card plugin-card-'+plugin.slug+'" data-slug="'+plugin.slug+'" data-init="'+plugin.init+'" data-name="'+plugin.name+'">'+plugin.name+'</li>');
1720
  });
1721
  }
1722
 
inc/assets/js/astra-sites-api.js CHANGED
@@ -12,54 +12,50 @@
12
  /**
13
  * API Request
14
  */
15
- _api_request: function( args ) {
16
 
17
- // Set API Request Data.
18
- var data = {
19
- url: AstraSitesAPI._api_url + args.slug,
20
  };
21
 
22
  if( astraRenderGrid.headers ) {
23
- data.headers = astraRenderGrid.headers;
24
  }
25
 
26
- $.ajax( data )
27
- .done(function( items, status, XHR ) {
28
-
29
- if( 'success' === status && XHR.getResponseHeader('x-wp-total') ) {
30
-
31
- if( args.id ) {
32
- AstraSitesAPI._stored_data[ args.id ] = $.merge( AstraSitesAPI._stored_data[ args.id ], items );
33
- }
34
-
35
- var data = {
36
- args : args,
37
  items : items,
38
- items_count : XHR.getResponseHeader('x-wp-total') || 0,
39
- };
40
-
41
- if( 'undefined' !== args.trigger && '' !== args.trigger ) {
42
- $(document).trigger( args.trigger, [data] );
43
- }
44
-
45
  } else {
46
  $(document).trigger( 'astra-sites-api-request-error' );
 
47
  }
48
-
49
  })
50
- .fail(function( jqXHR, textStatus ) {
 
 
 
 
 
51
 
52
- $(document).trigger( 'astra-sites-api-request-fail', [jqXHR, textStatus, args] );
 
 
53
 
54
- })
55
- .always(function() {
 
 
56
 
57
- $(document).trigger( 'astra-sites-api-request-always' );
58
 
59
- });
60
 
61
  },
62
 
63
  };
64
 
65
- })(jQuery);
12
  /**
13
  * API Request
14
  */
15
+ _api_request: function( args, callback ) {
16
 
17
+ var params = {
18
+ method: 'GET',
19
+ cache: 'default',
20
  };
21
 
22
  if( astraRenderGrid.headers ) {
23
+ params['headers'] = astraRenderGrid.headers;
24
  }
25
 
26
+ fetch( AstraSitesAPI._api_url + args.slug, params).then(response => {
27
+ if ( response.status === 200 ) {
28
+ return response.json().then(items => ({
 
 
 
 
 
 
 
 
29
  items : items,
30
+ items_count : response.headers.get( 'x-wp-total' ),
31
+ item_pages : response.headers.get( 'x-wp-totalpages' ),
32
+ }))
 
 
 
 
33
  } else {
34
  $(document).trigger( 'astra-sites-api-request-error' );
35
+ return response.json();
36
  }
 
37
  })
38
+ .then(data => {
39
+ if( 'object' === typeof data ) {
40
+ data['args'] = args;
41
+ if( data.args.id ) {
42
+ AstraSitesAPI._stored_data[ args.id ] = $.merge( AstraSitesAPI._stored_data[ data.args.id ], data.items );
43
+ }
44
 
45
+ if( 'undefined' !== typeof args.trigger && '' !== args.trigger ) {
46
+ $(document).trigger( args.trigger, [data] );
47
+ }
48
 
49
+ if( callback && typeof callback == "function"){
50
+ callback( data );
51
+ }
52
+ }
53
 
 
54
 
55
+ });
56
 
57
  },
58
 
59
  };
60
 
61
+ })(jQuery);
inc/assets/js/astra-sites-notices.js DELETED
@@ -1,21 +0,0 @@
1
- jQuery(document).ready(function ($) {
2
-
3
- jQuery( '.astra-notice.is-dismissible .notice-dismiss' ).on( 'click', function() {
4
- var $id = jQuery( this ).attr( 'id' ) || '';
5
- var $time = jQuery( this ).attr( 'dismissible-time' ) || '';
6
- var $meta = jQuery( this ).attr( 'dismissible-meta' ) || '';
7
-
8
- jQuery.ajax({
9
- url: ajaxurl,
10
- type: 'POST',
11
- data: {
12
- action : 'astra-notices',
13
- id : $id,
14
- meta : $meta,
15
- time : $time,
16
- },
17
- });
18
-
19
- });
20
-
21
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/assets/js/fetch.umd.js ADDED
@@ -0,0 +1,531 @@