1 line
9.7 KiB
JavaScript
1 line
9.7 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8810],{7900:(e,a,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/create-account",function(){return t(6660)}])},6234:(e,a,t)=>{"use strict";t.d(a,{A:()=>l});var s=t(4848);function l(e){let{message:a}=e;return(0,s.jsxs)("div",{className:"p-2 bg-orange-50 w-full justify-center rounded text-sm text-orange-700 border border-orange-400 border-solid",children:[(0,s.jsx)("img",{src:"/images/warning.png",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,s.jsx)("span",{children:a})]})}t(6540)},4329:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var s=t(4848);t(6540);var l=t(1710);function r(){return(0,s.jsx)("div",{className:"flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100",children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-20 bg-white rounded shadow-sm max-w-2xl w-full",children:[(0,s.jsx)("img",{src:"/images/logo-icon-alt-2.webp",alt:"Datasquirel Logo",width:60}),(0,s.jsx)("div",{className:"w-10 h-10 flex flex-col items-center justify-center",children:(0,s.jsx)(l.A,{width:"25px",position:"relative"})})]})})}},9625:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});var s=t(4848),l=t(6540);function r(e){let{pageTitle:a,pageDescription:t,pagePathname:r,aceEditor:n}=e;return(0,s.jsxs)(l.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:a}),(0,s.jsx)("meta",{property:"og:description",content:t}),(0,s.jsx)("meta",{itemProp:"name",content:a}),(0,s.jsx)("meta",{itemProp:"description",content:t}),(0,s.jsx)("meta",{name:"twitter:title",content:a}),(0,s.jsx)("meta",{name:"twitter:description",content:t}),n&&(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",integrity:"sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),(0,s.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",integrity:"sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"})]})]})}},4060:(e,a,t)=>{"use strict";let s;t.d(a,{A:()=>m});var l=t(4848),r=t(6540),n=t(9020);async function i(e){let{e:a,setLoading:t,user:s,image:l,query:r}=e;t(!0);let i={first_name:a.target.first_name.value,last_name:a.target.last_name.value,email:s?null:a.target.email_address.value,username:s?null:a.target.username.value,password:s?null:a.target.password.value,image:l||null};(null==r?void 0:r.invite)&&(i.inviteObject=r),(0,n.A)(s?"/api/updateUser":"/api/registerUser",{method:"post",body:i},!!s).then(e=>{console.log(e),!s&&(null==e?void 0:e.insertId)?(localStorage.setItem("id",e.insertId),(0,n.A)("/api/loginUser",{method:"post",body:{email:i.email,password:i.password}}).then(e=>{console.log(e),localStorage.setItem("csrf",e.user.csrf_k),localStorage.setItem("stripe_id",e.user.stripe_id),localStorage.setItem("user",JSON.stringify(e.userPayload)),window.location.href="/admin"})):s&&(null==e?void 0:e.user)?window.location.reload():(null==e?void 0:e.msg)&&alert(e.msg)}).catch(e=>{console.log(e)}).finally(()=>{setTimeout(()=>{t(!1)},2e3)})}var o=t(6234),c=t(1710),d=t(7384);function m(e){let{user:a,query:t,image:m}=e,u=(null==t?void 0:t.email)?t.email:(null==a?void 0:a.email)?a.email:"",[x,p]=r.useState(null),[g,h]=r.useState(!1);return(0,l.jsxs)("div",{className:"relative w-full max-w-2xl flex-col items-start",children:[g&&(0,l.jsx)(c.A,{}),!a&&(0,l.jsxs)(r.Fragment,{children:[(0,l.jsx)("hr",{className:"opacity-0"}),(0,l.jsx)(d.A,{user:null,userType:"admin",setLoading:h}),(0,l.jsxs)("div",{className:"w-full justify-center relative",children:[(0,l.jsx)("span",{className:"bg-white dark:bg-slate-800 px-3 relative z-10",children:"OR"}),(0,l.jsx)("hr",{className:"absolute"})]})]}),(0,l.jsxs)("form",{className:"w-full flex flex-col items-start gap-4 relative",onSubmit:e=>{e.preventDefault(),window.confirm("Update Account Information?")&&i({e,setLoading:h,user:a,image:m,query:t})},children:[x&&(0,l.jsx)(o.A,{message:x}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"first_name",children:"First Name"}),(0,l.jsx)("input",{type:"text",name:"first_name",id:"first_name",placeholder:"First Name",autoComplete:"given-name",onInput:e=>{let a=e.target;a.value.match(/./)?(a.classList.remove("warning"),p(null)):a.classList.add("warning")},defaultValue:a?a.first_name:"",required:!0})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"last_name",children:"Last Name"}),(0,l.jsx)("input",{type:"text",name:"last_name",id:"last_name",placeholder:"Last Name",autoComplete:"family-name",onInput:e=>{let a=e.target;a.value.match(/./)?(a.classList.remove("warning"),p(null)):a.classList.add("warning")},defaultValue:a?a.last_name:"",required:!0})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"username",children:"Username"}),(0,l.jsx)("input",{type:"text",name:"username",id:"username",placeholder:"Username",autoComplete:"username",onInput:e=>{let a=e.target;a.value.match(/./)?(a.classList.remove("warning"),p(null)):a.classList.add("warning"),window.clearTimeout(s),s=setTimeout(()=>{(0,n.A)("/api/checkDuplicateData?type=username&value=".concat(a.value,"&tableName=users")).then(e=>{console.log(e),(null==e?void 0:e.result)?(p("Username Already Exists"),a.classList.add("warning")):(p(null),a.classList.remove("warning"))})},300)},defaultValue:a?a.username:"",required:!a,readOnly:!!a})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"email_address",children:"Email Address"}),(0,l.jsx)("input",{type:"email",name:"email_address",id:"email_address",placeholder:"Email Address",autoComplete:"email",onInput:e=>{let a=e.target;window.clearTimeout(s),s=setTimeout(()=>{(0,n.A)("/api/checkDuplicateData?type=email&value=".concat(a.value,"&tableName=users")).then(e=>{console.log(e),(null==e?void 0:e.result)?(p("Email Already Exists"),a.classList.add("warning")):(p(null),a.classList.remove("warning"))})},300)},defaultValue:u,required:!0,readOnly:!!a})]}),!a&&(0,l.jsxs)(r.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"password",children:"Password"}),(0,l.jsx)("input",{type:"password",name:"password",id:"password",placeholder:"Password",required:!0})]}),(0,l.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,l.jsx)("label",{htmlFor:"confirm_password",children:"Confirm Password"}),(0,l.jsx)("input",{type:"password",name:"confirm_password",id:"confirm_password",placeholder:"Confirm Password",onInput:e=>{var a;let t=e.target;(null===(a=t.closest("form"))||void 0===a?void 0:a.password.value)===t.value?t.classList.remove("warning"):t.classList.add("warning")},required:!0})]}),(0,l.jsxs)("span",{className:"text-sm",children:['By clicking "Create Account" you agree to our'," ",(0,l.jsx)("a",{href:"/terms",target:"_blank",className:"font-bold",children:"Terms and Conditions"})]})]}),(0,l.jsx)("button",{type:"submit",className:"w-full",children:a?(0,l.jsx)("span",{children:"Update Account Info"}):(0,l.jsx)("span",{children:"Create Account"})}),!a&&(0,l.jsx)(r.Fragment,{children:(0,l.jsxs)("span",{className:"text-sm",children:["Already Have an Account?"," ",(0,l.jsx)("a",{href:"/login",className:"font-bold",children:"Login"})]})})]})]})}},6660:(e,a,t)=>{"use strict";t.r(a),t.d(a,{CreateAccountContext:()=>u,__N_SSP:()=>m,default:()=>x});var s=t(4848),l=t(6540),r=t(8883),n=t(9625),i=t(4060);function o(){let{query:e,invitingUser:a}=l.useContext(u);return(0,s.jsxs)("section",{className:"flex-col items-center lg:items-center gap-20 p-0",children:[(0,s.jsx)("img",{src:"/images/grid.webp",alt:"Dotted image background",className:"absolute top-0 left-0 w-full h-full object-cover opacity-80 dark:opacity-10 z-0"}),(0,s.jsxs)("div",{className:"w-full lg:w-1/2 max-w-6xl gap-4 flex-col items-center px-4 py-10 bg-white dark:bg-slate-900 relative z-10",children:[(null==a?void 0:a.first_name)&&(0,s.jsxs)("span",{className:"text-xs bg-emerald-100 rounded-full px-4 py-1 mb-4",children:["You have been invited by"," ",(0,s.jsxs)("b",{children:[a.first_name," ",a.last_name," (",a.email,")"]})," ","to manage an account. Please create an account to gain access."]}),(0,s.jsx)("h1",{className:"m-0 text-center text-2xl",children:"Create An Account"}),(0,s.jsx)(i.A,{query:e})]})]})}var c=t(9020),d=t(4329),m=!0;let u=l.createContext({});function x(e){var a;let t="Create Account | Datasquirel",i="Create a FREE account and start storing data.",m=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("title",{children:t}),(0,s.jsx)("meta",{name:"description",content:i}),(0,s.jsx)(n.A,{pageTitle:t,pageDescription:i,pagePathname:"/"})]}),[x,p]=l.useState(null);return(l.useEffect(()=>{var a;(null===(a=e.query)||void 0===a?void 0:a.invite)&&!e.isAuthCookie&&setTimeout(()=>{(0,c.A)("/api/addAdminUserUser",{method:"POST",body:{query:e.query}},!0).then(a=>{var t;window.location.pathname="/admin/".concat(null===(t=e.user)||void 0===t?void 0:t.id,"/users")})},1e3)},[]),null===(a=e.query)||void 0===a?void 0:a.invite)?(0,s.jsx)(d.A,{}):(0,s.jsx)(r.A,{head:m,children:(0,s.jsx)(u.Provider,{value:{user:x,query:e.query,invitingUser:e.invitingUser},children:(0,s.jsx)("main",{children:(0,s.jsx)(o,{})})})})}}},e=>{var a=a=>e(e.s=a);e.O(0,[7384,636,6593,8792],()=>a(7900)),_N_E=e.O()}]); |