1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__||=[]).push([[1897],{55563(e,t,i){function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return!(!e||0===t.length)&&t.includes(e)}i.d(t,{f:()=>n})},30700(e,t,i){i.d(t,{l:()=>c});i(76998);var n=i(13761),s=i(80369),r=i(36753),a=i(61952),o=i(23446);const l=(0,s.C)()((0,n.Ng)(function(e){return{siteHeader:e.siteHeader}})(function(e){let{t:t,siteHeader:i}=e;const{meta:{title:n}={},data:{title:s}={}}=i||{},l=n||s,d=l?`${t("event.purchase.booking-closed")} | ${l}`:t("event.purchase.booking-closed");return(0,o.jsx)(r.A,{helmet:{title:d},footerUpperHidden:!0,children:(0,o.jsx)(a.A,{})})}));var d=i(96509);const c=e=>t=>{const{booking:{statusCode:i}={}}=t;return 400===i||404===i?(0,o.jsx)(d.default,{}):423===i?(0,o.jsx)(l,{}):(0,o.jsx)(e,{...t})}},94764(e,t,i){i.r(t),i.d(t,{BillingDetailsView:()=>_,default:()=>P});var n=i(76998),s=i(13761),r=i(49113),a=i(75581),o=i(80369),l=i(31088),d=i(26854),c=i(6620),p=i(36753),m=i(19050),h=i(81528),u=i(1861),b=i(18783),g=i(27325),f=i(38559),x=i(23236),y=i(52557),v=i(44847),j=i(55563),N=i(23446);class C extends n.Component{constructor(e){super(e),this.getDLPersonTranslateKey=e=>this.isDistanceLearning()?`event.purchase.distance.person.${e}`:`event.purchase.person.${e}`,this.handleInGoFormValuesUpdate=this.handleInGoFormValuesUpdate.bind(this)}componentDidMount(){var e;null===(e=document.querySelector("form"))||void 0===e||e.addEventListener("change",this.handleInGoFormValuesUpdate)}componentWillUnmount(){var e;null===(e=document.querySelector("form"))||void 0===e||e.removeEventListener("change",this.handleInGoFormValuesUpdate)}handleInGoFormValuesUpdate(e){const{dispatch:t,formName:i,initialValues:n={}}=this.props,{name:s,value:r}=e.target;n[s]||t((0,u.Zg)(i,s,r))}isDistanceLearning(){const{options:{data:{deliveryType:e}={}}={}}=this.props;return"DISTANCE"===e}getPaymentMethodKey(e){const{t:t}=this.props,i=this.isDistanceLearning()?"distance.":"";let n="";switch(e){case"ONLINE":n="site.purchase.preferred-payment.card";break;case"INVOICE":n=`site.${i}purchase.preferred-payment.invoice`}return t(n)}render(){var e,t;const{handleSubmit:i=()=>{},restartBooking:n=()=>{},onSubmit:s,paymentOptions:r=[],paymentOption:a,initialValues:o={},cards:l,country:d,onCountryChange:c,submitting:p,disabledFormFields:m={},countries:h=[],regions:u=[],eInvoiceCountries:b=[],t:g,siteType:f,isInformerRequired:C,siteHeader:k}=this.props,B="ONLINE"!==(a||o.paymentOption),O="US"!==d&&"CA"!==d,S=O?[]:null===(e=u.find(e=>e.id===d))||void 0===e?void 0:e.options,{COURSE:D}=(0,x.Cn)(),A=f===D,T=null===k||void 0===k||null===(t=k.data)||void 0===t?void 0:t.nameFormat,I=(0,j.f)(d,b),L=e=>!!m[e];return(0,N.jsxs)("form",{onSubmit:i(s),"data-test-form":"billing-details-form",children:[1===r.length&&(0,N.jsxs)("p",{className:"c-billing-details-form__chosen-method","data-test-form":"billing-details-form-chosen-method",children:[(0,N.jsx)("span",{children:g("event.purchase.billing-details-method")})," ",this.getPaymentMethodKey(r[0])]}),(0,N.jsx)("div",{className:"c-billing-details-form__payment-method",children:1===r.length?(0,N.jsx)(y.zB,{type:"hidden",name:"paymentOption",value:r[0]}):r.map(e=>(0,N.jsx)(y.zB,{type:"radio",name:"paymentOption",value:e,label:this.getPaymentMethodKey(e),"data-test-form":"billing-details-form-payment-option"},e))}),(0,N.jsxs)("table",{children:[(0,N.jsx)("thead",{children:(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)("strong",{children:g("event.purchase.billing-details")})})})}),(0,N.jsxs)("tbody",{children:[(0,N.jsx)("tr",{className:""+(B?"hidden":""),"data-test-form":"billing-details-form-card",children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"select",name:"cardType",cardTypes:l,hidden:B,validate:[y.mw],blank:"select",label:"event.purchase.person.cardType"})})}),(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"forename",validate:[y.mw],disabled:L("forename"),label:(0,x.Qq)(T,"firstname")})}),(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"surname",validate:[y.mw],label:(0,x.Qq)(T,"lastname")}
1)})]}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"telephone",validate:[y.mw,y.Hw],disabled:L("telephone"),label:this.getDLPersonTranslateKey("telephone")})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"email",validate:[y.mw,y.Rp],disabled:L("email"),label:this.getDLPersonTranslateKey("email")})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"companyName",label:"event.purchase.person.companyName",disabled:L("companyName")})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"purchaseOrderNumber",label:"event.purchase.person.purchaseOrderNumberLabel",disabled:L("purchaseOrderNumber")})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"addressLine1",validate:[y.mw],disabled:L("addressLine1"),label:"event.purchase.person.billingAddress1"})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"addressLine2",label:"event.purchase.person.billingAddress2",disabled:L("addressLine2")})})}),(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"city",validate:[y.mw],disabled:L("city"),label:"event.purchase.person.city"})})}),(0,N.jsxs)("tr",{children:[(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"postcode",validate:[y.mw,y.WB],disabled:L("postcode"),label:"event.purchase.person.postcode"})}),(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"select",name:"state",options:S,hidden:O,validate:[y.mw],disabled:L("state"),blank:"none",label:"US"===d?"site.purchase.person.state.label":"site.purchase.person.province.label","data-test-form":"billing-details-form-state"})}),(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"select",name:"country",validate:[y.mw],disabled:L("country"),value:d,options:h,onChange:c,blank:"select",label:"site.purchase.person.country.label"})})]}),I&&(0,N.jsx)("tr",{"data-test-form":"billing-details-form-e-invoice",children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"tinTrnNumber",label:"site.pricing.confirm-purchase.billing.form.field.tin-trn-number.label",subLabel:"site.pricing.confirm-purchase.billing.form.field.tin-trn-number.advisory","data-test-form":"billing-details-form-e-invoice-field"})})}),A&&this.isDistanceLearning()&&(0,N.jsx)("tr",{children:(0,N.jsx)("td",{children:(0,N.jsx)(y.zB,{type:"text",name:"informer",validate:C?[y.mw]:[],label:"course.purchase.person.marketing",subLabel:"course.purchase.person.marketing-sub-label","data-test-form":"billing-details-form-informer"})})})]})]}),(0,N.jsxs)("div",{className:"row",children:[(0,N.jsx)("div",{className:"col-xs-12 col-sm-7 col-md-8",children:Object.keys(m).length>0&&(0,N.jsxs)("div",{className:"c-billing-details-form__restart-booking",children:[(0,N.jsx)("p",{children:g("site.purchase.billing-form.restart-booking.message")}),(0,N.jsx)("p",{className:"c-billing-details-form__restart-booking-link",children:(0,N.jsxs)("span",{onClick:n,children:[(0,N.jsx)("i",{className:"material-icons",children:"cached"}),g("site.purchase.billing-form.restart-booking.link")]})})]})}),(0,N.jsx)("div",{className:"col-xs-12 col-sm-5 col-md-4",children:(0,N.jsx)("div",{className:"text-right",children:(0,N.jsx)(v.Ay,{type:"submit",size:"large",look:"accent",disabled:p,"data-test-form":"billing-details-form-button",children:g("event.continue")})})})]})]})}}const k=(0,o.C)()((0,s.Ng)(function(e){return{options:e.options,siteHeader:e.siteHeader}})(C));var B=i(84153),O=i(63619),S=i(6148);class D extends n.Component{constructor(e){super(e),this.onSubmit=this.onSubmit.bind(this),this.onCountryChange=this.onCountryChange.bind(this),this.restartBooking=this.restartBooking.bind(this)}getSitePath(){const{pageConfig:{sitePath:e,singleSiteMode:t}}=this.props;return t?"":`/${e}`}onSubmit(e){var t;const{t:i,formMeta:{eInvoiceCountries:n=[]}={}}=this.props;"US"!==e.country&&"CA"!==e.country&&delete e.state,(0,j.f)(e.country,n)&&null!==(t=e.tinTrnNumber)&&void 0!==t&&t.trim()?e.tinTrnNumber=e.tinTrnNumber.trim():delete e.tinTrnNumber,Object.keys(e).forEach(t=>{"string"===typeof e[t]&&(e[t]=e[t].trim())});const s=this.props.cookies.get("basket_id");return this.props.updateBillingDetails(s,e,t=>{const{statusCode:n,errors:s}=t,{pageConfig:{location:r={}}={},options:{data:{locales:{primary:a}={}}={}}={},i18n:o}=this.props;l.A.ga4TrackPaymentType(e.cardType,"ONLINE"===e.paymentOption?i("site.purchase.preferred-
1payment.card"):"INVOICE"===e.paymentOption?i("site.purchase.preferred-payment.invoice"):"");const d={200:"/purchase/confirm-purchase/",410:"/purchase/expired/"}[n];if(!d)throw new h.n(s);const c=(0,O.dS)(`${this.getSitePath()}${d}`,o.language,a);document.location.href=(0,S.A)({url:c,pathname:r.pathname,hostname:r.hostname})})}onCountryChange(){this.props.dispatch((0,u.Zg)("billingDetails","state","")),this.props.dispatch((0,u.Bk)("billingDetails","state")),this.props.dispatch((0,u.Zg)("billingDetails","tinTrnNumber","")),this.props.dispatch((0,u.Bk)("billingDetails","tinTrnNumber"))}restartBooking(){const{COURSE:e}=(0,x.Cn)(),{i18n:t,pageConfig:{siteType:i,cookieSitePath:n,location:s={}}={},options:{data:{locales:{primary:r}={}}={}}={}}=this.props,a=i===e?"select-course-option":"select-package";this.props.cookies.remove("basket_id",{path:n,secure:(0,x.H)()}),this.props.cookies.remove("basket_order",{path:n,secure:(0,x.H)()});const o=(0,O.dS)(`${this.getSitePath()}/purchase/${a}`,t.language,r);document.location.href=(0,S.A)({url:o,pathname:s.pathname,hostname:s.hostname})}render(){const{handleSubmit:e,submitting:t,initialValues:i={},form:n,formValues:{country:s,paymentOption:r}={},formMeta:{cards:a=[],paymentOptions:o=[],countries:l=[],regions:d=[],disabledFormFields:c={},isInformerRequired:p,eInvoiceCountries:m=[]}={},pageConfig:{siteType:h}={},t:u}=this.props;return(0,N.jsx)("div",{className:"c-billing-details-form__container",children:(0,N.jsx)("div",{className:"container",children:(0,N.jsx)("div",{className:"row",children:(0,N.jsx)("div",{className:"col-xs-12 col-sm-8 col-sm-offset-2",children:(0,N.jsx)("div",{className:"c-billing-details-form__container-wrapper",children:(0,N.jsx)(f.A,{heading:o.length>1?u("event.purchase.preferred-payment.question"):null,children:(0,N.jsx)(k,{formName:n,siteType:h,isInformerRequired:p,handleSubmit:e,onSubmit:this.onSubmit,onCountryChange:this.onCountryChange,restartBooking:this.restartBooking,paymentOptions:o,paymentOption:r,cards:a,country:s,countries:l,regions:d,eInvoiceCountries:m,disabledFormFields:c,submitting:t,initialValues:i})})})})})})})}}function A(e,t){return e<t?1:e>t?-1:0}const T=(0,s.Ng)(function(e){let{data:t={},meta:{cards:i=[],paymentOptions:n=[],countries:s=[],regions:r=[],disabledFormFields:a={},isInformerRequired:o,eInvoiceCountries:l=[]}={}}=e.billingDetails;return n=n.sort(A),{initialValues:{paymentOption:n[0],country:a.country||"",state:a.state||"",...t},formMeta:{cards:i,paymentOptions:n,countries:s,regions:r,disabledFormFields:a,isInformerRequired:o,eInvoiceCountries:l},formValues:(0,b.A)("billingDetails")(e),pageConfig:e.pageConfig,options:e.options}},function(e){return{updateBillingDetails:(t,i,n)=>e((0,B.vZ)(t,i,n))}})((0,g.A)({form:"billingDetails",enableReinitialize:!0,onSubmitFail:function(){const e=document.querySelectorAll(".has-error");e&&e.length&&m.Ay.animateScroll.scrollTo(e[0].offsetTop)}})((0,o.C)()((0,a.A)((0,r.y)(D)))));var I=i(96509),L=i(30700);class _ extends n.Component{componentDidMount(){const{division:e,chosenProducts:{data:t}={}}=this.props,i=(0,d.A)({chosenProducts:t});l.A.pushCheckoutDetails(i,"step 1"),l.A.pushDivisionOption(e)}render(){const{siteHeader:{meta:{title:e}={}}={},billingDetails:{statusCode:t}={},t:i}=this.props;if(400===t||404===t)return(0,N.jsx)(I.default,{});const n={title:`${i("event.purchase.billing-details")} | ${e}`};return(0,N.jsx)(p.A,{footerUpperHidden:!0,helmet:n,children:(0,N.jsx)(T,{})})}}const P=(0,o.C)()((0,s.Ng)(function(e){return{siteHeader:e.siteHeader,billingDetails:e.billingDetails,chosenProducts:e.chosenProducts,booking:e.billingDetails,division:(0,c.UM)(e)}})((0,r.y)((0,L.l)((0,a.A)(_)))))},26854(e,t,i){const n=e=>{if(null===e||void 0===e||!e.chosenProducts)return null;const{chosenProducts:t}=e,i=Object.values(t).reduce((e,t)=>e.concat(t),[]);let n;const s=[];return i.forEach(function(e){e.packageSelection.forEach(function(t){n={name:t.productName,variant:t.optionNames?t.optionNames:null,price:e.packagePrice.originalPrice,quantity:e.quantity,brand:t.productName},s.push(n)})}),s};i.d(t,["A",0,n])}}]); 2//# sourceMappingURL=BillingDetailsView.c830b451.chunk.js.map
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.