@uninspired/auth-client 0.0.12 → 0.0.13

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.
package/dist/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var{defineProperty:u,getOwnPropertyNames:y,getOwnPropertyDescriptor:g}=Object,R=Object.prototype.hasOwnProperty;var a=new WeakMap,k=(e)=>{var t=a.get(e),n;if(t)return t;if(t=u({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")y(e).map((r)=>!R.call(t,r)&&u(t,r,{get:()=>e[r],enumerable:!(n=g(e,r))||n.enumerable}));return a.set(e,t),t};var x=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(r)=>t[n]=()=>r})};var S={};x(S,{makeUsBetterAuthClient:()=>A,makeRedirectIntent:()=>C,makePublicClient:()=>P,makeLoginUrl:()=>O,makeCheckoutUrl:()=>q,makeCheckoutClient:()=>d,makeAppClient:()=>b});module.exports=k(S);var m=require("hono/client"),P=(e,t)=>{return m.hc(e,t)};var h=require("hono/client"),b=(e,t)=>{return h.hc(e,{...t,fetch:(n,r)=>(t?.fetch??fetch)(n,{...r,credentials:"include",headers:{...r.headers,"Content-Type":"application/json"}})})};var o=require("better-auth/client/plugins"),f=require("better-auth/react"),A=(e)=>{return f.createAuthClient({baseURL:e,plugins:[o.customSessionClient(),o.magicLinkClient(),o.emailOTPClient(),o.passkeyClient()]})};var l=require("hono/client"),d=(e,t)=>{return l.hc(e,{...t,fetch:(n,r)=>(t?.fetch??fetch)(n,{...r,credentials:"include",headers:{...r.headers,"Content-Type":"application/json"}})})};function O(e,t,n){let r=new URL("/login",e);if(t)r.searchParams.set("intent",C(t,n));return r.toString()}function j(...e){}function q(e,t,n,r,s,p,c){j({priceId:t,productId:n,discountCode:r,loginUrl:s,pricingUrl:p,successUrl:c});let i=new URL("/auth/checkout",e);if(i.searchParams.set("priceId",t),i.searchParams.set("productId",n),r)i.searchParams.set("discountCode",r);if(s)i.searchParams.set("loginUrl",s);if(p)i.searchParams.set("pricingUrl",p);if(c)i.searchParams.set("successUrl",c);return i.toString()}function C(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}
1
+ var{defineProperty:c,getOwnPropertyNames:g,getOwnPropertyDescriptor:R}=Object,k=Object.prototype.hasOwnProperty;var a=new WeakMap,x=(e)=>{var t=a.get(e),r;if(t)return t;if(t=c({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")g(e).map((n)=>!k.call(t,n)&&c(t,n,{get:()=>e[n],enumerable:!(r=R(e,n))||r.enumerable}));return a.set(e,t),t};var P=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0,configurable:!0,set:(n)=>t[r]=()=>n})};var M={};P(M,{makeUsBetterAuthClient:()=>A,makeRedirectIntent:()=>y,makePublicClient:()=>b,makeMailingListClient:()=>O,makeLoginUrl:()=>q,makeCheckoutUrl:()=>j,makeCheckoutClient:()=>L,makeAppClient:()=>d});module.exports=x(M);var m=require("hono/client"),b=(e,t)=>{return m.hc(e,t)};var l=require("hono/client"),d=(e,t)=>{return l.hc(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};var i=require("better-auth/client/plugins"),h=require("better-auth/react"),A=(e)=>{return h.createAuthClient({baseURL:e,plugins:[i.customSessionClient(),i.magicLinkClient(),i.emailOTPClient(),i.passkeyClient()]})};var f=require("hono/client"),L=(e,t)=>{return f.hc(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};var C=require("hono/client"),O=(e,t,r)=>{return C.hc(e,{...r,headers:{...r?.headers,"X-Public-Key":t}})};function q(e,t,r){let n=new URL("/login",e);if(t)n.searchParams.set("intent",y(t,r));return n.toString()}function T(...e){}function j(e,t,r,n,s,p,u){T({priceId:t,productId:r,discountCode:n,loginUrl:s,pricingUrl:p,successUrl:u});let o=new URL("/auth/checkout",e);if(o.searchParams.set("priceId",t),o.searchParams.set("productId",r),n)o.searchParams.set("discountCode",n);if(s)o.searchParams.set("loginUrl",s);if(p)o.searchParams.set("pricingUrl",p);if(u)o.searchParams.set("successUrl",u);return o.toString()}function y(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}
2
2
 
3
- //# debugId=D2A8D8299A3497FE64756E2164756E21
3
+ //# debugId=2ED0EA5600DA226664756E2164756E21
4
4
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/utils/intent.ts"],
3
+ "sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/clients/mailingListClient.ts", "../../src/utils/intent.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { PublicRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type PublicClient = ReturnType<typeof hc<PublicRouter>>;\n\nexport const makePublicClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): PublicClient => {\n return hc<PublicRouter>(baseURL, options);\n};\n",
6
6
  "import type { AppRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type AppClient = ReturnType<typeof hc<AppRouter>>;\n\nexport const makeAppClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): AppClient => {\n return hc<AppRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
7
7
  "import {\n customSessionClient,\n magicLinkClient,\n emailOTPClient,\n passkeyClient,\n} from \"better-auth/client/plugins\";\nimport { createAuthClient } from \"better-auth/react\";\nimport type { Auth } from \"@us-accounts/api\";\n\nexport const makeUsBetterAuthClient = (baseURL: string) => {\n return createAuthClient({\n baseURL,\n plugins: [\n customSessionClient<Auth>(),\n magicLinkClient(),\n emailOTPClient(),\n passkeyClient(),\n ],\n });\n};\n",
8
8
  "import type { CheckoutRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;\n\nexport const makeCheckoutClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): CheckoutClient => {\n return hc<CheckoutRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
9
+ "import type { MailingListRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;\n\nexport const makeMailingListClient = (\n baseURL: string,\n publicKey: string,\n options?: ClientRequestOptions,\n): MailingListClient => {\n return hc<MailingListRouter>(baseURL, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Public-Key\": publicKey,\n },\n });\n};\n",
9
10
  "import type { CheckoutSearch, RedirectIntent } from \"@us-accounts/utils\";\n\nexport function makeLoginUrl(\n apiUrl: string,\n redirectUrl?: string,\n appName?: string,\n) {\n const url = new URL(\"/login\", apiUrl);\n if (redirectUrl) {\n url.searchParams.set(\"intent\", makeRedirectIntent(redirectUrl, appName));\n }\n return url.toString();\n}\n\nfunction noop(...args: any[]) {\n // Do nothing\n}\n\nexport function makeCheckoutUrl(\n apiUrl: string,\n priceId: string,\n productId: string,\n discountCode?: string,\n loginUrl?: string,\n pricingUrl?: string,\n successUrl?: string,\n) {\n const obj = {\n priceId,\n productId,\n discountCode,\n loginUrl,\n pricingUrl,\n successUrl,\n } satisfies CheckoutSearch;\n noop(obj);\n\n const url = new URL(\"/auth/checkout\", apiUrl);\n url.searchParams.set(\"priceId\", priceId);\n url.searchParams.set(\"productId\", productId);\n if (discountCode) {\n url.searchParams.set(\"discountCode\", discountCode);\n }\n if (loginUrl) {\n url.searchParams.set(\"loginUrl\", loginUrl);\n }\n if (pricingUrl) {\n url.searchParams.set(\"pricingUrl\", pricingUrl);\n }\n if (successUrl) {\n url.searchParams.set(\"successUrl\", successUrl);\n }\n return url.toString();\n}\n\nexport function makeRedirectIntent(\n redirectUrl: string,\n appName?: string,\n): string {\n const obj = {\n type: \"redirect\",\n redirectUrl,\n appName,\n } satisfies RedirectIntent;\n\n return JSON.stringify(obj);\n}\n"
10
11
  ],
11
- "mappings": "gpBAC8C,IAA9C,yBAIa,EAAmB,CAC9B,EACA,IACiB,CACjB,OAAO,KAAiB,EAAS,CAAO,GCRI,IAA9C,yBAIa,EAAgB,CAC3B,EACA,IACc,CACd,OAAO,KAAc,EAAS,IACzB,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCfI,IALP,wCAMA,+BAGa,EAAyB,CAAC,IAAoB,CACzD,OAAO,mBAAiB,CACtB,UACA,QAAS,CACP,sBAA0B,EAC1B,kBAAgB,EAChB,iBAAe,EACf,gBAAc,CAChB,CACF,CAAC,GCjB2C,IAA9C,yBAIa,EAAqB,CAChC,EACA,IACmB,CACnB,OAAO,KAAmB,EAAS,IAC9B,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GClBI,SAAS,CAAY,CAC1B,EACA,EACA,EACA,CACA,IAAM,EAAM,IAAI,IAAI,SAAU,CAAM,EACpC,GAAI,EACF,EAAI,aAAa,IAAI,SAAU,EAAmB,E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,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCnB2C,IAA9C,yBAIa,EAAwB,CACnC,EACA,EACA,IACsB,CACtB,OAAO,KAAsB,EAAS,IACjC,EACH,QAAS,IACJ,GAAS,QACZ,eAAgB,CAClB,CACF,CAAC,GCdI,SAAS,CAAY,CAC1B,EACA,EACA,EACA,CACA,IAAM,EAAM,IAAI,IAAI,SAAU,CAAM,EACpC,GAAI,EACF,EAAI,aAAa,IAAI,SAAU,EAAmB,EAAa,CAAO,CAAC,EAEzE,OAAO,EAAI,SAAS,EAGtB,SAAS,CAAI,IAAI,EAAa,EAIvB,SAAS,CAAe,CAC7B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,CASA,EARY,CACV,UACA,YACA,eACA,WACA,aACA,YACF,CACQ,EAER,IAAM,EAAM,IAAI,IAAI,iBAAkB,CAAM,EAG5C,GAFA,EAAI,aAAa,IAAI,UAAW,CAAO,EACvC,EAAI,aAAa,IAAI,YAAa,CAAS,EACvC,EACF,EAAI,aAAa,IAAI,eAAgB,CAAY,EAEnD,GAAI,EACF,EAAI,aAAa,IAAI,WAAY,CAAQ,EAE3C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,GAAI,EACF,EAAI,aAAa,IAAI,aAAc,CAAU,EAE/C,OAAO,EAAI,SAAS,EAGf,SAAS,CAAkB,CAChC,EACA,EACQ,CAOR,OAAO,KAAK,UANA,CACV,KAAM,WACN,cACA,SACF,CAEyB",
13
+ "debugId": "2ED0EA5600DA226664756E2164756E21",
13
14
  "names": []
14
15
  }
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{hc as c}from"hono/client";var x=(e,t)=>{return c(e,t)};import{hc as u}from"hono/client";var A=(e,t)=>{return u(e,{...t,fetch:(n,r)=>(t?.fetch??fetch)(n,{...r,credentials:"include",headers:{...r.headers,"Content-Type":"application/json"}})})};import{customSessionClient as a,magicLinkClient as m,emailOTPClient as h,passkeyClient as f}from"better-auth/client/plugins";import{createAuthClient as l}from"better-auth/react";var q=(e)=>{return l({baseURL:e,plugins:[a(),m(),h(),f()]})};import{hc as C}from"hono/client";var L=(e,t)=>{return C(e,{...t,fetch:(n,r)=>(t?.fetch??fetch)(n,{...r,credentials:"include",headers:{...r.headers,"Content-Type":"application/json"}})})};function v(e,t,n){let r=new URL("/login",e);if(t)r.searchParams.set("intent",g(t,n));return r.toString()}function y(...e){}function z(e,t,n,r,i,s,p){y({priceId:t,productId:n,discountCode:r,loginUrl:i,pricingUrl:s,successUrl:p});let o=new URL("/auth/checkout",e);if(o.searchParams.set("priceId",t),o.searchParams.set("productId",n),r)o.searchParams.set("discountCode",r);if(i)o.searchParams.set("loginUrl",i);if(s)o.searchParams.set("pricingUrl",s);if(p)o.searchParams.set("successUrl",p);return o.toString()}function g(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}export{q as makeUsBetterAuthClient,g as makeRedirectIntent,x as makePublicClient,v as makeLoginUrl,z as makeCheckoutUrl,L as makeCheckoutClient,A as makeAppClient};
1
+ import{hc as u}from"hono/client";var P=(e,t)=>{return u(e,t)};import{hc as c}from"hono/client";var A=(e,t)=>{return c(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};import{customSessionClient as a,magicLinkClient as m,emailOTPClient as l,passkeyClient as h}from"better-auth/client/plugins";import{createAuthClient as f}from"better-auth/react";var T=(e)=>{return f({baseURL:e,plugins:[a(),m(),l(),h()]})};import{hc as C}from"hono/client";var S=(e,t)=>{return C(e,{...t,fetch:(r,n)=>(t?.fetch??fetch)(r,{...n,credentials:"include",headers:{...n.headers,"Content-Type":"application/json"}})})};import{hc as y}from"hono/client";var B=(e,t,r)=>{return y(e,{...r,headers:{...r?.headers,"X-Public-Key":t}})};function D(e,t,r){let n=new URL("/login",e);if(t)n.searchParams.set("intent",R(t,r));return n.toString()}function g(...e){}function E(e,t,r,n,o,s,p){g({priceId:t,productId:r,discountCode:n,loginUrl:o,pricingUrl:s,successUrl:p});let i=new URL("/auth/checkout",e);if(i.searchParams.set("priceId",t),i.searchParams.set("productId",r),n)i.searchParams.set("discountCode",n);if(o)i.searchParams.set("loginUrl",o);if(s)i.searchParams.set("pricingUrl",s);if(p)i.searchParams.set("successUrl",p);return i.toString()}function R(e,t){return JSON.stringify({type:"redirect",redirectUrl:e,appName:t})}export{T as makeUsBetterAuthClient,R as makeRedirectIntent,P as makePublicClient,B as makeMailingListClient,D as makeLoginUrl,E as makeCheckoutUrl,S as makeCheckoutClient,A as makeAppClient};
2
2
 
3
- //# debugId=F9376091D0570D8C64756E2164756E21
3
+ //# debugId=007B2F935D38AB1064756E2164756E21
4
4
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/utils/intent.ts"],
3
+ "sources": ["../../src/clients/publicClient.ts", "../../src/clients/appClient.ts", "../../src/clients/authClient.ts", "../../src/clients/checkoutClient.ts", "../../src/clients/mailingListClient.ts", "../../src/utils/intent.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { PublicRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type PublicClient = ReturnType<typeof hc<PublicRouter>>;\n\nexport const makePublicClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): PublicClient => {\n return hc<PublicRouter>(baseURL, options);\n};\n",
6
6
  "import type { AppRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type AppClient = ReturnType<typeof hc<AppRouter>>;\n\nexport const makeAppClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): AppClient => {\n return hc<AppRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
7
7
  "import {\n customSessionClient,\n magicLinkClient,\n emailOTPClient,\n passkeyClient,\n} from \"better-auth/client/plugins\";\nimport { createAuthClient } from \"better-auth/react\";\nimport type { Auth } from \"@us-accounts/api\";\n\nexport const makeUsBetterAuthClient = (baseURL: string) => {\n return createAuthClient({\n baseURL,\n plugins: [\n customSessionClient<Auth>(),\n magicLinkClient(),\n emailOTPClient(),\n passkeyClient(),\n ],\n });\n};\n",
8
8
  "import type { CheckoutRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;\n\nexport const makeCheckoutClient = (\n baseURL: string,\n options?: ClientRequestOptions,\n): CheckoutClient => {\n return hc<CheckoutRouter>(baseURL, {\n ...options,\n fetch: (url: any, init: any) =>\n (options?.fetch ?? fetch)(url, {\n ...init,\n credentials: \"include\",\n headers: {\n ...init.headers,\n \"Content-Type\": \"application/json\",\n },\n }),\n });\n};\n",
9
+ "import type { MailingListRouter } from \"@us-accounts/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;\n\nexport const makeMailingListClient = (\n baseURL: string,\n publicKey: string,\n options?: ClientRequestOptions,\n): MailingListClient => {\n return hc<MailingListRouter>(baseURL, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-Public-Key\": publicKey,\n },\n });\n};\n",
9
10
  "import type { CheckoutSearch, RedirectIntent } from \"@us-accounts/utils\";\n\nexport function makeLoginUrl(\n apiUrl: string,\n redirectUrl?: string,\n appName?: string,\n) {\n const url = new URL(\"/login\", apiUrl);\n if (redirectUrl) {\n url.searchParams.set(\"intent\", makeRedirectIntent(redirectUrl, appName));\n }\n return url.toString();\n}\n\nfunction noop(...args: any[]) {\n // Do nothing\n}\n\nexport function makeCheckoutUrl(\n apiUrl: string,\n priceId: string,\n productId: string,\n discountCode?: string,\n loginUrl?: string,\n pricingUrl?: string,\n successUrl?: string,\n) {\n const obj = {\n priceId,\n productId,\n discountCode,\n loginUrl,\n pricingUrl,\n successUrl,\n } satisfies CheckoutSearch;\n noop(obj);\n\n const url = new URL(\"/auth/checkout\", apiUrl);\n url.searchParams.set(\"priceId\", priceId);\n url.searchParams.set(\"productId\", productId);\n if (discountCode) {\n url.searchParams.set(\"discountCode\", discountCode);\n }\n if (loginUrl) {\n url.searchParams.set(\"loginUrl\", loginUrl);\n }\n if (pricingUrl) {\n url.searchParams.set(\"pricingUrl\", pricingUrl);\n }\n if (successUrl) {\n url.searchParams.set(\"successUrl\", successUrl);\n }\n return url.toString();\n}\n\nexport function makeRedirectIntent(\n redirectUrl: string,\n appName?: string,\n): string {\n const obj = {\n type: \"redirect\",\n redirectUrl,\n appName,\n } satisfies RedirectIntent;\n\n return JSON.stringify(obj);\n}\n"
10
11
  ],
11
- "mappings": "AACA,aAAS,oBAIF,IAAM,EAAmB,CAC9B,EACA,IACiB,CACjB,OAAO,EAAiB,EAAS,CAAO,GCR1C,aAAS,oBAIF,IAAM,EAAgB,CAC3B,EACA,IACc,CACd,OAAO,EAAc,EAAS,IACzB,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EAAK,IAC1B,EACH,YAAa,UACb,QAAS,IACJ,EAAK,QACR,eAAgB,kBAClB,CACF,CAAC,CACL,CAAC,GCpBH,8BACE,qBACA,oBACA,mBACA,mCAEF,2BAAS,0BAGF,IAAM,EAAyB,CAAC,IAAoB,CACzD,OAAO,EAAiB,CACtB,UACA,QAAS,CACP,EAA0B,EAC1B,EAAgB,EAChB,EAAe,EACf,EAAc,CAChB,CACF,CAAC,GCjBH,aAAS,oBAIF,IAAM,EAAqB,CAChC,EACA,IACmB,CACnB,OAAO,EAAmB,EAAS,IAC9B,EACH,MAAO,CAAC,EAAU,KACf,GAAS,OAAS,OAAO,EA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D38AB1064756E2164756E21",
13
14
  "names": []
14
15
  }
@@ -8,6 +8,7 @@ import * as undici_types from 'undici-types';
8
8
  import * as better_auth from 'better-auth';
9
9
  import * as _better_fetch_fetch from '@better-fetch/fetch';
10
10
  import * as better_auth_plugins_passkey from 'better-auth/plugins/passkey';
11
+ import * as hono_types from 'hono/types';
11
12
 
12
13
  declare const checkoutRouter: hono_hono_base.HonoBase<{
13
14
  Variables: {
@@ -246,6 +247,114 @@ declare const publicRouter: hono_hono_base.HonoBase<{
246
247
  }, "/">;
247
248
  type PublicRouter = typeof publicRouter;
248
249
 
250
+ declare const mailingListRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, {
251
+ "/subscribe": {
252
+ $post: {
253
+ input: {
254
+ json: {
255
+ email: string;
256
+ userGroup: string;
257
+ callbackUrl: string;
258
+ };
259
+ };
260
+ output: "Unauthorized";
261
+ outputFormat: "text";
262
+ status: 401;
263
+ } | {
264
+ input: {
265
+ json: {
266
+ email: string;
267
+ userGroup: string;
268
+ callbackUrl: string;
269
+ };
270
+ };
271
+ output: "Success";
272
+ outputFormat: "text";
273
+ status: 200;
274
+ } | {
275
+ input: {
276
+ json: {
277
+ email: string;
278
+ userGroup: string;
279
+ callbackUrl: string;
280
+ };
281
+ };
282
+ output: "Could not send email";
283
+ outputFormat: "text";
284
+ status: 500;
285
+ } | {
286
+ input: {
287
+ json: {
288
+ email: string;
289
+ userGroup: string;
290
+ callbackUrl: string;
291
+ };
292
+ };
293
+ output: "Contact already subscribed";
294
+ outputFormat: "text";
295
+ status: 400;
296
+ };
297
+ };
298
+ } & {
299
+ "/opt-in": {
300
+ $get: {
301
+ input: {
302
+ query: {
303
+ code: string;
304
+ email: string;
305
+ };
306
+ };
307
+ output: undefined;
308
+ outputFormat: "redirect";
309
+ status: 302;
310
+ } | {
311
+ input: {
312
+ query: {
313
+ code: string;
314
+ email: string;
315
+ };
316
+ };
317
+ output: "Invalid opt-in token";
318
+ outputFormat: "text";
319
+ status: 400;
320
+ } | {
321
+ input: {
322
+ query: {
323
+ code: string;
324
+ email: string;
325
+ };
326
+ };
327
+ output: "Contact does not exist";
328
+ outputFormat: "text";
329
+ status: 400;
330
+ } | {
331
+ input: {
332
+ query: {
333
+ code: string;
334
+ email: string;
335
+ };
336
+ };
337
+ output: "Could not opt in contact";
338
+ outputFormat: "text";
339
+ status: 500;
340
+ };
341
+ };
342
+ } & {
343
+ "/unsubscribe": {
344
+ $post: {
345
+ input: {
346
+ query: {
347
+ email: string;
348
+ };
349
+ };
350
+ output: "Success";
351
+ outputFormat: "text";
352
+ status: 200;
353
+ };
354
+ };
355
+ }, "/">;
356
+ type MailingListRouter = typeof mailingListRouter;
357
+
249
358
  type PublicClient = ReturnType<typeof hc<PublicRouter>>;
250
359
  declare const makePublicClient: (baseURL: string, options?: ClientRequestOptions) => PublicClient;
251
360
 
@@ -3432,9 +3541,12 @@ declare const makeUsBetterAuthClient: (baseURL: string) => {
3432
3541
  type CheckoutClient = ReturnType<typeof hc<CheckoutRouter>>;
3433
3542
  declare const makeCheckoutClient: (baseURL: string, options?: ClientRequestOptions) => CheckoutClient;
3434
3543
 
3544
+ type MailingListClient = ReturnType<typeof hc<MailingListRouter>>;
3545
+ declare const makeMailingListClient: (baseURL: string, publicKey: string, options?: ClientRequestOptions) => MailingListClient;
3546
+
3435
3547
  declare function makeLoginUrl(apiUrl: string, redirectUrl?: string, appName?: string): string;
3436
3548
  declare function makeCheckoutUrl(apiUrl: string, priceId: string, productId: string, discountCode?: string, loginUrl?: string, pricingUrl?: string, successUrl?: string): string;
3437
3549
  declare function makeRedirectIntent(redirectUrl: string, appName?: string): string;
3438
3550
 
3439
- export { makeAppClient, makeCheckoutClient, makeCheckoutUrl, makeLoginUrl, makePublicClient, makeRedirectIntent, makeUsBetterAuthClient };
3440
- export type { AppClient, CheckoutClient, PublicClient };
3551
+ export { makeAppClient, makeCheckoutClient, makeCheckoutUrl, makeLoginUrl, makeMailingListClient, makePublicClient, makeRedirectIntent, makeUsBetterAuthClient };
3552
+ export type { AppClient, CheckoutClient, MailingListClient, PublicClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uninspired/auth-client",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Auth client for Uninspired Studio Products",
5
5
  "author": "Chris Kolb <chris@uninspired.studio>",
6
6
  "license": "MIT",