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

1 line
8.5 KiB
JavaScript
Raw Normal View History

2025-01-14 15:27:08 +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:()=>D,getStaticProps:()=>b,reportWebVitals:()=>A,routeModule:()=>M,unstable_getServerProps:()=>N,unstable_getServerSideProps:()=>O,unstable_getStaticParams:()=>E,unstable_getStaticPaths:()=>L,unstable_getStaticProps:()=>y});var r={};s.r(r),s.d(r,{default:()=>_,getServerSideProps:()=>j});var n=s(63865),a=s(9455),o=s(30671),i=s(5583),c=s(19796),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 n="Unsubscribe | Datasquirel",a="Unsubscribe from email alerts",o=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:n}),(0,l.jsx)("meta",{name:"description",content:a}),(0,l.jsx)(d.A,{pageTitle:n,pageDescription:a,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 j({req:e,res:t,query:s}){let r=process.env.DSQL_HOST_ENV,n=await (0,x.A)(e,t),a=s.email?s.email:n?.email?n.email:null,o=await (0,S.A)(`SELECT email FROM unsubscribes WHERE email='${a}' AND type='alerts'`);return{props:{user:n,email:a,productionEnvironment:r,existingAlerts:!o[0]}}}let f=(0,o.M)(r,"default"),b=(0,o.M)(r,"getStaticProps"),D=(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"),N=(0,o.M)(r,"unstable_getServerProps"),O=(0,o.M)(r,"unstable_getServerSideProps"),M=new n.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/unsubscribe",pathname:"/unsubscribe",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:r})},91258:(e,t,s)=>{s.d(t,{A:()=>o});var r=s(8732),n=s(82015),a=s.n(n);function o({pageTitle:e,pageDescription:t,pagePathname:s,aceEditor:n}){return(0,r.jsxs)(a().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",content:t}),(0,r.jsx)("meta",{name:"twitter:title",content:e}),(0,r.jsx)("meta",{name:"twitter:description",content:t}),n&&(0,r.jsxs)(a(