| 1 |
;(function($) { |
| 2 |
|
| 3 |
Vue.component('wpuf-integration-mailpoet', { |
| 4 |
template: '#tmpl-wpuf-integration-mailpoet', |
| 5 |
mixins: [wpuf_mixins.integration_mixin], |
| 6 |
|
| 7 |
data: function() { |
| 8 |
return { |
| 9 |
lists: [] |
| 10 |
}; |
| 11 |
}, |
| 12 |
|
| 13 |
computed: { |
| 14 |
|
| 15 |
}, |
| 16 |
|
| 17 |
created: function() { |
| 18 |
this.fetchLists(); |
| 19 |
}, |
| 20 |
|
| 21 |
methods: { |
| 22 |
|
| 23 |
fetchLists: function(target) { |
| 24 |
var self = this; |
| 25 |
|
| 26 |
wp.ajax.send('wpuf_mailpoet_fetch_lists', { |
| 27 |
data: { |
| 28 |
_wpnonce: weForms.nonce |
| 29 |
}, |
| 30 |
|
| 31 |
success: function(response) { |
| 32 |
self.lists = response; |
| 33 |
}, |
| 34 |
}); |
| 35 |
}, |
| 36 |
|
| 37 |
insertValue: function(type, field, property) { |
| 38 |
var value = ( field !== undefined ) ? '{' + type + ':' + field + '}' : '{' + type + '}'; |
| 39 |
|
| 40 |
this.settings.fields[property] = value; |
| 41 |
} |
| 42 |
} |
| 43 |
}); |
| 44 |
|
| 45 |
})(jQuery); |