PageSourceSearch

https://www.merrydiv.com/assets/Notifications-D5cTbPbq.js

js merrydiv.com collected 2026-10-02 00:32:59 UTC 5,473 bytes, 1 lines download raw bytes

1import{r as n,j as e,w as _,bp as j,a7 as v,av as k,bq as w,br as S}from"./react-vendor-D_nsP3Ik.js";import{C}from"./app-vendor-Bgcf8357.js";import{g as z,a as m}from"./index-BifhAkEM.js";import{u as R,a as P,S as I,T as u}from"./store-CwTHLgz-.js";import{u as O}from"./notistack.esm-DQJdjsZq.js";const b=[{id:"email_enabled",label:"Email Notifications",description:"Receive email notifications when dividends are paid",icon:e.jsx(v,{size:20}),field:"email_enabled"},{id:"email_monthly_report_enabled",label:"Monthly Report",description:"Get a monthly summary of your dividend income",icon:e.jsx(k,{size:20}),field:"email_monthly_report_enabled"},{id:"email_weekly_report_enabled",label:"Weekly Report",description:"Receive weekly updates on your portfolio performance",icon:e.jsx(w,{size:20}),field:"email_weekly_report_enabled"},{id:"marketing_enabled",label:"Product Updates",description:"Stay informed about new features and improvements",icon:e.jsx(S,{size:20}),field:"marketing_enabled"}];function D(){const{enqueueSnackbar:l}=O(),d=R(),s=P(I),[x,c]=n.useState(!0),[h,p]=n.useState(null);n.useEffect(()=>{document.title="Notifications - MerryDiv"},[]);const f=n.useMemo(()=>({headers:{Authorization:z("merrydiv.session"),"Content-Type":"application/json"}}),[]),g=async()=>{try{const i=await m.get("/api/v1/settings/notifications",f),a={user_id:i.data.user_id,email_enabled:i.data.email_enabled,email_monthly_report_enabled:i.data.email_monthly_report_enabled,email_weekly_report_enabled:i.data.email_weekly_report_enabled,marketing_enabled:i.data.marketing_enabled};d(u(a))}catch(i){console.error("Failed to load subscription profile:",i)}finally{c(!1)}},y=async(i,a)=>{p(i);const o={[i]:!a};try{const t=await m.put("/api/v1/subscription_profile",o,f),r={user_id:t.data.user_id,email_enabled:t.data.email_enabled,email_monthly_report_enabled:t.data.email_monthly_report_enabled,email_weekly_report_enabled:t.data.email_weekly_report_enabled,marketing_enabled:t.data.marketing_enabled};d(u(r)),l("Notification settings updated",{autoHideDuration:2e3,variant:"success",anchorOrigin:{vertical:"bottom",horizontal:"center"}})}catch(t){l("Failed to update settings",{autoHideDuration:3e3,variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"center"}}),console.error("Failed to update subscription profile:",t)}finally{p(null)}};return n.useEffect(()=>{s.subscriptionProfile?c(!1):g()},[s.subscriptionProfile]),e.jsx(C,{fluid:!0,className:"px-4",children:e.jsxs("div",{style:{maxWidth:"600px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:600,color:"#111827",marginBottom:"8px"},children:"Notifications"}),e.jsx("p",{style:{fontSize:"0.875rem",color:"#6b7280",margin:0},children:"Manage how and when you receive updates from MerryDiv"})]}),e.jsxs("div",{style:{backgroundColor:"#ffffff",borderRadius:"12px",border:"1px solid #e5e7eb",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"20px 24px",borderBottom:"1px solid #f3f4f6"},children:[e.jsx("div",{style:{width:"40px",height:"40px",borderRadius:"10px",backgroundColor:"#f3f4f6",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280"},children:e.jsx(_,{size:20})}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:"1rem",fontWeight:600,color:"#111827",margin:0},children:"Email Preferences"}),e.jsx("p",{style:{fontSize:"0.8125rem",color:"#6b7280",margin:0},children:"Choose which emails you'd like to receive"})]})]}),e.jsx("div",{style:{padding:"8px 0"},children:x?e.jsx("div",{style:{padding:"16px 24px"},children:[1,2,3,4].map(i=>e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(j,{height:60,style:{borderRadius:"8px"}})},i))}):b.map((i,a)=>{var r;const o=!!((r=s.subscriptionProfile)!=null&&r[i.field]),t=h===i.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:a<b.length-1?"1px solid #f3f4f6":"none",opacity:t?.6:1,transition:"opacity 150ms ease"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",ga
1p:"14px",flex:1},children:[e.jsx("div",{style:{width:"36px",height:"36px",borderRadius:"8px",backgroundColor:o?"#ecfdf5":"#f9fafb",display:"flex",alignItems:"center",justifyContent:"center",color:o?"#10b981":"#9ca3af",flexShrink:0,marginTop:"2px"},children:i.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"0.9375rem",fontWeight:500,color:"#111827",marginBottom:"2px"},children:i.label}),e.jsx("div",{style:{fontSize:"0.8125rem",color:"#6b7280"},children:i.description})]})]}),e.jsx("button",{onClick:()=>y(i.id,o),disabled:t,style:{position:"relative",width:"48px",height:"28px",borderRadius:"14px",border:"none",backgroundColor:o?"#10b981":"#e5e7eb",cursor:t?"not-allowed":"pointer",transition:"background-color 200ms ease",flexShrink:0,marginLeft:"16px"},children:e.jsx("span",{style:{position:"absolute",top:"3px",left:o?"23px":"3px",width:"22px",height:"22px",borderRadius:"50%",backgroundColor:"#ffffff",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.2)",transition:"left 200ms ease"}})})]},i.id)})})]}),e.jsx("div",{style:{marginTop:"16px",padding:"12px 16px",backgroundColor:"#f9fafb",borderRadius:"8px"},children:e.jsx("p",{style:{fontSize:"0.8125rem",color:"#6b7280",margin:0},children:"You can unsubscribe from any email at any time by clicking the unsubscribe link at the bottom of the email."})})]})})}export{D as default};

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.