| @@ -1,77 +1,2 @@ | ||
| 1 | 1 | import './amplitude-events' |
| 2 | - | |
| 3 | -( function ( $ ) { | |
| 4 | - $( document ).on( 'ready', function () { | |
| 5 | - let publishBtn = $( '.hsr-publish-btn' ); | |
| 6 | - let completedClass = 'completed'; | |
| 7 | - let gotItBtn = $( '.hsr-got-it-btn' ); | |
| 8 | - publishBtn.on( 'click', function ( e ) { | |
| 9 | - e.preventDefault(); | |
| 10 | - $( '.hsr-modal' ).addClass( 'open' ); | |
| 11 | - $( 'body' ).addClass( 'modal-open' ); | |
| 12 | - $.ajax( { | |
| 13 | - type: 'post', | |
| 14 | - dataType: 'json', | |
| 15 | - url: hostingerContainer.url, | |
| 16 | - data: { | |
| 17 | - action: 'hostinger_publish_website', | |
| 18 | - maintenance: 0, | |
| 19 | - nonce: hostingerContainer.nonce, | |
| 20 | - }, | |
| 21 | - success: function ( result ) { | |
| 22 | - const previewBtn = $( '.hsr-preview-btn' ); | |
| 23 | - $( '.hsr-circular' ).addClass( 'hsr-hide' ) | |
| 24 | - $( '.hsr-success-circular' ).addClass( 'hsr-show' ) | |
| 25 | - $( '.hsr-publish-modal--footer' ).addClass( 'show' ) | |
| 26 | - $( '.hsr-publish-modal--body h3' ).text( result.data.title ); | |
| 27 | - $( '.hsr-publish-modal--body__description' ).text( result.data.description ); | |
| 28 | - $( '.hsr-publish-btn' ).addClass( 'hsr-preview' ) | |
| 29 | - previewBtn.addClass( 'hsr-preview' ) | |
| 30 | - previewBtn.text( result.data.content.btn.text ) | |
| 31 | - $( '.hsr-onboarding__title' ).text( result.data.content.title ); | |
| 32 | - $( '.hsr-onboarding__description' ).text( result.data.content.description ); | |
| 33 | - }, | |
| 34 | - error: function ( xhr, status, error ) { | |
| 35 | - console.log( 'AJAX request failed: ' + error ); | |
| 36 | - } | |
| 37 | - } ) | |
| 38 | - } ) | |
| 39 | - | |
| 40 | - gotItBtn.on( 'click', function ( e ) { | |
| 41 | - e.preventDefault(); | |
| 42 | - const element = $( this ); | |
| 43 | - const step = $( this ).data( 'step' ); | |
| 44 | - let remaining_tasks = $( '.hsr-onboarding-steps' ).data( 'remaining-tasks' ); | |
| 45 | - | |
| 46 | - $.ajax( { | |
| 47 | - type: 'post', | |
| 48 | - dataType: 'json', | |
| 49 | - url: hostingerContainer.url, | |
| 50 | - data: { | |
| 51 | - action: 'hostinger_complete_onboarding_step', | |
| 52 | - step: step, | |
| 53 | - nonce: hostingerContainer.nonce, | |
| 54 | - }, | |
| 55 | - success: function () { | |
| 56 | - element.closest( '.hsr-onboarding-step--content' ).slideUp() | |
| 57 | - element.parents( '.hsr-onboarding-step' ) | |
| 58 | - .find( '.hsr-onboarding-step--status' ) | |
| 59 | - .addClass( completedClass ) | |
| 60 | - | |
| 61 | - if ( remaining_tasks > 0 ) { | |
| 62 | - remaining_tasks = remaining_tasks - 1; | |
| 63 | - $( '.hsr-onboarding-steps' ).data( 'remaining-tasks', remaining_tasks ) | |
| 64 | - | |
| 65 | - if ( remaining_tasks === 0 ) { | |
| 66 | - $( '.hsr-publish-btn' ).addClass( completedClass ); | |
| 67 | - } | |
| 68 | - | |
| 69 | - } | |
| 70 | - }, | |
| 71 | - error: function ( xhr, status, error ) { | |
| 72 | - console.log( 'AJAX request failed: ' + error ); | |
| 73 | - } | |
| 74 | - } ) | |
| 75 | - } ) | |
| 76 | - } ); | |
| 77 | -} )( jQuery ); | |
| 2 | +import './surveys' | |