1// @ts-nocheck 2// Usage: 3// ------ 4// <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js" defer></script> 5// <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js" defer></script> 6// <script src="js/form-newsletter.js" defer></script> 7 8(function (document, Vue, axios, VuePhoneNumberInput) { 9 10 document 11 .querySelectorAll('[form-lead]') 12 .forEach(function (form) { 13 14 new Vue({ 15 el: form, 16 components: { 17 VuePhoneNumberInput 18 }, 19 data: function () { 20 return { 21 email: '', 22 phoneNumber: '', 23 campaignName: form.dataset.campaignName, 24 operatingSystemName: form.dataset.operatingSystemName, 25 language: form.dataset.language, 26 country: form.dataset.country, 27 submitting: false, 28 submittedWithError: false, 29 submittedWithSuccess: false 30 }; 31 }, 32 mounted: function () { 33 34 var _this = this; 35 36 axios 37 .get('/user/api/me') 38 .then(function (response) { 39 var user = response.data; 40 41 _this.email = user.email; 42 _this.phoneNumber = user.phoneNumber; 43 44 }); 45 }, 46 methods: { 47 updatePhoneNumber: function (payload) { 48 var _this = this; 49 _this.formattedPhoneNumber = payload.formattedNumber; 50 }, 51 52 submit: function () { 53 54 var _this = this; 55 _this.submitting = true; 56 57 axios 58 .post('/api/leads', 59 { 60 customer: { 61 email: _this.email, 62 phoneNumber: _this.formattedPhoneNumber, 63 language: _this.language, 64 country: _this.country 65 }, 66 source: { 67 name: 'web' 68 }, 69 operatingSystem: { 70 name: _this.operatingSystemName 71 }, 72 campaign: { 73 name: _this.campaignName 74 } 75 }) 76 .then(function (response) { 77 78 _this.submitting = false; 79 _this.submittedWithError = false; 80 _this.submittedWithSuccess = true; 81 82 window.dataLayer = window.dataLayer || []; 83 window.dataLayer.push({ 84 event: 'form-lead' 85 }); 86 }) 87 .catch(function (error) { 88 _this.submitting = false; 89 _this.submittedWithError = true; 90 _this.submittedWithSuccess = false; 91 }); 92 93 } 94 } 95 }); 96 97 }); 98 99})(document, window.Vue, window.axios, window['vue-phone-number-input']);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.