"use strict";(self.webpackChunkglobal_main=self.webpackChunkglobal_main||[]).push([[9617],{5850:function(e,t,r){var n,o=r(7294),a=r(745),i=r(4311),l=r(7582),c=r(4012),u=r(20),s=r(4692),m=r(990),d=r(6252),f=r(3768),p=r(1165),v=r(507);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?new m.cA({graphQLErrors:l}):void 0,p=e.onError||(null===(r=f.current.options)||void 0===r?void 0:r.onError);if(c&&p&&p(c,d),s===f.current.mutationId&&!d.ignoreResults){var v={called:!0,loading:!1,data:o,error:c,client:a};f.current.isMounted&&!(0,u.D)(f.current.result,v)&&i(f.current.result=v)}var g=e.onCompleted||(null===(n=f.current.options)||void 0===n?void 0:n.onCompleted);return c||null==g||g(t.data,d),t})).catch((function(t){var r;if(s===f.current.mutationId&&f.current.isMounted){var n={loading:!1,error:t,data:void 0,called:!0,client:a};(0,u.D)(f.current.result,n)||i(f.current.result=n)}var o=e.onError||(null===(r=f.current.options)||void 0===r?void 0:r.onError);if(o)return o(t,d),{data:void 0,errors:t};throw t}))}),[]),v=o.useCallback((function(){f.current.isMounted&&i({called:!1,loading:!1,client:r})}),[]);return o.useEffect((function(){return f.current.isMounted=!0,function(){f.current.isMounted=!1}}),[]),[p,(0,l.pi)({reset:v},a)]}(N),i=h(a,2),f=i[0],p=i[1],g=p.data,b=p.loading,w=p.error,E=h((0,o.useState)(!1),2),S=E[0],O=E[1],j=h((0,o.useState)(!1),2),P=j[0],A=j[1],I=h((0,o.useState)(!1),2),M=I[0],T=I[1];return!n&&o.createElement("div",{className:"newsletter-component"},o.createElement("div",{className:"layout__content pt-0"},o.createElement("div",{className:"thule-container"},o.createElement("div",{className:"row py-14"},o.createElement("div",{className:"col-lg-12"},o.createElement("div",{className:"text-section text-center"},o.createElement("h2",{className:"paragraph--s top-text mb-4",dangerouslySetInnerHTML:(0,v.KU)(null==r?void 0:r.Text)}),o.createElement("label",{htmlFor:"newsletter-input-field",className:"description heading3 mb-9",dangerouslySetInnerHTML:(0,v.KU)(null==r?void 0:r.Description)}))),o.createElement("div",{className:"col-lg-12"},o.createElement("form",{onSubmit:function(e){var r;if(e.preventDefault(),null!==(r=window._THULEDATA._Footer.Newsletter)&&void 0!==r&&r.IsSitecoreSendNewsletterSignUp){var n={email:t.value,language:window._THULEDATA.SitecoreLanguage,SignupSource:"Footer"};A(!1),O(!0),function(e){return t={method:"POST",body:JSON.stringify({newsletterObject:e}),headers:new Headers({"Content-Type":"application/json"})},new Promise((function(e,r){fetch("/api/sitecore/sitecoresend/newslettersignup/",y(y({},t),{},{credentials:"same-origin"})).then((function(e){return e.json()})).then((function(t){e(t)})).catch((function(e){r(e)}))}));var t}(n).then((function(e){if(!e||!e.Success)throw Error(null==e?void 0:e.ResponseMessage);O(!1),T(!0)})).catch((function(e){O(!1),A(!0),T(!1)}))}else{var o,a=null===(o=window._THULEDATA._Footer.Newsletter)||void 0===o?void 0:o.SitecoreID;f({variables:{email:t.value,language:"en-US",siteName:"Thule",sitecoreID:a}})}t.value=""}},o.createElement("div",{className:"d-flex"},o.createElement("input",{id:"newsletter-input-field",pattern:"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",title:null==r?void 0:r.InvalidEmail,placeholder:null==r?void 0:r.EmailPlaceholder,className:"form-control email-input paragraph--s",required:!0,ref:function(e){t=e}}),o.createElement("button",{type:"submit",className:"btn thule-btn-default-bg-dark signup-btn p-0"},o.createElement("i",{className:"le-icon-arrow rot-180"}),o.createElement("span",{className:"sr-only"},"Sign up to newsletter"))),o.createElement("div",{className:"mt-5"},o.createElement("label",{htmlFor:"newsletter-privacy-checkbox",className:"form-check-label"},o.createElement("div",{className:"form-check"},o.createElement("input",{id:"newsletter-privacy-checkbox",className:"form-check-input",type:"checkbox",title:null==r?void 0:r.InvalidPrivacyPolicy,required:!0}),o.createElement("div",{className:"paragraph--s ms-4 pt-1",dangerouslySetInnerHTML:(0,v.KU)(null==r?void 0:r.PrivacyPolicy)})))))),(b||S)&&o.createElement("p",null,null==r?void 0:r.Loading),(w||P)&&o.createElement("div",{className:"error message paragraph--s mt-4 col-lg-4 offset-lg-4"},null==r?void 0:r.ValidationError),(g&&g.newsletterMutation&&"Success"===g.newsletterMutation.newsletterResponse.ResponseMessage||M)&&o.createElement("div",{className:"success message paragraph--s mt-4 col-lg-4 offset-lg-4"},null==r?void 0:r.SuccessMessage)),o.createElement("hr",{className:"my-0"}))))}(0,a.s)(document.getElementById("REACT_newsletter")).render(o.createElement(f.e,{client:p.L},o.createElement(O,window._THULEDATA._Footer)))},507:function(e,t,r){function n(e){return{__html:e}}r.d(t,{KU:function(){return n}}),r(4858),r(691)},6622:function(){}},function(e){var t=function(t){return e(e.s=t)};t(5850),t(6622)}]); //# sourceMappingURL=newsletter.dc3d672441bc2bc8bd34.js.map