PageSourceSearch

https://www.toolstation.com/_nuxt/2.15.1-uk-DeliveryMethods-CP3LlUgz.js

js toolstation.com collected 2026-10-01 11:51:19 UTC 5,511 bytes, 1 lines download raw bytes

1import{s as P}from"./2.15.1-uk-nuxt-B44lAuBn.js";import{$t as b,At as o,K as n,S as k,St as R,U as V,b as C,d as _,f as v,m as T,p as f,st as S,u as d,ut as y}from"./2.15.1-uk-runtime-core.esm-bundler-CM7kzQMe.js";import{t as Y}from"./2.15.1-uk-runtime-dom.esm-bundler-GujwpO3G.js";import{a as E,r as i}from"./2.15.1-uk-gift-card-plain-NH7kHq_M.js";import{t as L}from"./2.15.1-uk-trolley-BADzxSLc.js";import{n as w,t as A}from"./2.15.1-uk-logger-B0C-TRr1.js";import{r as B}from"./2.15.1-uk-vue-i18n-DdD6VHSI.js";import{t as U}from"./2.15.1-uk-_plugin-vue_export-helper-K9rsuiWd.js";import{t as F}from"./2.15.1-uk-useBloomreach-Bqkimq4H.js";import{t as $}from"./2.15.1-uk-AlertBox-bpVTLB-7.js";import{t as z}from"./2.15.1-uk-SectionGroup-C0fZw_lW.js";import{t as H}from"./2.15.1-uk-SectionItem-CdcQUKt6.js";import{n as K}from"./2.15.1-uk-review-Bf1T5lQO.js";var X={class:"w-full rounded-xl"},j={key:0,class:"font-bold mb-0 sm:mb-2 ml-4 sm:ml-0 mt-6 sm:mt-0 text-size-3 sm:text-size-4 text-blue rounded"},G=["innerHTML"],W={class:"relative max-sm:p-3"},q=k({__name:"DisplayDeliveryMethods",props:{title:{},deliveryMethods:{},channelProducts:{},channel:{},modelName:{},defaultDeliveryMethod:{}},emits:["methodSelected"],setup(s,{emit:c}){const e=F(),a=s,M=c,{locale:I}=B(),u=L(),D=P(),h=R(null),l=R(a.defaultDeliveryMethod||""),r=d(()=>{const t=D.public.currency||"GBP";try{return new Intl.NumberFormat(I.value,{style:"currency",currency:t}).formatToParts(0).find(p=>p.type==="currency")?.value||"£"}catch{return"£"}}),m=d(()=>a.deliveryMethods.map(t=>({id:t.code,name:t.name,body:t.description||"",value:`${r.value}${t.price.toFixed(2)}`}))),g=t=>t?.text?.value,O=async()=>{try{h.value=await e.fetchBrDocument("CHECKOUT","holiday-delivery-times-checkout")}catch(t){w.error("DisplayDeliveryMethods failed to fetch holiday delivery times",t,{fileName:"DisplayDeliveryMethods",feature:"checkout",action:"fetchBrDocument",errorType:"Bloomreach Document",params:{documentPath:"checkout",document:"holiday-delivery-times-checkout"}},A.Critical),h.value=null}};V(()=>{O()});const N=async t=>{l.value=t,u.setDeliveryMethodUpdating(!0),u.setSelectedDeliveryMethods({channel:a.channel,method:t}),await Promise.all(a.channelProducts.map(async p=>{await u.updateTrolleyLineDeliveryMethod(p.id,t)})),u.setDeliveryMethodUpdating(!1),M("methodSelected",t)};return S(()=>a.defaultDeliveryMethod,t=>{t&&!l.value&&(l.value=t)},{immediate:!0}),(t,p)=>(n(),T("div",X,[s.title?(n(),T("h2",j,b(s.title),1)):f("",!0),h.value?(n(),v($,{key:1,class:"xs:mb-5 md:mt-4 mb-4 !mt-0",variant:"warning","data-testid":"alert-box"},{default:y(()=>[_("div",{class:"text-size-2",innerHTML:g(h.value)},null,8,G)]),_:1})):f("",!0),_("div",W,[C(K,{"data-testid":"delivery-items",items:m.value,name:s.modelName,"default-value":s.defaultDeliveryMethod,"items-length":s.modelName==="delivery_delivery_method"?2:1,onOptionSelected:N},null,8,["items","name","default-value","items-length"])])]))}}),x=Object.assign(q,{__name:"CheckoutDeliveryDisplayDeliveryMethods"}),J={class:"font-bold text-size-5 sm:text-size-6"},Q={class:"w-full sm:p-5 bg-grey-50"},Z={class:"flex flex-col sm:gap-6","data-testid":"delivery-methods"},ee=k({__name:"DeliveryMethods",setup(s){const{t:c}=B(),e=L(),a=i.FREE_SUPPLIER_DELIVERY,M=d(()=>e.hasDeliveryItems||e.hasDirectshipItems),I=d(()=>{const l=e.getDeliveryMethods.filter(r=>r.channel===E.DELIVERY);return l.some(r=>r.code===i.REMOTE_DELIVERY||r.code===i.FREE_REMOTE_DELIVERY)?l.filter(r=>r.code===i.REMOTE_DELIVERY||r.code===i.FREE_REMOTE_DELIVERY):l}),u=d(()=>{const l=e.getDeliveryMethods;return[i.TS_CLUB_FREE_EXPRESS,i.NEXT_BUSINESS_DAY,i.REMOTE_DELIVERY,i.FREE_REMOTE_DELIVERY].find(r=>l.some(m=>m.code===r))||i.NEXT_BUSINESS_DAY_WEEKEND}),D=d(()=>e.getDeliveryMethods.filter(l=>l.channel===E.DIRECTSHIP)),h=d(()=>e.hasDeliveryItems&&e.hasDirectshipItems?D.value.length?c("checkout.delivery.deliveryMethodTitle"):c("checkout.delivery.deliveryMethods"):"");return S(()=>e.getDeliveryAddressId,()=>{e.hasDeliveryItems&&e.fetchDeliveryMethods()}),S(()=>e.getCollectionAddressId,()=>{e.hasCollectionItems&&e.getDeliveryMethods.length!==0&&e.fetchDeliveryMethods()}),(l,r)=>(n(),v(Y,{name:"fade",mode:"out-in"},{default:y(()=>[M.value?(n(),v(z,{key:0,"initial-active":"deliveryMethod"},{default:y(({activeId:m,setActive:g})=>[C(H,{id:"deliveryMethod","is-accordion":!0,"is-open":m==="deliveryMethod",onSetActive:g},{header:y(()=>[_("span",J,b(o(c)("checkout.delivery.deliveryMethods")),1)]),default:y(()=>[_("div",Q,[_("div",Z,[o(e).hasDirectshipOnlyItems?(n(),v(x,{key:0,"data-testid":"directship-delivery-methods",title:o(e).hasDeliveryOnlyItems?o(c)("checkout.delivery.directship"):"","delivery-methods":D.value,"channel-products":o(e).getDirectshipItems,channel:o(E).DIRECTSHIP,"model-name":"directship_delivery_method","default-delivery-method":o(a)},null,8,["title","delivery-methods","channel-products","channel","default-delivery-method"])):f("",!0),o(e).hasDeliveryOnlyItems?(n(),v(x,{key:1,"data-testid":"delivery-delivery-methods",title:h.value,"delivery-methods":I.value,"channel-products":o(e).getDeliveryOnlyItems,channel:o(E).DELIVERY,"model-name":"delivery_delivery_method","default-delivery-method":u.value},null,8,["title","delivery-methods","channel-products","channel","default-delivery-method"])):f("",!0)])])]),_:1},8,["is-open","onSetActive"])]),_:1})):f("",!0)]),_:1}))}}),ve=Object.assign(U(ee,[["__scopeId","data-v-908281b2"]]),{__name:"CheckoutSectionsDeliveryMethods"});export{ve as default};

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.