mtxuilib 0.0.504 → 0.0.506

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use client";var w=Object.defineProperty;var c=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var p=(o,e,t)=>e in o?w(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,l=(o,e)=>{for(var t in e||(e={}))y.call(e,t)&&p(o,t,e[t]);if(c)for(var t of c(e))N.call(e,t)&&p(o,t,e[t]);return o};var d=(o,e,t)=>new Promise((r,u)=>{var h=s=>{try{m(t.next(s))}catch(n){u(n)}},v=s=>{try{m(t.throw(s))}catch(n){u(n)}},m=s=>s.done?r(s.value):Promise.resolve(s.value).then(h,v);m((t=t.apply(o,e)).next())});import{jsx as a,jsxs as i}from"react/jsx-runtime";import{useAuth as b}from"gomtm/providers/userContext";import{AuthLoginInput as S}from"gomtm/validations/auth";import{ZForm as M,useZodForm as x}from"../../form/ZodForm";import{MtLink as F}from"../../common/mtlink";import{Input as f}from"../../ui/input";import{MtButton as g}from"../../ui/ui-mt/Button";function G(){const o=x({schema:S,defaultValues:{}}),e=b();return i("div",{className:"mx-auto max-w-md",children:[a("div",{className:"prose",children:"Sign in"}),i("div",{className:"prose text-sm",children:["New to company?"," ",a(F,{href:"#replace-with-a-link",children:"Sign up!"})]}),a(g,{variant:"ghost",className:"bg-opacity/0.8 w-full bg-neutral-50",children:"Continue with Google"}),i(M,{form:o,className:"space-y-2",handleSubmit:r=>d(this,null,function*(){e.login.mutate(r)}),children:[a(f,l({type:"email"},o.register("username"))),a(f,l({type:"password"},o.register("password"))),a("div",{className:"flex items-center justify-between"}),a(g,{type:"submit",className:"w-full",children:"Sign in"})]}),a("footer",{className:"py-3",children:i("div",{className:"prose text-center",children:["\xA9 Mtm ltd. ",new Date().getFullYear()]})})]})}export{G as LoginScreen2};
1
+ "use client";var v=Object.defineProperty;var d=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var f=(o,t,e)=>t in o?v(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,u=(o,t)=>{for(var e in t||(t={}))w.call(t,e)&&f(o,e,t[e]);if(d)for(var e of d(t))N.call(t,e)&&f(o,e,t[e]);return o};var g=(o,t,e)=>new Promise((p,i)=>{var m=r=>{try{a(e.next(r))}catch(l){i(l)}},c=r=>{try{a(e.throw(r))}catch(l){i(l)}},a=r=>r.done?p(r.value):Promise.resolve(r.value).then(m,c);a((e=e.apply(o,t)).next())});import{jsx as s,jsxs as n}from"react/jsx-runtime";import{AuthLoginInput as S}from"gomtm/validations/auth";import{useRouter as b,useSearchParams as M}from"next/navigation";import{MtLink as x}from"../../common/mtlink";import{ZForm as L,useZodForm as F}from"../../form/ZodForm";import{Input as h}from"../../ui/input";import{MtButton as y}from"../../ui/ui-mt/Button";function O(){const o=F({schema:S,defaultValues:{}}),t=M(),e=b();return n("div",{className:"mx-auto max-w-md",children:[s("div",{className:"prose",children:"Sign in"}),n("div",{className:"prose text-sm",children:["New to company?"," ",s(x,{href:"#replace-with-a-link",children:"Sign up!"})]}),s(y,{variant:"ghost",className:"bg-opacity/0.8 w-full bg-neutral-50",children:"Continue with Google"}),n(L,{form:o,className:"space-y-2",handleSubmit:i=>g(this,null,function*(){const m=yield fetch("/api.v1/login",{method:"POST",body:JSON.stringify(i)}),{success:c}=yield m.json();if(c){const a=t.get("next");e.push(a!=null?a:"/"),e.refresh()}else alert("Login failed")}),children:[s(h,u({},o.register("username"))),s(h,u({type:"password"},o.register("password"))),s("div",{className:"flex items-center justify-between"}),s(y,{type:"submit",className:"w-full",children:"Sign in"})]}),s("footer",{className:"py-3",children:n("div",{className:"prose text-center",children:["\xA9 Mtm ltd. ",new Date().getFullYear()]})})]})}export{O as LoginScreen2};
@@ -1 +1 @@
1
- "use client";import{Fragment as P,jsx as s}from"react/jsx-runtime";import{createContext as k,useCallback as v,useContext as h,useMemo as o,useState as C}from"react";import{getCookie as w}from"gomtm/clientlib";import{ExtKey_Hostname as u,ExtKey_SelfBackend as p,ExtKey_mtmaccessToken as d,ExtKey_mtmbackend as a,MtM_TOKEN_NAME as l}from"gomtm/consts";import{MtConnectProvider as y}from"gomtm/providers/MtConnectProvider";import{MtReactQueryProvider as E}from"gomtm/providers/ReactQueryProvider";const f=k(void 0);function B(t){const{children:n,initExtKv:e}=t,i=o(()=>e[p],[e]),r=o(()=>e[a],[e]),m=o(()=>e[u],[e]),x=o(()=>e[d],[e]);return s(P,{children:s(f.Provider,{value:{extKv:e,token:x,hostname:m,backendUrl:r,trpcBackendUrl:i},children:s(y,{children:s(E,{children:n})})})})}function c(){const t=h(f);if(t===void 0)throw new Error("useTrpcApp must be used within a TrpcAppProvider");return t}const g=()=>{const{backendUrl:t}=c();return t},A=()=>{const{hostname:t}=c();return t||window.location.host},H=()=>{const t=g(),n=A(),{token:e}=c();return v(r=>{switch(r){case a:return t;case u:return n;case d:return e;case p:return;default:throw new Error(`extinfo key error: ${r}`)}},[t,n,e])},R=()=>{const[t]=C(typeof window!="undefined"?w(l):"");return{token:t||"",setToken:n=>{typeof window!="undefined"&&(document.cookie=`${l}=${n}`)}}};export{B as TrpcAppProvider,H as useExtInfo,A as useHostname,g as useMtmBackendUrl,R as useToken,c as useTrpcApp};
1
+ "use client";import{Fragment as g,jsx as i}from"react/jsx-runtime";import{createContext as m,useCallback as k,useContext as h,useMemo as o,useState as v}from"react";import{getCookie as w}from"gomtm/clientlib";import{ExtKey_Hostname as c,ExtKey_SelfBackend as u,ExtKey_mtmaccessToken as p,ExtKey_mtmbackend as y,MtM_TOKEN_NAME as d}from"gomtm/consts";import{MtReactQueryProvider as C}from"gomtm/providers/ReactQueryProvider";const a=m(void 0);function b(t){const{children:n,initExtKv:e}=t,r=o(()=>e[u],[e]),l=o(()=>e[y],[e]),f=o(()=>e[c],[e]),x=o(()=>e[p],[e]);return i(g,{children:i(a.Provider,{value:{extKv:e,token:x,hostname:f,backendUrl:l,trpcBackendUrl:r},children:i(C,{children:n})})})}function s(){const t=h(a);if(t===void 0)throw new Error("useTrpcApp must be used within a TrpcAppProvider");return t}const U=()=>{const{backendUrl:t}=s();return t},E=()=>{const{hostname:t}=s();return t||window.location.host},_=()=>{const t=E(),{token:n}=s();return k(r=>{switch(r){case c:return t;case p:return n;case u:return;default:throw new Error(`extinfo key error: ${r}`)}},[t,n])},B=()=>{const[t]=v(typeof window!="undefined"?w(d):"");return{token:t||"",setToken:n=>{typeof window!="undefined"&&(document.cookie=`${d}=${n}`)}}};export{b as TrpcAppProvider,_ as useExtInfo,E as useHostname,U as useMtmBackendUrl,B as useToken,s as useTrpcApp};