gutenberg
2 years ago
admin.js
3 years ago
admin.min.js
3 years ago
deactivation-feedback.js
3 years ago
deactivation-feedback.min.js
3 years ago
editor.js
7 years ago
editor.min.js
5 years ago
evf-admin-email.js
2 years ago
evf-admin-email.min.js
2 years ago
evf-clipboard.js
7 years ago
evf-clipboard.min.js
7 years ago
evf-enhanced-select.js
3 years ago
evf-enhanced-select.min.js
3 years ago
evf-file-uploader.js
3 years ago
evf-file-uploader.min.js
3 years ago
evf-setup.js
2 years ago
evf-setup.min.js
2 years ago
extensions.js
2 years ago
extensions.min.js
2 years ago
form-builder.js
2 years ago
form-builder.min.js
2 years ago
form-template-controller.js
3 years ago
form-template-controller.min.js
3 years ago
settings.js
3 years ago
settings.min.js
3 years ago
tools.js
4 years ago
tools.min.js
4 years ago
upgrade.js
2 years ago
upgrade.min.js
2 years ago
upgrade.js
148 lines
| 1 | /* global evf_upgrade, evf_data */ |
| 2 | jQuery( function( $ ) { |
| 3 | |
| 4 | /** |
| 5 | * Upgrade actions. |
| 6 | */ |
| 7 | var evf_upgrade_actions = { |
| 8 | init: function() { |
| 9 | $( document.body ).on( 'click dragstart', '.evf-registered-item.upgrade-modal', this.field_upgrade ); |
| 10 | $( document.body ).on( 'click dragstart', '.evf-registered-item.evf-upgrade-addon', this.evf_upgrade_addon ); |
| 11 | $( document.body ).on( 'click dragstart', '.evf-registered-item.enable-stripe-model', this.enable_stripe_model ); |
| 12 | $( document.body ).on( 'click dragstart', '.evf-registered-item.enable-authorize-net-model', this.enable_authorize_net_model ); |
| 13 | $( document.body ).on( 'click dragstart', '.everest-forms-field-option-row.upgrade-modal', this.feature_upgrade ); |
| 14 | $( document.body ).on( 'click dragstart', '.evf-upgradable-feature, .everest-forms-btn-group span.upgrade-modal', this.feature_upgrade ); |
| 15 | }, |
| 16 | feature_upgrade: function( e ) { |
| 17 | e.preventDefault(); |
| 18 | |
| 19 | evf_upgrade_actions.upgrade_modal( $( this ).data( 'feature' ) ? $( this ).data( 'feature' ) : $( this ).text() ); |
| 20 | }, |
| 21 | field_upgrade: function( e ) { |
| 22 | e.preventDefault(); |
| 23 | |
| 24 | evf_upgrade_actions.upgrade_modal( $( this ).data( 'feature' ) ? $( this ).data( 'feature' ) : $( this ).text() + ' field' ); |
| 25 | }, |
| 26 | evf_upgrade_addon:function(e){ |
| 27 | e.preventDefault(); |
| 28 | var fieldType = $(this).data('field-type'), |
| 29 | fieldPlan = $(this).data('field-plan'), |
| 30 | addonSlug = $(this).data('addon-slug'); |
| 31 | $.ajax({ |
| 32 | type: 'POST', |
| 33 | url: evf_upgrade.ajax_url, |
| 34 | data: { |
| 35 | action: 'everest_forms_install_and_active_addons', |
| 36 | field_plan: fieldPlan, |
| 37 | field_type: fieldType, |
| 38 | addon_slug: addonSlug, |
| 39 | security : evf_upgrade.evf_install_and_active_nonce |
| 40 | }, |
| 41 | success: function(res) { |
| 42 | if(res.success === true) { |
| 43 | $.alert( { |
| 44 | title: res.data.title, |
| 45 | theme: 'jconfirm-modern jconfirm-everest-forms', |
| 46 | icon: 'dashicons dashicons-lock', |
| 47 | backgroundDismiss: false, |
| 48 | scrollToPreviousElement: false, |
| 49 | content: res.data.message, |
| 50 | buttons:{ |
| 51 | confirm:{ |
| 52 | text:res.data.content, |
| 53 | keys:['enter'], |
| 54 | }, |
| 55 | }, |
| 56 | type: 'blue', |
| 57 | boxWidth: '565px', |
| 58 | } ); |
| 59 | } |
| 60 | if(res.success === false) { |
| 61 | $.alert( { |
| 62 | title: res.data.addon.name + ' ' + evf_upgrade.upgrade_plan_title, |
| 63 | theme: 'jconfirm-modern jconfirm-everest-forms', |
| 64 | icon: 'dashicons dashicons-lock', |
| 65 | backgroundDismiss: false, |
| 66 | scrollToPreviousElement: false, |
| 67 | content: evf_upgrade.upgrade_plan_message, |
| 68 | type: 'red', |
| 69 | boxWidth: '565px', |
| 70 | buttons: { |
| 71 | confirm: { |
| 72 | text: evf_upgrade.upgrade_plan_button, |
| 73 | btnClass: 'btn-confirm', |
| 74 | keys: ['enter'], |
| 75 | action: function () { |
| 76 | window.open( evf_upgrade.upgrade_url, '_blank' ); |
| 77 | } |
| 78 | }, |
| 79 | cancel: { |
| 80 | text: evf_data.i18n_ok |
| 81 | } |
| 82 | } |
| 83 | } ); |
| 84 | } |
| 85 | } |
| 86 | }) |
| 87 | }, |
| 88 | upgrade_modal: function( feature ) { |
| 89 | var message = evf_upgrade.upgrade_message.replace( /%name%/g, feature ); |
| 90 | |
| 91 | $.alert({ |
| 92 | title: feature + ' ' + evf_upgrade.upgrade_title, |
| 93 | icon: 'dashicons dashicons-lock', |
| 94 | content: message, |
| 95 | type: 'red', |
| 96 | boxWidth: '565px', |
| 97 | buttons: { |
| 98 | confirm: { |
| 99 | text: evf_upgrade.upgrade_button, |
| 100 | btnClass: 'btn-confirm', |
| 101 | keys: ['enter'], |
| 102 | action: function () { |
| 103 | window.open( evf_upgrade.upgrade_url, '_blank' ); |
| 104 | } |
| 105 | }, |
| 106 | cancel: { |
| 107 | text: evf_data.i18n_ok |
| 108 | } |
| 109 | } |
| 110 | }); |
| 111 | }, |
| 112 | enable_stripe_model: function( e ) { |
| 113 | e.preventDefault(); |
| 114 | $.alert({ |
| 115 | title: evf_upgrade.enable_stripe_title, |
| 116 | content: evf_upgrade.enable_stripe_message, |
| 117 | icon: 'dashicons dashicons-info', |
| 118 | type: 'blue', |
| 119 | buttons : { |
| 120 | confirm : { |
| 121 | text: evf_data.i18n_close, |
| 122 | btnClass: 'btn-confirm', |
| 123 | keys: ['enter'] |
| 124 | } |
| 125 | } |
| 126 | }); |
| 127 | }, |
| 128 | enable_authorize_net_model: function( e ) { |
| 129 | e.preventDefault(); |
| 130 | $.alert({ |
| 131 | title: evf_upgrade.enable_authorize_net_title, |
| 132 | content: evf_upgrade.enable_authorize_net_message, |
| 133 | icon: 'dashicons dashicons-info', |
| 134 | type: 'blue', |
| 135 | buttons : { |
| 136 | confirm : { |
| 137 | text: evf_data.i18n_close, |
| 138 | btnClass: 'btn-confirm', |
| 139 | keys: ['enter'] |
| 140 | } |
| 141 | } |
| 142 | }); |
| 143 | } |
| 144 | }; |
| 145 | |
| 146 | evf_upgrade_actions.init(); |
| 147 | }); |
| 148 |