1window.amBrandOffer = window.amBrandOffer || {}; 2 3( function( window, document, $, plugin ) { 4 'use strict'; 5 6 plugin.generateOffer = function( options ) { 7 const { 8 input, 9 utmParams, 10 noLog = false, 11 skipCache = false, 12 container = '#am-brand-offer-container', 13 loading = '#am-brand-offer-loading', 14 onSuccess, 15 onError 16 } = options; 17 18 const $container = $( container ); 19 const $loading = $( loading ); 20 21 $container.html( '' ); 22 $loading.show(); 23 24 return $.ajax( { 25 url: '/wp-json/am-brand-offer/v1/generate-offer/', 26 method: 'POST', 27 headers: { 28 'X-WP-Nonce': window.amBrandOffer.nonce 29 }, 30 data: { 31 input: input, 32 utmParams: utmParams, 33 noLog: noLog, 34 skipCache: skipCache, 35 } 36 } ).done( function( response ) { 37 if ( response?.success ) { 38 $container.html( response.data.template ); 39 if ( typeof onSuccess === 'function' ) { 40 onSuccess( response ); 41 } 42 } else { 43 if ( typeof onError === 'function' ) { 44 onError(); 45 } 46 } 47 } ).fail( function() { 48 if ( typeof onError === 'function' ) { 49 onError(); 50 } 51 } ).always( function() { 52 $loading.hide(); 53 } ); 54 }; 55 56} )( window, document, jQuery, window.amBrandOffer );
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.