!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="90424c60-3efd-4dd7-92d0-0a032f2193d3",e._sentryDebugIdIdentifier="sentry-dbid-90424c60-3efd-4dd7-92d0-0a032f2193d3")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1744],{49974:function(){},88553:function(e,t,n){Promise.resolve().then(n.t.bind(n,37910,23)),Promise.resolve().then(n.t.bind(n,49082,23)),Promise.resolve().then(n.t.bind(n,88943,23)),Promise.resolve().then(n.t.bind(n,59298,23)),Promise.resolve().then(n.t.bind(n,89994,23)),Promise.resolve().then(n.t.bind(n,78236,23))},57790:function(e,t,n){"use strict";var r=n(16884),o=n(60377),a=n(29008),i=n(28723),s=n(97049),u=n(41060);globalThis.__sentryRewritesTunnelPath__=void 0,globalThis.SENTRY_RELEASE={id:"758cccb40eac691963de0f767f69663bfc4d04d7"},globalThis.__sentryBasePath=void 0,globalThis.__rewriteFramesAssetPrefixPath__="",r.S1({environment:"production",dsn:"https://76f3f75ca9554a9e96aa644a94ce25c2@o1306571.ingest.sentry.io/6549757",enabled:!0,normalizeDepth:6,tracesSampleRate:0,debug:!1,beforeSend(e){var t,n,r,l,c,d,h,g;return(null===(n=e.exception)||void 0===n?void 0:null===(t=n.values)||void 0===t?void 0:t.some(e=>"ChunkLoadError"===e.type))||(null===(l=e.exception)||void 0===l?void 0:null===(r=l.values)||void 0===r?void 0:r.some(e=>"TypeError"===e.type&&"Load failed"===e.value))||(null===(d=e.exception)||void 0===d?void 0:null===(c=d.values)||void 0===c?void 0:c.some(e=>"TypeError"===e.type&&"Load failed"===e.value))?null:(e.user=null!==(h=u.E.getQueryData(["user"]))&&void 0!==h?h:null,e.contexts={...e.contexts,additional_info:{storage_available:(0,a.F)()},store:{auth:s.F.getState(),checkout:o.p.getState(),patient:i.N.getState()}},e.tags={...null!==(g=e.tags)&&void 0!==g?g:{},storage_available:(0,a.F)()},e)},beforeBreadcrumb(e,t){if("ui.click"===e.category){let n=t.event.target.childElementCount?t.event.target.getAttribute("aria-label"):t.event.target.innerText;n&&(e.message=n)}return e}})},38578:function(e,t,n){"use strict";var r=n(30531),o=n(41060),a=n(84174),i=n(9311),s=n(97049),u=n(83750);let l=["https://api.getaddress.io","directory.spineservices.nhs.uk"],c=a.Z.create({baseURL:"https://api.evaro.com/json/api/v1",timeout:1e4,timeoutErrorMessage:"Request timed out",adapter:"fetch",fetchOptions:{cache:"no-store"}});c.interceptors.request.use(async e=>{if(["/user/register","/authenticate/token/renew"].some(t=>e.url.includes(t)))return e;{let t=window.location.pathname.split("/")[2];t&&(e.headers["x-evaro-vendor"]=t)}if(s.F.getState().isLogged&&null!==e.headers.Authorization){let t=await (0,s.L)();if(!t)throw Error("No Token, cancelling request ".concat(e.url));e.headers.Authorization="Bearer ".concat(t)}return e}),c.interceptors.response.use(e=>{var t,n;return null!==(n=null===(t=e.data)||void 0===t?void 0:t.data)&&void 0!==n?n:e.data},e=>{var t,n,i,c,d,h,g,p,v,f,m,w,_,y,S,b,P,A;let E=null===(t=e.response)||void 0===t?void 0:t.status,T=null===(n=e.config)||void 0===n?void 0:n.url;if(console.warn("HTTP API ERROR",T,null==e?void 0:e.message),a.Z.isCancel(e)||"ECONNABORTED"===e.code||!E||!T)return Promise.reject(e);let L=E>=400&&E<500;if(403===E)return console.warn("403 Error, logging out"),s.F.getState().logOut(),o.E.removeQueries({queryKey:["user"],type:"all"}),Promise.reject((null===(g=e.response)||void 0===g?void 0:null===(h=g.data)||void 0===h?void 0:h.data)||(null===(p=e.response)||void 0===p?void 0:p.data));try{if(l.some(e=>T.includes(e)))return Promise.reject(e);let t=e.config.data,n=(null===(v=e.config.headers)||void 0===v?void 0:v["Content-Type"])==="application/json",o=t&&n?JSON.parse(t):t,a=T.split("/").map(e=>30===e.length?":hash":e).join("/");e.name="API Error",e.message="URL:".concat(a," ").concat(e.message);let i="API Error : ".concat(e.config.method.toUpperCase()," ").concat(a," ").concat(E);r.uT(L?i:e,{level:L?"debug":"error",contexts:{http_error:{hasJWT:!!(null===(f=e.config.headers)||void 0===f?void 0:f.Authorization),isValidJWT:!!(0,u.c)(null===(m=e.config.headers)||void 0===m?void 0:m.Authorization),request:{headers:e.config.headers,body:o},response:{headers:null===(w=e.response)||void 0===w?void 0:w.headers,body:null===(_=e.response)||void 0===_?void 0:_.data,status:null===(y=e.response)||void 0===y?void 0:y.status},retryCount:null===(S=e.config["axios-retry"])||void 0===S?void 0:S.retryCount,code:e.code,ALL_DATA:e}},tags:{API_RESPONSE_MSG:null!==(A=null===(P=e.response)||void 0===P?void 0:null===(b=P.data)||void 0===b?void 0:b.message)&&void 0!==A?A:null}})}catch(t){console.error("Error in HTTP response error try method",t),r.Tb(t),r.uT(e.name,L?"debug":"error")}return Promise.reject((null===(c=e.response)||void 0===c?void 0:null===(i=c.data)||void 0===i?void 0:i.data)||(null===(d=e.response)||void 0===d?void 0:d.data))}),(0,i.ZP)(c,{retries:3,shouldResetTimeout:!0,retryDelay:i.ZP.exponentialDelay,retryCondition:e=>i.ZP.isNetworkOrIdempotentRequestError(e)||"ECONNABORTED"===e.code}),t.Z=c},80478:function(e,t,n){"use strict";n.d(t,{B:function(){return o}});var r=n(38578);let o=async e=>{let t=window.location.pathname.split("/")[2];return await r.Z.post("/cart",{vendor_hash:t,items:e})}},83750:function(e,t,n){"use strict";n.d(t,{c:function(){return a},h:function(){return o}});var r=n(38578);let o=async(e,t)=>r.Z.post("/patient",{...e,vendor:t});function a(e){if(!e)return;let t=JSON.parse(atob(e.split(".")[1]).toString());return Date.now()+5e3<1e3*t.exp}},41060:function(e,t,n){"use strict";n.d(t,{E:function(){return r}});let r=new(n(84542)).S({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:!1,staleTime:3e5}}})},97049:function(e,t,n){"use strict";n.d(t,{F:function(){return c},L:function(){return h}});var r=n(29008),o=n(68017),a=n(41060),i=n(74843),s=n(78644),u=n(83750),l=n(38578);let c=(0,o.Ue)()((0,i.tJ)((e,t)=>({isLogged:!1,token:null,renew:null,userHash:null,isHydrated:!1,showAuth:"auth"===new URLSearchParams(window.location.search).get("dialog"),type:"login",showResetPassword:"reset-password"===new URLSearchParams(window.location.search).get("dialog"),updateToken:t=>{e({isLogged:!0,token:t.token,renew:t.renew,userHash:t.user})},logOut:()=>{e({isLogged:!1,token:null,renew:null,userHash:null}),r.w.removeItem("user"),a.E.clear(),(0,s.Zt)(),(0,s.Iv)(null)},requestAuth:t=>{e({showAuth:!0,type:(null==t?void 0:t.type)||"login",authCallback:{...t}})},onSuccessAuth:()=>{var n,r;null===(r=t().authCallback)||void 0===r||null===(n=r.onAuth)||void 0===n||n.call(r),e({showAuth:!1,authCallback:null})},onAuthClose:()=>{var n,r;null===(r=t().authCallback)||void 0===r||null===(n=r.onClose)||void 0===n||n.call(r),e({showAuth:!1,type:"login",authCallback:null})},requestResetPassword:()=>{e({showResetPassword:!0})},closeResetPassword:()=>{e({showResetPassword:!1})},setHydrated:()=>{e({isHydrated:!0})}}),{name:"auth_state",storage:(0,i.FL)(()=>r.w),version:1,skipHydration:!0,partialize:e=>({isLogged:e.isLogged,token:e.token,renew:e.renew,userHash:e.userHash})}));c.persist.onFinishHydration(()=>{c.getState().setHydrated()});let d=null,h=async()=>{if(d)return d;let{token:e,renew:t}=c.getState();return e&&t?(0,u.c)(e)?e:d=l.Z.post("/authenticate/token/renew",{jwt_renew:t},{headers:{Authorization:null}}).then(e=>(c.getState().updateToken(e),d=null,e.token)).catch(e=>(console.warn("Error renewing token, logging out",e),c.getState().logOut(),a.E.removeQueries({queryKey:["user"],type:"all"}),d=null,null)):null}},60377:function(e,t,n){"use strict";n.d(t,{p:function(){return p}});var r=n(68017),o=n(74843),a=n(29008),i=n(78644),s=n(80478),u=n(38578);let l=async()=>await u.Z.get("/customer/cart"),c=async e=>await u.Z.get("/cart/".concat(e));var d=n(35799),h=n(97049);let g={shippingType:null,cart:[],cart_hash:null,recoveryCartHash:null,shippingAddress:null,billingAddress:null,billingSame:!0,email:"",coupon:null,rated:[],reorderHash:null},p=(0,r.Ue)()((0,o.tJ)((e,t)=>({...g,setCoupon:t=>e({coupon:t}),getCartTotal:()=>t().cart.reduce((e,t)=>e+t.price,0),hasSubscribtion:()=>t().cart.some(e=>{var t;return null===(t=e.variation)||void 0===t?void 0:t.some(e=>"pa_ep_frequency"===e.attribute&&"one-time-purchase"!==e.value)}),setShippingType:t=>e({shippingType:t}),setShippingAddress:t=>e({shippingAddress:t}),setBillingAddress:t=>e({billingAddress:t}),setBillingSame:t=>e({billingSame:t}),setReorderHash:t=>e({reorderHash:t}),addToCart:async n=>{(0,i.V3)(n);let r=[...t().cart,n];if(e({cart:r}),h.F.getState().isLogged){let{cart_hash:t}=await (0,s.B)(r);e({cart_hash:t})}},removeFromCart:async n=>{(0,i.Z0)(n);let r=t().cart.findIndex(e=>e.id===n.id),o=t().cart.filter((e,t)=>t!==r);if(e({cart:o}),h.F.getState().isLogged){let{cart_hash:t}=await (0,s.B)(o);e({cart_hash:t})}},syncCart:async n=>{let r=t().cart;try{var{items:o,cart_hash:a}=n?await c(n).then(e=>((0,i.$U)(),e)).catch(()=>((0,i.gK)(),d.toast.error("Oops! Sorry there was an error loading your cart, please try again later."),{items:[],cart_hash:null})):await l()}catch(e){console.warn("Error syncing or getting cart",e);return}if(!a)return;let u=[...r,...o],g=u.filter((e,t)=>u.findIndex(t=>JSON.stringify(t)===JSON.stringify(e))===t),p=JSON.stringify(o)===JSON.stringify(g);if(e({cart:g,cart_hash:a}),r.length&&!p&&h.F.getState().isLogged){let{cart_hash:t}=await (0,s.B)(g);e({cart_hash:t})}},setEmail:t=>e({email:t}),setRated:n=>e({rated:[...t().rated,n]}),reset:()=>e({...g,rated:t().rated})}),{name:"checkout_state",storage:(0,o.FL)(()=>a.w),version:2,skipHydration:!0,partialize:e=>({...e,recoveryCartHash:null,reorderHash:null})}))},63313:function(e,t,n){"use strict";n.d(t,{useDiscoveryStore:function(){return o},y:function(){return a}});var r=n(53484);let o=(0,n(68017).Ue)(e=>{var t;return{input:null!==(t=new URLSearchParams(window.location.search).get("search"))&&void 0!==t?t:"",setInput:t=>e({input:t}),ID:Math.random().toString(36).substring(7),newID:()=>e({ID:Math.random().toString(36).substring(7)}),messages:[],addMessage:t=>e(e=>{var n;return t.id=null!==(n=t.id)&&void 0!==n?n:Math.random().toString(36).substring(7),{messages:[...e.messages,t]}}),removeLastMessage:()=>e(e=>{let t=[...e.messages];return t.pop(),{messages:t}}),removeAllMessages:()=>e({messages:[]})}}),a=()=>{let e=(0,r.useRouter)(),t=(0,r.useSearchParams)();return{isOpen:t.has("discovery"),open:()=>{let n=new URLSearchParams(t.toString());n.set("discovery",""),e.push("?".concat(n.toString()))},close:()=>{let n=new URLSearchParams(t.toString());n.delete("discovery",""),e.replace("?".concat(n.toString()))}}}},28723:function(e,t,n){"use strict";n.d(t,{N:function(){return s}});var r=n(29008),o=n(68017),a=n(74843);let i={patient:{firstName:"",lastName:"",dob:"",gender:null},product_id:null,questionnaire_id:null,answers:{},exitAnswers:{},flaggedAnswers:{},patientHash:null,answerHash:null},s=(0,o.Ue)()((0,a.tJ)((e,t)=>({...i,setPatient:t=>e({patient:t}),reset:()=>e({...i,answers:{},exitAnswers:{},flaggedAnswers:{},product_id:t().product_id,questionnaire_id:t().questionnaire_id}),setProductId:t=>e({product_id:t}),setQuestionnaireId:t=>e({questionnaire_id:t}),setSingleAnswer:(n,r)=>{let o=t().answers;o[n]=r,e({answers:o})},setExitAnswers:(n,r)=>{let o=t().exitAnswers;o[n]=r,e({exitAnswers:o})},setFlaggedAnswers:(n,r)=>{let o=t().flaggedAnswers;o[n]=r,e({flaggedAnswers:o})},setPatientHash:t=>e({patientHash:t}),setAnswerHash:t=>e({answerHash:t})}),{name:"patient_state",storage:(0,a.FL)(()=>r.w),version:1,skipHydration:!0}))},78644:function(e,t,n){"use strict";n.d(t,{Nl:function(){return D},wV:function(){return q},V3:function(){return f},rS:function(){return X},ck:function(){return _},V7:function(){return N},Bx:function(){return k},zF:function(){return K},gp:function(){return T},Fs:function(){return j},E:function(){return Q},iV:function(){return $},D1:function(){return z},ab:function(){return G},hS:function(){return M},IP:function(){return V},J9:function(){return b},UG:function(){return P},Zt:function(){return S},Nc:function(){return C},NM:function(){return J},u1:function(){return y},hz:function(){return I},Bo:function(){return R},gK:function(){return Y},$U:function(){return W},Z0:function(){return w},EZ:function(){return L},$N:function(){return A},AF:function(){return m},$O:function(){return U},_O:function(){return v},h0:function(){return H},CI:function(){return F},c2:function(){return B},lG:function(){return Z},$8:function(){return x},Iv:function(){return E}});var r,o,a=n(60377),i=n(28723),s=n(29008),u=n(30531),l=n(38578),c=n(63313);let d=async(e,t)=>{let n={content:e,data:t,timestamp:Date.now(),threadID:c.useDiscoveryStore.getState().ID};return l.Z.post("/api/discovery/log",n,{baseURL:"",headers:{Authorization:null}})},h=e=>{var t,n,r;return{item_name:"".concat(e.title," [").concat(null===(t=e.variation)||void 0===t?void 0:t.map(e=>e.label).join(", "),"]").toLowerCase(),price:e.price/100,quantity:1,item_variant:(null===(r=e.variation)||void 0===r?void 0:null===(n=r.find(e=>"pa_ep_frequency"===e.attribute))||void 0===n?void 0:n.label)||"One Time Purchase"}};function g(){window.dataLayer=window.dataLayer||[],window.dataLayer.push(arguments)}let p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.timestamp=new Date().toISOString(),g("event",e,t),t.timestamp||u.uT("Missing timestamp for ".concat(e),{level:"warning",contexts:{event:{event:e,data:t}}}),window.parent.postMessage({type:"EVARO_ANALYTIC_EVENT",data:{event:"evaro_".concat(e),data:t}},"*")},v=e=>{p("view_item",{currency:"GBP",item_name:e.title})},f=e=>{p("add_to_cart",{currency:"GBP",value:e.price/100,items:[h(e)]})},m=()=>{p("view_cart",{currency:"GBP",value:a.p.getState().getCartTotal()/100,items:a.p.getState().cart.map(h)})},w=e=>{p("remove_from_cart",{currency:"GBP",value:e.price/100,items:[h(e)]})},_=()=>{var e;p("begin_checkout",{currency:"GBP",value:a.p.getState().getCartTotal()/100,items:a.p.getState().cart.map(h),coupon:null===(e=a.p.getState().coupon)||void 0===e?void 0:e.code})},y=e=>{var t;p("purchase",{transaction_id:e.meta.order_number,value:Number.parseFloat(e.payment.total)/100,discount:e.payment.discount,sub_total:Number.parseFloat(e.payment.sub_total)/100,shipping:Number.parseFloat(e.payment.shipping)/100,shipping_method:e.shipping.method_title,currency:"GBP",coupon:null===(t=e.payment.coupons)||void 0===t?void 0:t[0],items:e.items.map(e=>{var t;return{item_name:"".concat(e.name," [").concat(Object.values(e.variations).join(", "),"]").toLowerCase(),price:Number.parseFloat(e.total)/100,quantity:1,item_variant:(null===(t=e.variations)||void 0===t?void 0:t.frequency)||"One Time Purchase"}})})},S=()=>{p("logout",{login_status:"logged_out"})},b=()=>{p("login",{method:"email",login_status:"logged_in"})},P=(e,t)=>{p("login_failed",{method:e,error_info:t})},A=()=>{p("sign_up",{method:"email"})},E=e=>{},T=()=>{g("set","user_properties",{dark_mode:window.matchMedia("(prefers-color-scheme: dark)").matches?"true":"false",incognito_mode:(0,s.F)()?"false":"true"})},L=()=>{g("set","screen_resolution","".concat(window.screen.width,"x").concat(window.screen.height))},k=()=>{p("consultation_started",{questionnaire_hash:i.N.getState().questionnaire_id})},N=()=>{p("consultation_completed",{questionnaire_hash:i.N.getState().questionnaire_id})},R=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];p("question_viewed",{question_hash:e,consultation_hash:t,is_skipped:n})},I=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];p("question_answered",{question_hash:e,consultation_hash:t,is_skipped:n})},O=null!==(o=null===(r=globalThis.document)||void 0===r?void 0:r.referrer)&&void 0!==o?o:"",C=()=>{window.parent.postMessage({type:"EVARO_ANALYTIC_EVENT",data:{event:"evaro_page_view",data:{page_title:document.title,page_location:window.location.href,page_path:window.location.pathname,page_referrer:O,timestamp:new Date().toISOString()}}},"*"),O=window.location.href},q=()=>{var e;p("add_shipping_info",{shipping_type:null===(e=a.p.getState().shippingType)||void 0===e?void 0:e.title})},D=e=>{p("add_payment_info",{payment_type:e})},F=()=>{p("view_menu")},H=()=>{p("view_login")},x=()=>{p("view_signup")},U=()=>{p("view_forgot_password")},B=()=>{p("view_new_password")},Z=()=>{p("view_otp")},J=e=>{p("product_choice",e)},M=()=>{p("discovery_search_initiated",{source:new URLSearchParams(window.location.search).has("search")?"e-surgery":"connect"}),d("Discovery Opened")},j=()=>{p("discovery_search_closed",{source:new URLSearchParams(window.location.search).has("search")?"e-surgery":"connect"}),d("Discovery Closed")},z=()=>{p("discovery_query_submitted",{source:new URLSearchParams(window.location.search).has("search")?"e-surgery":"connect"})},V=()=>{p("discovery_search_history_cleared",{source:new URLSearchParams(window.location.search).has("search")?"e-surgery":"connect"}),d("Reset button clicked")},G=(e,t)=>{p("discovery_search_result_clicked",{source:new URLSearchParams(window.location.search).has("search")?"e-surgery":"connect"}),d(e,t&&JSON.stringify(t,null,2))},Q=e=>{d('Dialog: request - "'.concat(e,'"'))},$=e=>{d('Dialog: response - "'.concat(e.action,'"'),JSON.stringify(e,null,2))},K=(e,t)=>{p("consultation_viewed",{question_number:"Q-".concat(e),question_number_of_total:"Q-".concat(e," of ").concat(t)})},W=()=>{p("recovered_cart_success")},Y=()=>{p("recovered_cart_error")},X=()=>{p("app_closed")}},29008:function(e,t,n){"use strict";n.d(t,{F:function(){return r},w:function(){return i}});let r=()=>{try{return!!window.localStorage}catch(e){return!1}},o=()=>{window.parent.postMessage({type:"syncStorage",data:a},"*")},a={},i={getItem:e=>{try{var t;return null!==(t=a[e])&&void 0!==t?t:localStorage.getItem(e)}catch(e){return null}},setItem:(e,t)=>{try{a[e]=t,o(),localStorage.setItem(e,t)}catch(e){}},removeItem:e=>{try{a[e]=null,o(),localStorage.removeItem(e)}catch(e){}}}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[1898,4828],function(){return t(57790),t(1283),t(88553)}),_N_E=e.O()}]);
//# sourceMappingURL=main-app-2a256655181148b4.js.map