PageSourceSearch

https://www.tes.com/themes/custom/tes_magazines/js/web_components/web-component-element-5QPwczJw.js

js tes.com collected 2026-10-01 08:45:22 UTC 23,565 bytes, 6 lines download raw bytes

1import{g as Ne,r as c,j as e,c as Ie,d as Ce}from"./tes-ui-DDGs9VdS.js";import{L}from"./label-IT7YjM1M.js";import{u as E,c as Y,a as z,B as ke}from"./button-f0uUb2re.js";import{c as F,u as Q,a as Ee,b as N,d as _e,e as Se,P as Pe}from"./index-X9qgO_AS.js";import{P as _}from"./index-YZoW_8D1.js";import{u as Te}from"./index.esm-B2OCcHXt.js";import{R as Fe}from"./RedirectButton-BpGKMwfe.js";import{u as Ae}from"./useQuery-DnawQf82.js";import{Q as Ge}from"./react-query-client-provider-CnYhUTtQ.js";/**
2 * @license lucide-react v0.534.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],De=Ne("circle",Me),Oe=(t,r)=>{const o=new URLSearchParams({productCode:r});return`${t}?${o.toString()}`},Le=async t=>{const r=Oe(t.url,t.productCode),o=new FormData,n=await(await fetch(r,t.options?t.options(o):{credentials:"same-origin"})).json();return{products:n.products.map(a=>({id:a.id,name:a.name,unitPrice:a.unitPrice,currency:a.currency})),total:{netTotal:n.total.netTotal,grossTotal:n.total.grossTotal,vatTotal:n.total.vatTotal}}},Be=async(t,r,o)=>{const s=new FormData;r.forEach(i=>{s.append("productIds",i)}),o&&s.append("purchaseOrderNumber",o);const n=await fetch(t.url,t.options?t.options(s):{method:"POST",credentials:"same-origin",body:s});if(!n.ok)throw new Error("Failed to get checkout URL");return(await n.json()).checkoutUrl},J=c.createContext(void 0),X=()=>{const t=c.useContext(J);if(!t)throw new Error("useError must be used within an ErrorProvider");return t},Ue=({children:t})=>{const[r,o]=c.useState(null);return e.jsx(J.Provider,{value:{error:r,setError:o},children:t})},T=(t,r)=>{const o=(t/100).toFixed(2).toString(),s=Ke(r);return new Intl.NumberFormat(s,{style:"currency",currency:r}).format(Number(o))},ze=t=>t.reduce((r,o)=>r+o.unitPrice,0);function Ke(t){switch(t){case"GBP":return"en-GB";case"EUR":return"en-IE";case"USD":return"es-US";case"AUD":return"en-AU";default:return"en-GB"}}const Ve=({products:t,vatTotal:r})=>{const o=t.length>0?t[0].currency:"GBP",s=ze(t),n=s+r;return e.jsx("section",{"data-testid":"basket-container",className:"text-base font-sans p-4 md:p-0 rounded-xl md:rounded-none shadow-md md:shadow-none bg-white",children:e.jsxs("div",{className:"flex flex-col gap-6 md:gap-20 md:h-full",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:gap-6",children:[e.jsx("h2",{className:"text-lg md:text-xl font-bold font-display",children:"Basket"}),e.jsxs("div",{className:"flex justify-between border-b border-greyscale-300",children:[e.jsx("p",{className:"py-2",children:"Product(s)"}),e.jsx("p",{className:"flex items-center",children:"Price"})]}),e.jsx("div",{className:"flex flex-col gap-2",children:t.map((a,i)=>e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{"data-testid":"basket-product-name",className:"py-2 text-sm md:text-base",children:a.name}),e.jsx("p",{"data-testid":"basket-product-unit-price",className:"flex items-center font-bold",children:T(a.unitPrice,o)})]},i))})]}),e.jsxs("div",{className:"flex flex-col gap-2 py-2 md:mb-28 border-t border-greyscale-300",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{children:"Sub-total"}),e.jsx("p",{"data-testid":"basket-products-subtotal",className:"font-bold",children:T(s,o)})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("p",{children:"VAT"}),e.jsx("p",{"data-testid":"basket-products-vat-total",className:"font-bold",children:T(r,o)})]}),e.jsxs("div",{className:"flex justify-between font-bold font-display",children:[e.jsx("p",{className:"flex items-center text-md",children:"Total"}),e.jsxs("p",{"data-testid":"basket-products-gross-total",className:"text-lg",children:[T(n,o),"/year"]})]})]})]})})};function qe(t){const r=t+"CollectionProvider",[o,s]=F(r),[n,a]=o(r,{collectionRef:{current:null},itemMap:new Map}),i=y=>{const{scope:p,children:x}=y,j=c.useRef(null),h=c.useRef(new Map).current;return e.jsx(n,{scope:p,itemMap:h,collectionRef:j,children:x})};i.displayName=r;const d=t+"CollectionSlot",f=Y(d),l=c.forwardRef((y,p)=>{const{scope:x,children:j}=y,h=a(d,x),b=E(p,h.collectionRef);return e.jsx(f,{ref:b,children:j})});l.displayName=d;const u=t+"CollectionItemSlot",m="data-radix-collection-item",v=Y(u),g=c.forwardRef((y,p)=>{const{scope:x,children:j,...h}=y,b=c.useRef(null),I=E(p,b),C=a(u,x);return c.useEffect(()=>(C.itemMap.set(b,{ref:b,...h}),()=>void C.itemMap.delete(b))),e.jsx(v,{[m]:"",ref:I,children:j})});g.displayName=u;function w(y){const p=a(t+"CollectionConsumer",y);return c.useCallback(()=>{const j=p.collectionRef.current;if(!j)return[];const h=Array.from(j.querySelectorAll(`[${m}]`));return Array.from(p.itemMap.values()).sort((C,P)=>h.indexOf(C.ref.current)-h.indexOf(P.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:i,Slot:l,ItemSlot:g},w,s]}var $e=c.createContext(void 0);function Z(t){const r=c.useContext($e);return t||r||"ltr"}var O="rovingFocusGroup.onEntryFocus",We={bubbles:!1,cancelable:!0},S="RovingFocusGroup",[B,ee,He]=qe(S),[Ye,te]=F(S,[He]),[Qe,Je]=Ye(S),re=c.forwardRef((t,r)=>e.jsx(B.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(B.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Xe,{...t,ref:r})})}));re.displayName=S;var Xe=c.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:o,orientation:s,loop:n=!1,dir:a,currentTabStopId:i,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:f,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...m}=t,v=c.useRef(null),g=E(r,v),w=Z(a),[y,p]=Q({prop:i,defaultProp:d??null,onChange:f,caller:S}),[x,j]=c.useState(!1),h=Ee(l),b=ee(o),I=c.useRef(!1),[C,P]=c.useState(0);return c.useEffect(()=>{const R=v.current;if(R)return R.addEventListener(O,h),()=>R.removeEventListener(O,h)}
vendor: 11,798 bytes, line 6
6,[h]),e.jsx(Qe,{scope:o,orientation:s,dir:w,loop:n,currentTabStopId:y,onItemFocus:c.useCallback(R=>p(R),[p]),onItemShiftTab:c.useCallback(()=>j(!0),[]),onFocusableItemAdd:c.useCallback(()=>P(R=>R+1),[]),onFocusableItemRemove:c.useCallback(()=>P(R=>R-1),[]),children:e.jsx(_.div,{tabIndex:x||C===0?-1:0,"data-orientation":s,...m,ref:g,style:{outline:"none",...t.style},onMouseDown:N(t.onMouseDown,()=>{I.current=!0}),onFocus:N(t.onFocus,R=>{const ye=!I.current;if(R.target===R.currentTarget&&ye&&!x){const H=new CustomEvent(O,We);if(R.currentTarget.dispatchEvent(H),!H.defaultPrevented){const D=b().filter(k=>k.focusable),we=D.find(k=>k.active),je=D.find(k=>k.id===y),Re=[we,je,...D].filter(Boolean).map(k=>k.ref.current);ne(Re,u)}}I.current=!1}),onBlur:N(t.onBlur,()=>j(!1))})})}),oe="RovingFocusGroupItem",se=c.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:o,focusable:s=!0,active:n=!1,tabStopId:a,children:i,...d}=t,f=_e(),l=a||f,u=Je(oe,o),m=u.currentTabStopId===l,v=ee(o),{onFocusableItemAdd:g,onFocusableItemRemove:w,currentTabStopId:y}=u;return c.useEffect(()=>{if(s)return g(),()=>w()},[s,g,w]),e.jsx(B.ItemSlot,{scope:o,id:l,focusable:s,active:n,children:e.jsx(_.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...d,ref:r,onMouseDown:N(t.onMouseDown,p=>{s?u.onItemFocus(l):p.preventDefault()}),onFocus:N(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:N(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){u.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const x=tt(p,u.orientation,u.dir);if(x!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let h=v().filter(b=>b.focusable).map(b=>b.ref.current);if(x==="last")h.reverse();else if(x==="prev"||x==="next"){x==="prev"&&h.reverse();const b=h.indexOf(p.currentTarget);h=u.loop?rt(h,b+1):h.slice(b+1)}setTimeout(()=>ne(h))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:y!=null}):i})})});se.displayName=oe;var Ze={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function et(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function tt(t,r,o){const s=et(t.key,o);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Ze[s]}function ne(t,r=!1){const o=document.activeElement;for(const s of t)if(s===o||(s.focus({preventScroll:r}),document.activeElement!==o))return}function rt(t,r){return t.map((o,s)=>t[(r+s)%t.length])}var ot=re,st=se;function nt(t){const[r,o]=c.useState(void 0);return Se(()=>{if(t){o({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const a=n[0];let i,d;if("borderBoxSize"in a){const f=a.borderBoxSize,l=Array.isArray(f)?f[0]:f;i=l.inlineSize,d=l.blockSize}else i=t.offsetWidth,d=t.offsetHeight;o({width:i,height:d})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else o(void 0)},[t]),r}function at(t){const r=c.useRef({value:t,previous:t});return c.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var K="Radio",[ct,ae]=F(K),[it,A]=ct(K);function ce(t){const{__scopeRadio:r,checked:o=!1,children:s,disabled:n,form:a,name:i,onCheck:d,required:f,value:l="on",internal_do_not_use_render:u}=t,[m,v]=c.useState(null),[g,w]=c.useState(null),y=c.useRef(!1),p=m?!!a||!!m.closest("form"):!0,x={checked:o,disabled:n,required:f,name:i,form:a,value:l,control:m,setControl:v,hasConsumerStoppedPropagationRef:y,isFormControl:p,bubbleInput:g,setBubbleInput:w,onCheck:()=>d==null?void 0:d()};return e.jsx(it,{scope:r,...x,children:dt(u)?u(x):s})}var ie="RadioTrigger",V=c.forwardRef(({__scopeRadio:t,onClick:r,...o},s)=>{const{checked:n,disabled:a,value:i,setControl:d,onCheck:f,hasConsumerStoppedPropagationRef:l,isFormControl:u,bubbleInput:m}=A(ie,t),v=E(s,d);return e.jsx(_.button,{type:"button",role:"radio","aria-checked":n,"data-state":fe(n),"data-disabled":a?"":void 0,disabled:a,value:i,...o,ref:v,onClick:N(r,g=>{n||f(),m&&u&&(l.current=g.isPropagationStopped(),l.current||g.stopPropagation())})})});V.displayName=ie;var lt=c.forwardRef((t,r)=>{const{__scopeRadio:o,name:s,checked:n,required:a,disabled:i,value:d,onCheck:f,form:l,...u}=t;return e.jsx(ce,{__scopeRadio:o,checked:n,disabled:i,required:a,onCheck:f,name:s,form:l,value:d,internal_do_not_use_render:({isFormControl:m})=>e.jsxs(e.Fragment,{children:[e.jsx(V,{...u,ref:r,__scopeRadio:o}),m&&e.jsx(q,{__scopeRadio:o})]})})});lt.displayName=K;var le="RadioIndicator",de=c.forwardRef((t,r)=>{const{__scopeRadio:o,forceMount:s,...n}=t,a=A(le,o);return e.jsx(Pe,{present:s||a.checked,children:e.jsx(_.span,{"data-state":fe(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:r})})});de.displayName=le;var ue="RadioBubbleInput",q=c.forwardRef(({__scopeRadio:t,...r},o)=>{const{control:s,checked:n,required:a,disabled:i,name:d,value:f,form:l,bubbleInput:u,setBubbleInput:m,hasConsumerStoppedPropagationRef:v}=A(ue,t),g=E(o,m),w=at(n),y=nt(s);c.useEffect(()=>{const x=u;if(!x)return;const j=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(j,"checked").set,I=!v.current;if(w!==n&&b){const C=new Event("click",{bubbles:I});b.call(x,n),x.dispatchEvent(C)}},[u,w,n,v]);const p=c.useRef(n);return e.jsx(_.input,{type:"radio","aria-hidden":!0,defaultChecked:p.current,required:a,disabled:i,name:d,value:f,form:l,...r,tabIndex:-1,ref:g,style:{...r.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});q.displayName=ue;function dt(t){return typeof t=="function"}function fe(t){return t?"checked":"unchecked"}var ut=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G="RadioGroup",[ft]=F(G,[te,ae]),me=te(),M=ae(),[mt,pt]=ft(G),$=c.forwardRef((t,r)=>{const{__scopeRadioGroup:o,name:s,defaultValue:n,value:a,required:i=!1,disabled:d=!1,orientation:f,dir:l,loop:u=!0,onValueChange:m,...v}=t,g=me(o),w=Z(l),[y,p]=Q({prop:a,defaultProp:n??null,onChange:m,caller:G});return e.jsx(mt,{scope:o,name:s,required:i,disabled:d,value:y,onValueChange:p,children:e.jsx(ot,{asChild:!0,...g,orientation:f,dir:w,loop:u,children:e.jsx(_.div,{role:"radiogroup","aria-required":i,"aria-orientation":f,"data-disabled":d?"":void 0,dir:w,...v,ref:r})})})});$.displayName=G;var xt="RadioGroupItem",ht="RadioGroupItemProvider",pe="RadioGroupItemTrigger",bt="RadioGroupItemBubbleInput";function vt(t){const{__scopeRadioGroup:r,value:o,disabled:s,children:n,internal_do_not_use_render:a}=t,i=pt(ht,r),d=M(r),f=i.disabled||s;return e.jsx(ce,{...d,checked:i.value===o,disabled:f,required:i.required,name:i.name,value:o,onCheck:()=>i.onValueChange(o),internal_do_not_use_render:a,children:n})}var xe=c.forwardRef((t,r)=>{const{__scopeRadioGroup:o,...s}=t,n=me(o),a=M(o),{checked:i,disabled:d}=A(pe,a.__scopeRadio),f=c.useRef(null),l=E(r,f),u=c.useRef(!1);return c.useEffect(()=>{const m=g=>{ut.includes(g.key)&&(u.current=!0)},v=()=>u.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",v)}},[]),e.jsx(st,{asChild:!0,...n,focusable:!d,active:i,children:e.jsx(V,{...a,...s,ref:l,onKeyDown:N(s.onKeyDown,m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:N(s.onFocus,()=>{var m;u.current&&((m=f.current)==null||m.click())})})})});xe.displayName=pe;var W=c.forwardRef((t,r)=>{const{__scopeRadioGroup:o,value:s,disabled:n,...a}=t;return e.jsx(vt,{__scopeRadioGroup:o,value:s,disabled:n,internal_do_not_use_render:({isFormControl:i})=>e.jsxs(e.Fragment,{children:[e.jsx(xe,{...a,ref:r,__scopeRadioGroup:o}),i&&e.jsx(he,{__scopeRadioGroup:o})]})})});W.displayName=xt;var he=c.forwardRef((t,r)=>{const{__scopeRadioGroup:o,...s}=t,n=M(o);return e.jsx(q,{...n,...s,ref:r})});he.displayName=bt;var gt="RadioGroupIndicator",be=c.forwardRef((t,r)=>{const{__scopeRadioGroup:o,...s}=t,n=M(o);return e.jsx(de,{...n,...s,ref:r})});be.displayName=gt;const ve=c.forwardRef(({className:t,...r},o)=>e.jsx($,{className:z("grid gap-2",t),...r,ref:o}));ve.displayName=$.displayName;const U=c.forwardRef(({className:t,...r},o)=>e.jsx(W,{ref:o,className:z("aspect-square h-5 w-5 rounded-full border border-neutral-900 text-neutral-900 shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(be,{className:"flex items-center justify-center",children:e.jsx(De,{className:"h-3 w-3 fill-black"})})}));U.displayName=W.displayName;const ge=c.forwardRef(({className:t,type:r,...o},s)=>e.jsx("input",{type:r,className:z("flex h-9 w-full rounded-lg border border-greyscale-500 bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-neutral-950 placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-neutral-800 dark:file:text-neutral-50 dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-300",t),ref:s,...o}));ge.displayName="Input";const yt=c.forwardRef((t,r)=>{const{labelText:o,errorText:s,containerStyles:n,...a}=t,{name:i,required:d,disabled:f}=a,l=!!s,u=Ie("cursor-pointer text-base leading-none",{"text-greyscale-700":!f,"text-greyscale-500":f});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`group flex cursor-pointer h-8 ${n}`,children:[e.jsx("div",{className:"h-8 w-8 rounded-full outline-none flex",children:e.jsx("input",{...a,id:i,ref:r,type:"checkbox",className:"my-auto h-4 w-4 cursor-pointer rounded-sm border-greyscale-500 accent-inkwell-600"})}),o&&e.jsxs("label",{htmlFor:i,className:u,children:[o,d?e.jsx("span",{className:"text-alert",children:" * "}):null]})]}),l&&e.jsx("p",{"data-testid":`${i}-error`,className:"ml-4 mt-2 text-sm text-alert",children:s})]})});function wt(){return e.jsx("div",{className:"ease-in-out duration-200",children:e.jsx("span",{className:"text-sm lg:text-base font-bold text-danger",children:"*Please agree to the terms and conditions before checkout."})})}function jt({checkoutUrlRequest:t,productIds:r}){const{setError:o}=X(),{register:s,handleSubmit:n,formState:{errors:a}}=Te({defaultValues:{}}),i=l=>{window.location.href=l},d=async l=>{const u={purchaseOrderNumber:l.purchaseOrderInput||"",productIds:r};try{const m=await Be(t,u.productIds,u.purchaseOrderNumber);i(m)}catch{const m="Error fetching checkout URL";o(m),console.error(m)}},f=Object.keys(a).length>0;return e.jsxs("form",{className:"h-full flex flex-col justify-between",onSubmit:n(d),children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"mb-4 flex flex-col",children:[e.jsx(L,{className:"pb-2",htmlFor:"purchase-order-input",children:"Purchase order number (optional)"}),e.jsx(ge,{className:"p-4","data-testid":"checkout-purchase-number",placeholder:"e.g. PO-000",...s("purchaseOrderInput",{required:!1})})]}),e.jsx(yt,{"data-testid":"checkout-terms-and-conditions-checkbox",containerStyles:"h-full",labelText:e.jsxs("p",{className:"text-greyscale-700 ml-4 text-sm xl:text-base",children:["I agree to the ",e.jsx("a",{className:"underline font-bold","data-testid":"checkout-terms-and-conditions-link",href:"https://www.tes.com/en-gb/policies/general-terms-business",children:"Terms and Conditions"})," and confirm that I have purchasing authority for my organisation."]}),...s("terms",{required:!0})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"w-full mb-4",children:e.jsx("div",{className:`transition-all ease-linear duration-300 overflow-hidden ${f?"opacity-100 max-h-30 mt-2":"opacity-0 max-h-0 mt-0 pointer-events-none"}`,children:e.jsx(wt,{})})}),e.jsx("button",{"data-testid":"checkout-go-to-payment-button","data-tracking-event":"click","data-
6product-area":"store","data-name":"checkout.go_to_payment","data-entity-type":"product","data-entity-id":r,disabled:f,className:"flex items-center justify-center min-h-10 tracking-widest w-full px-4 font-bold rounded-lg transition-all duration-300 ease-in-out overflow-hidden bg-azure-600 hover:bg-azure-300 active:bg-azure-700 text-white",children:"Go to payment"})]})]})}function Rt({checkoutUrlRequest:t,productIds:r}){const[o,s]=c.useState("Card");return e.jsxs("div",{className:"bg-white shadow-md md:shadow-none rounded-2xl md:rounded-none w-full md:h-full flex flex-col gap-6 md:gap-4 p-4 md:p-0",children:[e.jsx("h2",{className:"lg:w-full text-md md:text-lg font-bold sm:mb-4 font-display lg:mb-4",children:"Payment method"}),e.jsxs(ve,{className:"flex flex-col gap-4 mb-2",defaultValue:"Card",onValueChange:n=>s(n),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(U,{value:"Card","data-testid":"checkout-payment-method-card",id:"payment-method-card",defaultChecked:!0}),e.jsx(L,{htmlFor:"payment-method-card",children:"Card"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(U,{value:"Invoice","data-testid":"checkout-payment-method-invoice",id:"payment-method-invoice"}),e.jsx(L,{htmlFor:"payment-method-invoice",children:"Invoice"})]})]}),e.jsx("hr",{className:"border-greyscale-300"}),o==="Invoice"?e.jsxs("div",{className:"h-full flex flex-col justify-between",children:[e.jsx("p",{className:"text-sm md:text-base mb-6",children:"Click the button below to fill in your details so we can provide you with an invoice."}),e.jsx(ke,{asChild:!0,className:"flex items-center justify-center min-h-10 tracking-widest w-full px-4 font-bold rounded-lg transition-all duration-300 ease-in-out overflow-hidden bg-azure-600 hover:bg-azure-300 active:bg-azure-700 text-white","data-testid":"checkout-provide-invoice-details-button","data-tracking-event":"click","data-product-area":"store","data-name":"checkout.provide_invoice_details","data-entity-type":"product","data-entity-id":r,children:e.jsx("a",{href:"https://www.tes.com/for-schools/safeguarding-training/invoice-request",target:"_blank",children:"Provide invoice details"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"lg:w-full text-md md:text-lg font-bold sm:mb-4 font-display lg:mb-4",children:"Additional information"}),e.jsx(jt,{checkoutUrlRequest:t,productIds:r})]})]})}const Nt=({salesEmail:t,salesPhoneNumber:r,redirectUrl:o,tesAppName:s})=>e.jsxs("section",{"data-testid":"error-message-container",className:"w-full flex flex-col items-center justify-center gap-10 p-4 md:p-0 rounded-xl md:rounded-none shadow-md md:shadow-none font-sans text-base text-greyscale-700 bg-white",children:[e.jsx("div",{className:"w-fit pb-2 border-b border-greyscale-700",children:e.jsx("h2",{className:"font-display font-bold text-center text-md md:text-lg",children:"We're currently unable to take orders through our website."})}),e.jsxs("p",{className:"text-center",children:["But no worries! Our sales team is available to take your order.",e.jsx("br",{}),"Just contact us at:"]}),e.jsxs("div",{className:"md:mb-10 xl:mb-26 flex flex-col font-bold",children:[e.jsx("p",{className:"text-center underline",children:e.jsx("a",{href:`mailto:${t}`,children:t})}),e.jsx("p",{"data-testid":"error-message-sales-phone-link",className:"text-center underline",children:e.jsx("a",{href:`tel:${r}`,children:r})})]}),e.jsxs("p",{className:"md:w-3/4 lg:w-1/2 text-center text-sm",children:["If you have any questions, our support team is here to help. You can reach us at"," ",e.jsx("a",{href:"mailto:[email protected]",className:"underline",children:"[email protected]"})," ","or visit our"," ",e.jsx("a",{"data-testid":"error-message-help-link",href:"https://www.tes.com/en-gb/contact",className:"underline",children:"Help centre"})," ","."]}),o&&s&&e.jsx(Fe,{redirectUrl:o,tesAppName:s})]}),It=({data:t,queryError:r,getCheckoutUrlRequest:o,salesEmail:s,salesPhoneNumber:n,tesAppName:a,redirectUrl:i})=>{const{error:d}=X(),f=d||r;return e.jsxs("div",{className:"flex flex-col items-center gap-6 lg:gap-10 w-full text-greyscale-700",children:[e.jsx("div",{className:"flex flex-col items-center justify-between w-64 lg:w-full",children:e.jsx("h1",{className:"text-xl lg:text-6xl text-center font-bold font-display",children:"Checkout"})}),e.jsx("div",{className:"relative flex flex-col items-center justify-center w-full",children:e.jsx("div",{className:"flex px-4 md:px-9 justify-center w-full ",children:e.jsx("div",{"data-testid":"checkout-wrapper",className:"w-full xl:w-3/4 2xl:w-2/3 flex flex-col md:flex-row md:justify-between gap-6 md:gap-10 md:p-6 md:rounded-2xl md:bg-white md:shadow-lg",children:f?e.jsx(Nt,{salesEmail:s,salesPhoneNumber:n,redirectUrl:i,tesAppName:a}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 md:w-1/2",children:e.jsx(Ve,{products:t.products.map(l
6=>({name:l.name,unitPrice:l.unitPrice,currency:l.currency})),vatTotal:t.total.vatTotal})}),e.jsx("div",{className:"hidden md:block min-h-full w-0.5 bg-greyscale-200 rounded-2xl"}),e.jsx("div",{className:"md:flex-1 md:w-1/2",children:e.jsx(Rt,{checkoutUrlRequest:o,productIds:t.products.map(l=>l.id)})})]})})})})]})};function Ct({getProductOptionsDataRequest:t,getCheckoutUrlRequest:r,salesEmail:o,salesPhoneNumber:s,tesAppName:n,redirectUrl:a}){const{isLoading:i,data:d,error:f}=Ae(["get-checkout-data"],()=>Le(t),{refetchOnWindowFocus:!1});return i?e.jsx("p",{children:"Loading..."}):e.jsx(Ue,{children:e.jsx(It,{data:d,queryError:f,getCheckoutUrlRequest:r,salesEmail:o,salesPhoneNumber:s,tesAppName:n,redirectUrl:a})})}const Dt=({getProductOptionsDataRequest:t,getCheckoutUrlRequest:r,salesEmail:o,salesPhoneNumber:s,redirectUrl:n,tesAppName:a})=>Ce(()=>e.jsx(Ge,{children:e.jsx(Ct,{getProductOptionsDataRequest:t,getCheckoutUrlRequest:r,salesEmail:o,salesPhoneNumber:s,redirectUrl:n,tesAppName:a})}),[],void 0,{mode:"open"});export{Dt as CheckoutWebComponentElement};

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.