1var backInStock = { 2 subscribe: function (productId) { 3 var notifyEmail = $(`#back-in-stock-${productId} [name="back-in-stock-email"]`).val(); 4 5 if (notifyEmail.length === 0) { 6 $(`#back-in-stock-${productId} .alert-error`).first().removeClass('hide'); 7 8 return false; 9 } else { 10 $(`#back-in-stock-${productId} .alert-error`).first().addClass('hide'); 11 } 12 13 $.ajax({ 14 type: 'POST', 15 url: 'https://a.klaviyo.com/client/back-in-stock-subscriptions/?company_id=' + shopconfig.klaviyoPublicApiKey, 16 contentType: 'application/json', 17 accept: 'application/json', 18 headers: {"revision": "2024-02-15"}, 19 data: JSON.stringify({ 20 data: { 21 type: 'back-in-stock-subscription', 22 attributes: { 23 channels: ['EMAIL'], 24 profile: { 25 data: { 26 type: 'profile', 27 attributes: { 28 email: notifyEmail, 29 } 30 } 31 } 32 }, 33 relationships: { 34 variant: { 35 data: { 36 type: 'catalog-variant', 37 id: '$custom:::$default:::' + productId 38 } 39 } 40 } 41 } 42 }), 43 success: function (response) { 44 $(`#back-in-stock-${productId} .alert-success`).first().removeClass('hide'); 45 $(`#back-in-stock-${productId} form`).hide(); 46 //reverse the actions on close of the modal and empty the input 47 $(`#back-in-stock-${productId} .close, .modal-backdrop`).on("click", function () { 48 $(`#back-in-stock-${productId} .alert-success`).first().addClass('hide'); 49 $(`#back-in-stock-${productId} form`).show(); 50 $(`#back-in-stock-${productId} [name="back-in-stock-email"]`).val(""); 51 }); 52 }, 53 error: function (response) { 54 console.log(response); 55 } 56 }); 57 58 return false; 59 } 60}
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.