1// instance Scalapay Checkout Popup class 2const scalapayCheckoutPopup = new ScalapayCheckoutPopup(); 3 4/** 5 * @class ScalapayPopup 6 */ 7class ScalapayPopup { 8 /** 9 * Initialize the Scalapay Popup configuration. 10 * 11 * @returns void 12 */ 13 initConfiguration() { 14 // return if scalapayInPageConfig object does not exist 15 if (typeof scalapayInPageConfig === 'undefined') { 16 return; 17 } 18 19 // build the payload 20 if (!scalapayInPageConfig.ajaxControllerPayload && scalapayInPageConfig.checkoutFormSelector) { 21 const checkoutForm = document.querySelector(scalapayInPageConfig.checkoutFormSelector); 22 if (!!checkoutForm) { 23 scalapayInPageConfig.ajaxControllerPayload = () => new URLSearchParams( 24 Object.fromEntries(new FormData(checkoutForm)) 25 ).toString(); 26 } 27 } 28 29 // set configurations 30 scalapayCheckoutPopup.setConfig('paymentSelectors', scalapayInPageConfig.paymentSelectors); 31 scalapayCheckoutPopup.setConfig('agreementSelectors', scalapayInPageConfig.agreementSelectors); 32 scalapayCheckoutPopup.setConfig('placeOrderSelector', scalapayInPageConfig.checkoutPlaceOrderButtonSelector); 33 scalapayCheckoutPopup.setConfig('placeOrderStyle', scalapayInPageConfig.scalapayPlaceOrderWrapperStyle); 34 scalapayCheckoutPopup.setConfig('scalapayCdnUrl', scalapayInPageConfig.cdnHtmlUrl); 35 scalapayCheckoutPopup.setConfig('ajaxController', scalapayInPageConfig.ajaxController); 36 scalapayCheckoutPopup.setConfig('ajaxMode', scalapayInPageConfig.ajaxMode); 37 scalapayCheckoutPopup.setConfig('ajaxControllerPayload', scalapayInPageConfig.ajaxControllerPayload); 38 scalapayCheckoutPopup.setConfig('ajaxContentTypeHeader', scalapayInPageConfig.ajaxContentTypeHeader); 39 40 // run bootstrap 41 scalapayCheckoutPopup.bootstrap(); 42 } 43} 44 45// start after the DOM has been loaded 46document.addEventListener('DOMContentLoaded', () => { 47 // init scalapay popup class 48 const scalapayPopup = new ScalapayPopup(); 49 50 // init the plugin process 51 scalapayPopup.initConfiguration(); 52});
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.