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

1 line
9.6 KiB
JavaScript
Raw Normal View History

2025-01-14 06:10:36 +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,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},41531:(e,t,r)=>{r.r(t),r.d(t,{config:()=>E,default:()=>S,getServerSideProps:()=>P,getStaticPaths:()=>y,getStaticProps:()=>b,reportWebVitals:()=>v,routeModule:()=>M,unstable_getServerProps:()=>O,unstable_getServerSideProps:()=>I,unstable_getStaticParams:()=>D,unstable_getStaticPaths:()=>N,unstable_getStaticProps:()=>A});var s={};r.r(s),r.d(s,{default:()=>_,getServerSideProps:()=>j});var n=r(63865),a=r(9455),i=r(30671),o=r(5583),c=r(19796),l=r(8732),u=r(82015),p=r.n(u),m=r(16757),d=r(91258),x=r(92702),h=r(46169),g=r(1013),f=r(71934);function _({user:e,email:t,productionEnvironment:r,existingAlerts:s}){let n="Unsubscribe | Datasquirel",a="Unsubscribe from email alerts",i=(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"})]}),[o,c]=p().useState(!1);return(0,l.jsx)(p().Fragment,{children:(0,l.jsx)(g.A,{head:i,user:e,productionEnvironment:r,children:(0,l.jsx)("main",{children:(0,l.jsxs)("section",{children:[o&&(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:r=>{r.preventDefault(),c(!0);let s=r.target;(0,h.A)("/api/unsubscribe",{method:"post",body:{email:t,alerts:s.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:!!s,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:r}){let s=process.env.DSQL_HOST_ENV,n=await (0,x.A)(e,t),a=r.email?r.email:n?.email?n.email:null,i=await (0,f.A)(`SELECT email FROM unsubscribes WHERE email='${a}' AND type='alerts'`);return{props:{user:n,email:a,productionEnvironment:s,existingAlerts:!i[0]}}}let S=(0,i.M)(s,"default"),b=(0,i.M)(s,"getStaticProps"),y=(0,i.M)(s,"getStaticPaths"),P=(0,i.M)(s,"getServerSideProps"),E=(0,i.M)(s,"config"),v=(0,i.M)(s,"reportWebVitals"),A=(0,i.M)(s,"unstable_getStaticProps"),N=(0,i.M)(s,"unstable_getStaticPaths"),D=(0,i.M)(s,"unstable_getStaticParams"),O=(0,i.M)(s,"unstable_getServerProps"),I=(0,i.M)(s,"unstable_getServerSideProps"),M=new n.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/unsubscribe",pathname:"/unsubscribe",bundlePath:"",filename:""},components:{App:c.default,Document:o.default},userland:s})},91258:(e,t,r)=>{r.d(t,{A:()=>i});var s=r(8732),n=r(82015),a=r.n(n);function i({pageTitle:e,pageDescription:t,pagePathname:r,aceEditor:n}){return(0,s.jsxs)(a().Fragment,{children:[(0,s.jsx)("link",{rel:"canonical",href:"http://localhost:7070"+r}),(0,s.jsx)("meta",{property:"og:url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{itemProp:"url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{name:"twitter:url",content:"http://localhost:7070"+r}),(0,s.jsx)("meta",{property:"og:title",content:e}),(0,s.jsx)("meta",{property:"og:description",content:t}),(0,s.jsx)("meta",{itemProp:"name",content:e}),(0,s.jsx)("meta",{itemProp:"description",content:t}),(0,s.jsx)("meta",{name:"twitter:title",content:e}),(0,s.jsx)("meta",{name:"twitter:description",content:t}),n&&(0,s.jsxs)(a()