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

1 line
9.8 KiB
JavaScript
Raw Normal View History

2025-02-19 19:38:56 +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:()=>L,default:()=>f,getServerSideProps:()=>v,getStaticPaths:()=>b,getStaticProps:()=>j,reportWebVitals:()=>P,routeModule:()=>N,unstable_getServerProps:()=>Q,unstable_getServerSideProps:()=>y,unstable_getStaticParams:()=>O,unstable_getStaticPaths:()=>E,unstable_getStaticProps:()=>A});var r={};s.r(r),s.d(r,{default:()=>D,getServerSideProps:()=>h});var n=s(63865),a=s(9455),o=s(30671),i=s(5583),c=s(53881),l=s(8732),p=s(82015),u=s.n(p),m=s(16757),_=s(91258),d=s(92702),S=s(46169),x=s(26228),g=s(71934);function D({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)(_.A,{pageTitle:n,pageDescription:a,pagePathname:"/unsubscribe"})]}),[i,c]=u().useState(!1);return(0,l.jsx)(u().Fragment,{children:(0,l.jsx)(x.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,S.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 h({req:e,res:t,query:s}){let r=process.env.DSQL_HOST_ENV,{user:n,appData:a}=await (0,d.A)(e,t),o=s.email?s.email:n?.email?n.email:null,i=await (0,g.A)(`SELECT email FROM unsubscribes WHERE email='${o}' AND type='alerts'`);return{props:{user:n,appData:a,email:o,productionEnvironment:r,existingAlerts:!i[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"),L=(0,o.M)(r,"config"),P=(0,o.M)(r,"reportWebVitals"),A=(0,o.M)(r,"unstable_getStaticProps"),E=(0,o.M)(r,"unstable_getStaticPaths"),O=(0,o.M)(r,"unstable_getStaticParams"),Q=(0,o.M)(r,"unstable_getServerProps"),y=(0,o.M)(r,"unstable_getServerSideProps"),N=new n.PagesRouteModule({definition:{kind:a.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:()=>n.a,Yv:()=>o.a,_n:()=>c}),s(76102);var r=s(65967),n=s.n(r),a=s(30889),o=s.n(a),i=s(93726);let c=s.n(i)()},91258:(e,t,s)=>{s.d(t,{A:()=>i});var r=s(8732),n=s(53881),a=s(82015),o=s.n(a);function i({pageTitle:e,pageDescription:t,pagePathname:s,aceEditor:a}){let i=o().useContext(n.AppContext),{DSQL_HOST:c}=i.pageProps?.appData||{DSQL_HOST:"https://datasquirel.com"};return(0,r.jsxs)(o().Fragment,{children:[(0,r.jsx)("link",{rel:"canonical",href:c+s}),(0,r.jsx)("meta",{property:"og:url",content:c+s}),(0,r.jsx)("meta",{itemProp:"url",content:c+s}),(0,r.jsx)("meta",{name:"twitter:url",content:c+s}),(0,r.jsx)("meta",{property:"og:title",content:e}),(0,r.jsx)("meta",{property:"og:description",content:t}),(0,r.jsx)("meta",{itemProp:"