1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8345],{8282:function(__unused_webpack_module,__unused_webpack_exports,__webpack_require__){(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/notification-settings",function(){return __webpack_require__(2852)}])},2852:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:function(){return notification_settings}});var jsx_runtime=__webpack_require__(5893),react=__webpack_require__(7294),next_router=__webpack_require__(1163),Head=__webpack_require__(4855),Inputs=__webpack_require__(3537);let Switch=param=>{let{switched,onChange}=param;return(0,jsx_runtime.jsxs)("div",{className:"switch ".concat(switched?"switch__checked":""),children:[(0,jsx_runtime.jsx)("button",{className:"switch__btn",onClick:()=>onChange&&onChange()}),(0,jsx_runtime.jsx)("div",{className:"switch__icon",children:switched&&(0,jsx_runtime.jsx)(Icon,{})})]})},Icon=()=>(0,jsx_runtime.jsx)("svg",{width:"7",height:"7",viewBox:"0 0 7 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,jsx_runtime.jsx)("path",{d:"M6.79497 2.14914L3.10217 5.84167C2.82872 6.11518 2.38513 6.11518 2.11142 5.84167L0.20517 3.93529C-0.0683899 3.66178 -0.0683899 3.21814 0.20517 2.94458C0.478781 2.67097 0.922335 2.67097 1.19583 2.94448L2.60694 4.35561L5.80416 1.15838C6.07777 0.884767 6.52136 0.884974 6.79486 1.15838C7.06837 1.43194 7.06837 1.87542 6.79497 2.14914Z",fill:"#3D5FCA"})});var Text=__webpack_require__(6058),AccountHeader=__webpack_require__(1384),authContext=__webpack_require__(188),fetchContext=__webpack_require__(5828);let TurnOffNotificationModal=param=>{let{type,onSubmit,onClose}=param;return(0,jsx_runtime.jsxs)("div",{className:"notification-modal",children:[(0,jsx_runtime.jsx)("div",{className:"notification-modal__background",onClick:onClose}),(0,jsx_runtime.jsx)("div",{className:"notification-modal__children",children:(0,jsx_runtime.jsxs)("div",{className:"notification-modal__wrapper",children:[(0,jsx_runtime.jsx)("div",{className:"notification-modal__close"}),(0,jsx_runtime.jsxs)("div",{className:"notification-modal__content",children:[(0,jsx_runtime.jsxs)(Text.X,{variation:"p",className:"notification-modal__title",children:["Are you sure you want to turn off ","email"===type?"email":"text message"," notifications?"]}),(0,jsx_runtime.jsxs)("div",{className:"notification-modal__cta",children:[(0,jsx_runtime.jsx)(Inputs.zx,{variation:"bordered",onClick:onClose,children:"Cancel"}),(0,jsx_runtime.jsx)(Inputs.zx,{variation:"danger",onClick:onSubmit,type:"button",children:"Turn Off"})]})]})]})})]})};var Layout=__webpack_require__(9655),Modal=__webpack_require__(5559),next_link=__webpack_require__(1664),link_default=__webpack_require__.n(next_link),VerifyPhonePopup=__webpack_require__(8093);let NotificationSettings=()=>{let{fetchAPI}=(0,fetchContext.ib)(),router=(0,next_router.useRouter)(),{user}=(0,authContext.aC)(),[notifications,setNotifications]=(0,react.useState)({notify_market_alerts_email:!1,notify_market_alerts_text:!1});(0,react.useEffect)(()=>{user.emailVerified||router.replace("/account")},[user,router]);let[fetching,setFetching]=(0,react.useState)(!1);(0,react.useEffect)(()=>{let getNotifications=async()=>{let json=await fetchAPI("/notify/list",{method:"GET"});json.success&&setNotifications(json.response.data)};getNotifications()},[fetchAPI]);let[submitTurnOffModal,setSubmitTurnOffModal]=(0,react.useState)(null),[showVerifyPhoneModal,setShowVerifyPhoneModal]=(0,react.useState)(!1),initSwitchHandler=type=>{var ref;let subscribe="email"===type?notifications.notify_market_alerts_email:notifications.notify_market_alerts_text;return subscribe?setSubmitTurnOffModal(type):"message"===type&&(null==user?void 0:null===(ref=user.profileData)||void 0===ref?void 0:ref.phone_number_change_to_pending)?setShowVerifyPhoneModal(!0):void switchHandler(type)},switchHandler=async(type,noCheck)=>{var ref;let subscribe="email"===type?notifications.notify_market_alerts_email:notifications.notify_market_alerts_text;if(!(null==user?void 0:null===(ref=user.profileData)||void 0===ref?void 0:ref.phone_number)&&"message"===type&&!noCheck)return setShowNumberModal(!0);fetching||(setFetching(!0),setSubmitTurnOffModal(null),await fetchAPI("/notify/email?subscribe=".concat(!subscribe,"&
1channel=").concat("email"===type?"market_alerts":"market_alerts_text"),{method:"PUT"}),setNotifications(notifications=>({notify_market_alerts_email:"email"===type?!notifications.notify_market_alerts_email:notifications.notify_market_alerts_email,notify_market_alerts_text:"message"===type?!notifications.notify_market_alerts_text:notifications.notify_market_alerts_text})),setFetching(!1))},[showNumberModal,setShowNumberModal]=(0,react.useState)(!1),numberSuccessHandler=()=>{switchHandler("message",!0),setShowNumberModal(!1)};return(0,jsx_runtime.jsx)(Layout.Z,{children:(0,jsx_runtime.jsxs)("div",{className:"notifications page page__account",children:[(0,jsx_runtime.jsx)(Head.ZP,{title:"Notification Settings",url:"account/notification-settings/"}),showVerifyPhoneModal&&(0,jsx_runtime.jsx)(VerifyPhoneModal,{onClose:()=>setShowVerifyPhoneModal(!1)}),showNumberModal,showNumberModal&&(0,jsx_runtime.jsx)(VerifyPhonePopup.Z,{type:"add",close:()=>setShowNumberModal(!1),onSuccess:numberSuccessHandler}),submitTurnOffModal&&(0,jsx_runtime.jsx)(TurnOffNotificationModal,{type:submitTurnOffModal,onSubmit:()=>switchHandler(submitTurnOffModal),onClose:()=>setSubmitTurnOffModal(null)}),(0,jsx_runtime.jsxs)("div",{className:"container",children:[(0,jsx_runtime.jsx)(AccountHeader.Z,{to:"/account"}),(0,jsx_runtime.jsx)(Text.X,{type:"title",variation:"h2",className:"notifications__title",children:"Notification Settings"}),(0,jsx_runtime.jsxs)("div",{className:"notifications__container",children:[(0,jsx_runtime.jsx)(Text.X,{type:"big",variation:"h3",className:"notifications__container--heading",children:"Product + Marketing Alerts"}),(0,jsx_runtime.jsx)(Inputs.fv,{container:"row",title:"Text Message",children:(0,jsx_runtime.jsx)(Switch,{switched:notifications.notify_market_alerts_text,onChange:()=>initSwitchHandler("message")})}),(0,jsx_runtime.jsx)(Inputs.fv,{container:"row",title:"Email",children:(0,jsx_runtime.jsx)(Switch,{switched:notifications.notify_market_alerts_email,onChange:()=>initSwitchHandler("email")})})]})]})]})})},VerifyPhoneModal=param=>{let{onClose}=param;return(0,jsx_runtime.jsx)(Modal.ZP,{visible:!0,header:(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{children:"Verify your phone number"}),onClose:onClose,className:"phonenumber__modal",children:(0,jsx_runtime.jsx)("div",{className:"phonenumber__modal--content",children:(0,jsx_runtime.jsxs)("p",{children:["Verify your phone number to turn on text message notifications. ",(0,jsx_runtime.jsx)("br",{}),(0,jsx_runtime.jsx)(link_default(),{href:"/account/info",style:{color:"inherit"},children:"Go to Account Info"})]})})})};NotificationSettings.authGuard=!0;var notification_settings=NotificationSettings}},function(__webpack_require__){__webpack_require__.O(0,[9198,9655,2141,7596,9774,2888,179],function(){return __webpack_require__(__webpack_require__.s=8282)}),_N_E=__webpack_require__.O()}]);
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.