1jQuery(function($){let widgetStates={};let postalCodeInputField=document.getElementById('billing_postcode');if(postalCodeInputField){postalCodeInputField.addEventListener('change',(event)=>{if(SendcloudShippingData){SendcloudShippingData.postal_code=postalCodeInputField.value}})} 2let $checkoutForm=$('form.checkout');if(0===$checkoutForm.length||!window.renderScShippingOptionModule){return} 3let $selectedShippingMethod,shippingMethodSelectorPrefix,mountElement,deliveryMethod,locale,state,renderedWidgetDestructor;$(document.body).on('updated_checkout',function(){window.renderScShippingOptionModule.then(onCheckoutUpdate)});function onCheckoutUpdate(){if(renderedWidgetDestructor){renderedWidgetDestructor.call()} 4$selectedShippingMethod=findSelectedShippingMethod();if(0===$selectedShippingMethod.length){return} 5initShippingMethodSelectorPrefix();let deliveryMethodConfig=$(`#${shippingMethodSelectorPrefix}_delivery_method`).html()||null;mountElement=$(`#${shippingMethodSelectorPrefix}_mount_point`).get(0);deliveryMethod=JSON.parse(deliveryMethodConfig);locale=$(`#${shippingMethodSelectorPrefix}_locale`).val()||'en-US';state=widgetStates[shippingMethodSelectorPrefix];if(mountElement){mountElement.classList.add('sc-delivery-method-mount-point');mountElement.setAttribute('data-sc-delivery-method-type',deliveryMethod.delivery_method_type)} 6let descriptionItems=document.getElementsByClassName('sc-delivery-method-description');for(let i=0;i<descriptionItems.length;i++){descriptionItems[i].parentElement.querySelector('label').classList.add('sc-delivery-method-title')} 7renderWidget()} 8function initShippingMethodSelectorPrefix(){shippingMethodSelectorPrefix=$selectedShippingMethod.attr('id');if(!$(`#${shippingMethodSelectorPrefix}_delivery_method`).html()){shippingMethodSelectorPrefix+='_'+$selectedShippingMethod.val().replace(/:/g,'')}} 9function findSelectedShippingMethod(){let name='shipping_method';return $checkoutForm.find(`select.${name}, input[name^="${name}"][type="radio"]:checked, input[name^="${name}"][type="hidden"]`)} 10function renderWidget(){if(!mountElement||!deliveryMethod){return} 11$(mountElement).on('scShippingOptionChange',onShippingOptionChange);window.renderScShippingOption({mountElement:mountElement,deliveryMethod:deliveryMethod,shippingData:SendcloudShippingData??{},renderDate:new Date(),locale:locale,state:state,localeMessages:SendcloudLocaleMessages,}).then(function(destructorCallback){renderedWidgetDestructor=destructorCallback})} 12function onShippingOptionChange(event){widgetStates[shippingMethodSelectorPrefix]=event.detail.state;let $selectionDataElement=$(`#${shippingMethodSelectorPrefix}_submit_data`);if(0!==$selectionDataElement.length){$selectionDataElement.val(JSON.stringify({...deliveryMethod,...event.detail.data}))}}})
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.