dsql-admin/dsql-app/.local_dist/server/pages/unsubscribe.js

1 line
9.3 KiB
JavaScript
Raw Normal View History

2025-02-16 16:12:40 +00:00
"use strict";(()=>{var e={};e.id=3751,e.ids=[3220,3751],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,s){return s in t?t[s]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,s)):"function"==typeof t&&"default"===s?t:void 0}}})},41531:(e,t,s)=>{s.r(t),s.d(t,{config:()=>P,default:()=>f,getServerSideProps:()=>v,getStaticPaths:()=>b,getStaticProps:()=>j,reportWebVitals:()=>A,routeModule:()=>Q,unstable_getServerProps:()=>O,unstable_getServerSideProps:()=>N,unstable_getStaticParams:()=>E,unstable_getStaticPaths:()=>L,unstable_getStaticProps:()=>y});var r={};s.r(r),s.d(r,{default:()=>_,getServerSideProps:()=>D});var a=s(63865),n=s(9455),o=s(30671),i=s(5583),c=s(53881),l=s(8732),p=s(82015),u=s.n(p),m=s(16757),d=s(91258),x=s(92702),h=s(46169),g=s(26228),S=s(71934);function _({user:e,email:t,productionEnvironment:s,existingAlerts:r}){let a="Unsubscribe | Datasquirel",n="Unsubscribe from email alerts",o=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:a}),(0,l.jsx)("meta",{name:"description",content:n}),(0,l.jsx)(d.A,{pageTitle:a,pageDescription:n,pagePathname:"/unsubscribe"})]}),[i,c]=u().useState(!1);return(0,l.jsx)(u().Fragment,{children:(0,l.jsx)(g.A,{head:o,user:e,productionEnvironment:s,children:(0,l.jsx)("main",{children:(0,l.jsxs)("section",{children:[i&&(0,l.jsx)(m.A,{}),(0,l.jsxs)("div",{className:"flex-col",children:[(0,l.jsx)("h1",{className:"text-2xl",children:"Unsubscribe from Email alerts"}),!t&&(0,l.jsxs)("p",{className:"max-w-md",children:["No email please ",(0,l.jsx)("a",{href:"/login",children:"Login"})," ","to Access Email Subscriptions or click on"," ",(0,l.jsx)("i",{children:'"unsubscribe"'})," from your mail box"]}),t&&(0,l.jsxs)("form",{className:"flex flex-col items-start gap-4",onSubmit:s=>{s.preventDefault(),c(!0);let r=s.target;(0,h.A)("/api/unsubscribe",{method:"post",body:{email:t,alerts:r.alerts_checkbox.checked,userId:e?.id?e.id:null}}).then(e=>{console.log(e),c(!1)})},children:[(0,l.jsx)("span",{className:"bg-slate-100 py-1 px-3 rounded-full",children:t}),(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)("input",{type:"checkbox",name:"alerts_checkbox",id:"alerts_checkbox",defaultChecked:!!r,className:"w-6 h-6"}),(0,l.jsx)("label",{htmlFor:"alerts_checkbox",className:"text-base whitespace-nowrap text-slate-800",children:"Alerts"})]}),(0,l.jsx)("button",{children:"Save Settings"})]})]})]})})})})}async function D({req:e,res:t,query:s}){let r=process.env.DSQL_HOST_ENV,a=await (0,x.A)(e,t),n=s.email?s.email:a?.email?a.email:null,o=await (0,S.A)(`SELECT email FROM unsubscribes WHERE email='${n}' AND type='alerts'`);return{props:{user:a,email:n,productionEnvironment:r,existingAlerts:!o[0]}}}let f=(0,o.M)(r,"default"),j=(0,o.M)(r,"getStaticProps"),b=(0,o.M)(r,"getStaticPaths"),v=(0,o.M)(r,"getServerSideProps"),P=(0,o.M)(r,"config"),A=(0,o.M)(r,"reportWebVitals"),y=(0,o.M)(r,"unstable_getStaticProps"),L=(0,o.M)(r,"unstable_getStaticPaths"),E=(0,o.M)(r,"unstable_getStaticParams"),O=(0,o.M)(r,"unstable_getServerProps"),N=(0,o.M)(r,"unstable_getServerSideProps"),Q=new a.PagesRouteModule({definition:{kind:n.A.PAGES,page:"/unsubscribe",pathname:"/unsubscribe",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:r})},60149:(e,t,s)=>{s.d(t,{On:()=>a.a,Yv:()=>o.a,_n:()=>c}),s(76102);var r=s(65967),a=s.n(r),n=s(30889),o=s.n(n),i=s(93726);let c=s.n(i)()},91258:(e,t,s)=>{s.d(t,{A:()=>o});var r=s(8732),a=s(82015),n=s.n(a);function o({pageTitle:e,pageDescription:t,pagePathname:s,aceEditor:a}){return(0,r.jsxs)(n().Fragment,{children:[(0,r.jsx)("link",{rel:"canonical",href:"http://localhost:7070"+s}),(0,r.jsx)("meta",{property:"og:url",content:"http://localhost:7070"+s}),(0,r.jsx)("meta",{itemProp:"url",content:"http://localhost:7070"+s}),(0,r.jsx)("meta",{name:"twitter:url",content:"http://localhost:7070"+s}),(0,r.jsx)("meta",{property:"og:title",content:e}),(0,r.jsx)("meta",{property:"og:description",content:t}),(0,r.jsx)("meta",{itemProp:"name",content:e}),(0,r.jsx)("meta",{itemProp:"description",