1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8229],{2013:e=>{e.exports={UnsubscribePage:"styles_UnsubscribePage__RgX39",Image:"styles_Image__CE_0K",Content:"styles_Content__ABCYJ",Content__copy:"styles_Content__copy__2fAb4",Content__formButtons:"styles_Content__formButtons__sbQ1o",Content__formHelperCopy:"styles_Content__formHelperCopy__m7e7F",NotificationBanner:"styles_NotificationBanner__ZHmvw"}},22606:e=>{e.exports={Textarea:"styles_Textarea__ATjIp",center:"styles_center__kgd1I",focused:"styles_focused__g2GQu",disabled:"styles_disabled__1t2Lo",error:"styles_error__tjjc_",FieldLabelCount:"styles_FieldLabelCount___NE3Q"}},38896:e=>{e.exports={FormGrid:"styles_FormGrid__TClfn",single:"styles_single__3O1w_",double:"styles_double___5p8w",large:"styles_large__sJsfJ",medium:"styles_medium__1AiKz",small:"styles_small__xbBuL"}},41162:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});var r=t(37876),a=t(38896),n=t.n(a);function l(e){let{children:s,gap:t="medium",column:a="single"}=e;return(0,r.jsx)("div",{className:"".concat(n().FormGrid," ").concat(n()[a]," ").concat(n()[t]),children:s})}},48229:(e,s,t)=>{"use strict";t.r(s),t.d(s,{UnsubscribeFormSchema:()=>w,default:()=>F});var r=t(37876);let a={requestHandle:"/catalogue/unsubscribe",content:[{id:"first_name",question:"First Name",placeholder:"Enter your first name*",type:"text",required:!0,answers:[""],hidden:!1},{id:"last_name",question:"Last Name",placeholder:"Enter your last name*",type:"text",required:!0,answers:[""],hidden:!1},{id:"address_line1",question:"First line of your address",type:"text",placeholder:"Enter your first line of your address*",required:!0,answers:[""],hidden:!1},{id:"postcode",question:"Postcode",placeholder:"Enter your postcode*",type:"text",required:!0,answers:[""],hidden:!1},{id:"unsubscribe_reason",question:"Let us know why",type:"textarea",required:!1,placeholder:"Let us know why â if you have a moment",answers:[""],hidden:!1}]};var n=t(2013),l=t.n(n),i=t(22442),o=t(70310),d=t(88992),c=t(13810),u=t(92243),_=t(14232),m=t(41162),h=t(11327),p=t(54587),b=t.n(p),f=t(36377),y=t(10199),g=t(77133),x=t(85422),j=t(91040),N=t(9188);function v(e){let{serverError:s,successMessage:t,hasFieldErrors:a,isSubmitted:n}=e,i=s||n&&a;return(0,r.jsxs)(r.Fragment,{children:[i&&(0,r.jsx)("div",{className:l().NotificationBanner,children:(0,r.jsx)(N.A,{type:"error",children:(0,r.jsx)("p",{children:s||"We think you might have missed a question. Please review your answers."})})}),t&&(0,r.jsx)("div",{className:l().NotificationBanner,children:(0,r.jsx)(N.A,{type:"success",children:(0,r.jsx)("p",{children:t})})})]})}let w=i.Ik({first_name:i.Yj().min(1,{message:"First Name cannot be empty"}),last_name:i.Yj().min(1,{message:"Last Name cannot be empty"}),address_line1:i.Yj().min(1,{message:"Address 1 cannot be empty"}),postcode:i.Yj().min(1,{message:"Postal code cannot be empty"}),unsubscribe_reason:o.V.getSchema(!1,200)}),C={first_name:"",last_name:"",address_line1:"",postcode:"",unsubscribe_reason:""};function F(){let[e,s]=(0,_.useState)("ready"),[t,n]=(0,_.useState)(null),[i,p]=(0,_.useState)(null),N=(0,d.mN)({mode:"onBlur",reValidateMode:"onChange",shouldFocusError:!0,resolver:(0,c.u)(w),defaultValues:C}),{formState:F,handleSubmit:q}=N,{errors:A,isDirty:S,isValid:k,isSubmitted:L}=F,E=async e=>{n(null);let t={...e,source:(0,g.g7)().toUpperCase()};try{s("loading"),await (0,x.KF)(t,a.requestHandle),p("Feedback form sent successfully"),N.reset(C),s("ready"),window.location.href=(0,g.TE)("/")}catch(e){var r,l;s("ready"),n(j.A.isAxiosError(e)&&e.response&&(null==e||null==(l=e.response)||null==(r=l.data)?void 0:r.message)||(null==e?void 0:e.message)||"Something went wrong while submitting the form. Please try again.")}},B=Object.keys(A).length>0;return(0,r.jsxs)("div",{className:l().UnsubscribePage,children:[(0,r.jsx)("div",{className:l().Image,children:(0,r.jsx)(b(),{src:"/static/images/pages/unsubscribe/catalogue.png",fill:!0,alt:"Unsubscribe from our catalogue"})}),(0,r.jsxs)("div",{className:l().Content,children:[(0,r.jsx)(y.A,{title:"Unsubscribe from the catalogue",variant:"left_aligned"}),(0,r.jsxs)(d.Op,{...N,children:[(0,r.jsx)("p",{className:l().Content__copy,children:"No longer wish to receive our catalogue? No problem â just fill in the form below:"}),(0,r.jsxs)("form",{onSubmit:q(E),noValidate:!0,className:l().Content__form,children:[(0,r.jsx)(m.A,{gap:"large",children:a.content.map(e=>{if("textarea"===e.type)return(0,r.jsx)(o.V,{id:e.id,required:e.required,placeholder:e.placeholder,name:e.question},e.id);let s="address_line1"===e.id;return(0,r.jsx)(h.F,{name:e.id,required:e.required,label:e.question,placeholder:e.placeholder,helperMessage:s?"As it appears on the catalogue / postcard":void 0},e.id)})}),(0,r.jsx)(v,{serverError:t,successMessage:i,hasFieldErrors:B,isSubmitted:L}),(0,r.jsx)("div",{className:l().Content__formButtons,children:(0,r.jsx)(u.A,{state:e,disabled:!S||!k||"loading"===e,type:"submit",fullWidth:"inherit",className:l().submit,children:"Submit"})}),(0,r.jsxs)("div",{className:l().Content__formHelperCopy,children:[(0,r.jsx)("p",{children:"Itâs worth noting that unsubscribing can take up to six weeks to take effect due to the printing planning cycles."}),(0,r.jsxs)("p",{children:["Any questions?"," ",(0,r.jsx)(f.A,{href:"/pages/contact-us",text:"Get in touch with us",textSize:"large"}),"."]})]})]})]})]})]})}},70310:(e,s,t)=>{"use strict";
1t.d(s,{V:()=>b});var r=t(37876),a=t(88992),n=t(22442),l=t(22606),i=t.n(l),o=t(28871),d=t(7557),c=t.n(d),u=t(84066),_=t.n(u),m=t(14232),h=t(15039),p=t.n(h);function b(e){var s;let{id:t,name:n,required:l=!1,placeholder:d,disabled:u=!1,maxLength:h=200,textPosition:b="left",showDefaultLabel:f=!1}=e,{register:y,watch:g,formState:{errors:x}}=(0,a.xW)(),[j,N]=(0,m.useState)(!1),v=null!=(s=g(t))?s:"",w=v.toString().length,C=null!=v&&("number"==typeof v||String(v).trim().length>0),F=j||C,q=p()(i().Textarea,i()[b],{[i().disabled]:u,[i().focused]:F,[i().error]:x[t]&&!u}),A=p()({[c().disabled]:u,[c().focused]:F,[c().required]:l});return(0,r.jsxs)("div",{className:"".concat(_().FieldWrapperTextarea," ").concat(f?"":_().FieldLabel__fluid),children:[(0,r.jsx)("label",{htmlFor:t,className:"".concat(c().FieldLabel," ").concat(c().FieldLabelTextarea," ").concat(!f?c().FieldLabel__fluid:""," ").concat(F?c().focused:""),children:(0,r.jsx)("span",{className:"".concat(c().FieldLabel__name," ").concat(A),children:n})}),(0,r.jsxs)("div",{className:i().FieldLabelCount,children:[w," / ",h]}),(0,r.jsx)("textarea",{...y(t),id:t,"aria-label":n,placeholder:d,onFocus:()=>!u&&N(!0),onBlur:()=>!u&&N(!1),className:q,autoComplete:"off",disabled:u}),x[t]&&!u&&(0,r.jsx)(o.s,{name:t,errors:x})]})}b.getSchema=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return e?n.Yj().min(1,"This field is required").max(s,"Must be ".concat(s," characters or fewer")):n.Yj().max(s,"Must be ".concat(s," characters or fewer")).transform(e=>""===e?void 0:e).optional()}}}]); 2//# sourceMappingURL=8229.9a774dd408b76a96.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.